ordering-ui-external 14.1.49 → 14.1.52

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 (126) hide show
  1. package/_bundles/{7.ordering-ui.697d19ddfcc29dfbeb52.js → 7.ordering-ui.746cebc54de638e8e528.js} +1 -1
  2. package/_bundles/ordering-ui.746cebc54de638e8e528.js +2 -0
  3. package/_modules/components/GoogleGpsButton/index.js +11 -3
  4. package/_modules/components/VerticalOrdersLayout/styles.js +1 -1
  5. package/_modules/themes/callcenterOriginal/index.js +7 -0
  6. package/_modules/themes/callcenterOriginal/src/components/AddressForm/index.js +22 -5
  7. package/_modules/themes/callcenterOriginal/src/components/AddressForm/styles.js +10 -7
  8. package/_modules/themes/callcenterOriginal/src/components/AddressList/index.js +59 -19
  9. package/_modules/themes/callcenterOriginal/src/components/AddressList/styles.js +10 -4
  10. package/_modules/themes/callcenterOriginal/src/components/ConfirmAddressForm/index.js +638 -0
  11. package/_modules/themes/callcenterOriginal/src/components/ConfirmAddressForm/styles.js +50 -0
  12. package/_modules/themes/callcenterOriginal/src/components/Header/index.js +33 -4
  13. package/_modules/themes/callcenterOriginal/src/components/InputPhoneNumber/index.js +17 -10
  14. package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +58 -106
  15. package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/styles.js +6 -29
  16. package/_modules/themes/callcenterOriginal/src/components/SearchBar/index.js +2 -2
  17. package/_modules/themes/callcenterOriginal/src/components/SignUpForm/index.js +21 -1
  18. package/_modules/themes/callcenterOriginal/src/components/UserDetails/index.js +49 -8
  19. package/_modules/themes/callcenterOriginal/src/components/UserDetails/styles.js +12 -9
  20. package/_modules/themes/callcenterOriginal/src/components/UserFormDetails/index.js +30 -12
  21. package/_modules/themes/callcenterOriginal/src/components/UserFormDetails/styles.js +11 -5
  22. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
  23. package/_modules/themes/five/src/components/BusinessController/franchises/OloBusinessController/index.js +192 -0
  24. package/_modules/themes/five/src/components/BusinessController/franchises/OloBusinessController/styles.js +114 -0
  25. package/_modules/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/index.js +572 -0
  26. package/_modules/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/styles.js +89 -0
  27. package/_modules/themes/five/src/components/BusinessesListing/index.js +6 -2
  28. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +31 -118
  29. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
  30. package/_modules/themes/five/src/components/Checkout/OrderDetail.js +1 -3
  31. package/_modules/themes/five/src/components/Checkout/index.js +22 -4
  32. package/_modules/themes/five/src/components/DriverTips/styles.js +1 -1
  33. package/_modules/themes/five/src/components/Header/index.js +8 -7
  34. package/_modules/themes/five/src/components/Header/styles.js +28 -25
  35. package/_modules/themes/five/src/components/HighestRated/franchises/OloHighestRated/index.js +116 -0
  36. package/_modules/themes/five/src/components/HighestRated/franchises/OloHighestRated/styles.js +22 -0
  37. package/_modules/themes/five/src/components/HomeHero/franchises/OloHomeHero/index.js +136 -0
  38. package/_modules/themes/five/src/components/HomeHero/franchises/OloHomeHero/styles.js +46 -0
  39. package/_modules/themes/five/src/components/HomeHero/index.js +5 -2
  40. package/_modules/themes/five/src/components/InputPhoneNumber/index.js +19 -12
  41. package/_modules/themes/five/src/components/LogoutPopup/index.js +2 -1
  42. package/_modules/themes/five/src/components/Modal/index.js +6 -3
  43. package/_modules/themes/five/src/components/MultiOrdersDetails/styles.js +2 -2
  44. package/_modules/themes/five/src/components/OrderDetails/layouts/Kiosk/index.js +2 -1
  45. package/_modules/themes/five/src/components/OrderItAgain/styles.js +1 -1
  46. package/_modules/themes/five/src/components/OrderTypesSquares/index.js +160 -0
  47. package/_modules/themes/five/src/components/OrderTypesSquares/styles.js +39 -0
  48. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +4 -4
  49. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +1 -1
  50. package/_modules/themes/five/src/components/SearchBar/index.js +2 -2
  51. package/_modules/themes/five/src/components/SignUpForm/index.js +11 -8
  52. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
  53. package/_modules/themes/five/src/components/UserDetails/index.js +5 -2
  54. package/_modules/themes/five/src/styles/Buttons/index.js +1 -1
  55. package/index-template.js +9 -1
  56. package/package.json +2 -2
  57. package/src/components/GoogleGpsButton/index.js +10 -2
  58. package/src/components/VerticalOrdersLayout/styles.js +2 -2
  59. package/src/themes/callcenterOriginal/index.js +2 -0
  60. package/src/themes/callcenterOriginal/src/components/AddressForm/index.js +44 -23
  61. package/src/themes/callcenterOriginal/src/components/AddressForm/styles.js +8 -0
  62. package/src/themes/callcenterOriginal/src/components/AddressList/index.js +67 -22
  63. package/src/themes/callcenterOriginal/src/components/AddressList/styles.js +16 -1
  64. package/src/themes/callcenterOriginal/src/components/ConfirmAddressForm/index.js +579 -0
  65. package/src/themes/callcenterOriginal/src/components/ConfirmAddressForm/styles.js +275 -0
  66. package/src/themes/callcenterOriginal/src/components/Header/index.js +22 -0
  67. package/src/themes/callcenterOriginal/src/components/InputPhoneNumber/index.js +13 -8
  68. package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +34 -100
  69. package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/styles.js +0 -52
  70. package/src/themes/callcenterOriginal/src/components/SearchBar/index.js +2 -2
  71. package/src/themes/callcenterOriginal/src/components/SignUpForm/index.js +19 -1
  72. package/src/themes/callcenterOriginal/src/components/UserDetails/index.js +45 -11
  73. package/src/themes/callcenterOriginal/src/components/UserDetails/styles.js +3 -1
  74. package/src/themes/callcenterOriginal/src/components/UserFormDetails/index.js +40 -14
  75. package/src/themes/callcenterOriginal/src/components/UserFormDetails/styles.js +19 -1
  76. package/src/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
  77. package/src/themes/five/src/components/BusinessController/franchises/OloBusinessController/index.js +237 -0
  78. package/src/themes/five/src/components/BusinessController/franchises/OloBusinessController/styles.js +367 -0
  79. package/src/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/index.js +582 -0
  80. package/src/themes/five/src/components/BusinessesListing/franchises/OloBusinessesListing/styles.js +307 -0
  81. package/src/themes/five/src/components/BusinessesListing/index.js +19 -4
  82. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +7 -104
  83. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +2 -2
  84. package/src/themes/five/src/components/Checkout/OrderDetail.js +1 -5
  85. package/src/themes/five/src/components/Checkout/index.js +20 -2
  86. package/src/themes/five/src/components/DriverTips/styles.js +1 -0
  87. package/src/themes/five/src/components/Header/index.js +17 -12
  88. package/src/themes/five/src/components/Header/styles.js +51 -4
  89. package/src/themes/five/src/components/HighestRated/franchises/OloHighestRated/index.js +114 -0
  90. package/src/themes/five/src/components/HighestRated/franchises/OloHighestRated/styles.js +57 -0
  91. package/src/themes/five/src/components/HomeHero/franchises/OloHomeHero/index.js +122 -0
  92. package/src/themes/five/src/components/HomeHero/franchises/OloHomeHero/styles.js +125 -0
  93. package/src/themes/five/src/components/HomeHero/index.js +16 -3
  94. package/src/themes/five/src/components/InputPhoneNumber/index.js +14 -9
  95. package/src/themes/five/src/components/LogoutPopup/index.js +3 -1
  96. package/src/themes/five/src/components/Modal/index.js +6 -3
  97. package/src/themes/five/src/components/MultiOrdersDetails/styles.js +3 -3
  98. package/src/themes/five/src/components/OrderDetails/layouts/Kiosk/index.js +3 -1
  99. package/src/themes/five/src/components/OrderItAgain/styles.js +2 -0
  100. package/src/themes/five/src/components/OrderTypesSquares/index.js +157 -0
  101. package/src/themes/five/src/components/OrderTypesSquares/styles.js +62 -0
  102. package/src/themes/five/src/components/ProductItemAccordion/index.js +2 -2
  103. package/src/themes/five/src/components/RenderProductsLayout/styles.js +2 -0
  104. package/src/themes/five/src/components/SearchBar/index.js +2 -2
  105. package/src/themes/five/src/components/SignUpForm/index.js +5 -3
  106. package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
  107. package/src/themes/five/src/components/UserDetails/index.js +3 -1
  108. package/src/themes/five/src/styles/Buttons/index.js +2 -2
  109. package/template/app.js +14 -11
  110. package/template/assets/images/catering.svg +13 -0
  111. package/template/assets/images/curbside.svg +19 -0
  112. package/template/assets/images/drivethru.svg +19 -0
  113. package/template/assets/images/eatin.svg +17 -0
  114. package/template/components/SubdomainComponent/index.js +4 -8
  115. package/template/pages/BusinessesList/index.js +1 -1
  116. package/_bundles/ordering-ui.697d19ddfcc29dfbeb52.js +0 -2
  117. /package/_bundles/{0.ordering-ui.697d19ddfcc29dfbeb52.js → 0.ordering-ui.746cebc54de638e8e528.js} +0 -0
  118. /package/_bundles/{1.ordering-ui.697d19ddfcc29dfbeb52.js → 1.ordering-ui.746cebc54de638e8e528.js} +0 -0
  119. /package/_bundles/{2.ordering-ui.697d19ddfcc29dfbeb52.js → 2.ordering-ui.746cebc54de638e8e528.js} +0 -0
  120. /package/_bundles/{4.ordering-ui.697d19ddfcc29dfbeb52.js → 4.ordering-ui.746cebc54de638e8e528.js} +0 -0
  121. /package/_bundles/{5.ordering-ui.697d19ddfcc29dfbeb52.js → 5.ordering-ui.746cebc54de638e8e528.js} +0 -0
  122. /package/_bundles/{6.ordering-ui.697d19ddfcc29dfbeb52.js → 6.ordering-ui.746cebc54de638e8e528.js} +0 -0
  123. /package/_bundles/{7.ordering-ui.697d19ddfcc29dfbeb52.js.LICENSE.txt → 7.ordering-ui.746cebc54de638e8e528.js.LICENSE.txt} +0 -0
  124. /package/_bundles/{8.ordering-ui.697d19ddfcc29dfbeb52.js → 8.ordering-ui.746cebc54de638e8e528.js} +0 -0
  125. /package/_bundles/{9.ordering-ui.697d19ddfcc29dfbeb52.js → 9.ordering-ui.746cebc54de638e8e528.js} +0 -0
  126. /package/_bundles/{ordering-ui.697d19ddfcc29dfbeb52.js.LICENSE.txt → ordering-ui.746cebc54de638e8e528.js.LICENSE.txt} +0 -0
@@ -0,0 +1,582 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useTheme } from 'styled-components'
3
+ import {
4
+ BusinessList as BusinessListController,
5
+ GoogleMapsMap,
6
+ useOrder,
7
+ useSession,
8
+ useLanguage,
9
+ useConfig
10
+ } from 'ordering-components-external'
11
+ import {
12
+ BusinessContainer,
13
+ BusinessList,
14
+ HightestRatedWrapper,
15
+ Divider,
16
+
17
+ AddressFormWrapper,
18
+ Title,
19
+ TypesContainer,
20
+ TypeButton,
21
+ IconTypeButton,
22
+ AdditionalTypesContainer,
23
+ BusinessListContainer,
24
+ AdditionalTypesWrapper,
25
+ WrapInput,
26
+ Subtitle,
27
+ PaginationContainer,
28
+ WrapperMap,
29
+ CityContainer,
30
+ LoadMoreButtonCityWrap,
31
+ ViewLocations,
32
+ CitiesContainer,
33
+ Separator
34
+ } from './styles'
35
+ import { Button } from '../../../../styles/Buttons'
36
+ import { NotFoundSource } from '../../../NotFoundSource'
37
+
38
+ import { Modal } from '../../../Modal'
39
+ import { Alert } from '../../../Confirm'
40
+
41
+ import { BusinessController } from '../../../BusinessController/franchises/OloBusinessController'
42
+
43
+ import { HighestRated } from '../../../HighestRated/franchises/OloHighestRated'
44
+ import { BusinessPreorder } from '../../../BusinessPreorder'
45
+
46
+ import Skeleton from 'react-loading-skeleton'
47
+ import { CitiesControl } from '../../../CitiesControl'
48
+ import { getCateringValues } from '../../../../../../../utils'
49
+ import { AddressList } from '../../../AddressList'
50
+ import { AddressForm } from '../../../AddressForm'
51
+ import { Pagination } from '../../../Pagination'
52
+ import HiOutlineLocationMarker from '@meronex/icons/hi/HiOutlineLocationMarker'
53
+ import RiArrowDropDownLine from '@meronex/icons/ri/RiArrowDropDownLine'
54
+
55
+ const OloBusinessesListingUI = (props) => {
56
+ const {
57
+ businessesList,
58
+ paginationProps,
59
+ getBusinesses,
60
+ isCustomLayout,
61
+ isCustomerMode,
62
+ handleBusinessClick,
63
+ onBusinessClick,
64
+ handleUpdateBusinessList,
65
+ getCities,
66
+ citiesState,
67
+ orderTypes,
68
+ franchiseId
69
+ } = props
70
+ const allOrderTypes = [1, 2, 3, 4, 5, 7, 8]
71
+ const pickupTypes = [2, 3, 4, 5]
72
+ const cateringTypes = [7, 8]
73
+ const [, t] = useLanguage()
74
+ const [orderState, { changeCityFilter, changeType }] = useOrder()
75
+ const [{ auth }] = useSession()
76
+ const [{ configs }] = useConfig()
77
+ const theme = useTheme()
78
+ const [modals, setModals] = useState({ listOpen: false, formOpen: false, citiesOpen: false })
79
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
80
+ const [mapErrors, setMapErrors] = useState('')
81
+ const [isPreorder, setIsPreorder] = useState(false)
82
+ const [preorderBusiness, setPreorderBusiness] = useState(null)
83
+ const [hasHighRatedBusiness, setHasHighRatedBusiness] = useState(true)
84
+ const [isPickupSelected, setIsPickupSelected] = useState(pickupTypes.includes(orderState?.options?.type))
85
+ const [isCateringSelected, setIsCateringSelected] = useState(cateringTypes.includes(orderState?.options?.type))
86
+ const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
87
+ const [favoriteIds, setFavoriteIds] = useState([])
88
+ const [businessesLocations, setBusinessesLocations] = useState([])
89
+ const [filterByCity, setFilterByCity] = useState(false)
90
+ const [citySelected, setCitySelected] = useState(null)
91
+
92
+ const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
93
+
94
+ const isChew = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
95
+ const cateringTypeString = orderState?.options?.type === 7
96
+ ? 'catering_delivery'
97
+ : orderState?.options?.type === 8
98
+ ? 'catering_pickup'
99
+ : null
100
+ const configTypes = configs?.order_types_allowed?.value.split('|').filter(value => (allOrderTypes.includes(Number(value)))).map(value => Number(value)) || []
101
+ const cateringValues = preorderBusiness?.configs && getCateringValues(cateringTypeString, preorderBusiness?.configs)
102
+ const googleMapsApiKey = configs?.google_maps_api_key?.value
103
+ const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map(value => Number(value)) || []
104
+ const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
105
+
106
+ const defaultLocation = {
107
+ lat: 40.7744146,
108
+ lng: -73.9678064
109
+ }
110
+
111
+ const handleClickAddress = (e) => {
112
+ if (auth) {
113
+ setModals({ ...modals, listOpen: true })
114
+ } else {
115
+ setModals({ ...modals, formOpen: true })
116
+ }
117
+ }
118
+
119
+ const handleCloseAlerts = () => {
120
+ setAlertState({ open: false, content: [] })
121
+ setMapErrors('')
122
+ }
123
+
124
+ const handleClosePreorder = () => {
125
+ setIsPreorder(false)
126
+ setPreorderBusiness(null)
127
+ }
128
+
129
+ const handleOpenCities = (value) => {
130
+ if (!citiesState?.cities?.length) {
131
+ getCities()
132
+ }
133
+ setFilterByCity(value)
134
+ }
135
+
136
+ const handleChangeCity = (cityId) => {
137
+ changeCityFilter(cityId === orderState?.options?.city_id ? null : cityId)
138
+ }
139
+
140
+ const handleChangeType = (value) => {
141
+ if (!orderState?.loading) {
142
+ changeType(value)
143
+ if (value === 1) {
144
+ setIsPickupSelected(false)
145
+ setIsCateringSelected(false)
146
+ }
147
+ }
148
+ }
149
+
150
+ const handleChangeOrderTypes = (configTypes, isPickup) => {
151
+ const firstEnabledPickupType = orderTypes.find(type => configTypes?.includes(type.value) && type.value !== 1)?.value
152
+ handleChangeType(firstEnabledPickupType)
153
+ if (isPickup) {
154
+ setIsPickupSelected(true)
155
+ setIsCateringSelected(false)
156
+ } else {
157
+ setIsCateringSelected(true)
158
+ setIsPickupSelected(false)
159
+ }
160
+ }
161
+
162
+ useEffect(() => {
163
+ if (preorderBusiness) setIsPreorder(true)
164
+ }, [preorderBusiness])
165
+
166
+ useEffect(() => {
167
+ if (!businessesList?.businesses?.length) return
168
+ const ids = [...favoriteIds]
169
+ businessesList.businesses.forEach(business => {
170
+ if (business?.favorite) {
171
+ ids.push(business.id)
172
+ }
173
+ })
174
+ setFavoriteIds([...new Set(ids)])
175
+ }, [businessesList?.businesses?.length])
176
+
177
+ useEffect(() => {
178
+ if (!citiesState?.cities?.length || !orderState?.options?.city_id) return
179
+ const selectedCity = citiesState?.cities?.find(city => city?.id === orderState?.options?.city_id)
180
+ if (!selectedCity || !selectedCity?.enabled) changeCityFilter(null)
181
+ }, [citiesState, orderState?.options?.city_id])
182
+
183
+ useEffect(() => {
184
+ setBusinessesLocations(businessesList?.businesses?.map(business => ({
185
+ ...business?.location,
186
+ icon: business?.logo || theme?.images?.dummies?.businessLogo,
187
+ slug: business?.slug,
188
+ id: business?.id,
189
+ address: business?.address
190
+ })))
191
+ }, [businessesList?.businesses])
192
+
193
+ const googleMapsControls = {
194
+ defaultZoom: 17,
195
+ zoomControl: true,
196
+ streetViewControl: false,
197
+ fullscreenControl: false,
198
+ mapTypeId: 'roadmap', // 'roadmap', 'satellite', 'hybrid', 'terrain'
199
+ mapTypeControl: true,
200
+ mapTypeControlOptions: {
201
+ mapTypeIds: ['roadmap', 'satellite']
202
+ },
203
+ isMarkerDraggable: false
204
+ }
205
+
206
+ const OrderTypesComponent = ({ title, configTypes }) => {
207
+ return (
208
+ <>
209
+ <AdditionalTypesWrapper>
210
+ <p>{title}</p>
211
+ <AdditionalTypesContainer>
212
+ {orderTypes && (configTypes ? orderTypes.filter(type => configTypes?.includes(type.value) && type.value !== 1) : orderTypes).map((item, i) => (
213
+ <Button
214
+ key={item.value}
215
+ onClick={() => handleChangeType(item.value)}
216
+ color={orderState?.options?.type === item?.value ? 'primary' : 'secondary'}
217
+ disabled={orderState?.loading}
218
+ className={orderState?.options?.type !== item?.value ? 'activated' : ''}
219
+ >
220
+ {item.text}
221
+ </Button>
222
+ ))}
223
+ </AdditionalTypesContainer>
224
+ </AdditionalTypesWrapper>
225
+ </>
226
+ )
227
+ }
228
+
229
+ return (
230
+ <BusinessContainer>
231
+ <BusinessListContainer>
232
+ <Title>{t('SELECT_YOUR_DELIVERY_TYPE', 'Select your Delivery type')}</Title>
233
+ <Subtitle>{t('SELECT_YOUR_DELIVERY_TYPE_DESCRIPTION', 'Please select the type of delivery for your order.')}</Subtitle>
234
+ <TypesContainer>
235
+ {configTypes.includes(1) && (
236
+ <TypeButton onClick={() => handleChangeType(1)} disabled={orderState?.loading} activated={!isPickupSelected && !isCateringSelected}>
237
+ <IconTypeButton activated={!isPickupSelected && !isCateringSelected}>
238
+ <img
239
+ src={theme?.images?.general?.deliveryIco}
240
+ width={20}
241
+ height={20}
242
+ />
243
+ </IconTypeButton>
244
+ <p>{t('DELIVERY', 'Delivery')}</p>
245
+ </TypeButton>
246
+ )}
247
+ {configTypes.some(type => pickupTypes.includes(type)) && (
248
+ <TypeButton
249
+ disabled={orderState?.loading}
250
+ activated={isPickupSelected}
251
+ onClick={() => handleChangeOrderTypes(pickupTypes, true)}
252
+ >
253
+ <IconTypeButton activated={isPickupSelected}>
254
+ <img
255
+ src={theme?.images?.general?.pickupIco}
256
+ width={22}
257
+ height={22}
258
+ />
259
+ </IconTypeButton>
260
+ <p>{t('PICKUP', 'Pickup')}</p>
261
+ </TypeButton>
262
+ )}
263
+ {configTypes.some(type => cateringTypes.includes(type)) && (
264
+ <TypeButton
265
+ disabled={orderState?.loading}
266
+ activated={isCateringSelected}
267
+ onClick={() => handleChangeOrderTypes(cateringTypes)}
268
+ >
269
+ <IconTypeButton activated={isCateringSelected}>
270
+ <img
271
+ src={theme?.images?.general?.cateringIco}
272
+ width={22}
273
+ height={22}
274
+ />
275
+ </IconTypeButton>
276
+ <p>{t('CATERING', 'Catering')}</p>
277
+ </TypeButton>
278
+ )}
279
+ </TypesContainer>
280
+ {isPickupSelected && (
281
+ <OrderTypesComponent
282
+ title={t('WHAT_PICKUP_YOU_NEED', 'What kind of pickup do you need?')}
283
+ configTypes={pickupTypes}
284
+ />
285
+ )}
286
+ {isCateringSelected && (
287
+ <OrderTypesComponent
288
+ title={t('WHAT_CATERING_YOU_NEED', 'What kind of catering do you need?')}
289
+ configTypes={cateringTypes}
290
+ />
291
+ )}
292
+ <WrapInput onClick={handleClickAddress} withIcon>
293
+ <HiOutlineLocationMarker />
294
+ <p>
295
+ {orderState?.options?.address?.address || t('WHERE_DO_WE_DELIVERY', theme?.defaultLanguages?.WHERE_DO_WE_DELIVERY || 'Where do we delivery?')}
296
+ </p>
297
+ </WrapInput>
298
+ <ViewLocations>
299
+ <p onClick={() =>
300
+ filterByCity
301
+ ? handleOpenCities(false)
302
+ : handleOpenCities(true)}
303
+ >
304
+ {filterByCity ? t('HIDE_LOCATIONS', 'Hide locations') : t('VIEW_ALL_LOCATIONS', 'View all locations')}
305
+ </p>
306
+ </ViewLocations>
307
+ {filterByCity && (
308
+ <CitiesContainer>
309
+ {citiesState?.cities?.filter(city => businessesList.businesses?.some(business => business?.city_id === city?.id))?.map((city, i, hash) => (
310
+ <div key={city?.id}>
311
+ <CityContainer
312
+ isSelected={citySelected?.id === city?.id}
313
+ onClick={() => setCitySelected(citySelected?.id === city?.id ? null : city)}
314
+ >
315
+ <h3>
316
+ {city?.name}
317
+ </h3>
318
+ <RiArrowDropDownLine size={18} />
319
+ </CityContainer>
320
+ {citySelected?.id === city?.id && (
321
+ <>
322
+ {
323
+ businessesList.businesses?.filter(business => business?.city_id === city?.id)?.map((business) => (
324
+ <BusinessController
325
+ key={business.id}
326
+ className='card'
327
+ business={business}
328
+ isBusinessOpen={business.open}
329
+ handleCustomClick={handleBusinessClick}
330
+ orderType={orderState?.options?.type}
331
+ isCustomLayout={isCustomLayout}
332
+ isCustomerMode={isCustomerMode}
333
+ onPreorderBusiness={setPreorderBusiness}
334
+ businessHeader={business?.header}
335
+ businessFeatured={business?.featured}
336
+ businessOffers={business?.offers}
337
+ businessLogo={business?.logo}
338
+ businessReviews={business?.reviews?.total}
339
+ businessDeliveryPrice={business?.delivery_price}
340
+ businessDeliveryTime={business?.delivery_time}
341
+ businessPickupTime={business?.pickup_time}
342
+ businessDistance={business?.distance}
343
+ handleUpdateBusinessList={handleUpdateBusinessList}
344
+ favoriteIds={favoriteIds}
345
+ setFavoriteIds={setFavoriteIds}
346
+ />
347
+ ))
348
+ }
349
+ {paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
350
+ <LoadMoreButtonCityWrap>
351
+ <Button
352
+ onClick={() => getBusinesses()}
353
+ color='primary'
354
+ >
355
+ {t('LOAD_MORE_BUSINESSES', 'Load more businesses')}
356
+ </Button>
357
+ </LoadMoreButtonCityWrap>
358
+ )}
359
+ </>
360
+ )}
361
+ {(i + 1) !== hash?.length && (
362
+ <Separator />
363
+ )}
364
+ </div>
365
+ ))}
366
+ </CitiesContainer>
367
+ )}
368
+ {filterByCity && citiesState?.loading && [...Array(4)].map((_, i) => (
369
+ <Skeleton height={70} style={{ marginBottom: 5 }} key={i} />
370
+ ))}
371
+ {!filterByCity && (
372
+ <>
373
+ {(isAllowUnaddressOrderType || orderState?.options?.address?.location) && !isChew && hasHighRatedBusiness && !hideHighestBusiness && (
374
+ <HightestRatedWrapper>
375
+ <Divider />
376
+ <HighestRated
377
+ propsToFetch={props.propsToFetch}
378
+ handleClickAddress={handleClickAddress}
379
+ setHasHighRatedBusiness={setHasHighRatedBusiness}
380
+ onBusinessClick={onBusinessClick}
381
+ isCustomerMode={isCustomerMode}
382
+ favoriteIds={favoriteIds}
383
+ setFavoriteIds={setFavoriteIds}
384
+ disabledCities
385
+ franchiseId={franchiseId}
386
+ />
387
+ <Divider />
388
+ </HightestRatedWrapper>
389
+ )}
390
+
391
+ <>
392
+ <BusinessList>
393
+ {
394
+ (isAllowUnaddressOrderType || orderState?.options?.address?.location) && !businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
395
+ <NotFoundSource
396
+ content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
397
+ >
398
+ <Button
399
+ outline
400
+ color='primary'
401
+ onClick={() => handleClickAddress()}
402
+ style={{ height: '44px' }}
403
+ >
404
+ {t('CHANGE_ADDRESS', 'Select other Address')}
405
+ </Button>
406
+ </NotFoundSource>
407
+ )
408
+ }
409
+ {
410
+ (isAllowUnaddressOrderType || orderState?.options?.address?.location) ? businessesList.businesses?.map((business) => (
411
+ <BusinessController
412
+ key={business.id}
413
+ className='card'
414
+ business={business}
415
+ isBusinessOpen={business.open}
416
+ handleCustomClick={handleBusinessClick}
417
+ orderType={orderState?.options?.type}
418
+ isCustomLayout={isCustomLayout}
419
+ isCustomerMode={isCustomerMode}
420
+ onPreorderBusiness={setPreorderBusiness}
421
+ businessHeader={business?.header}
422
+ businessFeatured={business?.featured}
423
+ businessOffers={business?.offers}
424
+ businessLogo={business?.logo}
425
+ businessReviews={business?.reviews?.total}
426
+ businessDeliveryPrice={business?.delivery_price}
427
+ businessDeliveryTime={business?.delivery_time}
428
+ businessPickupTime={business?.pickup_time}
429
+ businessDistance={business?.distance}
430
+ handleUpdateBusinessList={handleUpdateBusinessList}
431
+ favoriteIds={favoriteIds}
432
+ setFavoriteIds={setFavoriteIds}
433
+ />
434
+ )) : (
435
+ <p>{t('ENTER_FULL_ADDRESS_TO_ORDER', 'Enter your full street address to start your delivery order.')}</p>
436
+ )
437
+ }
438
+ {(isAllowUnaddressOrderType || orderState?.options?.address?.location) && (businessesList.loading || !businessesList?.fetched) && (
439
+ [...Array(paginationProps?.nextPageItems > 4 ? paginationProps.nextPageItems : 8).keys()].map(i => (
440
+ <BusinessController
441
+ key={i}
442
+ className='card'
443
+ business={{}}
444
+ isSkeleton
445
+ orderType={orderState?.options?.type}
446
+ />
447
+ ))
448
+ )}
449
+ {(isAllowUnaddressOrderType || orderState?.options?.address?.location) && (
450
+ <PaginationContainer>
451
+ <Pagination
452
+ currentPage={paginationProps.currentPage}
453
+ totalPages={Math.ceil(paginationProps?.totalPages)}
454
+ handleChangePage={(page) => getBusinesses(true, page)}
455
+ />
456
+ </PaginationContainer>
457
+ )}
458
+ </BusinessList>
459
+ </>
460
+ </>
461
+ )}
462
+ </BusinessListContainer>
463
+ {!!googleMapsApiKey && (orderState?.options?.address?.location || isAllowUnaddressOrderType) && (
464
+ <WrapperMap>
465
+ <GoogleMapsMap
466
+ apiKey={googleMapsApiKey}
467
+ location={orderState?.options?.address?.location || defaultLocation}
468
+ locations={businessesLocations}
469
+ onBusinessClick={(slug) => onBusinessClick({ slug })}
470
+ businessMap
471
+ noDistanceValidation
472
+ mapControls={googleMapsControls}
473
+ maxLimitLocation={parseInt(configs?.meters_to_change_address?.value)}
474
+ />
475
+ </WrapperMap>
476
+ )}
477
+ <Modal
478
+ open={isPreorder}
479
+ width='760px'
480
+ onClose={() => handleClosePreorder()}
481
+ >
482
+ <BusinessPreorder
483
+ business={preorderBusiness}
484
+ handleClick={handleBusinessClick}
485
+ showButton
486
+ cateringPreorder={!!cateringTypeString}
487
+ {...cateringValues}
488
+ />
489
+ </Modal>
490
+ <Modal
491
+ open={modals.citiesOpen}
492
+ width='70%'
493
+ onClose={() => setModals({ ...modals, citiesOpen: false })}
494
+ padding='0px'
495
+ hideCloseDefault
496
+ >
497
+ <CitiesControl
498
+ cities={citiesState?.cities}
499
+ handleChangeCity={handleChangeCity}
500
+ onClose={() => setModals({ ...modals, citiesOpen: false })}
501
+ />
502
+ </Modal>
503
+
504
+ <Modal
505
+ {...(!auth && { title: t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?') })}
506
+ open={modals.formOpen || modals.listOpen}
507
+ width='70%'
508
+ onClose={() => setModals({ ...modals, formOpen: false, listOpen: false })}
509
+ >
510
+ {modals.listOpen ? (
511
+ <AddressList
512
+ isModal
513
+ changeOrderAddressWithDefault
514
+ userId={isNaN(userCustomer?.id) ? null : userCustomer?.id}
515
+ onCancel={() => setModals({ ...modals, listOpen: false })}
516
+ isCustomerMode={isCustomerMode}
517
+ />
518
+ ) : (
519
+ <AddressFormWrapper>
520
+ <AddressForm
521
+ useValidationFileds
522
+ address={orderState?.options?.address || {}}
523
+ onCancel={() => setModals({ ...modals, formOpen: false })}
524
+ onSaveAddress={() => setModals({ ...modals, formOpen: false })}
525
+ isCustomerMode={isCustomerMode}
526
+ />
527
+ </AddressFormWrapper>
528
+ )}
529
+ </Modal>
530
+
531
+ <Alert
532
+ title={!mapErrors ? t('SEARCH', 'Search') : t('BUSINESSES_MAP', 'Businesses Map')}
533
+ content={alertState.content}
534
+ acceptText={t('ACCEPT', 'Accept')}
535
+ open={alertState.open}
536
+ onClose={() => handleCloseAlerts()}
537
+ onAccept={() => handleCloseAlerts()}
538
+ closeOnBackdrop={false}
539
+ />
540
+ </BusinessContainer>
541
+ )
542
+ }
543
+
544
+ export const OloBusinessesListing = (props) => {
545
+ const [, t] = useLanguage()
546
+ const businessListingProps = {
547
+ ...props,
548
+ UIComponent: OloBusinessesListingUI,
549
+ paginationSettings: { initialPage: 1, pageSize: 25, controlType: 'infinity' },
550
+ orderTypes: props.orderTypes || [
551
+ {
552
+ value: 1,
553
+ text: t('DELIVERY', 'Delivery')
554
+ },
555
+ {
556
+ value: 2,
557
+ text: t('PICKUP', 'Pickup')
558
+ },
559
+ {
560
+ value: 3,
561
+ text: t('EAT_IN', 'Eat in')
562
+ },
563
+ {
564
+ value: 4,
565
+ text: t('CURBSIDE', 'Curbside')
566
+ },
567
+ {
568
+ value: 5,
569
+ text: t('DRIVE_THRU', 'Drive thru')
570
+ },
571
+ {
572
+ value: 7,
573
+ text: t('CATERING_DELIVERY', 'Catering delivery')
574
+ },
575
+ {
576
+ value: 8,
577
+ text: t('CATERING_PICKUP', 'Catering pickup')
578
+ }
579
+ ]
580
+ }
581
+ return <BusinessListController {...businessListingProps} />
582
+ }