ordering-ui-external 8.0.4 → 9.0.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.bb114634995b2a0abd20.js → 0.ordering-ui.e271e480185aa4edfc4a.js} +1 -1
- package/_bundles/{5.ordering-ui.bb114634995b2a0abd20.js → 5.ordering-ui.e271e480185aa4edfc4a.js} +1 -1
- package/_bundles/{7.ordering-ui.bb114634995b2a0abd20.js → 7.ordering-ui.e271e480185aa4edfc4a.js} +2 -2
- package/_bundles/ordering-ui.e271e480185aa4edfc4a.js +2 -0
- package/_modules/components/Header/index.js +113 -9
- package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +2 -1
- package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +2 -1
- package/_modules/themes/five/src/components/Header/index.js +4 -5
- package/_modules/themes/five/src/components/SingleOrderCard/index.js +2 -1
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +4 -2
- package/_modules/themes/five/src/styles/Buttons/index.js +84 -60
- package/package.json +2 -2
- package/src/components/Header/index.js +109 -4
- package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +22 -18
- package/src/themes/five/src/components/BusinessBasicInformation/styles.js +1 -1
- package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -1
- package/src/themes/five/src/components/Header/index.js +5 -4
- package/src/themes/five/src/components/SingleOrderCard/index.js +3 -1
- package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
- package/src/themes/five/src/styles/Buttons/index.js +18 -0
- package/template/app.js +1 -0
- package/_bundles/ordering-ui.bb114634995b2a0abd20.js +0 -2
- /package/_bundles/{1.ordering-ui.bb114634995b2a0abd20.js → 1.ordering-ui.e271e480185aa4edfc4a.js} +0 -0
- /package/_bundles/{2.ordering-ui.bb114634995b2a0abd20.js → 2.ordering-ui.e271e480185aa4edfc4a.js} +0 -0
- /package/_bundles/{4.ordering-ui.bb114634995b2a0abd20.js → 4.ordering-ui.e271e480185aa4edfc4a.js} +0 -0
- /package/_bundles/{6.ordering-ui.bb114634995b2a0abd20.js → 6.ordering-ui.e271e480185aa4edfc4a.js} +0 -0
- /package/_bundles/{7.ordering-ui.bb114634995b2a0abd20.js.LICENSE.txt → 7.ordering-ui.e271e480185aa4edfc4a.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.bb114634995b2a0abd20.js → 8.ordering-ui.e271e480185aa4edfc4a.js} +0 -0
- /package/_bundles/{9.ordering-ui.bb114634995b2a0abd20.js → 9.ordering-ui.e271e480185aa4edfc4a.js} +0 -0
- /package/_bundles/{ordering-ui.bb114634995b2a0abd20.js.LICENSE.txt → ordering-ui.e271e480185aa4edfc4a.js.LICENSE.txt} +0 -0
|
@@ -39,6 +39,9 @@ import { HeaderOption } from '../HeaderOption'
|
|
|
39
39
|
import { SidebarMenu } from '../SidebarMenu'
|
|
40
40
|
import { UserDetails } from '../UserDetails'
|
|
41
41
|
import { Confirm } from '../Confirm'
|
|
42
|
+
import { LoginForm } from '../../themes/five/src/components/LoginForm'
|
|
43
|
+
import { SignUpForm } from '../../themes/five/src/components/SignUpForm'
|
|
44
|
+
import { ForgotPasswordForm } from '../../themes/five/src/components/ForgotPasswordForm'
|
|
42
45
|
|
|
43
46
|
export const Header = (props) => {
|
|
44
47
|
const {
|
|
@@ -48,13 +51,15 @@ export const Header = (props) => {
|
|
|
48
51
|
isShowOrderOptions,
|
|
49
52
|
isHideSignup,
|
|
50
53
|
isCustomerMode,
|
|
51
|
-
isLinkedToAdmin
|
|
54
|
+
isLinkedToAdmin,
|
|
55
|
+
notificationState,
|
|
56
|
+
useModalMode
|
|
52
57
|
} = props
|
|
53
58
|
|
|
54
59
|
const { pathname } = useLocation()
|
|
55
60
|
const [events] = useEvent()
|
|
56
61
|
const [, t] = useLanguage()
|
|
57
|
-
const [{ auth }] = useSession()
|
|
62
|
+
const [{ auth }, { login }] = useSession()
|
|
58
63
|
const [orderState, { refreshOrderOptions }] = useOrder()
|
|
59
64
|
const [openPopover, setOpenPopover] = useState({})
|
|
60
65
|
const theme = useTheme()
|
|
@@ -67,6 +72,8 @@ export const Header = (props) => {
|
|
|
67
72
|
const [modalSelected, setModalSelected] = useState(null)
|
|
68
73
|
const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
|
|
69
74
|
const [isFarAway, setIsFarAway] = useState(false)
|
|
75
|
+
const [authModalOpen, setAuthModalOpen] = useState(false)
|
|
76
|
+
const [modalPageToShow, setModalPageToShow] = useState(null)
|
|
70
77
|
|
|
71
78
|
const cartsWithProducts = (orderState?.carts && Object.values(orderState?.carts).filter(cart => cart.products && cart.products?.length > 0)) || null
|
|
72
79
|
|
|
@@ -101,6 +108,16 @@ export const Header = (props) => {
|
|
|
101
108
|
setModalIsOpen(true)
|
|
102
109
|
}
|
|
103
110
|
|
|
111
|
+
const handleCustomModalClick = (e, { page }) => {
|
|
112
|
+
e.preventDefault()
|
|
113
|
+
setModalPageToShow(page)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const closeAuthModal = () => {
|
|
117
|
+
setAuthModalOpen(false)
|
|
118
|
+
setModalPageToShow(null)
|
|
119
|
+
}
|
|
120
|
+
|
|
104
121
|
const handleTogglePopover = (type) => {
|
|
105
122
|
setOpenPopover({
|
|
106
123
|
...openPopover,
|
|
@@ -129,6 +146,28 @@ export const Header = (props) => {
|
|
|
129
146
|
}
|
|
130
147
|
}
|
|
131
148
|
|
|
149
|
+
const handleSuccessSignup = (user) => {
|
|
150
|
+
login({
|
|
151
|
+
user,
|
|
152
|
+
token: user?.session?.access_token
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const handleSuccessLogin = (user) => {
|
|
157
|
+
if (user) {
|
|
158
|
+
closeAuthModal()
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const handleOpenLoginSignUp = (index) => {
|
|
163
|
+
if (isCustomerMode) {
|
|
164
|
+
events.emit('go_to_page', { page: 'home' })
|
|
165
|
+
} else {
|
|
166
|
+
setModalPageToShow(index)
|
|
167
|
+
setAuthModalOpen(true)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
132
171
|
useEffect(() => {
|
|
133
172
|
events.on('cart_product_added', handleAddProduct)
|
|
134
173
|
return () => events.off('cart_product_added', handleAddProduct)
|
|
@@ -243,9 +282,9 @@ export const Header = (props) => {
|
|
|
243
282
|
{
|
|
244
283
|
!auth && windowSize.width > 870 && !isCustomerMode && (
|
|
245
284
|
<>
|
|
246
|
-
<MenuLink onClick={() => handleGoToPage({ page: 'signin' })} name='signin'>{t('SIGN_IN', theme?.defaultLanguages?.SIGN_IN || 'Sign in')}</MenuLink>
|
|
285
|
+
<MenuLink onClick={() => useModalMode ? handleOpenLoginSignUp('login') : handleGoToPage({ page: 'signin' })} name='signin'>{t('SIGN_IN', theme?.defaultLanguages?.SIGN_IN || 'Sign in')}</MenuLink>
|
|
247
286
|
{!isHideSignup && (
|
|
248
|
-
<MenuLink onClick={() => handleGoToPage({ page: 'signup' })} highlight={1} name='signup'>{t('SIGN_UP', theme?.defaultLanguages?.SIGN_UP || 'Sign up')}</MenuLink>
|
|
287
|
+
<MenuLink onClick={() => useModalMode ? handleOpenLoginSignUp('signup') : handleGoToPage({ page: 'signup' })} highlight={1} name='signup'>{t('SIGN_UP', theme?.defaultLanguages?.SIGN_UP || 'Sign up')}</MenuLink>
|
|
249
288
|
)}
|
|
250
289
|
</>
|
|
251
290
|
)
|
|
@@ -404,6 +443,72 @@ export const Header = (props) => {
|
|
|
404
443
|
</UserEdit>
|
|
405
444
|
</Modal>
|
|
406
445
|
)}
|
|
446
|
+
{authModalOpen && !auth && (
|
|
447
|
+
<Modal
|
|
448
|
+
open={authModalOpen}
|
|
449
|
+
onRemove={() => closeAuthModal()}
|
|
450
|
+
onClose={() => closeAuthModal()}
|
|
451
|
+
width='50%'
|
|
452
|
+
authModal
|
|
453
|
+
closeOnBackdrop
|
|
454
|
+
>
|
|
455
|
+
{modalPageToShow === 'login' && (
|
|
456
|
+
<LoginForm
|
|
457
|
+
notificationState={notificationState}
|
|
458
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
459
|
+
elementLinkToSignup={
|
|
460
|
+
<a
|
|
461
|
+
onClick={
|
|
462
|
+
(e) => handleCustomModalClick(e, { page: 'signup' })
|
|
463
|
+
} href='#'
|
|
464
|
+
>{t('CREATE_ACCOUNT', theme?.defaultLanguages?.CREATE_ACCOUNT || 'Create account')}
|
|
465
|
+
</a>
|
|
466
|
+
}
|
|
467
|
+
elementLinkToForgotPassword={
|
|
468
|
+
<a
|
|
469
|
+
onClick={
|
|
470
|
+
(e) => handleCustomModalClick(e, { page: 'forgotpassword' })
|
|
471
|
+
} href='#'
|
|
472
|
+
>{t('RESET_PASSWORD', theme?.defaultLanguages?.RESET_PASSWORD || 'Reset password')}
|
|
473
|
+
</a>
|
|
474
|
+
}
|
|
475
|
+
useLoginByCellphone
|
|
476
|
+
isPopup
|
|
477
|
+
/>
|
|
478
|
+
)}
|
|
479
|
+
{modalPageToShow === 'signup' && (
|
|
480
|
+
<SignUpForm
|
|
481
|
+
notificationState={notificationState}
|
|
482
|
+
elementLinkToLogin={
|
|
483
|
+
<a
|
|
484
|
+
onClick={
|
|
485
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
486
|
+
} href='#'
|
|
487
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
488
|
+
</a>
|
|
489
|
+
}
|
|
490
|
+
useLoginByCellphone
|
|
491
|
+
useChekoutFileds
|
|
492
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
493
|
+
isPopup
|
|
494
|
+
closeModal={() => closeAuthModal()}
|
|
495
|
+
/>
|
|
496
|
+
)}
|
|
497
|
+
{modalPageToShow === 'forgotpassword' && (
|
|
498
|
+
<ForgotPasswordForm
|
|
499
|
+
elementLinkToLogin={
|
|
500
|
+
<a
|
|
501
|
+
onClick={
|
|
502
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
503
|
+
} href='#'
|
|
504
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
505
|
+
</a>
|
|
506
|
+
}
|
|
507
|
+
isPopup
|
|
508
|
+
/>
|
|
509
|
+
)}
|
|
510
|
+
</Modal>
|
|
511
|
+
)}
|
|
407
512
|
<Confirm
|
|
408
513
|
title={t('CUSTOMER', theme?.defaultLanguages?.CUSTOMER || 'Customer')}
|
|
409
514
|
content={confirm.content}
|
|
@@ -34,6 +34,8 @@ const SingleOrderCardUI = (props) => {
|
|
|
34
34
|
const [, t] = useLanguage()
|
|
35
35
|
const [{ parseDate }] = useUtils()
|
|
36
36
|
|
|
37
|
+
const isGiftCardOrder = !order?.business_id
|
|
38
|
+
|
|
37
39
|
const handleChangeFavorite = (order) => {
|
|
38
40
|
handleFavoriteOrder && handleFavoriteOrder(!order?.favorite)
|
|
39
41
|
}
|
|
@@ -110,24 +112,26 @@ const SingleOrderCardUI = (props) => {
|
|
|
110
112
|
)}
|
|
111
113
|
</BusinessInformation>
|
|
112
114
|
</OrderPastContent>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
115
|
+
{!isGiftCardOrder && (
|
|
116
|
+
<Reorder>
|
|
117
|
+
{!hideReviewOrderButton && (
|
|
118
|
+
<Button
|
|
119
|
+
outline
|
|
120
|
+
disabled={!!order?.review}
|
|
121
|
+
color='primary'
|
|
122
|
+
className='review'
|
|
123
|
+
onClick={() => setOrderSelected(order)}
|
|
124
|
+
>
|
|
125
|
+
{!!order?.review ? t('REVIEWED', 'Reviewed') : t('REVIEW', 'Review')}
|
|
126
|
+
</Button>
|
|
127
|
+
)}
|
|
128
|
+
{!hideReorderButton && typeof order?.id === 'number' && (
|
|
129
|
+
<Button color='primary' className='reorder' outline onClick={() => handleReorder(order.id)}>
|
|
130
|
+
{orderID === order.id && reorderLoading ? t('LOADING', 'Loading...') : t('REORDER', 'Reorder')}
|
|
131
|
+
</Button>
|
|
132
|
+
)}
|
|
133
|
+
</Reorder>
|
|
134
|
+
)}
|
|
131
135
|
</SingleCard>
|
|
132
136
|
)
|
|
133
137
|
}
|
|
@@ -378,7 +378,7 @@ export const TitleWrapper = styled.div`
|
|
|
378
378
|
overflow: hidden;
|
|
379
379
|
white-space: nowrap;
|
|
380
380
|
text-overflow: ellipsis;
|
|
381
|
-
background: ${({ theme }) => theme?.colors?.
|
|
381
|
+
background: ${({ theme }) => theme?.colors?.backgroundPage};
|
|
382
382
|
&.fixed-name {
|
|
383
383
|
z-index: 10001;
|
|
384
384
|
position: fixed;
|
|
@@ -585,7 +585,8 @@ export const BusinessProductsListing = (props) => {
|
|
|
585
585
|
...props,
|
|
586
586
|
UIComponent: BusinessProductsListingUI,
|
|
587
587
|
isInitialRender,
|
|
588
|
-
handleUpdateInitialRender: (val) => setIsInitialRender(val)
|
|
588
|
+
handleUpdateInitialRender: (val) => setIsInitialRender(val),
|
|
589
|
+
isFetchAllProducts: true
|
|
589
590
|
}
|
|
590
591
|
|
|
591
592
|
return (
|
|
@@ -50,6 +50,7 @@ import { ForgotPasswordForm } from '../ForgotPasswordForm'
|
|
|
50
50
|
import { getDistance, getCateringValues } from '../../../../../utils'
|
|
51
51
|
import { BusinessPreorder } from '../BusinessPreorder'
|
|
52
52
|
import { SearchBar } from '../SearchBar'
|
|
53
|
+
import { Button } from '../../styles/Buttons'
|
|
53
54
|
|
|
54
55
|
export const Header = (props) => {
|
|
55
56
|
const {
|
|
@@ -354,14 +355,14 @@ export const Header = (props) => {
|
|
|
354
355
|
{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
355
356
|
</MenuLink>
|
|
356
357
|
{!isHideSignup && (
|
|
357
|
-
<
|
|
358
|
+
<Button
|
|
359
|
+
type='button'
|
|
360
|
+
color='primary'
|
|
358
361
|
name='signup'
|
|
359
|
-
highlight={1}
|
|
360
|
-
style={{ whiteSpace: 'nowrap' }}
|
|
361
362
|
onClick={() => handleOpenLoginSignUp('signup')}
|
|
362
363
|
>
|
|
363
364
|
{t('SIGN_UP', theme?.defaultLanguages?.SIGN_UP || 'Sign up')}
|
|
364
|
-
</
|
|
365
|
+
</Button>
|
|
365
366
|
)}
|
|
366
367
|
</>
|
|
367
368
|
)
|
|
@@ -59,6 +59,8 @@ const SingleOrderCardUI = (props) => {
|
|
|
59
59
|
const [isProductReviewed, setIsProductReviewed] = useState(false)
|
|
60
60
|
const [isDriverReviewed, setIsDriverReviewed] = useState(false)
|
|
61
61
|
|
|
62
|
+
const isGiftCardOrder = !order?.business_id
|
|
63
|
+
|
|
62
64
|
const handleClickCard = (e, order) => {
|
|
63
65
|
if (e.target.closest('.favorite') || e.target.closest('.review') || e.target.closest('.reorder')) return
|
|
64
66
|
|
|
@@ -254,7 +256,7 @@ const SingleOrderCardUI = (props) => {
|
|
|
254
256
|
}
|
|
255
257
|
</Price>
|
|
256
258
|
)}
|
|
257
|
-
{pastOrders && (
|
|
259
|
+
{pastOrders && !isGiftCardOrder && (
|
|
258
260
|
<ButtonWrapper isCustomerMode={isCustomerMode}>
|
|
259
261
|
{!isOrderReviewed && !isFavorite && (!order?.review || (order.driver && !order?.user_review)) && !hideReviewOrderButton && !isCustomerMode && (
|
|
260
262
|
<Button
|
|
@@ -5,7 +5,7 @@ export const CardContainer = styled.div`
|
|
|
5
5
|
${({ isShowAddButt }) => css`
|
|
6
6
|
min-height: ${isShowAddButt ? '162px' : '110px'};
|
|
7
7
|
`}
|
|
8
|
-
background: ${({ soldOut }) => soldOut ? '#6c757d33' :
|
|
8
|
+
background: ${({ soldOut, theme }) => soldOut ? '#6c757d33' : theme?.colors?.backgroundPage};
|
|
9
9
|
border: 1px solid #E9ECEF;
|
|
10
10
|
padding: 10px;
|
|
11
11
|
border-radius: 7.6px;
|
|
@@ -55,6 +55,24 @@ export const Button = styled.button`
|
|
|
55
55
|
${theme?.general?.components?.buttons?.shadow?.components?.spread || '0px'}
|
|
56
56
|
${theme?.general?.components?.buttons?.shadow?.components?.color || '#000'};
|
|
57
57
|
`}
|
|
58
|
+
${({ theme }) => theme?.general?.components?.buttons?.color && css`
|
|
59
|
+
background: ${theme?.general?.components?.buttons?.color} !important;
|
|
60
|
+
&:active {
|
|
61
|
+
background: ${({ theme }) => darken(0.07, theme?.general?.components?.buttons?.color)} !important;
|
|
62
|
+
}
|
|
63
|
+
&:hover {
|
|
64
|
+
background: ${({ theme }) => darken(0.07, theme?.general?.components?.buttons?.color)} !important;
|
|
65
|
+
}
|
|
66
|
+
`}
|
|
67
|
+
${({ theme }) => theme?.general?.components?.buttons?.buttonTextColor && css`
|
|
68
|
+
color: ${theme?.general?.components?.buttons?.buttonTextColor} !important;
|
|
69
|
+
&:active {
|
|
70
|
+
color: ${({ theme }) => darken(0.07, theme?.general?.components?.buttons?.buttonTextColor)} !important;
|
|
71
|
+
}
|
|
72
|
+
&:hover {
|
|
73
|
+
color: ${({ theme }) => darken(0.07, theme?.general?.components?.buttons?.buttonTextColor)} !important;
|
|
74
|
+
}
|
|
75
|
+
`}
|
|
58
76
|
${({ outline }) => outline && css`
|
|
59
77
|
background: #FFF;
|
|
60
78
|
color: #CCC;
|