ordering-ui-external 2.4.5 → 2.5.0

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 (135) hide show
  1. package/_bundles/{0.ordering-ui.83ddb51fdc85c2b920b0.js → 0.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  2. package/_bundles/{1.ordering-ui.83ddb51fdc85c2b920b0.js → 1.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  3. package/_bundles/{2.ordering-ui.83ddb51fdc85c2b920b0.js → 2.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  4. package/_bundles/{4.ordering-ui.83ddb51fdc85c2b920b0.js → 4.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  5. package/_bundles/{5.ordering-ui.83ddb51fdc85c2b920b0.js → 5.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  6. package/_bundles/{6.ordering-ui.83ddb51fdc85c2b920b0.js → 6.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  7. package/_bundles/{7.ordering-ui.83ddb51fdc85c2b920b0.js → 7.ordering-ui.5657c6a53b3791887fd7.js} +2 -2
  8. package/_bundles/{8.ordering-ui.83ddb51fdc85c2b920b0.js → 8.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  9. package/_bundles/{9.ordering-ui.83ddb51fdc85c2b920b0.js → 9.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
  10. package/_bundles/ordering-ui.5657c6a53b3791887fd7.js +2 -0
  11. package/_modules/components/OrdersOption/styles.js +1 -1
  12. package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +15 -8
  13. package/_modules/components/VerticalOrdersLayout/styles.js +2 -2
  14. package/_modules/contexts/ThemeContext/index.js +1 -0
  15. package/_modules/themes/five/src/components/AddressList/index.js +8 -7
  16. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +28 -22
  17. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +22 -21
  18. package/_modules/themes/five/src/components/BusinessController/index.js +5 -3
  19. package/_modules/themes/five/src/components/BusinessInformation/index.js +16 -10
  20. package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +5 -8
  21. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +93 -74
  22. package/_modules/themes/five/src/components/BusinessListingSearch/styles.js +10 -4
  23. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +7 -2
  24. package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
  25. package/_modules/themes/five/src/components/BusinessProductsList/index.js +1 -1
  26. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +38 -13
  27. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +20 -9
  28. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +35 -23
  29. package/_modules/themes/five/src/components/Cart/index.js +7 -3
  30. package/_modules/themes/five/src/components/Checkout/index.js +12 -11
  31. package/_modules/themes/five/src/components/Checkout/styles.js +8 -4
  32. package/_modules/themes/five/src/components/GiftCard/GiftCardUI/index.js +1 -0
  33. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +4 -3
  34. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +14 -8
  35. package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +1 -1
  36. package/_modules/themes/five/src/components/Header/index.js +29 -21
  37. package/_modules/themes/five/src/components/Header/styles.js +44 -40
  38. package/_modules/themes/five/src/components/MultiCheckout/index.js +18 -16
  39. package/_modules/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +6 -4
  40. package/_modules/themes/five/src/components/MyOrders/index.js +16 -10
  41. package/_modules/themes/five/src/components/MyOrders/styles.js +15 -12
  42. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +5 -2
  43. package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +2 -2
  44. package/_modules/themes/five/src/components/OrderDetails/index.js +2 -2
  45. package/_modules/themes/five/src/components/OrderItAgain/styles.js +1 -1
  46. package/_modules/themes/five/src/components/OrderProgress/index.js +15 -4
  47. package/_modules/themes/five/src/components/OrderTypeSelectorContent/index.js +16 -4
  48. package/_modules/themes/five/src/components/PageBanner/styles.js +1 -1
  49. package/_modules/themes/five/src/components/ProductForm/index.js +27 -7
  50. package/_modules/themes/five/src/components/ProductForm/styles.js +40 -31
  51. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +6 -6
  52. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -3
  53. package/_modules/themes/five/src/components/ReviewProduct/index.js +9 -4
  54. package/_modules/themes/five/src/components/ServiceForm/index.js +22 -3
  55. package/_modules/themes/five/src/components/ServiceForm/styles.js +9 -3
  56. package/_modules/themes/five/src/components/SidebarMenu/index.js +19 -10
  57. package/_modules/themes/five/src/components/SignUpForm/index.js +56 -29
  58. package/_modules/themes/five/src/components/SingleOrderCard/index.js +1 -1
  59. package/_modules/themes/five/src/components/SingleOrderCard/styles.js +26 -24
  60. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +9 -5
  61. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
  62. package/_modules/themes/five/src/components/UpsellingPage/index.js +2 -1
  63. package/_modules/themes/five/src/components/UserFormDetails/index.js +58 -18
  64. package/_modules/themes/five/src/components/UserFormDetails/styles.js +7 -3
  65. package/_modules/themes/five/src/components/UserPopover/index.js +41 -25
  66. package/_modules/themes/five/src/components/UserProfileForm/index.js +19 -11
  67. package/_modules/themes/five/src/styles/Buttons/index.js +68 -58
  68. package/_modules/themes/five/src/styles/Inputs/index.js +40 -16
  69. package/_modules/utils/index.js +8 -2
  70. package/index.html +1 -1
  71. package/package.json +3 -2
  72. package/src/components/OrdersOption/styles.js +1 -0
  73. package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +35 -17
  74. package/src/components/VerticalOrdersLayout/styles.js +9 -0
  75. package/src/contexts/ThemeContext/index.js +1 -0
  76. package/src/themes/five/src/components/AddressList/index.js +6 -6
  77. package/src/themes/five/src/components/BusinessBasicInformation/index.js +24 -22
  78. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +24 -3
  79. package/src/themes/five/src/components/BusinessController/index.js +4 -2
  80. package/src/themes/five/src/components/BusinessInformation/index.js +24 -12
  81. package/src/themes/five/src/components/BusinessItemAccordion/index.js +5 -6
  82. package/src/themes/five/src/components/BusinessListingSearch/index.js +127 -101
  83. package/src/themes/five/src/components/BusinessListingSearch/styles.js +15 -0
  84. package/src/themes/five/src/components/BusinessProductsCategories/index.js +7 -2
  85. package/src/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
  86. package/src/themes/five/src/components/BusinessProductsList/index.js +1 -1
  87. package/src/themes/five/src/components/BusinessProductsListing/index.js +34 -9
  88. package/src/themes/five/src/components/BusinessProductsListing/styles.js +26 -0
  89. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +9 -2
  90. package/src/themes/five/src/components/Cart/index.js +3 -4
  91. package/src/themes/five/src/components/Checkout/index.js +18 -4
  92. package/src/themes/five/src/components/Checkout/styles.js +22 -0
  93. package/src/themes/five/src/components/GiftCard/GiftCardUI/index.js +1 -0
  94. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +41 -31
  95. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +15 -4
  96. package/src/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +2 -2
  97. package/src/themes/five/src/components/Header/index.js +17 -5
  98. package/src/themes/five/src/components/Header/styles.js +9 -6
  99. package/src/themes/five/src/components/MultiCheckout/index.js +9 -10
  100. package/src/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +8 -5
  101. package/src/themes/five/src/components/MyOrders/index.js +13 -9
  102. package/src/themes/five/src/components/MyOrders/styles.js +3 -1
  103. package/src/themes/five/src/components/OrderDetails/OrderEta.js +3 -2
  104. package/src/themes/five/src/components/OrderDetails/OrderHistory.js +8 -2
  105. package/src/themes/five/src/components/OrderDetails/index.js +2 -2
  106. package/src/themes/five/src/components/OrderItAgain/styles.js +1 -1
  107. package/src/themes/five/src/components/OrderProgress/index.js +16 -5
  108. package/src/themes/five/src/components/OrderTypeSelectorContent/index.js +7 -4
  109. package/src/themes/five/src/components/PageBanner/styles.js +1 -4
  110. package/src/themes/five/src/components/ProductForm/index.js +23 -5
  111. package/src/themes/five/src/components/ProductForm/styles.js +36 -1
  112. package/src/themes/five/src/components/ProductItemAccordion/index.js +37 -29
  113. package/src/themes/five/src/components/RenderProductsLayout/index.js +3 -3
  114. package/src/themes/five/src/components/ReviewProduct/index.js +14 -6
  115. package/src/themes/five/src/components/ServiceForm/index.js +22 -4
  116. package/src/themes/five/src/components/ServiceForm/styles.js +16 -0
  117. package/src/themes/five/src/components/SidebarMenu/index.js +162 -144
  118. package/src/themes/five/src/components/SignUpForm/index.js +4 -3
  119. package/src/themes/five/src/components/SingleOrderCard/index.js +1 -1
  120. package/src/themes/five/src/components/SingleOrderCard/styles.js +9 -1
  121. package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +13 -3
  122. package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
  123. package/src/themes/five/src/components/UpsellingPage/index.js +1 -1
  124. package/src/themes/five/src/components/UserFormDetails/index.js +58 -14
  125. package/src/themes/five/src/components/UserFormDetails/styles.js +16 -0
  126. package/src/themes/five/src/components/UserPopover/index.js +26 -15
  127. package/src/themes/five/src/components/UserProfileForm/index.js +18 -9
  128. package/src/themes/five/src/styles/Buttons/index.js +11 -0
  129. package/src/themes/five/src/styles/Inputs/index.js +34 -0
  130. package/src/utils/index.js +5 -0
  131. package/template/app.js +5 -3
  132. package/template/theme.json +335 -24
  133. package/_bundles/ordering-ui.83ddb51fdc85c2b920b0.js +0 -2
  134. /package/_bundles/{7.ordering-ui.83ddb51fdc85c2b920b0.js.LICENSE.txt → 7.ordering-ui.5657c6a53b3791887fd7.js.LICENSE.txt} +0 -0
  135. /package/_bundles/{ordering-ui.83ddb51fdc85c2b920b0.js.LICENSE.txt → ordering-ui.5657c6a53b3791887fd7.js.LICENSE.txt} +0 -0
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useEffect } from 'react'
2
2
  import TiArrowSortedUp from '@meronex/icons/ti/TiArrowSortedUp'
3
- import { useOrder, useLanguage, useEvent, useUtils, useConfig, useOrderingTheme } from 'ordering-components-external'
3
+ import { useOrder, useLanguage, useEvent, useUtils, useConfig } from 'ordering-components-external'
4
4
  import { useTheme } from 'styled-components'
5
5
  import FiClock from '@meronex/icons/fi/FiClock'
6
6
  import {
@@ -49,7 +49,6 @@ export const BusinessItemAccordion = (props) => {
49
49
  const [{ parsePrice }] = useUtils()
50
50
  const [{ configs }] = useConfig()
51
51
  const theme = useTheme()
52
- const [orderingTheme] = useOrderingTheme()
53
52
  const [setActive, setActiveState] = useState('')
54
53
  const [setHeight, setHeightState] = useState('0px')
55
54
  const [setRotate, setRotateState] = useState('accordion__icon')
@@ -63,8 +62,8 @@ export const BusinessItemAccordion = (props) => {
63
62
  const changeStore = useRef(null)
64
63
 
65
64
  const viewString = isStore ? 'business_view' : 'header'
66
- const showBusinessLogo = !orderingTheme?.theme?.[viewString]?.components?.cart?.components?.business?.components?.logo?.hidden
67
- const showBusinessTime = !orderingTheme?.theme?.[viewString]?.components?.cart?.components?.business?.components?.time?.hidden
65
+ const hideBusinessLogo = theme?.[viewString]?.components?.cart?.components?.business?.components?.logo?.hidden
66
+ const hideBusinessTime = theme?.[viewString]?.components?.cart?.components?.business?.components?.time?.hidden
68
67
 
69
68
  const toggleAccordion = (e) => {
70
69
  const isActionsClick = businessStore.current?.contains(e?.target) || businessDelete.current?.contains(e?.target) || changeStore.current?.contains(e?.target)
@@ -146,14 +145,14 @@ export const BusinessItemAccordion = (props) => {
146
145
  onClick={(e) => toggleAccordion(e)}
147
146
  >
148
147
  <BusinessInfo>
149
- {!showBusinessLogo && (
148
+ {!hideBusinessLogo && (
150
149
  <WrapperBusinessLogo>
151
150
  <BusinessLogo bgimage={business?.logo || theme.images?.dummies?.businessLogo} />
152
151
  </WrapperBusinessLogo>
153
152
  )}
154
153
  <ContentInfo className='info' isStore={isStore}>
155
154
  <h2>{business?.name}</h2>
156
- {!showBusinessTime && (
155
+ {!hideBusinessTime && (
157
156
  <TimeContainer>
158
157
  {orderState?.options?.type === 1 ? (
159
158
  <span>
@@ -32,10 +32,11 @@ import {
32
32
  NoResult,
33
33
  PriceFilterWrapper,
34
34
  PriceFilterListWrapper,
35
- PreviouslyOrderedContainer
35
+ PreviouslyOrderedContainer,
36
+ SearchBarContainer
36
37
  } from './styles'
37
38
  import Skeleton from 'react-loading-skeleton'
38
- import { Check2, XLg as Close } from 'react-bootstrap-icons'
39
+ import { Check2, XLg as Close, Funnel } from 'react-bootstrap-icons'
39
40
  import { SearchBar } from '../SearchBar'
40
41
  import { useLanguage, useOrder, useUtils, useSession, BusinessSearchList, useConfig } from 'ordering-components-external'
41
42
  import { BusinessController } from '../BusinessController'
@@ -79,6 +80,7 @@ export const BusinessListingSearchUI = (props) => {
79
80
  const [, t] = useLanguage()
80
81
  const theme = useTheme()
81
82
  const [curProduct, setCurProduct] = useState({ business: null, product: null })
83
+ const [openFilter, setOpenFilter] = useState(false)
82
84
  const [{ parsePrice, optimizeImage, parseDistance }] = useUtils()
83
85
  const [{ auth }] = useSession()
84
86
  const { width } = useWindowSize()
@@ -105,7 +107,6 @@ export const BusinessListingSearchUI = (props) => {
105
107
  const noResults = (!businessesSearchList.loading && !businessesSearchList.lengthError && businessesSearchList?.businesses?.length === 0)
106
108
  const currentCart = Object.values(orderState?.carts).find(cart => cart?.business?.slug === curProduct?.business?.slug) ?? {}
107
109
 
108
-
109
110
  const handleScroll = useCallback(() => {
110
111
  const innerHeightScrolltop = window.innerHeight + document.documentElement?.scrollTop + PIXELS_TO_SCROLL
111
112
  const badScrollPosition = innerHeightScrolltop < document.documentElement?.offsetHeight
@@ -144,114 +145,130 @@ export const BusinessListingSearchUI = (props) => {
144
145
  return () => window.removeEventListener('scroll', handleScroll)
145
146
  }, [handleScroll])
146
147
 
147
- return (
148
- <BusinessListingSearchContainer>
149
- <BusinessesTitle>
150
- {t('SEARCH', 'Search')}
151
- </BusinessesTitle>
152
- <SearchBar
153
- lazyLoad
154
- isCustomLayout
155
- forceFocus
156
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('PLEASE_TYPE_AT_LEAST_3_CHARACTERS', 'Please type at least 3 characters')}`}
157
- onSearch={(val) => handleChangeTermValue(val)}
158
- search={termValue}
159
- />
160
- <FiltersContainer>
161
- <Filters>
162
- <SortContainer>
163
- <FilterAccordion title={t('SORT', 'Sort')}>
164
- {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
165
- <SortItem
166
- key={item?.value}
167
- onClick={() => handleChangeFilters('orderBy', item?.value)}
168
- active={filters?.orderBy?.includes(item?.value)}
148
+ const filtersComponent = () => {
149
+ return (
150
+ <Filters>
151
+ <SortContainer>
152
+ <FilterAccordion title={t('SORT', 'Sort')}>
153
+ {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
154
+ <SortItem
155
+ key={item?.value}
156
+ onClick={() => handleChangeFilters('orderBy', item?.value)}
157
+ active={filters?.orderBy?.includes(item?.value)}
158
+ >
159
+ {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <BisUpArrow /> : <BisDownArrow />}</>}
160
+ </SortItem>
161
+ ))}
162
+ </FilterAccordion>
163
+ </SortContainer>
164
+ <BrandContainer>
165
+ <FilterAccordion title={t('BRANDS', 'Brands')}>
166
+ <BrandListWrapper>
167
+ {brandList?.loading && (
168
+ <>
169
+ {[...Array(5).keys()].map(index => (
170
+ <BrandItem key={index}>
171
+ <Skeleton width={120} height={15} />
172
+ <Skeleton width={16} height={16} />
173
+ </BrandItem>
174
+ ))}
175
+ </>
176
+ )}
177
+ {!brandList?.loading && brandList?.brands.map((brand, i) => brand?.enabled && (
178
+ <BrandItem key={i} onClick={() => handleChangeBrandFilter(brand?.id)}>
179
+ <span>{brand?.name}</span>
180
+ {filters?.franchise_ids?.includes(brand?.id) && <Check2 />}
181
+ </BrandItem>
182
+ ))}
183
+ {!brandList?.loading && ((brandList?.brands?.filter(brand => brand?.enabled))?.length === 0) && (
184
+ <NoResult>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</NoResult>
185
+ )}
186
+ </BrandListWrapper>
187
+ </FilterAccordion>
188
+ </BrandContainer>
189
+ <PriceFilterWrapper>
190
+ <FilterAccordion title={t('PRICE_RANGE', 'Price range')}>
191
+ <PriceFilterListWrapper>
192
+ {priceList.map((price, i) => (
193
+ <Button
194
+ key={i}
195
+ color={(filters?.price_level === price?.level) ? 'primary' : 'lightGray'}
196
+ onClick={() => handleChangePriceRange(price?.level)}
169
197
  >
170
- {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <BisUpArrow /> : <BisDownArrow />}</>}
171
- </SortItem>
198
+ {price.content}
199
+ {(filters?.price_level === price?.level) && <Close />}
200
+ </Button>
172
201
  ))}
173
- </FilterAccordion>
174
- </SortContainer>
175
- <BrandContainer>
176
- <FilterAccordion title={t('BRANDS', 'Brands')}>
177
- <BrandListWrapper>
178
- {brandList?.loading && (
179
- <>
180
- {[...Array(5).keys()].map(index => (
181
- <BrandItem key={index}>
182
- <Skeleton width={120} height={15} />
183
- <Skeleton width={16} height={16} />
184
- </BrandItem>
185
- ))}
186
- </>
187
- )}
188
- {!brandList?.loading && brandList?.brands.map((brand, i) => brand?.enabled && (
189
- <BrandItem key={i} onClick={() => handleChangeBrandFilter(brand?.id)}>
190
- <span>{brand?.name}</span>
191
- {filters?.franchise_ids?.includes(brand?.id) && <Check2 />}
192
- </BrandItem>
193
- ))}
194
- {!brandList?.loading && ((brandList?.brands?.filter(brand => brand?.enabled))?.length === 0) && (
195
- <NoResult>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</NoResult>
196
- )}
197
- </BrandListWrapper>
198
- </FilterAccordion>
199
- </BrandContainer>
200
- <PriceFilterWrapper>
201
- <FilterAccordion title={t('PRICE_RANGE', 'Price range')}>
202
- <PriceFilterListWrapper>
203
- {priceList.map((price, i) => (
204
- <Button
205
- key={i}
206
- color={(filters?.price_level === price?.level) ? 'primary' : 'lightGray'}
207
- onClick={() => handleChangePriceRange(price?.level)}
208
- >
209
- {price.content}
210
- {(filters?.price_level === price?.level) && <Close />}
211
- </Button>
212
- ))}
213
- </PriceFilterListWrapper>
214
- </FilterAccordion>
215
- </PriceFilterWrapper>
216
- {orderState?.options?.type === 1 && (
217
- <MaxSectionItem
218
- title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
219
- options={maxDeliveryFeeOptions}
220
- filter='max_delivery_price'
221
- filters={filters}
222
- handleChangeFilters={handleChangeFilters}
223
- />
224
- )}
225
- {[1, 2].includes(orderState?.options?.type) && (
226
- <MaxSectionItem
227
- title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
228
- options={maxTimeOptions}
229
- filter='max_eta'
230
- filters={filters}
231
- handleChangeFilters={handleChangeFilters}
232
- />
233
- )}
202
+ </PriceFilterListWrapper>
203
+ </FilterAccordion>
204
+ </PriceFilterWrapper>
205
+ {orderState?.options?.type === 1 && (
234
206
  <MaxSectionItem
235
- title={t('MAX_DISTANCE', 'Max distance')}
236
- options={maxDistanceOptions}
237
- filter='max_distance'
207
+ title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
208
+ options={maxDeliveryFeeOptions}
209
+ filter='max_delivery_price'
238
210
  filters={filters}
239
211
  handleChangeFilters={handleChangeFilters}
240
212
  />
241
- <TagsContainer>
242
- <FilterAccordion title={t('BUSINESS_CATEGORIES', 'Business categories')}>
243
- <BusinessTypeFilter
244
- isSearchMode
245
- filters={filters}
246
- handleChangeFilters={handleChangeFilters}
247
- />
248
- </FilterAccordion>
249
- </TagsContainer>
250
- </Filters>
213
+ )}
214
+ {[1, 2].includes(orderState?.options?.type) && (
215
+ <MaxSectionItem
216
+ title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
217
+ options={maxTimeOptions}
218
+ filter='max_eta'
219
+ filters={filters}
220
+ handleChangeFilters={handleChangeFilters}
221
+ />
222
+ )}
223
+ <MaxSectionItem
224
+ title={t('MAX_DISTANCE', 'Max distance')}
225
+ options={maxDistanceOptions}
226
+ filter='max_distance'
227
+ filters={filters}
228
+ handleChangeFilters={handleChangeFilters}
229
+ />
230
+ <TagsContainer>
231
+ <FilterAccordion title={t('BUSINESS_CATEGORIES', 'Business categories')}>
232
+ <BusinessTypeFilter
233
+ isSearchMode
234
+ filters={filters}
235
+ handleChangeFilters={handleChangeFilters}
236
+ />
237
+ </FilterAccordion>
238
+ </TagsContainer>
239
+ </Filters>
240
+ )
241
+ }
242
+
243
+ return (
244
+ <BusinessListingSearchContainer>
245
+ <BusinessesTitle>
246
+ {t('SEARCH', 'Search')}
247
+ </BusinessesTitle>
248
+ <SearchBarContainer>
249
+ <SearchBar
250
+ lazyLoad
251
+ isCustomLayout
252
+ forceFocus
253
+ placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('PLEASE_TYPE_AT_LEAST_3_CHARACTERS', 'Please type at least 3 characters')}`}
254
+ onSearch={(val) => handleChangeTermValue(val)}
255
+ search={termValue}
256
+ />
257
+ {width <= 768 && (
258
+ <Funnel onClick={() => setOpenFilter(true)} />
259
+ )}
260
+ </SearchBarContainer>
261
+ <FiltersContainer>
262
+ {width > 768 && (
263
+ <>
264
+ {filtersComponent()}
265
+ </>
266
+ )}
251
267
  <FiltersResultContainer>
252
268
  {auth && termValue?.length === 0 && (
253
269
  <PreviouslyOrderedContainer>
254
270
  <MyOrders
271
+ isFromBusinessListingSearch
255
272
  hideOrders
256
273
  businessesSearchList={businessesSearchList}
257
274
  onRedirectPage={onRedirectPage}
@@ -431,6 +448,15 @@ export const BusinessListingSearchUI = (props) => {
431
448
  />
432
449
  )}
433
450
  </Modal>
451
+ {width <= 768 && (
452
+ <Modal
453
+ open={openFilter}
454
+ onClose={() => setOpenFilter(false)}
455
+ title={t('FILTERS', 'Filters')}
456
+ >
457
+ {filtersComponent()}
458
+ </Modal>
459
+ )}
434
460
  </BusinessListingSearchContainer>
435
461
  )
436
462
  }
@@ -48,6 +48,7 @@ export const FiltersContainer = styled.div`
48
48
  export const Filters = styled.div`
49
49
  width: 100%;
50
50
  max-width: 100%;
51
+
51
52
  @media (min-width: 993px){
52
53
  width: 25%;
53
54
  max-width: 25%;
@@ -435,3 +436,17 @@ export const PriceFilterListWrapper = styled.div`
435
436
  export const PreviouslyOrderedContainer = styled.div`
436
437
 
437
438
  `
439
+ export const SearchBarContainer = styled.div`
440
+ display: flex;
441
+ align-items: center;
442
+
443
+ svg {
444
+ font-size: 26px;
445
+ color: ${props => props.theme.colors.primary};
446
+ ${props => props.theme.rtl ? css`
447
+ margin-right: 10px;
448
+ ` : css`
449
+ margin-left: 10px;
450
+ `}
451
+ }
452
+ `
@@ -105,7 +105,12 @@ const BusinessProductsCategoriesUI = (props) => {
105
105
  const navbar = document.getElementById('category-lists')
106
106
  const search = document.getElementById('WrapperSearchAbsolute')
107
107
  const wrapperCategories = document.getElementById('wrapper-categories')
108
- const limit = window.pageYOffset >= wrapperCategories?.offsetTop && window.pageYOffset > 0
108
+ let limit
109
+ if (windowSize.width >= 993) {
110
+ limit = window.pageYOffset >= wrapperCategories?.offsetTop && window.pageYOffset > 0
111
+ } else {
112
+ limit = window.pageYOffset >= (wrapperCategories?.offsetTop - 56) && window.pageYOffset > 0
113
+ }
109
114
 
110
115
  if (limit) {
111
116
  const classAdded = navbar.classList.contains('sticky-prod-cat')
@@ -130,7 +135,7 @@ const BusinessProductsCategoriesUI = (props) => {
130
135
 
131
136
  let style0 = '.sticky-prod-cat {'
132
137
  style0 += 'position: fixed !important;'
133
- style0 += 'top: 0px !important;'
138
+ style0 += `top: ${windowSize.width >= 993 ? '0px' : '56px'} !important;`
134
139
  style0 += 'left: 0px !important;'
135
140
  style0 += 'padding: 5px 5px 0px 5px !important;'
136
141
  style0 += `width: calc(100% - ${useKioskApp ? '50px' : windowSize.width >= 993 ? '155px' : '0px'})!important;`
@@ -5,7 +5,7 @@ export const CategoriesContainer = styled.div`
5
5
  overflow-x: auto;
6
6
  padding: 5px 0px 0px 0px;
7
7
  background: ${props => props.theme.colors.backgroundPage};
8
- z-index: 1002;
8
+ z-index: 1000;
9
9
  position: absolute;
10
10
  top: 0;
11
11
  border-bottom: 1px solid #D9D9D9;
@@ -87,7 +87,7 @@ const BusinessProductsListUI = (props) => {
87
87
  onClick={() => onClickSubcategory(null, category)}
88
88
  color={allsubcategorySelected ? 'primary' : 'lightGray'}
89
89
  >
90
- {t('ALL', 'All')} {allsubcategorySelected && <Close />}
90
+ {t('ALL', 'All')}
91
91
  </Button>
92
92
  </ContainerButton>
93
93
  {category?.subcategories?.map(subcategory => {
@@ -14,8 +14,8 @@ import {
14
14
  useUtils,
15
15
  useSession,
16
16
  useSite,
17
- useOrderingTheme,
18
- useConfig
17
+ useConfig,
18
+ useBusiness
19
19
  } from 'ordering-components-external'
20
20
 
21
21
  import {
@@ -90,14 +90,14 @@ const BusinessProductsListingUI = (props) => {
90
90
  const [{ configs }] = useConfig()
91
91
  const theme = useTheme()
92
92
  const [, t] = useLanguage()
93
- const [{ carts }, { addProduct, updateProduct }] = useOrder()
93
+ const [{ carts, options }, { addProduct, updateProduct }] = useOrder()
94
94
  const [{ parsePrice }] = useUtils()
95
95
  const [events] = useEvent()
96
96
  const location = useLocation()
97
97
  const windowSize = useWindowSize()
98
98
  const [{ auth }] = useSession()
99
99
  const [{ site }] = useSite()
100
- const [orderingTheme] = useOrderingTheme()
100
+ const [, { setBusiness }] = useBusiness()
101
101
  const [openProduct, setModalIsOpen] = useState(false)
102
102
  const [curProduct, setCurProduct] = useState(props.product)
103
103
  const [openUpselling, setOpenUpselling] = useState(false)
@@ -113,7 +113,9 @@ const BusinessProductsListingUI = (props) => {
113
113
  const checkoutMultiBusinessEnabled = configs?.checkout_multi_business_enabled?.value === '1'
114
114
  const currentCart = Object.values(carts).find(cart => cart?.business?.slug === business?.slug) ?? {}
115
115
  const isLazy = businessState?.business?.lazy_load_products_recommended
116
- const showViewOrderButton = !orderingTheme?.theme?.business_view?.components?.order_view_button?.hidden
116
+ const showViewOrderButton = !theme?.business_view?.components?.order_view_button?.hidden
117
+ const cateringTypes = [7, 8]
118
+ const cateringPreorder = cateringTypes.includes(options?.type)
117
119
  const sortByOptions = [
118
120
  { value: null, content: t('SORT_BY', theme?.defaultLanguages?.SORT_BY || 'Sort By'), showOnSelected: t('SORT_BY', theme?.defaultLanguages?.SORT_BY || 'Sort By') },
119
121
  { value: 'rank', content: t('RANK', theme?.defaultLanguages?.RANK || 'Rank'), showOnSelected: t('RANK', theme?.defaultLanguages?.RANK || 'Rank') },
@@ -187,12 +189,23 @@ const BusinessProductsListingUI = (props) => {
187
189
  }
188
190
 
189
191
  const handleScroll = useCallback(() => {
192
+ const backArrowElement = document.getElementById('back-arrow')
193
+ if (backArrowElement) {
194
+ const limit = window.pageYOffset >= backArrowElement?.offsetTop && window.pageYOffset > 0
195
+ if (limit && windowSize.width < 993) {
196
+ const classAdded = backArrowElement.classList.contains('fixed-arrow')
197
+ !classAdded && backArrowElement.classList.add('fixed-arrow')
198
+ } else {
199
+ backArrowElement && backArrowElement.classList.remove('fixed-arrow')
200
+ }
201
+ }
202
+
190
203
  const innerHeightScrolltop = window.innerHeight + document.documentElement?.scrollTop + PIXELS_TO_SCROLL
191
204
  const badScrollPosition = innerHeightScrolltop < document.documentElement?.offsetHeight
192
205
  const hasMore = !(categoryState.pagination.totalPages === categoryState.pagination.currentPage)
193
206
  if (badScrollPosition || categoryState.loading || !hasMore) return
194
207
  getNextProducts({ isNextPage: true })
195
- }, [categoryState])
208
+ }, [categoryState, windowSize.width])
196
209
 
197
210
  const handleChangePage = (data) => {
198
211
  if (Object.entries(data.query).length === 0 && openProduct) {
@@ -300,14 +313,25 @@ const BusinessProductsListingUI = (props) => {
300
313
  }
301
314
  }, [currentCart])
302
315
 
316
+ useEffect(() => {
317
+ if (cateringPreorder) {
318
+ setBusiness(business)
319
+ }
320
+ return () => {
321
+ setBusiness({})
322
+ }
323
+ }, [cateringPreorder, business])
324
+
303
325
  return (
304
326
  <>
305
327
  <ProductsContainer>
306
328
  {!props.useKioskApp && (
307
329
  <HeaderContent>
308
- {!location.pathname.includes('/marketplace') &&
309
- <ArrowLeft className='back-arrow' onClick={() => handleGoToBusinessList()} />
310
- }
330
+ {!location.pathname.includes('/marketplace') && (
331
+ <div id='back-arrow'>
332
+ <ArrowLeft className='back-arrow' onClick={() => handleGoToBusinessList()} />
333
+ </div>
334
+ )}
311
335
  {windowSize?.width < 576 && (
312
336
  <OrderContextUIWrapper>
313
337
  <OrderContextUI isCheckOut />
@@ -432,6 +456,7 @@ const BusinessProductsListingUI = (props) => {
432
456
  isProducts={currentCart.products.length}
433
457
  isCartOnProductsList={isCartOnProductsList}
434
458
  handleCartOpen={(val) => setIsCartOpen(val)}
459
+ businessConfigs={business?.configs}
435
460
  />
436
461
  </>
437
462
  ) : (
@@ -3,6 +3,16 @@ import styled, { css } from 'styled-components'
3
3
  export const ProductsContainer = styled.div`
4
4
  width: 95%;
5
5
  margin: 20px auto 0px;
6
+ > svg {
7
+ color: ${props => props.theme.colors.headingColor};
8
+ font-size: 24px;
9
+ cursor: pointer;
10
+ margin-bottom: 5px;
11
+ }
12
+ > div {
13
+ background-color: ${({ theme }) => theme?.business_view?.components?.style?.backgroundColor};
14
+ }
15
+
6
16
  `
7
17
 
8
18
  export const ProductLoading = styled.div`
@@ -138,6 +148,22 @@ export const HeaderContent = styled.div`
138
148
  font-size: 24px;
139
149
  cursor: pointer;
140
150
  }
151
+ .fixed-arrow {
152
+ position: fixed;
153
+ top: 0;
154
+ left: 0;
155
+ z-index: 1001;
156
+ width: 100vw;
157
+ background-color: ${props => props.theme.colors.backgroundPage};
158
+ height: 56px;
159
+ display: flex;
160
+ align-items: center;
161
+ ${props => props.theme?.rtl ? css`
162
+ padding-right: 10px;
163
+ ` : css`
164
+ padding-left: 10px;
165
+ `}
166
+ }
141
167
  `
142
168
  export const OrderContextUIWrapper = styled.div`
143
169
  flex: 1;
@@ -87,7 +87,8 @@ const BusinessesListingUI = (props) => {
87
87
  const [hasHighRatedBusiness, setHasHighRatedBusiness] = useState(true)
88
88
  const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
89
89
  const [favoriteIds, setFavoriteIds] = useState([])
90
- const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
90
+ const allCitiesDisabled = citiesState?.cities?.every(city => !city.enabled)
91
+ const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
91
92
  const hideSearch = theme?.business_listing_view?.components?.search?.hidden
92
93
  const hideFilter = theme?.business_listing_view?.components?.filter?.hidden || hideSearch
93
94
  const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
@@ -186,6 +187,12 @@ const BusinessesListingUI = (props) => {
186
187
  setFavoriteIds([...new Set(ids)])
187
188
  }, [businessesList?.businesses?.length])
188
189
 
190
+ useEffect(() => {
191
+ if (!citiesState?.cities?.length || !orderState?.options?.city_id) return
192
+ const selectedCity = citiesState?.cities?.find(city => city?.id === orderState?.options?.city_id)
193
+ if (!selectedCity || !selectedCity?.enabled) changeCityFilter(null)
194
+ }, [citiesState, orderState?.options?.city_id])
195
+
189
196
  if (logosLayout) {
190
197
  return (
191
198
  <BusinessLogosWrapper>
@@ -218,7 +225,7 @@ const BusinessesListingUI = (props) => {
218
225
  {(windowSize.width < 576 || (configs?.business_listing_hide_image?.value !== '1' && !isChew)) && (
219
226
  <BusinessBanner>
220
227
  {windowSize.width < 576 && (
221
- <OrderContextUI isBusinessList hideHero={!hideHero} />
228
+ <OrderContextUI isBusinessList hideHero={(!!configs?.business_listing_hide_image?.value && !hideHero)} />
222
229
  )}
223
230
  {(configs?.business_listing_hide_image?.value !== '1' && !isChew) && !hideHero && (
224
231
  <BusinessHeroImg
@@ -135,9 +135,8 @@ const CartUI = (props) => {
135
135
  }
136
136
  }
137
137
 
138
- const loyaltyRewardValue = ((
139
- Math.trunc(((cart?.subtotal + getIncludedTaxes()) * loyaltyRewardRate) * 100) / 100
140
- ).toFixed(configs.format_number_decimal_length?.value ?? 2), 10)
138
+ const clearAmount = (value) => parseFloat((Math.trunc(value * 100) / 100).toFixed(configs.format_number_decimal_length?.value ?? 2))
139
+ const loyaltyRewardValue = clearAmount((cart?.subtotal + getIncludedTaxes()) * loyaltyRewardRate)
141
140
 
142
141
  const momentFormatted = !orderState?.option?.moment
143
142
  ? t('RIGHT_NOW', 'Right Now')
@@ -511,7 +510,7 @@ const CartUI = (props) => {
511
510
  <td>{t('TOTAL', 'Total')}</td>
512
511
  <td>{parsePrice(cart?.total >= 0 ? cart?.total : 0)}</td>
513
512
  </tr>
514
- {!!loyaltyRewardValue && isFinite(loyaltyRewardValue) && !isMultiCheckout && (
513
+ {!!loyaltyRewardValue && isFinite(loyaltyRewardValue) && isCheckout && (
515
514
  <tr>
516
515
  <td>&nbsp;</td>
517
516
  <td id='loyalty'>{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}</td>
@@ -47,7 +47,9 @@ import {
47
47
  MobileWrapperPlaceOrderButton,
48
48
  OrderContextUIWrapper,
49
49
  HeaderContent,
50
- AuthButtonList
50
+ AuthButtonList,
51
+ Flag,
52
+ SectionTitleContainer
51
53
  } from './styles'
52
54
 
53
55
  import { Button } from '../../styles/Buttons'
@@ -141,6 +143,8 @@ const CheckoutUI = (props) => {
141
143
  const isGiftCardCart = !cart?.business_id
142
144
  // const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
143
145
 
146
+ const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
147
+
144
148
  const isDisablePlaceOrderButton = !cart?.valid ||
145
149
  (!paymethodSelected && cart?.balance > 0) ||
146
150
  (paymethodSelected?.gateway === 'stripe' && cardList?.cards?.length === 0) ||
@@ -154,7 +158,8 @@ const CheckoutUI = (props) => {
154
158
  (options.type === 1 &&
155
159
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
156
160
  validationFields?.fields?.checkout?.driver_tip?.required &&
157
- (Number(cart?.driver_tip) <= 0))
161
+ (Number(cart?.driver_tip) <= 0)) ||
162
+ (validateCommentsCartField)
158
163
 
159
164
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
160
165
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -168,7 +173,7 @@ const CheckoutUI = (props) => {
168
173
 
169
174
  const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
170
175
  const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
171
- const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
176
+ const hideBusinessMap = theme?.checkout?.components?.map?.hidden
172
177
  const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
173
178
  const driverTipsField = !cartState.loading && cart && cart?.business_id && options.type === 1 && cart?.status !== 2 && validationFields?.fields?.checkout?.driver_tip?.enabled && driverTipsOptions.length > 0 && !useKioskApp
174
179
 
@@ -474,7 +479,10 @@ const CheckoutUI = (props) => {
474
479
 
475
480
  {!cartState.loading && cart && (
476
481
  <PaymentMethodContainer className='paymentsContainer'>
477
- <h1>{t('PAYMENT_METHODS', 'Payment Methods')}</h1>
482
+ <SectionTitleContainer>
483
+ <h1>{t('PAYMENT_METHODS', 'Payment Methods')}</h1>
484
+ <Flag>{t('REQUIRED', 'Required')}</Flag>
485
+ </SectionTitleContainer>
478
486
  {!cartState.loading && cart?.status === 4 && (
479
487
  <WarningMessage style={{ marginTop: 20 }}>
480
488
  <VscWarning />
@@ -644,6 +652,12 @@ const CheckoutUI = (props) => {
644
652
  </WarningText>
645
653
  )}
646
654
 
655
+ {validateCommentsCartField && (
656
+ <WarningText>
657
+ {t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
658
+ </WarningText>
659
+ )}
660
+
647
661
  {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
648
662
  <WarningText>
649
663
  {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}