ordering-ui-external 2.0.4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +3 -1
- 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/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 +7 -4
- 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/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
|
@@ -170,10 +170,10 @@ export const BusinessInfoContainer = styled.div`
|
|
|
170
170
|
padding-left: 5px;
|
|
171
171
|
padding-right: 5px;
|
|
172
172
|
display: flex;
|
|
173
|
-
justify-content: space-between;
|
|
173
|
+
justify-content: ${props => props.isFlexEnd ? 'flex-end' : 'space-between'};
|
|
174
174
|
flex-direction: column;
|
|
175
175
|
box-sizing: border-box;
|
|
176
|
-
align-items: flex-end;
|
|
176
|
+
align-items: ${props => props.isFlexEnd ? 'flex-end' : 'space-between'};
|
|
177
177
|
|
|
178
178
|
@media (min-width: 576px) {
|
|
179
179
|
padding-top: 0px;
|
|
@@ -193,11 +193,15 @@ export const BusinessInfoContent = styled.div`
|
|
|
193
193
|
width: 100%;
|
|
194
194
|
`
|
|
195
195
|
|
|
196
|
+
export const SearchWrapper = styled.div`
|
|
197
|
+
display: flex;
|
|
198
|
+
`
|
|
199
|
+
|
|
196
200
|
export const WrapperSearch = styled.div`
|
|
197
201
|
margin: 15px 0px 0px;
|
|
198
202
|
display: flex;
|
|
199
|
-
align-items:
|
|
200
|
-
justify-content: flex-end;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: ${props => props.isFlexEnd ? 'flex-end' : 'space-between'};
|
|
201
205
|
box-sizing: border-box;
|
|
202
206
|
|
|
203
207
|
.search-bar {
|
|
@@ -436,6 +440,24 @@ export const SocialList = styled.div`
|
|
|
436
440
|
`}
|
|
437
441
|
`
|
|
438
442
|
|
|
443
|
+
export const CategorySelectedContainer = styled.div`
|
|
444
|
+
display: inline;
|
|
445
|
+
margin-left: 10px;
|
|
446
|
+
color: ${({ theme }) => theme?.colors?.primary};
|
|
447
|
+
padding-right: 5px;
|
|
448
|
+
cursor: pointer;
|
|
449
|
+
p{
|
|
450
|
+
margin: 0;
|
|
451
|
+
}
|
|
452
|
+
svg {
|
|
453
|
+
position: relative;
|
|
454
|
+
top: 2px;
|
|
455
|
+
margin-right: 3px;
|
|
456
|
+
width: 14px;
|
|
457
|
+
height: 14px;
|
|
458
|
+
}
|
|
459
|
+
`
|
|
460
|
+
|
|
439
461
|
export const IconWrapper = styled.a`
|
|
440
462
|
margin: 0px 3px 10px 3px;
|
|
441
463
|
border-radius: 3px;
|
|
@@ -246,7 +246,7 @@ export const BusinessItemAccordion = (props) => {
|
|
|
246
246
|
{!setActive && !isClosed && !!isProducts && !checkoutButtonDisabled && !isMultiCheckout && !checkoutMultiBusinessEnabled && (
|
|
247
247
|
<PriceContainer>
|
|
248
248
|
<h4>{parsePrice(total)}</h4>
|
|
249
|
-
<Button onClick={handleClickCheckout} color='primary'>{t('CHECKOUT', 'Checkout')}</Button>
|
|
249
|
+
<Button onClick={() => handleClickCheckout(uuid)} color='primary'>{t('CHECKOUT', 'Checkout')}</Button>
|
|
250
250
|
</PriceContainer>
|
|
251
251
|
)}
|
|
252
252
|
</AccordionSection>
|
|
@@ -6,6 +6,7 @@ import { useTheme } from 'styled-components'
|
|
|
6
6
|
|
|
7
7
|
import { CategoriesContainer } from './styles'
|
|
8
8
|
import { Tabs, Tab } from '../../styles/Tabs'
|
|
9
|
+
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
9
10
|
|
|
10
11
|
const BusinessProductsCategoriesUI = (props) => {
|
|
11
12
|
const {
|
|
@@ -21,6 +22,7 @@ const BusinessProductsCategoriesUI = (props) => {
|
|
|
21
22
|
} = props
|
|
22
23
|
|
|
23
24
|
const theme = useTheme()
|
|
25
|
+
const windowSize = useWindowSize()
|
|
24
26
|
const [orderingTheme] = useOrderingTheme()
|
|
25
27
|
const [selectedCategory, setSelectedCateogry] = useState({ id: null })
|
|
26
28
|
const scrollTopSpan = 60
|
|
@@ -121,6 +123,9 @@ const BusinessProductsCategoriesUI = (props) => {
|
|
|
121
123
|
if (typeof useKioskApp === 'undefined') return
|
|
122
124
|
const styleSheet = document.getElementById('styles').sheet
|
|
123
125
|
|
|
126
|
+
if (Object.values(styleSheet.cssRules)?.length) {
|
|
127
|
+
styleSheet?.deleteRule(0)
|
|
128
|
+
}
|
|
124
129
|
const disabledCustomWidth = isChew || !useKioskApp
|
|
125
130
|
|
|
126
131
|
let style0 = '.sticky-prod-cat {'
|
|
@@ -128,6 +133,7 @@ const BusinessProductsCategoriesUI = (props) => {
|
|
|
128
133
|
style0 += 'top: 0px !important;'
|
|
129
134
|
style0 += 'left: 0px !important;'
|
|
130
135
|
style0 += 'padding: 5px 5px 0px 5px !important;'
|
|
136
|
+
style0 += `width: calc(100% - ${useKioskApp ? '50px' : windowSize.width >= 993 ? '155px' : '0px'})!important;`
|
|
131
137
|
!disabledCustomWidth && (style0 += `width: calc(100% - ${useKioskApp ? '50px' : '155px'}) !important;`)
|
|
132
138
|
style0 += '}'
|
|
133
139
|
|
|
@@ -145,7 +151,7 @@ const BusinessProductsCategoriesUI = (props) => {
|
|
|
145
151
|
|
|
146
152
|
window.addEventListener('scroll', handleScroll)
|
|
147
153
|
return () => window.removeEventListener('scroll', handleScroll)
|
|
148
|
-
}, [useKioskApp, isChew])
|
|
154
|
+
}, [useKioskApp, isChew, windowSize.width])
|
|
149
155
|
|
|
150
156
|
useEffect(() => {
|
|
151
157
|
if (business?.professionals?.length > 0 && !useKioskApp) {
|
package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js
CHANGED
|
@@ -16,7 +16,7 @@ export const CategoriesWrap = styled.div`
|
|
|
16
16
|
export const CategoriesContainer = styled.div`
|
|
17
17
|
display: flex;
|
|
18
18
|
overflow-x: auto;
|
|
19
|
-
padding:
|
|
19
|
+
padding: 15px 0 0 0;
|
|
20
20
|
padding-bottom: 0;
|
|
21
21
|
background: ${props => props.theme.colors.backgroundPage};
|
|
22
22
|
z-index: 1000;
|
|
@@ -37,7 +37,7 @@ export const CategoriesContainer = styled.div`
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@media (min-width: 381px) {
|
|
40
|
-
padding:
|
|
40
|
+
padding: 5px;
|
|
41
41
|
}
|
|
42
42
|
`
|
|
43
43
|
|
|
@@ -338,6 +338,7 @@ const BusinessProductsListingUI = (props) => {
|
|
|
338
338
|
priceFilterValues={priceFilterValues}
|
|
339
339
|
handleChangePriceFilterValues={handleChangePriceFilterValues}
|
|
340
340
|
productToIdLoading={productToIdLoading}
|
|
341
|
+
handleUpdateProfessionals={handleUpdateProfessionals}
|
|
341
342
|
/>
|
|
342
343
|
|
|
343
344
|
{
|
|
@@ -19,6 +19,7 @@ import { Modal } from '../Modal'
|
|
|
19
19
|
import { CouponControl } from '../../../../../components/CouponControl'
|
|
20
20
|
import { ProductForm } from '../ProductForm'
|
|
21
21
|
import { UpsellingPage } from '../UpsellingPage'
|
|
22
|
+
import { CartStoresListing } from '../../../../franchise/src/components/CartStoresListing'
|
|
22
23
|
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
23
24
|
import { TaxInformation } from '../TaxInformation'
|
|
24
25
|
import { TextArea } from '../../styles/Inputs'
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
import { verifyDecimals } from '../../../../../utils'
|
|
42
43
|
import BsInfoCircle from '@meronex/icons/bs/BsInfoCircle'
|
|
43
44
|
import MdCloseCircle from '@meronex/icons/ios/MdCloseCircle'
|
|
45
|
+
import { MomentContent } from '../MomentContent'
|
|
44
46
|
|
|
45
47
|
const CartUI = (props) => {
|
|
46
48
|
const {
|
|
@@ -67,7 +69,8 @@ const CartUI = (props) => {
|
|
|
67
69
|
setPreorderBusiness,
|
|
68
70
|
cart: cartMulticart,
|
|
69
71
|
hideDeliveryFee,
|
|
70
|
-
hideDriverTip
|
|
72
|
+
hideDriverTip,
|
|
73
|
+
businessConfigs
|
|
71
74
|
} = props
|
|
72
75
|
|
|
73
76
|
const theme = useTheme()
|
|
@@ -92,16 +95,29 @@ const CartUI = (props) => {
|
|
|
92
95
|
const [canOpenUpselling, setCanOpenUpselling] = useState(false)
|
|
93
96
|
const [openTaxModal, setOpenTaxModal] = useState({ open: false, tax: null })
|
|
94
97
|
const [isUpselling, setIsUpselling] = useState(false)
|
|
95
|
-
|
|
98
|
+
const [openChangeStore, setOpenChangeStore] = useState(false)
|
|
96
99
|
|
|
97
100
|
const businessUrlTemplate = site?.business_url_template || '/store/:business_slug'
|
|
98
101
|
|
|
99
102
|
const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
|
|
103
|
+
const cateringTypes = [7, 8]
|
|
100
104
|
const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
|
|
101
105
|
const cart = cartMulticart || orderState?.carts?.[`businessId:${props.cart?.business_id}`]
|
|
102
106
|
const viewString = isStore ? 'business_view' : 'header'
|
|
103
107
|
const hideCartComments = theme?.[viewString]?.components?.cart?.components?.comments?.hidden
|
|
104
108
|
const hideCartDiscount = theme?.[viewString]?.components?.cart?.components?.discount?.hidden
|
|
109
|
+
const cateringTypeString = orderState?.options?.type === 7
|
|
110
|
+
? 'catering_delivery'
|
|
111
|
+
: orderState?.options?.type === 8
|
|
112
|
+
? 'catering_pickup'
|
|
113
|
+
: null
|
|
114
|
+
const splitCateringValue = (configName) => businessConfigs.find(config => config.key === configName)?.value?.split('|')?.find(val => val.includes(cateringTypeString))?.split(',')[1]
|
|
115
|
+
const preorderSlotInterval = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_slot_interval'))
|
|
116
|
+
const preorderLeadTime = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_lead_time'))
|
|
117
|
+
const preorderTimeRange = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_time_range'))
|
|
118
|
+
const preorderMaximumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_maximum_days'))
|
|
119
|
+
const preorderMinimumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_minimum_days'))
|
|
120
|
+
|
|
105
121
|
const walletName = {
|
|
106
122
|
cash: {
|
|
107
123
|
name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
|
|
@@ -131,10 +147,10 @@ const CartUI = (props) => {
|
|
|
131
147
|
setModalIsOpen(true)
|
|
132
148
|
}
|
|
133
149
|
|
|
134
|
-
const handleClickCheckout = () => {
|
|
150
|
+
const handleClickCheckout = (uuid) => {
|
|
135
151
|
const cartsAvailable = Object.values(orderState?.carts)?.filter(cart => cart?.valid && cart?.status !== 2)
|
|
136
|
-
if (cartsAvailable.length === 1) {
|
|
137
|
-
events.emit('go_to_page', { page: 'checkout', params: { cartUuid:
|
|
152
|
+
if (cartsAvailable.length === 1 || !isMultiCheckout) {
|
|
153
|
+
events.emit('go_to_page', { page: 'checkout', params: { cartUuid: uuid } })
|
|
138
154
|
} else {
|
|
139
155
|
const groupKeys = {}
|
|
140
156
|
cartsAvailable.forEach(_cart => {
|
|
@@ -203,8 +219,8 @@ const CartUI = (props) => {
|
|
|
203
219
|
handleClickCheckout()
|
|
204
220
|
}
|
|
205
221
|
|
|
206
|
-
const checkOutBtnClick = () => {
|
|
207
|
-
handleClickCheckout()
|
|
222
|
+
const checkOutBtnClick = (uuid) => {
|
|
223
|
+
handleClickCheckout(uuid)
|
|
208
224
|
}
|
|
209
225
|
|
|
210
226
|
const getIncludedTaxes = () => {
|
|
@@ -233,9 +249,9 @@ const CartUI = (props) => {
|
|
|
233
249
|
})
|
|
234
250
|
}
|
|
235
251
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
252
|
+
const handleChangeStore = () => {
|
|
253
|
+
setOpenChangeStore(true)
|
|
254
|
+
}
|
|
239
255
|
|
|
240
256
|
useEffect(() => {
|
|
241
257
|
if (isCustomMode) setIsUpselling(true)
|
|
@@ -272,7 +288,7 @@ const CartUI = (props) => {
|
|
|
272
288
|
handleClickCheckout={handleClickCheckout}
|
|
273
289
|
checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || !cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address}
|
|
274
290
|
setPreorderBusiness={setPreorderBusiness}
|
|
275
|
-
|
|
291
|
+
handleChangeStore={!useKioskApp && handleChangeStore}
|
|
276
292
|
isMultiCheckout={isMultiCheckout}
|
|
277
293
|
>
|
|
278
294
|
{cart?.products?.length > 0 && cart?.products.map(product => (
|
|
@@ -571,12 +587,26 @@ const CartUI = (props) => {
|
|
|
571
587
|
)}
|
|
572
588
|
</OrderBill>
|
|
573
589
|
)}
|
|
590
|
+
{cateringTypes.includes(orderState?.options?.type) && (
|
|
591
|
+
<div>
|
|
592
|
+
<MomentContent
|
|
593
|
+
cateringPreorder
|
|
594
|
+
isCart
|
|
595
|
+
preorderSlotInterval={preorderSlotInterval}
|
|
596
|
+
preorderLeadTime={preorderLeadTime}
|
|
597
|
+
preorderTimeRange={preorderTimeRange}
|
|
598
|
+
preorderMaximumDays={preorderMaximumDays}
|
|
599
|
+
business={cart?.business}
|
|
600
|
+
preorderMinimumDays={preorderMinimumDays}
|
|
601
|
+
/>
|
|
602
|
+
</div>
|
|
603
|
+
)}
|
|
574
604
|
{(onClickCheckout || isForceOpenCart) && !isCheckout && cart?.valid_products && (!isMultiCheckout || isStore) && (
|
|
575
605
|
<CheckoutAction>
|
|
576
606
|
<p>{cart?.total >= 1 && parsePrice(cart?.total)}</p>
|
|
577
607
|
<Button
|
|
578
608
|
color={(!cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address) ? 'secundary' : 'primary'}
|
|
579
|
-
onClick={checkOutBtnClick}
|
|
609
|
+
onClick={() => checkOutBtnClick(cart?.uuid)}
|
|
580
610
|
disabled={(openUpselling && !canOpenUpselling) || !cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address}
|
|
581
611
|
>
|
|
582
612
|
{!cart?.valid_address ? (
|
|
@@ -665,7 +695,7 @@ const CartUI = (props) => {
|
|
|
665
695
|
)}
|
|
666
696
|
</CartSticky>
|
|
667
697
|
|
|
668
|
-
|
|
698
|
+
<Modal
|
|
669
699
|
width='70%'
|
|
670
700
|
title={t('CHANGE_STORE', 'Change store')}
|
|
671
701
|
open={openChangeStore}
|
|
@@ -681,7 +711,7 @@ const CartUI = (props) => {
|
|
|
681
711
|
onClose={() => setOpenChangeStore(false)}
|
|
682
712
|
handleCustomStoreRedirect={handleStoreRedirect}
|
|
683
713
|
/>
|
|
684
|
-
</Modal>
|
|
714
|
+
</Modal>
|
|
685
715
|
|
|
686
716
|
</CartContainer>
|
|
687
717
|
{props.afterComponents?.map((AfterComponent, i) => (
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
useValidationFields,
|
|
14
14
|
useConfig,
|
|
15
15
|
useCustomer,
|
|
16
|
-
useOrderingTheme
|
|
16
|
+
useOrderingTheme,
|
|
17
|
+
useEvent
|
|
17
18
|
} from 'ordering-components-external'
|
|
18
19
|
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
19
20
|
import { UpsellingPage } from '../UpsellingPage'
|
|
@@ -106,6 +107,8 @@ const CheckoutUI = (props) => {
|
|
|
106
107
|
const [{ user }] = useSession()
|
|
107
108
|
const [{ configs }] = useConfig()
|
|
108
109
|
const [customerState] = useCustomer()
|
|
110
|
+
const [events] = useEvent()
|
|
111
|
+
|
|
109
112
|
const history = useHistory()
|
|
110
113
|
const windowSize = useWindowSize()
|
|
111
114
|
|
|
@@ -127,6 +130,7 @@ const CheckoutUI = (props) => {
|
|
|
127
130
|
|
|
128
131
|
const placeSpotTypes = [3, 4, 5]
|
|
129
132
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type) && !useKioskApp
|
|
133
|
+
const isGiftCardCart = !cart?.business_id
|
|
130
134
|
// const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
|
|
131
135
|
|
|
132
136
|
const isDisablePlaceOrderButton = !cart?.valid ||
|
|
@@ -254,7 +258,11 @@ const CheckoutUI = (props) => {
|
|
|
254
258
|
|
|
255
259
|
useEffect(() => {
|
|
256
260
|
if (cart?.products?.length) return
|
|
257
|
-
|
|
261
|
+
if (cart?.business?.slug) {
|
|
262
|
+
handleStoreRedirect(cart?.business?.slug)
|
|
263
|
+
} else {
|
|
264
|
+
events.emit('go_to_page', { page: 'wallets' })
|
|
265
|
+
}
|
|
258
266
|
}, [cart?.products])
|
|
259
267
|
|
|
260
268
|
useEffect(() => {
|
|
@@ -285,21 +293,25 @@ const CheckoutUI = (props) => {
|
|
|
285
293
|
|
|
286
294
|
{!useKioskApp ? (
|
|
287
295
|
<>
|
|
288
|
-
{
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
296
|
+
{cart?.business_id && (
|
|
297
|
+
<>
|
|
298
|
+
{(businessDetails?.loading || cartState.loading) ? (
|
|
299
|
+
<div style={{ width: '100%', marginBottom: '20px' }}>
|
|
300
|
+
<Skeleton height={35} style={{ marginBottom: '10px' }} />
|
|
301
|
+
<Skeleton height={150} />
|
|
302
|
+
</div>
|
|
303
|
+
) : (
|
|
304
|
+
<AddressDetails
|
|
305
|
+
location={businessDetails?.business?.location}
|
|
306
|
+
businessLogo={businessDetails?.business?.logo || theme.images?.dummies?.businessLogo}
|
|
307
|
+
isCartPending={cart?.status === 2}
|
|
308
|
+
businessId={cart?.business_id}
|
|
309
|
+
apiKey={configs?.google_maps_api_key?.value}
|
|
310
|
+
mapConfigs={mapConfigs}
|
|
311
|
+
isCustomerMode={isCustomerMode}
|
|
312
|
+
/>
|
|
313
|
+
)}
|
|
314
|
+
</>
|
|
303
315
|
)}
|
|
304
316
|
<UserDetailsContainer>
|
|
305
317
|
<WrapperUserDetails>
|
|
@@ -328,38 +340,40 @@ const CheckoutUI = (props) => {
|
|
|
328
340
|
)}
|
|
329
341
|
</WrapperUserDetails>
|
|
330
342
|
</UserDetailsContainer>
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
343
|
+
{cart?.business_id && (
|
|
344
|
+
<BusinessDetailsContainer>
|
|
345
|
+
{(businessDetails?.loading || cartState.loading) && !businessDetails?.error && (
|
|
334
346
|
<div>
|
|
335
|
-
<
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
347
|
+
<div>
|
|
348
|
+
<Skeleton height={35} style={{ marginBottom: '10px' }} />
|
|
349
|
+
<Skeleton height={35} style={{ marginBottom: '10px' }} />
|
|
350
|
+
<Skeleton height={35} style={{ marginBottom: '10px' }} />
|
|
351
|
+
<Skeleton height={35} style={{ marginBottom: '10px' }} />
|
|
352
|
+
<Skeleton height={35} style={{ marginBottom: '10px' }} />
|
|
353
|
+
</div>
|
|
340
354
|
</div>
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
{!cartState.loading && businessDetails?.business && Object.values(businessDetails?.business)?.length > 0 && (
|
|
344
|
-
<div>
|
|
345
|
-
<h1>{t('BUSINESS_DETAILS', 'Business Details')}</h1>
|
|
355
|
+
)}
|
|
356
|
+
{!cartState.loading && businessDetails?.business && Object.values(businessDetails?.business)?.length > 0 && (
|
|
346
357
|
<div>
|
|
347
|
-
<
|
|
348
|
-
<
|
|
349
|
-
|
|
350
|
-
|
|
358
|
+
<h1>{t('BUSINESS_DETAILS', 'Business Details')}</h1>
|
|
359
|
+
<div>
|
|
360
|
+
<p>{businessDetails?.business?.address}</p>
|
|
361
|
+
<p>{businessDetails?.business?.name}</p>
|
|
362
|
+
<p>{businessDetails?.business?.email}</p>
|
|
363
|
+
<p>{businessDetails?.business?.cellphone}</p>
|
|
364
|
+
</div>
|
|
351
365
|
</div>
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
366
|
+
)}
|
|
367
|
+
{businessDetails?.error && businessDetails?.error?.length > 0 && (
|
|
368
|
+
<div>
|
|
369
|
+
<h1>{t('BUSINESS_DETAILS', 'Business Details')}</h1>
|
|
370
|
+
<NotFoundSource
|
|
371
|
+
content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
|
|
372
|
+
/>
|
|
373
|
+
</div>
|
|
374
|
+
)}
|
|
375
|
+
</BusinessDetailsContainer>
|
|
376
|
+
)}
|
|
363
377
|
<CheckOutDivider />
|
|
364
378
|
</>
|
|
365
379
|
) : (
|
|
@@ -384,7 +398,7 @@ const CheckoutUI = (props) => {
|
|
|
384
398
|
</div>
|
|
385
399
|
)}
|
|
386
400
|
|
|
387
|
-
{!useKioskApp && (
|
|
401
|
+
{!useKioskApp && cart?.business_id && (
|
|
388
402
|
<>
|
|
389
403
|
{!cartState.loading && deliveryOptionSelected !== undefined && options?.type === 1 && (
|
|
390
404
|
<DeliveryOptionsContainer>
|
|
@@ -415,8 +429,8 @@ const CheckoutUI = (props) => {
|
|
|
415
429
|
cart={cart}
|
|
416
430
|
useKioskApp={useKioskApp}
|
|
417
431
|
isDisabled={cart?.status === 2}
|
|
418
|
-
businessId={businessDetails?.business?.id}
|
|
419
|
-
isLoading={businessDetails.loading}
|
|
432
|
+
businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
|
|
433
|
+
isLoading={!isGiftCardCart ? businessDetails.loading : false}
|
|
420
434
|
paymethods={businessDetails?.business?.paymethods}
|
|
421
435
|
onPaymentChange={handlePaymethodChange}
|
|
422
436
|
errorCash={errorCash}
|
|
@@ -470,7 +484,7 @@ const CheckoutUI = (props) => {
|
|
|
470
484
|
</WrapperLeftContent>
|
|
471
485
|
</WrapperLeftContainer>
|
|
472
486
|
<WrapperRightContainer>
|
|
473
|
-
{!cartState.loading && placeSpotsEnabled && (
|
|
487
|
+
{!cartState.loading && placeSpotsEnabled && cart?.business_id && (
|
|
474
488
|
<SelectSpotContainer>
|
|
475
489
|
<PlaceSpot
|
|
476
490
|
isCheckout
|
|
@@ -519,7 +533,9 @@ const CheckoutUI = (props) => {
|
|
|
519
533
|
<CartContainer>
|
|
520
534
|
<CartHeader>
|
|
521
535
|
<h1>{t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}</h1>
|
|
522
|
-
|
|
536
|
+
{cart?.business?.slug && (
|
|
537
|
+
<span onClick={() => cart?.business?.slug && handleStoreRedirect && handleStoreRedirect(cart?.business?.slug)}>{t('ADD_PRODUCTS', 'Add products')}</span>
|
|
538
|
+
)}
|
|
523
539
|
</CartHeader>
|
|
524
540
|
<Cart
|
|
525
541
|
isCartPending={cart?.status === 2}
|
|
@@ -586,7 +602,7 @@ const CheckoutUI = (props) => {
|
|
|
586
602
|
<span>{parsePrice(cart?.total)}</span>
|
|
587
603
|
<Button
|
|
588
604
|
color={(!cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100))) ? 'secundary' : 'primary'}
|
|
589
|
-
|
|
605
|
+
disabled={isDisablePlaceOrderButton}
|
|
590
606
|
onClick={() => isDisablePlaceOrderButton ? handleScrollTo('.paymentsContainer') : handlePlaceOrder()}
|
|
591
607
|
>
|
|
592
608
|
{!cart?.valid_maximum ? (
|
|
@@ -25,8 +25,10 @@ const DriverTipsUI = (props) => {
|
|
|
25
25
|
const [, t] = useLanguage()
|
|
26
26
|
const [{ configs }] = useConfig()
|
|
27
27
|
|
|
28
|
+
const [customTip, setCustomTip] = useState((isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) ?? false)
|
|
28
29
|
const [value, setvalue] = useState('')
|
|
29
30
|
const isFixedPriceType = parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
31
|
+
const currentTip = customTip ? parseFloat(driverTip || 0) > 0 : (!customTip && !driverTipsOptions.includes(driverTip) && parseFloat(driverTip || 0)) > 0
|
|
30
32
|
|
|
31
33
|
const handleChangeDriverTip = (e) => {
|
|
32
34
|
const tip = Number(e?.target?.value)
|
|
@@ -34,54 +36,64 @@ const DriverTipsUI = (props) => {
|
|
|
34
36
|
setvalue(e?.target?.value)
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
|
|
39
|
+
const placeholderCurrency = !isFixedPriceType ? `0%` : (configs?.currency_position?.value || 'left') === 'left'
|
|
38
40
|
? `${configs?.format_number_currency?.value}0`
|
|
39
41
|
: `0${configs?.format_number_currency?.value}`
|
|
40
42
|
|
|
41
43
|
return (
|
|
42
44
|
<DriverTipContainer id='driver-tip-container'>
|
|
43
45
|
<>
|
|
44
|
-
|
|
46
|
+
<WrapperTips>
|
|
47
|
+
{driverTipsOptions.map((option, i) => (
|
|
48
|
+
<TipCard
|
|
49
|
+
key={i}
|
|
50
|
+
className={`${(option === driverTip && !customTip) ? 'active' : ''}`}
|
|
51
|
+
onClick={() => {
|
|
52
|
+
handlerChangeOption(option)
|
|
53
|
+
setCustomTip(false)
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{`${isFixedPriceType ? parsePrice(option) : `${option}%`}`}
|
|
57
|
+
</TipCard>
|
|
58
|
+
))}
|
|
59
|
+
{(isDriverTipUseCustom && !isMulti) && (
|
|
60
|
+
<TipCard
|
|
61
|
+
className={`${customTip ? 'active' : ''}`}
|
|
62
|
+
onClick={() => setCustomTip(true)}
|
|
63
|
+
>
|
|
64
|
+
{t('CUSTOM_TIP', 'Custom')}
|
|
65
|
+
</TipCard>
|
|
66
|
+
)}
|
|
45
67
|
<FormDriverTip>
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPriceType &&
|
|
68
|
-
` (${driverTip}%)`}: {isFixedPriceType ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
|
|
69
|
-
</DriverTipMessage>
|
|
70
|
-
)}
|
|
68
|
+
{customTip &&
|
|
69
|
+
<WrapperInput>
|
|
70
|
+
<Input
|
|
71
|
+
name='drivertip'
|
|
72
|
+
type='text'
|
|
73
|
+
value={value}
|
|
74
|
+
placeholder={placeholderCurrency}
|
|
75
|
+
onChange={handleChangeDriverTip}
|
|
76
|
+
/>
|
|
77
|
+
<Button
|
|
78
|
+
color='primary'
|
|
79
|
+
disabled={parseFloat(value || 0) < 0 || parseFloat(value || 0) === driverTip || value === ''}
|
|
80
|
+
onClick={() => {
|
|
81
|
+
handlerChangeOption(value)
|
|
82
|
+
setvalue('')
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{t('APPLY_TIP', 'Apply Tip')}
|
|
86
|
+
</Button>
|
|
87
|
+
</WrapperInput>
|
|
88
|
+
}
|
|
71
89
|
</FormDriverTip>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
>
|
|
80
|
-
{`${isFixedPriceType ? parsePrice(option) : `${option}%`}`}
|
|
81
|
-
</TipCard>
|
|
82
|
-
))}
|
|
83
|
-
</WrapperTips>
|
|
84
|
-
)}
|
|
90
|
+
{currentTip && (
|
|
91
|
+
<DriverTipMessage>
|
|
92
|
+
{t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPriceType &&
|
|
93
|
+
` (${driverTip}%)`}: {isFixedPriceType ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
|
|
94
|
+
</DriverTipMessage>
|
|
95
|
+
)}
|
|
96
|
+
</WrapperTips>
|
|
85
97
|
</>
|
|
86
98
|
</DriverTipContainer>
|
|
87
99
|
)
|