ordering-ui-external 2.0.4 → 2.1.1
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.a228aa8797d9d0fc5a6c.js → 0.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{1.ordering-ui.a228aa8797d9d0fc5a6c.js → 1.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{2.ordering-ui.a228aa8797d9d0fc5a6c.js → 2.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{4.ordering-ui.a228aa8797d9d0fc5a6c.js → 4.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{5.ordering-ui.a228aa8797d9d0fc5a6c.js → 5.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{6.ordering-ui.a228aa8797d9d0fc5a6c.js → 6.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{7.ordering-ui.a228aa8797d9d0fc5a6c.js → 7.ordering-ui.3861d1cf52cf041c74c5.js} +1 -1
- package/_bundles/{7.ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt → 7.ordering-ui.3861d1cf52cf041c74c5.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.a228aa8797d9d0fc5a6c.js → 8.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{9.ordering-ui.a228aa8797d9d0fc5a6c.js → 9.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
- package/_bundles/{ordering-ui.a228aa8797d9d0fc5a6c.js → ordering-ui.3861d1cf52cf041c74c5.js} +2 -2
- package/_bundles/{ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt → ordering-ui.3861d1cf52cf041c74c5.js.LICENSE.txt} +0 -0
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +36 -28
- package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +48 -34
- package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +3 -1
- package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +8 -1
- package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +2 -1
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
- package/_modules/themes/five/src/components/Cart/index.js +73 -25
- package/_modules/themes/five/src/components/CartContent/index.js +3 -1
- package/_modules/themes/five/src/components/Checkout/index.js +25 -15
- package/_modules/themes/five/src/components/DriverTips/index.js +26 -15
- package/_modules/themes/five/src/components/GiftCard/GiftCardUI/index.js +63 -0
- package/_modules/themes/five/src/components/GiftCard/GiftCardUI/styles.js +27 -0
- package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +69 -0
- package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +29 -0
- package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +123 -0
- package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/styles.js +20 -0
- package/_modules/themes/five/src/components/GiftCard/SendGiftCard/index.js +114 -0
- package/_modules/themes/five/src/components/GiftCard/SendGiftCard/styles.js +14 -0
- package/_modules/themes/five/src/components/HorizontalOrdersLayout/index.js +8 -56
- package/_modules/themes/five/src/components/HorizontalOrdersLayout/styles.js +1 -1
- package/_modules/themes/five/src/components/LoginForm/index.js +6 -0
- package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +69 -0
- package/_modules/themes/five/src/components/OrderDetails/index.js +84 -76
- package/_modules/themes/five/src/components/OrderDetails/styles.js +1 -1
- package/_modules/themes/five/src/components/OrderItAgain/styles.js +3 -3
- package/_modules/themes/five/src/components/OrderProgress/index.js +5 -14
- package/_modules/themes/five/src/components/PageBanner/index.js +120 -6
- package/_modules/themes/five/src/components/PaymentOptions/index.js +22 -8
- package/_modules/themes/five/src/components/PaymentOptions/styles.js +9 -7
- package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +20 -14
- package/_modules/themes/five/src/components/ProfessionalFilter/index.js +23 -25
- package/_modules/themes/five/src/components/ProfessionalFilter/styles.js +6 -32
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +38 -22
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +3 -9
- package/_modules/themes/five/src/components/ServiceForm/index.js +10 -4
- package/_modules/themes/five/src/components/ServiceForm/styles.js +23 -25
- package/_modules/themes/five/src/components/SignUpForm/index.js +6 -0
- package/_modules/themes/five/src/components/SingleOrderCard/index.js +22 -16
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +13 -2
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +73 -51
- package/_modules/themes/five/src/components/SingleProfessionalCard/index.js +23 -7
- package/_modules/themes/five/src/components/SingleProfessionalCard/styles.js +29 -10
- package/_modules/themes/five/src/components/Wallets/index.js +2 -1
- package/package.json +2 -2
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +49 -35
- package/src/themes/five/src/components/BusinessBasicInformation/styles.js +26 -4
- package/src/themes/five/src/components/BusinessItemAccordion/index.js +1 -1
- package/src/themes/five/src/components/BusinessProductsCategories/index.js +7 -1
- package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +2 -2
- package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
- package/src/themes/five/src/components/Cart/index.js +44 -14
- package/src/themes/five/src/components/CartContent/index.js +1 -0
- package/src/themes/five/src/components/Checkout/index.js +67 -51
- package/src/themes/five/src/components/DriverTips/index.js +52 -40
- package/src/themes/five/src/components/GiftCard/GiftCardUI/index.js +59 -0
- package/src/themes/five/src/components/GiftCard/GiftCardUI/styles.js +41 -0
- package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +70 -0
- package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +52 -0
- package/src/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +122 -0
- package/src/themes/five/src/components/GiftCard/RedeemGiftCard/styles.js +41 -0
- package/src/themes/five/src/components/GiftCard/SendGiftCard/index.js +103 -0
- package/src/themes/five/src/components/GiftCard/SendGiftCard/styles.js +27 -0
- package/src/themes/five/src/components/HorizontalOrdersLayout/index.js +33 -79
- package/src/themes/five/src/components/HorizontalOrdersLayout/styles.js +0 -1
- package/src/themes/five/src/components/LoginForm/index.js +7 -0
- package/src/themes/five/src/components/OrderDetails/OrderEta.js +59 -0
- package/src/themes/five/src/components/OrderDetails/index.js +141 -133
- package/src/themes/five/src/components/OrderDetails/styles.js +0 -1
- package/src/themes/five/src/components/OrderItAgain/styles.js +6 -6
- package/src/themes/five/src/components/OrderProgress/index.js +3 -12
- package/src/themes/five/src/components/PageBanner/index.js +96 -4
- package/src/themes/five/src/components/PaymentOptions/index.js +26 -5
- package/src/themes/five/src/components/PaymentOptions/styles.js +4 -0
- package/src/themes/five/src/components/ProductOptionSubOption/styles.js +24 -4
- package/src/themes/five/src/components/ProfessionalFilter/index.js +18 -30
- package/src/themes/five/src/components/ProfessionalFilter/styles.js +1 -57
- package/src/themes/five/src/components/RenderProductsLayout/index.js +33 -17
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +0 -18
- package/src/themes/five/src/components/ServiceForm/index.js +11 -5
- package/src/themes/five/src/components/ServiceForm/styles.js +1 -9
- package/src/themes/five/src/components/SignUpForm/index.js +7 -0
- package/src/themes/five/src/components/SingleOrderCard/index.js +43 -26
- package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +12 -2
- package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +51 -4
- package/src/themes/five/src/components/SingleProfessionalCard/index.js +17 -6
- package/src/themes/five/src/components/SingleProfessionalCard/styles.js +33 -6
- package/src/themes/five/src/components/Wallets/index.js +2 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { useUtils } from 'ordering-components-external'
|
|
3
|
+
import moment from 'moment'
|
|
4
|
+
|
|
5
|
+
export const OrderEta = (props) => {
|
|
6
|
+
const {
|
|
7
|
+
order,
|
|
8
|
+
outputFormat
|
|
9
|
+
} = props
|
|
10
|
+
|
|
11
|
+
const [{ parseDate }] = useUtils()
|
|
12
|
+
const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
|
|
13
|
+
|
|
14
|
+
const getEstimatedDeliveryTime = () => {
|
|
15
|
+
let _estimatedTime
|
|
16
|
+
let totalEta = 0
|
|
17
|
+
const _delivery = order?.delivery_datetime_utc
|
|
18
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
19
|
+
: parseDate(order?.delivery_datetime)
|
|
20
|
+
if (order?.eta_current_status_time) {
|
|
21
|
+
const currentStatueEta = order?.eta_current_status_time
|
|
22
|
+
totalEta += currentStatueEta
|
|
23
|
+
let nextStatusTimes = 0
|
|
24
|
+
if (order?.eta_next_status_times) {
|
|
25
|
+
Object.keys(order.eta_next_status_times).map(key => {
|
|
26
|
+
if (!key.includes('status_penalty')) {
|
|
27
|
+
nextStatusTimes += order.eta_next_status_times[key]
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
totalEta += nextStatusTimes
|
|
33
|
+
|
|
34
|
+
const diffTimeAsSeconds = moment.utc(order?.reporting_data?.at[`status:${order.status}`]).add(order?.eta_current_status_time, 'minutes').diff(moment().utc(), 'seconds')
|
|
35
|
+
const diffTimeAsMinutes = Math.ceil(diffTimeAsSeconds / 60)
|
|
36
|
+
if (diffTimeAsMinutes <= 0) {
|
|
37
|
+
totalEta += (Math.floor(Math.abs(diffTimeAsMinutes / order?.eta_current_status_time) + 1) * order?.eta_current_status_penalty_time)
|
|
38
|
+
}
|
|
39
|
+
_estimatedTime = parseDate(moment(_delivery).add(totalEta, 'minutes'))
|
|
40
|
+
} else {
|
|
41
|
+
_estimatedTime = parseDate(moment(_delivery).add(order?.eta_time, 'minutes'))
|
|
42
|
+
}
|
|
43
|
+
setEstimatedDeliveryTime(_estimatedTime)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
getEstimatedDeliveryTime()
|
|
48
|
+
const interval = setInterval(() => {
|
|
49
|
+
getEstimatedDeliveryTime()
|
|
50
|
+
}, 1000)
|
|
51
|
+
return () => clearInterval(interval)
|
|
52
|
+
}, [order])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
{!outputFormat ? estimatedDeliveryTime : moment(estimatedDeliveryTime).format(outputFormat)}
|
|
57
|
+
</>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -28,7 +28,9 @@ import { OrderBillSection } from './OrderBillSection'
|
|
|
28
28
|
import { ActionsSection } from './ActionsSection'
|
|
29
29
|
import { OrderPreferencesSection } from './OrderPreferencesSections'
|
|
30
30
|
import { PlaceSpot } from '../PlaceSpot'
|
|
31
|
+
import { SendGiftCard } from '../GiftCard/SendGiftCard'
|
|
31
32
|
import { Confirm } from '../Confirm'
|
|
33
|
+
import { OrderEta } from './OrderEta'
|
|
32
34
|
|
|
33
35
|
import {
|
|
34
36
|
Container,
|
|
@@ -111,6 +113,7 @@ const OrderDetailsUI = (props) => {
|
|
|
111
113
|
const [isProductReviewed, setIsProductReviewed] = useState(false)
|
|
112
114
|
const [isDriverReviewed, setIsDriverReviewed] = useState(false)
|
|
113
115
|
const [isProReviewed, setIsProReviewed] = useState(false)
|
|
116
|
+
const [isGiftCardSent, setIsGiftCardSent] = useState(false)
|
|
114
117
|
const [unreadAlert, setUnreadAlert] = useState({ business: false, driver: false })
|
|
115
118
|
const [isReviewOpen, setIsReviewOpen] = useState(false)
|
|
116
119
|
const [reviewStatus, setReviewStatus] = useState({ order: false, product: false, driver: false, professional: false })
|
|
@@ -124,29 +127,31 @@ const OrderDetailsUI = (props) => {
|
|
|
124
127
|
const acceptedStatus = [1, 2, 5, 6, 10, 11, 12]
|
|
125
128
|
const completedStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
126
129
|
const placeSpotTypes = [3, 4, 5]
|
|
130
|
+
const activeStatus = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
|
|
127
131
|
const googleMapsApiKey = configs?.google_maps_api_key?.value
|
|
128
132
|
const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
|
|
129
133
|
|
|
130
|
-
const
|
|
134
|
+
const hideOrderActions = order?.delivery_type === 1
|
|
135
|
+
const isGiftCardOrder = !order?.business_id
|
|
131
136
|
|
|
132
137
|
const isOriginalLayout = orderingTheme?.theme?.confirmation?.components?.layout?.type === 'original'
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const
|
|
138
|
+
const hideDeliveryType = theme?.confirmation?.components?.order?.components?.delivery_type?.hidden
|
|
139
|
+
const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
|
|
140
|
+
const hideDeliveryProgress = theme?.confirmation?.components?.order?.components?.progress?.hidden
|
|
141
|
+
const hideBusinessPhone = theme?.confirmation?.components?.business?.components?.phone?.hidden
|
|
142
|
+
const hideBusinessMessages = theme?.confirmation?.components?.business?.components?.messages?.hidden
|
|
143
|
+
const hideBusinessEmail = theme?.confirmation?.components?.business?.components?.email?.hidden
|
|
144
|
+
const hideBusinessAddress = theme?.confirmation?.components?.business?.components?.address?.hidden
|
|
145
|
+
const hideBusinessMap = theme?.confirmation?.components?.business?.components?.map?.hidden
|
|
146
|
+
const hideDriverName = theme?.confirmation?.components?.driver?.components?.name?.hidden
|
|
147
|
+
const hideDriverPhone = theme?.confirmation?.components?.driver?.components?.phone?.hidden
|
|
148
|
+
const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
|
|
149
|
+
const hideDriverEmail = theme?.confirmation?.components?.driver?.components?.email?.hidden
|
|
150
|
+
const hideDriverPhoto = theme?.confirmation?.components?.driver?.components?.photo?.hidden
|
|
151
|
+
const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
|
|
152
|
+
const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
|
|
153
|
+
const hideCustomerEmail = theme?.confirmation?.components?.customer?.components?.email?.hidden
|
|
154
|
+
const hideCustomerPhoto = theme?.confirmation?.components?.customer?.components?.photo?.hidden
|
|
150
155
|
|
|
151
156
|
const validTrackingStatus = [9, 19, 23]
|
|
152
157
|
const mapConfigs = { zoom: 15 }
|
|
@@ -407,25 +412,25 @@ const OrderDetailsUI = (props) => {
|
|
|
407
412
|
{order?.status !== 0 && order?.integration_id && (
|
|
408
413
|
<h1>{t('TICKET', 'Ticket')}: {order?.integration_id}</h1>
|
|
409
414
|
)}
|
|
410
|
-
{
|
|
415
|
+
{!hideDeliveryType && (
|
|
411
416
|
<p className='types'>
|
|
412
417
|
{isService
|
|
413
418
|
? t('SERVICE_AT_HOME', 'Service at home')
|
|
414
419
|
: orderTypes?.find(type => order?.delivery_type === type?.value)?.text}
|
|
415
420
|
</p>
|
|
416
421
|
)}
|
|
417
|
-
{
|
|
422
|
+
{!hideDeliveryDate && (
|
|
418
423
|
<p className='date'>
|
|
419
|
-
{
|
|
420
|
-
order
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
+
{activeStatus.includes(order?.status) ? (
|
|
425
|
+
<OrderEta order={order} />
|
|
426
|
+
) : (
|
|
427
|
+
parseDate(order?.reporting_data?.at[`status:${order.status}`])
|
|
428
|
+
)}
|
|
424
429
|
</p>
|
|
425
430
|
)}
|
|
426
431
|
{(acceptedStatus.includes(parseInt(order?.status, 10)) ||
|
|
427
432
|
!isOriginalLayout
|
|
428
|
-
) &&
|
|
433
|
+
) && !isGiftCardOrder &&
|
|
429
434
|
(
|
|
430
435
|
<ReOrder>
|
|
431
436
|
<Button
|
|
@@ -451,7 +456,7 @@ const OrderDetailsUI = (props) => {
|
|
|
451
456
|
</ReOrder>
|
|
452
457
|
)}
|
|
453
458
|
</TitleContainer>
|
|
454
|
-
{
|
|
459
|
+
{!hideDeliveryProgress && !isGiftCardOrder && (
|
|
455
460
|
<>
|
|
456
461
|
<StatusBar percentage={getOrderStatus(order?.status)?.percentage} />
|
|
457
462
|
<OrderStatusAndLinkContainer>
|
|
@@ -478,120 +483,116 @@ const OrderDetailsUI = (props) => {
|
|
|
478
483
|
</>
|
|
479
484
|
)}
|
|
480
485
|
</OrderInfo>
|
|
481
|
-
|
|
482
|
-
<
|
|
483
|
-
<
|
|
484
|
-
w='calc(100% - 20px)'
|
|
485
|
-
// borderBottom={showOrderActions}
|
|
486
|
-
>
|
|
487
|
-
{isShowBusinessLogo && <img src={order?.business?.logo} />}
|
|
488
|
-
<BusinessInfo>
|
|
489
|
-
<h2>{order?.business?.name}</h2>
|
|
490
|
-
<ActionsSection
|
|
491
|
-
{...ActionsSectionProps}
|
|
492
|
-
actionType='business'
|
|
493
|
-
showPhone={showBusinessPhone}
|
|
494
|
-
showMessages={showBusinessMessages}
|
|
495
|
-
/>
|
|
496
|
-
{showBusinessEmail && (
|
|
497
|
-
<p>{order?.business?.email}</p>
|
|
498
|
-
)}
|
|
499
|
-
{showBusinessPhone && (
|
|
500
|
-
<p>{order?.business?.cellphone}</p>
|
|
501
|
-
)}
|
|
502
|
-
{showBusinessAddress && (
|
|
503
|
-
<p>{order?.business?.address}</p>
|
|
504
|
-
)}
|
|
505
|
-
{order?.place?.name && (
|
|
506
|
-
<PlaceSpotSection>
|
|
507
|
-
<p>
|
|
508
|
-
{yourSpotString}: {order?.place?.name}
|
|
509
|
-
</p>
|
|
510
|
-
</PlaceSpotSection>
|
|
511
|
-
)}
|
|
512
|
-
{showOrderActions && (
|
|
513
|
-
<DirectionButtonWrapper>
|
|
514
|
-
<Button
|
|
515
|
-
color='primary'
|
|
516
|
-
onClick={() => window.open(`http://maps.google.com/?q=${order?.business?.address}`)}
|
|
517
|
-
>
|
|
518
|
-
{t('GET_DIRECTIONS', 'Get Directions')}
|
|
519
|
-
</Button>
|
|
520
|
-
</DirectionButtonWrapper>
|
|
521
|
-
)}
|
|
522
|
-
</BusinessInfo>
|
|
523
|
-
</BusinessWrapper>
|
|
524
|
-
|
|
525
|
-
{showDeliveryType && placeSpotTypes.includes(order?.delivery_type) && (
|
|
526
|
-
<PlaceSpotWrapper>
|
|
527
|
-
<PlaceSpot
|
|
528
|
-
isInputMode
|
|
529
|
-
cart={order}
|
|
530
|
-
spotNumberDefault={order?.spot_number}
|
|
531
|
-
vehicleDefault={order?.vehicle}
|
|
532
|
-
/>
|
|
533
|
-
</PlaceSpotWrapper>
|
|
534
|
-
)}
|
|
535
|
-
|
|
536
|
-
{showOrderActions && (
|
|
486
|
+
{!isGiftCardOrder && (
|
|
487
|
+
<OrderBusiness>
|
|
488
|
+
<BusinessExternalWrapper>
|
|
537
489
|
<BusinessWrapper
|
|
538
490
|
w='calc(100% - 20px)'
|
|
539
|
-
borderTop
|
|
491
|
+
borderTop={!hideDeliveryType && placeSpotTypes.includes(order?.delivery_type)}
|
|
540
492
|
>
|
|
541
|
-
<
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
493
|
+
{isShowBusinessLogo && <img src={order?.business?.logo} />}
|
|
494
|
+
<BusinessInfo>
|
|
495
|
+
<h2>{order?.business?.name}</h2>
|
|
496
|
+
<ActionsSection
|
|
497
|
+
{...ActionsSectionProps}
|
|
498
|
+
actionType='business'
|
|
499
|
+
showPhone={!hideBusinessPhone}
|
|
500
|
+
showMessages={!hideBusinessMessages}
|
|
501
|
+
/>
|
|
502
|
+
{!hideBusinessEmail && (
|
|
503
|
+
<p>{order?.business?.email}</p>
|
|
504
|
+
)}
|
|
505
|
+
{!hideBusinessPhone && (
|
|
506
|
+
<p>{order?.business?.cellphone}</p>
|
|
507
|
+
)}
|
|
508
|
+
{!hideBusinessAddress && (
|
|
509
|
+
<p>{order?.business?.address}</p>
|
|
510
|
+
)}
|
|
511
|
+
{order?.place?.name && (
|
|
512
|
+
<PlaceSpotSection>
|
|
513
|
+
<p>
|
|
514
|
+
{yourSpotString}: {order?.place?.name}
|
|
515
|
+
</p>
|
|
516
|
+
</PlaceSpotSection>
|
|
517
|
+
)}
|
|
518
|
+
{hideOrderActions && (
|
|
519
|
+
<DirectionButtonWrapper>
|
|
520
|
+
<Button
|
|
521
|
+
color='primary'
|
|
522
|
+
onClick={() => window.open(`http://maps.google.com/?q=${order?.business?.address}`)}
|
|
523
|
+
>
|
|
524
|
+
{t('GET_DIRECTIONS', 'Get Directions')}
|
|
525
|
+
</Button>
|
|
526
|
+
</DirectionButtonWrapper>
|
|
527
|
+
)}
|
|
528
|
+
</BusinessInfo>
|
|
529
|
+
{!hideOrderActions && (
|
|
530
|
+
<BtsOrderStatus>
|
|
531
|
+
<div>
|
|
532
|
+
<Button
|
|
533
|
+
style={{ fontSize: 14 }}
|
|
534
|
+
color={order?.status === 20 ? 'secundary' : 'primary'}
|
|
535
|
+
onClick={() => handleChangeOrderStatus(20)}
|
|
536
|
+
disabled={disableLeftButton.includes(order?.status)}
|
|
537
|
+
>
|
|
538
|
+
{getOrderStatus(20)?.value}
|
|
539
|
+
</Button>
|
|
540
|
+
</div>
|
|
541
|
+
<div>
|
|
542
|
+
<Button
|
|
543
|
+
style={{ fontSize: 14 }}
|
|
544
|
+
color={order?.status === 20 ? 'primary' : 'secundary'}
|
|
545
|
+
disabled={disableRightButton.includes(order?.status)}
|
|
546
|
+
onClick={() => handleChangeOrderStatus(21)}
|
|
547
|
+
>
|
|
548
|
+
{getOrderStatus(21)?.value}
|
|
549
|
+
</Button>
|
|
550
|
+
</div>
|
|
551
|
+
</BtsOrderStatus>
|
|
552
|
+
)}
|
|
563
553
|
</BusinessWrapper>
|
|
554
|
+
|
|
555
|
+
{!hideDeliveryType && placeSpotTypes.includes(order?.delivery_type) && (
|
|
556
|
+
<PlaceSpotWrapper>
|
|
557
|
+
<PlaceSpot
|
|
558
|
+
isInputMode
|
|
559
|
+
cart={order}
|
|
560
|
+
spotNumberDefault={order?.spot_number}
|
|
561
|
+
vehicleDefault={order?.vehicle}
|
|
562
|
+
/>
|
|
563
|
+
</PlaceSpotWrapper>
|
|
564
|
+
)}
|
|
565
|
+
</BusinessExternalWrapper>
|
|
566
|
+
{googleMapsApiKey && !hideBusinessMap && (
|
|
567
|
+
<MapWrapper>
|
|
568
|
+
<Map style={{ width: '100%' }}>
|
|
569
|
+
<img
|
|
570
|
+
src={getGoogleMapImage(order?.business?.location, googleMapsApiKey, mapConfigs)}
|
|
571
|
+
id='google-maps-image'
|
|
572
|
+
alt='google-maps-location'
|
|
573
|
+
width='100%'
|
|
574
|
+
height='100%'
|
|
575
|
+
loading='lazy'
|
|
576
|
+
/>
|
|
577
|
+
</Map>
|
|
578
|
+
</MapWrapper>
|
|
564
579
|
)}
|
|
565
|
-
</
|
|
566
|
-
|
|
567
|
-
<MapWrapper>
|
|
568
|
-
<Map style={{ width: '100%' }}>
|
|
569
|
-
<img
|
|
570
|
-
src={getGoogleMapImage(order?.business?.location, googleMapsApiKey, mapConfigs)}
|
|
571
|
-
id='google-maps-image'
|
|
572
|
-
alt='google-maps-location'
|
|
573
|
-
width='100%'
|
|
574
|
-
height='100%'
|
|
575
|
-
loading='lazy'
|
|
576
|
-
/>
|
|
577
|
-
</Map>
|
|
578
|
-
</MapWrapper>
|
|
579
|
-
)}
|
|
580
|
-
</OrderBusiness>
|
|
580
|
+
</OrderBusiness>
|
|
581
|
+
)}
|
|
581
582
|
<OrderCustomer>
|
|
582
583
|
<BusinessWrapper>
|
|
583
|
-
{
|
|
584
|
+
{!hideCustomerPhoto && order?.customer?.photo && (
|
|
584
585
|
<img src={order?.customer?.photo} />
|
|
585
586
|
)}
|
|
586
587
|
<BusinessInfo>
|
|
587
588
|
<p>{order?.customer?.name} {order?.customer?.lastname}</p>
|
|
588
|
-
{
|
|
589
|
+
{!hideCustomerEmail && (
|
|
589
590
|
<p>{order?.customer?.email}</p>
|
|
590
591
|
)}
|
|
591
|
-
{
|
|
592
|
+
{!hideCustomerPhone && (
|
|
592
593
|
<p>{order?.customer?.cellphone || order?.customer?.phone}</p>
|
|
593
594
|
)}
|
|
594
|
-
{
|
|
595
|
+
{!hideCustomerAddress && (
|
|
595
596
|
<p>{order?.customer?.address}</p>
|
|
596
597
|
)}
|
|
597
598
|
</BusinessInfo>
|
|
@@ -605,12 +606,12 @@ const OrderDetailsUI = (props) => {
|
|
|
605
606
|
<ActionsSection
|
|
606
607
|
{...ActionsSectionProps}
|
|
607
608
|
actionType='driver'
|
|
608
|
-
showPhone={
|
|
609
|
-
showMessages={
|
|
609
|
+
showPhone={!hideDriverPhone}
|
|
610
|
+
showMessages={!hideDriverMessages}
|
|
610
611
|
/>
|
|
611
612
|
</SectionTitleContainer>
|
|
612
613
|
<WrapperDriver>
|
|
613
|
-
{
|
|
614
|
+
{!hideDriverPhoto && (
|
|
614
615
|
<div className='photo'>
|
|
615
616
|
{order?.driver?.photo ? (
|
|
616
617
|
<PhotoBlock src={order?.driver?.photo} />
|
|
@@ -620,13 +621,13 @@ const OrderDetailsUI = (props) => {
|
|
|
620
621
|
</div>
|
|
621
622
|
)}
|
|
622
623
|
<div>
|
|
623
|
-
{
|
|
624
|
+
{!hideDriverName && (
|
|
624
625
|
<h2>{order?.driver?.name} {order?.driver?.lastname}</h2>
|
|
625
626
|
)}
|
|
626
|
-
{
|
|
627
|
+
{!hideDriverEmail && (
|
|
627
628
|
<p>{order?.driver?.email}</p>
|
|
628
629
|
)}
|
|
629
|
-
{
|
|
630
|
+
{!hideDriverPhone && (
|
|
630
631
|
<p>{order?.driver?.cellphone || order?.driver?.phone}</p>
|
|
631
632
|
)}
|
|
632
633
|
</div>
|
|
@@ -652,7 +653,7 @@ const OrderDetailsUI = (props) => {
|
|
|
652
653
|
}
|
|
653
654
|
</>
|
|
654
655
|
)}
|
|
655
|
-
{(order?.delivery_type === 1 || order?.comment) && (
|
|
656
|
+
{(order?.delivery_type === 1 || order?.comment) && !isGiftCardOrder && (
|
|
656
657
|
<OrderPreferences>
|
|
657
658
|
<OrderPreferencesSection
|
|
658
659
|
order={order}
|
|
@@ -678,6 +679,13 @@ const OrderDetailsUI = (props) => {
|
|
|
678
679
|
/>
|
|
679
680
|
</OrderProducts>
|
|
680
681
|
</WrapperRightContainer>
|
|
682
|
+
|
|
683
|
+
{isGiftCardOrder && order?.products[0]?.gift_card?.status === 'pending' && !isGiftCardSent && (
|
|
684
|
+
<SendGiftCard
|
|
685
|
+
giftCardId={order?.products[0]?.gift_card?.id}
|
|
686
|
+
setIsGiftCardSent={setIsGiftCardSent}
|
|
687
|
+
/>
|
|
688
|
+
)}
|
|
681
689
|
</WrapperContainer>
|
|
682
690
|
)}
|
|
683
691
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components'
|
|
2
2
|
|
|
3
3
|
export const Container = styled.div`
|
|
4
|
-
padding-top:
|
|
5
|
-
margin
|
|
4
|
+
padding-top: 5px;
|
|
5
|
+
margin: 0px;
|
|
6
6
|
${props => props.theme.rtl && css`
|
|
7
7
|
margin-left: 30px;
|
|
8
8
|
margin-right: 0px;
|
|
@@ -12,11 +12,13 @@ export const Container = styled.div`
|
|
|
12
12
|
margin-right: 0px;
|
|
13
13
|
margin-left: 0px;
|
|
14
14
|
`}
|
|
15
|
+
@media (min-width: 993px) {
|
|
16
|
+
margin-right: 30px;
|
|
17
|
+
}
|
|
15
18
|
`
|
|
16
19
|
|
|
17
20
|
export const ContentHeader = styled.div`
|
|
18
|
-
margin-bottom:
|
|
19
|
-
|
|
21
|
+
margin-bottom: 15px;
|
|
20
22
|
> h2 {
|
|
21
23
|
font-weight: 600;
|
|
22
24
|
font-size: 24px;
|
|
@@ -53,11 +55,9 @@ export const ProductList = styled.div`
|
|
|
53
55
|
flex-direction: row;
|
|
54
56
|
box-sizing: border-box;
|
|
55
57
|
align-items: center;
|
|
56
|
-
|
|
57
58
|
button {
|
|
58
59
|
padding: 0px;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
61
|
#orderItAgain > div {
|
|
62
62
|
width: 350px;
|
|
63
63
|
${({ theme }) => theme?.business_view?.components?.products?.components?.layout?.type === 'starbucks' && css`
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
OrderList as OrderListController
|
|
7
7
|
} from 'ordering-components-external'
|
|
8
8
|
import { Button } from '../../styles/Buttons'
|
|
9
|
-
import moment from 'moment'
|
|
10
9
|
import Skeleton from 'react-loading-skeleton'
|
|
11
10
|
import { useTheme } from 'styled-components'
|
|
12
11
|
import BsArrowRight from '@meronex/icons/bs/BsArrowRight'
|
|
12
|
+
import { OrderEta } from '../OrderDetails/OrderEta'
|
|
13
13
|
import {
|
|
14
14
|
OrderProgressContainer,
|
|
15
15
|
OrderInfoWrapper,
|
|
@@ -31,20 +31,11 @@ const OrderProgressUI = (props) => {
|
|
|
31
31
|
isCustomerMode
|
|
32
32
|
} = props
|
|
33
33
|
const [, t] = useLanguage()
|
|
34
|
-
const [{ optimizeImage,
|
|
34
|
+
const [{ optimizeImage, parseTime }] = useUtils()
|
|
35
35
|
const theme = useTheme()
|
|
36
36
|
const [events] = useEvent()
|
|
37
37
|
const [lastOrder, setLastOrder] = useState(null)
|
|
38
38
|
|
|
39
|
-
const convertDiffToHours = (time) => {
|
|
40
|
-
if (!time) return
|
|
41
|
-
const deliveryTime = lastOrder?.delivery_datetime_utc
|
|
42
|
-
? parseDate(lastOrder?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
|
|
43
|
-
: parseDate(lastOrder?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD hh:mm A' })
|
|
44
|
-
const returnedDate = moment(new Date(deliveryTime.replace(/-/g, '/'))).add(time, 'minutes').format('hh:mm A')
|
|
45
|
-
return returnedDate
|
|
46
|
-
}
|
|
47
|
-
|
|
48
39
|
const handleGoToPage = (index) => {
|
|
49
40
|
events.emit('go_to_page', { page: index, params: { orderId: lastOrder?.uuid } })
|
|
50
41
|
}
|
|
@@ -102,7 +93,7 @@ const OrderProgressUI = (props) => {
|
|
|
102
93
|
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: 'hh:mm A' })
|
|
103
94
|
: parseTime(lastOrder?.delivery_datetime, { utc: false })}
|
|
104
95
|
-
|
|
105
|
-
{
|
|
96
|
+
<OrderEta order={lastOrder} outputFormat='hh:mm A' />
|
|
106
97
|
</span>
|
|
107
98
|
</TimeWrapper>
|
|
108
99
|
</ProgressTextWrapper>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
useSite,
|
|
4
|
+
useEvent,
|
|
5
|
+
PageBanner as PageBannerController
|
|
6
|
+
} from 'ordering-components-external'
|
|
3
7
|
import Skeleton from 'react-loading-skeleton'
|
|
4
8
|
import { Swiper, SwiperSlide } from 'swiper/react'
|
|
5
9
|
import SwiperCore, {
|
|
@@ -7,6 +11,7 @@ import SwiperCore, {
|
|
|
7
11
|
} from 'swiper'
|
|
8
12
|
import 'swiper/swiper-bundle.min.css'
|
|
9
13
|
import 'swiper/swiper.min.css'
|
|
14
|
+
import { checkSiteUrl } from '../../../../../utils'
|
|
10
15
|
|
|
11
16
|
import {
|
|
12
17
|
BannerContainer,
|
|
@@ -20,6 +25,89 @@ const PageBannerUI = (props) => {
|
|
|
20
25
|
pageBannerState
|
|
21
26
|
} = props
|
|
22
27
|
|
|
28
|
+
const [{ site }] = useSite()
|
|
29
|
+
const [events] = useEvent()
|
|
30
|
+
|
|
31
|
+
const businessUrlTemplate = checkSiteUrl(site?.business_url_template, '/store/:business_slug')
|
|
32
|
+
const productUrlTemplate = checkSiteUrl(site?.product_url_template, '/store/:business_slug?category=:category_id&product=:product_id')
|
|
33
|
+
|
|
34
|
+
const onProductRedirect = ({ slug, category, product }) => {
|
|
35
|
+
if (!category && !product) {
|
|
36
|
+
if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
|
|
37
|
+
return events.emit('go_to_page', { page: 'business', params: { business_slug: slug }, replace: true })
|
|
38
|
+
} else {
|
|
39
|
+
return events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${slug}`, replace: true })
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
events.emit('product_banner_clicked')
|
|
43
|
+
if (productUrlTemplate === '/store/:business_slug/:category_slug/:product_slug' || productUrlTemplate === '/:business_slug/:category_slug/:product_slug') {
|
|
44
|
+
return events.emit('go_to_page', {
|
|
45
|
+
page: 'product',
|
|
46
|
+
params: {
|
|
47
|
+
business_slug: slug,
|
|
48
|
+
category_slug: category,
|
|
49
|
+
product_slug: product
|
|
50
|
+
},
|
|
51
|
+
replace: true
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
if (productUrlTemplate.includes('/store/:category_slug/:product_slug')) {
|
|
55
|
+
const businessParameter = businessUrlTemplate.replace('/store?', '').replace('=:business_slug', '')
|
|
56
|
+
return events.emit('go_to_page', {
|
|
57
|
+
page: 'product',
|
|
58
|
+
params: {
|
|
59
|
+
category_slug: category,
|
|
60
|
+
product_slug: product
|
|
61
|
+
},
|
|
62
|
+
search: `?${businessParameter}=${slug}`,
|
|
63
|
+
replace: true
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
if (productUrlTemplate.includes('/store/:business_slug') && productUrlTemplate.includes('category_id')) {
|
|
67
|
+
const ids = productUrlTemplate.split('?')[1].split('&')
|
|
68
|
+
const categoryParameter = ids[0].replace('=:category_id', '')
|
|
69
|
+
const productParameter = ids[1].replace('=:product_id', '')
|
|
70
|
+
return events.emit('go_to_page', {
|
|
71
|
+
page: 'product',
|
|
72
|
+
params: {
|
|
73
|
+
business_slug: slug
|
|
74
|
+
},
|
|
75
|
+
search: `?${categoryParameter}=${category}&${productParameter}=${product}`,
|
|
76
|
+
replace: true
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
if (productUrlTemplate.includes('/:business_slug') && !productUrlTemplate.includes('store')) {
|
|
80
|
+
const ids = productUrlTemplate.split('?')[1].split('&')
|
|
81
|
+
const categoryParameter = ids[0].replace('=:category_id', '')
|
|
82
|
+
const productParameter = ids[1].replace('=:product_id', '')
|
|
83
|
+
return events.emit('go_to_page', {
|
|
84
|
+
page: 'product',
|
|
85
|
+
params: {
|
|
86
|
+
business_slug: slug
|
|
87
|
+
},
|
|
88
|
+
search: `?${categoryParameter}=${category}&${productParameter}=${product}`,
|
|
89
|
+
replace: true
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const handleGoToPage = (action) => {
|
|
95
|
+
if (!action?.url) return
|
|
96
|
+
let slug
|
|
97
|
+
if (action.type === 'business') {
|
|
98
|
+
slug = action.url.split('store/')[1]
|
|
99
|
+
onProductRedirect({ slug })
|
|
100
|
+
}
|
|
101
|
+
if (action.type === 'product') {
|
|
102
|
+
slug = action.url.split('store/')[1]?.split('?')[0]
|
|
103
|
+
const paramString = action.url.split('?')[1]
|
|
104
|
+
const urlParams = new URLSearchParams(paramString)
|
|
105
|
+
const product = urlParams.get('product')
|
|
106
|
+
const category = urlParams.get('category')
|
|
107
|
+
onProductRedirect({ slug, category, product })
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
23
111
|
return (
|
|
24
112
|
<>
|
|
25
113
|
{pageBannerState.loading ? (
|
|
@@ -27,7 +115,7 @@ const PageBannerUI = (props) => {
|
|
|
27
115
|
<Skeleton height={250} />
|
|
28
116
|
</BannerContainer>
|
|
29
117
|
) : (
|
|
30
|
-
pageBannerState.banner?.items && (
|
|
118
|
+
pageBannerState.banner?.items?.length > 0 && (
|
|
31
119
|
<BannerContainer>
|
|
32
120
|
<Swiper
|
|
33
121
|
navigation
|
|
@@ -35,8 +123,12 @@ const PageBannerUI = (props) => {
|
|
|
35
123
|
loop={pageBannerState.banner?.items.length > 1}
|
|
36
124
|
>
|
|
37
125
|
{pageBannerState.banner?.items.map((img, i) => (
|
|
38
|
-
<SwiperSlide
|
|
39
|
-
|
|
126
|
+
<SwiperSlide
|
|
127
|
+
key={i}
|
|
128
|
+
>
|
|
129
|
+
<ImageWrapper
|
|
130
|
+
onClick={() => handleGoToPage(img?.action)}
|
|
131
|
+
>
|
|
40
132
|
<img src={img.url} className='banner-img' alt='' />
|
|
41
133
|
</ImageWrapper>
|
|
42
134
|
</SwiperSlide>
|