ordering-ui-external 1.3.2 → 1.4.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 (133) hide show
  1. package/_bundles/0.ordering-ui.4daed536057dd0fbaf15.js +1 -0
  2. package/_bundles/{0.ordering-ui.8d3ec9f208550df10621.js → 1.ordering-ui.4daed536057dd0fbaf15.js} +1 -1
  3. package/_bundles/{1.ordering-ui.8d3ec9f208550df10621.js → 2.ordering-ui.4daed536057dd0fbaf15.js} +1 -1
  4. package/_bundles/{4.ordering-ui.8d3ec9f208550df10621.js → 4.ordering-ui.4daed536057dd0fbaf15.js} +1 -1
  5. package/_bundles/{5.ordering-ui.8d3ec9f208550df10621.js → 5.ordering-ui.4daed536057dd0fbaf15.js} +1 -1
  6. package/_bundles/{6.ordering-ui.8d3ec9f208550df10621.js → 6.ordering-ui.4daed536057dd0fbaf15.js} +1 -1
  7. package/_bundles/7.ordering-ui.4daed536057dd0fbaf15.js +2 -0
  8. package/_bundles/{7.ordering-ui.8d3ec9f208550df10621.js.LICENSE.txt → 7.ordering-ui.4daed536057dd0fbaf15.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.8d3ec9f208550df10621.js → 8.ordering-ui.4daed536057dd0fbaf15.js} +0 -0
  10. package/_bundles/{9.ordering-ui.8d3ec9f208550df10621.js → 9.ordering-ui.4daed536057dd0fbaf15.js} +1 -1
  11. package/_bundles/ordering-ui.4daed536057dd0fbaf15.js +2 -0
  12. package/_bundles/{ordering-ui.8d3ec9f208550df10621.js.LICENSE.txt → ordering-ui.4daed536057dd0fbaf15.js.LICENSE.txt} +0 -0
  13. package/_modules/themes/five/index.js +7 -0
  14. package/_modules/themes/five/src/components/BusinessListingSearch/MaxSectionItem/index.js +47 -0
  15. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +14 -29
  16. package/_modules/themes/five/src/components/BusinessProductsList/index.js +10 -6
  17. package/_modules/themes/five/src/components/BusinessProductsList/styles.js +8 -7
  18. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +1 -1
  19. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +3 -3
  20. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +4 -1
  21. package/_modules/themes/five/src/components/Cart/index.js +3 -1
  22. package/_modules/themes/five/src/components/Checkout/index.js +46 -33
  23. package/_modules/themes/five/src/components/Favorite/index.js +16 -2
  24. package/_modules/themes/five/src/components/FavoriteList/index.js +15 -1
  25. package/_modules/themes/five/src/components/Header/index.js +2 -2
  26. package/_modules/themes/five/src/components/Header/styles.js +5 -3
  27. package/_modules/themes/five/src/components/Modal/index.js +2 -2
  28. package/_modules/themes/five/src/components/Modal/styles.js +8 -4
  29. package/_modules/themes/five/src/components/MyOrders/index.js +9 -2
  30. package/_modules/themes/five/src/components/OrderDetails/ActionsSection.js +1 -0
  31. package/_modules/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +10 -40
  32. package/_modules/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/index.js +25 -0
  33. package/_modules/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/styles.js +19 -0
  34. package/_modules/themes/five/src/components/OrdersOption/index.js +16 -13
  35. package/_modules/themes/five/src/components/ProductForm/index.js +5 -5
  36. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +1 -1
  37. package/_modules/themes/five/src/components/SidebarMenu/index.js +39 -17
  38. package/_modules/themes/five/src/components/SingleProductCard/styles.js +1 -1
  39. package/_modules/themes/five/src/components/SingleProfessionalCard/index.js +95 -0
  40. package/_modules/themes/five/src/components/SingleProfessionalCard/styles.js +47 -0
  41. package/_modules/themes/five/src/styles/Selects/index.js +1 -1
  42. package/index-template.js +28 -5
  43. package/package.json +6 -3
  44. package/src/themes/five/index.js +2 -0
  45. package/src/themes/five/src/components/BusinessListingSearch/MaxSectionItem/index.js +44 -0
  46. package/src/themes/five/src/components/BusinessListingSearch/index.js +8 -30
  47. package/src/themes/five/src/components/BusinessProductsList/index.js +29 -22
  48. package/src/themes/five/src/components/BusinessProductsList/styles.js +25 -2
  49. package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -1
  50. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +4 -3
  51. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
  52. package/src/themes/five/src/components/Cart/index.js +2 -0
  53. package/src/themes/five/src/components/Checkout/index.js +19 -12
  54. package/src/themes/five/src/components/Favorite/index.js +19 -1
  55. package/src/themes/five/src/components/FavoriteList/index.js +24 -0
  56. package/src/themes/five/src/components/Header/index.js +11 -8
  57. package/src/themes/five/src/components/Header/styles.js +5 -0
  58. package/src/themes/five/src/components/Modal/index.js +9 -6
  59. package/src/themes/five/src/components/Modal/styles.js +15 -1
  60. package/src/themes/five/src/components/MyOrders/index.js +11 -1
  61. package/src/themes/five/src/components/OrderDetails/ActionsSection.js +1 -0
  62. package/src/themes/five/src/components/OrdersOption/PreviousBusinessOrdered/index.js +8 -29
  63. package/src/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/index.js +32 -0
  64. package/src/themes/five/src/components/OrdersOption/PreviousProfessionalOrdered/styles.js +38 -0
  65. package/src/themes/five/src/components/OrdersOption/index.js +18 -9
  66. package/src/themes/five/src/components/ProductForm/index.js +5 -5
  67. package/src/themes/five/src/components/RenderProductsLayout/styles.js +1 -1
  68. package/src/themes/five/src/components/SidebarMenu/index.js +98 -42
  69. package/src/themes/five/src/components/SingleProductCard/styles.js +5 -1
  70. package/src/themes/five/src/components/SingleProfessionalCard/index.js +82 -0
  71. package/src/themes/five/src/components/SingleProfessionalCard/styles.js +92 -0
  72. package/src/themes/five/src/styles/Selects/index.js +1 -0
  73. package/template/Utils/index.js +4 -0
  74. package/template/app.js +554 -143
  75. package/template/assets/images/business-hero.jpg +0 -0
  76. package/template/assets/images/business-signup-background.png +0 -0
  77. package/template/assets/images/business_signup.png +0 -0
  78. package/template/assets/images/congratulation_approval.png +0 -0
  79. package/template/assets/images/congratulation_no_approval.png +0 -0
  80. package/template/assets/images/credit.png +0 -0
  81. package/template/assets/images/delivery-types/curbside.jpg +0 -0
  82. package/template/assets/images/delivery-types/delivery.jpg +0 -0
  83. package/template/assets/images/delivery-types/drive_thru.jpg +0 -0
  84. package/template/assets/images/delivery-types/eat_in.jpg +0 -0
  85. package/template/assets/images/delivery-types/pickup.jpg +0 -0
  86. package/template/assets/images/driver-signup-background.png +0 -0
  87. package/template/assets/images/driver-signup-hero.png +0 -0
  88. package/template/assets/images/driver_congratulation_approval.png +0 -0
  89. package/template/assets/images/driver_congratulation_no_approval.png +0 -0
  90. package/template/assets/images/driver_signup.png +0 -0
  91. package/template/assets/images/home-hero.jpg +0 -0
  92. package/template/assets/images/loyalty_level.png +0 -0
  93. package/template/assets/images/mastercard.png +0 -0
  94. package/template/assets/images/not-found.svg +94 -1
  95. package/template/assets/images/not-network.svg +226 -1
  96. package/template/assets/images/visa.png +0 -0
  97. package/template/components/HelmetTags/index.js +5 -4
  98. package/template/components/ListenPageChanges/index.js +25 -12
  99. package/template/components/ScrollToTop/index.js +4 -0
  100. package/template/config.js +14 -0
  101. package/template/config.json +1 -0
  102. package/template/helmetdata.json +91 -28
  103. package/template/pages/AddressList/index.js +34 -0
  104. package/template/pages/AddressList/styles.js +43 -0
  105. package/template/pages/BusinessListingSearch/index.js +106 -0
  106. package/template/pages/BusinessProductsList/index.js +152 -29
  107. package/template/pages/BusinessesList/index.js +17 -6
  108. package/template/pages/Checkout/index.js +14 -4
  109. package/template/pages/Favorite/index.js +12 -0
  110. package/template/pages/Help/index.js +7 -2
  111. package/template/pages/Home/index.js +58 -36
  112. package/template/pages/Home/styles.js +14 -0
  113. package/template/pages/MessagesList/index.js +19 -0
  114. package/template/pages/MultiCheckout/index.js +26 -0
  115. package/template/pages/MultiOrdersDetails/index.js +21 -0
  116. package/template/pages/MyOrders/index.js +87 -3
  117. package/template/pages/OrderDetails/index.js +12 -2
  118. package/template/pages/Profile/index.js +16 -3
  119. package/template/pages/Promotions/index.js +13 -0
  120. package/template/pages/ResetPassword/index.js +15 -9
  121. package/template/pages/SessionsList/index.js +12 -0
  122. package/template/pages/SignUpBusiness/index.js +12 -0
  123. package/template/pages/SignUpDriver/index.js +12 -0
  124. package/template/pages/UserVerification/index.js +12 -0
  125. package/template/pages/Wallets/index.js +12 -0
  126. package/template/service-worker.js +72 -0
  127. package/template/theme.json +27 -51
  128. package/_bundles/3.ordering-ui.8d3ec9f208550df10621.js +0 -1
  129. package/_bundles/7.ordering-ui.8d3ec9f208550df10621.js +0 -2
  130. package/_bundles/ordering-ui.8d3ec9f208550df10621.js +0 -2
  131. package/template/assets/images/exclamation.svg +0 -3
  132. package/template/assets/images/order-creating.png +0 -0
  133. package/template/assets/images/order-sucess.png +0 -0
Binary file
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import { Helmet } from 'react-helmet'
3
3
  import helmetData from '../../helmetdata.json'
4
+ import settings from '../../config'
4
5
 
5
6
  export const HelmetTags = (props) => {
6
7
  const {
@@ -9,10 +10,10 @@ export const HelmetTags = (props) => {
9
10
 
10
11
  const metaTag = page ? helmetData[page] : helmetData.app
11
12
  return (
12
- <Helmet titleTemplate={!page ? '' : 'Ordering - %s'}>
13
- <title>{props.helmetTitle || metaTag.title}</title>
14
- <meta name='description' content={props.description || metaTag.description} />
15
- <meta name='keywords' content={props.keywords || metaTag.keywords} />
13
+ <Helmet titleTemplate={!page ? '' : `${settings.app_name} - %s`}>
14
+ <title>{props.helmetMetaTags?.title || metaTag.title}</title>
15
+ <meta name='description' content={props.helmetMetaTags?.description || metaTag.description} />
16
+ <meta name='keywords' content={props.helmetMetaTags?.keywords || metaTag.keywords} />
16
17
  {props.robots ? (
17
18
  <meta name='robots' content={props.robots} />
18
19
  ) : (
@@ -1,34 +1,47 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import { useHistory } from 'react-router-dom'
3
- import { useEvent, useLanguage } from 'ordering-components-external'
3
+ import { useEvent, useLanguage, useSite } from 'ordering-components-external'
4
4
  import { useTheme } from '../../../src/contexts/ThemeContext'
5
+ import { checkSiteUrl } from '../../Utils'
5
6
 
6
7
  export const ListenPageChanges = ({ children }) => {
7
8
  const history = useHistory()
8
9
  const [events] = useEvent()
9
10
  const [languageState] = useLanguage()
10
11
  const [theme, { merge }] = useTheme()
12
+ const [{ site }] = useSite()
13
+
14
+ const businessUrlChecked = checkSiteUrl(site?.business_url_template, '/store/:business_slug')
15
+ const businessUrl = businessUrlChecked.includes('?') ? businessUrlChecked.split('?')[0] : businessUrlChecked
16
+
17
+ const productUrlTemplate = checkSiteUrl(site?.product_url_template, '/store/:business_slug?category=:category_id&product=:product_id')
18
+ const productUrl = productUrlTemplate.includes('?') ? productUrlTemplate.split('?')[0] : productUrlTemplate
11
19
 
12
20
  const routes = {
13
21
  home: '/',
14
22
  search: '/search',
15
- delivery: '/delivery',
16
- pickup: '/pickup',
17
- eatin: '/eatin',
18
- curbside: '/curbside',
19
- drivethru: '/drivethru',
20
- signup: '/signup',
21
- signin: '/signin',
22
23
  profile: '/profile',
24
+ messages: '/messages',
25
+ verify: '/verify',
26
+ wallets: '/wallets',
27
+ help: '/help',
28
+ signup_business: '/signup_business',
29
+ signup_driver: '/signup-driver',
23
30
  orders: '/profile/orders',
24
31
  order_detail: '/orders/:orderId',
25
32
  checkout: '/checkout/:cartUuid',
26
33
  checkout_list: '/checkout',
27
- business: '/store/:store',
34
+ multi_checkout: '/multi-checkout',
35
+ multi_orders: '/multi-orders',
36
+ business: businessUrl,
28
37
  business_slug: '/:store',
29
- forgot_password: '/password/forgot',
38
+ product: productUrl,
39
+ business_search: '/business_search',
30
40
  reset_password: '/password/reset',
31
- help: '/help'
41
+ sessions: '/sessions',
42
+ promotions: '/promotions',
43
+ addresses: '/profile/addresses',
44
+ favorite: '/favorite'
32
45
  }
33
46
 
34
47
  const handleGoToPage = ({ page, params = {}, search, replace = false }) => {
@@ -83,7 +96,7 @@ export const ListenPageChanges = ({ children }) => {
83
96
  events.off('go_to_page', handleGoToPage)
84
97
  events.off('get_current_view', handleGetCurrentView)
85
98
  }
86
- }, [events])
99
+ }, [])
87
100
 
88
101
  useEffect(() => {
89
102
  if (theme.rtl !== languageState?.language?.rtl) {
@@ -1,7 +1,11 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import { withRouter } from 'react-router-dom'
3
+ import { useSite } from 'ordering-components-external'
4
+ import { checkSiteUrl } from '../../Utils'
3
5
 
4
6
  export const ScrollToTop = withRouter(({ history, children }) => {
7
+ const [{ site }] = useSite()
8
+ const productUrlTemplate = checkSiteUrl(site?.product_url_template, '/store/:business_slug?category=:category_id&product=:product_id')
5
9
  useEffect(() => {
6
10
  const unlisten = history.listen((data) => {
7
11
  if (!window.location.pathname.includes('/store/')) {
@@ -0,0 +1,14 @@
1
+ import settings from './config.json'
2
+
3
+ const keysToNull = [
4
+ 'franchiseSlug',
5
+ 'businessSlug'
6
+ ]
7
+
8
+ keysToNull.forEach(key => {
9
+ if (settings[key] === '0' || settings[key] === 'null') {
10
+ settings[key] = null
11
+ };
12
+ })
13
+
14
+ export default settings
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "app_id": "ordering-react",
3
+ "app_name": "Ordering",
3
4
  "project": "luisv4",
4
5
  "api": {
5
6
  "url": "https://apiv4.ordering.co",
@@ -13,34 +13,6 @@
13
13
  "robots": "index, follow",
14
14
  "canonicalUrl": ""
15
15
  },
16
- "login": {
17
- "title": "Login",
18
- "description": "a dummy description about this page",
19
- "keywords": "test, dummy, data",
20
- "robots": "index, follow",
21
- "canonicalUrl": ""
22
- },
23
- "signup": {
24
- "title": "Signup",
25
- "description": "a dummy description about this page",
26
- "keywords": "test, dummy, data",
27
- "robots": "index, follow",
28
- "canonicalUrl": ""
29
- },
30
- "forgotpassword": {
31
- "title": "Forgot Password",
32
- "description": "a dummy description about this page",
33
- "keywords": "test, dummy, data",
34
- "robots": "index, follow",
35
- "canonicalUrl": ""
36
- },
37
- "resetpassword": {
38
- "title": "Reset Password",
39
- "description": "a dummy description about this page",
40
- "keywords": "test, dummy, data",
41
- "robots": "index, follow",
42
- "canonicalUrl": ""
43
- },
44
16
  "profile": {
45
17
  "title": "Profile",
46
18
  "description": "a dummy description about this page",
@@ -117,5 +89,96 @@
117
89
  "keywords": "test, dummy, data",
118
90
  "robots": "index, follow",
119
91
  "canonicalUrl": ""
92
+ },
93
+ "signup_business": {
94
+ "title": "SignUp for business",
95
+ "description": "a dummy description about this page",
96
+ "keywords": "test, dummy, data",
97
+ "robots": "index, follow",
98
+ "canonicalUrl": ""
99
+ },
100
+ "messages": {
101
+ "title": "Messages",
102
+ "description": "a dummy description about this page",
103
+ "keywords": "test, dummy, data",
104
+ "robots": "index, follow",
105
+ "canonicalUrl": ""
106
+ },
107
+ "wallets": {
108
+ "title": "Wallets",
109
+ "description": "a dummy description about this page",
110
+ "keywords": "test, dummy, data",
111
+ "robots": "index, follow",
112
+ "canonicalUrl": ""
113
+ },
114
+ "user-verification": {
115
+ "title": "User Verification",
116
+ "description": "a dummy description about this page",
117
+ "keywords": "test, dummy, data",
118
+ "robots": "index, follow",
119
+ "canonicalUrl": ""
120
+ },
121
+ "business_search": {
122
+ "title": "Business Search",
123
+ "description": "a dummy description about this page",
124
+ "keywords": "test, dummy, data",
125
+ "robots": "index, follow",
126
+ "canonicalUrl": ""
127
+ },
128
+ "resetpassword": {
129
+ "title": "Reset Password",
130
+ "description": "a dummy description about this page",
131
+ "keywords": "test, dummy, data",
132
+ "robots": "index, follow",
133
+ "canonicalUrl": ""
134
+ },
135
+ "sessions": {
136
+ "title": "Sessions",
137
+ "description": "a dummy description about this page",
138
+ "keywords": "test, dummy, data",
139
+ "robots": "index, follow",
140
+ "canonicalUrl": ""
141
+ },
142
+ "signup_driver": {
143
+ "title": "SignUp for driver",
144
+ "description": "a dummy description about this page",
145
+ "keywords": "test, dummy, data",
146
+ "robots": "index, follow",
147
+ "canonicalUrl": ""
148
+ },
149
+ "promotions": {
150
+ "title": "Promotions",
151
+ "description": "a dummy description about this page",
152
+ "keywords": "test, dummy, data",
153
+ "robots": "index, follow",
154
+ "canonicalUrl": ""
155
+ },
156
+ "addresses": {
157
+ "title": "Addresses",
158
+ "description": "a dummy description about this page",
159
+ "keywords": "test, dummy, data",
160
+ "robots": "index, follow",
161
+ "canonicalUrl": ""
162
+ },
163
+ "favorite": {
164
+ "title": "Favorite",
165
+ "description": "a dummy description about this page",
166
+ "keywords": "test, dummy, data",
167
+ "robots": "index, follow",
168
+ "canonicalUrl": ""
169
+ },
170
+ "multi_checkout": {
171
+ "title": "Multi checkout",
172
+ "description": "a dummy description about this page",
173
+ "keywords": "test, dummy, data",
174
+ "robots": "index, follow",
175
+ "canonicalUrl": ""
176
+ },
177
+ "multi_orders": {
178
+ "title": "Multi Orders",
179
+ "description": "a dummy description about this page",
180
+ "keywords": "test, dummy, data",
181
+ "robots": "index, follow",
182
+ "canonicalUrl": ""
120
183
  }
121
184
  }
@@ -0,0 +1,34 @@
1
+ import React from 'react'
2
+ import { AddressList as AddressListController } from '../../../src/themes/five/src/components/AddressList'
3
+ import { ProfileOptions } from '../../../src/themes/five/src/components/UserProfileForm/ProfileOptions'
4
+ import { useLanguage, useSession, useOrderingTheme } from 'ordering-components-external'
5
+ import { HelmetTags } from '../../components/HelmetTags'
6
+ import { SavedPlaces } from './styles'
7
+
8
+ export const AddressList = (props) => {
9
+ const [{ user }] = useSession()
10
+ const [, t] = useLanguage()
11
+ const [orderingTheme] = useOrderingTheme()
12
+ const addressListParams = {
13
+ ...props,
14
+ addressList: user?.addresses,
15
+ isProfile: true,
16
+ isModal: true
17
+ }
18
+ const showProfileOptions = orderingTheme?.theme?.profile?.components?.address_list?.components?.layout?.position === 'new_page'
19
+
20
+ return (
21
+ <>
22
+ <HelmetTags page='addresses' />
23
+ {showProfileOptions && (
24
+ <ProfileOptions value='addresses' />
25
+ )}
26
+ <SavedPlaces>
27
+ <h1>
28
+ {t('SAVED_PLACES', 'Saved places')}
29
+ </h1>
30
+ <AddressListController {...addressListParams} />
31
+ </SavedPlaces>
32
+ </>
33
+ )
34
+ }
@@ -0,0 +1,43 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const SavedPlaces = styled.div`
4
+ width: 90%;
5
+ text-align: center;
6
+ margin: 0 auto;
7
+ margin-top: 40px;
8
+ margin-bottom: 20px;
9
+
10
+
11
+ h1{
12
+ font-size: 24px;
13
+ text-align: left;
14
+ ${props => props.theme?.rtl && css`
15
+ text-align: right;
16
+ `}
17
+ }
18
+
19
+ > div{
20
+ display: flex;
21
+ flex-direction: column-reverse;
22
+ align-items: center;
23
+ }
24
+
25
+ button{
26
+ width: 100%;
27
+ align-self: center;
28
+ }
29
+
30
+ @media (min-width: 768px){
31
+ width: 90%;
32
+ margin-top: 40px;
33
+ h1 {
34
+ text-align: center;
35
+ }
36
+ ul{
37
+ width: 100%;
38
+ }
39
+ button {
40
+ width: 65%;
41
+ }
42
+ }
43
+ `
@@ -0,0 +1,106 @@
1
+ import React from 'react'
2
+ import { useLocation } from 'react-router-dom'
3
+ import { BusinessListingSearch as BusinessListingSearchController } from '../../../src/themes/five/src/components/BusinessListingSearch'
4
+ import { useEvent, useSite } from 'ordering-components-external'
5
+ import { HelmetTags } from '../../components/HelmetTags'
6
+ import { checkSiteUrl } from '../../Utils'
7
+
8
+ export const BusinessListingSearch = (props) => {
9
+ const [events] = useEvent()
10
+ const { search } = useLocation()
11
+ const searchParams = new URLSearchParams(search)
12
+ const defaultTerm = searchParams.get('term') || ''
13
+
14
+ const [{ site }] = useSite()
15
+ const businessUrlTemplate = checkSiteUrl(site?.business_url_template, '/store/:business_slug')
16
+ const productUrlTemplate = checkSiteUrl(site?.product_url_template, '/store/:business_slug?category=:category_id&product=:product_id')
17
+
18
+ const businessListingProps = {
19
+ ...props,
20
+ defaultTerm: defaultTerm,
21
+ onBusinessClick: (business) => {
22
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
23
+ events.emit('go_to_page', { page: 'business', params: { business_slug: business.slug } })
24
+ } else {
25
+ events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${business.slug}` })
26
+ }
27
+ },
28
+ onRedirectPage: (data) => {
29
+ if (data.page === 'business') {
30
+ const businessSlug = data.params?.store
31
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
32
+ events.emit('go_to_page', { page: 'business', params: { business_slug: businessSlug } })
33
+ } else {
34
+ events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${businessSlug}` })
35
+ }
36
+ } else {
37
+ events.emit('go_to_page', data)
38
+ }
39
+ },
40
+ onProductRedirect: ({ slug, category, product }) => {
41
+ if (!category && !product) {
42
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
43
+ return events.emit('go_to_page', { page: 'business', params: { business_slug: slug } })
44
+ } else {
45
+ return events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${slug}` })
46
+ }
47
+ }
48
+ if (productUrlTemplate === '/store/:business_slug/:category_slug/:product_slug' || productUrlTemplate === '/:business_slug/:category_slug/:product_slug') {
49
+ return events.emit('go_to_page', {
50
+ page: 'product',
51
+ params: {
52
+ business_slug: slug,
53
+ category_slug: category,
54
+ product_slug: product
55
+ },
56
+ replace: true
57
+ })
58
+ }
59
+ if (productUrlTemplate.includes('/store/:category_slug/:product_slug')) {
60
+ const businessParameter = businessUrlTemplate.replace('/store?', '').replace('=:business_slug', '')
61
+ return events.emit('go_to_page', {
62
+ page: 'product',
63
+ params: {
64
+ category_slug: category,
65
+ product_slug: product
66
+ },
67
+ search: `?${businessParameter}=${slug}`,
68
+ replace: true
69
+ })
70
+ }
71
+ if (productUrlTemplate.includes('/store/:business_slug') && productUrlTemplate.includes('category_id')) {
72
+ const ids = productUrlTemplate.split('?')[1].split('&')
73
+ const categoryParameter = ids[0].replace('=:category_id', '')
74
+ const productParameter = ids[1].replace('=:product_id', '')
75
+ return events.emit('go_to_page', {
76
+ page: 'product',
77
+ params: {
78
+ business_slug: slug,
79
+ },
80
+ search: `?${categoryParameter}=${category}&${productParameter}=${product}`,
81
+ replace: true
82
+ })
83
+ }
84
+ if (productUrlTemplate.includes('/:business_slug') && !productUrlTemplate.includes('store')) {
85
+ const ids = productUrlTemplate.split('?')[1].split('&')
86
+ const categoryParameter = ids[0].replace('=:category_id', '')
87
+ const productParameter = ids[1].replace('=:product_id', '')
88
+ return events.emit('go_to_page', {
89
+ page: 'product',
90
+ params: {
91
+ business_slug: slug,
92
+ },
93
+ search: `?${categoryParameter}=${category}&${productParameter}=${product}`,
94
+ replace: true
95
+ })
96
+ }
97
+ },
98
+ }
99
+
100
+ return (
101
+ <>
102
+ <HelmetTags page='business_search' />
103
+ <BusinessListingSearchController {...businessListingProps} />
104
+ </>
105
+ )
106
+ }