ordering-ui-external 2.4.6 → 2.5.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.038c4b4d536032472bc7.js → 0.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/{1.ordering-ui.038c4b4d536032472bc7.js → 1.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/{2.ordering-ui.038c4b4d536032472bc7.js → 2.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/{4.ordering-ui.038c4b4d536032472bc7.js → 4.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/{5.ordering-ui.038c4b4d536032472bc7.js → 5.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/{6.ordering-ui.038c4b4d536032472bc7.js → 6.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/{7.ordering-ui.038c4b4d536032472bc7.js → 7.ordering-ui.5657c6a53b3791887fd7.js} +2 -2
- package/_bundles/{8.ordering-ui.038c4b4d536032472bc7.js → 8.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/{9.ordering-ui.038c4b4d536032472bc7.js → 9.ordering-ui.5657c6a53b3791887fd7.js} +1 -1
- package/_bundles/ordering-ui.5657c6a53b3791887fd7.js +2 -0
- package/_modules/components/OrdersOption/styles.js +1 -1
- package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +15 -8
- package/_modules/components/VerticalOrdersLayout/styles.js +2 -2
- package/_modules/contexts/ThemeContext/index.js +1 -0
- package/_modules/themes/five/src/components/AddressList/index.js +8 -7
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +28 -22
- package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +22 -21
- package/_modules/themes/five/src/components/BusinessController/index.js +5 -3
- package/_modules/themes/five/src/components/BusinessInformation/index.js +16 -10
- package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +5 -8
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +93 -74
- package/_modules/themes/five/src/components/BusinessListingSearch/styles.js +10 -4
- package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +7 -2
- package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessProductsList/index.js +1 -1
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +38 -13
- package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +20 -9
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +35 -23
- package/_modules/themes/five/src/components/Cart/index.js +7 -3
- package/_modules/themes/five/src/components/Checkout/index.js +12 -11
- package/_modules/themes/five/src/components/Checkout/styles.js +8 -4
- package/_modules/themes/five/src/components/GiftCard/GiftCardUI/index.js +1 -0
- package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +4 -3
- package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +14 -8
- package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +1 -1
- package/_modules/themes/five/src/components/Header/index.js +29 -21
- package/_modules/themes/five/src/components/Header/styles.js +44 -40
- package/_modules/themes/five/src/components/MultiCheckout/index.js +18 -16
- package/_modules/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +6 -4
- package/_modules/themes/five/src/components/MyOrders/index.js +16 -10
- package/_modules/themes/five/src/components/MyOrders/styles.js +15 -12
- package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +5 -2
- package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +2 -2
- package/_modules/themes/five/src/components/OrderDetails/index.js +2 -2
- package/_modules/themes/five/src/components/OrderItAgain/styles.js +1 -1
- package/_modules/themes/five/src/components/OrderProgress/index.js +15 -4
- package/_modules/themes/five/src/components/OrderTypeSelectorContent/index.js +16 -4
- package/_modules/themes/five/src/components/PageBanner/styles.js +1 -1
- package/_modules/themes/five/src/components/ProductForm/index.js +27 -7
- package/_modules/themes/five/src/components/ProductForm/styles.js +40 -31
- package/_modules/themes/five/src/components/ProductItemAccordion/index.js +6 -6
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -3
- package/_modules/themes/five/src/components/ReviewProduct/index.js +9 -4
- package/_modules/themes/five/src/components/ServiceForm/index.js +22 -3
- package/_modules/themes/five/src/components/ServiceForm/styles.js +9 -3
- package/_modules/themes/five/src/components/SidebarMenu/index.js +19 -10
- package/_modules/themes/five/src/components/SignUpForm/index.js +56 -29
- package/_modules/themes/five/src/components/SingleOrderCard/index.js +1 -1
- package/_modules/themes/five/src/components/SingleOrderCard/styles.js +26 -24
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +9 -5
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
- package/_modules/themes/five/src/components/UpsellingPage/index.js +2 -1
- package/_modules/themes/five/src/components/UserFormDetails/index.js +58 -18
- package/_modules/themes/five/src/components/UserFormDetails/styles.js +7 -3
- package/_modules/themes/five/src/components/UserPopover/index.js +41 -25
- package/_modules/themes/five/src/components/UserProfileForm/index.js +19 -11
- package/_modules/themes/five/src/styles/Buttons/index.js +68 -58
- package/_modules/themes/five/src/styles/Inputs/index.js +40 -16
- package/_modules/utils/index.js +8 -2
- package/index.html +1 -1
- package/package.json +3 -2
- package/src/components/OrdersOption/styles.js +1 -0
- package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +35 -17
- package/src/components/VerticalOrdersLayout/styles.js +9 -0
- package/src/contexts/ThemeContext/index.js +1 -0
- package/src/themes/five/src/components/AddressList/index.js +6 -6
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +24 -22
- package/src/themes/five/src/components/BusinessBasicInformation/styles.js +24 -3
- package/src/themes/five/src/components/BusinessController/index.js +4 -2
- package/src/themes/five/src/components/BusinessInformation/index.js +24 -12
- package/src/themes/five/src/components/BusinessItemAccordion/index.js +5 -6
- package/src/themes/five/src/components/BusinessListingSearch/index.js +127 -101
- package/src/themes/five/src/components/BusinessListingSearch/styles.js +15 -0
- package/src/themes/five/src/components/BusinessProductsCategories/index.js +7 -2
- package/src/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
- package/src/themes/five/src/components/BusinessProductsList/index.js +1 -1
- package/src/themes/five/src/components/BusinessProductsListing/index.js +34 -9
- package/src/themes/five/src/components/BusinessProductsListing/styles.js +26 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +9 -2
- package/src/themes/five/src/components/Cart/index.js +3 -4
- package/src/themes/five/src/components/Checkout/index.js +18 -4
- package/src/themes/five/src/components/Checkout/styles.js +22 -0
- package/src/themes/five/src/components/GiftCard/GiftCardUI/index.js +1 -0
- package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +41 -31
- package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +15 -4
- package/src/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +2 -2
- package/src/themes/five/src/components/Header/index.js +17 -5
- package/src/themes/five/src/components/Header/styles.js +9 -6
- package/src/themes/five/src/components/MultiCheckout/index.js +9 -10
- package/src/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +8 -5
- package/src/themes/five/src/components/MyOrders/index.js +13 -9
- package/src/themes/five/src/components/MyOrders/styles.js +3 -1
- package/src/themes/five/src/components/OrderDetails/OrderEta.js +3 -2
- package/src/themes/five/src/components/OrderDetails/OrderHistory.js +8 -2
- package/src/themes/five/src/components/OrderDetails/index.js +2 -2
- package/src/themes/five/src/components/OrderItAgain/styles.js +1 -1
- package/src/themes/five/src/components/OrderProgress/index.js +16 -5
- package/src/themes/five/src/components/OrderTypeSelectorContent/index.js +7 -4
- package/src/themes/five/src/components/PageBanner/styles.js +1 -4
- package/src/themes/five/src/components/ProductForm/index.js +23 -5
- package/src/themes/five/src/components/ProductForm/styles.js +36 -1
- package/src/themes/five/src/components/ProductItemAccordion/index.js +37 -29
- package/src/themes/five/src/components/RenderProductsLayout/index.js +3 -3
- package/src/themes/five/src/components/ReviewProduct/index.js +14 -6
- package/src/themes/five/src/components/ServiceForm/index.js +22 -4
- package/src/themes/five/src/components/ServiceForm/styles.js +16 -0
- package/src/themes/five/src/components/SidebarMenu/index.js +162 -144
- package/src/themes/five/src/components/SignUpForm/index.js +4 -3
- package/src/themes/five/src/components/SingleOrderCard/index.js +1 -1
- package/src/themes/five/src/components/SingleOrderCard/styles.js +9 -1
- package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +13 -3
- package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
- package/src/themes/five/src/components/UpsellingPage/index.js +1 -1
- package/src/themes/five/src/components/UserFormDetails/index.js +58 -14
- package/src/themes/five/src/components/UserFormDetails/styles.js +16 -0
- package/src/themes/five/src/components/UserPopover/index.js +26 -15
- package/src/themes/five/src/components/UserProfileForm/index.js +18 -9
- package/src/themes/five/src/styles/Buttons/index.js +11 -0
- package/src/themes/five/src/styles/Inputs/index.js +34 -0
- package/src/utils/index.js +5 -0
- package/template/app.js +5 -3
- package/template/theme.json +335 -24
- package/_bundles/ordering-ui.038c4b4d536032472bc7.js +0 -2
- /package/_bundles/{7.ordering-ui.038c4b4d536032472bc7.js.LICENSE.txt → 7.ordering-ui.5657c6a53b3791887fd7.js.LICENSE.txt} +0 -0
- /package/_bundles/{ordering-ui.038c4b4d536032472bc7.js.LICENSE.txt → ordering-ui.5657c6a53b3791887fd7.js.LICENSE.txt} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react'
|
|
2
2
|
import Skeleton from 'react-loading-skeleton'
|
|
3
|
+
import { nanoid } from 'nanoid'
|
|
3
4
|
import FiMinusCircle from '@meronex/icons/fi/FiMinusCircle'
|
|
4
5
|
import FiPlusCircle from '@meronex/icons/fi/FiPlusCircle'
|
|
5
6
|
import MdcPlayCircleOutline from '@meronex/icons/mdc/MdcPlayCircleOutline'
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
useConfig
|
|
18
19
|
} from 'ordering-components-external'
|
|
19
20
|
|
|
20
|
-
import { scrollTo } from '../../../../../utils'
|
|
21
|
+
import { scrollTo, orderTypeList } from '../../../../../utils'
|
|
21
22
|
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
22
23
|
|
|
23
24
|
import { ProductIngredient } from '../ProductIngredient'
|
|
@@ -62,7 +63,8 @@ import {
|
|
|
62
63
|
ProductTagsListContainer,
|
|
63
64
|
ProductTagWrapper,
|
|
64
65
|
VideoGalleryWrapper,
|
|
65
|
-
TitleWrapper
|
|
66
|
+
TitleWrapper,
|
|
67
|
+
GuestUserLink
|
|
66
68
|
} from './styles'
|
|
67
69
|
import { useTheme } from 'styled-components'
|
|
68
70
|
import { Input, TextArea } from '../../styles/Inputs'
|
|
@@ -95,7 +97,9 @@ const ProductOptionsUI = (props) => {
|
|
|
95
97
|
handleChangeSuboptionState,
|
|
96
98
|
handleChangeCommentState,
|
|
97
99
|
productAddedToCartLength,
|
|
98
|
-
handleFavoriteProduct
|
|
100
|
+
handleFavoriteProduct,
|
|
101
|
+
handleCreateGuestUser,
|
|
102
|
+
actionStatus
|
|
99
103
|
} = props
|
|
100
104
|
|
|
101
105
|
const { product, loading, error } = productObject
|
|
@@ -129,6 +133,9 @@ const ProductOptionsUI = (props) => {
|
|
|
129
133
|
|
|
130
134
|
const [{ configs }] = useConfig()
|
|
131
135
|
const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map(value => Number(value)) || []
|
|
136
|
+
const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
|
|
137
|
+
const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
|
|
138
|
+
const hideProductDescription = theme?.business_view?.components?.products?.components?.product?.components?.description?.hidden
|
|
132
139
|
|
|
133
140
|
const closeModal = () => {
|
|
134
141
|
setModalIsOpen(false)
|
|
@@ -246,6 +253,11 @@ const ProductOptionsUI = (props) => {
|
|
|
246
253
|
}
|
|
247
254
|
}
|
|
248
255
|
|
|
256
|
+
const handleUpdateGuest = () => {
|
|
257
|
+
const guestToken = nanoid()
|
|
258
|
+
if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
|
|
259
|
+
}
|
|
260
|
+
|
|
249
261
|
const handleSlideChange = () => {
|
|
250
262
|
var videos = document.querySelectorAll('iframe, video')
|
|
251
263
|
Array.prototype.forEach.call(videos, function (video) {
|
|
@@ -526,7 +538,7 @@ const ProductOptionsUI = (props) => {
|
|
|
526
538
|
)}
|
|
527
539
|
</ProductMeta>
|
|
528
540
|
</Properties>
|
|
529
|
-
{product?.description && (
|
|
541
|
+
{product?.description && !hideProductDescription && (
|
|
530
542
|
<ProductDescription>
|
|
531
543
|
<LinkableText
|
|
532
544
|
text={product?.description}
|
|
@@ -662,7 +674,7 @@ const ProductOptionsUI = (props) => {
|
|
|
662
674
|
<MidComponent key={i} {...props} />))
|
|
663
675
|
}
|
|
664
676
|
</ProductEdition>
|
|
665
|
-
<ProductActions>
|
|
677
|
+
<ProductActions isColumn={(auth && !(orderState.options?.address_id || unaddressedTypes.includes(orderState?.options?.type)))}>
|
|
666
678
|
<div className='price-amount-block'>
|
|
667
679
|
<div className='price'>
|
|
668
680
|
<h4>{productCart.total && parsePrice(productCart.total)}</h4>
|
|
@@ -737,6 +749,7 @@ const ProductOptionsUI = (props) => {
|
|
|
737
749
|
) : (
|
|
738
750
|
<AddressList
|
|
739
751
|
isModal
|
|
752
|
+
isProfile
|
|
740
753
|
userId={isNaN(userCustomer?.id) ? null : userCustomer?.id}
|
|
741
754
|
addressList={isNaN(userCustomer?.id) ? user.addresses : null}
|
|
742
755
|
isProductForm
|
|
@@ -755,6 +768,11 @@ const ProductOptionsUI = (props) => {
|
|
|
755
768
|
{isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', theme?.defaultLanguages?.SOLD_OUT || 'Sold out') : t('LOGIN_SIGNUP', theme?.defaultLanguages?.LOGIN_SIGNUP || 'Login / Sign Up')}
|
|
756
769
|
</Button>
|
|
757
770
|
)}
|
|
771
|
+
{!auth && guestCheckoutEnabled && orderTypeEnabled && (
|
|
772
|
+
<GuestUserLink onClick={handleUpdateGuest}>
|
|
773
|
+
{actionStatus?.loading ? <Skeleton height={25} width={70} /> : t('WITH_GUEST_USER', 'With Guest user')}
|
|
774
|
+
</GuestUserLink>
|
|
775
|
+
)}
|
|
758
776
|
</ProductActions>
|
|
759
777
|
</ProductInfo>
|
|
760
778
|
</>
|
|
@@ -314,7 +314,7 @@ export const ProductActions = styled.div`
|
|
|
314
314
|
div.price-amount-block {
|
|
315
315
|
display: flex;
|
|
316
316
|
justify-content: space-between;
|
|
317
|
-
width:
|
|
317
|
+
width: 70%
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
svg {
|
|
@@ -356,6 +356,17 @@ export const ProductActions = styled.div`
|
|
|
356
356
|
margin: 0 10px;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
#address_control {
|
|
360
|
+
button.add {
|
|
361
|
+
width: calc(100% - 20px) !important;
|
|
362
|
+
margin: 10px 10px 0 10px;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
div#address_list {
|
|
367
|
+
padding: 0;
|
|
368
|
+
}
|
|
369
|
+
|
|
359
370
|
@media (min-width: 577px) {
|
|
360
371
|
position: sticky;
|
|
361
372
|
}
|
|
@@ -370,6 +381,13 @@ export const ProductActions = styled.div`
|
|
|
370
381
|
padding: 10px 20px;
|
|
371
382
|
box-sizing: border-box;
|
|
372
383
|
|
|
384
|
+
${({ isColumn }) => isColumn && css`
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
div.price-amount-block {
|
|
387
|
+
margin-bottom: 15px;
|
|
388
|
+
}
|
|
389
|
+
`}
|
|
390
|
+
|
|
373
391
|
div.price {
|
|
374
392
|
width: 25%;
|
|
375
393
|
}
|
|
@@ -602,3 +620,20 @@ export const VideoGalleryWrapper = styled.div`
|
|
|
602
620
|
font-size: 28px;
|
|
603
621
|
}
|
|
604
622
|
`
|
|
623
|
+
|
|
624
|
+
export const GuestUserLink = styled.div`
|
|
625
|
+
font-size: 14px;
|
|
626
|
+
color: ${props => props.theme.colors.primary};
|
|
627
|
+
text-align: center;
|
|
628
|
+
cursor: pointer;
|
|
629
|
+
margin: 15px 0;
|
|
630
|
+
white-space: nowrap;
|
|
631
|
+
&:hover {
|
|
632
|
+
text-decoration: underline;
|
|
633
|
+
}
|
|
634
|
+
margin-left: 10px;
|
|
635
|
+
${props => props.theme.rtl && css`
|
|
636
|
+
margin-left: 0;
|
|
637
|
+
margin-right: 10px;
|
|
638
|
+
`}
|
|
639
|
+
`
|
|
@@ -63,7 +63,7 @@ export const ProductItemAccordion = (props) => {
|
|
|
63
63
|
const productActionsDelete = useRef(null)
|
|
64
64
|
|
|
65
65
|
const viewString = isConfirmationPage ? 'confirmation' : isStore ? 'business_view' : 'header'
|
|
66
|
-
const showProductImage = !
|
|
66
|
+
const showProductImage = !theme?.[viewString]?.components?.cart?.components?.products?.components?.image?.hidden
|
|
67
67
|
|
|
68
68
|
const productInfo = () => {
|
|
69
69
|
if (isCartProduct) {
|
|
@@ -224,13 +224,15 @@ export const ProductItemAccordion = (props) => {
|
|
|
224
224
|
<Pencil color='#B1BCCC' />
|
|
225
225
|
</ProductActionsEdit>
|
|
226
226
|
)}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
227
|
+
{onDeleteProduct && (
|
|
228
|
+
<ProductActionsDelete
|
|
229
|
+
ref={productActionsDelete}
|
|
230
|
+
onClick={() => onDeleteProduct(product)}
|
|
231
|
+
disabled={orderState.loading}
|
|
232
|
+
>
|
|
233
|
+
<Trash color='#B1BCCC' />
|
|
234
|
+
</ProductActionsDelete>
|
|
235
|
+
)}
|
|
234
236
|
</ProductActions>
|
|
235
237
|
)}
|
|
236
238
|
</ProductPriceSection>
|
|
@@ -238,13 +240,15 @@ export const ProductItemAccordion = (props) => {
|
|
|
238
240
|
</>
|
|
239
241
|
) : (
|
|
240
242
|
<ProductActions>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
{onDeleteProduct && (
|
|
244
|
+
<ProductActionsDelete
|
|
245
|
+
ref={productActionsDelete}
|
|
246
|
+
onClick={() => onDeleteProduct(product)}
|
|
247
|
+
disabled={orderState.loading}
|
|
248
|
+
>
|
|
249
|
+
<Trash color='#B1BCCC' />
|
|
250
|
+
</ProductActionsDelete>
|
|
251
|
+
)}
|
|
248
252
|
</ProductActions>
|
|
249
253
|
)}
|
|
250
254
|
|
|
@@ -260,13 +264,15 @@ export const ProductItemAccordion = (props) => {
|
|
|
260
264
|
<Pencil color='#B1BCCC' />
|
|
261
265
|
</ProductActionsEdit>
|
|
262
266
|
)}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
{onDeleteProduct && (
|
|
268
|
+
<ProductActionsDelete
|
|
269
|
+
ref={productActionsDelete}
|
|
270
|
+
onClick={() => onDeleteProduct(product)}
|
|
271
|
+
disabled={orderState.loading}
|
|
272
|
+
>
|
|
273
|
+
<Trash color='#B1BCCC' />
|
|
274
|
+
</ProductActionsDelete>
|
|
275
|
+
)}
|
|
270
276
|
</ProductActions>
|
|
271
277
|
<ProductNotAvailable>
|
|
272
278
|
{t('NOT_AVAILABLE', 'Not available')}
|
|
@@ -277,13 +283,15 @@ export const ProductItemAccordion = (props) => {
|
|
|
277
283
|
{!product?.valid_menu && isCartProduct && !isCartPending && (
|
|
278
284
|
<ProductError>
|
|
279
285
|
<ProductActions>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
286
|
+
{onDeleteProduct && (
|
|
287
|
+
<ProductActionsDelete
|
|
288
|
+
ref={productActionsDelete}
|
|
289
|
+
onClick={() => onDeleteProduct(product)}
|
|
290
|
+
disabled={orderState.loading}
|
|
291
|
+
>
|
|
292
|
+
<Trash color='#D81212' />
|
|
293
|
+
</ProductActionsDelete>
|
|
294
|
+
)}
|
|
287
295
|
</ProductActions>
|
|
288
296
|
<ProductNotAvailable>
|
|
289
297
|
{t('NOT_AVAILABLE', 'Not available')}
|
|
@@ -209,7 +209,7 @@ export const RenderProductsLayout = (props) => {
|
|
|
209
209
|
</WrapperSearch>
|
|
210
210
|
</>
|
|
211
211
|
)}
|
|
212
|
-
{!business?.loading && business?.previously_products?.length > 0 && !hidePreviousOrdered &&
|
|
212
|
+
{!business?.loading && business?.previously_products?.length > 0 && !hidePreviousOrdered && !categoryClicked && (
|
|
213
213
|
<OrderItAgain
|
|
214
214
|
onProductClick={onProductClick}
|
|
215
215
|
productList={business?.previously_products}
|
|
@@ -321,7 +321,7 @@ export const RenderProductsLayout = (props) => {
|
|
|
321
321
|
/>
|
|
322
322
|
</WrapContent>
|
|
323
323
|
</BusinessCategoryProductWrapper>
|
|
324
|
-
{showCartOnProductList && (
|
|
324
|
+
{(windowSize.width >= 1000 && windowSize.height >= 600) && showCartOnProductList && (
|
|
325
325
|
<BusinessCartContainer isProfessional={business?.professionals?.length > 0 && !useKioskApp}>
|
|
326
326
|
<BusinessCartContent maxHeight={window.innerHeight - 100}>
|
|
327
327
|
{currentCart?.products?.length > 0 ? (
|
|
@@ -399,7 +399,7 @@ export const RenderProductsLayout = (props) => {
|
|
|
399
399
|
{(categoryClicked || windowSize.width >= 993) && (
|
|
400
400
|
<BusinessCategoryProductWrapper>
|
|
401
401
|
<WrapContent isGroceries id='groceries'>
|
|
402
|
-
{!business?.loading && business?.previously_products?.length > 0 && windowSize.width >= 993 && (
|
|
402
|
+
{!business?.loading && !hidePreviousOrdered && business?.previously_products?.length > 0 && windowSize.width >= 993 && (
|
|
403
403
|
<OrderItAgain
|
|
404
404
|
onProductClick={onProductClick}
|
|
405
405
|
productList={business?.previously_products}
|
|
@@ -209,12 +209,20 @@ const ReviewProductUI = (props) => {
|
|
|
209
209
|
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
210
210
|
<BeforeComponent key={i} {...props} />))}
|
|
211
211
|
<ReviewProductContainer onSubmit={handleSubmit(onSubmit)}>
|
|
212
|
-
{order?.products && order.products.length > 0 && order
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
212
|
+
{order?.products && order.products.length > 0 && order?.products.map(productsOrder => (
|
|
213
|
+
productsOrder?.length ? productsOrder?.map((product, i) => !product?.deleted && (
|
|
214
|
+
<SingleProductReview
|
|
215
|
+
{...props}
|
|
216
|
+
key={i}
|
|
217
|
+
product={product}
|
|
218
|
+
/>
|
|
219
|
+
)) : !productsOrder?.deleted && (
|
|
220
|
+
<SingleProductReview
|
|
221
|
+
{...props}
|
|
222
|
+
key={i}
|
|
223
|
+
product={productsOrder}
|
|
224
|
+
/>
|
|
225
|
+
)
|
|
218
226
|
))}
|
|
219
227
|
<ActionBlock>
|
|
220
228
|
<span onClick={closeReviewProduct}>{t('SKIP', 'Skip')}</span>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { Swiper, SwiperSlide } from 'swiper/react'
|
|
3
|
-
import {
|
|
3
|
+
import { nanoid } from 'nanoid'
|
|
4
|
+
import { useUtils, useLanguage, useSession, useConfig, ProductForm as ProductFormController, useOrder } from 'ordering-components-external'
|
|
4
5
|
import Skeleton from 'react-loading-skeleton'
|
|
5
6
|
import { Alert } from '../Confirm'
|
|
6
7
|
import { Modal } from '../Modal'
|
|
@@ -13,7 +14,7 @@ import { ChevronLeft, ChevronRight, ChevronDown } from 'react-bootstrap-icons'
|
|
|
13
14
|
import BsCaretLeftFill from '@meronex/icons/bs/BsCaretLeftFill'
|
|
14
15
|
import { Button } from '../../styles/Buttons'
|
|
15
16
|
import moment from 'moment'
|
|
16
|
-
import { getTimes } from '../../../../../utils'
|
|
17
|
+
import { getTimes, orderTypeList } from '../../../../../utils'
|
|
17
18
|
import SwiperCore, { Navigation } from 'swiper'
|
|
18
19
|
import 'swiper/swiper-bundle.min.css'
|
|
19
20
|
import 'swiper/swiper.min.css'
|
|
@@ -47,7 +48,8 @@ import {
|
|
|
47
48
|
DayNumber,
|
|
48
49
|
TimeListWrapper,
|
|
49
50
|
TimeItem,
|
|
50
|
-
ClosedBusinessMsg
|
|
51
|
+
ClosedBusinessMsg,
|
|
52
|
+
GuestUserLink
|
|
51
53
|
} from './styles'
|
|
52
54
|
SwiperCore.use([Navigation])
|
|
53
55
|
|
|
@@ -62,13 +64,16 @@ const ServiceFormUI = (props) => {
|
|
|
62
64
|
maxProductQuantity,
|
|
63
65
|
productCart,
|
|
64
66
|
isCartProduct,
|
|
65
|
-
professionalListState
|
|
67
|
+
professionalListState,
|
|
68
|
+
handleCreateGuestUser,
|
|
69
|
+
actionStatus
|
|
66
70
|
} = props
|
|
67
71
|
|
|
68
72
|
const { product, loading, error } = productObject
|
|
69
73
|
const theme = useTheme()
|
|
70
74
|
const [, t] = useLanguage()
|
|
71
75
|
const [{ configs }] = useConfig()
|
|
76
|
+
const [orderState] = useOrder()
|
|
72
77
|
const [{ parsePrice, parseDate }] = useUtils()
|
|
73
78
|
const [{ auth }, { login }] = useSession()
|
|
74
79
|
const [modalPageToShow, setModalPageToShow] = useState('login')
|
|
@@ -81,6 +86,9 @@ const ServiceFormUI = (props) => {
|
|
|
81
86
|
const [isEnabled, setIsEnabled] = useState(false)
|
|
82
87
|
const [datesList, setDatesList] = useState([])
|
|
83
88
|
|
|
89
|
+
const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
|
|
90
|
+
const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
|
|
91
|
+
|
|
84
92
|
const dropDownRef = useRef()
|
|
85
93
|
const is12Hours = configs?.format_time?.value === '12'
|
|
86
94
|
|
|
@@ -89,6 +97,11 @@ const ServiceFormUI = (props) => {
|
|
|
89
97
|
setModalPageToShow('login')
|
|
90
98
|
}
|
|
91
99
|
|
|
100
|
+
const handleUpdateGuest = () => {
|
|
101
|
+
const guestToken = nanoid()
|
|
102
|
+
if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
|
|
103
|
+
}
|
|
104
|
+
|
|
92
105
|
const handleSuccessLogin = (user) => {
|
|
93
106
|
if (user) {
|
|
94
107
|
closeModal()
|
|
@@ -485,6 +498,11 @@ const ServiceFormUI = (props) => {
|
|
|
485
498
|
{isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', theme?.defaultLanguages?.SOLD_OUT || 'Sold out') : t('LOGIN_SIGNUP', theme?.defaultLanguages?.LOGIN_SIGNUP || 'Login / Sign Up')}
|
|
486
499
|
</Button>
|
|
487
500
|
)}
|
|
501
|
+
{!auth && guestCheckoutEnabled && orderTypeEnabled && (
|
|
502
|
+
<GuestUserLink onClick={handleUpdateGuest}>
|
|
503
|
+
{actionStatus?.loading ? <Skeleton height={25} width={70} /> : t('WITH_GUEST_USER', 'With Guest user')}
|
|
504
|
+
</GuestUserLink>
|
|
505
|
+
)}
|
|
488
506
|
</ButtonWrapper>
|
|
489
507
|
</>
|
|
490
508
|
)}
|
|
@@ -469,3 +469,19 @@ export const ClosedBusinessMsg = styled.div`
|
|
|
469
469
|
font-size: 16px;
|
|
470
470
|
width: 100%;
|
|
471
471
|
`
|
|
472
|
+
|
|
473
|
+
export const GuestUserLink = styled.div`
|
|
474
|
+
font-size: 14px;
|
|
475
|
+
color: ${props => props.theme.colors.primary};
|
|
476
|
+
cursor: pointer;
|
|
477
|
+
margin: 15px 0;
|
|
478
|
+
white-space: nowrap;
|
|
479
|
+
&:hover {
|
|
480
|
+
text-decoration: underline;
|
|
481
|
+
}
|
|
482
|
+
margin-left: 10px;
|
|
483
|
+
${props => props.theme.rtl && css`
|
|
484
|
+
margin-left: 0;
|
|
485
|
+
margin-right: 10px;
|
|
486
|
+
`}
|
|
487
|
+
`
|