ordering-ui-external 10.10.23 → 11.0.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 (43) hide show
  1. package/_bundles/{7.ordering-ui.40e61237ed46b8c579a3.js → 7.ordering-ui.fa5f19340751cb2d73a3.js} +1 -1
  2. package/_bundles/{ordering-ui.40e61237ed46b8c579a3.js → ordering-ui.fa5f19340751cb2d73a3.js} +2 -2
  3. package/_modules/components/BusinessProductsList/index.js +15 -4
  4. package/_modules/themes/callcenterOriginal/src/components/CartPopover/styles.js +1 -1
  5. package/_modules/themes/callcenterOriginal/src/components/Header/index.js +0 -1
  6. package/_modules/themes/callcenterOriginal/src/components/Header/styles.js +2 -2
  7. package/_modules/themes/five/src/components/Cart/index.js +2 -2
  8. package/_modules/themes/five/src/components/HighestRated/index.js +40 -7
  9. package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +2 -2
  10. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +4 -1
  11. package/_modules/themes/five/src/components/OrderDetails/index.js +2 -1
  12. package/_modules/themes/five/src/components/ProductForm/index.js +2 -2
  13. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +14 -13
  14. package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +1 -1
  15. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +3 -2
  16. package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +3 -2
  17. package/package.json +2 -2
  18. package/src/components/BusinessProductsList/index.js +9 -1
  19. package/src/themes/callcenterOriginal/src/components/CartPopover/styles.js +1 -1
  20. package/src/themes/callcenterOriginal/src/components/Header/index.js +0 -1
  21. package/src/themes/callcenterOriginal/src/components/Header/styles.js +2 -2
  22. package/src/themes/five/src/components/Cart/index.js +7 -1
  23. package/src/themes/five/src/components/HighestRated/index.js +35 -1
  24. package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +7 -1
  25. package/src/themes/five/src/components/OrderDetails/OrderEta.js +1 -1
  26. package/src/themes/five/src/components/OrderDetails/index.js +2 -1
  27. package/src/themes/five/src/components/ProductForm/index.js +2 -2
  28. package/src/themes/five/src/components/ProductOptionSubOption/index.js +11 -12
  29. package/src/themes/five/src/components/ProductOptionSubOption/styles.js +1 -1
  30. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +3 -2
  31. package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +3 -2
  32. package/template/pages/SignUpDriver/index.js +5 -1
  33. /package/_bundles/{0.ordering-ui.40e61237ed46b8c579a3.js → 0.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  34. /package/_bundles/{1.ordering-ui.40e61237ed46b8c579a3.js → 1.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  35. /package/_bundles/{2.ordering-ui.40e61237ed46b8c579a3.js → 2.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  36. /package/_bundles/{4.ordering-ui.40e61237ed46b8c579a3.js → 4.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  37. /package/_bundles/{5.ordering-ui.40e61237ed46b8c579a3.js → 5.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  38. /package/_bundles/{6.ordering-ui.40e61237ed46b8c579a3.js → 6.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  39. /package/_bundles/{7.ordering-ui.40e61237ed46b8c579a3.js.LICENSE.txt → 7.ordering-ui.fa5f19340751cb2d73a3.js.LICENSE.txt} +0 -0
  40. /package/_bundles/{8.ordering-ui.40e61237ed46b8c579a3.js → 8.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  41. /package/_bundles/{9.ordering-ui.40e61237ed46b8c579a3.js → 9.ordering-ui.fa5f19340751cb2d73a3.js} +0 -0
  42. /package/_bundles/{ordering-ui.40e61237ed46b8c579a3.js.LICENSE.txt → ordering-ui.fa5f19340751cb2d73a3.js.LICENSE.txt} +0 -0
  43. /package/template/{utils → Utils}/index.js +0 -0
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage, useOrder, BusinessList as BusinessListController } from 'ordering-components-external'
3
3
  import { BusinessController } from '../BusinessController'
4
4
  import { Button } from '../../styles/Buttons'
@@ -12,6 +12,9 @@ import {
12
12
  BusinessListWrapper
13
13
  } from './styles'
14
14
  import { AutoScroll } from '../AutoScroll'
15
+ import Modal from '../Modal'
16
+ import { BusinessPreorder } from '../BusinessPreorder'
17
+ import { getCateringValues } from '../../../../../utils'
15
18
 
16
19
  const HighestRatedUI = (props) => {
17
20
  const {
@@ -27,8 +30,25 @@ const HighestRatedUI = (props) => {
27
30
 
28
31
  const [, t] = useLanguage()
29
32
  const [orderState] = useOrder()
33
+ const [isPreorder, setIsPreorder] = useState(false)
34
+ const [preorderBusiness, setPreorderBusiness] = useState(null)
30
35
 
31
36
  const isBusinessWithReviews = businessesList?.businesses?.every((business) => business?.reviews?.total === 0)
37
+ const cateringTypeString = orderState?.options?.type === 7
38
+ ? 'catering_delivery'
39
+ : orderState?.options?.type === 8
40
+ ? 'catering_pickup'
41
+ : null
42
+ const cateringValues = preorderBusiness?.configs && getCateringValues(cateringTypeString, preorderBusiness?.configs)
43
+
44
+ const handleClosePreorder = () => {
45
+ setIsPreorder(false)
46
+ setPreorderBusiness(null)
47
+ }
48
+
49
+ useEffect(() => {
50
+ if (preorderBusiness) setIsPreorder(true)
51
+ }, [preorderBusiness])
32
52
 
33
53
  useEffect(() => {
34
54
  if (!businessesList.loading) {
@@ -90,6 +110,7 @@ const HighestRatedUI = (props) => {
90
110
  isCustomerMode={isCustomerMode}
91
111
  favoriteIds={favoriteIds}
92
112
  setFavoriteIds={setFavoriteIds}
113
+ onPreorderBusiness={setPreorderBusiness}
93
114
  />
94
115
  )
95
116
  ))
@@ -114,6 +135,19 @@ const HighestRatedUI = (props) => {
114
135
  </BusinessList>
115
136
  </BusinessListWrapper>
116
137
  </HighestRatedContainer>
138
+ <Modal
139
+ open={isPreorder}
140
+ width='760px'
141
+ onClose={() => handleClosePreorder()}
142
+ >
143
+ <BusinessPreorder
144
+ business={preorderBusiness}
145
+ handleClick={handleBusinessClick}
146
+ showButton
147
+ cateringPreorder={!!cateringTypeString}
148
+ {...cateringValues}
149
+ />
150
+ </Modal>
117
151
  {props.afterComponents?.map((AfterComponent, i) => (
118
152
  <AfterComponent key={i} {...props} />))}
119
153
  {props.afterElements?.map((AfterElement, i) => (
@@ -124,7 +124,7 @@ export const OrderBillSection = (props) => {
124
124
  )
125
125
  }
126
126
  {
127
- order?.taxes?.length > 0 && order?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0).map(tax => (
127
+ order?.taxes?.length > 0 && order?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'product').map(tax => (
128
128
  <tr key={tax?.id}>
129
129
  <td>
130
130
  {t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
@@ -181,6 +181,12 @@ export const OrderBillSection = (props) => {
181
181
  <td>{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true))}</td>
182
182
  </tr>
183
183
  )}
184
+ {order?.extra_value_checkprice && order?.extra_value_checkprice > 0 && (
185
+ <tr>
186
+ <td>{t('EXTRA_VALUE_CHECKPRICE', 'Extra value checkprice')}</td>
187
+ <td>{parsePrice(order?.extra_value_checkprice)}</td>
188
+ </tr>
189
+ )}
184
190
  {
185
191
  order?.taxes?.length > 0 && order?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map(tax => (
186
192
  <tr key={tax?.id}>
@@ -57,7 +57,7 @@ export const OrderEta = (props) => {
57
57
  }
58
58
  estimatedUtcTime = moment.utc(_delivery).add(totalEta, 'minutes')
59
59
  const _estimatedTime = outputFormat ? moment(estimatedUtcTime).local().format(outputFormat) : parseDate(estimatedUtcTime, { utc: false })
60
- setEstimatedDeliveryTime(_estimatedTime)
60
+ setEstimatedDeliveryTime(order?.status === 13 ? parseDate(_delivery, { utc: !!order?.delivery_datetime_utc, outputFormat: outputFormat }) : _estimatedTime)
61
61
  }
62
62
 
63
63
  useEffect(() => {
@@ -130,6 +130,7 @@ const OrderDetailsUI = (props) => {
130
130
  const completedStatus = [1, 2, 5, 6, 10, 11, 12, 15, 16, 17]
131
131
  const placeSpotTypes = [3, 4, 5]
132
132
  const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
133
+ const preorderStatus = [0, 13]
133
134
  const googleMapsApiKey = configs?.google_maps_api_key?.value
134
135
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
135
136
 
@@ -546,7 +547,7 @@ const OrderDetailsUI = (props) => {
546
547
  </DirectionButtonWrapper>
547
548
  )}
548
549
  </BusinessInfo>
549
- {!hideOrderActions && (
550
+ {!hideOrderActions && !preorderStatus.includes(order?.status) && (
550
551
  <BtsOrderStatus>
551
552
  <div>
552
553
  <Button
@@ -98,7 +98,7 @@ const ProductOptionsUI = (props) => {
98
98
  handleChangeSuboptionState,
99
99
  handleChangeCommentState,
100
100
  productAddedToCartLength,
101
- pizzaType,
101
+ pizzaState,
102
102
  handleFavoriteProduct,
103
103
  handleCreateGuestUser,
104
104
  actionStatus,
@@ -654,7 +654,7 @@ const ProductOptionsUI = (props) => {
654
654
  isSoldOut={isSoldOut}
655
655
  scrollDown={scrollDown}
656
656
  setIsScrollAvailable={setIsScrollAvailable}
657
- pizzaType={pizzaType}
657
+ pizzaState={pizzaState}
658
658
  productCart={productCart}
659
659
  />
660
660
  )
@@ -27,7 +27,7 @@ import MdRadioButtonUnchecked from '@meronex/icons/md/MdRadioButtonUnchecked'
27
27
 
28
28
  const ProductOptionSubOptionPropsAreEqual = (prevProps, nextProps) => {
29
29
  return JSON.stringify(prevProps.state) === JSON.stringify(nextProps.state) &&
30
- prevProps.pizzaType === nextProps.pizzaType &&
30
+ JSON.stringify(prevProps.pizzaState) === JSON.stringify(nextProps.pizzaState) &&
31
31
  prevProps.balance === nextProps.balance &&
32
32
  JSON.stringify(prevProps.productCart) === JSON.stringify(nextProps.productCart)
33
33
  }
@@ -44,9 +44,8 @@ const ProductOptionSubOptionUI = React.memo((props) => {
44
44
  changePosition,
45
45
  isSoldOut,
46
46
  setIsScrollAvailable,
47
- onChange,
48
- pizzaType,
49
- productCart
47
+ usePizzaValidation,
48
+ pizzaState
50
49
  } = props
51
50
 
52
51
  const disableIncrement = option?.limit_suboptions_by_max ? (balance === option?.max || state.quantity === suboption.max) : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
@@ -74,16 +73,18 @@ const ProductOptionSubOptionUI = React.memo((props) => {
74
73
  const handleSuboptionClick = () => {
75
74
  dirtyRef.current = true
76
75
  toggleSelect()
77
- if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1) && !state.selected) {
76
+ const minMaxValidation = option?.with_half_option ? usePizzaValidation : (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))
77
+ if (!state.selected && minMaxValidation) {
78
78
  setShowMessage(true)
79
79
  }
80
80
  }
81
81
 
82
82
  useEffect(() => {
83
- if (!(balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1) && !state.selected)) {
83
+ const minMaxValidation = option?.with_half_option ? usePizzaValidation : (!state.selected && balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))
84
+ if (!minMaxValidation) {
84
85
  setShowMessage(false)
85
86
  }
86
- }, [balance])
87
+ }, [balance, pizzaState?.[`option:${option?.id}`]?.value])
87
88
 
88
89
  useEffect(() => {
89
90
  if (balance === option?.max && state?.selected && dirtyRef) {
@@ -95,10 +96,10 @@ const ProductOptionSubOptionUI = React.memo((props) => {
95
96
  }, [state?.selected])
96
97
 
97
98
  useEffect(() => {
98
- if (pizzaType === 'mitad y mitad' && option?.with_half_option) {
99
+ if (option?.with_half_option) {
99
100
  handlePosition({}, 'left')
100
101
  }
101
- }, [pizzaType, state?.selected, suboption?.id])
102
+ }, [state?.selected, suboption?.id])
102
103
 
103
104
  return (
104
105
  <>
@@ -155,20 +156,18 @@ const ProductOptionSubOptionUI = React.memo((props) => {
155
156
  <>
156
157
  <BsCircleHalf
157
158
  className={[
158
- pizzaType === 'center' ? 'disabled disable-clicks' : '',
159
159
  'reverse',
160
160
  state.selected && state.position === 'left' ? 'selected' : null].filter(classname => classname).join(' ')}
161
161
  onClick={(e) => handlePosition(e, 'left')}
162
162
  />
163
163
  <BsCircleFill
164
164
  className={[
165
- pizzaType === 'mitad y mitad' ? 'disabled' : '',
165
+ pizzaState?.[`option:${option?.id}`]?.value === option?.max ? 'disabled' : '',
166
166
  state.selected && state.position === 'whole' ? 'selected' : null].filter(classname => classname).join(' ')}
167
167
  onClick={(e) => handlePosition(e, 'whole')}
168
168
  />
169
169
  <BsCircleHalf
170
170
  className={[
171
- pizzaType === 'center' ? 'disabled disable-clicks' : '',
172
171
  state.selected && state.position === 'right' ? 'selected' : null].filter(classname => classname).join(' ')}
173
172
  onClick={(e) => handlePosition(e, 'right')}
174
173
  />
@@ -56,7 +56,7 @@ export const Text = styled.div`
56
56
  text-overflow: ellipsis;
57
57
  ${props => props.theme?.rtl && css`
58
58
  margin-left: 0;
59
- margin-right: 10px;
59
+ margin-right: 10px;
60
60
  `}
61
61
  }
62
62
 
@@ -54,7 +54,8 @@ const SignUpDriverUI = (props) => {
54
54
  saveCustomerUser,
55
55
  fieldsNotValid,
56
56
  signupData,
57
- enableReCaptcha
57
+ enableReCaptcha,
58
+ isDriverSignup
58
59
  } = props
59
60
 
60
61
  const theme = useTheme()
@@ -385,7 +386,7 @@ const SignUpDriverUI = (props) => {
385
386
  </FormInput>
386
387
  </FormSide>
387
388
  <Alert
388
- title={t('SIGN_UP_FOR_BUSINESS', 'Sign up for business')}
389
+ title={isDriverSignup ? t('SIGN_UP_FOR_DRIVER', 'Sign up for driver') : t('SIGN_UP_FOR_BUSINESS', 'Sign up for business')}
389
390
  content={alertState.content}
390
391
  acceptText={t('ACCEPT', 'Accept')}
391
392
  open={alertState.open}
@@ -52,7 +52,8 @@ const SignUpDriverUI = (props) => {
52
52
  saveCustomerUser,
53
53
  fieldsNotValid,
54
54
  signupData,
55
- enableReCaptcha
55
+ enableReCaptcha,
56
+ isDriverSignup
56
57
  } = props
57
58
 
58
59
  const theme = useTheme()
@@ -381,7 +382,7 @@ const SignUpDriverUI = (props) => {
381
382
  </FormInput>
382
383
  </FormSide>
383
384
  <Alert
384
- title={t('SIGN_UP_FOR_BUSINESS', 'Sign up for business')}
385
+ title={isDriverSignup ? t('SIGN_UP_FOR_DRIVER', 'Sign up for driver') : t('SIGN_UP_FOR_BUSINESS', 'Sign up for business')}
385
386
  content={alertState.content}
386
387
  acceptText={t('ACCEPT', 'Accept')}
387
388
  open={alertState.open}
@@ -3,10 +3,14 @@ import { SignUpDriver as SignUpDriverController } from '../../../src/themes/five
3
3
  import { HelmetTags } from '../../components/HelmetTags'
4
4
 
5
5
  export const SignUpDriver = (props) => {
6
+ const SignUpDriverProps = {
7
+ ...props,
8
+ isDriverSignup: true
9
+ }
6
10
  return (
7
11
  <>
8
12
  <HelmetTags page='signup_driver' />
9
- <SignUpDriverController {...props} />
13
+ <SignUpDriverController {...SignUpDriverProps} />
10
14
  </>
11
15
  )
12
16
  }
File without changes