ordering-ui-external 1.9.1 → 1.9.3

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 (89) hide show
  1. package/_bundles/0.ordering-ui.ea0875b41af5b7f1d809.js +1 -0
  2. package/_bundles/{1.ordering-ui.a97bdaf67c563ada4c74.js → 1.ordering-ui.ea0875b41af5b7f1d809.js} +1 -1
  3. package/_bundles/{2.ordering-ui.a97bdaf67c563ada4c74.js → 2.ordering-ui.ea0875b41af5b7f1d809.js} +1 -1
  4. package/_bundles/{4.ordering-ui.a97bdaf67c563ada4c74.js → 4.ordering-ui.ea0875b41af5b7f1d809.js} +1 -1
  5. package/_bundles/{5.ordering-ui.a97bdaf67c563ada4c74.js → 5.ordering-ui.ea0875b41af5b7f1d809.js} +1 -1
  6. package/_bundles/{6.ordering-ui.a97bdaf67c563ada4c74.js → 6.ordering-ui.ea0875b41af5b7f1d809.js} +1 -1
  7. package/_bundles/{7.ordering-ui.a97bdaf67c563ada4c74.js → 7.ordering-ui.ea0875b41af5b7f1d809.js} +2 -2
  8. package/_bundles/{7.ordering-ui.a97bdaf67c563ada4c74.js.LICENSE.txt → 7.ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.a97bdaf67c563ada4c74.js → 8.ordering-ui.ea0875b41af5b7f1d809.js} +1 -1
  10. package/_bundles/{9.ordering-ui.a97bdaf67c563ada4c74.js → 9.ordering-ui.ea0875b41af5b7f1d809.js} +1 -1
  11. package/_bundles/ordering-ui.ea0875b41af5b7f1d809.js +2 -0
  12. package/_bundles/{ordering-ui.a97bdaf67c563ada4c74.js.LICENSE.txt → ordering-ui.ea0875b41af5b7f1d809.js.LICENSE.txt} +0 -0
  13. package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +9 -10
  14. package/_modules/themes/five/index.js +7 -0
  15. package/_modules/themes/five/src/components/AddressList/index.js +3 -2
  16. package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +3 -2
  17. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +8 -3
  18. package/_modules/themes/five/src/components/BusinessProductsList/index.js +50 -14
  19. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +9 -2
  20. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +10 -6
  21. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +34 -129
  22. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +29 -40
  23. package/_modules/themes/five/src/components/Cart/index.js +6 -3
  24. package/_modules/themes/five/src/components/CartContent/index.js +97 -2
  25. package/_modules/themes/five/src/components/CartContent/styles.js +6 -4
  26. package/_modules/themes/five/src/components/Checkout/index.js +8 -2
  27. package/_modules/themes/five/src/components/Checkout/styles.js +10 -4
  28. package/_modules/themes/five/src/components/Header/index.js +26 -34
  29. package/_modules/themes/five/src/components/Header/styles.js +46 -35
  30. package/_modules/themes/five/src/components/HeaderOption/index.js +3 -2
  31. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +3 -2
  32. package/_modules/themes/five/src/components/MultiCheckout/index.js +20 -10
  33. package/_modules/themes/five/src/components/MultiCheckout/styles.js +11 -8
  34. package/_modules/themes/five/src/components/MultiOrdersDetails/index.js +2 -0
  35. package/_modules/themes/five/src/components/OrderContextUI/index.js +192 -0
  36. package/_modules/themes/five/src/components/OrderContextUI/styles.js +41 -0
  37. package/_modules/themes/five/src/components/OrderDetails/index.js +5 -2
  38. package/_modules/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +8 -2
  39. package/_modules/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/styles.js +8 -2
  40. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +17 -8
  41. package/_modules/themes/five/src/components/ProductItemAccordion/styles.js +27 -27
  42. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +7 -2
  43. package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +17 -14
  44. package/_modules/themes/five/src/components/SingleOrderCard/index.js +16 -16
  45. package/_modules/themes/five/src/components/SingleOrderCard/styles.js +49 -41
  46. package/package.json +2 -1
  47. package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +12 -12
  48. package/src/themes/five/index.js +2 -0
  49. package/src/themes/five/src/components/AddressList/index.js +3 -2
  50. package/src/themes/five/src/components/BusinessItemAccordion/index.js +2 -1
  51. package/src/themes/five/src/components/BusinessProductsCategories/index.js +8 -3
  52. package/src/themes/five/src/components/BusinessProductsList/index.js +54 -18
  53. package/src/themes/five/src/components/BusinessProductsListing/index.js +14 -2
  54. package/src/themes/five/src/components/BusinessProductsListing/styles.js +18 -6
  55. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +2 -85
  56. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +2 -77
  57. package/src/themes/five/src/components/Cart/index.js +6 -3
  58. package/src/themes/five/src/components/CartContent/index.js +61 -3
  59. package/src/themes/five/src/components/CartContent/styles.js +6 -0
  60. package/src/themes/five/src/components/Checkout/index.js +16 -2
  61. package/src/themes/five/src/components/Checkout/styles.js +19 -6
  62. package/src/themes/five/src/components/Header/index.js +281 -277
  63. package/src/themes/five/src/components/Header/styles.js +20 -51
  64. package/src/themes/five/src/components/HeaderOption/index.js +3 -2
  65. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +2 -1
  66. package/src/themes/five/src/components/MultiCheckout/index.js +26 -6
  67. package/src/themes/five/src/components/MultiCheckout/styles.js +8 -13
  68. package/src/themes/five/src/components/MultiOrdersDetails/index.js +2 -0
  69. package/src/themes/five/src/components/OrderContextUI/index.js +133 -0
  70. package/src/themes/five/src/components/OrderContextUI/styles.js +86 -0
  71. package/src/themes/five/src/components/OrderDetails/index.js +6 -2
  72. package/src/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +5 -2
  73. package/src/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/styles.js +4 -0
  74. package/src/themes/five/src/components/ProductItemAccordion/index.js +58 -40
  75. package/src/themes/five/src/components/ProductItemAccordion/styles.js +4 -3
  76. package/src/themes/five/src/components/ProductOptionSubOption/index.js +8 -1
  77. package/src/themes/five/src/components/ProductOptionSubOption/styles.js +6 -0
  78. package/src/themes/five/src/components/SingleOrderCard/index.js +12 -13
  79. package/src/themes/five/src/components/SingleOrderCard/styles.js +26 -7
  80. package/template/app.js +1 -1
  81. package/template/components/ListenPageChanges/index.js +3 -2
  82. package/template/components/OrderingThemeUpdated/index.js +41 -0
  83. package/template/helmetdata.json +7 -0
  84. package/template/pages/MessagesList/index.js +2 -0
  85. package/template/pages/MultiCart/index.js +24 -0
  86. package/template/pages/MultiCheckout/index.js +86 -10
  87. package/template/pages/MultiOrdersDetails/index.js +9 -4
  88. package/_bundles/0.ordering-ui.a97bdaf67c563ada4c74.js +0 -1
  89. package/_bundles/ordering-ui.a97bdaf67c563ada4c74.js +0 -2
@@ -134,22 +134,19 @@ const BusinessProductsListUI = (props) => {
134
134
  )}
135
135
  </HeaderWrapper>
136
136
  <ProductsListing>
137
- {
138
- productsCategorySelected
139
- ?.filter(product => product?.category_id === category?.id)
140
- ?.map((product, i) => (
141
- <SingleProductCard
142
- key={i}
143
- isSoldOut={(product.inventoried && !product.quantity)}
144
- product={product}
145
- useKioskApp={useKioskApp}
146
- businessId={businessId}
147
- onProductClick={onProductClick}
148
- isCartOnProductsList={isCartOnProductsList}
149
- handleUpdateProducts={handleUpdateProducts}
150
- productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
151
- />
152
- ))
137
+ {productsCategorySelected.map((product, i) => (
138
+ <SingleProductCard
139
+ key={i}
140
+ isSoldOut={(product.inventoried && !product.quantity)}
141
+ product={product}
142
+ useKioskApp={useKioskApp}
143
+ businessId={businessId}
144
+ onProductClick={onProductClick}
145
+ isCartOnProductsList={isCartOnProductsList}
146
+ handleUpdateProducts={handleUpdateProducts}
147
+ productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
148
+ />
149
+ ))
153
150
  }
154
151
  </ProductsListing>
155
152
  {isSearchMode && category?.subcategories?.length > 0 && category?.subcategories?.filter(subcategory => productsCategorySelected?.some(product => product?.category_id === subcategory?.id))?.map(subcategory => (
@@ -196,6 +193,19 @@ const BusinessProductsListUI = (props) => {
196
193
  productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
197
194
  />
198
195
  ))}
196
+ {!categoryState?.loading && categoryState?.products?.length > 9 && (
197
+ <SingleProductCard
198
+ useCustomFunctionality
199
+ onCustomClick={() => onClickCategory(category)}
200
+ isCartOnProductsList={isCartOnProductsList}
201
+ handleUpdateProducts={handleUpdateProducts}
202
+ customText={t('MORE', 'More')}
203
+ customStyle={{
204
+ display: 'flex',
205
+ justifyContent: 'center'
206
+ }}
207
+ />
208
+ )}
199
209
  </ProductsListing>
200
210
  </WrapAllCategories>
201
211
  )
@@ -256,7 +266,7 @@ const BusinessProductsListUI = (props) => {
256
266
  <ProductsListing isSubcategorySearch={isSubcategorySearch}>
257
267
  {isSearchMode && category?.subcategories?.length > 0 ? (
258
268
  <>
259
- {products?.filter(product => product?.category_id === category?.id)?.map((product, i) => (
269
+ {products?.filter((product, i) => i < 9 && product?.category_id === category?.id)?.map((product, i) => (
260
270
  <SingleProductCard
261
271
  key={i}
262
272
  isSoldOut={product.inventoried && !product.quantity}
@@ -269,11 +279,24 @@ const BusinessProductsListUI = (props) => {
269
279
  productAddedToCartLength={currentCart?.products?.reduce((productsLength, Cproduct) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
270
280
  />
271
281
  ))}
282
+ {!categoryState?.loading && products?.length > 9 && (
283
+ <SingleProductCard
284
+ useCustomFunctionality
285
+ onCustomClick={() => onClickCategory(category)}
286
+ isCartOnProductsList={isCartOnProductsList}
287
+ handleUpdateProducts={handleUpdateProducts}
288
+ customText={t('MORE', 'More')}
289
+ customStyle={{
290
+ display: 'flex',
291
+ justifyContent: 'center'
292
+ }}
293
+ />
294
+ )}
272
295
  </>
273
296
  ) : (
274
297
  <>
275
298
  {
276
- products.map((product, i) => (
299
+ products.filter((_, i) => i < 9).map((product, i) => (
277
300
  <SingleProductCard
278
301
  key={i}
279
302
  isSoldOut={product.inventoried && !product.quantity}
@@ -287,6 +310,19 @@ const BusinessProductsListUI = (props) => {
287
310
  />
288
311
  ))
289
312
  }
313
+ {!categoryState?.loading && products?.length > 9 && (
314
+ <SingleProductCard
315
+ useCustomFunctionality
316
+ onCustomClick={() => onClickCategory(category)}
317
+ isCartOnProductsList={isCartOnProductsList}
318
+ handleUpdateProducts={handleUpdateProducts}
319
+ customText={t('MORE', 'More')}
320
+ customStyle={{
321
+ display: 'flex',
322
+ justifyContent: 'center'
323
+ }}
324
+ />
325
+ )}
290
326
  </>
291
327
  )}
292
328
  {
@@ -26,7 +26,9 @@ import {
26
26
  BusinessCartContent,
27
27
  EmptyCart,
28
28
  EmptyBtnWrapper,
29
- Title
29
+ Title,
30
+ HeaderContent,
31
+ OrderContextUIWrapper
30
32
  } from './styles'
31
33
 
32
34
  import { NotFoundSource } from '../NotFoundSource'
@@ -42,6 +44,8 @@ import { Alert } from '../../../../../components/Confirm'
42
44
  import { FloatingButton } from '../../../../../components/FloatingButton'
43
45
  import { UpsellingPage } from '../../../../../components/UpsellingPage'
44
46
  import { ServiceForm } from '../ServiceForm'
47
+ import { OrderContextUI } from '../OrderContextUI'
48
+
45
49
  const PIXELS_TO_SCROLL = 300
46
50
 
47
51
  const BusinessProductsListingUI = (props) => {
@@ -284,7 +288,15 @@ const BusinessProductsListingUI = (props) => {
284
288
  <>
285
289
  <ProductsContainer>
286
290
  {!props.useKioskApp && (
287
- <ArrowLeft onClick={() => handleGoToBusinessList()} />
291
+ // <ArrowLeft onClick={() => handleGoToBusinessList()} />
292
+ <HeaderContent>
293
+ <ArrowLeft className='back-arrow' onClick={() => handleGoToBusinessList()} />
294
+ {windowSize?.width < 576 && (
295
+ <OrderContextUIWrapper>
296
+ <OrderContextUI isCheckOut />
297
+ </OrderContextUIWrapper>
298
+ )}
299
+ </HeaderContent>
288
300
  )}
289
301
  <RenderProductsLayout
290
302
  errors={errors}
@@ -3,12 +3,6 @@ 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
6
  `
13
7
 
14
8
  export const ProductLoading = styled.div`
@@ -135,3 +129,21 @@ export const EmptyBtnWrapper = styled.div`
135
129
  padding-right: 25px;
136
130
  }
137
131
  `
132
+
133
+ export const HeaderContent = styled.div`
134
+ display: flex;
135
+ align-items: center;
136
+ margin-bottom: 10px;
137
+ .back-arrow {
138
+ font-size: 24px;
139
+ cursor: pointer;
140
+ }
141
+ `
142
+ export const OrderContextUIWrapper = styled.div`
143
+ flex: 1;
144
+ width: 100%;
145
+ ${props => props.theme.rtl && css`
146
+ margin-left: 0px;
147
+ margin-right: 15px;
148
+ `}
149
+ `
@@ -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,9 @@ 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'
58
50
 
59
51
  const PIXELS_TO_SCROLL = 300
60
52
 
@@ -80,7 +72,6 @@ const BusinessesListingUI = (props) => {
80
72
 
81
73
  const [, t] = useLanguage()
82
74
  const [orderState, { changeCityFilter }] = useOrder()
83
- const [configState] = useConfig()
84
75
  const [{ auth }] = useSession()
85
76
  const [{ configs }] = useConfig()
86
77
  const windowSize = useWindowSize()
@@ -89,7 +80,6 @@ const BusinessesListingUI = (props) => {
89
80
  const [modals, setModals] = useState({ listOpen: false, formOpen: false, citiesOpen: false })
90
81
  const [alertState, setAlertState] = useState({ open: false, content: [] })
91
82
  const [activeMap, setActiveMap] = useState(false)
92
- const [openPopover, setOpenPopover] = useState({})
93
83
  const [mapErrors, setMapErrors] = useState('')
94
84
  const [isPreorder, setIsPreorder] = useState(false)
95
85
  const [preorderBusiness, setPreorderBusiness] = useState(null)
@@ -104,7 +94,6 @@ const BusinessesListingUI = (props) => {
104
94
  const businessesIds = isCustomLayout &&
105
95
  businessesList.businesses &&
106
96
  businessesList.businesses?.map(business => business.id)
107
- const configTypes = configState?.configs?.order_types_allowed?.value.split('|').map(value => Number(value)) || []
108
97
  const isChew = orderingTheme?.theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
109
98
 
110
99
  const handleScroll = useCallback(() => {
@@ -128,28 +117,6 @@ const BusinessesListingUI = (props) => {
128
117
  }
129
118
  }
130
119
 
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
120
  const toggleMap = () => {
154
121
  setActiveMap(!activeMap)
155
122
  }
@@ -286,27 +253,7 @@ const BusinessesListingUI = (props) => {
286
253
  {(windowSize.width < 576 || (configs?.business_listing_hide_image?.value !== '1' && !isChew)) && (
287
254
  <BusinessBanner>
288
255
  {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>
256
+ <OrderContextUI isBusinessList />
310
257
  )}
311
258
  {(configs?.business_listing_hide_image?.value !== '1' && !isChew) && (
312
259
  <BusinessHeroImg
@@ -502,36 +449,6 @@ const BusinessesListingUI = (props) => {
502
449
  showButton
503
450
  />
504
451
  </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>
519
-
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
452
  <Modal
536
453
  title={t('SELECT_A_STORE', 'Select a store')}
537
454
  open={modals.citiesOpen}
@@ -13,86 +13,11 @@ export const BusinessBanner = styled.div`
13
13
  align-items: center;
14
14
  margin-bottom: 30px;
15
15
  position: relative;
16
- @media (max-width: 481px) {
16
+ @media (max-width: 576px) {
17
17
  margin-bottom: 0px;
18
18
  }
19
19
  `
20
20
 
21
- export const BusinessFeatures = styled.div`
22
- position: absolute;
23
- top: 10%;
24
- width: 100%;
25
- padding: 0 15px;
26
- box-sizing: border-box;
27
- `
28
-
29
- export const AddressMenu = styled.div`
30
- cursor: pointer;
31
- font-size: 14px;
32
- display: flex;
33
- align-items: center;
34
- background-color: #fff;
35
- color: #344050;
36
- font-weight: 600;
37
- border-radius: 50px;
38
- padding: 13px 19px;
39
- margin-bottom: 10px;
40
- span {
41
- width: 100%;
42
- overflow: hidden;
43
- text-overflow: ellipsis;
44
- white-space: nowrap;
45
- }
46
- svg {
47
- margin-right: 5px;
48
- color: #B1BCCC;
49
- ${props => props.theme?.rtl && css`
50
- margin-left: 5px;
51
- margin-right: 0;
52
- `}
53
- }
54
- `
55
-
56
- export const FeatureItems = styled.div`
57
- width: 100%;
58
- display: flex;
59
- justify-content: space-between;
60
- `
61
-
62
- export const ItemInline = styled.div`
63
- > span #select-input {
64
- background-color: #F8F9FA !important;
65
- border: none;
66
- border-radius: 7.6px;
67
- svg {
68
- font-size: 14px;
69
- }
70
- #list {
71
- background-color: #fff;
72
- border: none;
73
- border-radius: 7.6px;
74
- left: 0px;
75
- right: initial;
76
- ${props => props.theme.rtl && css`
77
- left: initial;
78
- right: 0px;
79
- `}
80
- }
81
- > div:first-child {
82
- font-size: 11px;
83
- }
84
- }
85
- .moment-popover {
86
- > div:first-child {
87
- font-size: 11px;
88
- padding: 4px 7px;
89
- svg {
90
- font-size: 14px;
91
- }
92
- }
93
- }
94
- `
95
-
96
21
  export const BusinessSearch = styled.div`
97
22
  display: flex;
98
23
  background-color: #f8f9fa;
@@ -196,7 +121,7 @@ export const BusinessHeroImgStyled = styled.div`
196
121
  height: 370px;
197
122
  }
198
123
  @media (min-width: 821px) {
199
- height: ${({ height }) => height || '650px'};
124
+ height: ${({ height, theme }) => theme?.business_listing_view?.components?.business_hero?.components?.styles?.height || height || '650px'};
200
125
  }
201
126
  `
202
127
 
@@ -67,7 +67,10 @@ const CartUI = (props) => {
67
67
  handleChangeComment,
68
68
  commentState,
69
69
  handleRemoveOfferClick,
70
- setPreorderBusiness
70
+ setPreorderBusiness,
71
+ cart: cartMulticart,
72
+ hideDeliveryFee,
73
+ hideDriverTip
71
74
  } = props
72
75
 
73
76
  const theme = useTheme()
@@ -407,7 +410,7 @@ const CartUI = (props) => {
407
410
  </tr>
408
411
  ))
409
412
  }
410
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
413
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
411
414
  <tr>
412
415
  <td>{t('DELIVERY_FEE', 'Delivery Fee')}</td>
413
416
  <td>{parsePrice(cart?.delivery_price)}</td>
@@ -432,7 +435,7 @@ const CartUI = (props) => {
432
435
  </tr>
433
436
  ))
434
437
  }
435
- {cart?.driver_tip > 0 && (
438
+ {cart?.driver_tip > 0 && !hideDriverTip && (
436
439
  <tr>
437
440
  <td>
438
441
  {t('DRIVER_TIP', 'Driver tip')}{' '}
@@ -1,9 +1,10 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { useTheme } from 'styled-components'
3
- import { useLanguage, useEvent } from 'ordering-components-external'
4
- import { Container, NotCarts, Title } from './styles'
3
+ import { useLanguage, useEvent, useConfig, useOrder } from 'ordering-components-external'
4
+ import { Container, NotCarts, Title, WrapperContainer } from './styles'
5
5
 
6
6
  import { Cart } from '../Cart'
7
+ import { Button } from '../../styles/Buttons'
7
8
 
8
9
  export const CartContent = (props) => {
9
10
  const {
@@ -19,8 +20,21 @@ export const CartContent = (props) => {
19
20
  const [, t] = useLanguage()
20
21
  const theme = useTheme()
21
22
  const [events] = useEvent()
23
+ const [orderState] = useOrder()
24
+ const [{ configs }] = useConfig()
22
25
 
23
26
  const [currentCartUuid, setCurrentCartUuid] = useState(null)
27
+ const checkoutMultiBusinessEnabled = configs?.checkout_multi_business_enabled?.value === '1'
28
+ const openCarts = (Object.values(orderState?.carts)?.filter(cart => cart?.products &&
29
+ cart?.products?.length &&
30
+ cart?.status !== 2 &&
31
+ cart?.valid_schedule &&
32
+ cart?.valid_products &&
33
+ cart?.valid_address &&
34
+ cart?.valid_maximum &&
35
+ cart?.valid_minimum &&
36
+ !cart?.wallets
37
+ ) || null) || []
24
38
 
25
39
  const handleAddProduct = (product, cart) => {
26
40
  setCurrentCartUuid(cart?.uuid)
@@ -28,6 +42,45 @@ export const CartContent = (props) => {
28
42
 
29
43
  const handleSetCurrentCartUuid = () => {
30
44
  setCurrentCartUuid(null)
45
+ props.onClose && props.onClose()
46
+ }
47
+
48
+ const handleClickCheckout = () => {
49
+ const cart = carts.find(cart => cart?.group?.uuid)
50
+ const cartSelectedHasGroup = cart?.group?.uuid
51
+ const cartFilterValidation = cart => cart?.valid && cart?.status !== 2
52
+ const cartsGroupLength = cartSelectedHasGroup ? Object.values(orderState.carts).filter(_cart => _cart?.group?.uuid === cartSelectedHasGroup && cartFilterValidation(_cart))?.length : 0
53
+ if (cartsGroupLength > 1 && checkoutMultiBusinessEnabled) {
54
+ events.emit('go_to_page', { page: 'multi_checkout', params: { cartUuid: cart?.group?.uuid } })
55
+ events.emit('cart_popover_closed')
56
+ return
57
+ }
58
+ const cartGroupsCount = {}
59
+ // eslint-disable-next-line no-unused-expressions
60
+ Object.values(orderState.carts).filter(_cart => cartFilterValidation(_cart))?.forEach(_cart => {
61
+ if (cartGroupsCount[_cart?.group?.uuid]) {
62
+ cartGroupsCount[_cart?.group?.uuid] += 1
63
+ } else {
64
+ cartGroupsCount[_cart?.group?.uuid] = 1
65
+ }
66
+ })
67
+ let groupForTheCart
68
+ const groupForAddCartArray = Object.keys(cartGroupsCount).filter(cartGroupUuid => cartGroupsCount[cartGroupUuid] > 0 && cartGroupsCount[cartGroupUuid] < 5)
69
+ const max = Math.max(...groupForAddCartArray.map(uuid => cartGroupsCount[uuid]))
70
+ const indexes = groupForAddCartArray.filter(uuid => cartGroupsCount[uuid] === max)
71
+ if (indexes?.length > 1) {
72
+ groupForTheCart = indexes.find(uuid => uuid !== 'undefined')
73
+ } else {
74
+ groupForTheCart = indexes[0]
75
+ }
76
+
77
+ if (checkoutMultiBusinessEnabled && openCarts?.length > 1 && groupForTheCart) {
78
+ events.emit('go_to_page', { page: 'multi_cart', params: { cartUuid: cart?.uuid, cartGroup: groupForTheCart === 'undefined' ? 'create' : groupForTheCart } })
79
+ } else {
80
+ events.emit('go_to_page', { page: 'checkout', params: { cartUuid: cart?.uuid } })
81
+ }
82
+ events.emit('cart_popover_closed')
83
+ props.onClose && props.onClose()
31
84
  }
32
85
 
33
86
  useEffect(() => {
@@ -43,7 +96,12 @@ export const CartContent = (props) => {
43
96
  <>
44
97
  <Container>
45
98
  {!isSlideBar && (
46
- <Title>{t('YOUR_CART', 'Your cart')}</Title>
99
+ <WrapperContainer>
100
+ <Title>{t('YOUR_CART', 'Your cart')}</Title>
101
+ {checkoutMultiBusinessEnabled && (
102
+ <Button onClick={handleClickCheckout} color='primary'>{t('CHECKOUT', 'Checkout')}</Button>
103
+ )}
104
+ </WrapperContainer>
47
105
  )}
48
106
  {isOrderStateCarts && carts?.length > 0 &&
49
107
  carts.map(cart => (
@@ -13,6 +13,12 @@ export const Container = styled.div`
13
13
  }
14
14
  `
15
15
 
16
+ export const WrapperContainer = styled.div`
17
+ display: flex;
18
+ width: 100%;
19
+ justify-content: space-between;
20
+ `
21
+
16
22
  export const NotCarts = styled.div`
17
23
  height: 300px;
18
24
  display: flex;
@@ -43,7 +43,9 @@ import {
43
43
  CartHeader,
44
44
  SelectSpotContainer,
45
45
  WrapperActionsInput,
46
- MobileWrapperPlaceOrderButton
46
+ MobileWrapperPlaceOrderButton,
47
+ OrderContextUIWrapper,
48
+ HeaderContent
47
49
  } from './styles'
48
50
 
49
51
  import { Button } from '../../styles/Buttons'
@@ -61,6 +63,7 @@ import { Alert } from '../Confirm'
61
63
  import { CartContent } from '../CartContent'
62
64
  import { Select } from '../../styles/Select'
63
65
  import { PlaceSpot } from '../PlaceSpot'
66
+ import { OrderContextUI } from '../OrderContextUI'
64
67
 
65
68
  const mapConfigs = {
66
69
  mapZoom: 16,
@@ -254,11 +257,22 @@ const CheckoutUI = (props) => {
254
257
  handleStoreRedirect(cart?.business?.slug)
255
258
  }, [cart?.products])
256
259
 
260
+ useEffect(() => {
261
+ window.scrollTo(0, 0)
262
+ }, [])
263
+
257
264
  return (
258
265
  <Container>
259
266
  <WrapperLeftContainer>
260
267
  <WrapperLeftContent>
261
- <ArrowLeft className='back-arrow' onClick={() => history.goBack()} />
268
+ <HeaderContent>
269
+ <ArrowLeft className='back-arrow' onClick={() => history.goBack()} />
270
+ {windowSize?.width < 576 && (
271
+ <OrderContextUIWrapper>
272
+ <OrderContextUI isCheckOut />
273
+ </OrderContextUIWrapper>
274
+ )}
275
+ </HeaderContent>
262
276
  {!cartState.loading && cart?.status === 2 && (
263
277
  <WarningMessage>
264
278
  <VscWarning />
@@ -184,12 +184,6 @@ export const WrapperLeftContent = styled.div`
184
184
  font-size: 32px;
185
185
  color: ${props => props.theme?.colors.darkTextColor};
186
186
  }
187
-
188
- .back-arrow {
189
- font-size: 24px;
190
- cursor: pointer;
191
- margin-bottom: 5px;
192
- }
193
187
  `
194
188
  export const CheckOutDivider = styled.div`
195
189
  height: 8px;
@@ -319,3 +313,22 @@ export const MobileWrapperPlaceOrderButton = styled.div`
319
313
  border-radius: 7.6px;
320
314
  }
321
315
  `
316
+
317
+ export const OrderContextUIWrapper = styled.div`
318
+ flex: 1;
319
+ margin-left: 15px;
320
+ ${props => props.theme.rtl && css`
321
+ margin-left: 0px;
322
+ margin-right: 15px;
323
+ `}
324
+ `
325
+
326
+ export const HeaderContent = styled.div`
327
+ display: flex;
328
+ align-items: center;
329
+ margin-bottom: 10px;
330
+ .back-arrow {
331
+ font-size: 24px;
332
+ cursor: pointer;
333
+ }
334
+ `