ordering-ui-external 1.7.2 → 1.8.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 (171) hide show
  1. package/_bundles/{0.ordering-ui.f9c3deec77a8e21645ed.js → 0.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
  2. package/_bundles/{1.ordering-ui.f9c3deec77a8e21645ed.js → 1.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
  3. package/_bundles/2.ordering-ui.a7de4e953ec3c5879d9b.js +1 -0
  4. package/_bundles/{4.ordering-ui.f9c3deec77a8e21645ed.js → 4.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
  5. package/_bundles/{5.ordering-ui.f9c3deec77a8e21645ed.js → 5.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
  6. package/_bundles/{6.ordering-ui.f9c3deec77a8e21645ed.js → 6.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
  7. package/_bundles/{7.ordering-ui.f9c3deec77a8e21645ed.js → 7.ordering-ui.a7de4e953ec3c5879d9b.js} +2 -2
  8. package/_bundles/{7.ordering-ui.f9c3deec77a8e21645ed.js.LICENSE.txt → 7.ordering-ui.a7de4e953ec3c5879d9b.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.f9c3deec77a8e21645ed.js → 8.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
  10. package/_bundles/{9.ordering-ui.f9c3deec77a8e21645ed.js → 9.ordering-ui.a7de4e953ec3c5879d9b.js} +1 -1
  11. package/_bundles/ordering-ui.a7de4e953ec3c5879d9b.js +2 -0
  12. package/_bundles/{ordering-ui.f9c3deec77a8e21645ed.js.LICENSE.txt → ordering-ui.a7de4e953ec3c5879d9b.js.LICENSE.txt} +0 -0
  13. package/_modules/components/BusinessInformation/index.js +4 -8
  14. package/_modules/components/OrdersOption/styles.js +4 -2
  15. package/_modules/components/Pagination/index.js +100 -0
  16. package/_modules/components/Pagination/styles.js +56 -0
  17. package/_modules/components/SmartAppBanner/index.js +2 -1
  18. package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +92 -0
  19. package/_modules/components/VerticalOrdersLayout/index.js +115 -41
  20. package/_modules/components/VerticalOrdersLayout/styles.js +25 -11
  21. package/_modules/index.js +7 -0
  22. package/_modules/themes/five/src/components/AccordionDropdown/index.js +15 -4
  23. package/_modules/themes/five/src/components/AccordionDropdown/styles.js +14 -4
  24. package/_modules/themes/five/src/components/AddressList/styles.js +2 -2
  25. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +17 -10
  26. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +48 -42
  27. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +5 -1
  28. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +0 -3
  29. package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/index.js +22 -13
  30. package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +15 -7
  31. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +3 -0
  32. package/_modules/themes/five/src/components/BusinessTypeFilter/index.js +15 -5
  33. package/_modules/themes/five/src/components/BusinessesListing/index.js +6 -13
  34. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +66 -40
  35. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +13 -7
  36. package/_modules/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/index.js +16 -7
  37. package/_modules/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/styles.js +21 -15
  38. package/_modules/themes/five/src/components/CardForm/index.js +17 -3
  39. package/_modules/themes/five/src/components/CardForm/styles.js +14 -6
  40. package/_modules/themes/five/src/components/CartPopover/index.js +6 -4
  41. package/_modules/themes/five/src/components/CartPopover/styles.js +4 -2
  42. package/_modules/themes/five/src/components/Footer/index.js +16 -6
  43. package/_modules/themes/five/src/components/Footer/styles.js +11 -9
  44. package/_modules/themes/five/src/components/Header/index.js +14 -9
  45. package/_modules/themes/five/src/components/Header/styles.js +64 -44
  46. package/_modules/themes/five/src/components/HeaderOption/index.js +9 -2
  47. package/_modules/themes/five/src/components/HeaderOption/styles.js +8 -2
  48. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +9 -3
  49. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +5 -3
  50. package/_modules/themes/five/src/components/HorizontalOrdersLayout/index.js +9 -19
  51. package/_modules/themes/five/src/components/HorizontalOrdersLayout/styles.js +23 -19
  52. package/_modules/themes/five/src/components/InputPhoneNumber/index.js +1 -0
  53. package/_modules/themes/five/src/components/LoginForm/index.js +3 -2
  54. package/_modules/themes/five/src/components/MyOrders/index.js +24 -56
  55. package/_modules/themes/five/src/components/MyOrders/styles.js +1 -1
  56. package/_modules/themes/five/src/components/OrderDetails/index.js +5 -2
  57. package/_modules/themes/five/src/components/OrderDetails/styles.js +24 -24
  58. package/_modules/themes/five/src/components/OrderItAgain/styles.js +6 -2
  59. package/_modules/themes/five/src/components/OrdersOption/index.js +18 -18
  60. package/_modules/themes/five/src/components/OrdersOption/styles.js +2 -2
  61. package/_modules/themes/five/src/components/PageBanner/index.js +50 -0
  62. package/_modules/themes/five/src/components/PageBanner/styles.js +18 -0
  63. package/_modules/themes/five/src/components/Pagination/index.js +99 -0
  64. package/_modules/themes/five/src/components/Pagination/styles.js +56 -0
  65. package/_modules/themes/five/src/components/ProductForm/index.js +39 -23
  66. package/_modules/themes/five/src/components/ProductForm/styles.js +74 -38
  67. package/_modules/themes/five/src/components/Promotions/index.js +7 -2
  68. package/_modules/themes/five/src/components/Promotions/styles.js +16 -14
  69. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +31 -10
  70. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +19 -11
  71. package/_modules/themes/five/src/components/SidebarMenu/styles.js +1 -1
  72. package/_modules/themes/five/src/components/SignUpForm/index.js +3 -2
  73. package/_modules/themes/five/src/components/SingleOrderCard/index.js +7 -17
  74. package/_modules/themes/five/src/components/SingleProductCard/index.js +7 -298
  75. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +310 -0
  76. package/_modules/themes/five/src/components/SingleProductCard/{styles.js → layouts/original/styles.js} +36 -32
  77. package/_modules/themes/five/src/components/SingleProductCard/layouts/starbucks/index.js +305 -0
  78. package/_modules/themes/five/src/components/SingleProductCard/layouts/starbucks/styles.js +143 -0
  79. package/_modules/themes/five/src/components/StripeElementsForm/index.js +1 -0
  80. package/_modules/themes/five/src/components/UserPopover/index.js +3 -1
  81. package/_modules/themes/five/src/components/UserPopover/styles.js +4 -3
  82. package/_modules/themes/five/src/components/UserProfileForm/styles.js +5 -8
  83. package/_modules/themes/six/src/components/BusinessController/index.js +81 -15
  84. package/_modules/themes/six/src/components/BusinessController/styles.js +58 -30
  85. package/_modules/themes/six/src/components/BusinessProductsListing/SearchProducts/index.js +5 -3
  86. package/_modules/themes/six/src/components/BusinessesMap/styles.js +1 -1
  87. package/_modules/themes/six/src/components/SearchBar/index.js +19 -10
  88. package/_modules/themes/six/src/components/SearchBar/styles.js +44 -16
  89. package/index-template.js +3 -1
  90. package/package.json +2 -2
  91. package/src/components/BusinessInformation/index.js +3 -8
  92. package/src/components/OrdersOption/styles.js +5 -5
  93. package/src/components/Pagination/index.js +107 -0
  94. package/src/components/Pagination/styles.js +106 -0
  95. package/src/components/SmartAppBanner/index.js +1 -0
  96. package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +89 -0
  97. package/src/components/VerticalOrdersLayout/index.js +86 -48
  98. package/src/components/VerticalOrdersLayout/styles.js +66 -22
  99. package/src/index.js +2 -0
  100. package/src/themes/five/src/components/AccordionDropdown/index.js +19 -6
  101. package/src/themes/five/src/components/AccordionDropdown/styles.js +25 -1
  102. package/src/themes/five/src/components/AddressList/styles.js +2 -0
  103. package/src/themes/five/src/components/BusinessBasicInformation/index.js +21 -11
  104. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +9 -3
  105. package/src/themes/five/src/components/BusinessListingSearch/index.js +1 -0
  106. package/src/themes/five/src/components/BusinessProductsCategories/index.js +0 -2
  107. package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/index.js +23 -12
  108. package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +12 -4
  109. package/src/themes/five/src/components/BusinessProductsListing/index.js +3 -0
  110. package/src/themes/five/src/components/BusinessTypeFilter/index.js +15 -5
  111. package/src/themes/five/src/components/BusinessesListing/index.js +5 -5
  112. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +54 -25
  113. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +40 -26
  114. package/src/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/index.js +19 -6
  115. package/src/themes/five/src/components/BusinessesListing/layouts/StarbucksBusinessesListing/styles.js +38 -3
  116. package/src/themes/five/src/components/CardForm/index.js +49 -8
  117. package/src/themes/five/src/components/CardForm/styles.js +20 -2
  118. package/src/themes/five/src/components/CartPopover/index.js +2 -1
  119. package/src/themes/five/src/components/CartPopover/styles.js +3 -3
  120. package/src/themes/five/src/components/Footer/index.js +15 -6
  121. package/src/themes/five/src/components/Footer/styles.js +15 -14
  122. package/src/themes/five/src/components/Header/index.js +6 -4
  123. package/src/themes/five/src/components/Header/styles.js +14 -11
  124. package/src/themes/five/src/components/HeaderOption/index.js +13 -10
  125. package/src/themes/five/src/components/HeaderOption/styles.js +2 -2
  126. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +22 -10
  127. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +8 -0
  128. package/src/themes/five/src/components/HorizontalOrdersLayout/index.js +24 -36
  129. package/src/themes/five/src/components/HorizontalOrdersLayout/styles.js +12 -1
  130. package/src/themes/five/src/components/InputPhoneNumber/index.js +1 -0
  131. package/src/themes/five/src/components/LoginForm/index.js +2 -1
  132. package/src/themes/five/src/components/MyOrders/index.js +20 -62
  133. package/src/themes/five/src/components/MyOrders/styles.js +1 -2
  134. package/src/themes/five/src/components/OrderDetails/index.js +9 -0
  135. package/src/themes/five/src/components/OrderDetails/styles.js +0 -55
  136. package/src/themes/five/src/components/OrderItAgain/styles.js +18 -0
  137. package/src/themes/five/src/components/OrdersOption/index.js +10 -16
  138. package/src/themes/five/src/components/OrdersOption/styles.js +1 -3
  139. package/src/themes/five/src/components/PageBanner/index.js +58 -0
  140. package/src/themes/five/src/components/PageBanner/styles.js +58 -0
  141. package/src/themes/five/src/components/Pagination/index.js +106 -0
  142. package/src/themes/five/src/components/Pagination/styles.js +106 -0
  143. package/src/themes/five/src/components/ProductForm/index.js +108 -84
  144. package/src/themes/five/src/components/ProductForm/styles.js +94 -12
  145. package/src/themes/five/src/components/Promotions/index.js +22 -16
  146. package/src/themes/five/src/components/Promotions/styles.js +10 -4
  147. package/src/themes/five/src/components/RenderProductsLayout/index.js +94 -66
  148. package/src/themes/five/src/components/RenderProductsLayout/styles.js +23 -22
  149. package/src/themes/five/src/components/SidebarMenu/styles.js +1 -1
  150. package/src/themes/five/src/components/SignUpForm/index.js +2 -1
  151. package/src/themes/five/src/components/SingleOrderCard/index.js +0 -21
  152. package/src/themes/five/src/components/SingleProductCard/index.js +7 -300
  153. package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +312 -0
  154. package/src/themes/five/src/components/SingleProductCard/{styles.js → layouts/original/styles.js} +9 -5
  155. package/src/themes/five/src/components/SingleProductCard/layouts/starbucks/index.js +313 -0
  156. package/src/themes/five/src/components/SingleProductCard/layouts/starbucks/styles.js +353 -0
  157. package/src/themes/five/src/components/StripeElementsForm/index.js +1 -0
  158. package/src/themes/five/src/components/UserPopover/index.js +2 -0
  159. package/src/themes/five/src/components/UserPopover/styles.js +2 -2
  160. package/src/themes/five/src/components/UserProfileForm/styles.js +3 -11
  161. package/src/themes/six/src/components/BusinessController/index.js +163 -62
  162. package/src/themes/six/src/components/BusinessController/styles.js +53 -14
  163. package/src/themes/six/src/components/BusinessProductsListing/SearchProducts/index.js +3 -1
  164. package/src/themes/six/src/components/BusinessesMap/styles.js +1 -1
  165. package/src/themes/six/src/components/SearchBar/index.js +27 -8
  166. package/src/themes/six/src/components/SearchBar/styles.js +33 -2
  167. package/template/app.js +364 -364
  168. package/template/assets/images/chew_logo.png +0 -0
  169. package/template/components/HelmetTags/index.js +5 -4
  170. package/_bundles/2.ordering-ui.f9c3deec77a8e21645ed.js +0 -1
  171. package/_bundles/ordering-ui.f9c3deec77a8e21645ed.js +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -85,7 +85,7 @@
85
85
  "libphonenumber-js": "^1.9.4",
86
86
  "lodash": "^4.17.19",
87
87
  "moment": "^2.29.4",
88
- "ordering-components-external": "1.6.0",
88
+ "ordering-components-external": "1.7.0",
89
89
  "polished": "^3.6.6",
90
90
  "react-bootstrap-icons": "^1.7.2",
91
91
  "react-calendar": "^3.3.1",
@@ -75,12 +75,7 @@ export const BusinessInformationUI = (props) => {
75
75
  const [{ parsePrice, parseDistance }] = useUtils()
76
76
  const [modalImage, setModalImage] = useState(false)
77
77
  const [image, setImage] = useState('')
78
- const timeFormat = configs?.format_time?.value
79
-
80
- const timeOptions = {
81
- 12: 'hh:mm a',
82
- 24: 'HH:mm'
83
- }
78
+ const timeFormat = configs?.general_hour_format?.value
84
79
 
85
80
  const handleModalImage = (src) => {
86
81
  setImage(src)
@@ -218,12 +213,12 @@ export const BusinessInformationUI = (props) => {
218
213
  {schedule.enabled ? (
219
214
  schedule.lapses.map((time, k) => (
220
215
  <React.Fragment key={k}>
221
- <p>{moment(time.open).format(timeOptions[timeFormat])}</p>
216
+ <p>{moment(time.open).format(timeFormat)}</p>
222
217
  <p style={{
223
218
  borderBottom: '2px solid',
224
219
  borderBottomColor: theme.colors.primary,
225
220
  marginBottom: 10
226
- }} >{moment(time.close).format(timeOptions[timeFormat])}</p>
221
+ }} >{moment(time.close).format(timeFormat)}</p>
227
222
  </React.Fragment>
228
223
  ))
229
224
  ) : (
@@ -100,7 +100,7 @@ export const OrdersContainer = styled.div`
100
100
  }
101
101
 
102
102
  @media(min-width: 480px){
103
- width: 80%;
103
+ width: 100%;
104
104
  padding: 0;
105
105
  div:last-child {
106
106
  border-top: none;
@@ -275,7 +275,6 @@ export const BusinessInformation = styled.div`
275
275
  }
276
276
 
277
277
  p[name='order_number']{
278
- width: 170px;
279
278
  overflow: hidden;
280
279
  text-overflow: ellipsis;
281
280
  white-space: nowrap;
@@ -288,6 +287,10 @@ export const BusinessInformation = styled.div`
288
287
  width: fit-content;
289
288
  }
290
289
 
290
+ .status {
291
+ color: ${props => props.theme.colors.primary};
292
+ }
293
+
291
294
  @media (min-width: 480px){
292
295
  h2 {
293
296
  font-size: 14px;
@@ -299,9 +302,6 @@ export const BusinessInformation = styled.div`
299
302
  font-size: 0.9em;
300
303
  `}
301
304
  }
302
- p[name='order_number']{
303
- width: 230px;
304
- }
305
305
  }
306
306
 
307
307
  @media (min-width: 768px){
@@ -0,0 +1,107 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage } from 'ordering-components-external'
3
+ import { Select } from '../../themes/five/src/styles/Select'
4
+ import { ChevronLeft, ChevronRight } from 'react-bootstrap-icons'
5
+
6
+ import {
7
+ PaginationContainer,
8
+ PaginationButtonContainer,
9
+ PageButton,
10
+ } from './styles'
11
+
12
+ export const Pagination = (props) => {
13
+ const {
14
+ currentPage,
15
+ totalPages,
16
+ handleChangePage,
17
+ } = props
18
+
19
+ const [, t] = useLanguage()
20
+
21
+ const [visiblePages, setVisiblePages] = useState([])
22
+ const [activePage, setActivePage] = useState(currentPage)
23
+
24
+ const filterPages = (visiblePages, totalPages) => {
25
+ return visiblePages.filter(page => page <= totalPages)
26
+ }
27
+
28
+ const getVisiblePages = (page, total) => {
29
+ if (total < 7) {
30
+ return filterPages([1, 2, 3, 4, 5, 6], total)
31
+ } else {
32
+ if (page % 5 >= 0 && page > 4 && page + 2 < total) {
33
+ return [1, page - 1, page, page + 1, total]
34
+ } else if (page % 5 >= 0 && page > 4 && page + 2 >= total) {
35
+ return [1, total - 3, total - 2, total - 1, total]
36
+ } else {
37
+ return [1, 2, 3, 4, 5, total]
38
+ }
39
+ }
40
+ }
41
+
42
+ const changePage = (page) => {
43
+ if (page === activePage) {
44
+ return
45
+ }
46
+ setActivePage(page)
47
+ const _visiblePages = getVisiblePages(page, totalPages)
48
+ setVisiblePages(filterPages(_visiblePages, totalPages))
49
+ handleChangePage(page)
50
+ }
51
+
52
+ useEffect(() => {
53
+ if (!totalPages) return
54
+ setVisiblePages(getVisiblePages(null, totalPages))
55
+ }, [totalPages])
56
+
57
+ useEffect(() => {
58
+ setActivePage(currentPage)
59
+ const _visiblePages = getVisiblePages(currentPage, totalPages)
60
+ setVisiblePages(filterPages(_visiblePages, totalPages))
61
+ }, [currentPage])
62
+
63
+ return (
64
+ <PaginationContainer>
65
+ <PaginationButtonContainer>
66
+ <PageButton
67
+ disabled={activePage === 1}
68
+ onClick={() => (activePage !== 1) && changePage(activePage - 1)}
69
+ >
70
+ <ChevronLeft />
71
+ </PageButton>
72
+
73
+ {visiblePages.map((page, index, array) => (
74
+ <React.Fragment key={page}>
75
+ {array[index - 1] + 2 <= page ? (
76
+ <>
77
+ <PageButton noEffect>
78
+ ...
79
+ </PageButton>
80
+ <PageButton
81
+ active={activePage === page}
82
+ onClick={() => changePage(page)}
83
+ >
84
+ {page}
85
+ </PageButton>
86
+ </>
87
+ ) : (
88
+ <PageButton
89
+ active={activePage === page}
90
+ onClick={() => changePage(page)}
91
+ >
92
+ {page}
93
+ </PageButton>
94
+ )}
95
+ </React.Fragment>
96
+ ))}
97
+
98
+ <PageButton
99
+ disabled={activePage === totalPages}
100
+ onClick={() => (activePage !== totalPages) && changePage(activePage + 1)}
101
+ >
102
+ <ChevronRight />
103
+ </PageButton>
104
+ </PaginationButtonContainer>
105
+ </PaginationContainer>
106
+ )
107
+ }
@@ -0,0 +1,106 @@
1
+ import styled, { css } from 'styled-components'
2
+ import { darken } from 'polished'
3
+
4
+ export const PaginationContainer = styled.div`
5
+ display: flex;
6
+ flex-wrap: wrap;
7
+ align-items: center;
8
+ justify-content: flex-end;
9
+ `
10
+
11
+ export const PaginationButtonContainer = styled.div`
12
+ display: flex;
13
+ align-items: center;
14
+ ${props => props.theme?.rtl ? css`
15
+ margin-left: 20px;
16
+ ` : css`
17
+ margin-right: 20px;
18
+ `}
19
+ `
20
+
21
+ export const PageButton = styled.button`
22
+ background-color: transparent;
23
+ font-size: 14px;
24
+ color: ${props => props.theme.colors.headingColor};
25
+ outline: none;
26
+ border: none;
27
+ border-radius: 27px;
28
+ min-width: 27px;
29
+ min-height: 27px;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ padding: 0px 7px;
34
+
35
+ ${props => props.theme?.rtl ? css`
36
+ margin-left: 3px;
37
+ ` : css`
38
+ margin-right: 3px;
39
+ `}
40
+
41
+ &:hover {
42
+ background-color: #1507260a;
43
+ }
44
+
45
+ &:disabled {
46
+ cursor: not-allowed;
47
+ opacity: 0.5;
48
+ }
49
+
50
+ &:active {
51
+ background-color: #1507261a;
52
+ }
53
+
54
+ ${({ active }) => active && css`
55
+ background-color: ${props => props.theme.colors.primary};
56
+ color: ${props => props.theme.colors.primaryContrast};
57
+ &:hover {
58
+ background: ${props => darken(0.04, props.theme.colors.primary)};
59
+ }
60
+ &:active {
61
+ background: ${props => darken(0.1, props.theme.colors.primary)};
62
+ }
63
+ `}
64
+
65
+ ${({ noEffect }) => noEffect && css`
66
+ cursor: initial;
67
+ &:hover {
68
+ background-color: transparent;
69
+ }
70
+ &:active {
71
+ background-color: transparent;
72
+ }
73
+ `}
74
+ `
75
+
76
+ export const PageSizeContainer = styled.div`
77
+ display: flex;
78
+ align-items: center;
79
+ margin: 10px 0;
80
+
81
+ .select {
82
+ border-color: ${props => props.theme.colors.lightGray};
83
+ padding: 5px 0;
84
+
85
+ > div:first-child {
86
+ padding-left: 10px;
87
+ padding-right: 10px;
88
+ }
89
+ }
90
+ `
91
+
92
+ export const PageSizeTitle = styled.p`
93
+ margin: 0px;
94
+ color: ${props => props.theme.colors.lightGray};
95
+ font-size: 12px;
96
+ ${props => props.theme?.rtl ? css`
97
+ margin-left: 10px;
98
+ ` : css`
99
+ margin-right: 10px;
100
+ `}
101
+ `
102
+
103
+ export const Option = styled.div`
104
+ font-size: 14px;
105
+ color: ${props => props.theme.colors.lightGray};
106
+ `
@@ -25,6 +25,7 @@ const SmartAppBanneUI = (props) => {
25
25
  windows: t('FREE', 'Free'),
26
26
  kindle: t('FREE', 'Free')
27
27
  }}
28
+ ignoreIosVersion
28
29
  />
29
30
  </>
30
31
  )
@@ -0,0 +1,89 @@
1
+ import React from 'react'
2
+ import { Heart as DisLike, HeartFill as Like } from 'react-bootstrap-icons'
3
+ import BsDot from '@meronex/icons/bs/BsDot'
4
+ import { BusinessInformation } from '../../OrdersOption/styles'
5
+ import { useLanguage, useUtils, SingleOrderCard as SingleOrderCardController } from 'ordering-components-external'
6
+ import { Button } from '../../../styles/Buttons'
7
+ import { useTheme } from 'styled-components'
8
+
9
+ import {
10
+ SingleCard,
11
+ OrderPastContent,
12
+ PastLogo,
13
+ WrapperBusinessTitle,
14
+ Reorder,
15
+ OrderInfo,
16
+ FavoriteWrapper
17
+ } from '../styles'
18
+
19
+ const SingleOrderCardUI = (props) => {
20
+ const {
21
+ order,
22
+ getOrderStatus,
23
+ handleReorder,
24
+ reorderLoading,
25
+ orderID,
26
+ handleFavoriteOrder,
27
+ setOrderSelected
28
+ } = props
29
+
30
+ const theme = useTheme()
31
+ const [, t] = useLanguage()
32
+ const [{ parseDate }] = useUtils()
33
+
34
+ const handleChangeFavorite = (order) => {
35
+ handleFavoriteOrder && handleFavoriteOrder(!order?.favorite)
36
+ }
37
+
38
+ return (
39
+ <SingleCard key={order.id} id='order-card'>
40
+ <OrderPastContent>
41
+ {(order.business?.logo || theme.images?.dummies?.businessLogo) && (
42
+ <PastLogo>
43
+ <img src={order.business?.logo || theme.images?.dummies?.businessLogo} alt='business-logo' width='55px' height='64px' loading='lazy' />
44
+ </PastLogo>
45
+ )}
46
+ <BusinessInformation>
47
+ <WrapperBusinessTitle>
48
+ <h2>{order.business?.name}</h2>
49
+ <FavoriteWrapper onClick={() => handleChangeFavorite(order)} className='favorite'>
50
+ {order?.favorite ? <Like /> : <DisLike />}
51
+ </FavoriteWrapper>
52
+ </WrapperBusinessTitle>
53
+ <OrderInfo>
54
+ {order?.id && (
55
+ <>
56
+ <p name='order_number'>{t('ORDER_NUM', 'Order No.')} {order.id}</p>
57
+ <BsDot className='dot' />
58
+ </>
59
+ )}
60
+ <p>{order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })}</p>
61
+ </OrderInfo>
62
+ <p className='status'>{getOrderStatus(order.status)?.value}</p>
63
+ </BusinessInformation>
64
+ </OrderPastContent>
65
+ <Reorder>
66
+ <Button
67
+ outline
68
+ disabled={!!order?.review}
69
+ color='primary'
70
+ className='review'
71
+ onClick={() => setOrderSelected(order)}
72
+ >
73
+ {!!order?.review ? t('REVIEWED', 'Reviewed') : t('REVIEW', 'Review')}
74
+ </Button>
75
+ <Button color='primary' className='reorder' outline onClick={() => handleReorder(order.id)}>
76
+ {orderID === order.id && reorderLoading ? t('LOADING', 'Loading...') : t('REORDER', 'Reorder')}
77
+ </Button>
78
+ </Reorder>
79
+ </SingleCard>
80
+ )
81
+ }
82
+
83
+ export const SingleOrderCard = (props) => {
84
+ const singleOrderCardProps = {
85
+ ...props,
86
+ UIComponent: SingleOrderCardUI
87
+ }
88
+ return <SingleOrderCardController {...singleOrderCardProps} />
89
+ }
@@ -1,34 +1,73 @@
1
- import React from 'react'
2
- import { useLanguage, useUtils } from 'ordering-components-external'
3
- import { useTheme } from 'styled-components'
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useLanguage } from 'ordering-components-external'
4
3
  import { Button } from '../../styles/Buttons'
5
4
 
6
5
  import {
7
- SingleCard,
8
- OrderPastContent,
9
- PastLogo,
10
- WrapperBusinessTitle,
11
- Reorder,
12
- WrappButton
6
+ WrappButton,
7
+ ReviewWrapper,
13
8
  } from './styles'
14
9
 
15
- import { OrdersContainer, BusinessInformation } from '../OrdersOption/styles'
10
+ import { OrdersContainer } from '../OrdersOption/styles'
11
+
12
+ import { ReviewOrder } from '../../themes/five/src/components/ReviewOrder'
13
+ import { ReviewProduct } from '../../themes/five/src/components/ReviewProduct'
14
+ import { ReviewDriver } from '../../themes/five/src/components/ReviewDriver'
15
+ import { Modal } from '../../themes/five/src/components/Modal'
16
+ import { SingleOrderCard } from './SingleOrderCard'
16
17
 
17
18
  export const VerticalOrdersLayout = (props) => {
18
19
  const {
19
20
  orders,
20
21
  pagination,
21
- onRedirectPage,
22
22
  loadMoreOrders,
23
- getOrderStatus,
24
- handleReorder,
25
- reorderLoading,
26
- orderID
23
+ handleUpdateOrderList
27
24
  } = props
28
25
 
29
- const theme = useTheme()
30
26
  const [, t] = useLanguage()
31
- const [{ parseDate }] = useUtils()
27
+ const [isReviewOpen, setIsReviewOpen] = useState(false)
28
+ const [reviewStatus, setReviewStatus] = useState({ order: false, product: false, driver: false })
29
+ const [isOrderReviewed, setIsOrderReviewed] = useState(false)
30
+ const [isProductReviewed, setIsProductReviewed] = useState(false)
31
+ const [isDriverReviewed, setIsDriverReviewed] = useState(false)
32
+ const [orderSelected, setOrderSelected] = useState({})
33
+
34
+ const closeReviewOrder = () => {
35
+ if (!isProductReviewed) setReviewStatus({ order: false, product: true, driver: false })
36
+ else if (orderSelected?.driver && !orderSelected?.user_review && !isDriverReviewed) setReviewStatus({ order: false, product: false, driver: true })
37
+ else handleCloseReivew()
38
+ }
39
+
40
+ const closeReviewProduct = () => {
41
+ if (orderSelected?.driver && !orderSelected?.user_review && !isDriverReviewed) setReviewStatus({ order: false, product: false, driver: true })
42
+ else {
43
+ setIsDriverReviewed(true)
44
+ handleCloseReivew()
45
+ }
46
+ }
47
+ const handleOpenReview = () => {
48
+ if (!orderSelected?.review && !isOrderReviewed) setReviewStatus({ order: true, product: false, driver: false })
49
+ else if (!isProductReviewed) setReviewStatus({ order: false, product: true, driver: false })
50
+ else if (orderSelected?.driver && !orderSelected?.user_review && !isDriverReviewed) setReviewStatus({ order: false, product: false, driver: true })
51
+ else {
52
+ setIsReviewOpen(false)
53
+ return
54
+ }
55
+ setIsReviewOpen(true)
56
+ }
57
+
58
+ const handleCloseReivew = () => {
59
+ setReviewStatus({ order: false, product: false, driver: false })
60
+ setIsReviewOpen(false)
61
+ }
62
+
63
+ const handleClickReview = (order) => {
64
+ handleOpenReview && handleOpenReview()
65
+ }
66
+
67
+ useEffect(() => {
68
+ if (!orderSelected?.id) return
69
+ handleClickReview()
70
+ }, [orderSelected])
32
71
 
33
72
  return (
34
73
  <>
@@ -42,37 +81,12 @@ export const VerticalOrdersLayout = (props) => {
42
81
  }
43
82
  <OrdersContainer id='orders-container'>
44
83
  {orders.map(order => (
45
- <SingleCard key={order.id} id='order-card'>
46
- <OrderPastContent>
47
- {(order.business?.logo || theme.images?.dummies?.businessLogo) && (
48
- <PastLogo>
49
- <img src={order.business?.logo || theme.images?.dummies?.businessLogo} alt='business-logo' width='55px' height='64px' loading='lazy' />
50
- </PastLogo>
51
- )}
52
- <BusinessInformation>
53
- <WrapperBusinessTitle>
54
- <h2>{order.business?.name}</h2>
55
- </WrapperBusinessTitle>
56
- <p>{order?.delivery_datetime_utc ? parseDate(order?.delivery_datetime_utc) : parseDate(order?.delivery_datetime, { utc: false })}</p>
57
- <p
58
- name='view_order'
59
- onClick={() => onRedirectPage({ page: 'order_detail', params: { orderId: order.uuid } })}
60
- >
61
- {t('MOBILE_FRONT_BUTTON_VIEW_ORDER', 'View order')}
62
- </p>
63
- </BusinessInformation>
64
- </OrderPastContent>
65
- <Reorder>
66
- <p>{getOrderStatus(order.status)?.value}</p>
67
- <Button
68
- color='primary'
69
- onClick={() => handleReorder(order.id)}
70
- disabled={reorderLoading}
71
- >
72
- {orderID === order.id && reorderLoading ? t('LOADING', 'Loading...') : t('REORDER', 'Reorder')}
73
- </Button>
74
- </Reorder>
75
- </SingleCard>
84
+ <SingleOrderCard
85
+ {...props}
86
+ key={order.id}
87
+ order={order}
88
+ setOrderSelected={setOrderSelected}
89
+ />
76
90
  ))}
77
91
  </OrdersContainer>
78
92
  {pagination.totalPages && pagination.currentPage < pagination.totalPages && (
@@ -87,6 +101,30 @@ export const VerticalOrdersLayout = (props) => {
87
101
  </Button>
88
102
  </WrappButton>
89
103
  )}
104
+ {isReviewOpen && (
105
+ <Modal
106
+ open={isReviewOpen}
107
+ onClose={handleCloseReivew}
108
+ title={orderSelected
109
+ ? (reviewStatus?.order
110
+ ? t('REVIEW_ORDER', 'Review order')
111
+ : (reviewStatus?.product
112
+ ? t('REVIEW_PRODUCT', 'Review Product')
113
+ : t('REVIEW_DRIVER', 'Review Driver')))
114
+ : t('LOADING', 'Loading...')}
115
+ >
116
+ <ReviewWrapper>
117
+ {
118
+ reviewStatus?.order
119
+ ? <ReviewOrder order={orderSelected} closeReviewOrder={closeReviewOrder} setIsReviewed={setIsOrderReviewed} handleUpdateOrderList={handleUpdateOrderList} />
120
+ : (reviewStatus?.product
121
+ ? <ReviewProduct order={orderSelected} closeReviewProduct={closeReviewProduct} setIsProductReviewed={setIsProductReviewed} />
122
+ : <ReviewDriver order={orderSelected} closeReviewDriver={handleCloseReivew} setIsDriverReviewed={setIsDriverReviewed} />)
123
+ }
124
+ </ReviewWrapper>
125
+
126
+ </Modal>
127
+ )}
90
128
  {props.afterComponents?.map((AfterComponent, i) => (
91
129
  <AfterComponent key={i} {...props} />))
92
130
  }