ordering-ui-external 2.6.7 → 2.7.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 (112) hide show
  1. package/_bundles/0.ordering-ui.0a58ae9fc1a4bce64c6e.js +1 -0
  2. package/_bundles/{1.ordering-ui.fd1dc326de89a8eb39f9.js → 1.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
  3. package/_bundles/4.ordering-ui.0a58ae9fc1a4bce64c6e.js +1 -0
  4. package/_bundles/{5.ordering-ui.fd1dc326de89a8eb39f9.js → 5.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
  5. package/_bundles/{6.ordering-ui.fd1dc326de89a8eb39f9.js → 6.ordering-ui.0a58ae9fc1a4bce64c6e.js} +1 -1
  6. package/_bundles/{7.ordering-ui.fd1dc326de89a8eb39f9.js → 7.ordering-ui.0a58ae9fc1a4bce64c6e.js} +2 -2
  7. package/_bundles/ordering-ui.0a58ae9fc1a4bce64c6e.js +2 -0
  8. package/_modules/components/LanguageSelector/index.js +1 -0
  9. package/_modules/components/OrderTypeSelectorHeader/index.js +3 -1
  10. package/_modules/components/SmartAppBanner/index.js +5 -2
  11. package/_modules/contexts/ThemeContext/index.js +1 -1
  12. package/_modules/styles/Select/index.js +14 -2
  13. package/_modules/styles/Selects/index.js +11 -8
  14. package/_modules/themes/five/index.js +21 -0
  15. package/_modules/themes/five/src/components/BusinessBasicInformation/BusinessInfoComponent.js +168 -0
  16. package/_modules/themes/five/src/components/BusinessBasicInformation/SearchComponent.js +39 -0
  17. package/_modules/themes/five/src/components/BusinessBasicInformation/SocialNetWork.js +19 -0
  18. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +35 -156
  19. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +45 -35
  20. package/_modules/themes/five/src/components/BusinessController/index.js +6 -2
  21. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
  22. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +5 -4
  23. package/_modules/themes/five/src/components/CardForm/index.js +16 -3
  24. package/_modules/themes/five/src/components/CardForm/styles.js +13 -9
  25. package/_modules/themes/five/src/components/CardFormCustom/cardUtils.js +102 -0
  26. package/_modules/themes/five/src/components/CardFormCustom/index.js +148 -0
  27. package/_modules/themes/five/src/components/CardFormCustom/styles.js +16 -0
  28. package/_modules/themes/five/src/components/Cart/index.js +1 -1
  29. package/_modules/themes/five/src/components/CartPopover/styles.js +1 -1
  30. package/_modules/themes/five/src/components/Checkout/index.js +41 -27
  31. package/_modules/themes/five/src/components/Header/index.js +10 -4
  32. package/_modules/themes/five/src/components/LanguageSelector/index.js +4 -1
  33. package/_modules/themes/five/src/components/LoginForm/index.js +11 -8
  34. package/_modules/themes/five/src/components/Modal/styles.js +1 -1
  35. package/_modules/themes/five/src/components/OrderContextUI/index.js +13 -1
  36. package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
  37. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +18 -8
  38. package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +7 -3
  39. package/_modules/themes/five/src/components/OrderDetails/index.js +4 -2
  40. package/_modules/themes/five/src/components/PaymentOptionCard/index.js +84 -0
  41. package/_modules/themes/five/src/components/PaymentOptionStripe/index.js +48 -22
  42. package/_modules/themes/five/src/components/PaymentOptionStripe/styles.js +3 -1
  43. package/_modules/themes/five/src/components/PaymentOptions/index.js +46 -24
  44. package/_modules/themes/five/src/components/ProductForm/styles.js +1 -1
  45. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +2 -2
  46. package/_modules/themes/five/src/components/SearchProducts/styles.js +1 -1
  47. package/_modules/themes/five/src/components/UserDetails/index.js +1 -1
  48. package/_modules/themes/five/src/components/UserPopover/styles.js +1 -1
  49. package/_modules/themes/five/src/styles/Select/index.js +4 -2
  50. package/_modules/themes/five/src/styles/Selects/index.js +7 -4
  51. package/_modules/themes/pwa/src/components/MomentPopover/styles.js +1 -1
  52. package/index.html +1 -1
  53. package/package.json +4 -2
  54. package/src/components/LanguageSelector/index.js +1 -0
  55. package/src/components/OrderTypeSelectorHeader/index.js +3 -1
  56. package/src/components/SmartAppBanner/index.js +4 -2
  57. package/src/contexts/ThemeContext/index.js +1 -1
  58. package/src/styles/Select/index.js +11 -2
  59. package/src/styles/Selects/index.js +1 -1
  60. package/src/themes/five/index.js +6 -0
  61. package/src/themes/five/src/components/BusinessBasicInformation/BusinessInfoComponent.js +230 -0
  62. package/src/themes/five/src/components/BusinessBasicInformation/SearchComponent.js +40 -0
  63. package/src/themes/five/src/components/BusinessBasicInformation/SocialNetWork.js +10 -0
  64. package/src/themes/five/src/components/BusinessBasicInformation/index.js +39 -247
  65. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +14 -4
  66. package/src/themes/five/src/components/BusinessController/index.js +2 -2
  67. package/src/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
  68. package/src/themes/five/src/components/BusinessProductsListing/index.js +5 -4
  69. package/src/themes/five/src/components/CardForm/index.js +25 -4
  70. package/src/themes/five/src/components/CardForm/styles.js +35 -0
  71. package/src/themes/five/src/components/CardFormCustom/cardUtils.js +111 -0
  72. package/src/themes/five/src/components/CardFormCustom/index.js +161 -0
  73. package/src/themes/five/src/components/CardFormCustom/styles.js +20 -0
  74. package/src/themes/five/src/components/Cart/index.js +1 -1
  75. package/src/themes/five/src/components/CartPopover/styles.js +1 -1
  76. package/src/themes/five/src/components/Checkout/index.js +42 -30
  77. package/src/themes/five/src/components/Header/index.js +9 -4
  78. package/src/themes/five/src/components/LanguageSelector/index.js +2 -1
  79. package/src/themes/five/src/components/LoginForm/index.js +6 -4
  80. package/src/themes/five/src/components/Modal/styles.js +1 -0
  81. package/src/themes/five/src/components/OrderContextUI/index.js +10 -3
  82. package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
  83. package/src/themes/five/src/components/OrderDetails/OrderEta.js +21 -9
  84. package/src/themes/five/src/components/OrderDetails/OrderHistory.js +4 -3
  85. package/src/themes/five/src/components/OrderDetails/index.js +1 -1
  86. package/src/themes/five/src/components/PaymentOptionCard/index.js +70 -0
  87. package/src/themes/five/src/components/PaymentOptionStripe/index.js +46 -20
  88. package/src/themes/five/src/components/PaymentOptionStripe/styles.js +6 -1
  89. package/src/themes/five/src/components/PaymentOptions/index.js +28 -3
  90. package/src/themes/five/src/components/ProductForm/index.js +0 -1
  91. package/src/themes/five/src/components/ProductForm/styles.js +1 -1
  92. package/src/themes/five/src/components/RenderProductsLayout/index.js +2 -2
  93. package/src/themes/five/src/components/SearchProducts/styles.js +1 -1
  94. package/src/themes/five/src/components/UserDetails/index.js +1 -1
  95. package/src/themes/five/src/components/UserPopover/styles.js +1 -1
  96. package/src/themes/five/src/styles/Select/index.js +3 -2
  97. package/src/themes/five/src/styles/Selects/index.js +1 -1
  98. package/src/themes/pwa/src/components/MomentPopover/styles.js +4 -1
  99. package/template/app.js +13 -7
  100. package/template/pages/BusinessProductsList/index.js +4 -3
  101. package/template/pages/BusinessesList/index.js +2 -1
  102. package/template/pages/Checkout/index.js +1 -0
  103. package/template/pages/MyOrders/index.js +1 -0
  104. package/template/theme.json +3 -1
  105. package/_bundles/0.ordering-ui.fd1dc326de89a8eb39f9.js +0 -1
  106. package/_bundles/4.ordering-ui.fd1dc326de89a8eb39f9.js +0 -1
  107. package/_bundles/ordering-ui.fd1dc326de89a8eb39f9.js +0 -2
  108. /package/_bundles/{2.ordering-ui.fd1dc326de89a8eb39f9.js → 2.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
  109. /package/_bundles/{7.ordering-ui.fd1dc326de89a8eb39f9.js.LICENSE.txt → 7.ordering-ui.0a58ae9fc1a4bce64c6e.js.LICENSE.txt} +0 -0
  110. /package/_bundles/{8.ordering-ui.fd1dc326de89a8eb39f9.js → 8.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
  111. /package/_bundles/{9.ordering-ui.fd1dc326de89a8eb39f9.js → 9.ordering-ui.0a58ae9fc1a4bce64c6e.js} +0 -0
  112. /package/_bundles/{ordering-ui.fd1dc326de89a8eb39f9.js.LICENSE.txt → ordering-ui.0a58ae9fc1a4bce64c6e.js.LICENSE.txt} +0 -0
@@ -0,0 +1,230 @@
1
+ import React from 'react'
2
+ import { BusinessDetail, BusinessInfo, BusinessInfoContainer, BusinessInfoContent, BusinessInfoItem, IconWrapper, RibbonBox, SocialList, TitleWrapper } from './styles'
3
+ import Skeleton from 'react-loading-skeleton'
4
+ import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../../../../utils'
5
+ import { useWindowSize } from '../../../../../hooks/useWindowSize'
6
+ import { useTheme } from 'styled-components'
7
+ import { SocialNetWork } from './SocialNetWork'
8
+ import { StarFill, Facebook, Tiktok, Pinterest, Whatsapp, Instagram, Snapchat } from 'react-bootstrap-icons'
9
+ import { useConfig, useLanguage, useOrder, useUtils } from 'ordering-components-external'
10
+ import { SearchComponent } from './SearchComponent'
11
+
12
+ export const BusinessInfoComponent = (props) => {
13
+ const {
14
+ isChew,
15
+ loading,
16
+ business,
17
+ isInfoShrunken,
18
+ isCustomerMode,
19
+ setIsPreOrder,
20
+ setIsBusinessReviews,
21
+ categoryState,
22
+ searchValue,
23
+ errorQuantityProducts,
24
+ setOpenSearchProducts,
25
+ handleChangeSortBy,
26
+ sortByValue,
27
+ sortByOptions,
28
+ isCustomLayout
29
+ } = props
30
+ const theme = useTheme()
31
+ const [orderState] = useOrder()
32
+ const [{ parsePrice, parseDistance }] = useUtils()
33
+ const [{ configs }] = useConfig()
34
+ const [, t] = useLanguage()
35
+ const windowSize = useWindowSize()
36
+ const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
37
+ const hideTime = theme?.business_view?.components?.header?.components?.business?.components?.time?.hidden
38
+ const hideReviews = theme?.business_view?.components?.header?.components?.business?.components?.reviews?.hidden
39
+ const hideReviewsPopup = theme?.business_view?.components?.header?.components?.reviews?.hidden
40
+ const hideDistance = theme?.business_view?.components?.header?.components?.business?.components?.distance?.hidden
41
+ const hideCity = theme?.business_view?.components?.header?.components?.business?.components?.city?.hidden
42
+ const layoutsWithOldSearch = ['starbucks', 'old', 'floating']
43
+ const hideSearch = layoutsWithOldSearch.includes(theme?.business_view?.components?.product_search?.components?.layout?.type)
44
+ const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
45
+
46
+ const searchComponentProps = {
47
+ setOpenSearchProducts,
48
+ handleChangeSortBy,
49
+ sortByValue,
50
+ sortByOptions
51
+ }
52
+
53
+ return (
54
+ <BusinessInfoContainer isChew={isChew} isFlexEnd={windowSize.width >= 768}>
55
+ <BusinessInfoContent>
56
+ <BusinessInfo className='info'>
57
+ <BusinessInfoItem isInfoShrunken={isInfoShrunken}>
58
+ {!loading ? (
59
+ <TitleWrapper isCustomLayout={isCustomLayout}>
60
+ <h2 className='bold' id='business_name'>{business?.name}</h2>
61
+ {business?.ribbon?.enabled && (
62
+ <RibbonBox
63
+ bgColor={business?.ribbon?.color}
64
+ colorText={lightenDarkenColor(business?.ribbon?.color)}
65
+ borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
66
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
67
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
68
+ >
69
+ {business?.ribbon?.text}
70
+ </RibbonBox>
71
+ )}
72
+ </TitleWrapper>
73
+ ) : (
74
+ <Skeleton width={isCustomerMode ? 100 : 150} height={isCustomerMode ? 35 : 'auto'} />
75
+ )}
76
+ {typeof hideCity !== 'undefined' && !hideCity && business?.city?.name && (
77
+ <>
78
+ {!loading ? (
79
+ <p className='type'>{business?.city?.name}</p>
80
+ ) : (
81
+ <Skeleton width={isCustomerMode ? 100 : 150} />
82
+ )}
83
+ </>
84
+ )}
85
+ {!loading ? (
86
+ <SocialList>
87
+ {business?.facebook_profile && (
88
+ <SocialNetWork
89
+ url={business?.facebook_profile}
90
+ icon={<Facebook />}
91
+ />
92
+ )}
93
+ {business?.instagram_profile && (
94
+ <SocialNetWork
95
+ url={business?.instagram_profile}
96
+ icon={<Instagram />}
97
+ />
98
+ )}
99
+ {business?.tiktok_profile && (
100
+ <SocialNetWork
101
+ url={business?.tiktok_profile}
102
+ icon={<Tiktok />}
103
+ />
104
+ )}
105
+ {business?.pinterest_profile && (
106
+ <SocialNetWork
107
+ url={business?.pinterest_profile}
108
+ icon={<Pinterest />}
109
+ />
110
+ )}
111
+ {business?.whatsapp_number && (
112
+ <SocialNetWork
113
+ url={business?.whatsapp_number}
114
+ icon={<Whatsapp />}
115
+ />
116
+ )}
117
+ {business?.snapchat_profile && (
118
+ <SocialNetWork
119
+ url={business?.snapchat_profile}
120
+ icon={<Snapchat />}
121
+ />
122
+ )}
123
+ </SocialList>
124
+ ) : (
125
+ <SocialList>
126
+ {[...Array(5).keys()].map(i => (
127
+ <IconWrapper isSkeleton key={i}>
128
+ <Skeleton width={27} height={27} />
129
+ </IconWrapper>
130
+ ))}
131
+ </SocialList>
132
+ )}
133
+ <BusinessDetail isSkeleton={loading}>
134
+ {orderState?.options.type === 1 && !hideDeliveryFee && (
135
+ <>
136
+ {!loading ? (
137
+ <>
138
+ <h5>
139
+ <span>{t('DELIVERY_FEE', 'Delivery fee')}</span>
140
+ {business && parsePrice(business?.delivery_price || 0)}
141
+ </h5>
142
+ <span className='dot'>•</span>
143
+ </>
144
+ ) : (
145
+ <Skeleton width={isCustomerMode ? 70 : 50} />
146
+ )}
147
+ </>
148
+ )}
149
+ {!hideTime && (
150
+ <>
151
+ {!loading ? (
152
+ <>
153
+ {orderState?.options?.type === 1 ? (
154
+ <>
155
+ <h5>
156
+ {convertHoursToMinutes(business?.delivery_time)}
157
+ </h5>
158
+ <span className='dot'>•</span>
159
+ </>
160
+ ) : (
161
+ <>
162
+ <h5>
163
+ {convertHoursToMinutes(business?.pickup_time)}
164
+ </h5>
165
+ <span className='dot'>•</span>
166
+ </>
167
+ )}
168
+ </>
169
+ ) : (
170
+ <Skeleton width={isCustomerMode ? 70 : 50} />
171
+ )}
172
+ </>
173
+ )}
174
+ {!hideDistance && (
175
+ <>
176
+ {!loading ? (
177
+ <>
178
+ <h5>
179
+ {parseDistance(business?.distance || 0)}
180
+ </h5>
181
+ <span className='dot'>•</span>
182
+ </>
183
+ ) : (
184
+ <Skeleton width={isCustomerMode ? 70 : 50} />
185
+ )}
186
+ </>
187
+ )}
188
+ {!hideReviews && (
189
+ <>
190
+ {!loading ? (
191
+ <div className='review'>
192
+ <StarFill className='start' />
193
+ <p>{business?.reviews?.total}</p>
194
+ </div>
195
+ ) : (
196
+ <Skeleton width={isCustomerMode ? 100 : 50} />
197
+ )}
198
+ </>
199
+ )}
200
+ </BusinessDetail>
201
+ {
202
+ !loading ? (
203
+ <div className='preorder-Reviews'>
204
+ {isPreOrderSetting && (
205
+ <>
206
+ <span onClick={() => setIsPreOrder(true)}>{t('PREORDER', 'Preorder')}</span>
207
+ <span className='dot'>•</span>
208
+ </>
209
+ )}
210
+ {business.reviews?.reviews && !hideReviewsPopup && <span onClick={() => setIsBusinessReviews(true)}>{t('REVIEWS', 'Reviews')}</span>}
211
+ </div>
212
+ ) : (
213
+ <Skeleton width={isCustomerMode ? 100 : 150} />
214
+ )
215
+ }
216
+ </BusinessInfoItem>
217
+ </BusinessInfo>
218
+ </BusinessInfoContent>
219
+ {!hideSearch &&
220
+ (categoryState?.products?.length !== 0 || searchValue) &&
221
+ !errorQuantityProducts &&
222
+ !isInfoShrunken &&
223
+ !business?.professionals?.length &&
224
+ // (categoryClicked || windowSize.width >= 993) &&
225
+ (
226
+ <SearchComponent {...searchComponentProps} />
227
+ )}
228
+ </BusinessInfoContainer>
229
+ )
230
+ }
@@ -0,0 +1,40 @@
1
+ import React from 'react'
2
+ import { SearchIconWrapper, SearchWrapper, WrapperSearch } from './styles'
3
+ import { Select } from '../../styles/Select'
4
+ import { useTheme } from 'styled-components'
5
+ import CgSearch from '@meronex/icons/cg/CgSearch'
6
+
7
+ export const SearchComponent = (props) => {
8
+ const {
9
+ setOpenSearchProducts,
10
+ handleChangeSortBy,
11
+ sortByValue,
12
+ sortByOptions,
13
+ isResponsive
14
+ } = props
15
+
16
+ const theme = useTheme()
17
+
18
+ const hideSort = theme?.business_view?.components?.header?.components?.business?.components?.sort?.hidden
19
+
20
+ return (
21
+ <WrapperSearch id='search-component' isResponsive={isResponsive}>
22
+ <SearchWrapper>
23
+ <SearchIconWrapper
24
+ onClick={() => setOpenSearchProducts(true)}
25
+ >
26
+ <CgSearch />
27
+ </SearchIconWrapper>
28
+ {!hideSort && (
29
+ <Select
30
+ notAsync
31
+ notReload
32
+ options={sortByOptions}
33
+ defaultValue={sortByValue}
34
+ onChange={(val) => handleChangeSortBy && handleChangeSortBy(val)}
35
+ />
36
+ )}
37
+ </SearchWrapper>
38
+ </WrapperSearch>
39
+ )
40
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react'
2
+ import { IconWrapper } from './styles'
3
+
4
+ export const SocialNetWork = ({ url, icon }) => {
5
+ return (
6
+ <IconWrapper href={url} target='_blank' rel='noopener noreferrer'>
7
+ {icon}
8
+ </IconWrapper>
9
+ )
10
+ }
@@ -1,6 +1,4 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import Skeleton from 'react-loading-skeleton'
3
- import { StarFill, Facebook, Tiktok, Pinterest, Whatsapp, Instagram, Snapchat } from 'react-bootstrap-icons'
4
2
  import { useTheme } from 'styled-components'
5
3
 
6
4
  import { Modal } from '../Modal'
@@ -8,12 +6,9 @@ import { BusinessInformation } from '../BusinessInformation'
8
6
  import { BusinessReviews } from '../BusinessReviews'
9
7
  import BsInfoCircle from '@meronex/icons/bs/BsInfoCircle'
10
8
 
11
- import { useUtils, useOrder, useLanguage, useConfig } from 'ordering-components-external'
9
+ import { useUtils, useLanguage } from 'ordering-components-external'
12
10
 
13
- import { convertHoursToMinutes, shape, lightenDarkenColor } from '../../../../../utils'
14
- import { Select } from '../../styles/Select'
15
11
  import { MomentContent } from '../MomentContent'
16
- import CgSearch from '@meronex/icons/cg/CgSearch'
17
12
  import { SearchProducts } from '../SearchProducts'
18
13
  import { SearchProducts as SearchProductsStarbucks } from '../../../../six/src/components/BusinessProductsListing/SearchProducts'
19
14
  import {
@@ -21,22 +16,10 @@ import {
21
16
  BusinessContent,
22
17
  WrapperBusinessLogo,
23
18
  BusinessLogo,
24
- BusinessInfo,
25
- BusinessInfoItem,
26
- BusinessInfoContainer,
27
- BusinessInfoContent,
28
- WrapperSearch,
29
- BusinessDetail,
30
19
  BusinessMoreDetail,
31
- TitleWrapper,
32
- RibbonBox,
33
- SearchIconWrapper,
34
20
  SearchComponentContainer,
35
- SocialList,
36
- IconWrapper,
37
21
  BusinessInfoWrapper,
38
- WrapperFloatingSearch,
39
- SearchWrapper
22
+ WrapperFloatingSearch
40
23
  } from './styles'
41
24
  import { BusinessPreorder } from '../BusinessPreorder'
42
25
 
@@ -44,6 +27,8 @@ import dayjs from 'dayjs'
44
27
  import timezone from 'dayjs/plugin/timezone'
45
28
  import isBetween from 'dayjs/plugin/isBetween'
46
29
  import { useWindowSize } from '../../../../../hooks/useWindowSize'
30
+ import { BusinessInfoComponent } from './BusinessInfoComponent'
31
+ import { SearchComponent } from './SearchComponent'
47
32
 
48
33
  dayjs.extend(timezone)
49
34
  dayjs.extend(isBetween)
@@ -63,36 +48,44 @@ export const BusinessBasicInformation = (props) => {
63
48
  handleChangeSortBy,
64
49
  categoryState,
65
50
  errorQuantityProducts,
66
- isCustomerMode
51
+ isCustomerMode,
52
+ isCustomLayout
67
53
  } = props
68
54
  const { business, loading } = businessState
69
55
 
70
56
  const theme = useTheme()
71
- const [orderState] = useOrder()
72
57
  const [, t] = useLanguage()
73
- const [{ parsePrice, parseDistance, optimizeImage }] = useUtils()
58
+ const [{ optimizeImage }] = useUtils()
74
59
  const windowSize = useWindowSize()
75
60
  const [isBusinessReviews, setIsBusinessReviews] = useState(false)
76
61
  const [isPreOrder, setIsPreOrder] = useState(false)
77
62
  const [openSearchProducts, setOpenSearchProducts] = useState(false)
78
- const [{ configs }] = useConfig()
79
- const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
80
63
 
81
64
  const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
82
- const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
83
- const hideTime = theme?.business_view?.components?.header?.components?.business?.components?.time?.hidden
84
- const hideReviews = theme?.business_view?.components?.header?.components?.business?.components?.reviews?.hidden
85
- const hideReviewsPopup = theme?.business_view?.components?.header?.components?.reviews?.hidden
86
- const hideDistance = theme?.business_view?.components?.header?.components?.business?.components?.distance?.hidden
87
- const hideSort = theme?.business_view?.components?.header?.components?.business?.components?.sort?.hidden
88
65
  const hideInfoIcon = theme?.business_view?.components?.header?.components?.business?.components?.business_info?.hidden
89
66
 
90
67
  const isInfoShrunken = theme?.business_view?.components?.header?.components?.business?.components?.layout?.position === 'shrunken'
91
68
  const searchLayout = theme?.business_view?.components?.product_search?.components?.layout?.type
92
- const hideCity = theme?.business_view?.components?.header?.components?.business?.components?.city?.hidden
93
69
  const isChew = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
94
- const layoutsWithOldSearch = ['starbucks', 'old', 'floating']
95
- const hideSearch = layoutsWithOldSearch.includes(theme?.business_view?.components?.product_search?.components?.layout?.type)
70
+
71
+ const businessInfoComponentProps = {
72
+ isChew,
73
+ loading,
74
+ business,
75
+ isInfoShrunken,
76
+ isCustomerMode,
77
+ setIsPreOrder,
78
+ setIsBusinessReviews,
79
+ categoryState,
80
+ searchValue,
81
+ errorQuantityProducts,
82
+ setOpenSearchProducts,
83
+ handleChangeSortBy,
84
+ sortByValue,
85
+ sortByOptions,
86
+ isCustomLayout
87
+ }
88
+
96
89
  const getBusinessType = () => {
97
90
  if (Object.keys(business).length <= 0) return t('GENERAL', 'General')
98
91
  const _types = []
@@ -166,217 +159,6 @@ export const BusinessBasicInformation = (props) => {
166
159
  })
167
160
  }, [sortByValue])
168
161
 
169
- const SearchComponent = () => {
170
- return (
171
- <WrapperSearch id='search-component'>
172
- <SearchWrapper>
173
- <SearchIconWrapper
174
- onClick={() => setOpenSearchProducts(true)}
175
- >
176
- <CgSearch />
177
- </SearchIconWrapper>
178
- {!hideSort && (
179
- <Select
180
- notAsync
181
- notReload
182
- options={sortByOptions}
183
- defaultValue={sortByValue}
184
- onChange={(val) => handleChangeSortBy && handleChangeSortBy(val)}
185
- />
186
- )}
187
- </SearchWrapper>
188
- </WrapperSearch>
189
- )
190
- }
191
-
192
- const SocialNetWork = ({ url, icon }) => {
193
- return (
194
- <IconWrapper href={url} target='_blank' rel='noopener noreferrer'>
195
- {icon}
196
- </IconWrapper>
197
- )
198
- }
199
-
200
- const BusinessInfoComponent = () => {
201
- return (
202
- <BusinessInfoContainer isChew={isChew} isFlexEnd={windowSize.width >= 768}>
203
- <BusinessInfoContent>
204
- <BusinessInfo className='info'>
205
- <BusinessInfoItem isInfoShrunken={isInfoShrunken}>
206
- {!loading ? (
207
- <TitleWrapper>
208
- <h2 className='bold' id='business_name'>{business?.name}</h2>
209
- {business?.ribbon?.enabled && (
210
- <RibbonBox
211
- bgColor={business?.ribbon?.color}
212
- colorText={lightenDarkenColor(business?.ribbon?.color)}
213
- borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
214
- isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
215
- isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
216
- >
217
- {business?.ribbon?.text}
218
- </RibbonBox>
219
- )}
220
- </TitleWrapper>
221
- ) : (
222
- <Skeleton width={isCustomerMode ? 100 : 150} height={isCustomerMode ? 35 : 'auto'} />
223
- )}
224
- {typeof hideCity !== 'undefined' && !hideCity && business?.city?.name && (
225
- <>
226
- {!loading ? (
227
- <p className='type'>{business?.city?.name}</p>
228
- ) : (
229
- <Skeleton width={isCustomerMode ? 100 : 150} />
230
- )}
231
- </>
232
- )}
233
- {!loading ? (
234
- <SocialList>
235
- {business?.facebook_profile && (
236
- <SocialNetWork
237
- url={business?.facebook_profile}
238
- icon={<Facebook />}
239
- />
240
- )}
241
- {business?.instagram_profile && (
242
- <SocialNetWork
243
- url={business?.instagram_profile}
244
- icon={<Instagram />}
245
- />
246
- )}
247
- {business?.tiktok_profile && (
248
- <SocialNetWork
249
- url={business?.tiktok_profile}
250
- icon={<Tiktok />}
251
- />
252
- )}
253
- {business?.pinterest_profile && (
254
- <SocialNetWork
255
- url={business?.pinterest_profile}
256
- icon={<Pinterest />}
257
- />
258
- )}
259
- {business?.whatsapp_number && (
260
- <SocialNetWork
261
- url={business?.whatsapp_number}
262
- icon={<Whatsapp />}
263
- />
264
- )}
265
- {business?.snapchat_profile && (
266
- <SocialNetWork
267
- url={business?.snapchat_profile}
268
- icon={<Snapchat />}
269
- />
270
- )}
271
- </SocialList>
272
- ) : (
273
- <SocialList>
274
- {[...Array(5).keys()].map(i => (
275
- <IconWrapper isSkeleton key={i}>
276
- <Skeleton width={27} height={27} />
277
- </IconWrapper>
278
- ))}
279
- </SocialList>
280
- )}
281
- <BusinessDetail isSkeleton={loading}>
282
- {orderState?.options.type === 1 && !hideDeliveryFee && (
283
- <>
284
- {!loading ? (
285
- <>
286
- <h5>
287
- <span>{t('DELIVERY_FEE', 'Delivery fee')}</span>
288
- {business && parsePrice(business?.delivery_price || 0)}
289
- </h5>
290
- <span className='dot'>•</span>
291
- </>
292
- ) : (
293
- <Skeleton width={isCustomerMode ? 70 : 50} />
294
- )}
295
- </>
296
- )}
297
- {!hideTime && (
298
- <>
299
- {!loading ? (
300
- <>
301
- {orderState?.options?.type === 1 ? (
302
- <>
303
- <h5>
304
- {convertHoursToMinutes(business?.delivery_time)}
305
- </h5>
306
- <span className='dot'>•</span>
307
- </>
308
- ) : (
309
- <>
310
- <h5>
311
- {convertHoursToMinutes(business?.pickup_time)}
312
- </h5>
313
- <span className='dot'>•</span>
314
- </>
315
- )}
316
- </>
317
- ) : (
318
- <Skeleton width={isCustomerMode ? 70 : 50} />
319
- )}
320
- </>
321
- )}
322
- {!hideDistance && (
323
- <>
324
- {!loading ? (
325
- <>
326
- <h5>
327
- {parseDistance(business?.distance || 0)}
328
- </h5>
329
- <span className='dot'>•</span>
330
- </>
331
- ) : (
332
- <Skeleton width={isCustomerMode ? 70 : 50} />
333
- )}
334
- </>
335
- )}
336
- {!hideReviews && (
337
- <>
338
- {!loading ? (
339
- <div className='review'>
340
- <StarFill className='start' />
341
- <p>{business?.reviews?.total}</p>
342
- </div>
343
- ) : (
344
- <Skeleton width={isCustomerMode ? 100 : 50} />
345
- )}
346
- </>
347
- )}
348
- </BusinessDetail>
349
- {
350
- !loading ? (
351
- <div className='preorder-Reviews'>
352
- {isPreOrderSetting && (
353
- <>
354
- <span onClick={() => setIsPreOrder(true)}>{t('PREORDER', 'Preorder')}</span>
355
- <span className='dot'>•</span>
356
- </>
357
- )}
358
- {business.reviews?.reviews && !hideReviewsPopup && <span onClick={() => setIsBusinessReviews(true)}>{t('REVIEWS', 'Reviews')}</span>}
359
- </div>
360
- ) : (
361
- <Skeleton width={isCustomerMode ? 100 : 150} />
362
- )
363
- }
364
- </BusinessInfoItem>
365
- </BusinessInfo>
366
- </BusinessInfoContent>
367
- {!hideSearch &&
368
- (categoryState?.products?.length !== 0 || searchValue) &&
369
- !errorQuantityProducts &&
370
- !isInfoShrunken &&
371
- !business?.professionals?.length &&
372
- // (categoryClicked || windowSize.width >= 993) &&
373
- (
374
- <SearchComponent />
375
- )}
376
- </BusinessInfoContainer>
377
- )
378
- }
379
-
380
162
  return (
381
163
  <>
382
164
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -401,7 +183,10 @@ export const BusinessBasicInformation = (props) => {
401
183
  )}
402
184
  <BusinessInfoWrapper>
403
185
  {(!isInfoShrunken && !isChew) && (
404
- <BusinessInfoComponent />
186
+ <BusinessInfoComponent
187
+ {...businessInfoComponentProps}
188
+
189
+ />
405
190
  )}
406
191
  {(business?.header || business?.logo || loading || isInfoShrunken) && (
407
192
  <BusinessContainer bgimage={business?.header} isSkeleton={isSkeleton} id='container' isClosed={!business?.open} isChew={isChew}>
@@ -416,13 +201,20 @@ export const BusinessBasicInformation = (props) => {
416
201
  </BusinessContent>
417
202
  )}
418
203
  {(isInfoShrunken || isChew) && (
419
- <BusinessInfoComponent />
204
+ <BusinessInfoComponent
205
+ {...businessInfoComponentProps}
206
+ />
420
207
  )}
421
208
  {!loading && (
422
209
  <>
423
210
  {isInfoShrunken && (
424
211
  <SearchComponentContainer>
425
- <SearchComponent />
212
+ <SearchComponent
213
+ setOpenSearchProducts={setOpenSearchProducts}
214
+ handleChangeSortBy={handleChangeSortBy}
215
+ sortByValue={sortByValue}
216
+ sortByOptions={sortByOptions}
217
+ />
426
218
  </SearchComponentContainer>
427
219
  )}
428
220
  {searchLayout === 'floating' && (
@@ -249,7 +249,7 @@ export const WrapperSearch = styled.div`
249
249
  position: fixed;
250
250
  top: 0;
251
251
  right: 0;
252
- z-index: 1002;
252
+ z-index: 10001;
253
253
  width: fit-content;
254
254
  margin-top: 0px;
255
255
  background-color: ${props => props.theme.colors.backgroundPage};
@@ -260,6 +260,7 @@ export const WrapperSearch = styled.div`
260
260
  &.fixed-search {
261
261
  left: 0;
262
262
  width: 100vw;
263
+ z-index: 1002;
263
264
  }
264
265
  }
265
266
  `
@@ -370,17 +371,26 @@ export const TitleWrapper = styled.div`
370
371
  overflow: hidden;
371
372
  white-space: nowrap;
372
373
  text-overflow: ellipsis;
374
+ background: ${({ theme }) => theme?.colors?.white};
373
375
  &.fixed-name {
374
376
  z-index: 1002;
375
377
  position: fixed;
376
378
  top: 0;
377
- width: calc(100vw - 190px);
378
379
  padding: 10px 0;
379
380
  font-size: 18px;
380
- ${props => props.theme?.rtl ? css`
381
+ ${({ isCustomLayout }) => !isCustomLayout ? css`
382
+ width: calc(100vw - 190px);
383
+ ${props => props.theme?.rtl ? css`
381
384
  right: 50px;
382
- ` : css`
385
+ ` : css`
383
386
  left: 50px;
387
+ `}
388
+ ` : css`
389
+ ${props => props.theme?.rtl ? css`
390
+ right: 10px;
391
+ ` : css`
392
+ left: 10px;
393
+ `}
384
394
  `}
385
395
  }
386
396
  @media (min-width: 768px) {