ordering-ui-external 1.4.5 → 1.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.
Files changed (151) hide show
  1. package/_bundles/{0.ordering-ui.9c913f613f7ccfd32dd9.js → 0.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  2. package/_bundles/{1.ordering-ui.9c913f613f7ccfd32dd9.js → 1.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  3. package/_bundles/{2.ordering-ui.9c913f613f7ccfd32dd9.js → 2.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  4. package/_bundles/{4.ordering-ui.9c913f613f7ccfd32dd9.js → 4.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  5. package/_bundles/{5.ordering-ui.9c913f613f7ccfd32dd9.js → 5.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  6. package/_bundles/{6.ordering-ui.9c913f613f7ccfd32dd9.js → 6.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  7. package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js → 7.ordering-ui.b1e32f04828ea3f944e1.js} +2 -2
  8. package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → 7.ordering-ui.b1e32f04828ea3f944e1.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.9c913f613f7ccfd32dd9.js → 8.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  10. package/_bundles/{9.ordering-ui.9c913f613f7ccfd32dd9.js → 9.ordering-ui.b1e32f04828ea3f944e1.js} +1 -1
  11. package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js → ordering-ui.b1e32f04828ea3f944e1.js} +2 -2
  12. package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → ordering-ui.b1e32f04828ea3f944e1.js.LICENSE.txt} +0 -0
  13. package/_modules/components/LogoutButton/index.js +9 -4
  14. package/_modules/components/PaymentOptions/index.js +14 -7
  15. package/_modules/components/SpinnerLoader/styles.js +1 -1
  16. package/_modules/components/UserProfileForm/index.js +15 -2
  17. package/_modules/components/UserProfileForm/styles.js +1 -1
  18. package/_modules/hooks/useRecaptcha.js +62 -0
  19. package/_modules/themes/five/src/components/AddressForm/styles.js +3 -3
  20. package/_modules/themes/five/src/components/AddressList/index.js +1 -1
  21. package/_modules/themes/five/src/components/AddressList/styles.js +1 -1
  22. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +5 -5
  23. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +12 -10
  24. package/_modules/themes/five/src/components/BusinessController/index.js +6 -4
  25. package/_modules/themes/five/src/components/BusinessController/styles.js +10 -4
  26. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +21 -6
  27. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +6 -17
  28. package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +3 -4
  29. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +11 -3
  30. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +2 -2
  31. package/_modules/themes/five/src/components/BusinessReviews/index.js +16 -8
  32. package/_modules/themes/five/src/components/BusinessReviews/styles.js +6 -4
  33. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +58 -34
  34. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +40 -23
  35. package/_modules/themes/five/src/components/DriverTips/styles.js +1 -1
  36. package/_modules/themes/five/src/components/Footer/index.js +2 -1
  37. package/_modules/themes/five/src/components/Footer/styles.js +1 -1
  38. package/_modules/themes/five/src/components/Header/index.js +18 -11
  39. package/_modules/themes/five/src/components/Header/styles.js +7 -7
  40. package/_modules/themes/five/src/components/HomeHero/index.js +0 -15
  41. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +116 -31
  42. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +36 -37
  43. package/_modules/themes/five/src/components/LoginForm/index.js +62 -21
  44. package/_modules/themes/five/src/components/LoginForm/styles.js +1 -1
  45. package/_modules/themes/five/src/components/Messages/index.js +19 -3
  46. package/_modules/themes/five/src/components/MultiOrdersDetails/styles.js +6 -6
  47. package/_modules/themes/five/src/components/MyOrders/index.js +4 -4
  48. package/_modules/themes/five/src/components/NavigationBar/index.js +145 -34
  49. package/_modules/themes/five/src/components/NavigationBar/styles.js +1 -1
  50. package/_modules/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
  51. package/_modules/themes/five/src/components/PaymentOptions/index.js +23 -16
  52. package/_modules/themes/five/src/components/PaymentOptions/styles.js +1 -1
  53. package/_modules/themes/five/src/components/ProductForm/index.js +9 -7
  54. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +10 -4
  55. package/_modules/themes/five/src/components/ProductItemAccordion/styles.js +11 -3
  56. package/_modules/themes/five/src/components/ProductShare/ProductCopyURL.js +61 -0
  57. package/_modules/themes/five/src/components/ProductShare/index.js +107 -0
  58. package/_modules/themes/five/src/components/ProductShare/styles.js +40 -0
  59. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -2
  60. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +18 -16
  61. package/_modules/themes/five/src/components/ReviewProduct/index.js +5 -3
  62. package/_modules/themes/five/src/components/ReviewProduct/styles.js +19 -3
  63. package/_modules/themes/five/src/components/SearchProducts/index.js +13 -2
  64. package/_modules/themes/five/src/components/SignUpApproval/index.js +6 -6
  65. package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +57 -17
  66. package/_modules/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +57 -17
  67. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +57 -17
  68. package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +57 -17
  69. package/_modules/themes/five/src/components/SignUpForm/index.js +60 -20
  70. package/_modules/themes/five/src/components/SignUpForm/styles.js +2 -2
  71. package/_modules/themes/five/src/components/SingleProductCard/index.js +36 -2
  72. package/_modules/themes/five/src/components/UserProfileForm/index.js +105 -8
  73. package/_modules/themes/five/src/components/UserProfileForm/styles.js +30 -17
  74. package/_modules/utils/index.js +26 -11
  75. package/index-template.js +11 -1
  76. package/package.json +2 -2
  77. package/src/components/LogoutButton/index.js +10 -8
  78. package/src/components/PaymentOptions/index.js +16 -11
  79. package/src/components/SpinnerLoader/styles.js +1 -0
  80. package/src/components/UserProfileForm/index.js +12 -2
  81. package/src/components/UserProfileForm/styles.js +1 -1
  82. package/src/hooks/useRecaptcha.js +40 -0
  83. package/src/themes/five/src/components/AddressForm/styles.js +3 -2
  84. package/src/themes/five/src/components/AddressList/index.js +1 -1
  85. package/src/themes/five/src/components/AddressList/styles.js +2 -2
  86. package/src/themes/five/src/components/BusinessBasicInformation/index.js +74 -71
  87. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +69 -20
  88. package/src/themes/five/src/components/BusinessController/index.js +3 -1
  89. package/src/themes/five/src/components/BusinessController/styles.js +8 -0
  90. package/src/themes/five/src/components/BusinessListingSearch/index.js +16 -1
  91. package/src/themes/five/src/components/BusinessProductsCategories/index.js +6 -18
  92. package/src/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
  93. package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -0
  94. package/src/themes/five/src/components/BusinessProductsListing/styles.js +2 -3
  95. package/src/themes/five/src/components/BusinessReviews/index.js +17 -10
  96. package/src/themes/five/src/components/BusinessReviews/styles.js +7 -0
  97. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +64 -19
  98. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +99 -1
  99. package/src/themes/five/src/components/DriverTips/styles.js +1 -1
  100. package/src/themes/five/src/components/Footer/index.js +9 -5
  101. package/src/themes/five/src/components/Footer/styles.js +2 -6
  102. package/src/themes/five/src/components/Header/index.js +16 -8
  103. package/src/themes/five/src/components/Header/styles.js +49 -8
  104. package/src/themes/five/src/components/HomeHero/index.js +0 -6
  105. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +163 -60
  106. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +145 -82
  107. package/src/themes/five/src/components/LoginForm/index.js +30 -4
  108. package/src/themes/five/src/components/LoginForm/styles.js +8 -0
  109. package/src/themes/five/src/components/Messages/index.js +8 -2
  110. package/src/themes/five/src/components/MultiOrdersDetails/styles.js +34 -1
  111. package/src/themes/five/src/components/MyOrders/index.js +4 -4
  112. package/src/themes/five/src/components/NavigationBar/index.js +153 -39
  113. package/src/themes/five/src/components/NavigationBar/styles.js +2 -2
  114. package/src/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
  115. package/src/themes/five/src/components/PaymentOptions/index.js +13 -7
  116. package/src/themes/five/src/components/PaymentOptions/styles.js +5 -0
  117. package/src/themes/five/src/components/ProductForm/index.js +9 -7
  118. package/src/themes/five/src/components/ProductItemAccordion/index.js +67 -53
  119. package/src/themes/five/src/components/ProductItemAccordion/styles.js +26 -0
  120. package/src/themes/five/src/components/ProductShare/ProductCopyURL.js +53 -0
  121. package/src/themes/five/src/components/ProductShare/index.js +104 -0
  122. package/src/themes/five/src/components/ProductShare/styles.js +165 -0
  123. package/src/themes/five/src/components/RenderProductsLayout/index.js +2 -8
  124. package/src/themes/five/src/components/RenderProductsLayout/styles.js +5 -0
  125. package/src/themes/five/src/components/ReviewProduct/index.js +10 -3
  126. package/src/themes/five/src/components/ReviewProduct/styles.js +43 -0
  127. package/src/themes/five/src/components/SearchProducts/index.js +16 -3
  128. package/src/themes/five/src/components/SignUpApproval/index.js +8 -7
  129. package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +26 -2
  130. package/src/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +26 -2
  131. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +26 -2
  132. package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +26 -2
  133. package/src/themes/five/src/components/SignUpForm/index.js +26 -1
  134. package/src/themes/five/src/components/SignUpForm/styles.js +9 -2
  135. package/src/themes/five/src/components/SingleProductCard/index.js +26 -1
  136. package/src/themes/five/src/components/UserPopover/index.js +1 -1
  137. package/src/themes/five/src/components/UserProfileForm/index.js +83 -5
  138. package/src/themes/five/src/components/UserProfileForm/styles.js +49 -0
  139. package/src/utils/index.js +36 -9
  140. package/template/app.js +12 -11
  141. package/template/assets/images/amex.svg +30 -0
  142. package/template/assets/images/diners.svg +16 -0
  143. package/template/assets/images/discover.svg +17 -0
  144. package/template/assets/images/jcb.svg +33 -0
  145. package/template/assets/images/unionpay.svg +25 -0
  146. package/template/components/HelmetTags/index.js +1 -1
  147. package/template/components/ScrollToTop/index.js +7 -5
  148. package/template/pages/BusinessProductsList/index.js +8 -4
  149. package/template/pages/MyOrders/index.js +4 -1
  150. package/template/pages/OrderDetails/index.js +11 -2
  151. package/template/pages/Profile/index.js +8 -2
@@ -4,7 +4,8 @@ import {
4
4
  Messages as MessagesController,
5
5
  useUtils,
6
6
  useLanguage,
7
- useSession
7
+ useSession,
8
+ useEvent
8
9
  } from 'ordering-components-external'
9
10
  import { useForm } from 'react-hook-form'
10
11
  import IosSend from '@meronex/icons/ios/IosSend'
@@ -90,6 +91,7 @@ const MessagesUI = (props) => {
90
91
  const { handleSubmit, register, errors, setValue } = useForm()
91
92
  const [alertState, setAlertState] = useState({ open: false, content: [] })
92
93
  const [{ user }] = useSession()
94
+ const [events] = useEvent()
93
95
  const [{ parseDate, parseTime }] = useUtils()
94
96
  const buttonRef = useRef(null)
95
97
  const [modalImage, setModalImage] = useState({ open: false, src: '' })
@@ -299,6 +301,10 @@ const MessagesUI = (props) => {
299
301
  })
300
302
  }
301
303
 
304
+ const goToBusiness = (slug) => {
305
+ events.emit('go_to_page', { page: 'business', params: { business_slug: slug} })
306
+ }
307
+
302
308
  const MapMessages = ({ messages }) => {
303
309
  return (
304
310
  <>
@@ -575,7 +581,7 @@ const MessagesUI = (props) => {
575
581
  onClick={() => onMessages({ business: true, driver: false })}
576
582
  isCursor
577
583
  >
578
- <Image>
584
+ <Image onClick={() => goToBusiness(order?.business?.slug)}>
579
585
  <ImageWithFallback
580
586
  src={order.business?.logo || theme.images?.dummies?.businessLogo}
581
587
  fallback={<FaUserAlt />}
@@ -47,17 +47,30 @@ export const CustomerInfoContainer = styled.div`
47
47
  padding: 30px 25px;
48
48
  margin-top: 48px;
49
49
  display: flex;
50
+ flex-wrap: wrap;
51
+ flex-direction: column;
52
+ @media (min-width: 576px) {
53
+ flex-direction: row;
54
+ }
50
55
  `
56
+
51
57
  export const CustomerDetails = styled.div`
52
58
  flex: 1;
53
59
  > div {
54
60
  display: flex;
61
+ flex-direction: column;
55
62
  margin-top: 24px;
56
63
  }
64
+
65
+ @media (min-width: 576px) {
66
+ > div {
67
+ flex-direction: row;
68
+ }
69
+ }
57
70
  `
58
71
  export const PaymentDetails = styled.div`
59
72
  flex: 1;
60
- h3.address {
73
+ h3 {
61
74
  margin-top: 30px;
62
75
  }
63
76
  p {
@@ -65,6 +78,12 @@ export const PaymentDetails = styled.div`
65
78
  line-height: 24px;
66
79
  margin: 10px 0;
67
80
  }
81
+
82
+ @media (min-width: 576px) {
83
+ h3:not(.address) {
84
+ margin-top: 0;
85
+ }
86
+ }
68
87
  `
69
88
  export const PhotoWrapper = styled.div`
70
89
  width: 75px;
@@ -154,6 +173,7 @@ export const SingleOrderHeader = styled.div`
154
173
  display: flex;
155
174
  align-items: center;
156
175
  justify-content: space-between;
176
+ flex-direction: column;
157
177
 
158
178
  > div {
159
179
  > div {
@@ -173,6 +193,10 @@ export const SingleOrderHeader = styled.div`
173
193
  button {
174
194
  height: 43px;
175
195
  }
196
+
197
+ @media (min-width: 576px) {
198
+ flex-direction: row;
199
+ }
176
200
  `
177
201
  export const OrderBusinessDetails = styled.div`
178
202
  display: flex;
@@ -181,8 +205,14 @@ export const OrderBusinessDetails = styled.div`
181
205
  `
182
206
  export const OrderBusinessWrapper = styled.div`
183
207
  display: flex;
208
+ flex-direction: column;
209
+
210
+ @media (min-width: 576px) {
211
+ flex-direction: row;
212
+ }
184
213
  `
185
214
  export const BusinessData = styled.div`
215
+ margin-top: 10px;
186
216
  p {
187
217
  font-size: 14px;
188
218
  line-height: 21px;
@@ -191,6 +221,9 @@ export const BusinessData = styled.div`
191
221
  font-weight: 500;
192
222
  }
193
223
  }
224
+ @media (min-width: 576px) {
225
+ margin-top: 0px;
226
+ }
194
227
  `
195
228
  export const ActionsBlock = styled.div`
196
229
  display: flex;
@@ -67,7 +67,7 @@ export const MyOrders = (props) => {
67
67
  {hideOrders && !allEmpty && (
68
68
  <h2>{t('PREVIOUSLY_ORDERED', 'Previously ordered')}</h2>
69
69
  )}
70
- {!hideOrders && (
70
+ {!hideOrders && !props.hideOptions && (
71
71
  <ProfileOptions value='orders' />
72
72
  )}
73
73
  <Container hideOrders={hideOrders}>
@@ -135,7 +135,7 @@ export const MyOrders = (props) => {
135
135
  setIsEmptyPreorder={setIsEmptyPreorder}
136
136
  selectItem={selectItem}
137
137
  />
138
- <Divider />
138
+ {!isEmptyPreorder && <Divider />}
139
139
  </>
140
140
  )}
141
141
  {(selectItem === 'all' || selectItem === 'active') && (
@@ -147,7 +147,7 @@ export const MyOrders = (props) => {
147
147
  setIsEmptyActive={setIsEmptyActive}
148
148
  selectItem={selectItem}
149
149
  />
150
- <Divider />
150
+ {!isEmptyActive && <Divider />}
151
151
  </>
152
152
  )}
153
153
  {(selectItem === 'all' || selectItem === 'past') && (
@@ -159,7 +159,7 @@ export const MyOrders = (props) => {
159
159
  setIsEmptyPast={setIsEmptyPast}
160
160
  selectItem={selectItem}
161
161
  />
162
- <Divider />
162
+ {!isEmptyPast && <Divider />}
163
163
  </>
164
164
  )}
165
165
  </>
@@ -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
- events.emit('go_to_page', data)
37
+ auth
38
+ ? events.emit('go_to_page', data)
39
+ : handleOpenLoginSignUp('login')
32
40
  }
33
41
 
34
42
  const handleChangeExplore = () => {
35
- if (auth) handleGoToPage({ page: 'search' })
36
- else setIsAddress(true)
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
- <NavigationLink
43
- active={location.pathname === '/search' || isAddress}
44
- onClick={handleChangeExplore}
45
- >
46
- <BsHouse />
47
- <p>{t('HOME', 'Home')}</p>
48
- </NavigationLink>
49
- <NavigationLink
50
- active={location.pathname === '/business_search'}
51
- onClick={() => handleGoToPage({ page: 'business_search' })}
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: sticky;
10
+ position: fixed;
11
11
  bottom: 0px;
12
12
  left: 0px;
13
13
  width: 100%;
14
14
  box-sizing: border-box;
15
- z-index: 100;
15
+ z-index: 1005;
16
16
  `
17
17
 
18
18
  export const NavigationLink = styled.div`
@@ -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 = paymethodsList.paymethods.filter(p => useKioskApp ? includeKioskPaymethods.includes(p.gateway) : p)
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.length === 1 && !paymethodSelected && !popupMethods.includes(supportedMethods[0]?.gateway)) {
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
- {supportedMethods.length > 0 && (
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.publishable}
299
+ clientSecret={isOpenMethod?.paymethod?.credentials?.publishable}
294
300
  payType={paymethodsList?.name}
295
301
  onSelectCard={handlePaymethodDataChange}
296
302
  onCancel={() => handlePaymethodClick(null)}
@@ -109,6 +109,11 @@ export const CardItemContent = styled.div`
109
109
  font-size: 22px;
110
110
  }
111
111
 
112
+ img {
113
+ width: 24px;
114
+ height: 20px;
115
+ }
116
+
112
117
  .brand svg {
113
118
  font-size: 26px;
114
119
  }
@@ -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 '../../../../../components/ProductShare'
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.quantity >= maxProductQuantity || (productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) || isSoldOut ? 'disabled' : ''}`}
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>