ordering-ui-external 2.4.6 → 2.5.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 (147) hide show
  1. package/_bundles/{0.ordering-ui.038c4b4d536032472bc7.js → 0.ordering-ui.5488030edb520175432d.js} +1 -1
  2. package/_bundles/{1.ordering-ui.038c4b4d536032472bc7.js → 1.ordering-ui.5488030edb520175432d.js} +1 -1
  3. package/_bundles/{2.ordering-ui.038c4b4d536032472bc7.js → 2.ordering-ui.5488030edb520175432d.js} +1 -1
  4. package/_bundles/{4.ordering-ui.038c4b4d536032472bc7.js → 4.ordering-ui.5488030edb520175432d.js} +1 -1
  5. package/_bundles/{5.ordering-ui.038c4b4d536032472bc7.js → 5.ordering-ui.5488030edb520175432d.js} +1 -1
  6. package/_bundles/{6.ordering-ui.038c4b4d536032472bc7.js → 6.ordering-ui.5488030edb520175432d.js} +1 -1
  7. package/_bundles/{7.ordering-ui.038c4b4d536032472bc7.js → 7.ordering-ui.5488030edb520175432d.js} +2 -2
  8. package/_bundles/{8.ordering-ui.038c4b4d536032472bc7.js → 8.ordering-ui.5488030edb520175432d.js} +1 -1
  9. package/_bundles/{9.ordering-ui.038c4b4d536032472bc7.js → 9.ordering-ui.5488030edb520175432d.js} +1 -1
  10. package/_bundles/ordering-ui.5488030edb520175432d.js +2 -0
  11. package/_modules/components/OrdersOption/styles.js +1 -1
  12. package/_modules/components/StripeMethodForm/index.js +26 -11
  13. package/_modules/components/VerticalOrdersLayout/SingleOrderCard/index.js +15 -8
  14. package/_modules/components/VerticalOrdersLayout/styles.js +2 -2
  15. package/_modules/contexts/ThemeContext/index.js +1 -0
  16. package/_modules/themes/five/src/components/AddressList/index.js +8 -7
  17. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +28 -22
  18. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +22 -21
  19. package/_modules/themes/five/src/components/BusinessController/index.js +5 -3
  20. package/_modules/themes/five/src/components/BusinessInformation/index.js +16 -10
  21. package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +5 -8
  22. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +93 -74
  23. package/_modules/themes/five/src/components/BusinessListingSearch/styles.js +10 -4
  24. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +7 -2
  25. package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
  26. package/_modules/themes/five/src/components/BusinessProductsList/index.js +1 -1
  27. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +38 -13
  28. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +20 -9
  29. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +35 -23
  30. package/_modules/themes/five/src/components/Cart/index.js +7 -3
  31. package/_modules/themes/five/src/components/Checkout/index.js +12 -11
  32. package/_modules/themes/five/src/components/Checkout/styles.js +8 -4
  33. package/_modules/themes/five/src/components/CitiesControl/index.js +1 -1
  34. package/_modules/themes/five/src/components/GiftCard/GiftCardUI/index.js +1 -0
  35. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +4 -3
  36. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +14 -8
  37. package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +1 -1
  38. package/_modules/themes/five/src/components/Header/index.js +29 -21
  39. package/_modules/themes/five/src/components/Header/styles.js +44 -40
  40. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +1 -1
  41. package/_modules/themes/five/src/components/MultiCartsPaymethodsAndWallets/index.js +36 -5
  42. package/_modules/themes/five/src/components/MultiCheckout/index.js +35 -6
  43. package/_modules/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +6 -4
  44. package/_modules/themes/five/src/components/MyOrders/index.js +16 -10
  45. package/_modules/themes/five/src/components/MyOrders/styles.js +15 -12
  46. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +4 -3
  47. package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +2 -2
  48. package/_modules/themes/five/src/components/OrderDetails/index.js +2 -2
  49. package/_modules/themes/five/src/components/OrderItAgain/styles.js +1 -1
  50. package/_modules/themes/five/src/components/OrderProgress/index.js +15 -4
  51. package/_modules/themes/five/src/components/OrderTypeSelectorContent/index.js +16 -4
  52. package/_modules/themes/five/src/components/PageBanner/styles.js +1 -1
  53. package/_modules/themes/five/src/components/PaymentOptions/index.js +8 -5
  54. package/_modules/themes/five/src/components/ProductForm/index.js +27 -7
  55. package/_modules/themes/five/src/components/ProductForm/styles.js +40 -31
  56. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +6 -6
  57. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -3
  58. package/_modules/themes/five/src/components/ReviewProduct/index.js +9 -4
  59. package/_modules/themes/five/src/components/ServiceForm/index.js +22 -3
  60. package/_modules/themes/five/src/components/ServiceForm/styles.js +9 -3
  61. package/_modules/themes/five/src/components/SidebarMenu/index.js +19 -10
  62. package/_modules/themes/five/src/components/SignUpForm/index.js +56 -29
  63. package/_modules/themes/five/src/components/SingleOrderCard/index.js +1 -1
  64. package/_modules/themes/five/src/components/SingleOrderCard/styles.js +26 -24
  65. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +9 -5
  66. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
  67. package/_modules/themes/five/src/components/StripeElementsForm/index.js +3 -1
  68. package/_modules/themes/five/src/components/UpsellingPage/index.js +2 -1
  69. package/_modules/themes/five/src/components/UserFormDetails/index.js +58 -18
  70. package/_modules/themes/five/src/components/UserFormDetails/styles.js +7 -3
  71. package/_modules/themes/five/src/components/UserPopover/index.js +41 -25
  72. package/_modules/themes/five/src/components/UserProfileForm/index.js +19 -11
  73. package/_modules/themes/five/src/styles/Buttons/index.js +68 -58
  74. package/_modules/themes/five/src/styles/Inputs/index.js +40 -16
  75. package/_modules/utils/index.js +8 -2
  76. package/index.html +1 -1
  77. package/package.json +3 -2
  78. package/src/components/OrdersOption/styles.js +1 -0
  79. package/src/components/StripeMethodForm/index.js +22 -10
  80. package/src/components/VerticalOrdersLayout/SingleOrderCard/index.js +35 -17
  81. package/src/components/VerticalOrdersLayout/styles.js +9 -0
  82. package/src/contexts/ThemeContext/index.js +1 -0
  83. package/src/themes/five/src/components/AddressList/index.js +6 -6
  84. package/src/themes/five/src/components/BusinessBasicInformation/index.js +24 -22
  85. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +24 -3
  86. package/src/themes/five/src/components/BusinessController/index.js +4 -2
  87. package/src/themes/five/src/components/BusinessInformation/index.js +24 -12
  88. package/src/themes/five/src/components/BusinessItemAccordion/index.js +5 -6
  89. package/src/themes/five/src/components/BusinessListingSearch/index.js +127 -101
  90. package/src/themes/five/src/components/BusinessListingSearch/styles.js +15 -0
  91. package/src/themes/five/src/components/BusinessProductsCategories/index.js +7 -2
  92. package/src/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
  93. package/src/themes/five/src/components/BusinessProductsList/index.js +1 -1
  94. package/src/themes/five/src/components/BusinessProductsListing/index.js +34 -9
  95. package/src/themes/five/src/components/BusinessProductsListing/styles.js +26 -0
  96. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +9 -2
  97. package/src/themes/five/src/components/Cart/index.js +3 -4
  98. package/src/themes/five/src/components/Checkout/index.js +18 -4
  99. package/src/themes/five/src/components/Checkout/styles.js +22 -0
  100. package/src/themes/five/src/components/CitiesControl/index.js +1 -1
  101. package/src/themes/five/src/components/GiftCard/GiftCardUI/index.js +1 -0
  102. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +41 -31
  103. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +15 -4
  104. package/src/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +2 -2
  105. package/src/themes/five/src/components/Header/index.js +17 -5
  106. package/src/themes/five/src/components/Header/styles.js +9 -6
  107. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +1 -1
  108. package/src/themes/five/src/components/MultiCartsPaymethodsAndWallets/index.js +83 -51
  109. package/src/themes/five/src/components/MultiCheckout/index.js +21 -6
  110. package/src/themes/five/src/components/MultiOrdersDetails/SingleOrderCard.js +8 -5
  111. package/src/themes/five/src/components/MyOrders/index.js +13 -9
  112. package/src/themes/five/src/components/MyOrders/styles.js +3 -1
  113. package/src/themes/five/src/components/OrderDetails/OrderEta.js +6 -3
  114. package/src/themes/five/src/components/OrderDetails/OrderHistory.js +8 -2
  115. package/src/themes/five/src/components/OrderDetails/index.js +2 -2
  116. package/src/themes/five/src/components/OrderItAgain/styles.js +1 -1
  117. package/src/themes/five/src/components/OrderProgress/index.js +16 -5
  118. package/src/themes/five/src/components/OrderTypeSelectorContent/index.js +7 -4
  119. package/src/themes/five/src/components/PageBanner/styles.js +1 -4
  120. package/src/themes/five/src/components/PaymentOptions/index.js +7 -4
  121. package/src/themes/five/src/components/ProductForm/index.js +23 -5
  122. package/src/themes/five/src/components/ProductForm/styles.js +36 -1
  123. package/src/themes/five/src/components/ProductItemAccordion/index.js +37 -29
  124. package/src/themes/five/src/components/RenderProductsLayout/index.js +3 -3
  125. package/src/themes/five/src/components/ReviewProduct/index.js +14 -6
  126. package/src/themes/five/src/components/ServiceForm/index.js +22 -4
  127. package/src/themes/five/src/components/ServiceForm/styles.js +16 -0
  128. package/src/themes/five/src/components/SidebarMenu/index.js +162 -144
  129. package/src/themes/five/src/components/SignUpForm/index.js +4 -3
  130. package/src/themes/five/src/components/SingleOrderCard/index.js +1 -1
  131. package/src/themes/five/src/components/SingleOrderCard/styles.js +9 -1
  132. package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +13 -3
  133. package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
  134. package/src/themes/five/src/components/StripeElementsForm/index.js +3 -1
  135. package/src/themes/five/src/components/UpsellingPage/index.js +1 -1
  136. package/src/themes/five/src/components/UserFormDetails/index.js +58 -14
  137. package/src/themes/five/src/components/UserFormDetails/styles.js +16 -0
  138. package/src/themes/five/src/components/UserPopover/index.js +26 -15
  139. package/src/themes/five/src/components/UserProfileForm/index.js +18 -9
  140. package/src/themes/five/src/styles/Buttons/index.js +11 -0
  141. package/src/themes/five/src/styles/Inputs/index.js +34 -0
  142. package/src/utils/index.js +5 -0
  143. package/template/app.js +5 -3
  144. package/template/theme.json +335 -24
  145. package/_bundles/ordering-ui.038c4b4d536032472bc7.js +0 -2
  146. /package/_bundles/{7.ordering-ui.038c4b4d536032472bc7.js.LICENSE.txt → 7.ordering-ui.5488030edb520175432d.js.LICENSE.txt} +0 -0
  147. /package/_bundles/{ordering-ui.038c4b4d536032472bc7.js.LICENSE.txt → ordering-ui.5488030edb520175432d.js.LICENSE.txt} +0 -0
@@ -12,7 +12,7 @@ export const OrderEta = (props) => {
12
12
  const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
13
13
 
14
14
  const getEstimatedDeliveryTime = () => {
15
- let _estimatedTime
15
+ let _estimatedTime = null
16
16
  let totalEta = 0
17
17
  const _delivery = order?.delivery_datetime_utc
18
18
  ? order?.delivery_datetime_utc
@@ -38,9 +38,12 @@ export const OrderEta = (props) => {
38
38
  }
39
39
  _estimatedTime = moment.utc(_delivery).add(totalEta, 'minutes')
40
40
  } else {
41
- _estimatedTime = moment.utc(_delivery).add(order?.eta_time, 'minutes')
41
+ const _etaTime = order?.delivered_in
42
+ ? order?.delivered_in + order?.eta_time
43
+ : order?.eta_time
44
+ _estimatedTime = moment.utc(_delivery).add(_etaTime, 'minutes')
42
45
  }
43
- _estimatedTime = outputFormat ? moment(_estimatedTime).format(outputFormat) : parseDate(_estimatedTime, { utc: false })
46
+ _estimatedTime = outputFormat ? moment(_estimatedTime).local().format(outputFormat) : parseDate(_estimatedTime, { utc: false })
44
47
  setEstimatedDeliveryTime(_estimatedTime)
45
48
  }
46
49
 
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import { useLanguage, useUtils } from 'ordering-components-external'
3
3
  import { ArrowRight, CheckCircleFill } from 'react-bootstrap-icons'
4
4
  import { Button } from '../../styles/Buttons'
5
- import { getTraduction } from '../../../../../utils'
5
+ import { formatSeconds, getTraduction } from '../../../../../utils'
6
6
  import {
7
7
  OrderHistoryContainer,
8
8
  HistoryItemWrapper,
@@ -127,7 +127,13 @@ export const OrderHistory = (props) => {
127
127
  <h3>
128
128
  {message.change?.attribute === 'logistic_status'
129
129
  ? getLogisticTagStatus(parseInt(message.change.new, 10))
130
- : t(getStatus(parseInt(message.change.new, 10)))
130
+ : message.change?.attribute === 'delivered_in' ? (
131
+ <h3>
132
+ <strong>{t('TIME_ADDED_BY_DRIVER', 'Time added by driver')}</strong><br />
133
+ {formatSeconds(parseInt(message.change.new, 10))}
134
+ </h3>
135
+ )
136
+ :t(getStatus(parseInt(message.change.new, 10)))
131
137
  }
132
138
  </h3>
133
139
  ) : (
@@ -127,7 +127,7 @@ const OrderDetailsUI = (props) => {
127
127
  const acceptedStatus = [1, 2, 5, 6, 10, 11, 12]
128
128
  const completedStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
129
129
  const placeSpotTypes = [3, 4, 5]
130
- const activeStatus = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
130
+ const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
131
131
  const googleMapsApiKey = configs?.google_maps_api_key?.value
132
132
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
133
133
 
@@ -515,7 +515,7 @@ const OrderDetailsUI = (props) => {
515
515
  </p>
516
516
  </PlaceSpotSection>
517
517
  )}
518
- {hideOrderActions && (
518
+ {!hideOrderActions && (
519
519
  <DirectionButtonWrapper>
520
520
  <Button
521
521
  color='primary'
@@ -1,7 +1,7 @@
1
1
  import styled, { css } from 'styled-components'
2
2
 
3
3
  export const Container = styled.div`
4
- padding-top: 5px;
4
+ padding-top: 25px;
5
5
  margin: 0px;
6
6
  ${props => props.theme.rtl && css`
7
7
  margin-left: 30px;
@@ -35,6 +35,7 @@ const OrderProgressUI = (props) => {
35
35
  const theme = useTheme()
36
36
  const [events] = useEvent()
37
37
  const [lastOrder, setLastOrder] = useState(null)
38
+ const statusToShow = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21]
38
39
 
39
40
  const isChew = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
40
41
 
@@ -45,7 +46,15 @@ const OrderProgressUI = (props) => {
45
46
  useEffect(() => {
46
47
  if (orderList?.orders.length > 0) {
47
48
  const sortedOrders = orderList.orders.sort((a, b) => a.id > b.id ? -1 : 1)
48
- setLastOrder(sortedOrders[0])
49
+ const orderInProgress = sortedOrders.find(({ status }) => (statusToShow.includes(status)))
50
+
51
+ let _lastOrder = null
52
+ if (orderInProgress) {
53
+ _lastOrder = orderInProgress
54
+ } else {
55
+ _lastOrder = sortedOrders[0]
56
+ }
57
+ setLastOrder(_lastOrder)
49
58
  }
50
59
  }, [orderList?.orders])
51
60
 
@@ -66,8 +75,10 @@ const OrderProgressUI = (props) => {
66
75
  : isChew ? theme.images.logos.chewLogoReverse : theme.images.logos.logotype}
67
76
  />
68
77
  <ProgressDescriptionWrapper>
69
- <h2>{t('ORDER_IN_PROGRESS', 'Order in progress')}</h2>
70
- <p>{t('RESTAURANT_PREPARING_YOUR_ORDER', 'The restaurant is preparing your order')}</p>
78
+ <h2>{statusToShow.includes(lastOrder?.status) ? t('ORDER_IN_PROGRESS', 'Order in progress') : t('ORDER', 'Order')}</h2>
79
+ {statusToShow.includes(lastOrder?.status) && (
80
+ <p>{t('RESTAURANT_PREPARING_YOUR_ORDER', 'The restaurant is preparing your order')}</p>
81
+ )}
71
82
  <Button
72
83
  color='primaryContrast'
73
84
  naked
@@ -93,7 +104,7 @@ const OrderProgressUI = (props) => {
93
104
  <ProgressTextWrapper>
94
105
  <StatusWrapper>{getOrderStatus(lastOrder?.status)?.value}</StatusWrapper>
95
106
  <TimeWrapper>
96
- <span>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}:&nbsp;</span>
107
+ <span>{lastOrder?.delivery_type === 1 ? t('ESTIMATED_DELIVERY', 'Estimated delivery') : t('ESTIMATED_TIME', 'Estimated time')}:&nbsp;</span>
97
108
  <span>
98
109
  {lastOrder?.delivery_datetime_utc
99
110
  ? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: 'hh:mm A', utc: false })
@@ -116,7 +127,7 @@ export const OrderProgress = (props) => {
116
127
  const orderProgressProps = {
117
128
  ...props,
118
129
  UIComponent: OrderProgressUI,
119
- orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 15, 18, 19, 20, 21, 22, 23],
130
+ orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
120
131
  useDefualtSessionManager: true,
121
132
  paginationSettings: {
122
133
  initialPage: 1,
@@ -28,7 +28,10 @@ export const OrderTypeSelectorContentUI = (props) => {
28
28
  handleChangeOrderType && handleChangeOrderType(orderType)
29
29
  }
30
30
 
31
- const orderTypeImage = (type) => theme?.header?.components?.order_types?.components?.[type]?.components?.image
31
+ const orderTypeImage = (type) => theme?.order_types?.components?.[type]?.components?.image
32
+ const orderTypeTitle = (type) => theme?.order_types?.components?.[type]?.components?.title
33
+ const orderTypeDescription = (type) => theme?.order_types?.components?.[type]?.components?.description
34
+ const orderTypeCallAction = (type) => theme?.order_types?.components?.[type]?.components?.call_to_action
32
35
 
33
36
  return (
34
37
  <div className='order-type' style={{ overflow: 'hidden' }}>
@@ -48,10 +51,10 @@ export const OrderTypeSelectorContentUI = (props) => {
48
51
  onClick={() => handleClickOrderType(item.value)}
49
52
  active={orderStatus?.options?.type === item?.value}
50
53
  >
51
- <OrderTypeTitle>{item.text}</OrderTypeTitle>
52
- <OrderTypeDescription>{item.description}</OrderTypeDescription>
54
+ <OrderTypeTitle>{orderTypeTitle(item?.text?.replace(' ', '_')?.toLowerCase()) || item.text}</OrderTypeTitle>
55
+ <OrderTypeDescription>{orderTypeDescription(item?.text?.replace(' ', '_')?.toLowerCase()) || item.description}</OrderTypeDescription>
53
56
  <OrderStartWrapper>
54
- <span>{t('START_MY_ORDER', 'start my order')}</span>
57
+ <span>{orderTypeCallAction(item?.text?.replace(' ', '_')?.toLowerCase()) || t('START_MY_ORDER', 'start my order')}</span>
55
58
  <BsArrowRight />
56
59
  </OrderStartWrapper>
57
60
  <OrderTypeOverlay />
@@ -43,7 +43,7 @@ export const BannerContainer = styled.div`
43
43
  export const ImageWrapper = styled.div`
44
44
  cursor: pointer;
45
45
  width: 100%;
46
- padding-top: 260px;
46
+ padding-top: 18%;
47
47
  position: relative;
48
48
  .banner-img {
49
49
  position: absolute;
@@ -53,7 +53,4 @@ export const ImageWrapper = styled.div`
53
53
  height: 100%;
54
54
  object-fit: cover;
55
55
  }
56
- @media (min-width: 768px) {
57
- padding-top: 18%;
58
- }
59
56
  `
@@ -112,10 +112,13 @@ const PaymentOptionsUI = (props) => {
112
112
 
113
113
  const includeKioskPaymethods = ['cash', 'card_delivery']
114
114
 
115
+ const multiCheckoutMethods = ['global_google_pay', 'global_apple_pay']
116
+
115
117
  const list = paymethodsList ? paymethodsList?.paymethods : paymethods?.map(pay => pay.paymethod)
116
118
 
117
119
  const popupMethods = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal', 'square', 'google_pay', 'apple_pay']
118
- const supportedMethods = list?.filter(p => useKioskApp ? includeKioskPaymethods.includes(p.gateway) : p)
120
+
121
+ const supportedMethods = list?.filter(p => !multiCheckoutMethods.includes(p.gateway))?.filter(p => useKioskApp ? includeKioskPaymethods.includes(p.gateway) : p)
119
122
 
120
123
  const handlePaymentMethodClick = (paymethod) => {
121
124
  if (paymethod?.gateway === 'paypal' &&
@@ -176,7 +179,7 @@ const PaymentOptionsUI = (props) => {
176
179
  if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
177
180
  handlePlaceOrder()
178
181
  }
179
- }, [paymethodData, paymethodSelected])
182
+ }, [JSON.stringify(paymethodData), paymethodSelected])
180
183
 
181
184
  return (
182
185
  <>
@@ -193,10 +196,10 @@ const PaymentOptionsUI = (props) => {
193
196
  supportedMethods.sort((a, b) => a.id - b.id).map(paymethod => (
194
197
  <React.Fragment key={paymethod.id}>
195
198
  {
196
- (!isCustomerMode || (isCustomerMode && (paymethod.gateway === 'card_delivery' || paymethod.gateway === 'cash'))) && (
199
+ ((!isCustomerMode && paymethod.gateway) || (isCustomerMode && (paymethod.gateway === 'card_delivery' || paymethod.gateway === 'cash'))) && (
197
200
  <PayCard
198
201
  isDisabled={isDisabled}
199
- className={`card ${(paymethodSelected?.id || isOpenMethod?.paymethod?.id) === paymethod.id ? 'active' : ''}`}
202
+ className={`${(paymethodSelected?.id || isOpenMethod?.paymethod?.id) === paymethod.id ? 'active' : ''}`}
200
203
  onClick={() => handlePaymentMethodClick(paymethod)}
201
204
  >
202
205
  <div>
@@ -1,5 +1,6 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
+ import { nanoid } from 'nanoid'
3
4
  import FiMinusCircle from '@meronex/icons/fi/FiMinusCircle'
4
5
  import FiPlusCircle from '@meronex/icons/fi/FiPlusCircle'
5
6
  import MdcPlayCircleOutline from '@meronex/icons/mdc/MdcPlayCircleOutline'
@@ -17,7 +18,7 @@ import {
17
18
  useConfig
18
19
  } from 'ordering-components-external'
19
20
 
20
- import { scrollTo } from '../../../../../utils'
21
+ import { scrollTo, orderTypeList } from '../../../../../utils'
21
22
  import { useWindowSize } from '../../../../../hooks/useWindowSize'
22
23
 
23
24
  import { ProductIngredient } from '../ProductIngredient'
@@ -62,7 +63,8 @@ import {
62
63
  ProductTagsListContainer,
63
64
  ProductTagWrapper,
64
65
  VideoGalleryWrapper,
65
- TitleWrapper
66
+ TitleWrapper,
67
+ GuestUserLink
66
68
  } from './styles'
67
69
  import { useTheme } from 'styled-components'
68
70
  import { Input, TextArea } from '../../styles/Inputs'
@@ -95,7 +97,9 @@ const ProductOptionsUI = (props) => {
95
97
  handleChangeSuboptionState,
96
98
  handleChangeCommentState,
97
99
  productAddedToCartLength,
98
- handleFavoriteProduct
100
+ handleFavoriteProduct,
101
+ handleCreateGuestUser,
102
+ actionStatus
99
103
  } = props
100
104
 
101
105
  const { product, loading, error } = productObject
@@ -129,6 +133,9 @@ const ProductOptionsUI = (props) => {
129
133
 
130
134
  const [{ configs }] = useConfig()
131
135
  const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map(value => Number(value)) || []
136
+ const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
137
+ const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
138
+ const hideProductDescription = theme?.business_view?.components?.products?.components?.product?.components?.description?.hidden
132
139
 
133
140
  const closeModal = () => {
134
141
  setModalIsOpen(false)
@@ -246,6 +253,11 @@ const ProductOptionsUI = (props) => {
246
253
  }
247
254
  }
248
255
 
256
+ const handleUpdateGuest = () => {
257
+ const guestToken = nanoid()
258
+ if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
259
+ }
260
+
249
261
  const handleSlideChange = () => {
250
262
  var videos = document.querySelectorAll('iframe, video')
251
263
  Array.prototype.forEach.call(videos, function (video) {
@@ -526,7 +538,7 @@ const ProductOptionsUI = (props) => {
526
538
  )}
527
539
  </ProductMeta>
528
540
  </Properties>
529
- {product?.description && (
541
+ {product?.description && !hideProductDescription && (
530
542
  <ProductDescription>
531
543
  <LinkableText
532
544
  text={product?.description}
@@ -662,7 +674,7 @@ const ProductOptionsUI = (props) => {
662
674
  <MidComponent key={i} {...props} />))
663
675
  }
664
676
  </ProductEdition>
665
- <ProductActions>
677
+ <ProductActions isColumn={(auth && !(orderState.options?.address_id || unaddressedTypes.includes(orderState?.options?.type)))}>
666
678
  <div className='price-amount-block'>
667
679
  <div className='price'>
668
680
  <h4>{productCart.total && parsePrice(productCart.total)}</h4>
@@ -737,6 +749,7 @@ const ProductOptionsUI = (props) => {
737
749
  ) : (
738
750
  <AddressList
739
751
  isModal
752
+ isProfile
740
753
  userId={isNaN(userCustomer?.id) ? null : userCustomer?.id}
741
754
  addressList={isNaN(userCustomer?.id) ? user.addresses : null}
742
755
  isProductForm
@@ -755,6 +768,11 @@ const ProductOptionsUI = (props) => {
755
768
  {isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', theme?.defaultLanguages?.SOLD_OUT || 'Sold out') : t('LOGIN_SIGNUP', theme?.defaultLanguages?.LOGIN_SIGNUP || 'Login / Sign Up')}
756
769
  </Button>
757
770
  )}
771
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
772
+ <GuestUserLink onClick={handleUpdateGuest}>
773
+ {actionStatus?.loading ? <Skeleton height={25} width={70} /> : t('WITH_GUEST_USER', 'With Guest user')}
774
+ </GuestUserLink>
775
+ )}
758
776
  </ProductActions>
759
777
  </ProductInfo>
760
778
  </>
@@ -314,7 +314,7 @@ export const ProductActions = styled.div`
314
314
  div.price-amount-block {
315
315
  display: flex;
316
316
  justify-content: space-between;
317
- width: 80%
317
+ width: 70%
318
318
  }
319
319
 
320
320
  svg {
@@ -356,6 +356,17 @@ export const ProductActions = styled.div`
356
356
  margin: 0 10px;
357
357
  }
358
358
 
359
+ #address_control {
360
+ button.add {
361
+ width: calc(100% - 20px) !important;
362
+ margin: 10px 10px 0 10px;
363
+ }
364
+ }
365
+
366
+ div#address_list {
367
+ padding: 0;
368
+ }
369
+
359
370
  @media (min-width: 577px) {
360
371
  position: sticky;
361
372
  }
@@ -370,6 +381,13 @@ export const ProductActions = styled.div`
370
381
  padding: 10px 20px;
371
382
  box-sizing: border-box;
372
383
 
384
+ ${({ isColumn }) => isColumn && css`
385
+ flex-direction: column;
386
+ div.price-amount-block {
387
+ margin-bottom: 15px;
388
+ }
389
+ `}
390
+
373
391
  div.price {
374
392
  width: 25%;
375
393
  }
@@ -602,3 +620,20 @@ export const VideoGalleryWrapper = styled.div`
602
620
  font-size: 28px;
603
621
  }
604
622
  `
623
+
624
+ export const GuestUserLink = styled.div`
625
+ font-size: 14px;
626
+ color: ${props => props.theme.colors.primary};
627
+ text-align: center;
628
+ cursor: pointer;
629
+ margin: 15px 0;
630
+ white-space: nowrap;
631
+ &:hover {
632
+ text-decoration: underline;
633
+ }
634
+ margin-left: 10px;
635
+ ${props => props.theme.rtl && css`
636
+ margin-left: 0;
637
+ margin-right: 10px;
638
+ `}
639
+ `
@@ -63,7 +63,7 @@ export const ProductItemAccordion = (props) => {
63
63
  const productActionsDelete = useRef(null)
64
64
 
65
65
  const viewString = isConfirmationPage ? 'confirmation' : isStore ? 'business_view' : 'header'
66
- const showProductImage = !orderingTheme?.theme?.[viewString]?.components?.cart?.components?.products?.components?.image?.hidden
66
+ const showProductImage = !theme?.[viewString]?.components?.cart?.components?.products?.components?.image?.hidden
67
67
 
68
68
  const productInfo = () => {
69
69
  if (isCartProduct) {
@@ -224,13 +224,15 @@ export const ProductItemAccordion = (props) => {
224
224
  <Pencil color='#B1BCCC' />
225
225
  </ProductActionsEdit>
226
226
  )}
227
- <ProductActionsDelete
228
- ref={productActionsDelete}
229
- onClick={() => onDeleteProduct(product)}
230
- disabled={orderState.loading}
231
- >
232
- <Trash color='#B1BCCC' />
233
- </ProductActionsDelete>
227
+ {onDeleteProduct && (
228
+ <ProductActionsDelete
229
+ ref={productActionsDelete}
230
+ onClick={() => onDeleteProduct(product)}
231
+ disabled={orderState.loading}
232
+ >
233
+ <Trash color='#B1BCCC' />
234
+ </ProductActionsDelete>
235
+ )}
234
236
  </ProductActions>
235
237
  )}
236
238
  </ProductPriceSection>
@@ -238,13 +240,15 @@ export const ProductItemAccordion = (props) => {
238
240
  </>
239
241
  ) : (
240
242
  <ProductActions>
241
- <ProductActionsDelete
242
- ref={productActionsDelete}
243
- onClick={() => onDeleteProduct(product)}
244
- disabled={orderState.loading}
245
- >
246
- <Trash color='#B1BCCC' />
247
- </ProductActionsDelete>
243
+ {onDeleteProduct && (
244
+ <ProductActionsDelete
245
+ ref={productActionsDelete}
246
+ onClick={() => onDeleteProduct(product)}
247
+ disabled={orderState.loading}
248
+ >
249
+ <Trash color='#B1BCCC' />
250
+ </ProductActionsDelete>
251
+ )}
248
252
  </ProductActions>
249
253
  )}
250
254
 
@@ -260,13 +264,15 @@ export const ProductItemAccordion = (props) => {
260
264
  <Pencil color='#B1BCCC' />
261
265
  </ProductActionsEdit>
262
266
  )}
263
- <ProductActionsDelete
264
- ref={productActionsDelete}
265
- onClick={() => onDeleteProduct(product)}
266
- disabled={orderState.loading}
267
- >
268
- <Trash color='#B1BCCC' />
269
- </ProductActionsDelete>
267
+ {onDeleteProduct && (
268
+ <ProductActionsDelete
269
+ ref={productActionsDelete}
270
+ onClick={() => onDeleteProduct(product)}
271
+ disabled={orderState.loading}
272
+ >
273
+ <Trash color='#B1BCCC' />
274
+ </ProductActionsDelete>
275
+ )}
270
276
  </ProductActions>
271
277
  <ProductNotAvailable>
272
278
  {t('NOT_AVAILABLE', 'Not available')}
@@ -277,13 +283,15 @@ export const ProductItemAccordion = (props) => {
277
283
  {!product?.valid_menu && isCartProduct && !isCartPending && (
278
284
  <ProductError>
279
285
  <ProductActions>
280
- <ProductActionsDelete
281
- ref={productActionsDelete}
282
- onClick={() => onDeleteProduct(product)}
283
- disabled={orderState.loading}
284
- >
285
- <Trash color='#D81212' />
286
- </ProductActionsDelete>
286
+ {onDeleteProduct && (
287
+ <ProductActionsDelete
288
+ ref={productActionsDelete}
289
+ onClick={() => onDeleteProduct(product)}
290
+ disabled={orderState.loading}
291
+ >
292
+ <Trash color='#D81212' />
293
+ </ProductActionsDelete>
294
+ )}
287
295
  </ProductActions>
288
296
  <ProductNotAvailable>
289
297
  {t('NOT_AVAILABLE', 'Not available')}
@@ -209,7 +209,7 @@ export const RenderProductsLayout = (props) => {
209
209
  </WrapperSearch>
210
210
  </>
211
211
  )}
212
- {!business?.loading && business?.previously_products?.length > 0 && !hidePreviousOrdered && windowSize.width < 993 && !categoryClicked && (
212
+ {!business?.loading && business?.previously_products?.length > 0 && !hidePreviousOrdered && !categoryClicked && (
213
213
  <OrderItAgain
214
214
  onProductClick={onProductClick}
215
215
  productList={business?.previously_products}
@@ -321,7 +321,7 @@ export const RenderProductsLayout = (props) => {
321
321
  />
322
322
  </WrapContent>
323
323
  </BusinessCategoryProductWrapper>
324
- {showCartOnProductList && (
324
+ {(windowSize.width >= 1000 && windowSize.height >= 600) && showCartOnProductList && (
325
325
  <BusinessCartContainer isProfessional={business?.professionals?.length > 0 && !useKioskApp}>
326
326
  <BusinessCartContent maxHeight={window.innerHeight - 100}>
327
327
  {currentCart?.products?.length > 0 ? (
@@ -399,7 +399,7 @@ export const RenderProductsLayout = (props) => {
399
399
  {(categoryClicked || windowSize.width >= 993) && (
400
400
  <BusinessCategoryProductWrapper>
401
401
  <WrapContent isGroceries id='groceries'>
402
- {!business?.loading && business?.previously_products?.length > 0 && windowSize.width >= 993 && (
402
+ {!business?.loading && !hidePreviousOrdered && business?.previously_products?.length > 0 && windowSize.width >= 993 && (
403
403
  <OrderItAgain
404
404
  onProductClick={onProductClick}
405
405
  productList={business?.previously_products}
@@ -209,12 +209,20 @@ const ReviewProductUI = (props) => {
209
209
  {props.beforeComponents?.map((BeforeComponent, i) => (
210
210
  <BeforeComponent key={i} {...props} />))}
211
211
  <ReviewProductContainer onSubmit={handleSubmit(onSubmit)}>
212
- {order?.products && order.products.length > 0 && order.products.map((product, i) => !product?.deleted && (
213
- <SingleProductReview
214
- {...props}
215
- key={i}
216
- product={product}
217
- />
212
+ {order?.products && order.products.length > 0 && order?.products.map(productsOrder => (
213
+ productsOrder?.length ? productsOrder?.map((product, i) => !product?.deleted && (
214
+ <SingleProductReview
215
+ {...props}
216
+ key={i}
217
+ product={product}
218
+ />
219
+ )) : !productsOrder?.deleted && (
220
+ <SingleProductReview
221
+ {...props}
222
+ key={i}
223
+ product={productsOrder}
224
+ />
225
+ )
218
226
  ))}
219
227
  <ActionBlock>
220
228
  <span onClick={closeReviewProduct}>{t('SKIP', 'Skip')}</span>
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect, useRef, useState } from 'react'
2
2
  import { Swiper, SwiperSlide } from 'swiper/react'
3
- import { useUtils, useLanguage, useSession, useConfig, ProductForm as ProductFormController } from 'ordering-components-external'
3
+ import { nanoid } from 'nanoid'
4
+ import { useUtils, useLanguage, useSession, useConfig, ProductForm as ProductFormController, useOrder } from 'ordering-components-external'
4
5
  import Skeleton from 'react-loading-skeleton'
5
6
  import { Alert } from '../Confirm'
6
7
  import { Modal } from '../Modal'
@@ -13,7 +14,7 @@ import { ChevronLeft, ChevronRight, ChevronDown } from 'react-bootstrap-icons'
13
14
  import BsCaretLeftFill from '@meronex/icons/bs/BsCaretLeftFill'
14
15
  import { Button } from '../../styles/Buttons'
15
16
  import moment from 'moment'
16
- import { getTimes } from '../../../../../utils'
17
+ import { getTimes, orderTypeList } from '../../../../../utils'
17
18
  import SwiperCore, { Navigation } from 'swiper'
18
19
  import 'swiper/swiper-bundle.min.css'
19
20
  import 'swiper/swiper.min.css'
@@ -47,7 +48,8 @@ import {
47
48
  DayNumber,
48
49
  TimeListWrapper,
49
50
  TimeItem,
50
- ClosedBusinessMsg
51
+ ClosedBusinessMsg,
52
+ GuestUserLink
51
53
  } from './styles'
52
54
  SwiperCore.use([Navigation])
53
55
 
@@ -62,13 +64,16 @@ const ServiceFormUI = (props) => {
62
64
  maxProductQuantity,
63
65
  productCart,
64
66
  isCartProduct,
65
- professionalListState
67
+ professionalListState,
68
+ handleCreateGuestUser,
69
+ actionStatus
66
70
  } = props
67
71
 
68
72
  const { product, loading, error } = productObject
69
73
  const theme = useTheme()
70
74
  const [, t] = useLanguage()
71
75
  const [{ configs }] = useConfig()
76
+ const [orderState] = useOrder()
72
77
  const [{ parsePrice, parseDate }] = useUtils()
73
78
  const [{ auth }, { login }] = useSession()
74
79
  const [modalPageToShow, setModalPageToShow] = useState('login')
@@ -81,6 +86,9 @@ const ServiceFormUI = (props) => {
81
86
  const [isEnabled, setIsEnabled] = useState(false)
82
87
  const [datesList, setDatesList] = useState([])
83
88
 
89
+ const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
90
+ const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
91
+
84
92
  const dropDownRef = useRef()
85
93
  const is12Hours = configs?.format_time?.value === '12'
86
94
 
@@ -89,6 +97,11 @@ const ServiceFormUI = (props) => {
89
97
  setModalPageToShow('login')
90
98
  }
91
99
 
100
+ const handleUpdateGuest = () => {
101
+ const guestToken = nanoid()
102
+ if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
103
+ }
104
+
92
105
  const handleSuccessLogin = (user) => {
93
106
  if (user) {
94
107
  closeModal()
@@ -485,6 +498,11 @@ const ServiceFormUI = (props) => {
485
498
  {isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', theme?.defaultLanguages?.SOLD_OUT || 'Sold out') : t('LOGIN_SIGNUP', theme?.defaultLanguages?.LOGIN_SIGNUP || 'Login / Sign Up')}
486
499
  </Button>
487
500
  )}
501
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
502
+ <GuestUserLink onClick={handleUpdateGuest}>
503
+ {actionStatus?.loading ? <Skeleton height={25} width={70} /> : t('WITH_GUEST_USER', 'With Guest user')}
504
+ </GuestUserLink>
505
+ )}
488
506
  </ButtonWrapper>
489
507
  </>
490
508
  )}
@@ -469,3 +469,19 @@ export const ClosedBusinessMsg = styled.div`
469
469
  font-size: 16px;
470
470
  width: 100%;
471
471
  `
472
+
473
+ export const GuestUserLink = styled.div`
474
+ font-size: 14px;
475
+ color: ${props => props.theme.colors.primary};
476
+ cursor: pointer;
477
+ margin: 15px 0;
478
+ white-space: nowrap;
479
+ &:hover {
480
+ text-decoration: underline;
481
+ }
482
+ margin-left: 10px;
483
+ ${props => props.theme.rtl && css`
484
+ margin-left: 0;
485
+ margin-right: 10px;
486
+ `}
487
+ `