ordering-ui-external 10.2.1 → 10.3.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/{7.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 7.ordering-ui.e758aec40c3bf292cadb.js} +1 -1
- package/_bundles/ordering-ui.e758aec40c3bf292cadb.js +2 -0
- package/_modules/themes/five/index.js +7 -0
- package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +17 -3
- package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +23 -11
- package/_modules/themes/six/src/components/Header/index.js +113 -9
- package/_modules/utils/index.js +18 -8
- package/package.json +2 -2
- package/src/themes/five/index.js +2 -0
- package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +18 -3
- package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +32 -6
- package/src/themes/six/src/components/Header/index.js +113 -4
- package/src/utils/index.js +11 -4
- package/template/app.js +8 -8
- package/_bundles/ordering-ui.d1a8d1fbf5b112d5d9a9.js +0 -2
- /package/_bundles/{0.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 0.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{1.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 1.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{2.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 2.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{4.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 4.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{5.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 5.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{6.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 6.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{7.ordering-ui.d1a8d1fbf5b112d5d9a9.js.LICENSE.txt → 7.ordering-ui.e758aec40c3bf292cadb.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 8.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{9.ordering-ui.d1a8d1fbf5b112d5d9a9.js → 9.ordering-ui.e758aec40c3bf292cadb.js} +0 -0
- /package/_bundles/{ordering-ui.d1a8d1fbf5b112d5d9a9.js.LICENSE.txt → ordering-ui.e758aec40c3bf292cadb.js.LICENSE.txt} +0 -0
|
@@ -32,18 +32,25 @@ import { LanguageSelector } from '../LanguageSelector'
|
|
|
32
32
|
import { CartContent } from '../CartContent'
|
|
33
33
|
import { SidebarMenu } from '../SidebarMenu'
|
|
34
34
|
import { HeaderOption } from '../HeaderOption'
|
|
35
|
+
import { LoginForm } from '../../../../../themes/five/src/components/LoginForm'
|
|
36
|
+
import { SignUpForm } from '../../../../../themes/five/src/components/SignUpForm'
|
|
37
|
+
import { ForgotPasswordForm } from '../../../../../themes/five/src/components/ForgotPasswordForm'
|
|
38
|
+
|
|
39
|
+
|
|
35
40
|
export const Header = (props) => {
|
|
36
41
|
const {
|
|
37
42
|
isHome,
|
|
38
43
|
location,
|
|
39
44
|
isShowOrderOptions,
|
|
40
45
|
isHideSignup,
|
|
41
|
-
isCustomerMode
|
|
46
|
+
isCustomerMode,
|
|
47
|
+
notificationState,
|
|
48
|
+
useModalMode
|
|
42
49
|
} = props
|
|
43
50
|
const { pathname } = useLocation()
|
|
44
51
|
const [events] = useEvent()
|
|
45
52
|
const [, t] = useLanguage()
|
|
46
|
-
const [{ auth }] = useSession()
|
|
53
|
+
const [{ auth }, { login }] = useSession()
|
|
47
54
|
const [orderState, { refreshOrderOptions }] = useOrder()
|
|
48
55
|
const [openPopover, setOpenPopover] = useState({})
|
|
49
56
|
const theme = useTheme()
|
|
@@ -54,6 +61,9 @@ export const Header = (props) => {
|
|
|
54
61
|
const [customerModalOpen, setCustomerModalOpen] = useState(false)
|
|
55
62
|
const [modalSelected, setModalSelected] = useState(null)
|
|
56
63
|
const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
|
|
64
|
+
const [authModalOpen, setAuthModalOpen] = useState(false)
|
|
65
|
+
const [modalPageToShow, setModalPageToShow] = useState(null)
|
|
66
|
+
|
|
57
67
|
const cartsWithProducts = (orderState?.carts && Object.values(orderState?.carts).filter(cart => cart.products && cart.products?.length > 0)) || null
|
|
58
68
|
const windowSize = useWindowSize()
|
|
59
69
|
const onlineStatus = useOnlineStatus()
|
|
@@ -99,6 +109,39 @@ export const Header = (props) => {
|
|
|
99
109
|
refreshOrderOptions()
|
|
100
110
|
}
|
|
101
111
|
}
|
|
112
|
+
|
|
113
|
+
const handleCustomModalClick = (e, { page }) => {
|
|
114
|
+
e.preventDefault()
|
|
115
|
+
setModalPageToShow(page)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const closeAuthModal = () => {
|
|
119
|
+
setAuthModalOpen(false)
|
|
120
|
+
setModalPageToShow(null)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const handleSuccessSignup = (user) => {
|
|
124
|
+
login({
|
|
125
|
+
user,
|
|
126
|
+
token: user?.session?.access_token
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const handleSuccessLogin = (user) => {
|
|
131
|
+
if (user) {
|
|
132
|
+
closeAuthModal()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const handleOpenLoginSignUp = (index) => {
|
|
137
|
+
if (isCustomerMode) {
|
|
138
|
+
events.emit('go_to_page', { page: 'home' })
|
|
139
|
+
} else {
|
|
140
|
+
setModalPageToShow(index)
|
|
141
|
+
setAuthModalOpen(true)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
102
145
|
useEffect(() => {
|
|
103
146
|
if (isCustomerMode) {
|
|
104
147
|
setCustomerModalOpen(false)
|
|
@@ -171,9 +214,9 @@ export const Header = (props) => {
|
|
|
171
214
|
{
|
|
172
215
|
!auth && windowSize.width > 768 && (
|
|
173
216
|
<>
|
|
174
|
-
<MenuLink onClick={() => handleGoToPage({ page: 'signin' })} name='signin'>{t(theme?.defaultLanguages?.SIGN_IN || 'Sign in')}</MenuLink>
|
|
217
|
+
<MenuLink onClick={() => useModalMode ? handleOpenLoginSignUp('login') : handleGoToPage({ page: 'signin' })} name='signin'>{t(theme?.defaultLanguages?.SIGN_IN || 'Sign in')}</MenuLink>
|
|
175
218
|
{!isHideSignup && (
|
|
176
|
-
<MenuLink onClick={() => handleGoToPage({ page: 'signup' })} highlight={1} name='signup'>{t(theme?.defaultLanguages?.SIGN_UP || 'Join now')}</MenuLink>
|
|
219
|
+
<MenuLink onClick={() => useModalMode ? handleOpenLoginSignUp('signup') : handleGoToPage({ page: 'signup' })} highlight={1} name='signup'>{t(theme?.defaultLanguages?.SIGN_UP || 'Join now')}</MenuLink>
|
|
177
220
|
)}
|
|
178
221
|
</>
|
|
179
222
|
)
|
|
@@ -288,6 +331,72 @@ export const Header = (props) => {
|
|
|
288
331
|
</UserEdit>
|
|
289
332
|
</Modal>
|
|
290
333
|
)}
|
|
334
|
+
{authModalOpen && !auth && (
|
|
335
|
+
<Modal
|
|
336
|
+
open={authModalOpen}
|
|
337
|
+
onRemove={() => closeAuthModal()}
|
|
338
|
+
onClose={() => closeAuthModal()}
|
|
339
|
+
width='50%'
|
|
340
|
+
authModal
|
|
341
|
+
closeOnBackdrop
|
|
342
|
+
>
|
|
343
|
+
{modalPageToShow === 'login' && (
|
|
344
|
+
<LoginForm
|
|
345
|
+
notificationState={notificationState}
|
|
346
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
347
|
+
elementLinkToSignup={
|
|
348
|
+
<a
|
|
349
|
+
onClick={
|
|
350
|
+
(e) => handleCustomModalClick(e, { page: 'signup' })
|
|
351
|
+
} href='#'
|
|
352
|
+
>{t('CREATE_ACCOUNT', theme?.defaultLanguages?.CREATE_ACCOUNT || 'Create account')}
|
|
353
|
+
</a>
|
|
354
|
+
}
|
|
355
|
+
elementLinkToForgotPassword={
|
|
356
|
+
<a
|
|
357
|
+
onClick={
|
|
358
|
+
(e) => handleCustomModalClick(e, { page: 'forgotpassword' })
|
|
359
|
+
} href='#'
|
|
360
|
+
>{t('RESET_PASSWORD', theme?.defaultLanguages?.RESET_PASSWORD || 'Reset password')}
|
|
361
|
+
</a>
|
|
362
|
+
}
|
|
363
|
+
useLoginByCellphone
|
|
364
|
+
isPopup
|
|
365
|
+
/>
|
|
366
|
+
)}
|
|
367
|
+
{modalPageToShow === 'signup' && (
|
|
368
|
+
<SignUpForm
|
|
369
|
+
notificationState={notificationState}
|
|
370
|
+
elementLinkToLogin={
|
|
371
|
+
<a
|
|
372
|
+
onClick={
|
|
373
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
374
|
+
} href='#'
|
|
375
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
376
|
+
</a>
|
|
377
|
+
}
|
|
378
|
+
useLoginByCellphone
|
|
379
|
+
useChekoutFileds
|
|
380
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
381
|
+
isPopup
|
|
382
|
+
closeModal={() => closeAuthModal()}
|
|
383
|
+
/>
|
|
384
|
+
)}
|
|
385
|
+
{modalPageToShow === 'forgotpassword' && (
|
|
386
|
+
<ForgotPasswordForm
|
|
387
|
+
elementLinkToLogin={
|
|
388
|
+
<a
|
|
389
|
+
onClick={
|
|
390
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
391
|
+
} href='#'
|
|
392
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
393
|
+
</a>
|
|
394
|
+
}
|
|
395
|
+
isPopup
|
|
396
|
+
/>
|
|
397
|
+
)}
|
|
398
|
+
</Modal>
|
|
399
|
+
)}
|
|
291
400
|
<Confirm
|
|
292
401
|
title={t('CUSTOMER', theme?.defaultLanguages?.CUSTOMER || 'Customer')}
|
|
293
402
|
content={confirm.content}
|
package/src/utils/index.js
CHANGED
|
@@ -707,10 +707,17 @@ export const calendarLanguages = {
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
export const getCateringValues = (cateringTypeString, configs) => {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
710
|
+
let splitCateringValue
|
|
711
|
+
if (configs?.preorder_slot_interval) {
|
|
712
|
+
splitCateringValue = (configName) => configs[configName]
|
|
713
|
+
?.value?.split('|')
|
|
714
|
+
?.find(val => val.includes(cateringTypeString))?.split(',')[1]
|
|
715
|
+
} else {
|
|
716
|
+
splitCateringValue = (configName) => Object.values(configs || {})
|
|
717
|
+
?.find(config => config?.key === configName)
|
|
718
|
+
?.value?.split('|')
|
|
719
|
+
?.find(val => val.includes(cateringTypeString))?.split(',')[1]
|
|
720
|
+
}
|
|
714
721
|
const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
|
|
715
722
|
const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
|
|
716
723
|
const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
|
package/template/app.js
CHANGED
|
@@ -171,8 +171,8 @@ export const App = () => {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
const websiteThemeType = themeUpdated?.
|
|
175
|
-
const websiteThemeBusinessSlug = themeUpdated?.
|
|
174
|
+
const websiteThemeType = themeUpdated?.my_products?.components?.website_theme?.components?.type
|
|
175
|
+
const websiteThemeBusinessSlug = themeUpdated?.my_products?.components?.website_theme?.components?.business_slug
|
|
176
176
|
const updatedBusinessSlug = (websiteThemeType === 'single_store' && websiteThemeBusinessSlug) || settings?.businessSlug
|
|
177
177
|
|
|
178
178
|
const businessesSlug = {
|
|
@@ -185,21 +185,21 @@ export const App = () => {
|
|
|
185
185
|
businessSlug: businessesSlug[isKioskApp ? 'kiosk' : 'marketplace']
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const signUpBusinesslayout = themeUpdated?.
|
|
188
|
+
const signUpBusinesslayout = themeUpdated?.business_signup?.components?.layout?.type === 'old'
|
|
189
189
|
? 'old'
|
|
190
190
|
: 'new'
|
|
191
191
|
|
|
192
|
-
const signUpDriverlayout = themeUpdated?.
|
|
192
|
+
const signUpDriverlayout = themeUpdated?.driver_signup?.components?.layout?.type === 'old'
|
|
193
193
|
? 'old'
|
|
194
194
|
: 'new'
|
|
195
195
|
|
|
196
196
|
const HeaderComponent =
|
|
197
197
|
isKioskApp ? HeaderKiosk
|
|
198
|
-
: themeUpdated?.
|
|
198
|
+
: themeUpdated?.header?.components?.layout?.type === 'old'
|
|
199
199
|
? HeaderOld
|
|
200
|
-
: themeUpdated?.
|
|
200
|
+
: themeUpdated?.header?.components?.layout?.type === 'red'
|
|
201
201
|
? HeaderRed
|
|
202
|
-
: themeUpdated?.
|
|
202
|
+
: themeUpdated?.header?.components?.layout?.type === 'starbucks'
|
|
203
203
|
? HeaderStarbucks
|
|
204
204
|
: Header
|
|
205
205
|
|
|
@@ -210,7 +210,7 @@ export const App = () => {
|
|
|
210
210
|
const isEmailVerifyRequired = auth && configs?.verification_email_required?.value === '1' && !user?.email_verified
|
|
211
211
|
const isPhoneVerifyRequired = auth && configs?.verification_phone_required?.value === '1' && !user?.phone_verified
|
|
212
212
|
const isUserVerifyRequired = (isEmailVerifyRequired || isPhoneVerifyRequired) && !isKioskApp
|
|
213
|
-
const isHideFooter = themeUpdated?.
|
|
213
|
+
const isHideFooter = themeUpdated?.footer?.hidden
|
|
214
214
|
|
|
215
215
|
const isHome = location.pathname === '/' || location.pathname === '/home'
|
|
216
216
|
const isFooterPage = location.pathname === '/pages/footer' || isKioskApp || isHideFooter
|