ordering-ui-external 1.4.5 → 1.5.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.9c913f613f7ccfd32dd9.js → 0.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{1.ordering-ui.9c913f613f7ccfd32dd9.js → 1.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{2.ordering-ui.9c913f613f7ccfd32dd9.js → 2.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{4.ordering-ui.9c913f613f7ccfd32dd9.js → 4.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{5.ordering-ui.9c913f613f7ccfd32dd9.js → 5.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{6.ordering-ui.9c913f613f7ccfd32dd9.js → 6.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js → 7.ordering-ui.5de718771fdf8a9bc402.js} +2 -2
- package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → 7.ordering-ui.5de718771fdf8a9bc402.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.9c913f613f7ccfd32dd9.js → 8.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{9.ordering-ui.9c913f613f7ccfd32dd9.js → 9.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
- package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js → ordering-ui.5de718771fdf8a9bc402.js} +2 -2
- package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → ordering-ui.5de718771fdf8a9bc402.js.LICENSE.txt} +0 -0
- package/_modules/components/LogoutButton/index.js +9 -4
- package/_modules/components/PaymentOptions/index.js +14 -7
- package/_modules/components/SpinnerLoader/styles.js +1 -1
- package/_modules/components/UserProfileForm/index.js +15 -2
- package/_modules/components/UserProfileForm/styles.js +1 -1
- package/_modules/hooks/useRecaptcha.js +62 -0
- package/_modules/themes/five/src/components/AddressForm/styles.js +3 -3
- package/_modules/themes/five/src/components/AddressList/index.js +1 -1
- package/_modules/themes/five/src/components/AddressList/styles.js +1 -1
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +5 -5
- package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +12 -10
- package/_modules/themes/five/src/components/BusinessController/index.js +6 -4
- package/_modules/themes/five/src/components/BusinessController/styles.js +10 -4
- package/_modules/themes/five/src/components/BusinessListingSearch/index.js +21 -6
- package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +6 -17
- package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +3 -4
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +11 -3
- package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +2 -2
- package/_modules/themes/five/src/components/BusinessReviews/index.js +16 -8
- package/_modules/themes/five/src/components/BusinessReviews/styles.js +6 -4
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +58 -34
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +40 -23
- package/_modules/themes/five/src/components/DriverTips/styles.js +1 -1
- package/_modules/themes/five/src/components/Footer/index.js +2 -1
- package/_modules/themes/five/src/components/Footer/styles.js +1 -1
- package/_modules/themes/five/src/components/Header/index.js +18 -11
- package/_modules/themes/five/src/components/Header/styles.js +7 -7
- package/_modules/themes/five/src/components/HomeHero/index.js +0 -15
- package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +116 -31
- package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +36 -37
- package/_modules/themes/five/src/components/LoginForm/index.js +62 -21
- package/_modules/themes/five/src/components/LoginForm/styles.js +1 -1
- package/_modules/themes/five/src/components/Messages/index.js +19 -3
- package/_modules/themes/five/src/components/MultiOrdersDetails/styles.js +6 -6
- package/_modules/themes/five/src/components/MyOrders/index.js +4 -4
- package/_modules/themes/five/src/components/NavigationBar/index.js +145 -34
- package/_modules/themes/five/src/components/NavigationBar/styles.js +1 -1
- package/_modules/themes/five/src/components/OrderDetails/index.js +46 -7
- package/_modules/themes/five/src/components/OrderDetails/styles.js +11 -3
- package/_modules/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
- package/_modules/themes/five/src/components/PaymentOptions/index.js +23 -16
- package/_modules/themes/five/src/components/PaymentOptions/styles.js +1 -1
- package/_modules/themes/five/src/components/ProductForm/index.js +9 -7
- package/_modules/themes/five/src/components/ProductItemAccordion/index.js +10 -4
- package/_modules/themes/five/src/components/ProductItemAccordion/styles.js +11 -3
- package/_modules/themes/five/src/components/ProductShare/ProductCopyURL.js +61 -0
- package/_modules/themes/five/src/components/ProductShare/index.js +107 -0
- package/_modules/themes/five/src/components/ProductShare/styles.js +40 -0
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -2
- package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +18 -16
- package/_modules/themes/five/src/components/ReviewProduct/index.js +5 -3
- package/_modules/themes/five/src/components/ReviewProduct/styles.js +19 -3
- package/_modules/themes/five/src/components/SearchProducts/index.js +13 -2
- package/_modules/themes/five/src/components/SignUpApproval/index.js +6 -6
- package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +57 -17
- package/_modules/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +57 -17
- package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +57 -17
- package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +57 -17
- package/_modules/themes/five/src/components/SignUpForm/index.js +60 -20
- package/_modules/themes/five/src/components/SignUpForm/styles.js +2 -2
- package/_modules/themes/five/src/components/SingleProductCard/index.js +36 -2
- package/_modules/themes/five/src/components/UserProfileForm/index.js +105 -8
- package/_modules/themes/five/src/components/UserProfileForm/styles.js +30 -17
- package/_modules/utils/index.js +26 -11
- package/index-template.js +11 -1
- package/package.json +2 -2
- package/src/components/LogoutButton/index.js +10 -8
- package/src/components/PaymentOptions/index.js +16 -11
- package/src/components/SpinnerLoader/styles.js +1 -0
- package/src/components/UserProfileForm/index.js +12 -2
- package/src/components/UserProfileForm/styles.js +1 -1
- package/src/hooks/useRecaptcha.js +40 -0
- package/src/themes/five/src/components/AddressForm/styles.js +3 -2
- package/src/themes/five/src/components/AddressList/index.js +1 -1
- package/src/themes/five/src/components/AddressList/styles.js +2 -2
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +74 -71
- package/src/themes/five/src/components/BusinessBasicInformation/styles.js +69 -20
- package/src/themes/five/src/components/BusinessController/index.js +3 -1
- package/src/themes/five/src/components/BusinessController/styles.js +8 -0
- package/src/themes/five/src/components/BusinessListingSearch/index.js +16 -1
- package/src/themes/five/src/components/BusinessProductsCategories/index.js +6 -18
- package/src/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
- package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -0
- package/src/themes/five/src/components/BusinessProductsListing/styles.js +2 -3
- package/src/themes/five/src/components/BusinessReviews/index.js +17 -10
- package/src/themes/five/src/components/BusinessReviews/styles.js +7 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +64 -19
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +99 -1
- package/src/themes/five/src/components/DriverTips/styles.js +1 -1
- package/src/themes/five/src/components/Footer/index.js +9 -5
- package/src/themes/five/src/components/Footer/styles.js +2 -6
- package/src/themes/five/src/components/Header/index.js +16 -8
- package/src/themes/five/src/components/Header/styles.js +49 -8
- package/src/themes/five/src/components/HomeHero/index.js +0 -6
- package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +163 -60
- package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +145 -82
- package/src/themes/five/src/components/LoginForm/index.js +30 -4
- package/src/themes/five/src/components/LoginForm/styles.js +8 -0
- package/src/themes/five/src/components/Messages/index.js +8 -2
- package/src/themes/five/src/components/MultiOrdersDetails/styles.js +34 -1
- package/src/themes/five/src/components/MyOrders/index.js +4 -4
- package/src/themes/five/src/components/NavigationBar/index.js +153 -39
- package/src/themes/five/src/components/NavigationBar/styles.js +2 -2
- package/src/themes/five/src/components/OrderDetails/index.js +45 -8
- package/src/themes/five/src/components/OrderDetails/styles.js +50 -0
- package/src/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
- package/src/themes/five/src/components/PaymentOptions/index.js +13 -7
- package/src/themes/five/src/components/PaymentOptions/styles.js +5 -0
- package/src/themes/five/src/components/ProductForm/index.js +9 -7
- package/src/themes/five/src/components/ProductItemAccordion/index.js +67 -53
- package/src/themes/five/src/components/ProductItemAccordion/styles.js +26 -0
- package/src/themes/five/src/components/ProductShare/ProductCopyURL.js +53 -0
- package/src/themes/five/src/components/ProductShare/index.js +104 -0
- package/src/themes/five/src/components/ProductShare/styles.js +165 -0
- package/src/themes/five/src/components/RenderProductsLayout/index.js +2 -8
- package/src/themes/five/src/components/RenderProductsLayout/styles.js +5 -0
- package/src/themes/five/src/components/ReviewProduct/index.js +10 -3
- package/src/themes/five/src/components/ReviewProduct/styles.js +43 -0
- package/src/themes/five/src/components/SearchProducts/index.js +16 -3
- package/src/themes/five/src/components/SignUpApproval/index.js +8 -7
- package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +26 -2
- package/src/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +26 -2
- package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +26 -2
- package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +26 -2
- package/src/themes/five/src/components/SignUpForm/index.js +26 -1
- package/src/themes/five/src/components/SignUpForm/styles.js +9 -2
- package/src/themes/five/src/components/SingleProductCard/index.js +26 -1
- package/src/themes/five/src/components/UserPopover/index.js +1 -1
- package/src/themes/five/src/components/UserProfileForm/index.js +83 -5
- package/src/themes/five/src/components/UserProfileForm/styles.js +49 -0
- package/src/utils/index.js +36 -9
- package/template/app.js +12 -11
- package/template/assets/images/amex.svg +30 -0
- package/template/assets/images/diners.svg +16 -0
- package/template/assets/images/discover.svg +17 -0
- package/template/assets/images/jcb.svg +33 -0
- package/template/assets/images/unionpay.svg +25 -0
- package/template/components/HelmetTags/index.js +1 -1
- package/template/components/ScrollToTop/index.js +7 -5
- package/template/pages/BusinessProductsList/index.js +8 -4
- package/template/pages/MyOrders/index.js +4 -1
- package/template/pages/OrderDetails/index.js +11 -2
- package/template/pages/Profile/index.js +8 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components'
|
|
2
3
|
import { useLocation } from 'react-router-dom'
|
|
3
4
|
import { useLanguage, useEvent, useOrder, useSession } from 'ordering-components-external'
|
|
4
5
|
import BsHouse from '@meronex/icons/bs/BsHouse'
|
|
@@ -10,6 +11,9 @@ import FaRegUser from '@meronex/icons/fa/FaRegUser'
|
|
|
10
11
|
import { CartContent } from '../CartContent'
|
|
11
12
|
import { Modal } from '../Modal'
|
|
12
13
|
import { AddressForm } from '../AddressForm'
|
|
14
|
+
import { LoginForm } from '../LoginForm'
|
|
15
|
+
import { SignUpForm } from '../SignUpForm'
|
|
16
|
+
import { ForgotPasswordForm } from '../ForgotPasswordForm'
|
|
13
17
|
|
|
14
18
|
import {
|
|
15
19
|
NavigationBarContainer,
|
|
@@ -17,63 +21,114 @@ import {
|
|
|
17
21
|
} from './styles'
|
|
18
22
|
|
|
19
23
|
export const NavigationBar = () => {
|
|
24
|
+
const theme = useTheme()
|
|
20
25
|
const [, t] = useLanguage()
|
|
21
26
|
const location = useLocation()
|
|
22
27
|
const [events] = useEvent()
|
|
23
28
|
const [orderState] = useOrder()
|
|
24
|
-
const [{ auth }] = useSession()
|
|
29
|
+
const [{ auth }, { login }] = useSession()
|
|
25
30
|
const [isCart, setIsCart] = useState(false)
|
|
26
31
|
const [isAddress, setIsAddress] = useState(false)
|
|
32
|
+
const [modalPageToShow, setModalPageToShow] = useState(null)
|
|
27
33
|
|
|
28
34
|
const cartsWithProducts = (orderState?.carts && Object.values(orderState?.carts).filter(cart => cart.products && cart.products?.length > 0)) || null
|
|
29
35
|
|
|
30
36
|
const handleGoToPage = (data) => {
|
|
31
|
-
|
|
37
|
+
auth
|
|
38
|
+
? events.emit('go_to_page', data)
|
|
39
|
+
: handleOpenLoginSignUp('login')
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
const handleChangeExplore = () => {
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
auth
|
|
44
|
+
? handleGoToPage({ page: 'search' })
|
|
45
|
+
: setIsAddress(true)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const handleOpenLoginSignUp = (index) => {
|
|
49
|
+
setModalPageToShow(index)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const handleCustomModalClick = (e, { page }) => {
|
|
53
|
+
e.preventDefault()
|
|
54
|
+
setModalPageToShow(page)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const closeAuthModal = () => {
|
|
58
|
+
setModalPageToShow(null)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleSuccessLogin = (user) => {
|
|
62
|
+
if (user) {
|
|
63
|
+
closeAuthModal()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const handleSuccessSignup = (user) => {
|
|
68
|
+
login({
|
|
69
|
+
user,
|
|
70
|
+
token: user?.session?.access_token
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const itemlist = {
|
|
75
|
+
home: {
|
|
76
|
+
key: 'home',
|
|
77
|
+
text: t('HOME', 'Home'),
|
|
78
|
+
active: location.pathname === '/search' || isAddress,
|
|
79
|
+
onClick: handleChangeExplore
|
|
80
|
+
},
|
|
81
|
+
browse: {
|
|
82
|
+
key: 'browse',
|
|
83
|
+
active: location.pathname === '/business_search',
|
|
84
|
+
onClick: () => handleGoToPage({ page: 'business_search' }),
|
|
85
|
+
text: t('EXPLORE', 'Explore')
|
|
86
|
+
},
|
|
87
|
+
cart: {
|
|
88
|
+
key: 'cart',
|
|
89
|
+
active: isCart,
|
|
90
|
+
text: t('MY_CART', 'My cart'),
|
|
91
|
+
onClick: () => setIsCart(true)
|
|
92
|
+
},
|
|
93
|
+
orders: {
|
|
94
|
+
key: 'orders',
|
|
95
|
+
active: location.pathname === '/profile/orders',
|
|
96
|
+
text: t('ORDERS', 'Orders'),
|
|
97
|
+
onClick: () => handleGoToPage({ page: 'orders' })
|
|
98
|
+
},
|
|
99
|
+
profile: {
|
|
100
|
+
key: 'profile',
|
|
101
|
+
active: location.pathname === '/profile',
|
|
102
|
+
text: t('PROFILE', 'Profile'),
|
|
103
|
+
onClick: () => handleGoToPage({ page: 'profile' })
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const getIcon = (icon) => {
|
|
108
|
+
return icon === 'home'
|
|
109
|
+
? <BsHouse />
|
|
110
|
+
: icon === 'browse'
|
|
111
|
+
? <BsSearch />
|
|
112
|
+
: icon === 'orders'
|
|
113
|
+
? <BsCardChecklist />
|
|
114
|
+
: icon === 'cart'
|
|
115
|
+
? <AiOutlineShoppingCart />
|
|
116
|
+
: <FaRegUser />
|
|
37
117
|
}
|
|
38
118
|
|
|
39
119
|
return (
|
|
40
120
|
<>
|
|
41
121
|
<NavigationBarContainer>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
>
|
|
53
|
-
<BsSearch />
|
|
54
|
-
<p>{t('BROWSE', 'Browse')}</p>
|
|
55
|
-
</NavigationLink>
|
|
56
|
-
<NavigationLink
|
|
57
|
-
active={location.pathname === '/profile/orders'}
|
|
58
|
-
onClick={() => handleGoToPage({ page: 'orders' })}
|
|
59
|
-
>
|
|
60
|
-
<BsCardChecklist />
|
|
61
|
-
<p>{t('ORDERS', 'Orders')}</p>
|
|
62
|
-
</NavigationLink>
|
|
63
|
-
<NavigationLink
|
|
64
|
-
active={isCart}
|
|
65
|
-
onClick={() => setIsCart(true)}
|
|
66
|
-
>
|
|
67
|
-
<AiOutlineShoppingCart />
|
|
68
|
-
<p>{t('MY_CART', 'My cart')}</p>
|
|
69
|
-
</NavigationLink>
|
|
70
|
-
<NavigationLink
|
|
71
|
-
active={location.pathname === '/profile'}
|
|
72
|
-
onClick={() => handleGoToPage({ page: 'profile' })}
|
|
73
|
-
>
|
|
74
|
-
<FaRegUser />
|
|
75
|
-
<p>{t('PROFILE', 'Profile')}</p>
|
|
76
|
-
</NavigationLink>
|
|
122
|
+
{Object.values(itemlist).map(item => (
|
|
123
|
+
<NavigationLink
|
|
124
|
+
key={item.key}
|
|
125
|
+
active={item.active}
|
|
126
|
+
onClick={() => item.onClick()}
|
|
127
|
+
>
|
|
128
|
+
{getIcon(item.key)}
|
|
129
|
+
<p>{item.text}</p>
|
|
130
|
+
</NavigationLink>
|
|
131
|
+
))}
|
|
77
132
|
</NavigationBarContainer>
|
|
78
133
|
<Modal
|
|
79
134
|
open={isCart}
|
|
@@ -99,6 +154,65 @@ export const NavigationBar = () => {
|
|
|
99
154
|
onSaveAddress={() => setIsAddress(false)}
|
|
100
155
|
/>
|
|
101
156
|
</Modal>
|
|
157
|
+
<Modal
|
|
158
|
+
open={modalPageToShow && !auth}
|
|
159
|
+
onRemove={() => closeAuthModal()}
|
|
160
|
+
width='50%'
|
|
161
|
+
authModal
|
|
162
|
+
>
|
|
163
|
+
{modalPageToShow === 'login' && (
|
|
164
|
+
<LoginForm
|
|
165
|
+
handleSuccessLogin={handleSuccessLogin}
|
|
166
|
+
elementLinkToSignup={
|
|
167
|
+
<a
|
|
168
|
+
onClick={
|
|
169
|
+
(e) => handleCustomModalClick(e, { page: 'signup' })
|
|
170
|
+
} href='#'
|
|
171
|
+
>{t('CREATE_ACCOUNT', theme?.defaultLanguages?.CREATE_ACCOUNT || 'Create account')}
|
|
172
|
+
</a>
|
|
173
|
+
}
|
|
174
|
+
elementLinkToForgotPassword={
|
|
175
|
+
<a
|
|
176
|
+
onClick={
|
|
177
|
+
(e) => handleCustomModalClick(e, { page: 'forgotpassword' })
|
|
178
|
+
} href='#'
|
|
179
|
+
>{t('RESET_PASSWORD', theme?.defaultLanguages?.RESET_PASSWORD || 'Reset password')}
|
|
180
|
+
</a>
|
|
181
|
+
}
|
|
182
|
+
useLoginByCellphone
|
|
183
|
+
isPopup
|
|
184
|
+
/>
|
|
185
|
+
)}
|
|
186
|
+
{modalPageToShow === 'signup' && (
|
|
187
|
+
<SignUpForm
|
|
188
|
+
elementLinkToLogin={
|
|
189
|
+
<a
|
|
190
|
+
onClick={
|
|
191
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
192
|
+
} href='#'
|
|
193
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
194
|
+
</a>
|
|
195
|
+
}
|
|
196
|
+
useLoginByCellphone
|
|
197
|
+
useChekoutFileds
|
|
198
|
+
handleSuccessSignup={handleSuccessSignup}
|
|
199
|
+
isPopup
|
|
200
|
+
/>
|
|
201
|
+
)}
|
|
202
|
+
{modalPageToShow === 'forgotpassword' && (
|
|
203
|
+
<ForgotPasswordForm
|
|
204
|
+
elementLinkToLogin={
|
|
205
|
+
<a
|
|
206
|
+
onClick={
|
|
207
|
+
(e) => handleCustomModalClick(e, { page: 'login' })
|
|
208
|
+
} href='#'
|
|
209
|
+
>{t('LOGIN', theme?.defaultLanguages?.LOGIN || 'Login')}
|
|
210
|
+
</a>
|
|
211
|
+
}
|
|
212
|
+
isPopup
|
|
213
|
+
/>
|
|
214
|
+
)}
|
|
215
|
+
</Modal>
|
|
102
216
|
</>
|
|
103
217
|
)
|
|
104
218
|
}
|
|
@@ -7,12 +7,12 @@ export const NavigationBarContainer = styled.div`
|
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: space-between;
|
|
9
9
|
padding: 15px 10vw;
|
|
10
|
-
position:
|
|
10
|
+
position: fixed;
|
|
11
11
|
bottom: 0px;
|
|
12
12
|
left: 0px;
|
|
13
13
|
width: 100%;
|
|
14
14
|
box-sizing: border-box;
|
|
15
|
-
z-index:
|
|
15
|
+
z-index: 1005;
|
|
16
16
|
`
|
|
17
17
|
|
|
18
18
|
export const NavigationLink = styled.div`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useMemo } from 'react'
|
|
2
2
|
import Skeleton from 'react-loading-skeleton'
|
|
3
3
|
import {
|
|
4
4
|
useLanguage,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useOrderingTheme
|
|
13
13
|
} from 'ordering-components-external'
|
|
14
14
|
import RiUser2Fill from '@meronex/icons/ri/RiUser2Fill'
|
|
15
|
+
import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
|
|
15
16
|
|
|
16
17
|
import { Button } from '../../styles/Buttons'
|
|
17
18
|
import { NotFoundSource } from '../NotFoundSource'
|
|
@@ -65,7 +66,9 @@ import {
|
|
|
65
66
|
OrderStatusAndLinkContainer,
|
|
66
67
|
LinkWrapper,
|
|
67
68
|
MapWrapper,
|
|
68
|
-
BusinessExternalWrapper
|
|
69
|
+
BusinessExternalWrapper,
|
|
70
|
+
ProfessionalWrapper,
|
|
71
|
+
ProfessionalBlock
|
|
69
72
|
} from './styles'
|
|
70
73
|
import { useTheme } from 'styled-components'
|
|
71
74
|
import { TaxInformation } from '../TaxInformation'
|
|
@@ -285,6 +288,45 @@ const OrderDetailsUI = (props) => {
|
|
|
285
288
|
handleReorder(order.id)
|
|
286
289
|
}
|
|
287
290
|
|
|
291
|
+
const getProductList = () => {
|
|
292
|
+
const professionalList = order?.products.reduce((prev, current) => {
|
|
293
|
+
const found = prev.find(item => item.id === current?.calendar_event?.professional?.id)
|
|
294
|
+
if (found || !current?.calendar_event) {
|
|
295
|
+
return prev
|
|
296
|
+
}
|
|
297
|
+
return [...prev, current?.calendar_event?.professional]
|
|
298
|
+
}, [])
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<>
|
|
302
|
+
{professionalList?.length > 0 && professionalList.map((professional, i) => (
|
|
303
|
+
<ProfessionalBlock key={i}>
|
|
304
|
+
<ProfessionalWrapper>
|
|
305
|
+
{professional?.photo
|
|
306
|
+
? <img src={professional?.photo} alt='' />
|
|
307
|
+
: <FaUserAlt />}
|
|
308
|
+
<p>{professional?.name} {professional?.lastname}</p>
|
|
309
|
+
</ProfessionalWrapper>
|
|
310
|
+
{order?.products.filter(product => product?.calendar_event?.professional?.id === professional?.id).map(product => (
|
|
311
|
+
<ProductItemAccordion
|
|
312
|
+
key={product.id}
|
|
313
|
+
product={product}
|
|
314
|
+
/>
|
|
315
|
+
))}
|
|
316
|
+
</ProfessionalBlock>
|
|
317
|
+
))}
|
|
318
|
+
{order?.products.filter(product => !product?.calendar_event).map(product => (
|
|
319
|
+
<ProductItemAccordion
|
|
320
|
+
key={product.id}
|
|
321
|
+
product={product}
|
|
322
|
+
/>
|
|
323
|
+
))}
|
|
324
|
+
</>
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const sortedProductList = useMemo(() => getProductList(), [order?.products])
|
|
329
|
+
|
|
288
330
|
const ActionsSectionProps = {
|
|
289
331
|
order,
|
|
290
332
|
handleBusinessRedirect,
|
|
@@ -661,12 +703,7 @@ const OrderDetailsUI = (props) => {
|
|
|
661
703
|
<OrderHeaderInfoSection />
|
|
662
704
|
<OrderActionsSection />
|
|
663
705
|
</HeaderTitle>
|
|
664
|
-
{
|
|
665
|
-
<ProductItemAccordion
|
|
666
|
-
key={product.id}
|
|
667
|
-
product={product}
|
|
668
|
-
/>
|
|
669
|
-
))}
|
|
706
|
+
{sortedProductList}
|
|
670
707
|
<OrderBillSection
|
|
671
708
|
order={order}
|
|
672
709
|
setOpenTaxModal={setOpenTaxModal}
|
|
@@ -737,3 +737,53 @@ export const BusinessExternalWrapper = styled.div`
|
|
|
737
737
|
width: 50%;
|
|
738
738
|
}
|
|
739
739
|
`
|
|
740
|
+
|
|
741
|
+
export const ProfessionalWrapper = styled.div`
|
|
742
|
+
display: flex;
|
|
743
|
+
align-items: center;
|
|
744
|
+
margin: 0px 10px 10px 10px;
|
|
745
|
+
|
|
746
|
+
> img {
|
|
747
|
+
width: 55px;
|
|
748
|
+
height: 55px;
|
|
749
|
+
min-width: 55px;
|
|
750
|
+
border-radius: 8px;
|
|
751
|
+
object-fit: cover;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
> svg {
|
|
755
|
+
width: 55px;
|
|
756
|
+
height: 55px;
|
|
757
|
+
min-width: 55px;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
> p {
|
|
761
|
+
font-weight: 600;
|
|
762
|
+
font-size: 17px;
|
|
763
|
+
line-height: 26px;
|
|
764
|
+
margin-left: 14px;
|
|
765
|
+
|
|
766
|
+
${props => props.theme.rtl && css`
|
|
767
|
+
margin-left: 0px;
|
|
768
|
+
margin-right: 14px;
|
|
769
|
+
`}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
@media (min-width: 411px) {
|
|
773
|
+
> img {
|
|
774
|
+
width: 65px;
|
|
775
|
+
height: 65px;
|
|
776
|
+
min-width: 65px;
|
|
777
|
+
}
|
|
778
|
+
> svg {
|
|
779
|
+
width: 65px;
|
|
780
|
+
height: 65px;
|
|
781
|
+
min-width: 65px;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
`
|
|
785
|
+
|
|
786
|
+
export const ProfessionalBlock = styled.div`
|
|
787
|
+
border-bottom: 1px solid ${props => props.theme.colors.disabled};
|
|
788
|
+
margin-bottom: 15px;
|
|
789
|
+
`
|
|
@@ -11,7 +11,7 @@ import { useTheme } from 'styled-components'
|
|
|
11
11
|
import { Modal } from '../Modal'
|
|
12
12
|
import { Confirm } from '../Confirm'
|
|
13
13
|
import { StripeElementsForm } from '../StripeElementsForm'
|
|
14
|
-
|
|
14
|
+
import { getIconCard } from '../../../../../utils'
|
|
15
15
|
import { NotFoundSource } from '../NotFoundSource'
|
|
16
16
|
|
|
17
17
|
import {
|
|
@@ -148,7 +148,7 @@ export const PaymentCard = (props) => {
|
|
|
148
148
|
handleDeleteCard,
|
|
149
149
|
card,
|
|
150
150
|
handleCardClick,
|
|
151
|
-
onSelectCard
|
|
151
|
+
onSelectCard
|
|
152
152
|
} = props
|
|
153
153
|
const [, t] = useLanguage()
|
|
154
154
|
const theme = useTheme()
|
|
@@ -156,18 +156,6 @@ export const PaymentCard = (props) => {
|
|
|
156
156
|
const cardActionsRef = useRef(null)
|
|
157
157
|
const actionWrapperRef = useRef(null)
|
|
158
158
|
|
|
159
|
-
const getIconCard = (brand = '') => {
|
|
160
|
-
const value = brand.toLowerCase()
|
|
161
|
-
switch (value) {
|
|
162
|
-
case 'visa':
|
|
163
|
-
return theme.images?.general?.visa
|
|
164
|
-
case 'mastercard':
|
|
165
|
-
return theme.images?.general?.mastercard
|
|
166
|
-
default:
|
|
167
|
-
return theme.images?.general?.credit
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
159
|
const handleClickOutside = (e) => {
|
|
172
160
|
if (!isShowActions) return
|
|
173
161
|
const outsideCalendar = !cardActionsRef.current?.contains(e.target)
|
|
@@ -10,6 +10,7 @@ import { Cash, CreditCard } from 'react-bootstrap-icons'
|
|
|
10
10
|
import {
|
|
11
11
|
PaymentOptions as PaymentOptionsController,
|
|
12
12
|
useLanguage,
|
|
13
|
+
useOrder,
|
|
13
14
|
useSession
|
|
14
15
|
} from 'ordering-components-external'
|
|
15
16
|
|
|
@@ -94,10 +95,12 @@ const PaymentOptionsUI = (props) => {
|
|
|
94
95
|
onPaymentChange,
|
|
95
96
|
setCreateOrder,
|
|
96
97
|
onPlaceOrderClick,
|
|
97
|
-
handlePlaceOrder
|
|
98
|
+
handlePlaceOrder,
|
|
99
|
+
paymethods
|
|
98
100
|
} = props
|
|
99
101
|
const [, t] = useLanguage()
|
|
100
102
|
const [{ token }] = useSession()
|
|
103
|
+
const [{ loading: loadingOptions }] = useOrder()
|
|
101
104
|
const [alertState, setAlertState] = useState({ open: false, content: [] })
|
|
102
105
|
|
|
103
106
|
const paymethodSelected = props.paySelected || props.paymethodSelected
|
|
@@ -108,8 +111,10 @@ const PaymentOptionsUI = (props) => {
|
|
|
108
111
|
|
|
109
112
|
const includeKioskPaymethods = ['cash', 'card_delivery']
|
|
110
113
|
|
|
114
|
+
const list = paymethods ? paymethods?.map(pay => pay.paymethod) : paymethodsList?.paymethods
|
|
115
|
+
|
|
111
116
|
const popupMethods = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal', 'square', 'google_pay', 'apple_pay']
|
|
112
|
-
const supportedMethods =
|
|
117
|
+
const supportedMethods = list?.filter(p => useKioskApp ? includeKioskPaymethods.includes(p.gateway) : p)
|
|
113
118
|
|
|
114
119
|
const handlePaymentMethodClick = (paymethod) => {
|
|
115
120
|
if (cart?.balance > 0) {
|
|
@@ -131,7 +136,7 @@ const PaymentOptionsUI = (props) => {
|
|
|
131
136
|
}
|
|
132
137
|
|
|
133
138
|
useEffect(() => {
|
|
134
|
-
if (supportedMethods
|
|
139
|
+
if (supportedMethods?.length === 1 && !paymethodSelected && !popupMethods.includes(supportedMethods[0]?.gateway)) {
|
|
135
140
|
handlePaymethodClick && handlePaymethodClick(supportedMethods[0])
|
|
136
141
|
}
|
|
137
142
|
}, [supportedMethods])
|
|
@@ -168,7 +173,8 @@ const PaymentOptionsUI = (props) => {
|
|
|
168
173
|
<BeforeComponent key={i} {...props} />))}
|
|
169
174
|
<PaymentMethodsContainer>
|
|
170
175
|
<PaymentMethodsList className='payments-list'>
|
|
171
|
-
{
|
|
176
|
+
{!(paymethodsList.loading || isLoading || loadingOptions) &&
|
|
177
|
+
supportedMethods.length > 0 && (
|
|
172
178
|
supportedMethods.sort((a, b) => a.id - b.id).map(paymethod => (
|
|
173
179
|
<React.Fragment key={paymethod.id}>
|
|
174
180
|
{
|
|
@@ -191,7 +197,7 @@ const PaymentOptionsUI = (props) => {
|
|
|
191
197
|
))
|
|
192
198
|
)}
|
|
193
199
|
|
|
194
|
-
{(paymethodsList.loading || isLoading) && (
|
|
200
|
+
{(paymethodsList.loading || isLoading || loadingOptions) && (
|
|
195
201
|
[...Array(5).keys()].map(i => (
|
|
196
202
|
<PayCard key={i} isSkeleton>
|
|
197
203
|
<Skeleton key={i} width={100} height={60} style={{ marginLeft: '10px' }} />
|
|
@@ -205,7 +211,7 @@ const PaymentOptionsUI = (props) => {
|
|
|
205
211
|
/>
|
|
206
212
|
)}
|
|
207
213
|
|
|
208
|
-
{!(paymethodsList.loading || isLoading) &&
|
|
214
|
+
{!(paymethodsList.loading || isLoading || loadingOptions) &&
|
|
209
215
|
!paymethodsList.error &&
|
|
210
216
|
(!paymethodsList?.paymethods || supportedMethods.length === 0) &&
|
|
211
217
|
(
|
|
@@ -290,7 +296,7 @@ const PaymentOptionsUI = (props) => {
|
|
|
290
296
|
paymethod={isOpenMethod?.paymethod}
|
|
291
297
|
businessId={props.businessId}
|
|
292
298
|
publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
293
|
-
clientSecret={isOpenMethod?.paymethod?.credentials
|
|
299
|
+
clientSecret={isOpenMethod?.paymethod?.credentials?.publishable}
|
|
294
300
|
payType={paymethodsList?.name}
|
|
295
301
|
onSelectCard={handlePaymethodDataChange}
|
|
296
302
|
onCancel={() => handlePaymethodClick(null)}
|
|
@@ -22,7 +22,7 @@ import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
|
22
22
|
import { ProductIngredient } from '../ProductIngredient'
|
|
23
23
|
import { ProductOption } from '../ProductOption'
|
|
24
24
|
import { ProductOptionSubOption } from '../ProductOptionSubOption'
|
|
25
|
-
import { ProductShare } from '
|
|
25
|
+
import { ProductShare } from '../ProductShare'
|
|
26
26
|
import { LoginForm } from '../LoginForm'
|
|
27
27
|
import { SignUpForm } from '../SignUpForm'
|
|
28
28
|
import { ForgotPasswordForm } from '../ForgotPasswordForm'
|
|
@@ -91,7 +91,8 @@ const ProductOptionsUI = (props) => {
|
|
|
91
91
|
handleSave,
|
|
92
92
|
handleChangeIngredientState,
|
|
93
93
|
handleChangeSuboptionState,
|
|
94
|
-
handleChangeCommentState
|
|
94
|
+
handleChangeCommentState,
|
|
95
|
+
productAddedToCartLength
|
|
95
96
|
} = props
|
|
96
97
|
|
|
97
98
|
const { product, loading, error } = productObject
|
|
@@ -375,6 +376,7 @@ const ProductOptionsUI = (props) => {
|
|
|
375
376
|
slug={businessSlug}
|
|
376
377
|
categoryId={product?.category_id}
|
|
377
378
|
productId={product?.id}
|
|
379
|
+
product={product}
|
|
378
380
|
/>
|
|
379
381
|
) : (
|
|
380
382
|
<div style={{ height: 30 }} />
|
|
@@ -640,15 +642,15 @@ const ProductOptionsUI = (props) => {
|
|
|
640
642
|
<div className='price-amount-block'>
|
|
641
643
|
<div className='price'>
|
|
642
644
|
<h4>{productCart.total && parsePrice(productCart.total)}</h4>
|
|
643
|
-
{product?.minimum_per_order && productCart?.quantity <= product?.minimum_per_order && productCart?.quantity !== 1 && <span>{t('MINIMUM_TO_ORDER', 'Minimum _number_ to order').replace('_number_', product?.minimum_per_order)}</span>}
|
|
644
|
-
{product?.maximum_per_order && productCart?.quantity >= product?.maximum_per_order && <span>{t('MAXIMUM_TO_ORDER', 'Max. _number_ to order'.replace('_number_', product?.maximum_per_order))}</span>}
|
|
645
|
+
{product?.minimum_per_order && (productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order && productCart?.quantity !== 1 && <span>{t('MINIMUM_TO_ORDER', 'Minimum _number_ to order').replace('_number_', product?.minimum_per_order)}</span>}
|
|
646
|
+
{product?.maximum_per_order && (productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && <span>{t('MAXIMUM_TO_ORDER', 'Max. _number_ to order'.replace('_number_', product?.maximum_per_order))}</span>}
|
|
645
647
|
</div>
|
|
646
648
|
{
|
|
647
649
|
productCart && !isSoldOut && maxProductQuantity > 0 && (
|
|
648
650
|
<div className={isHaveWeight ? 'incdec-control show-weight-unit' : 'incdec-control'}>
|
|
649
651
|
<FiMinusCircle
|
|
650
652
|
onClick={decrement}
|
|
651
|
-
className={`${productCart.quantity === 1 || !productCart.quantity || isSoldOut || (productCart?.quantity <= product?.minimum_per_order) ? 'disabled' : ''}`}
|
|
653
|
+
className={`${productCart.quantity === 1 || !productCart.quantity || isSoldOut || ((productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order) ? 'disabled' : ''}`}
|
|
652
654
|
/>
|
|
653
655
|
{
|
|
654
656
|
qtyBy?.pieces && (
|
|
@@ -669,7 +671,7 @@ const ProductOptionsUI = (props) => {
|
|
|
669
671
|
)}
|
|
670
672
|
<FiPlusCircle
|
|
671
673
|
onClick={increment}
|
|
672
|
-
className={`${maxProductQuantity <= 0 || productCart
|
|
674
|
+
className={`${maxProductQuantity <= 0 || (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity || ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) || isSoldOut ? 'disabled' : ''}`}
|
|
673
675
|
/>
|
|
674
676
|
{isHaveWeight && (
|
|
675
677
|
<WeightUnitSwitch>
|
|
@@ -687,7 +689,7 @@ const ProductOptionsUI = (props) => {
|
|
|
687
689
|
className={`add ${(maxProductQuantity === 0 || Object.keys(errors).length > 0) ? 'disabled' : ''}`}
|
|
688
690
|
color='primary'
|
|
689
691
|
onClick={() => handleSaveProduct()}
|
|
690
|
-
disabled={orderState.loading || productCart?.quantity === 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
|
|
692
|
+
disabled={orderState.loading || productCart?.quantity === 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
|
|
691
693
|
>
|
|
692
694
|
{orderState.loading ? (
|
|
693
695
|
<span>{t('LOADING', theme?.defaultLanguages?.LOADING || 'Loading')}</span>
|