ordering-ui-external 2.0.2 → 2.0.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.32113e17b220a7b5ae09.js → 0.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  2. package/_bundles/{1.ordering-ui.32113e17b220a7b5ae09.js → 1.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  3. package/_bundles/{2.ordering-ui.32113e17b220a7b5ae09.js → 2.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  4. package/_bundles/{4.ordering-ui.32113e17b220a7b5ae09.js → 4.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  5. package/_bundles/{5.ordering-ui.32113e17b220a7b5ae09.js → 5.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  6. package/_bundles/{6.ordering-ui.32113e17b220a7b5ae09.js → 6.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  7. package/_bundles/{7.ordering-ui.32113e17b220a7b5ae09.js → 7.ordering-ui.a228aa8797d9d0fc5a6c.js} +1 -1
  8. package/_bundles/{7.ordering-ui.32113e17b220a7b5ae09.js.LICENSE.txt → 7.ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.32113e17b220a7b5ae09.js → 8.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  10. package/_bundles/{9.ordering-ui.32113e17b220a7b5ae09.js → 9.ordering-ui.a228aa8797d9d0fc5a6c.js} +0 -0
  11. package/_bundles/ordering-ui.a228aa8797d9d0fc5a6c.js +2 -0
  12. package/_bundles/{ordering-ui.32113e17b220a7b5ae09.js.LICENSE.txt → ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt} +0 -0
  13. package/_modules/themes/callcenterOriginal/index.js +7 -0
  14. package/_modules/themes/callcenterOriginal/src/components/Cart/index.js +46 -32
  15. package/_modules/themes/callcenterOriginal/src/components/Cart/styles.js +1 -1
  16. package/_modules/themes/callcenterOriginal/src/components/CartContent/index.js +53 -21
  17. package/_modules/themes/callcenterOriginal/src/components/CartContent/styles.js +6 -4
  18. package/_modules/themes/callcenterOriginal/src/components/CartPopover/index.js +5 -19
  19. package/_modules/themes/callcenterOriginal/src/components/Header/index.js +3 -21
  20. package/_modules/themes/callcenterOriginal/src/components/Header/styles.js +2 -2
  21. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
  22. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +1 -0
  23. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +13 -8
  24. package/_modules/themes/five/src/components/Cart/index.js +1 -1
  25. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +1 -1
  26. package/package.json +2 -2
  27. package/src/themes/callcenterOriginal/index.js +2 -0
  28. package/src/themes/callcenterOriginal/src/components/Cart/index.js +321 -307
  29. package/src/themes/callcenterOriginal/src/components/Cart/styles.js +1 -1
  30. package/src/themes/callcenterOriginal/src/components/CartContent/index.js +69 -50
  31. package/src/themes/callcenterOriginal/src/components/CartContent/styles.js +6 -0
  32. package/src/themes/callcenterOriginal/src/components/CartPopover/index.js +20 -32
  33. package/src/themes/callcenterOriginal/src/components/Header/index.js +276 -292
  34. package/src/themes/callcenterOriginal/src/components/Header/styles.js +19 -1
  35. package/src/themes/five/src/components/BusinessProductsCategories/index.js +1 -1
  36. package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -0
  37. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +5 -1
  38. package/src/themes/five/src/components/Cart/index.js +1 -1
  39. package/src/themes/five/src/components/RenderProductsLayout/index.js +1 -1
  40. package/_bundles/ordering-ui.32113e17b220a7b5ae09.js +0 -2
@@ -23,8 +23,7 @@ import {
23
23
  Exclamation,
24
24
  Spinner,
25
25
  CommentContainer,
26
- IconContainer,
27
- SavedContainer
26
+ IconContainer
28
27
  } from './styles'
29
28
  import { verifyDecimals } from '../../../../../utils'
30
29
  import MdCloseCircle from '@meronex/icons/ios/MdCloseCircle'
@@ -33,7 +32,6 @@ import BsInfoCircle from '@meronex/icons/bs/BsInfoCircle'
33
32
  const CartUI = (props) => {
34
33
  const {
35
34
  currentCartUuid,
36
- cart,
37
35
  clearCart,
38
36
  isProducts,
39
37
  changeQuantity,
@@ -52,7 +50,10 @@ const CartUI = (props) => {
52
50
  handleChangeComment,
53
51
  commentState,
54
52
  handleRemoveOfferClick,
55
- setPreorderBusiness
53
+ setPreorderBusiness,
54
+ cart: cartMulticart,
55
+ hideDeliveryFee,
56
+ hideDriverTip
56
57
  } = props
57
58
 
58
59
  const theme = useTheme()
@@ -73,6 +74,8 @@ const CartUI = (props) => {
73
74
  const [isUpselling, setIsUpselling] = useState(false)
74
75
 
75
76
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
77
+ const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
78
+ const cart = cartMulticart || orderState?.carts?.[`businessId:${props.cart?.business_id}`]
76
79
 
77
80
  const momentFormatted = !orderState?.option?.moment
78
81
  ? t('RIGHT_NOW', 'Right Now')
@@ -95,7 +98,31 @@ const CartUI = (props) => {
95
98
  }
96
99
 
97
100
  const handleClickCheckout = () => {
98
- events.emit('go_to_page', { page: 'checkout', params: { cartUuid: cart.uuid } })
101
+ const cartsAvailable = Object.values(orderState?.carts)?.filter(cart => cart?.valid && cart?.status !== 2)
102
+ if (cartsAvailable.length === 1) {
103
+ events.emit('go_to_page', { page: 'checkout', params: { cartUuid: cartsAvailable[0]?.uuid } })
104
+ } else {
105
+ const groupKeys = {}
106
+ cartsAvailable.forEach(_cart => {
107
+ groupKeys[_cart?.group?.uuid]
108
+ ? groupKeys[_cart?.group?.uuid] += 1
109
+ : groupKeys[_cart?.group?.uuid ?? 'null'] = 1
110
+ })
111
+
112
+ if (
113
+ (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
114
+ Object.keys(groupKeys).length > 1
115
+ ) {
116
+ events.emit('go_to_page', { page: 'multi_cart' })
117
+ } else {
118
+ events.emit('go_to_page', {
119
+ page: 'multi_checkout',
120
+ params: {
121
+ cartUuid: cartsAvailable[0]?.group?.uuid
122
+ }
123
+ })
124
+ }
125
+ }
99
126
  events.emit('cart_popover_closed')
100
127
  onClickCheckout && onClickCheckout()
101
128
  }
@@ -172,326 +199,313 @@ const CartUI = (props) => {
172
199
  }, [isCustomMode])
173
200
 
174
201
  return (
175
- <>
176
- {props.beforeElements?.map((BeforeElement, i) => (
177
- <React.Fragment key={i}>
178
- {BeforeElement}
179
- </React.Fragment>))}
180
- {props.beforeComponents?.map((BeforeComponent, i) => (
181
- <BeforeComponent key={i} {...props} />))}
182
- <CartContainer className='cart'>
183
- <CartSticky isCartOnProductsList={isCartOnProductsList}>
184
- <BusinessItemAccordion
185
- isCartPending={isCartPending}
186
- currentCartUuid={currentCartUuid}
187
- uuid={cart?.uuid}
188
- isCheckout={isCheckout}
189
- orderTotal={cart?.total}
190
- business={cart?.business}
191
- isClosed={!cart?.valid_schedule}
192
- moment={momentFormatted}
193
- isProducts={isProducts}
194
- isValidProducts={cart?.valid_products}
195
- isForceOpenAccordion={isForceOpenCart}
196
- isCartOnProductsList={isCartOnProductsList}
197
- handleClearProducts={handleClearProducts}
198
- handleStoreRedirect={handleStoreRedirect}
199
- handleCartOpen={handleCartOpen}
200
- isStore={isStore}
201
- setPreorderBusiness={setPreorderBusiness}
202
- >
203
- {cart?.products?.length > 0 && cart?.products.map(product => (
204
- <ProductItemAccordion
205
- key={product.code}
206
- isCartPending={isCartPending}
207
- isCartProduct
208
- product={product}
209
- isCheckout={isCheckout}
210
- changeQuantity={changeQuantity}
211
- getProductMax={getProductMax}
212
- offsetDisabled={offsetDisabled}
213
- onDeleteProduct={handleDeleteClick}
214
- onEditProduct={handleEditProduct}
215
- />
216
- ))}
217
- {cart?.valid_products && (
218
- <OrderBill isCheckout={isCheckout}>
219
- <table className='order-info'>
220
- <tbody>
202
+ <CartContainer className='cart'>
203
+ <CartSticky isCartOnProductsList={isCartOnProductsList}>
204
+ <BusinessItemAccordion
205
+ isCartPending={isCartPending}
206
+ currentCartUuid={currentCartUuid}
207
+ uuid={cart?.uuid}
208
+ isCheckout={isCheckout}
209
+ total={cart?.total}
210
+ business={cart?.business}
211
+ isClosed={!cart?.valid_schedule}
212
+ moment={momentFormatted}
213
+ isProducts={isProducts}
214
+ isValidProducts={cart?.valid_products}
215
+ isForceOpenAccordion={isForceOpenCart}
216
+ isCartOnProductsList={isCartOnProductsList}
217
+ handleClearProducts={handleClearProducts}
218
+ handleStoreRedirect={handleStoreRedirect}
219
+ handleCartOpen={handleCartOpen}
220
+ isStore={isStore}
221
+ setPreorderBusiness={setPreorderBusiness}
222
+ checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || !cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address}
223
+ >
224
+ {cart?.products?.length > 0 && cart?.products.map(product => (
225
+ <ProductItemAccordion
226
+ key={product.code}
227
+ isCartPending={isCartPending}
228
+ isCartProduct
229
+ product={product}
230
+ isCheckout={isCheckout}
231
+ changeQuantity={changeQuantity}
232
+ getProductMax={getProductMax}
233
+ offsetDisabled={offsetDisabled}
234
+ onDeleteProduct={handleDeleteClick}
235
+ onEditProduct={handleEditProduct}
236
+ />
237
+ ))}
238
+ {cart?.valid_products && (
239
+ <OrderBill isCheckout={isCheckout}>
240
+ <table className='order-info'>
241
+ <tbody>
242
+ <tr>
243
+ <td>{t('SUBTOTAL', 'Subtotal')}</td>
244
+ <td>{parsePrice(cart?.subtotal + getIncludedTaxes())}</td>
245
+ </tr>
246
+ {cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
221
247
  <tr>
222
- <td>{t('SUBTOTAL', 'Subtotal')}</td>
223
- <td>{parsePrice(cart?.subtotal + getIncludedTaxes())}</td>
248
+ {cart?.discount_type === 1 ? (
249
+ <td>
250
+ {t('DISCOUNT', 'Discount')}{' '}
251
+ <span>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</span>
252
+ </td>
253
+ ) : (
254
+ <td>{t('DISCOUNT', 'Discount')}</td>
255
+ )}
256
+ <td>- {parsePrice(cart?.discount || 0)}</td>
224
257
  </tr>
225
- {cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && (
258
+ )}
259
+ {
260
+ cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 1)?.map(offer => (
261
+ <tr key={offer.id}>
262
+ <td className='icon'>
263
+ {offer.name}
264
+ {offer.rate_type === 1 && (
265
+ <span>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</span>
266
+ )}
267
+ <IconContainer>
268
+ <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })} />
269
+ <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
270
+ </IconContainer>
271
+ </td>
272
+ <td>
273
+ - {parsePrice(offer?.summary?.discount)}
274
+ </td>
275
+ </tr>
276
+ ))
277
+ }
278
+ <tr>
279
+ <td>
280
+ <Divider />
281
+ </td>
282
+ <td>
283
+ <Divider />
284
+ </td>
285
+ </tr>
286
+ {
287
+ cart?.offers?.filter(offer => offer?.target === 1)?.length > 0 &&
288
+ cart?.subtotal_with_discount > 0 &&
289
+ cart?.discount > 0 &&
290
+ cart?.total >= 0 &&
291
+ (
226
292
  <tr>
227
- {cart?.discount_type === 1 ? (
228
- <td>
229
- {t('DISCOUNT', 'Discount')}{' '}
230
- <span>{`(${verifyDecimals(cart?.discount_rate, parsePrice)}%)`}</span>
231
- </td>
293
+ <td>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</td>
294
+ {cart?.business?.tax_type === 1 ? (
295
+ <td>{parsePrice(cart?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0)}</td>
232
296
  ) : (
233
- <td>{t('DISCOUNT', 'Discount')}</td>
297
+ <td>{parsePrice(cart?.subtotal_with_discount ?? 0)}</td>
234
298
  )}
235
- <td>- {parsePrice(cart?.discount || 0)}</td>
236
299
  </tr>
237
- )}
238
- {
239
- cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 1)?.map(offer => (
240
- <tr key={offer.id}>
241
- <td className='icon'>
242
- {offer.name}
243
- {offer.rate_type === 1 && (
244
- <span>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</span>
245
- )}
246
- <IconContainer>
247
- <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_1' })} />
248
- <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
249
- </IconContainer>
250
- </td>
251
- <td>
252
- - {parsePrice(offer?.summary?.discount)}
253
- </td>
254
- </tr>
255
- ))
256
- }
300
+ )
301
+ }
302
+ {
303
+ cart?.taxes?.length > 0 && cart?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0).map(tax => (
304
+ <tr key={tax?.id}>
305
+ <td className='icon'>
306
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
307
+ <span>{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}</span>
308
+ <Exclamation onClick={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
309
+ <BsInfoCircle size='20' color={theme.colors.primary} />
310
+ </Exclamation>
311
+ </td>
312
+ <td>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</td>
313
+ </tr>
314
+ ))
315
+ }
316
+ {
317
+ cart?.fees?.length > 0 && cart?.fees?.filter(fee => !(fee.fixed === 0 && fee.percentage === 0)).map(fee => (
318
+ <tr key={fee.id}>
319
+ <td className='icon'>
320
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
321
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%)
322
+ <Exclamation onClick={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
323
+ <BsInfoCircle size='20' color={theme.colors.primary} />
324
+ </Exclamation>
325
+ </td>
326
+ <td>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</td>
327
+ </tr>
328
+ ))
329
+ }
330
+ {
331
+ cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 3)?.map(offer => (
332
+ <tr key={offer.id}>
333
+ <td className='icon'>
334
+ {offer.name}
335
+ {offer?.rate_type === 1 && (
336
+ <span>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</span>
337
+ )}
338
+ <IconContainer>
339
+ <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })} />
340
+ <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
341
+ </IconContainer>
342
+ </td>
343
+ <td>
344
+ - {parsePrice(offer?.summary?.discount)}
345
+ </td>
346
+ </tr>
347
+ ))
348
+ }
349
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
257
350
  <tr>
258
- <td>
259
- <Divider />
260
- </td>
261
- <td>
262
- <Divider />
263
- </td>
351
+ <td>{t('DELIVERY_FEE', 'Delivery Fee')}</td>
352
+ <td>{parsePrice(cart?.delivery_price)}</td>
264
353
  </tr>
265
- {
266
- cart?.offers?.filter(offer => offer?.target === 1)?.length > 0 &&
267
- cart?.subtotal_with_discount > 0 &&
268
- cart?.discount > 0 &&
269
- cart?.total >= 0 &&
270
- (
271
- <tr>
272
- <td>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</td>
273
- {cart?.business?.tax_type === 1 ? (
274
- <td>{parsePrice(cart?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0)}</td>
275
- ) : (
276
- <td>{parsePrice(cart?.subtotal_with_discount ?? 0)}</td>
354
+ )}
355
+ {
356
+ cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 2)?.map(offer => (
357
+ <tr key={offer.id}>
358
+ <td className='icon'>
359
+ {offer.name}
360
+ {offer?.rate_type === 1 && (
361
+ <span>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</span>
277
362
  )}
278
- </tr>
279
- )
280
- }
281
- {
282
- cart?.taxes?.length > 0 && cart?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0).map(tax => (
283
- <tr key={tax?.id}>
284
- <td className='icon'>
285
- {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
286
- <span>{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}</span>
287
- <Exclamation onClick={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
288
- <BsInfoCircle size='20' color={theme.colors.primary} />
289
- </Exclamation>
290
- </td>
291
- <td>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</td>
292
- </tr>
293
- ))
294
- }
295
- {
296
- cart?.fees?.length > 0 && cart?.fees?.filter(fee => !(fee.fixed === 0 && fee.percentage === 0)).map(fee => (
297
- <tr key={fee.id}>
298
- <td className='icon'>
299
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
300
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%)
301
- <Exclamation onClick={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
302
- <BsInfoCircle size='20' color={theme.colors.primary} />
303
- </Exclamation>
304
- </td>
305
- <td>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</td>
306
- </tr>
307
- ))
308
- }
309
- {
310
- cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 3)?.map(offer => (
311
- <tr key={offer.id}>
312
- <td className='icon'>
313
- {offer.name}
314
- {offer?.rate_type === 1 && (
315
- <span>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</span>
316
- )}
317
- <IconContainer>
318
- <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })} />
319
- <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
320
- </IconContainer>
321
- </td>
322
- <td>
323
- - {parsePrice(offer?.summary?.discount)}
324
- </td>
325
- </tr>
326
- ))
327
- }
328
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
329
- <tr>
330
- <td>{t('DELIVERY_FEE', 'Delivery Fee')}</td>
331
- <td>{parsePrice(cart?.delivery_price)}</td>
332
- </tr>
333
- )}
334
- {
335
- cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 2)?.map(offer => (
336
- <tr key={offer.id}>
337
- <td className='icon'>
338
- {offer.name}
339
- {offer?.rate_type === 1 && (
340
- <span>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</span>
341
- )}
342
- <IconContainer>
343
- <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })} />
344
- <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
345
- </IconContainer>
346
- </td>
347
- <td>
348
- - {parsePrice(offer?.summary?.discount)}
349
- </td>
350
- </tr>
351
- ))
352
- }
353
- {cart?.driver_tip > 0 && (
354
- <tr>
363
+ <IconContainer>
364
+ <BsInfoCircle size='20' color={theme.colors.primary} onClick={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_2' })} />
365
+ <MdCloseCircle size='24' color={theme.colors.primary} onClick={() => onRemoveOffer(offer?.id)} />
366
+ </IconContainer>
367
+ </td>
355
368
  <td>
356
- {t('DRIVER_TIP', 'Driver tip')}{' '}
357
- {cart?.driver_tip_rate > 0 &&
358
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
359
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
360
- (
361
- <span>{`(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`}</span>
362
- )}
369
+ - {parsePrice(offer?.summary?.discount)}
363
370
  </td>
364
- <td>{parsePrice(cart?.driver_tip)}</td>
365
371
  </tr>
366
- )}
367
- </tbody>
368
- </table>
369
- {isCouponEnabled && !isCartPending && ((isCheckout || isCartPopover) && !(isCheckout && isCartPopover)) && (
370
- <CouponContainer>
371
- <CouponControl
372
- businessId={cart.business_id}
373
- price={cart.total}
374
- />
375
- </CouponContainer>
376
- )}
377
- <table className='total'>
372
+ ))
373
+ }
374
+ {cart?.driver_tip > 0 && !hideDriverTip && (
375
+ <tr>
376
+ <td>
377
+ {t('DRIVER_TIP', 'Driver tip')}{' '}
378
+ {cart?.driver_tip_rate > 0 &&
379
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
380
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
381
+ (
382
+ <span>{`(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`}</span>
383
+ )}
384
+ </td>
385
+ <td>{parsePrice(cart?.driver_tip)}</td>
386
+ </tr>
387
+ )}
388
+ </tbody>
389
+ </table>
390
+ {isCouponEnabled && !isCartPending && ((isCheckout || isCartPopover) && !(isCheckout && isCartPopover)) && (
391
+ <CouponContainer>
392
+ <CouponControl
393
+ businessId={cart.business_id}
394
+ price={cart.total}
395
+ />
396
+ </CouponContainer>
397
+ )}
398
+ <table className='total'>
399
+ <tbody>
400
+ <tr>
401
+ <td>{t('TOTAL', 'Total')}</td>
402
+ <td>{parsePrice(cart?.total >= 0 ? cart?.total : 0)}</td>
403
+ </tr>
404
+ </tbody>
405
+ </table>
406
+ {cart?.status !== 2 && (
407
+ <table className='comments'>
378
408
  <tbody>
379
409
  <tr>
380
- <td>{t('TOTAL', 'Total')}</td>
381
- <td>{parsePrice(cart?.total >= 0 ? cart?.total : 0)}</td>
410
+ <td>{t('COMMENTS', 'Comments')}</td>
411
+ </tr>
412
+ <tr>
413
+ <CommentContainer>
414
+ <TextArea
415
+ defaultValue={cart?.comment}
416
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
417
+ onChange={(e) => handleChangeComment(e.target.value)}
418
+ />
419
+ {commentState?.loading && (
420
+ <Spinner>
421
+ <SpinnerLoader
422
+ style={{ height: 100 }}
423
+ />
424
+ </Spinner>
425
+ )}
426
+ </CommentContainer>
382
427
  </tr>
383
428
  </tbody>
384
429
  </table>
385
- {cart?.status !== 2 && (
386
- <table className='comments'>
387
- <tbody>
388
- <tr>
389
- <td>{t('COMMENTS', 'Comments')}</td>
390
- </tr>
391
- <tr>
392
- <CommentContainer>
393
- <TextArea
394
- defaultValue={cart?.comment}
395
- placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
396
- onChange={(e) => handleChangeComment(e.target.value)}
397
- />
398
- {commentState?.loading && (
399
- <Spinner>
400
- <SpinnerLoader
401
- style={{ height: 100 }}
402
- />
403
- </Spinner>
404
- )}
405
- </CommentContainer>
406
- </tr>
407
- </tbody>
408
- </table>
409
- )}
410
- </OrderBill>
411
- )}
412
- {(onClickCheckout || isForceOpenCart) && !isCheckout && cart?.valid_products && (
413
- <CheckoutAction>
414
- <Button
415
- color={(!cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address) ? 'secundary' : 'primary'}
416
- onClick={checkOutBtnClick}
417
- disabled={(openUpselling && !canOpenUpselling) || !cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address}
418
- >
419
- {!cart?.valid_address ? (
420
- t('OUT_OF_COVERAGE', 'Out of Coverage')
421
- ) : !cart?.valid_maximum ? (
422
- `${t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order')}: ${parsePrice(cart?.maximum)}`
423
- ) : (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) ? (
424
- `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
425
- ) : !openUpselling ^ canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')}
426
- </Button>
427
- </CheckoutAction>
428
- )}
429
- </BusinessItemAccordion>
430
- {!isStore && <Divider />}
431
- <Confirm
432
- title={t('PRODUCT', 'Product')}
433
- content={confirm.content}
434
- acceptText={t('ACCEPT', 'Accept')}
435
- open={confirm.open}
436
- onClose={() => setConfirm({ ...confirm, open: false })}
437
- onCancel={() => setConfirm({ ...confirm, open: false })}
438
- onAccept={confirm.handleOnAccept}
439
- closeOnBackdrop={false}
440
- />
441
- <Modal
442
- width='40%'
443
- open={openProduct}
444
- padding='0'
445
- closeOnBackdrop
446
- onClose={() => setModalIsOpen(false)}
447
- >
448
- <ProductForm
449
- isCartProduct
450
- productCart={curProduct}
451
- businessSlug={cart?.business?.slug}
452
- businessId={cart?.business_id}
453
- categoryId={curProduct?.category_id}
454
- productId={curProduct?.id}
455
- onSave={handlerProductAction}
456
- />
457
- </Modal>
458
- <Modal
459
- width='70%'
460
- open={openTaxModal.open}
461
- padding='20px'
462
- closeOnBackdrop
463
- title={`${openTaxModal.data?.name ||
464
- t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
465
- onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
466
- modalTitleStyle={{ display: 'flex', justifyContent: 'center' }}
467
- >
468
- <TaxInformation
469
- type={openTaxModal.type}
470
- data={openTaxModal.data}
471
- products={cart.products}
472
- />
473
- </Modal>
474
- {(openUpselling || isUpselling) && (
475
- <UpsellingPage
476
- businessId={cart.business_id}
477
- isCustomMode={isCustomMode}
478
- cartProducts={cart.products}
479
- business={cart.business}
480
- handleUpsellingPage={handleUpsellingPage}
481
- openUpselling={openUpselling}
482
- canOpenUpselling={canOpenUpselling}
483
- setCanOpenUpselling={setCanOpenUpselling}
484
- />
430
+ )}
431
+ </OrderBill>
432
+ )}
433
+ {(onClickCheckout || isForceOpenCart) && !isCheckout && cart?.valid_products && (!isMultiCheckout || isStore) && (
434
+ <CheckoutAction>
435
+ <Button
436
+ color={(!cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address) ? 'secundary' : 'primary'}
437
+ onClick={checkOutBtnClick}
438
+ disabled={(openUpselling && !canOpenUpselling) || !cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address}
439
+ >
440
+ {!cart?.valid_address ? (
441
+ t('OUT_OF_COVERAGE', 'Out of Coverage')
442
+ ) : !cart?.valid_maximum ? (
443
+ `${t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order')}: ${parsePrice(cart?.maximum)}`
444
+ ) : (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) ? (
445
+ `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
446
+ ) : !openUpselling ^ canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')}
447
+ </Button>
448
+ </CheckoutAction>
485
449
  )}
486
- </CartSticky>
487
- </CartContainer>
488
- {props.afterComponents?.map((AfterComponent, i) => (
489
- <AfterComponent key={i} {...props} />))}
490
- {props.afterElements?.map((AfterElement, i) => (
491
- <React.Fragment key={i}>
492
- {AfterElement}
493
- </React.Fragment>))}
494
- </>
450
+ </BusinessItemAccordion>
451
+ {!isStore && <Divider />}
452
+ <Confirm
453
+ title={t('PRODUCT', 'Product')}
454
+ content={confirm.content}
455
+ acceptText={t('ACCEPT', 'Accept')}
456
+ open={confirm.open}
457
+ onClose={() => setConfirm({ ...confirm, open: false })}
458
+ onCancel={() => setConfirm({ ...confirm, open: false })}
459
+ onAccept={confirm.handleOnAccept}
460
+ closeOnBackdrop={false}
461
+ />
462
+ <Modal
463
+ width='40%'
464
+ open={openProduct}
465
+ padding='0'
466
+ closeOnBackdrop
467
+ onClose={() => setModalIsOpen(false)}
468
+ >
469
+ <ProductForm
470
+ isCartProduct
471
+ productCart={curProduct}
472
+ businessSlug={cart?.business?.slug}
473
+ businessId={cart?.business_id}
474
+ categoryId={curProduct?.category_id}
475
+ productId={curProduct?.id}
476
+ onSave={handlerProductAction}
477
+ />
478
+ </Modal>
479
+ <Modal
480
+ width='70%'
481
+ open={openTaxModal.open}
482
+ padding='20px'
483
+ closeOnBackdrop
484
+ title={`${openTaxModal.data?.name ||
485
+ t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
486
+ onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
487
+ modalTitleStyle={{ display: 'flex', justifyContent: 'center' }}
488
+ >
489
+ <TaxInformation
490
+ type={openTaxModal.type}
491
+ data={openTaxModal.data}
492
+ products={cart.products}
493
+ />
494
+ </Modal>
495
+ {(openUpselling || isUpselling) && (
496
+ <UpsellingPage
497
+ businessId={cart.business_id}
498
+ isCustomMode={isCustomMode}
499
+ cartProducts={cart.products}
500
+ business={cart.business}
501
+ handleUpsellingPage={handleUpsellingPage}
502
+ openUpselling={openUpselling}
503
+ canOpenUpselling={canOpenUpselling}
504
+ setCanOpenUpselling={setCanOpenUpselling}
505
+ />
506
+ )}
507
+ </CartSticky>
508
+ </CartContainer>
495
509
  )
496
510
  }
497
511