ordering-ui-external 2.5.3 → 2.5.4

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 (40) hide show
  1. package/_bundles/{0.ordering-ui.b041abea697214292027.js → 0.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  2. package/_bundles/{1.ordering-ui.b041abea697214292027.js → 1.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  3. package/_bundles/{2.ordering-ui.b041abea697214292027.js → 2.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  4. package/_bundles/{4.ordering-ui.b041abea697214292027.js → 4.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  5. package/_bundles/{5.ordering-ui.b041abea697214292027.js → 5.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  6. package/_bundles/{6.ordering-ui.b041abea697214292027.js → 6.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  7. package/_bundles/{7.ordering-ui.b041abea697214292027.js → 7.ordering-ui.67fc029cdff9bbdf3d6a.js} +2 -2
  8. package/_bundles/{8.ordering-ui.b041abea697214292027.js → 8.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  9. package/_bundles/{9.ordering-ui.b041abea697214292027.js → 9.ordering-ui.67fc029cdff9bbdf3d6a.js} +1 -1
  10. package/_bundles/{ordering-ui.b041abea697214292027.js → ordering-ui.67fc029cdff9bbdf3d6a.js} +2 -2
  11. package/_bundles/{ordering-ui.b041abea697214292027.js.LICENSE.txt → ordering-ui.67fc029cdff9bbdf3d6a.js.LICENSE.txt} +8 -0
  12. package/_modules/components/UserProfileForm/index.js +1 -1
  13. package/_modules/components/VerticalOrdersLayout/index.js +3 -1
  14. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +48 -46
  15. package/_modules/themes/five/src/components/Cart/index.js +3 -3
  16. package/_modules/themes/five/src/components/Header/index.js +1 -1
  17. package/_modules/themes/five/src/components/MultiCheckout/index.js +4 -4
  18. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +4 -1
  19. package/_modules/themes/five/src/components/OrderDetails/OrderHistory.js +2 -2
  20. package/_modules/themes/five/src/components/OrdersOption/index.js +22 -10
  21. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +15 -9
  22. package/_modules/themes/five/src/components/ReviewOrder/styles.js +1 -1
  23. package/_modules/themes/five/src/components/Wallets/index.js +1 -1
  24. package/_modules/utils/index.js +10 -10
  25. package/package.json +2 -2
  26. package/src/components/UserProfileForm/index.js +1 -2
  27. package/src/components/VerticalOrdersLayout/index.js +3 -1
  28. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +15 -9
  29. package/src/themes/five/src/components/Cart/index.js +5 -3
  30. package/src/themes/five/src/components/Header/index.js +1 -1
  31. package/src/themes/five/src/components/MultiCheckout/index.js +1 -1
  32. package/src/themes/five/src/components/OrderDetails/OrderEta.js +4 -3
  33. package/src/themes/five/src/components/OrderDetails/OrderHistory.js +9 -3
  34. package/src/themes/five/src/components/OrdersOption/index.js +11 -1
  35. package/src/themes/five/src/components/ProductOptionSubOption/index.js +12 -6
  36. package/src/themes/five/src/components/ReviewOrder/styles.js +2 -1
  37. package/src/themes/five/src/components/Wallets/index.js +1 -1
  38. package/src/utils/index.js +10 -10
  39. package/template/app.js +2 -1
  40. /package/_bundles/{7.ordering-ui.b041abea697214292027.js.LICENSE.txt → 7.ordering-ui.67fc029cdff9bbdf3d6a.js.LICENSE.txt} +0 -0
@@ -903,7 +903,7 @@ var getOrderStatus = function getOrderStatus(s) {
903
903
  key: 0,
904
904
  value: t('PENDING', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag = theme.defaultLanguages) === null || _theme$defaultLanguag === void 0 ? void 0 : _theme$defaultLanguag.PENDING) || 'Pending'),
905
905
  slug: 'PENDING',
906
- percentage: 25
906
+ percentage: 10
907
907
  }, {
908
908
  key: 1,
909
909
  value: t('COMPLETED', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag2 = theme.defaultLanguages) === null || _theme$defaultLanguag2 === void 0 ? void 0 : _theme$defaultLanguag2.COMPLETED) || 'Completed'),
@@ -923,7 +923,7 @@ var getOrderStatus = function getOrderStatus(s) {
923
923
  key: 4,
924
924
  value: t('PREPARATION_COMPLETED', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag5 = theme.defaultLanguages) === null || _theme$defaultLanguag5 === void 0 ? void 0 : _theme$defaultLanguag5.PREPARATION_COMPLETED) || 'Preparation Completed'),
925
925
  slug: 'PREPARATION_COMPLETED',
926
- percentage: 70
926
+ percentage: 20
927
927
  }, {
928
928
  key: 5,
929
929
  value: t('REJECTED_BY_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag6 = theme.defaultLanguages) === null || _theme$defaultLanguag6 === void 0 ? void 0 : _theme$defaultLanguag6.REJECTED_BY_BUSINESS) || 'Rejected by business'),
@@ -938,17 +938,17 @@ var getOrderStatus = function getOrderStatus(s) {
938
938
  key: 7,
939
939
  value: t('ACCEPTED_BY_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag8 = theme.defaultLanguages) === null || _theme$defaultLanguag8 === void 0 ? void 0 : _theme$defaultLanguag8.ACCEPTED_BY_BUSINESS) || 'Accepted by business'),
940
940
  slug: 'ACCEPTED_BY_BUSINESS',
941
- percentage: 35
941
+ percentage: 15
942
942
  }, {
943
943
  key: 8,
944
944
  value: t('ACCEPTED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag9 = theme.defaultLanguages) === null || _theme$defaultLanguag9 === void 0 ? void 0 : _theme$defaultLanguag9.ACCEPTED_BY_DRIVER) || 'Accepted by driver'),
945
945
  slug: 'ACCEPTED_BY_DRIVER',
946
- percentage: 45
946
+ percentage: 40
947
947
  }, {
948
948
  key: 9,
949
949
  value: t('PICK_UP_COMPLETED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag10 = theme.defaultLanguages) === null || _theme$defaultLanguag10 === void 0 ? void 0 : _theme$defaultLanguag10.PICK_UP_COMPLETED_BY_DRIVER) || 'Pick up completed by driver'),
950
950
  slug: 'PICK_UP_COMPLETED_BY_DRIVER',
951
- percentage: 80
951
+ percentage: 70
952
952
  }, {
953
953
  key: 10,
954
954
  value: t('PICK_UP_FAILED_BY_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag11 = theme.defaultLanguages) === null || _theme$defaultLanguag11 === void 0 ? void 0 : _theme$defaultLanguag11.PICK_UP_FAILED_BY_DRIVER) || 'Pick up Failed by driver'),
@@ -973,7 +973,7 @@ var getOrderStatus = function getOrderStatus(s) {
973
973
  key: 14,
974
974
  value: t('ORDER_NOT_READY', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag15 = theme.defaultLanguages) === null || _theme$defaultLanguag15 === void 0 ? void 0 : _theme$defaultLanguag15.ORDER_NOT_READY) || 'Order not ready'),
975
975
  slug: 'ORDER_NOT_READY',
976
- percentage: 65
976
+ percentage: 15
977
977
  }, {
978
978
  key: 15,
979
979
  value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag16 = theme.defaultLanguages) === null || _theme$defaultLanguag16 === void 0 ? void 0 : _theme$defaultLanguag16.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER) || 'Order picked up completed by customer'),
@@ -993,7 +993,7 @@ var getOrderStatus = function getOrderStatus(s) {
993
993
  key: 18,
994
994
  value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag19 = theme.defaultLanguages) === null || _theme$defaultLanguag19 === void 0 ? void 0 : _theme$defaultLanguag19.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS) || 'Driver almost arrived to business'),
995
995
  slug: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
996
- percentage: 55
996
+ percentage: 50
997
997
  }, {
998
998
  key: 19,
999
999
  value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag20 = theme.defaultLanguages) === null || _theme$defaultLanguag20 === void 0 ? void 0 : _theme$defaultLanguag20.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER) || 'Driver almost arrived to customer'),
@@ -1008,17 +1008,17 @@ var getOrderStatus = function getOrderStatus(s) {
1008
1008
  key: 21,
1009
1009
  value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag22 = theme.defaultLanguages) === null || _theme$defaultLanguag22 === void 0 ? void 0 : _theme$defaultLanguag22.ORDER_CUSTOMER_ARRIVED_BUSINESS) || 'Customer arrived to business'),
1010
1010
  slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
1011
- percentage: 95
1011
+ percentage: 90
1012
1012
  }, {
1013
1013
  key: 22,
1014
1014
  value: t('ORDER_LOOKING_FOR_DRIVER', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag23 = theme.defaultLanguages) === null || _theme$defaultLanguag23 === void 0 ? void 0 : _theme$defaultLanguag23.ORDER_LOOKING_FOR_DRIVER) || 'Looking for driver'),
1015
1015
  slug: 'ORDER_LOOKING_FOR_DRIVER',
1016
- percentage: 35
1016
+ percentage: 30
1017
1017
  }, {
1018
1018
  key: 23,
1019
1019
  value: t('ORDER_DRIVER_ON_WAY', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag24 = theme.defaultLanguages) === null || _theme$defaultLanguag24 === void 0 ? void 0 : _theme$defaultLanguag24.ORDER_DRIVER_ON_WAY) || 'Driver on way'),
1020
1020
  slug: 'ORDER_DRIVER_ON_WAY',
1021
- percentage: 45
1021
+ percentage: 80
1022
1022
  }];
1023
1023
  var objectStatus = orderStatus.find(function (o) {
1024
1024
  return o.key === status;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -87,7 +87,7 @@
87
87
  "lodash": "^4.17.19",
88
88
  "moment": "^2.29.4",
89
89
  "nanoid": "^4.0.0",
90
- "ordering-components-external": "2.6.0",
90
+ "ordering-components-external": "2.6.1",
91
91
  "polished": "^3.6.6",
92
92
  "react-bootstrap-icons": "^1.7.2",
93
93
  "react-calendar": "^3.3.1",
@@ -164,8 +164,7 @@ const UserProfileFormUI = (props) => {
164
164
  ) : (
165
165
  <UserData>
166
166
  <h1>
167
- {showCustomerName && (userData?.name || user?.name)}
168
- {showCustomerLastName && (userData?.lastname || user?.lastname)}
167
+ {showCustomerName && (userData?.name || user?.name)} {showCustomerLastName && (userData?.lastname || user?.lastname)}
169
168
  </h1>
170
169
  <p>{(showCustomerEmail && (userData?.email || user.email))}</p>
171
170
  {(showCustomerCellphone && (userData?.cellphone || user?.cellphone)) && (
@@ -20,7 +20,8 @@ export const VerticalOrdersLayout = (props) => {
20
20
  orders,
21
21
  pagination,
22
22
  loadMoreOrders,
23
- handleUpdateOrderList
23
+ handleUpdateOrderList,
24
+ setRefreshOrders
24
25
  } = props
25
26
 
26
27
  const [, t] = useLanguage()
@@ -58,6 +59,7 @@ export const VerticalOrdersLayout = (props) => {
58
59
  const handleCloseReivew = () => {
59
60
  setReviewStatus({ order: false, product: false, driver: false })
60
61
  setIsReviewOpen(false)
62
+ setRefreshOrders(true)
61
63
  }
62
64
 
63
65
  const handleClickReview = (order) => {
@@ -8,12 +8,12 @@ export const BusinessContainer = styled.div`
8
8
  box-sizing: border-box;
9
9
  position: relative;
10
10
  max-height: 324px;
11
- height: 324px;
11
+ height: 150px;
12
12
  background-repeat: no-repeat, repeat;
13
13
  background-size: cover;
14
14
  object-fit: cover;
15
15
  background-position: center;
16
- min-height: 200px;
16
+ min-height: 150px;
17
17
  justify-content: start;
18
18
  align-items: flex-end;
19
19
 
@@ -21,6 +21,10 @@ export const BusinessContainer = styled.div`
21
21
  background-color: #cccccc;
22
22
  `}
23
23
 
24
+ ${props => props.bgimage && props.isChew && css`
25
+ height: 180px;
26
+ `}
27
+
24
28
  ${props => props.bgimage && (!props.isClosed && !props.isChew) && css`
25
29
  background-image: url(${props.bgimage});
26
30
  `}
@@ -45,6 +49,8 @@ export const BusinessContainer = styled.div`
45
49
 
46
50
  @media (min-width: 576px) {
47
51
  border-radius: 7.6px;
52
+ height: 324px;
53
+ min-height: 200px;
48
54
  }
49
55
 
50
56
 
@@ -54,8 +60,8 @@ export const BusinessContent = styled.div`
54
60
  margin: 0;
55
61
  margin-left: 35px;
56
62
  margin-bottom: -35px;
57
- max-height: 80px;
58
- width: 80px;
63
+ max-height: 70px;
64
+ width: 70px;
59
65
  box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
60
66
 
61
67
  @media (min-width: 576px) {
@@ -71,10 +77,10 @@ export const BusinessContent = styled.div`
71
77
  `
72
78
 
73
79
  export const WrapperBusinessLogo = styled.div`
74
- max-width: 80px;
75
- max-height: 80px;
76
- width: 80px;
77
- height: 80px;
80
+ max-width: 70px;
81
+ max-height: 70px;
82
+ width: 70px;
83
+ height: 70px;
78
84
 
79
85
  @media (min-width: 576px) {
80
86
  max-width: 124px;
@@ -94,7 +100,7 @@ const BusinessLogoStyled = styled.div`
94
100
  background-size: cover;
95
101
  object-fit: cover;
96
102
  background-position: center;
97
- min-height: 80px;
103
+ min-height: 70px;
98
104
  border-radius: 7.6px;
99
105
  @media (min-width: 576px) {
100
106
  min-height: 124px;
@@ -345,7 +345,9 @@ const CartUI = (props) => {
345
345
  )}
346
346
  <IconContainer>
347
347
  <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })} />
348
- <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
348
+ {!!offer?.id && (
349
+ <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
350
+ )}
349
351
  </IconContainer>
350
352
  </td>
351
353
  <td>
@@ -408,7 +410,7 @@ const CartUI = (props) => {
408
410
  )}
409
411
  <IconContainer>
410
412
  <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })} />
411
- {!offer?.type && (
413
+ {!!offer?.id && (
412
414
  <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
413
415
  )}
414
416
  </IconContainer>
@@ -435,7 +437,7 @@ const CartUI = (props) => {
435
437
  )}
436
438
  <IconContainer>
437
439
  <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })} />
438
- {!offer?.type && (
440
+ {!!offer?.id && (
439
441
  <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
440
442
  )}
441
443
  </IconContainer>
@@ -238,7 +238,7 @@ export const Header = (props) => {
238
238
  <img alt='Isotype' width={isChew ? '70px' : '35px'} height={isChew ? '20px' : '45px'} src={isChew ? theme?.images?.logos?.chewLogo : (isHome && windowSize.width < 576 ? theme?.images?.logos?.isotypeInvert : orderingTheme?.theme?.my_products?.components?.images?.components?.logo?.components?.image || theme?.images?.logos?.isotype)} loading='lazy' />
239
239
  </LogoHeader>
240
240
  </LeftHeader>
241
- {isShowOrderOptions && !props.isCustomLayout && windowSize.width >= 576 && (
241
+ {isShowOrderOptions && windowSize.width >= 576 && (
242
242
  <Menu id='center-side' className='left-header' isCustomerMode={isCustomerMode} isChew={isChew}>
243
243
  {windowSize.width > 850 && isFarAway && (
244
244
  <FarAwayMessage>
@@ -57,7 +57,6 @@ const MultiCheckoutUI = (props) => {
57
57
  isCustomerMode,
58
58
  openCarts,
59
59
  loyaltyPlansState,
60
- totalCartsPrice,
61
60
  handleGroupPlaceOrder,
62
61
  paymethodSelected,
63
62
  handleSelectPaymethod,
@@ -101,6 +100,7 @@ const MultiCheckoutUI = (props) => {
101
100
  ? JSON.parse(configs?.driver_tip_options?.value) || []
102
101
  : configs?.driver_tip_options?.value || []
103
102
 
103
+ const totalCartsPrice = cartGroup?.result?.balance
104
104
  const methodsPay = ['global_google_pay', 'global_apple_pay']
105
105
  const creditPointPlan = loyaltyPlansState?.result?.find((loyal) => loyal.type === 'credit_point')
106
106
  const businessIds = openCarts.map((cart) => cart.business_id)
@@ -38,9 +38,10 @@ export const OrderEta = (props) => {
38
38
  }
39
39
  _estimatedTime = moment.utc(_delivery).add(totalEta, 'minutes')
40
40
  } else {
41
- const _etaTime = order?.delivered_in
42
- ? order?.delivered_in + order?.eta_time
43
- : order?.eta_time
41
+ let timesToAdd = 0
42
+ if (order?.delivered_in) timesToAdd += order?.delivered_in
43
+ if (order?.prepared_in) timesToAdd += order?.prepared_in
44
+ const _etaTime = order?.eta_time + timesToAdd
44
45
  _estimatedTime = moment.utc(_delivery).add(_etaTime, 'minutes')
45
46
  }
46
47
  _estimatedTime = outputFormat ? moment(_estimatedTime).local().format(outputFormat) : parseDate(_estimatedTime, { utc: false })
@@ -129,11 +129,17 @@ export const OrderHistory = (props) => {
129
129
  ? getLogisticTagStatus(parseInt(message.change.new, 10))
130
130
  : message.change?.attribute === 'delivered_in' ? (
131
131
  <h3>
132
- <strong>{t('TIME_ADDED_BY_DRIVER', 'Time added by driver')}</strong><br />
133
- {formatSeconds(parseInt(message.change.new, 10))}
132
+ <strong>{t('TIME_ADDED_BY_DRIVER', 'Time added by driver')}</strong><br />
133
+ {formatSeconds(parseInt(message.change.new, 10))}
134
134
  </h3>
135
135
  )
136
- :t(getStatus(parseInt(message.change.new, 10)))
136
+ : message.change?.attribute === 'prepared_in' ? (
137
+ <h3>
138
+ <strong>{t('TIME_ADDED_BY_BUSINESS', 'Time added by business')}</strong><br />
139
+ {formatSeconds(parseInt(message.change.new, 10))}
140
+ </h3>
141
+ )
142
+ : t(getStatus(parseInt(message.change.new, 10)))
137
143
  }
138
144
  </h3>
139
145
  ) : (
@@ -65,7 +65,8 @@ const OrdersOptionUI = (props) => {
65
65
  handleUpdateProfessionals,
66
66
  businesses,
67
67
  handleUpdateBusinesses,
68
- getPage
68
+ getPage,
69
+ loadOrders,
69
70
  } = props
70
71
 
71
72
  const [, t] = useLanguage()
@@ -73,6 +74,7 @@ const OrdersOptionUI = (props) => {
73
74
  const [events] = useEvent()
74
75
  const { width } = useWindowSize()
75
76
  const { loading, error, orders: values } = orderList
77
+ const [refreshOrders , setRefreshOrders] = useState(false)
76
78
 
77
79
  const _orders = customArray || values || []
78
80
  const uniqueOrders = []
@@ -186,6 +188,13 @@ const OrdersOptionUI = (props) => {
186
188
  }
187
189
  }, [reorderState])
188
190
 
191
+ useEffect(() => {
192
+ if (refreshOrders) {
193
+ loadOrders(false, false, false, true)
194
+ setRefreshOrders(false)
195
+ }
196
+ }, [refreshOrders])
197
+
189
198
  return (
190
199
  <>
191
200
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -340,6 +349,7 @@ const OrdersOptionUI = (props) => {
340
349
  getOrderStatus={getOrderStatus}
341
350
  handleReorder={handleReorder}
342
351
  handleUpdateOrderList={handleUpdateOrderList}
352
+ setRefreshOrders={setRefreshOrders}
343
353
  />
344
354
  )
345
355
  )}
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react'
1
+ import React, { useState, useEffect, useRef } from 'react'
2
2
  import {
3
3
  ProductOptionSuboption as ProductSubOptionController,
4
4
  useUtils,
@@ -37,7 +37,8 @@ const ProductOptionSubOptionUI = (props) => {
37
37
  toggleSelect,
38
38
  changePosition,
39
39
  isSoldOut,
40
- setIsScrollAvailable
40
+ setIsScrollAvailable,
41
+ onChange
41
42
  } = props
42
43
 
43
44
  const disableIncrement = option?.limit_suboptions_by_max ? (balance === option?.max || state.quantity === suboption.max) : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
@@ -46,7 +47,7 @@ const ProductOptionSubOptionUI = (props) => {
46
47
  const [{ parsePrice }] = useUtils()
47
48
  const { width } = useWindowSize()
48
49
  const [showMessage, setShowMessage] = useState(false)
49
- const [isDirty, setIsDirty] = useState(false)
50
+ const dirtyRef = useRef(null)
50
51
 
51
52
  const handleIncrement = (e) => {
52
53
  e.stopPropagation()
@@ -64,8 +65,8 @@ const ProductOptionSubOptionUI = (props) => {
64
65
  }
65
66
 
66
67
  const handleSuboptionClick = () => {
68
+ dirtyRef.current = true
67
69
  toggleSelect()
68
- setIsDirty(true)
69
70
  if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1) && !state.selected) {
70
71
  setShowMessage(true)
71
72
  }
@@ -78,12 +79,17 @@ const ProductOptionSubOptionUI = (props) => {
78
79
  }, [balance])
79
80
 
80
81
  useEffect(() => {
81
- if (balance === option?.max && state?.selected && isDirty) {
82
- setIsDirty(false)
82
+ if (balance === option?.max && state?.selected && dirtyRef) {
83
+ dirtyRef.current = false
83
84
  setIsScrollAvailable(true)
84
85
  }
85
86
  }, [state?.selected])
86
87
 
88
+ useEffect(() => {
89
+ if (dirtyRef?.current || !suboption?.preselected || !option?.respect_to) return
90
+ const newState = { ...state, selected: suboption?.preselected, quantity: state.selected ? 0 : 1 }
91
+ onChange(newState, suboption, option)
92
+ }, [suboption, dirtyRef, option])
87
93
  return (
88
94
  <>
89
95
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -256,7 +256,8 @@ export const ContinueContainer = styled.div`
256
256
  display: flex;
257
257
  align-items: center;
258
258
  p{
259
- flex: 1
259
+ flex: 1;
260
+ margin: 0;
260
261
  }
261
262
  `
262
263
 
@@ -109,7 +109,7 @@ const WalletsUI = (props) => {
109
109
  </span>
110
110
  </BalanceElement>
111
111
  </SectionWrapper>
112
- {/* <GiftCardUI /> */}
112
+ <GiftCardUI />
113
113
  <div className='transactions_list'>
114
114
  {!transactionsList?.loading && transactionsList.list?.[`wallet:${currentWalletSelected?.id}`]?.length > 0 && (
115
115
  <>
@@ -627,30 +627,30 @@ export const getOrderStatus = (s) => {
627
627
  const theme = useTheme()
628
628
  const status = parseInt(s)
629
629
  const orderStatus = [
630
- { key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 25 },
630
+ { key: 0, value: t('PENDING', theme?.defaultLanguages?.PENDING || 'Pending'), slug: 'PENDING', percentage: 10 },
631
631
  { key: 1, value: t('COMPLETED', theme?.defaultLanguages?.COMPLETED || 'Completed'), slug: 'COMPLETED', percentage: 100 },
632
632
  { key: 2, value: t('REJECTED', theme?.defaultLanguages?.REJECTED || 'Rejected'), slug: 'REJECTED', percentage: 0 },
633
633
  { key: 3, value: t('DRIVER_IN_BUSINESS', theme?.defaultLanguages?.DRIVER_IN_BUSINESS || 'Driver in business'), slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
634
- { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 70 },
634
+ { key: 4, value: t('PREPARATION_COMPLETED', theme?.defaultLanguages?.PREPARATION_COMPLETED || 'Preparation Completed'), slug: 'PREPARATION_COMPLETED', percentage: 20 },
635
635
  { key: 5, value: t('REJECTED_BY_BUSINESS', theme?.defaultLanguages?.REJECTED_BY_BUSINESS || 'Rejected by business'), slug: 'REJECTED_BY_BUSINESS', percentage: 0 },
636
636
  { key: 6, value: t('REJECTED_BY_DRIVER', theme?.defaultLanguages?.REJECTED_BY_DRIVER || 'Rejected by Driver'), slug: 'REJECTED_BY_DRIVER', percentage: 0 },
637
- { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 35 },
638
- { key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 45 },
639
- { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver'), slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 80 },
637
+ { key: 7, value: t('ACCEPTED_BY_BUSINESS', theme?.defaultLanguages?.ACCEPTED_BY_BUSINESS || 'Accepted by business'), slug: 'ACCEPTED_BY_BUSINESS', percentage: 15 },
638
+ { key: 8, value: t('ACCEPTED_BY_DRIVER', theme?.defaultLanguages?.ACCEPTED_BY_DRIVER || 'Accepted by driver'), slug: 'ACCEPTED_BY_DRIVER', percentage: 40 },
639
+ { key: 9, value: t('PICK_UP_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_COMPLETED_BY_DRIVER || 'Pick up completed by driver'), slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 70 },
640
640
  { key: 10, value: t('PICK_UP_FAILED_BY_DRIVER', theme?.defaultLanguages?.PICK_UP_FAILED_BY_DRIVER || 'Pick up Failed by driver'), slug: 'PICK_UP_FAILED_BY_DRIVER', percentage: 0 },
641
641
  { key: 11, value: t('DELIVERY_COMPLETED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_COMPLETED_BY_DRIVER || 'Delivery completed by driver'), slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 100 },
642
642
  { key: 12, value: t('DELIVERY_FAILED_BY_DRIVER', theme?.defaultLanguages?.DELIVERY_FAILED_BY_DRIVER || 'Delivery Failed by driver'), slug: 'DELIVERY_FAILED_BY_DRIVER', percentage: 0 },
643
643
  { key: 13, value: t('PREORDER', theme?.defaultLanguages?.PREORDER || 'PreOrder'), slug: 'PREORDER', percentage: 0 },
644
- { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 65 },
644
+ { key: 14, value: t('ORDER_NOT_READY', theme?.defaultLanguages?.ORDER_NOT_READY || 'Order not ready'), slug: 'ORDER_NOT_READY', percentage: 15 },
645
645
  { key: 15, value: t('ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER || 'Order picked up completed by customer'), slug: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER', percentage: 100 },
646
646
  { key: 16, value: t('ORDER_STATUS_CANCELLED_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_STATUS_CANCELLED_BY_CUSTOMER || 'Order cancelled by customer'), slug: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER', percentage: 0 },
647
647
  { key: 17, value: t('ORDER_NOT_PICKEDUP_BY_CUSTOMER', theme?.defaultLanguages?.ORDER_NOT_PICKEDUP_BY_CUSTOMER || 'Order not picked up by customer'), slug: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER', percentage: 0 },
648
- { key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', percentage: 55 },
648
+ { key: 18, value: t('ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS || 'Driver almost arrived to business'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS', percentage: 50 },
649
649
  { key: 19, value: t('ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', theme?.defaultLanguages?.ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER || 'Driver almost arrived to customer'), slug: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER', percentage: 90 },
650
650
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
651
- { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
652
- { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
653
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
651
+ { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 90 },
652
+ { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 30 },
653
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 80 }
654
654
  ]
655
655
  const objectStatus = orderStatus.find((o) => o.key === status)
656
656
  return objectStatus && objectStatus
package/template/app.js CHANGED
@@ -476,6 +476,7 @@ export const App = () => {
476
476
  isHome={isHome}
477
477
  location={location}
478
478
  isCustomLayout={singleBusinessConfig.isActive}
479
+ singleBusinessConfig={singleBusinessConfig}
479
480
  searchValue={searchValue}
480
481
  setSearchValue={setSearchValue}
481
482
  />
@@ -616,7 +617,7 @@ export const App = () => {
616
617
  isUserVerifyRequired ? (
617
618
  <Redirect to='/verify' />
618
619
  ) : (
619
- (orderStatus.options?.address?.location || isAllowUnaddressOrderType)
620
+ (orderStatus.options?.address?.location || isAllowUnaddressOrderType) && !singleBusinessConfig.isActive
620
621
  ? <BusinessesList searchValueCustom={searchValue} />
621
622
  : <Redirect to={singleBusinessConfig.isActive ? `/${singleBusinessConfig.businessSlug}` : '/'} />
622
623
  )