ordering-ui-external 13.0.6 → 14.0.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.c4c91aa3ff7bda16e0a8.js → 0.ordering-ui.5d8e5d10aa0c5a9a862c.js} +1 -1
- package/_bundles/{4.ordering-ui.c4c91aa3ff7bda16e0a8.js → 4.ordering-ui.5d8e5d10aa0c5a9a862c.js} +1 -1
- package/_bundles/{7.ordering-ui.c4c91aa3ff7bda16e0a8.js → 7.ordering-ui.5d8e5d10aa0c5a9a862c.js} +1 -1
- package/_bundles/ordering-ui.5d8e5d10aa0c5a9a862c.js +2 -0
- package/_modules/themes/callcenterOriginal/src/components/AddressList/index.js +11 -4
- package/_modules/themes/callcenterOriginal/src/components/Messages/index.js +3 -1
- package/_modules/themes/callcenterOriginal/src/components/Orders/Messages/index.js +30 -12
- package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +80 -42
- package/_modules/themes/callcenterOriginal/src/components/SignUpForm/index.js +1 -1
- package/_modules/themes/callcenterOriginal/src/components/UserDetails/index.js +17 -10
- package/_modules/themes/five/src/components/AddressDetails/index.js +10 -2
- package/_modules/themes/five/src/components/AddressDetails/styles.js +5 -4
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/OrdersSection/index.js +8 -4
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +2 -1
- package/_modules/themes/five/src/components/Checkout/index.js +5 -4
- package/_modules/themes/five/src/components/HighestRated/index.js +1 -1
- package/_modules/themes/five/src/components/Messages/MapMessages.js +35 -5
- package/_modules/themes/five/src/components/Messages/index.js +8 -3
- package/_modules/themes/five/src/components/MultiCheckout/index.js +1 -1
- package/_modules/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +1 -1
- package/_modules/themes/five/src/components/OrdersOption/index.js +3 -2
- package/_modules/themes/five/src/components/SingleOrderCard/index.js +10 -25
- package/_modules/themes/five/src/components/UserDetails/index.js +27 -15
- package/_modules/themes/five/src/components/UserDetails/styles.js +4 -3
- package/_modules/themes/five/src/components/UserFormDetails/index.js +2 -2
- package/package.json +2 -2
- package/src/themes/callcenterOriginal/src/components/AddressList/index.js +9 -2
- package/src/themes/callcenterOriginal/src/components/Messages/index.js +3 -8
- package/src/themes/callcenterOriginal/src/components/Orders/Messages/index.js +30 -12
- package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +115 -85
- package/src/themes/callcenterOriginal/src/components/SignUpForm/index.js +1 -1
- package/src/themes/callcenterOriginal/src/components/UserDetails/index.js +9 -3
- package/src/themes/five/src/components/AddressDetails/index.js +18 -5
- package/src/themes/five/src/components/AddressDetails/styles.js +7 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/OrdersSection/index.js +5 -1
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -0
- package/src/themes/five/src/components/Checkout/index.js +29 -21
- package/src/themes/five/src/components/HighestRated/index.js +1 -1
- package/src/themes/five/src/components/Messages/MapMessages.js +21 -3
- package/src/themes/five/src/components/Messages/index.js +24 -15
- package/src/themes/five/src/components/MultiCheckout/index.js +1 -1
- package/src/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +1 -1
- package/src/themes/five/src/components/OrdersOption/index.js +3 -2
- package/src/themes/five/src/components/SingleOrderCard/index.js +11 -4
- package/src/themes/five/src/components/UserDetails/index.js +21 -10
- package/src/themes/five/src/components/UserDetails/styles.js +4 -0
- package/src/themes/five/src/components/UserFormDetails/index.js +2 -2
- package/_bundles/ordering-ui.c4c91aa3ff7bda16e0a8.js +0 -2
- /package/_bundles/{1.ordering-ui.c4c91aa3ff7bda16e0a8.js → 1.ordering-ui.5d8e5d10aa0c5a9a862c.js} +0 -0
- /package/_bundles/{2.ordering-ui.c4c91aa3ff7bda16e0a8.js → 2.ordering-ui.5d8e5d10aa0c5a9a862c.js} +0 -0
- /package/_bundles/{5.ordering-ui.c4c91aa3ff7bda16e0a8.js → 5.ordering-ui.5d8e5d10aa0c5a9a862c.js} +0 -0
- /package/_bundles/{6.ordering-ui.c4c91aa3ff7bda16e0a8.js → 6.ordering-ui.5d8e5d10aa0c5a9a862c.js} +0 -0
- /package/_bundles/{7.ordering-ui.c4c91aa3ff7bda16e0a8.js.LICENSE.txt → 7.ordering-ui.5d8e5d10aa0c5a9a862c.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.c4c91aa3ff7bda16e0a8.js → 8.ordering-ui.5d8e5d10aa0c5a9a862c.js} +0 -0
- /package/_bundles/{9.ordering-ui.c4c91aa3ff7bda16e0a8.js → 9.ordering-ui.5d8e5d10aa0c5a9a862c.js} +0 -0
- /package/_bundles/{ordering-ui.c4c91aa3ff7bda16e0a8.js.LICENSE.txt → ordering-ui.5d8e5d10aa0c5a9a862c.js.LICENSE.txt} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react'
|
|
2
2
|
import { useHistory, useLocation } from 'react-router-dom'
|
|
3
|
-
import { useUtils, useLanguage, useSession, MessagesDashboard as MessagesController } from 'ordering-components-external'
|
|
3
|
+
import { useUtils, useLanguage, useSession, MessagesDashboard as MessagesController, useConfig } from 'ordering-components-external'
|
|
4
4
|
import { useForm, Controller } from 'react-hook-form'
|
|
5
5
|
import { useTheme } from 'styled-components'
|
|
6
6
|
import Skeleton from 'react-loading-skeleton'
|
|
@@ -82,7 +82,6 @@ export const MessagesUI = (props) => {
|
|
|
82
82
|
getHistoryComment
|
|
83
83
|
} = props
|
|
84
84
|
|
|
85
|
-
const routerHistory = useHistory()
|
|
86
85
|
const query = new URLSearchParams(useLocation().search)
|
|
87
86
|
const [, t] = useLanguage()
|
|
88
87
|
const theme = useTheme()
|
|
@@ -99,8 +98,11 @@ export const MessagesUI = (props) => {
|
|
|
99
98
|
const [load, setLoad] = useState(0)
|
|
100
99
|
const [messageList, setMessageList] = useState([])
|
|
101
100
|
const [isChatDisabled, setIsChatDisabled] = useState(false)
|
|
102
|
-
const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
|
|
101
|
+
const previousStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
|
|
103
102
|
const chatDisabled = previousStatus.includes(order?.status)
|
|
103
|
+
const [{ configs }] = useConfig()
|
|
104
|
+
const showExternalId = configs?.change_order_id?.value === '1'
|
|
105
|
+
const hideLogBookMessages = configs?.order_logbook_enabled?.value === '0'
|
|
104
106
|
|
|
105
107
|
const adminMessageList = [
|
|
106
108
|
{ key: 'message_1', text: t('ADMIN_MESSAGE_1', 'admin_message_1') },
|
|
@@ -258,6 +260,20 @@ export const MessagesUI = (props) => {
|
|
|
258
260
|
})
|
|
259
261
|
}
|
|
260
262
|
|
|
263
|
+
const queryStringToObject = url => {
|
|
264
|
+
const params = new URLSearchParams(url.split('?')[1])
|
|
265
|
+
return Object.fromEntries(params)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const addQueryToUrl = (newObj) => {
|
|
269
|
+
const queryObj = queryStringToObject(location.href)
|
|
270
|
+
for (const key in newObj) {
|
|
271
|
+
queryObj[key] = newObj[key]
|
|
272
|
+
}
|
|
273
|
+
const query = new URLSearchParams(queryObj)
|
|
274
|
+
history && history.replaceState(null, '', `${location.pathname}?${query}`)
|
|
275
|
+
}
|
|
276
|
+
|
|
261
277
|
const unreadMessageControl = () => {
|
|
262
278
|
if (messages.loading || messages.messages.length === 0) return
|
|
263
279
|
if (messages.messages[messages.messages.length - 1].read) return
|
|
@@ -302,9 +318,9 @@ export const MessagesUI = (props) => {
|
|
|
302
318
|
const handleTabClick = (tab, isInitialRender) => {
|
|
303
319
|
setTabActive(tab)
|
|
304
320
|
if (!isInitialRender) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
321
|
+
addQueryToUrl({
|
|
322
|
+
tab: tab
|
|
323
|
+
})
|
|
308
324
|
}
|
|
309
325
|
}
|
|
310
326
|
|
|
@@ -330,7 +346,7 @@ export const MessagesUI = (props) => {
|
|
|
330
346
|
{isChat && (
|
|
331
347
|
<ChatHeader>
|
|
332
348
|
<OrderNumber>
|
|
333
|
-
{t('INVOICE_ORDER_NO', 'Order No')} {order.id}
|
|
349
|
+
{t('INVOICE_ORDER_NO', 'Order No')} {(showExternalId && !!order?.external_id) ? order.external_id : order.id}
|
|
334
350
|
</OrderNumber>
|
|
335
351
|
<ImageContainer>
|
|
336
352
|
{user?.level !== 2 && (
|
|
@@ -468,13 +484,15 @@ export const MessagesUI = (props) => {
|
|
|
468
484
|
<React.Fragment key={message.id}>
|
|
469
485
|
{history && tabActive === 'order_history' && (
|
|
470
486
|
<>
|
|
471
|
-
{message.type === 0 && (
|
|
487
|
+
{message.type === 0 && !hideLogBookMessages && (
|
|
472
488
|
<MessageConsole key={message.id}>
|
|
473
489
|
<BubbleConsole>
|
|
474
490
|
<p
|
|
475
491
|
dangerouslySetInnerHTML={{
|
|
476
492
|
__html: t('ORDER_PLACED_FOR_VIA', 'Order placed for _for_ via _via_.')
|
|
477
|
-
.replace('_for_', '<b>' +
|
|
493
|
+
.replace('_for_', '<b>' + order?.delivery_datetime_utc
|
|
494
|
+
? parseDate(order?.delivery_datetime_utc)
|
|
495
|
+
: parseDate(order?.delivery_datetime, { utc: false }) + '</b>')
|
|
478
496
|
.replace('_via_', '<b>' + t(order.app_id ? order.app_id.toUpperCase() : 'OTHER') + '</b>')
|
|
479
497
|
}}
|
|
480
498
|
/>
|
|
@@ -486,7 +504,7 @@ export const MessagesUI = (props) => {
|
|
|
486
504
|
</BubbleConsole>
|
|
487
505
|
</MessageConsole>
|
|
488
506
|
)}
|
|
489
|
-
{message.type === 1 && (
|
|
507
|
+
{message.type === 1 && !hideLogBookMessages && (
|
|
490
508
|
<MessageConsole key={message.id} style={{ display: `${tabActive === 'order_history' ? 'inline-flex' : 'none'}` }}>
|
|
491
509
|
{getHistoryComment(message) && (
|
|
492
510
|
<BubbleConsole>
|
|
@@ -509,7 +527,7 @@ export const MessagesUI = (props) => {
|
|
|
509
527
|
)}
|
|
510
528
|
{isChat && (
|
|
511
529
|
<>
|
|
512
|
-
{message.type === 0 && (
|
|
530
|
+
{message.type === 0 && !hideLogBookMessages && (
|
|
513
531
|
<MessageConsole key={message.id}>
|
|
514
532
|
<BubbleConsole>
|
|
515
533
|
<p>
|
|
@@ -528,7 +546,7 @@ export const MessagesUI = (props) => {
|
|
|
528
546
|
</BubbleConsole>
|
|
529
547
|
</MessageConsole>
|
|
530
548
|
)}
|
|
531
|
-
{message.type === 1 && (
|
|
549
|
+
{message.type === 1 && !hideLogBookMessages && (
|
|
532
550
|
<MessageConsole key={message.id} style={{ display: `${tabActive === 'order_history' ? 'inline-flex' : 'none'}` }}>
|
|
533
551
|
{getHistoryComment(message) && (
|
|
534
552
|
<BubbleConsole>
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
useLanguage,
|
|
6
6
|
useOrder,
|
|
7
7
|
useCustomer,
|
|
8
|
-
useConfig
|
|
8
|
+
useConfig,
|
|
9
|
+
useEvent
|
|
9
10
|
} from 'ordering-components-external'
|
|
10
11
|
import { useTheme } from 'styled-components'
|
|
11
12
|
import { Modal } from '../Modal'
|
|
@@ -63,17 +64,24 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
63
64
|
const theme = useTheme()
|
|
64
65
|
const [, { deleteUserCustomer }] = useCustomer()
|
|
65
66
|
const [configState] = useConfig()
|
|
67
|
+
const [events] = useEvent()
|
|
66
68
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
67
|
-
const [inputValue, setInputValue] = useState(urlPhone ?? '')
|
|
68
|
-
const [optSelected, setOptSelected] = useState(null)
|
|
69
69
|
const [isOpenUserData, setIsOpenUserData] = useState(false)
|
|
70
70
|
const [isAddressFormOpen, setIsAddressFormOpen] = useState(false)
|
|
71
71
|
const [isPickupSelected, setIsPickupSelected] = useState(pickupTypes.includes(orderState?.options?.type))
|
|
72
72
|
const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
|
|
73
|
+
const [inputValue, setInputValue] = useState(urlPhone ?? userCustomer?.cellphone ?? '')
|
|
74
|
+
const [isSavedAddress, setIsSavedAddress] = useState(false)
|
|
75
|
+
const [optSelected, setOptSelected] = useState(userCustomer ? {
|
|
76
|
+
value: userCustomer.cellphone || userCustomer.phone,
|
|
77
|
+
label: `${userCustomer?.country_phone_code ? `(${userCustomer?.country_phone_code})` : ''} ${userCustomer?.phone && !userCustomer?.cellphone ? `${userCustomer?.phone}` : ''} ${userCustomer?.cellphone ? `${userCustomer.cellphone}` : ''} - {${userCustomer.name}}`,
|
|
78
|
+
flag: userCustomer?.imported_address_text && userCustomer?.addresses?.length === 0,
|
|
79
|
+
lastname: userCustomer.lastname
|
|
80
|
+
} : null)
|
|
73
81
|
const configTypes = configState?.configs?.order_types_allowed?.value.split('|').filter(value => (allOrderTypes.includes(Number(value)))).map(value => Number(value)) || []
|
|
74
82
|
const userName = userCustomer?.lastname
|
|
75
83
|
? `${userCustomer?.name} ${userCustomer?.lastname}`
|
|
76
|
-
: userCustomer?.name
|
|
84
|
+
: userCustomer?.name ?? optSelected?.lastname
|
|
77
85
|
|
|
78
86
|
const handleCloseAlert = () => {
|
|
79
87
|
setCustomersPhones({ ...customersPhones, error: null })
|
|
@@ -87,7 +95,10 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
const handleFindClick = () => {
|
|
90
|
-
if (userCustomer?.id && orderState?.options?.address?.address) {
|
|
98
|
+
if (optSelected && !(userCustomer?.id && orderState?.options?.address?.address)) {
|
|
99
|
+
onChange(optSelected)
|
|
100
|
+
}
|
|
101
|
+
else if (userCustomer?.id && orderState?.options?.address?.address) {
|
|
91
102
|
onRedirectPage && onRedirectPage('search')
|
|
92
103
|
} else {
|
|
93
104
|
setAlertState({ open: true, content: t('SELECT_ADDRESS_CUSTOMER', 'Please select an address for the selected customer') })
|
|
@@ -124,8 +135,21 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
124
135
|
onChangeNumber(inputValue)
|
|
125
136
|
}
|
|
126
137
|
|
|
127
|
-
const onChange = (option) => {
|
|
128
|
-
|
|
138
|
+
const onChange = (option, triggeredAction) => {
|
|
139
|
+
if (triggeredAction?.action === 'clear') {
|
|
140
|
+
setOptSelected(null)
|
|
141
|
+
setCustomersPhones({ ...customersPhones, users: [] })
|
|
142
|
+
setInputValue('')
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
let user
|
|
146
|
+
if (option) {
|
|
147
|
+
user = customersPhones.users?.find(user => user.cellphone === option?.value || user.phone === option?.value)
|
|
148
|
+
}
|
|
149
|
+
setOptSelected({
|
|
150
|
+
...option,
|
|
151
|
+
lastname: user?.lastname ?? user?.name
|
|
152
|
+
})
|
|
129
153
|
setInputValue(option ? option?.value : '')
|
|
130
154
|
if (!option) {
|
|
131
155
|
onChangeNumber('')
|
|
@@ -134,7 +158,6 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
134
158
|
}
|
|
135
159
|
return
|
|
136
160
|
}
|
|
137
|
-
const user = customersPhones.users?.find(user => user.cellphone === option?.value || user.phone === option?.value)
|
|
138
161
|
if (user) {
|
|
139
162
|
setCustomerState({ ...customerState, result: user })
|
|
140
163
|
setOpenModal({ ...openModal, signup: false, customer: true })
|
|
@@ -201,6 +224,15 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
201
224
|
}
|
|
202
225
|
}, [orderState?.options?.type])
|
|
203
226
|
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
if (isSavedAddress &&
|
|
229
|
+
userCustomer?.id === orderState?.options?.user_id &&
|
|
230
|
+
orderState?.options?.address?.address
|
|
231
|
+
) {
|
|
232
|
+
events.emit('go_to_page', { page: 'search' })
|
|
233
|
+
}
|
|
234
|
+
}, [isSavedAddress, userCustomer?.id, orderState?.options?.user_id, orderState?.options?.address?.address])
|
|
235
|
+
|
|
204
236
|
const OrderTypesComponent = () => {
|
|
205
237
|
return (
|
|
206
238
|
<>
|
|
@@ -225,38 +257,36 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
225
257
|
<ContentWrapper>
|
|
226
258
|
<Title>{t('TITLE_HOME_CALLCENTER', 'Welcome to your Ordering Call Center.')}</Title>
|
|
227
259
|
<Slogan>{t('SUBTITLE_HOME_CALLCENTER', 'Start first by selecting a delivery type')}</Slogan>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
<
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
>
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
</TypesContainer>
|
|
259
|
-
)}
|
|
260
|
+
<TypesContainer>
|
|
261
|
+
{configTypes.includes(1) && (
|
|
262
|
+
<TypeButton onClick={() => handleChangeType(1)} disabled={orderState?.loading} activated={!isPickupSelected}>
|
|
263
|
+
<IconTypeButton activated={!isPickupSelected}>
|
|
264
|
+
<img
|
|
265
|
+
src={theme?.images?.general?.deliveryIco}
|
|
266
|
+
width={20}
|
|
267
|
+
height={20}
|
|
268
|
+
/>
|
|
269
|
+
</IconTypeButton>
|
|
270
|
+
<p>{t('DELIVERY', 'Delivery')}</p>
|
|
271
|
+
</TypeButton>
|
|
272
|
+
)}
|
|
273
|
+
{configTypes.some(type => pickupTypes.includes(type)) && (
|
|
274
|
+
<TypeButton
|
|
275
|
+
disabled={orderState?.loading}
|
|
276
|
+
activated={isPickupSelected}
|
|
277
|
+
onClick={() => handleChangeToPickup()}
|
|
278
|
+
>
|
|
279
|
+
<IconTypeButton activated={isPickupSelected}>
|
|
280
|
+
<img
|
|
281
|
+
src={theme?.images?.general?.pickupIco}
|
|
282
|
+
width={22}
|
|
283
|
+
height={22}
|
|
284
|
+
/>
|
|
285
|
+
</IconTypeButton>
|
|
286
|
+
<p>{t('PICKUP', 'Pickup')}</p>
|
|
287
|
+
</TypeButton>
|
|
288
|
+
)}
|
|
289
|
+
</TypesContainer>
|
|
260
290
|
{isPickupSelected && (
|
|
261
291
|
<>
|
|
262
292
|
<p>{t('WHAT_PICKUP_YOU_NEED', 'What kind of pickup do you need?')}</p>
|
|
@@ -267,51 +297,49 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
267
297
|
)}
|
|
268
298
|
{configTypes.includes(orderState?.options?.type) && (
|
|
269
299
|
<>
|
|
270
|
-
|
|
271
|
-
<
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
<
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
<
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
</PhoneAutocompleteContainer>
|
|
314
|
-
)}
|
|
300
|
+
<PhoneAutocompleteContainer>
|
|
301
|
+
<h2>
|
|
302
|
+
{t('ADDING_CUSTOMERS_PHONE_NUMBER', 'Adding the customers’ phone number')}
|
|
303
|
+
</h2>
|
|
304
|
+
<WrappBtn>
|
|
305
|
+
<Button
|
|
306
|
+
color={(inputValue || (userCustomer && orderState?.options?.address?.address)) ? 'primary' : 'secundary'}
|
|
307
|
+
onMouseDown={() => !(userCustomer && orderState?.options?.address?.address) && !optSelected ? createNewUser() : handleFindClick()}
|
|
308
|
+
disabled={(!inputValue && !(userCustomer && orderState?.options?.address?.address) && !optSelected)}
|
|
309
|
+
>
|
|
310
|
+
{
|
|
311
|
+
!(userCustomer && orderState?.options?.address?.address) && !optSelected
|
|
312
|
+
? t('CREATE_CUSTOMER', 'Create new customer')
|
|
313
|
+
: `${t('CONTINUE_WITH', 'Continue with')} ${userName}`
|
|
314
|
+
}
|
|
315
|
+
</Button>
|
|
316
|
+
</WrappBtn>
|
|
317
|
+
<SelectContainer>
|
|
318
|
+
<MdcCellphoneAndroid size={18} color={theme?.colors?.primary} />
|
|
319
|
+
<Select
|
|
320
|
+
isSearchable
|
|
321
|
+
isClearable
|
|
322
|
+
className='basic-single'
|
|
323
|
+
classNamePrefix='select'
|
|
324
|
+
placeholder={t('PHONE_NUMBER', 'Phone number')}
|
|
325
|
+
value={optSelected}
|
|
326
|
+
noOptionsMessage={() => inputValue?.length > 6 ? t('NO_OPTIONS', 'No options') : t('TYPE_AT_LEAST_NUMBER_SUGGEST', 'Type at least 7 numbers for suggesstions')}
|
|
327
|
+
inputValue={!optSelected ? inputValue : ''}
|
|
328
|
+
onChange={onChange}
|
|
329
|
+
onInputChange={onInputChange}
|
|
330
|
+
isLoading={customersPhones?.loading}
|
|
331
|
+
options={optionsToSelect}
|
|
332
|
+
components={{ Option }}
|
|
333
|
+
/>
|
|
334
|
+
{optSelected && (
|
|
335
|
+
<ContinueButton>
|
|
336
|
+
<Button onClick={() => onChange(optSelected)} color='primary'>
|
|
337
|
+
{t('CONTINUE', 'Continue')}
|
|
338
|
+
</Button>
|
|
339
|
+
</ContinueButton>
|
|
340
|
+
)}
|
|
341
|
+
</SelectContainer>
|
|
342
|
+
</PhoneAutocompleteContainer>
|
|
315
343
|
</>
|
|
316
344
|
)}
|
|
317
345
|
</ContentWrapper>
|
|
@@ -361,10 +389,12 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
361
389
|
}}
|
|
362
390
|
isEnableContinueButton
|
|
363
391
|
isCustomerMode
|
|
392
|
+
isFromPhoneAutocomplete
|
|
364
393
|
isOpenUserData={isOpenUserData}
|
|
365
394
|
setIsOpenUserData={setIsOpenUserData}
|
|
366
395
|
setIsAddressFormOpen={setIsAddressFormOpen}
|
|
367
396
|
franchiseId={franchiseId}
|
|
397
|
+
setIsSavedAddress={setIsSavedAddress}
|
|
368
398
|
/>
|
|
369
399
|
</>
|
|
370
400
|
)}
|
|
@@ -278,7 +278,7 @@ const SignUpFormUI = (props) => {
|
|
|
278
278
|
name={field.code}
|
|
279
279
|
aria-label={field.code}
|
|
280
280
|
className='form'
|
|
281
|
-
placeholder={t(field.code.toUpperCase(), field.name)}
|
|
281
|
+
placeholder={!field.required ? t(field.code.toUpperCase() + '_OPTIONAL', field.name + ' (Optional)') : t(field.code.toUpperCase(), field.name)}
|
|
282
282
|
onChange={handleChangeInputEmail}
|
|
283
283
|
ref={(e) => {
|
|
284
284
|
emailInput.current = e
|
|
@@ -44,6 +44,8 @@ const UserDetailsUI = (props) => {
|
|
|
44
44
|
const [{ user }] = useSession()
|
|
45
45
|
const userData = userState.result?.result || props.userData || formState.result?.result || user
|
|
46
46
|
|
|
47
|
+
const validationFieldsLength = Object.values(validationFields?.fields?.checkout)?.map(field => field.enabled)
|
|
48
|
+
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
if (isUserDetailsEdit) {
|
|
49
51
|
!isEdit && toggleIsEdit()
|
|
@@ -69,9 +71,13 @@ const UserDetailsUI = (props) => {
|
|
|
69
71
|
<BeforeComponent key={i} {...props} />))}
|
|
70
72
|
{(validationFields.loading || formState.loading || userState.loading) && (
|
|
71
73
|
<UserData>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
{validationFieldsLength?.map(field => (
|
|
75
|
+
<React.Fragment key={field?.id}>
|
|
76
|
+
<Skeleton width={250} height={50} />
|
|
77
|
+
<Skeleton width={180} height={25} />
|
|
78
|
+
<Skeleton width={210} height={50} />
|
|
79
|
+
</React.Fragment>
|
|
80
|
+
))}
|
|
75
81
|
</UserData>
|
|
76
82
|
)}
|
|
77
83
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Header,
|
|
7
7
|
Map,
|
|
8
8
|
Text,
|
|
9
|
+
ToggleMap,
|
|
9
10
|
WrappMap
|
|
10
11
|
} from './styles'
|
|
11
12
|
|
|
@@ -27,6 +28,7 @@ const AddressDetailsUI = (props) => {
|
|
|
27
28
|
const [, t] = useLanguage()
|
|
28
29
|
const [openModal, setOpenModal] = useState(false)
|
|
29
30
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
31
|
+
const [isShowMap, setIsShowMap] = useState(false)
|
|
30
32
|
const userCustomer = JSON.parse(window.localStorage.getItem('user-customer'))
|
|
31
33
|
const [{ user }] = useCustomer()
|
|
32
34
|
|
|
@@ -51,11 +53,22 @@ const AddressDetailsUI = (props) => {
|
|
|
51
53
|
</Text>
|
|
52
54
|
</Header>
|
|
53
55
|
{apiKey && (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
<>
|
|
57
|
+
{!isShowMap && (
|
|
58
|
+
<ToggleMap>
|
|
59
|
+
<Text>
|
|
60
|
+
<span onClick={() => setIsShowMap(!isShowMap)}>{t('SHOW_MAP', 'Show map')}</span>
|
|
61
|
+
</Text>
|
|
62
|
+
</ToggleMap>
|
|
63
|
+
)}
|
|
64
|
+
{isShowMap && (
|
|
65
|
+
<WrappMap>
|
|
66
|
+
<Map>
|
|
67
|
+
<img src={googleMapsUrl} id='google-maps-image' alt='google-maps-location' width='288px' height='162px' loading='lazy' />
|
|
68
|
+
</Map>
|
|
69
|
+
</WrappMap>
|
|
70
|
+
)}
|
|
71
|
+
</>
|
|
59
72
|
)}
|
|
60
73
|
|
|
61
74
|
<Modal
|
|
@@ -11,6 +11,7 @@ export const Header = styled.div``
|
|
|
11
11
|
export const WrappMap = styled.div`
|
|
12
12
|
width: 100%;
|
|
13
13
|
margin: auto;
|
|
14
|
+
height: 300px;
|
|
14
15
|
`
|
|
15
16
|
|
|
16
17
|
export const Map = styled.div`
|
|
@@ -63,3 +64,9 @@ export const Text = styled.div`
|
|
|
63
64
|
`}
|
|
64
65
|
}
|
|
65
66
|
`
|
|
67
|
+
|
|
68
|
+
export const ToggleMap = styled.div`
|
|
69
|
+
span {
|
|
70
|
+
margin: 0 auto;
|
|
71
|
+
}
|
|
72
|
+
`
|
|
@@ -9,7 +9,8 @@ export const OrdersSection = (props) => {
|
|
|
9
9
|
getCustomArray,
|
|
10
10
|
businessesList,
|
|
11
11
|
isCustomerMode,
|
|
12
|
-
userCustomer
|
|
12
|
+
userCustomer,
|
|
13
|
+
disableSkeletons
|
|
13
14
|
} = props
|
|
14
15
|
const [orderState] = useOrder()
|
|
15
16
|
const [, t] = useLanguage()
|
|
@@ -41,6 +42,7 @@ export const OrdersSection = (props) => {
|
|
|
41
42
|
isCustomerMode={isCustomerMode}
|
|
42
43
|
franchiseId={props.franchiseId}
|
|
43
44
|
handleRedirectToCheckout={handleRedirectToCheckout}
|
|
45
|
+
disableSkeletons={disableSkeletons}
|
|
44
46
|
/>
|
|
45
47
|
<OrdersOption
|
|
46
48
|
propsToFetch={propsToFetch}
|
|
@@ -58,6 +60,7 @@ export const OrdersSection = (props) => {
|
|
|
58
60
|
isCustomerMode={isCustomerMode}
|
|
59
61
|
franchiseId={props.franchiseId}
|
|
60
62
|
handleRedirectToCheckout={handleRedirectToCheckout}
|
|
63
|
+
disableSkeletons={disableSkeletons}
|
|
61
64
|
/>
|
|
62
65
|
<OrdersOption
|
|
63
66
|
propsToFetch={propsToFetch}
|
|
@@ -75,6 +78,7 @@ export const OrdersSection = (props) => {
|
|
|
75
78
|
isCustomerMode={isCustomerMode}
|
|
76
79
|
franchiseId={props.franchiseId}
|
|
77
80
|
handleRedirectToCheckout={handleRedirectToCheckout}
|
|
81
|
+
disableSkeletons={disableSkeletons}
|
|
78
82
|
/>
|
|
79
83
|
</>
|
|
80
84
|
)}
|
|
@@ -100,7 +100,8 @@ const CheckoutUI = (props) => {
|
|
|
100
100
|
onPlaceOrderClick,
|
|
101
101
|
setPlaceSpotNumber,
|
|
102
102
|
placeSpotNumber,
|
|
103
|
-
checkoutFieldsState
|
|
103
|
+
checkoutFieldsState,
|
|
104
|
+
alseaCheckPriceError
|
|
104
105
|
} = props
|
|
105
106
|
|
|
106
107
|
const theme = useTheme()
|
|
@@ -171,7 +172,8 @@ const CheckoutUI = (props) => {
|
|
|
171
172
|
validateCommentsCartField ||
|
|
172
173
|
validateDriverTipField ||
|
|
173
174
|
validateCouponField ||
|
|
174
|
-
validateZipcodeCard
|
|
175
|
+
validateZipcodeCard ||
|
|
176
|
+
!!alseaCheckPriceError
|
|
175
177
|
|
|
176
178
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
177
179
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
@@ -199,7 +201,7 @@ const CheckoutUI = (props) => {
|
|
|
199
201
|
return
|
|
200
202
|
}
|
|
201
203
|
|
|
202
|
-
if (!userErrors.length && !requiredFields?.length) {
|
|
204
|
+
if ((!userErrors.length && !requiredFields?.length) || (requiredFields?.length === 1 && isCustomerMode && requiredFields?.includes('email'))) {
|
|
203
205
|
const body = {}
|
|
204
206
|
if (behalfName) {
|
|
205
207
|
body.on_behalf_of = behalfName
|
|
@@ -578,24 +580,24 @@ const CheckoutUI = (props) => {
|
|
|
578
580
|
|
|
579
581
|
{
|
|
580
582
|
!!(!isMultiDriverTips && driverTipsField) &&
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
583
|
+
<>
|
|
584
|
+
<DriverTipContainer>
|
|
585
|
+
<h1>{t('DRIVER_TIPS', 'Driver Tips')}</h1>
|
|
586
|
+
<p>{t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')}</p>
|
|
587
|
+
<DriverTips
|
|
588
|
+
businessId={cart?.business_id}
|
|
589
|
+
driverTipsOptions={driverTipsOptions}
|
|
590
|
+
isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
|
|
591
|
+
isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
|
|
592
|
+
driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
|
|
593
|
+
? cart?.driver_tip
|
|
594
|
+
: cart?.driver_tip_rate}
|
|
595
|
+
cart={cart}
|
|
596
|
+
useOrderContext
|
|
597
|
+
/>
|
|
598
|
+
</DriverTipContainer>
|
|
599
|
+
<DriverTipDivider />
|
|
600
|
+
</>
|
|
599
601
|
}
|
|
600
602
|
{!cartState.loading && placeSpotsEnabled && cart?.business_id && (
|
|
601
603
|
<SelectSpotContainer>
|
|
@@ -723,6 +725,12 @@ const CheckoutUI = (props) => {
|
|
|
723
725
|
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
724
726
|
</WarningText>
|
|
725
727
|
)}
|
|
728
|
+
|
|
729
|
+
{!!alseaCheckPriceError && (
|
|
730
|
+
<WarningText>
|
|
731
|
+
{alseaCheckPriceError}
|
|
732
|
+
</WarningText>
|
|
733
|
+
)}
|
|
726
734
|
{cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
|
|
727
735
|
<WarningText>
|
|
728
736
|
{t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
|
|
@@ -81,7 +81,7 @@ const HighestRatedUI = (props) => {
|
|
|
81
81
|
<BusinessListWrapper>
|
|
82
82
|
<BusinessList>
|
|
83
83
|
{
|
|
84
|
-
!businessesList.loading && (businessesList.businesses.length === 0 || isBusinessWithReviews) && (
|
|
84
|
+
!isCustomerMode && !businessesList.loading && (businessesList.businesses.length === 0 || isBusinessWithReviews) && (
|
|
85
85
|
<NotFoundSource
|
|
86
86
|
content={t('NOT_FOUND_BUSINESSES_HIGHEST_RATED', 'No highest rated businesses found, please change filters or change address.')}
|
|
87
87
|
>
|