ordering-ui-external 1.3.2 → 1.4.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.
Files changed (133) hide show
  1. package/_bundles/0.ordering-ui.eec38d66166bc4458215.js +1 -0
  2. package/_bundles/{0.ordering-ui.8d3ec9f208550df10621.js → 1.ordering-ui.eec38d66166bc4458215.js} +1 -1
  3. package/_bundles/{1.ordering-ui.8d3ec9f208550df10621.js → 2.ordering-ui.eec38d66166bc4458215.js} +1 -1
  4. package/_bundles/{4.ordering-ui.8d3ec9f208550df10621.js → 4.ordering-ui.eec38d66166bc4458215.js} +1 -1
  5. package/_bundles/{5.ordering-ui.8d3ec9f208550df10621.js → 5.ordering-ui.eec38d66166bc4458215.js} +1 -1
  6. package/_bundles/{6.ordering-ui.8d3ec9f208550df10621.js → 6.ordering-ui.eec38d66166bc4458215.js} +1 -1
  7. package/_bundles/7.ordering-ui.eec38d66166bc4458215.js +2 -0
  8. package/_bundles/{7.ordering-ui.8d3ec9f208550df10621.js.LICENSE.txt → 7.ordering-ui.eec38d66166bc4458215.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.8d3ec9f208550df10621.js → 8.ordering-ui.eec38d66166bc4458215.js} +1 -1
  10. package/_bundles/{9.ordering-ui.8d3ec9f208550df10621.js → 9.ordering-ui.eec38d66166bc4458215.js} +1 -1
  11. package/_bundles/ordering-ui.eec38d66166bc4458215.js +2 -0
  12. package/_bundles/{ordering-ui.8d3ec9f208550df10621.js.LICENSE.txt → ordering-ui.eec38d66166bc4458215.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 +52 -39
  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 +22 -14
  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
@@ -1,34 +1,88 @@
1
- import React from 'react'
1
+ import React, { useState, useEffect } from 'react'
2
2
  import { useParams, useLocation } from 'react-router-dom'
3
- import { useApi, useEvent } from 'ordering-components-external'
4
- import { BusinessProductsListing } from '../../../src/components/BusinessProductsListing'
3
+ import { useApi, useEvent, useSite } from 'ordering-components-external'
4
+ import { BusinessProductsListing } from '../../../src/themes/five/src/components/BusinessProductsListing'
5
5
  import { HelmetTags } from '../../components/HelmetTags'
6
6
  import { capitalize } from '../../../src/utils'
7
+ import settings from '../../config'
8
+ import { checkSiteUrl } from '../../Utils'
7
9
 
8
10
  export const BusinessProductsList = (props) => {
9
- const { store } = useParams()
10
- const [ordering] = useApi()
11
+ const [{ site }] = useSite()
11
12
  const { search } = useLocation()
13
+ const [helmetMetaTags, setHelmetMetaTags] = useState({
14
+ title: '',
15
+ description: '',
16
+ keywords: ''
17
+ })
18
+
19
+ let businessSlug = ''
20
+ const businessUrlTemplate = checkSiteUrl(site?.business_url_template, '/store/:business_slug')
21
+ const productUrlTemplate = checkSiteUrl(site?.product_url_template, '/store/:business_slug?category=:category_id&product=:product_id')
22
+
23
+ if (businessUrlTemplate.includes('?')) {
24
+ const businessParameter = businessUrlTemplate.replace('/store?', '').replace('=:business_slug', '')
25
+ const params = new URLSearchParams(search)
26
+ businessSlug = params.get(businessParameter)
27
+ } else {
28
+ const { business_slug } = useParams()
29
+ businessSlug = business_slug
30
+ }
31
+ const [ordering] = useApi()
12
32
 
13
- let category
14
- let product
33
+ let categoryId
34
+ let productId
35
+ let tableNumber
15
36
 
16
- if (search) {
17
- const data = search.substring(1).split('&')
18
- category = data[0]
19
- product = data[1]
37
+ if (productUrlTemplate === '/store/:business_slug/:category_slug/:product_slug' ||
38
+ productUrlTemplate === '/:business_slug/:category_slug/:product_slug' ||
39
+ productUrlTemplate.includes('/store/:category_slug/:product_slug')
40
+ ) {
41
+ const { category_slug, product_slug } = useParams()
42
+ categoryId = category_slug
43
+ productId = product_slug
44
+ }
45
+
46
+ if ((productUrlTemplate.includes('/store/:business_slug') && productUrlTemplate.includes('category_id') ||
47
+ (productUrlTemplate.includes('/:business_slug') && !productUrlTemplate.includes('store')))
48
+ ) {
49
+ if (search) {
50
+ const ids = productUrlTemplate.split('?')[1].split('&')
51
+ const categoryParameter = ids[0].replace('=:category_id', '')
52
+ const productParameter = ids[1].replace('=:product_id', '')
53
+ const params = new URLSearchParams(search)
54
+ categoryId = params.get(categoryParameter)
55
+ productId = params.get(productParameter)
56
+ tableNumber = params.get('table_number')
57
+ }
58
+ }
59
+
60
+ if (tableNumber) {
61
+ const tableNumberFromStorage = window.localStorage.getItem('table_number')
62
+ if (tableNumberFromStorage) {
63
+ window.localStorage.removeItem('table_number')
64
+ }
65
+
66
+ window.localStorage.setItem(
67
+ 'table_number',
68
+ JSON.stringify({
69
+ tableNumber: tableNumber.split('=')[1],
70
+ slug: businessSlug
71
+ })
72
+ )
20
73
  }
21
74
 
22
- const categoryId = category && category.split('=')[1]
23
- const productId = product && product.split('=')[1]
24
75
  const [events] = useEvent()
25
76
 
26
77
  const businessProductsProps = {
27
78
  ...props,
28
79
  ordering,
80
+ avoidBusinessLoading: true,
81
+ isCustomLayout: settings?.use_marketplace,
82
+ useKioskApp: settings?.use_kiosk,
29
83
  isSearchByName: true,
30
84
  isSearchByDescription: true,
31
- slug: store,
85
+ slug: businessSlug,
32
86
  categoryId,
33
87
  productId,
34
88
  businessProps: [
@@ -39,8 +93,8 @@ export const BusinessProductsList = (props) => {
39
93
  'name',
40
94
  'open',
41
95
  'about',
42
- 'description',
43
96
  'ribbon',
97
+ 'description',
44
98
  'address',
45
99
  'location',
46
100
  'timezone',
@@ -62,39 +116,108 @@ export const BusinessProductsList = (props) => {
62
116
  'products',
63
117
  'zones',
64
118
  'front_layout',
65
- 'professionals'
119
+ 'professionals',
120
+ 'facebook_profile',
121
+ 'instagram_profile',
122
+ 'tiktok_profile',
123
+ 'pinterest_profile',
124
+ 'whatsapp_number',
125
+ 'snapchat_profile',
126
+ 'previously_products'
66
127
  ],
67
128
  handleSearchRedirect: () => {
68
129
  events.emit('go_to_page', { page: 'search' })
69
130
  },
70
131
  onProductRedirect: ({ slug, category, product }) => {
71
132
  if (!category && !product) {
72
- return window.location.pathname.includes('/store/')
73
- ? events.emit('go_to_page', { page: 'business', params: { store: slug }, replace: true })
74
- : events.emit('go_to_page', { page: 'business_slug', params: { store: slug }, replace: true })
133
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
134
+ return events.emit('go_to_page', { page: 'business', params: { business_slug: slug } })
135
+ } else {
136
+ return events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${slug}` })
137
+ }
75
138
  }
76
- return window.location.pathname.includes('/store/')
77
- ? events.emit('go_to_page', {
78
- page: 'business',
79
- params: { store: slug },
80
- search: `?category=${category}&product=${product}`,
139
+ if (productUrlTemplate === '/store/:business_slug/:category_slug/:product_slug' || productUrlTemplate === '/:business_slug/:category_slug/:product_slug') {
140
+ return events.emit('go_to_page', {
141
+ page: 'product',
142
+ params: {
143
+ business_slug: slug,
144
+ category_slug: category,
145
+ product_slug: product
146
+ },
81
147
  replace: true
82
148
  })
83
- : events.emit('go_to_page', {
84
- page: 'business_slug',
85
- params: { store: slug },
86
- search: `?category=${category}&product=${product}`,
149
+ }
150
+ if (productUrlTemplate.includes('/store/:category_slug/:product_slug')) {
151
+ const businessParameter = businessUrlTemplate.replace('/store?', '').replace('=:business_slug', '')
152
+ return events.emit('go_to_page', {
153
+ page: 'product',
154
+ params: {
155
+ category_slug: category,
156
+ product_slug: product
157
+ },
158
+ search: `?${businessParameter}=${slug}`,
159
+ replace: true
160
+ })
161
+ }
162
+ if (productUrlTemplate.includes('/store/:business_slug') && productUrlTemplate.includes('category_id')) {
163
+ const ids = productUrlTemplate.split('?')[1].split('&')
164
+ const categoryParameter = ids[0].replace('=:category_id', '')
165
+ const productParameter = ids[1].replace('=:product_id', '')
166
+ return events.emit('go_to_page', {
167
+ page: 'product',
168
+ params: {
169
+ business_slug: slug,
170
+ },
171
+ search: `?${categoryParameter}=${category}&${productParameter}=${product}`,
172
+ replace: true
173
+ })
174
+ }
175
+ if (productUrlTemplate.includes('/:business_slug') && !productUrlTemplate.includes('store')) {
176
+ const ids = productUrlTemplate.split('?')[1].split('&')
177
+ const categoryParameter = ids[0].replace('=:category_id', '')
178
+ const productParameter = ids[1].replace('=:product_id', '')
179
+ return events.emit('go_to_page', {
180
+ page: 'product',
181
+ params: {
182
+ business_slug: slug,
183
+ },
184
+ search: `?${categoryParameter}=${category}&${productParameter}=${product}`,
87
185
  replace: true
88
186
  })
187
+ }
89
188
  },
90
189
  onCheckoutRedirect: (cartUuid) => {
91
190
  events.emit('go_to_page', { page: 'checkout', params: { cartUuid } })
191
+ },
192
+ onChangeMetaTag: (title, description, keywords) => {
193
+ setHelmetMetaTags({
194
+ title: title,
195
+ description: description,
196
+ keywords: keywords
197
+ })
198
+ },
199
+ onBusinessClick: (business) => {
200
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
201
+ events.emit('go_to_page', { page: 'business', params: { business_slug: business.slug } })
202
+ } else {
203
+ events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${business.slug}` })
204
+ }
92
205
  }
93
206
  }
94
207
 
208
+ useEffect(() => {
209
+ if (businessSlug) {
210
+ const metaTitle = capitalize(businessSlug)
211
+ setHelmetMetaTags({
212
+ ...helmetMetaTags,
213
+ title: metaTitle,
214
+ })
215
+ }
216
+ }, [businessSlug])
217
+
95
218
  return (
96
219
  <>
97
- <HelmetTags page='business' helmetTitle={capitalize(store)} />
220
+ <HelmetTags page='business' helmetMetaTags={helmetMetaTags} />
98
221
  <BusinessProductsListing {...businessProductsProps} />
99
222
  </>
100
223
  )
@@ -1,20 +1,31 @@
1
1
  import React from 'react'
2
- import { BusinessesListing } from '../../../src/components/BusinessesListing'
3
- import { useEvent } from 'ordering-components-external'
2
+ import { BusinessesListing } from '../../../src/themes/five/src/components/BusinessesListing'
3
+ import { useEvent, useSite } from 'ordering-components-external'
4
4
  import { HelmetTags } from '../../components/HelmetTags'
5
+ import settings from '../../config'
6
+ import { checkSiteUrl } from '../../Utils'
5
7
 
6
8
  export const BusinessesList = (props) => {
7
9
  const [events] = useEvent()
8
- const currentPageParam = window.location.search.split('page=')[1]
10
+ const [{ site }] = useSite()
11
+
12
+ const businessUrlTemplate = checkSiteUrl(site?.business_url_template, '/store/:business_slug')
13
+
9
14
  const businessListingProps = {
10
15
  ...props,
11
16
  isSearchByName: true,
12
17
  isSearchByDescription: true,
18
+ franchiseId: settings?.franchiseSlug,
13
19
  onBusinessClick: (business) => {
14
- events.emit('go_to_page', { page: 'business', params: { store: business.slug } })
20
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
21
+ events.emit('go_to_page', { page: 'business', params: { business_slug: business.slug } })
22
+ } else {
23
+ events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${business.slug}` })
24
+ }
15
25
  },
16
- currentPageParam: parseInt(currentPageParam),
17
- propsToFetch: ['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug']
26
+ currentPageParam: 0,
27
+ propsToFetch: ['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug', 'city', 'city_id'],
28
+ onRedirectPage: (data) => events.emit('go_to_page', data),
18
29
  }
19
30
 
20
31
  return (
@@ -2,8 +2,11 @@ import React, { useState } from 'react'
2
2
  import { loadStripe } from '@stripe/stripe-js/pure'
3
3
  import { useParams, useLocation } from 'react-router-dom'
4
4
  import { HelmetTags } from '../../components/HelmetTags'
5
- import { Checkout } from '../../../src/components/Checkout'
6
- import { useEvent, useOrder, useLanguage } from 'ordering-components-external'
5
+
6
+ import { Checkout } from '../../../src/themes/five/src/components/Checkout'
7
+ import { useEvent, useOrder, useLanguage, useSite } from 'ordering-components-external'
8
+ import settings from '../../config'
9
+ import { checkSiteUrl } from '../../Utils'
7
10
 
8
11
  export const CheckoutPage = (props) => {
9
12
  const { cartUuid } = useParams()
@@ -11,7 +14,9 @@ export const CheckoutPage = (props) => {
11
14
  const [errors, setErrors] = useState([])
12
15
  const [orderState, { confirmCart, changeMoment }] = useOrder()
13
16
  const [, t] = useLanguage()
17
+ const [{ site }] = useSite()
14
18
  const stripePayments = ['stripe', 'stripe_connect', 'stripe_direct', 'google_pay', 'apple_pay']
19
+ const businessUrlTemplate = checkSiteUrl(site?.business_url_template, '/store/:business_slug')
15
20
 
16
21
  const useQuery = () => {
17
22
  return new URLSearchParams(useLocation().search)
@@ -95,6 +100,7 @@ export const CheckoutPage = (props) => {
95
100
  clearErrors: () => setErrors([]),
96
101
  useValidationFields: true,
97
102
  validationFieldsType: 'checkout',
103
+ useKioskApp: settings?.use_kiosk,
98
104
  onPlaceOrderClick: (data, paymethod, cart) => {
99
105
  if (cart?.order?.uuid) {
100
106
  if (orderState?.options?.moment) {
@@ -115,8 +121,12 @@ export const CheckoutPage = (props) => {
115
121
  handleCheckoutListRedirect: () => {
116
122
  events.emit('go_to_page', { page: 'checkout_list' })
117
123
  },
118
- handleStoreRedirect: (store) => {
119
- events.emit('go_to_page', { page: 'business', params: { store } })
124
+ handleStoreRedirect: (slug) => {
125
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
126
+ events.emit('go_to_page', { page: 'business', params: { business_slug: slug } })
127
+ } else {
128
+ events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${slug}` })
129
+ }
120
130
  }
121
131
  }
122
132
  return (
@@ -0,0 +1,12 @@
1
+ import React from 'react'
2
+ import { Favorite as FavoriteController } from '../../../src/themes/five/src/components/Favorite'
3
+ import { HelmetTags } from '../../components/HelmetTags'
4
+
5
+ export const Favorite = (props) => {
6
+ return (
7
+ <>
8
+ <HelmetTags page='favorite' />
9
+ <FavoriteController {...props} />
10
+ </>
11
+ )
12
+ }
@@ -1,12 +1,17 @@
1
1
  import React from 'react'
2
- import { Help as HelpController } from '../../../src/components/Help'
2
+ import { Help as HelpController } from '../../../src/themes/five/src/components/Help'
3
3
  import { HelmetTags } from '../../components/HelmetTags'
4
+ import settings from '../../config'
4
5
 
5
6
  export const Help = (props) => {
7
+ const helpProps = {
8
+ ...props,
9
+ franchiseId: settings?.franchiseSlug
10
+ }
6
11
  return (
7
12
  <>
8
13
  <HelmetTags page='help' />
9
- <HelpController {...props} />
14
+ <HelpController {...helpProps} />
10
15
  </>
11
16
  )
12
17
  }
@@ -1,9 +1,11 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, useApi } from 'ordering-components-external'
3
- import { HomeHero } from '../../../src/components/HomeHero'
2
+ import { useApi, useEvent, useSite } from 'ordering-components-external'
3
+ import { HomeHero } from '../../../src/themes/five/src/components/HomeHero'
4
+ import { KioskHomeHero } from '../../../src/themes/five/src/components/HomeHero/layouts/KioskHomeHero'
4
5
  import { useHistory } from 'react-router-dom'
5
6
  import { HelmetTags } from '../../components/HelmetTags'
6
7
  import Skeleton from 'react-loading-skeleton'
8
+ import settings from '../../config'
7
9
 
8
10
  import {
9
11
  HomeContainer,
@@ -13,23 +15,37 @@ import {
13
15
  SkeletonInformation,
14
16
  SkeletonSide
15
17
  } from './styles'
18
+ import { checkSiteUrl } from '../../Utils'
16
19
 
17
20
  export const HomePage = (props) => {
18
21
  const history = useHistory()
19
22
  const [homeState, setHomeState] = useState({ body: null, loading: false, error: null })
20
23
  const [ordering] = useApi()
24
+ const [events] = useEvent()
25
+ const [{ site }] = useSite()
26
+
21
27
  const requestsState = {}
28
+ const isKioskApp = settings?.use_kiosk
29
+ const businessUrlTemplate = checkSiteUrl(site?.business_url_template, '/store/:business_slug')
22
30
 
23
31
  const handlerFindBusiness = () => {
24
32
  history.push('/search')
25
33
  }
26
34
 
35
+ const handleGoToBusiness = () => {
36
+ if (businessUrlTemplate === '/store/:business_slug' || businessUrlTemplate === '/:business_slug') {
37
+ events.emit('go_to_page', { page: 'business', params: { business_slug: settings?.businessSlug } })
38
+ } else {
39
+ events.emit('go_to_page', { page: 'business', search: `?${businessUrlTemplate.split('?')[1].replace(':business_slug', '')}${settings?.businessSlug}` })
40
+ }
41
+ }
42
+
27
43
  const getPage = async () => {
28
44
  setHomeState({ ...homeState, loading: true })
29
45
  try {
30
46
  const source = {}
31
47
  requestsState.page = source
32
- const { content: { error, result } } = await ordering.pages('orderingHome').get({ cancelToken: source })
48
+ const { content: { error, result } } = await ordering.pages('originalHomeContent').get({ cancelToken: source })
33
49
  setHomeState({ ...homeState, loading: false })
34
50
  if (!error) {
35
51
  setHomeState({ ...homeState, body: result.body })
@@ -44,7 +60,9 @@ export const HomePage = (props) => {
44
60
  }
45
61
 
46
62
  useEffect(() => {
47
- getPage()
63
+ if (!isKioskApp) {
64
+ getPage()
65
+ }
48
66
  return () => {
49
67
  if (requestsState.page) {
50
68
  requestsState.page.cancel()
@@ -60,39 +78,43 @@ export const HomePage = (props) => {
60
78
  return (
61
79
  <>
62
80
  <HelmetTags page='home' />
63
- <HomeContainer>
64
- <HomeHero
65
- {...homeHeroProps}
66
- />
67
- {
68
- homeState.loading && (
69
- <SkeletonContainer>
70
- <SkeletonHeader>
71
- <Skeleton width='100%' height='100%' />
72
- </SkeletonHeader>
73
- <SkeletonContent>
74
- <SkeletonInformation>
75
- <Skeleton width='100%' height='100px' />
76
- <Skeleton width='100%' height='100px' />
77
- <Skeleton width='100%' height='100px' />
78
- <Skeleton width='100%' height='100px' />
79
- </SkeletonInformation>
80
- <SkeletonSide>
81
+ {isKioskApp ? (
82
+ <KioskHomeHero handleGoToBusiness={handleGoToBusiness} />
83
+ ) : (
84
+ <HomeContainer>
85
+ <HomeHero
86
+ {...homeHeroProps}
87
+ />
88
+ {
89
+ homeState.loading && (
90
+ <SkeletonContainer>
91
+ <SkeletonHeader>
81
92
  <Skeleton width='100%' height='100%' />
82
- </SkeletonSide>
83
- </SkeletonContent>
84
- </SkeletonContainer>
85
- )
86
- }
87
- {
88
- homeState.body && (
89
- <div dangerouslySetInnerHTML={{
90
- __html: homeState.body
91
- }}
92
- />
93
- )
94
- }
95
- </HomeContainer>
93
+ </SkeletonHeader>
94
+ <SkeletonContent>
95
+ <SkeletonInformation>
96
+ <Skeleton width='100%' height='100px' />
97
+ <Skeleton width='100%' height='100px' />
98
+ <Skeleton width='100%' height='100px' />
99
+ <Skeleton width='100%' height='100px' />
100
+ </SkeletonInformation>
101
+ <SkeletonSide>
102
+ <Skeleton width='100%' height='100%' />
103
+ </SkeletonSide>
104
+ </SkeletonContent>
105
+ </SkeletonContainer>
106
+ )
107
+ }
108
+ {
109
+ homeState.body && (
110
+ <div dangerouslySetInnerHTML={{
111
+ __html: homeState.body
112
+ }}
113
+ />
114
+ )
115
+ }
116
+ </HomeContainer>
117
+ )}
96
118
  </>
97
119
  )
98
120
  }
@@ -10,17 +10,21 @@ export const HomeSection = styled.div`
10
10
  width: 100%;
11
11
  box-sizing: border-box;
12
12
  background: #FFF;
13
+
13
14
  flex-direction: column;
14
15
  padding: 0px 10px 20px;
15
16
  &.reverse {
16
17
  flex-direction: column-reverse;
17
18
  }
19
+
18
20
  ${({ column }) => column && css`
19
21
  flex-direction: column;
20
22
  `}
23
+
21
24
  ${({ bgColor }) => bgColor && css`
22
25
  background: ${bgColor};
23
26
  `}
27
+
24
28
  ${({ bgimage }) => bgimage && css`
25
29
  background-image: linear-gradient(
26
30
  rgba(0, 0, 0, 0.5),
@@ -35,6 +39,7 @@ export const HomeSection = styled.div`
35
39
  justify-content: center;
36
40
  align-items: center;
37
41
  `}
42
+
38
43
  @media (min-width: 943px) {
39
44
  padding: 0px 50px 20px;
40
45
  flex-direction: ${({ column }) => column ? 'column' : 'row'};
@@ -136,6 +141,7 @@ export const TextContent = styled.div`
136
141
  justify-content: center;
137
142
  width: 100%;
138
143
  text-align: center;
144
+
139
145
  div {
140
146
  text-align: left;
141
147
  margin-top: 25px;
@@ -143,9 +149,11 @@ export const TextContent = styled.div`
143
149
  color: ${props => props.theme.colors.primary};
144
150
  }
145
151
  }
152
+
146
153
  h2 {
147
154
  font-size: 24px;
148
155
  }
156
+
149
157
  &.center {
150
158
  display: flex;
151
159
  flex-direction: column;
@@ -153,11 +161,13 @@ export const TextContent = styled.div`
153
161
  align-items: center;
154
162
  height: 100%;
155
163
  width: 100%;
164
+
156
165
  h2 {
157
166
  font-size: 24px;
158
167
  color: #FFF;
159
168
  text-align: center;
160
169
  }
170
+
161
171
  div {
162
172
  display: flex;
163
173
  flex-direction: column;
@@ -165,14 +175,17 @@ export const TextContent = styled.div`
165
175
  align-items: center;
166
176
  height: 100%;
167
177
  }
178
+
168
179
  button {
169
180
  width: 122px;
170
181
  }
171
182
  }
183
+
172
184
  @media (min-width: 943px) {
173
185
  width: 50%;
174
186
  text-align: left;
175
187
  }
188
+
176
189
  @media (min-width: 481px) {
177
190
  div {
178
191
  ${props => props.theme?.rtl && css`
@@ -195,6 +208,7 @@ export const Icons = styled.div`
195
208
  `
196
209
  export const HomeFooter = styled.div`
197
210
  font: normal normal normal 128px/160px ${props => props.theme.fonts.special || 'Georgia'};
211
+
198
212
  @media (min-width: 768px) {
199
213
  h2 {
200
214
  font-size: 50px !important;
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+ import { MessagesListing } from '../../../src/themes/five/src/components/MessagesListing'
3
+
4
+ import { HelmetTags } from '../../components/HelmetTags'
5
+ import { useEvent } from 'ordering-components-external'
6
+
7
+ export const MessagesList = (props) => {
8
+ const [events] = useEvent()
9
+ const messageprops = {
10
+ ...props,
11
+ onRedirectPage: (data) => events.emit('go_to_page', data)
12
+ }
13
+ return (
14
+ <>
15
+ <HelmetTags page='messages' />
16
+ <MessagesListing {...messageprops} />
17
+ </>
18
+ )
19
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react'
2
+ import { useHistory } from 'react-router-dom'
3
+ import { MultiCheckout as MultiCheckoutController } from '../../../src/themes/five/src/components/MultiCheckout'
4
+ import { HelmetTags } from '../../components/HelmetTags'
5
+ import { useEvent } from 'ordering-components-external'
6
+
7
+ export const MultiCheckout = (props) => {
8
+ const [events] = useEvent()
9
+ const history = useHistory()
10
+ const multiCheckoutProps = {
11
+ ...props,
12
+ onRedirectPage: (data) => events.emit('go_to_page', data),
13
+ onPlaceOrderClick: (orderUuids) => {
14
+ history.push({
15
+ pathname: '/multi-orders',
16
+ orderUuids
17
+ })
18
+ }
19
+ }
20
+ return (
21
+ <>
22
+ <HelmetTags page='multi_checkout' />
23
+ <MultiCheckoutController {...multiCheckoutProps} />
24
+ </>
25
+ )
26
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+ import { useLocation } from 'react-router-dom'
3
+ import { MultiOrdersDetails as MultiOrdersDetailsController } from '../../../src/themes/five/src/components/MultiOrdersDetails'
4
+ import { HelmetTags } from '../../components/HelmetTags'
5
+ import { useEvent } from 'ordering-components-external'
6
+
7
+ export const MultiOrdersDetails = (props) => {
8
+ const [events] = useEvent()
9
+ const { orderUuids } = useLocation()
10
+ const multiOrdersDetailsProps = {
11
+ ...props,
12
+ orderUuids: orderUuids || [],
13
+ onRedirectPage: () => events.emit('go_to_page', { page: 'search' })
14
+ }
15
+ return (
16
+ <>
17
+ <HelmetTags page='multi_orders' />
18
+ <MultiOrdersDetailsController {...multiOrdersDetailsProps} />
19
+ </>
20
+ )
21
+ }