ordering-ui-external 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/{0.ordering-ui.82b10af64edad46e950f.js → 0.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/{1.ordering-ui.82b10af64edad46e950f.js → 1.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/{2.ordering-ui.82b10af64edad46e950f.js → 2.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/{4.ordering-ui.82b10af64edad46e950f.js → 4.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/{5.ordering-ui.82b10af64edad46e950f.js → 5.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/{6.ordering-ui.82b10af64edad46e950f.js → 6.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/{7.ordering-ui.82b10af64edad46e950f.js → 7.ordering-ui.c12070c3ccac5ea49732.js} +1 -1
- package/_bundles/{7.ordering-ui.82b10af64edad46e950f.js.LICENSE.txt → 7.ordering-ui.c12070c3ccac5ea49732.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.82b10af64edad46e950f.js → 8.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/{9.ordering-ui.82b10af64edad46e950f.js → 9.ordering-ui.c12070c3ccac5ea49732.js} +0 -0
- package/_bundles/ordering-ui.c12070c3ccac5ea49732.js +2 -0
- package/_bundles/{ordering-ui.82b10af64edad46e950f.js.LICENSE.txt → ordering-ui.c12070c3ccac5ea49732.js.LICENSE.txt} +0 -0
- package/_modules/themes/five/src/components/AddressForm/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +2 -2
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +41 -62
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +10 -18
- package/_modules/themes/five/src/components/CartPopover/index.js +3 -4
- package/_modules/themes/five/src/components/Checkout/index.js +18 -10
- package/_modules/themes/five/src/components/CitiesControl/index.js +69 -0
- package/_modules/themes/five/src/components/CitiesControl/styles.js +18 -0
- package/_modules/themes/five/src/components/DriverTips/index.js +6 -22
- package/_modules/themes/five/src/components/Header/index.js +7 -6
- package/_modules/themes/five/src/components/HeaderOption/index.js +3 -3
- package/_modules/themes/five/src/components/MultiCheckout/index.js +21 -2
- package/_modules/themes/five/src/components/MultiCheckout/styles.js +14 -10
- package/_modules/themes/five/src/components/OrderProgress/index.js +9 -8
- package/_modules/themes/five/src/components/OrderProgress/styles.js +21 -17
- package/_modules/themes/five/src/components/PaymentOptions/index.js +2 -2
- package/_modules/themes/five/src/components/UserPopover/index.js +2 -2
- package/package.json +2 -2
- package/src/themes/five/src/components/AddressForm/styles.js +2 -1
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +53 -78
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +15 -54
- package/src/themes/five/src/components/CartPopover/index.js +2 -2
- package/src/themes/five/src/components/Checkout/index.js +47 -16
- package/src/themes/five/src/components/CitiesControl/index.js +56 -0
- package/src/themes/five/src/components/CitiesControl/styles.js +32 -0
- package/src/themes/five/src/components/DriverTips/index.js +46 -63
- package/src/themes/five/src/components/Header/index.js +3 -3
- package/src/themes/five/src/components/HeaderOption/index.js +2 -2
- package/src/themes/five/src/components/MultiCheckout/index.js +35 -2
- package/src/themes/five/src/components/MultiCheckout/styles.js +19 -0
- package/src/themes/five/src/components/OrderProgress/index.js +53 -49
- package/src/themes/five/src/components/OrderProgress/styles.js +9 -0
- package/src/themes/five/src/components/PaymentOptions/index.js +1 -1
- package/src/themes/five/src/components/UserPopover/index.js +1 -1
- package/_bundles/ordering-ui.82b10af64edad46e950f.js +0 -2
package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js
CHANGED
|
@@ -2,8 +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 IosRadioButtonOff from '@meronex/icons/ios/IosRadioButtonOff'
|
|
6
|
-
import RiRadioButtonFill from '@meronex/icons/ri/RiRadioButtonFill'
|
|
7
5
|
import FaMapMarkerAlt from '@meronex/icons/fa/FaMapMarkerAlt'
|
|
8
6
|
import {
|
|
9
7
|
useOrder,
|
|
@@ -17,16 +15,12 @@ import {
|
|
|
17
15
|
import {
|
|
18
16
|
BusinessContainer,
|
|
19
17
|
BusinessList,
|
|
20
|
-
// ErrorMessage,
|
|
21
18
|
WrapperSearch,
|
|
22
19
|
BusinessesTitle,
|
|
23
20
|
BusinessHeroImg,
|
|
24
21
|
HightestRatedWrapper,
|
|
25
22
|
Divider,
|
|
26
|
-
OrderProgressWrapper,
|
|
27
23
|
SearchContainer,
|
|
28
|
-
BusinessCityList,
|
|
29
|
-
CityItem,
|
|
30
24
|
BusinessLogo,
|
|
31
25
|
BusinessLogosContainer,
|
|
32
26
|
BusinessBanner,
|
|
@@ -34,8 +28,7 @@ import {
|
|
|
34
28
|
AddressMenu,
|
|
35
29
|
FeatureItems,
|
|
36
30
|
ItemInline,
|
|
37
|
-
BusinessLogosWrapper
|
|
38
|
-
ButtonWrapper
|
|
31
|
+
BusinessLogosWrapper
|
|
39
32
|
} from './styles'
|
|
40
33
|
import { useWindowSize } from '../../../../../../../hooks/useWindowSize'
|
|
41
34
|
import { Button } from '../../../../styles/Buttons'
|
|
@@ -60,8 +53,8 @@ import { PageBanner } from '../../../PageBanner'
|
|
|
60
53
|
import Skeleton from 'react-loading-skeleton'
|
|
61
54
|
import { MomentPopover } from '../../../../../../pwa/src/components/MomentPopover'
|
|
62
55
|
import { OrderTypeSelectorHeader } from '../../../../../../../components/OrderTypeSelectorHeader'
|
|
63
|
-
import BsArrowRight from '@meronex/icons/bs/BsArrowRight'
|
|
64
56
|
import { AutoScroll } from '../../../AutoScroll'
|
|
57
|
+
import { CitiesControl } from '../../../CitiesControl'
|
|
65
58
|
|
|
66
59
|
const PIXELS_TO_SCROLL = 300
|
|
67
60
|
|
|
@@ -91,20 +84,19 @@ const BusinessesListingUI = (props) => {
|
|
|
91
84
|
const [{ auth }] = useSession()
|
|
92
85
|
const [{ configs }] = useConfig()
|
|
93
86
|
const windowSize = useWindowSize()
|
|
94
|
-
const [
|
|
87
|
+
const [orderingTheme] = useOrderingTheme()
|
|
95
88
|
const theme = useTheme()
|
|
96
89
|
const [modals, setModals] = useState({ listOpen: false, formOpen: false, citiesOpen: false })
|
|
97
90
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
98
91
|
const [activeMap, setActiveMap] = useState(false)
|
|
99
92
|
const [openPopover, setOpenPopover] = useState({})
|
|
100
93
|
const [mapErrors, setMapErrors] = useState('')
|
|
101
|
-
const [actualCity, setActualCity] = useState(orderState?.options?.city_id)
|
|
102
94
|
const [isPreorder, setIsPreorder] = useState(false)
|
|
103
95
|
const [preorderBusiness, setPreorderBusiness] = useState(null)
|
|
104
96
|
const [hasHighRatedBusiness, setHasHighRatedBusiness] = useState(true)
|
|
105
97
|
const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
|
|
106
98
|
const [favoriteIds, setFavoriteIds] = useState([])
|
|
107
|
-
const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
|
|
99
|
+
const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2) ?? true
|
|
108
100
|
const hideSearch = theme?.business_listing_view?.components?.search?.hidden
|
|
109
101
|
const hideFilter = theme?.business_listing_view?.components?.filter?.hidden
|
|
110
102
|
const hideSearchSection = hideCities && hideSearch && hideFilter
|
|
@@ -113,7 +105,7 @@ const BusinessesListingUI = (props) => {
|
|
|
113
105
|
businessesList.businesses &&
|
|
114
106
|
businessesList.businesses?.map(business => business.id)
|
|
115
107
|
const configTypes = configState?.configs?.order_types_allowed?.value.split('|').map(value => Number(value)) || []
|
|
116
|
-
const isChew = orderingTheme?.theme?.header?.components?.layout?.type === '
|
|
108
|
+
const isChew = orderingTheme?.theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
117
109
|
|
|
118
110
|
const handleScroll = useCallback(() => {
|
|
119
111
|
const innerHeightScrolltop = window.innerHeight + document.documentElement?.scrollTop + PIXELS_TO_SCROLL
|
|
@@ -265,10 +257,11 @@ const BusinessesListingUI = (props) => {
|
|
|
265
257
|
) : (
|
|
266
258
|
<>
|
|
267
259
|
{businessesList.businesses
|
|
268
|
-
?.filter(business => business?.
|
|
260
|
+
?.filter(business => business?.open)
|
|
269
261
|
?.map(business => (
|
|
270
262
|
<BusinessLogo
|
|
271
263
|
key={business?.id}
|
|
264
|
+
isActive={actualSlug === business?.slug}
|
|
272
265
|
bgimage={business?.logo || theme.images?.dummies?.businessLogo}
|
|
273
266
|
onClick={() => onBusinessClick(business)}
|
|
274
267
|
/>
|
|
@@ -290,46 +283,47 @@ const BusinessesListingUI = (props) => {
|
|
|
290
283
|
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
291
284
|
<BeforeComponent key={i} {...props} />))}
|
|
292
285
|
<BusinessContainer>
|
|
293
|
-
<
|
|
294
|
-
|
|
295
|
-
<
|
|
296
|
-
<
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
<
|
|
304
|
-
<
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
<
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
286
|
+
{(windowSize.width < 576 || (configs?.business_listing_hide_image?.value !== '1' && !isChew)) && (
|
|
287
|
+
<BusinessBanner>
|
|
288
|
+
{windowSize.width < 576 && (
|
|
289
|
+
<BusinessFeatures>
|
|
290
|
+
<AddressMenu
|
|
291
|
+
onClick={() => handleClickAddress()}
|
|
292
|
+
>
|
|
293
|
+
<FaMapMarkerAlt />
|
|
294
|
+
<span>{orderState.options?.address?.address || t('WHERE_DO_WE_DELIVERY', 'Where do we delivery?')}</span>
|
|
295
|
+
</AddressMenu>
|
|
296
|
+
<FeatureItems>
|
|
297
|
+
<ItemInline>
|
|
298
|
+
<OrderTypeSelectorHeader configTypes={configTypes} />
|
|
299
|
+
</ItemInline>
|
|
300
|
+
<ItemInline>
|
|
301
|
+
<MomentPopover
|
|
302
|
+
open={openPopover.moment}
|
|
303
|
+
onClick={() => handleTogglePopover('moment')}
|
|
304
|
+
onClose={() => handleClosePopover('moment')}
|
|
305
|
+
isBanner
|
|
306
|
+
/>
|
|
307
|
+
</ItemInline>
|
|
308
|
+
</FeatureItems>
|
|
309
|
+
</BusinessFeatures>
|
|
310
|
+
)}
|
|
311
|
+
{(configs?.business_listing_hide_image?.value !== '1' && !isChew) && (
|
|
312
|
+
<BusinessHeroImg
|
|
313
|
+
bgimage={theme.images?.general?.businessHero}
|
|
314
|
+
height={theme?.business_listing_view?.components?.business_hero?.style?.height}
|
|
315
|
+
/>
|
|
316
|
+
)}
|
|
317
|
+
</BusinessBanner>
|
|
318
|
+
)}
|
|
324
319
|
{!!Object.values(orderState?.carts)?.length && (
|
|
325
|
-
<
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
</OrderProgressWrapper>
|
|
320
|
+
<OrderProgress
|
|
321
|
+
isChew={isChew}
|
|
322
|
+
franchiseId={props.franchiseId}
|
|
323
|
+
userCustomerId={userCustomer?.id}
|
|
324
|
+
asDashboard={isCustomerMode}
|
|
325
|
+
isCustomerMode={isCustomerMode}
|
|
326
|
+
/>
|
|
333
327
|
)}
|
|
334
328
|
{(configs?.business_listing_hide_image?.value !== '1' && isChew) && (
|
|
335
329
|
<BusinessHeroImg
|
|
@@ -434,7 +428,7 @@ const BusinessesListingUI = (props) => {
|
|
|
434
428
|
<OrdersSection />
|
|
435
429
|
)}
|
|
436
430
|
<>
|
|
437
|
-
{!isCustomLayout && isCustomerMode && businessesList?.businesses?.length > 0 && (
|
|
431
|
+
{((!isCustomLayout && isCustomerMode && businessesList?.businesses?.length > 0) || isChew) && (
|
|
438
432
|
<BusinessesTitle>
|
|
439
433
|
{t('BUSINESSES', 'Businesses')}
|
|
440
434
|
</BusinessesTitle>
|
|
@@ -544,30 +538,11 @@ const BusinessesListingUI = (props) => {
|
|
|
544
538
|
width='70%'
|
|
545
539
|
onClose={() => setModals({ ...modals, citiesOpen: false })}
|
|
546
540
|
>
|
|
547
|
-
<
|
|
548
|
-
{
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
<>
|
|
553
|
-
{citiesState?.cities?.map(city => (
|
|
554
|
-
<CityItem key={city?.id} onClick={() => setActualCity(city?.id)}>
|
|
555
|
-
<span className='radio'>
|
|
556
|
-
{city?.id === actualCity ? <RiRadioButtonFill className='city-checked' /> : <IosRadioButtonOff />}
|
|
557
|
-
</span>
|
|
558
|
-
{city?.name}
|
|
559
|
-
</CityItem>
|
|
560
|
-
))}
|
|
561
|
-
<ButtonWrapper>
|
|
562
|
-
<Button color='primary' disabled={actualCity === null} onClick={() => handleChangeCity(actualCity)}>
|
|
563
|
-
{t('CONTINUE', 'Continue')}
|
|
564
|
-
</Button>
|
|
565
|
-
<BsArrowRight />
|
|
566
|
-
</ButtonWrapper>
|
|
567
|
-
</>
|
|
568
|
-
)
|
|
569
|
-
}
|
|
570
|
-
</BusinessCityList>
|
|
541
|
+
<CitiesControl
|
|
542
|
+
cities={citiesState?.cities}
|
|
543
|
+
handleChangeCity={handleChangeCity}
|
|
544
|
+
onClose={() => setModals({ ...modals, citiesOpen: false })}
|
|
545
|
+
/>
|
|
571
546
|
</Modal>
|
|
572
547
|
|
|
573
548
|
<Alert
|
package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js
CHANGED
|
@@ -221,54 +221,12 @@ export const Divider = styled.div`
|
|
|
221
221
|
width: 100%;
|
|
222
222
|
`
|
|
223
223
|
|
|
224
|
-
export const OrderProgressWrapper = styled.div`
|
|
225
|
-
padding: ${props => props.isChew ? '110px 20px 45px' : '45px 20px'};
|
|
226
|
-
margin: 0px;
|
|
227
|
-
@media (min-width: 768px) {
|
|
228
|
-
margin: 0 35px;
|
|
229
|
-
padding: 45px 20px;
|
|
230
|
-
}
|
|
231
|
-
`
|
|
232
|
-
|
|
233
224
|
export const SearchContainer = styled.div`
|
|
234
225
|
display: flex;
|
|
235
226
|
justify-content: space-between;
|
|
236
227
|
align-items: center;
|
|
237
228
|
`
|
|
238
229
|
|
|
239
|
-
export const BusinessCityList = styled.div`
|
|
240
|
-
|
|
241
|
-
`
|
|
242
|
-
|
|
243
|
-
export const ButtonWrapper = styled.div`
|
|
244
|
-
position: relative;
|
|
245
|
-
svg {
|
|
246
|
-
position: absolute;
|
|
247
|
-
right: 10px;
|
|
248
|
-
top: 8px;
|
|
249
|
-
font-size: 25px;
|
|
250
|
-
color: #ffffff;
|
|
251
|
-
}
|
|
252
|
-
button {
|
|
253
|
-
width: 100%;
|
|
254
|
-
padding: 5px;
|
|
255
|
-
}
|
|
256
|
-
`
|
|
257
|
-
|
|
258
|
-
export const CityItem = styled.div`
|
|
259
|
-
display: flex;
|
|
260
|
-
justify-content: flex-start;
|
|
261
|
-
align-items: center;
|
|
262
|
-
padding: 15px 0px;
|
|
263
|
-
cursor: pointer;
|
|
264
|
-
span {
|
|
265
|
-
margin-right: 15px;
|
|
266
|
-
}
|
|
267
|
-
.city-checked{
|
|
268
|
-
color: ${props => props.theme.colors.primary};
|
|
269
|
-
}
|
|
270
|
-
`
|
|
271
|
-
|
|
272
230
|
export const BusinessLogosWrapper = styled.div`
|
|
273
231
|
overflow: scroll hidden;
|
|
274
232
|
width: 100%;
|
|
@@ -276,18 +234,21 @@ export const BusinessLogosWrapper = styled.div`
|
|
|
276
234
|
|
|
277
235
|
|
|
278
236
|
const BusinessLogoStyled = styled.div`
|
|
279
|
-
min-width: 100px;
|
|
280
|
-
min-height: 100px;
|
|
281
|
-
height: 100px;
|
|
282
|
-
width: 100px;
|
|
283
|
-
box-sizing: border-box;
|
|
284
|
-
background-repeat: no-repeat, repeat;
|
|
285
|
-
background-size: cover;
|
|
286
|
-
object-fit: cover;
|
|
287
|
-
background-position: center;
|
|
288
|
-
border-radius: 7.6px;
|
|
289
|
-
margin-right: 15px;
|
|
290
|
-
cursor: pointer;
|
|
237
|
+
min-width: 100px;
|
|
238
|
+
min-height: 100px;
|
|
239
|
+
height: 100px;
|
|
240
|
+
width: 100px;
|
|
241
|
+
box-sizing: border-box;
|
|
242
|
+
background-repeat: no-repeat, repeat;
|
|
243
|
+
background-size: cover;
|
|
244
|
+
object-fit: cover;
|
|
245
|
+
background-position: center;
|
|
246
|
+
border-radius: 7.6px;
|
|
247
|
+
margin-right: 15px;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
${props => props.isActive && css`
|
|
250
|
+
border: 2px solid ${props => props.theme.colors.primary};
|
|
251
|
+
`};
|
|
291
252
|
`
|
|
292
253
|
|
|
293
254
|
export const BusinessLogo = (props) => {
|
|
@@ -26,7 +26,7 @@ export const CartPopover = (props) => {
|
|
|
26
26
|
const referenceElement = useRef()
|
|
27
27
|
const popperElement = useRef()
|
|
28
28
|
const arrowElement = useRef()
|
|
29
|
-
const isChew = orderingTheme?.theme?.header?.components?.layout?.type === '
|
|
29
|
+
const isChew = orderingTheme?.theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
30
30
|
const popper = usePopper(referenceElement.current, popperElement.current, {
|
|
31
31
|
placement: theme?.rtl ? 'bottom' : 'bottom-end',
|
|
32
32
|
modifiers: [
|
|
@@ -40,7 +40,7 @@ export const CartPopover = (props) => {
|
|
|
40
40
|
]
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
const { styles, attributes
|
|
43
|
+
const { styles, attributes } = popper
|
|
44
44
|
|
|
45
45
|
const isSlideBar = orderingTheme?.theme?.header?.components?.cart?.open_strategy?.type === 'slide'
|
|
46
46
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
useValidationFields,
|
|
14
14
|
useConfig,
|
|
15
15
|
useCustomer,
|
|
16
|
-
|
|
16
|
+
useOrderingTheme
|
|
17
17
|
} from 'ordering-components-external'
|
|
18
18
|
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
19
19
|
import { UpsellingPage } from '../UpsellingPage'
|
|
@@ -94,14 +94,13 @@ const CheckoutUI = (props) => {
|
|
|
94
94
|
|
|
95
95
|
const theme = useTheme()
|
|
96
96
|
const [validationFields] = useValidationFields()
|
|
97
|
-
|
|
97
|
+
const [orderingTheme] = useOrderingTheme()
|
|
98
98
|
const [{ options, loading }] = useOrder()
|
|
99
99
|
const [, t] = useLanguage()
|
|
100
100
|
const [{ parsePrice }] = useUtils()
|
|
101
101
|
const [{ user }] = useSession()
|
|
102
102
|
const [{ configs }] = useConfig()
|
|
103
103
|
const [customerState] = useCustomer()
|
|
104
|
-
const [events] = useEvent()
|
|
105
104
|
const history = useHistory()
|
|
106
105
|
const windowSize = useWindowSize()
|
|
107
106
|
|
|
@@ -118,6 +117,7 @@ const CheckoutUI = (props) => {
|
|
|
118
117
|
const isWalletCashEnabled = businessConfigs.find(config => config.key === 'wallet_cash_enabled')?.value === '1'
|
|
119
118
|
const isWalletCreditPointsEnabled = businessConfigs.find(config => config.key === 'wallet_credit_point_enabled')?.value === '1'
|
|
120
119
|
const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled) && !useKioskApp
|
|
120
|
+
const isMultiDriverTips = orderingTheme?.theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
121
121
|
|
|
122
122
|
const placeSpotTypes = [3, 4, 5]
|
|
123
123
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type) && !useKioskApp
|
|
@@ -220,7 +220,7 @@ const CheckoutUI = (props) => {
|
|
|
220
220
|
const handleScrollTo = () => {
|
|
221
221
|
if (!((!paymethodSelected && cart?.balance > 0) && cart?.status !== 2)) return
|
|
222
222
|
const scrollElement = document.querySelector('.paymentsContainer')
|
|
223
|
-
window.scrollTo(0, scrollElement.offsetTop - 20)
|
|
223
|
+
window.scrollTo(0, scrollElement.offsetTop - 20)
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
useEffect(() => {
|
|
@@ -421,6 +421,35 @@ const CheckoutUI = (props) => {
|
|
|
421
421
|
/>
|
|
422
422
|
</WalletPaymentOptionContainer>
|
|
423
423
|
)}
|
|
424
|
+
|
|
425
|
+
{
|
|
426
|
+
isMultiDriverTips &&
|
|
427
|
+
!cartState.loading &&
|
|
428
|
+
cart &&
|
|
429
|
+
cart?.business_id &&
|
|
430
|
+
options.type === 1 &&
|
|
431
|
+
cart?.status !== 2 &&
|
|
432
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
433
|
+
driverTipsOptions.length > 0 &&
|
|
434
|
+
!useKioskApp &&
|
|
435
|
+
(
|
|
436
|
+
<DriverTipContainer>
|
|
437
|
+
<h1>{t('DRIVER_TIPS', 'Driver Tips')}</h1>
|
|
438
|
+
<p>{t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')}</p>
|
|
439
|
+
<DriverTips
|
|
440
|
+
businessId={cart?.business_id}
|
|
441
|
+
driverTipsOptions={driverTipsOptions}
|
|
442
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
443
|
+
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
444
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
445
|
+
? cart?.driver_tip
|
|
446
|
+
: cart?.driver_tip_rate}
|
|
447
|
+
cart={cart}
|
|
448
|
+
useOrderContext
|
|
449
|
+
/>
|
|
450
|
+
</DriverTipContainer>
|
|
451
|
+
)
|
|
452
|
+
}
|
|
424
453
|
</WrapperLeftContent>
|
|
425
454
|
</WrapperLeftContainer>
|
|
426
455
|
<WrapperRightContainer>
|
|
@@ -437,6 +466,7 @@ const CheckoutUI = (props) => {
|
|
|
437
466
|
</SelectSpotContainer>
|
|
438
467
|
)}
|
|
439
468
|
{
|
|
469
|
+
!isMultiDriverTips &&
|
|
440
470
|
!cartState.loading &&
|
|
441
471
|
cart &&
|
|
442
472
|
cart?.business_id &&
|
|
@@ -524,9 +554,10 @@ const CheckoutUI = (props) => {
|
|
|
524
554
|
)}
|
|
525
555
|
|
|
526
556
|
{options.type === 1 &&
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
557
|
+
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
558
|
+
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
559
|
+
(Number(cart?.driver_tip) <= 0) &&
|
|
560
|
+
(
|
|
530
561
|
<WarningText>
|
|
531
562
|
{t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
|
|
532
563
|
</WarningText>
|
|
@@ -536,17 +567,17 @@ const CheckoutUI = (props) => {
|
|
|
536
567
|
<MobileWrapperPlaceOrderButton>
|
|
537
568
|
<span>{parsePrice(cart?.total)}</span>
|
|
538
569
|
<Button
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
570
|
+
color={(!cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100))) ? 'secundary' : 'primary'}
|
|
571
|
+
// disabled={isDisablePlaceOrderButton}
|
|
572
|
+
onClick={() => isDisablePlaceOrderButton ? handleScrollTo('.paymentsContainer') : handlePlaceOrder()}
|
|
573
|
+
>
|
|
574
|
+
{!cart?.valid_maximum ? (
|
|
544
575
|
`${t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order')}: ${parsePrice(cart?.maximum)}`
|
|
545
|
-
|
|
576
|
+
) : (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) ? (
|
|
546
577
|
`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
578
|
+
) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order')}
|
|
579
|
+
</Button>
|
|
580
|
+
</MobileWrapperPlaceOrderButton>
|
|
550
581
|
)}
|
|
551
582
|
<Alert
|
|
552
583
|
title={t('CUSTOMER_DETAILS', 'Customer Details')}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import Skeleton from 'react-loading-skeleton'
|
|
3
|
+
import { useLanguage, useOrder } from 'ordering-components-external'
|
|
4
|
+
import IosRadioButtonOff from '@meronex/icons/ios/IosRadioButtonOff'
|
|
5
|
+
import RiRadioButtonFill from '@meronex/icons/ri/RiRadioButtonFill'
|
|
6
|
+
import BsArrowRight from '@meronex/icons/bs/BsArrowRight'
|
|
7
|
+
|
|
8
|
+
import { ButtonWrapper, CityItem, Container } from './styles'
|
|
9
|
+
import { Button } from '../../styles/Buttons'
|
|
10
|
+
|
|
11
|
+
export const CitiesControl = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
cities,
|
|
14
|
+
onClose,
|
|
15
|
+
handleChangeCity
|
|
16
|
+
} = props
|
|
17
|
+
|
|
18
|
+
const [, t] = useLanguage()
|
|
19
|
+
const [orderState] = useOrder()
|
|
20
|
+
|
|
21
|
+
const [cityState, setCityState] = useState(orderState?.options?.city_id)
|
|
22
|
+
|
|
23
|
+
const handleClick = () => {
|
|
24
|
+
cityState !== orderState?.options?.city_id && handleChangeCity(cityState)
|
|
25
|
+
onClose && onClose()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Container>
|
|
30
|
+
{
|
|
31
|
+
orderState?.loading ? (
|
|
32
|
+
<Skeleton height={40} count={3} style={{ marginBottom: '10px' }} />
|
|
33
|
+
) : (
|
|
34
|
+
<>
|
|
35
|
+
{cities?.map(city => (
|
|
36
|
+
<CityItem key={city?.id} onClick={() => setCityState(city?.id === cityState ? null : city?.id)}>
|
|
37
|
+
<span className='radio'>
|
|
38
|
+
{city?.id === cityState
|
|
39
|
+
? <RiRadioButtonFill className='city-checked' />
|
|
40
|
+
: <IosRadioButtonOff />}
|
|
41
|
+
</span>
|
|
42
|
+
{city?.name}
|
|
43
|
+
</CityItem>
|
|
44
|
+
))}
|
|
45
|
+
<ButtonWrapper>
|
|
46
|
+
<Button color='primary' onClick={() => handleClick()}>
|
|
47
|
+
{t('CONTINUE', 'Continue')}
|
|
48
|
+
</Button>
|
|
49
|
+
<BsArrowRight />
|
|
50
|
+
</ButtonWrapper>
|
|
51
|
+
</>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
</Container>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const Container = styled.div``
|
|
4
|
+
|
|
5
|
+
export const CityItem = styled.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: flex-start;
|
|
8
|
+
align-items: center;
|
|
9
|
+
padding: 15px 0px;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
span {
|
|
12
|
+
margin-right: 15px;
|
|
13
|
+
}
|
|
14
|
+
.city-checked{
|
|
15
|
+
color: ${props => props.theme.colors.primary};
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
export const ButtonWrapper = styled.div`
|
|
20
|
+
position: relative;
|
|
21
|
+
svg {
|
|
22
|
+
position: absolute;
|
|
23
|
+
right: 10px;
|
|
24
|
+
top: 8px;
|
|
25
|
+
font-size: 25px;
|
|
26
|
+
color: #ffffff;
|
|
27
|
+
}
|
|
28
|
+
button {
|
|
29
|
+
width: 100%;
|
|
30
|
+
padding: 5px;
|
|
31
|
+
}
|
|
32
|
+
`
|
|
@@ -14,6 +14,7 @@ import { Button } from '../../styles/Buttons'
|
|
|
14
14
|
|
|
15
15
|
const DriverTipsUI = (props) => {
|
|
16
16
|
const {
|
|
17
|
+
isMulti,
|
|
17
18
|
driverTip,
|
|
18
19
|
driverTipsOptions,
|
|
19
20
|
cart,
|
|
@@ -38,69 +39,51 @@ const DriverTipsUI = (props) => {
|
|
|
38
39
|
: `0${configs?.format_number_currency?.value}`
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</TipCard>
|
|
87
|
-
))}
|
|
88
|
-
</WrapperTips>
|
|
89
|
-
)}
|
|
90
|
-
</>
|
|
91
|
-
{/* {isDriverTipUseCustom && !driverTipsOptions.includes(driverTip) && driverTip > 0 && (
|
|
92
|
-
<DriverTipMessage>
|
|
93
|
-
{t('CUSTOM_DRIVER_TIP_AMOUNT', 'The driver\'s current tip comes from a custom option')}
|
|
94
|
-
</DriverTipMessage>
|
|
95
|
-
)} */}
|
|
96
|
-
</DriverTipContainer>
|
|
97
|
-
{props.afterComponents?.map((AfterComponent, i) => (
|
|
98
|
-
<AfterComponent key={i} {...props} />))}
|
|
99
|
-
{props.afterElements?.map((AfterElement, i) => (
|
|
100
|
-
<React.Fragment key={i}>
|
|
101
|
-
{AfterElement}
|
|
102
|
-
</React.Fragment>))}
|
|
103
|
-
</>
|
|
42
|
+
<DriverTipContainer id='driver-tip-container'>
|
|
43
|
+
<>
|
|
44
|
+
{isDriverTipUseCustom && !isMulti ? (
|
|
45
|
+
<FormDriverTip>
|
|
46
|
+
<WrapperInput>
|
|
47
|
+
<Input
|
|
48
|
+
name='drivertip'
|
|
49
|
+
type='text'
|
|
50
|
+
value={value}
|
|
51
|
+
placeholder={placeholderCurrency}
|
|
52
|
+
onChange={handleChangeDriverTip}
|
|
53
|
+
/>
|
|
54
|
+
<Button
|
|
55
|
+
color='primary'
|
|
56
|
+
disabled={parseFloat(value || 0) < 0 || parseFloat(value || 0) === driverTip || value === ''}
|
|
57
|
+
onClick={() => {
|
|
58
|
+
handlerChangeOption(value)
|
|
59
|
+
setvalue('')
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{t('APPLY_TIP', 'Apply Tip')}
|
|
63
|
+
</Button>
|
|
64
|
+
</WrapperInput>
|
|
65
|
+
{parseFloat(driverTip || 0) > 0 && (
|
|
66
|
+
<DriverTipMessage>
|
|
67
|
+
{t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPriceType &&
|
|
68
|
+
` (${driverTip}%)`}: {isFixedPriceType ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
|
|
69
|
+
</DriverTipMessage>
|
|
70
|
+
)}
|
|
71
|
+
</FormDriverTip>
|
|
72
|
+
) : (
|
|
73
|
+
<WrapperTips>
|
|
74
|
+
{driverTipsOptions.map((option, i) => (
|
|
75
|
+
<TipCard
|
|
76
|
+
key={i}
|
|
77
|
+
className={`${option === driverTip ? 'active' : ''}`}
|
|
78
|
+
onClick={() => handlerChangeOption(option)}
|
|
79
|
+
>
|
|
80
|
+
{`${isFixedPriceType ? parsePrice(option) : `${option}%`}`}
|
|
81
|
+
</TipCard>
|
|
82
|
+
))}
|
|
83
|
+
</WrapperTips>
|
|
84
|
+
)}
|
|
85
|
+
</>
|
|
86
|
+
</DriverTipContainer>
|
|
104
87
|
)
|
|
105
88
|
}
|
|
106
89
|
|