ordering-ui-external 2.4.3 → 2.4.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 (26) hide show
  1. package/_bundles/{7.ordering-ui.d43a68e386178f10fff2.js → 7.ordering-ui.a403107e2b344dcd35e9.js} +1 -1
  2. package/_bundles/ordering-ui.a403107e2b344dcd35e9.js +2 -0
  3. package/_modules/themes/five/src/components/Cart/index.js +12 -29
  4. package/_modules/themes/five/src/components/CartContent/index.js +25 -7
  5. package/_modules/themes/five/src/components/CartContent/styles.js +7 -3
  6. package/_modules/themes/five/src/components/Checkout/index.js +7 -7
  7. package/_modules/themes/five/src/components/MultiCheckout/index.js +9 -7
  8. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +8 -7
  9. package/package.json +2 -2
  10. package/src/themes/five/src/components/Cart/index.js +11 -17
  11. package/src/themes/five/src/components/CartContent/index.js +58 -22
  12. package/src/themes/five/src/components/CartContent/styles.js +26 -0
  13. package/src/themes/five/src/components/Checkout/index.js +1 -1
  14. package/src/themes/five/src/components/MultiCheckout/index.js +7 -6
  15. package/src/themes/five/src/components/OrderDetails/OrderEta.js +6 -5
  16. package/_bundles/ordering-ui.d43a68e386178f10fff2.js +0 -2
  17. /package/_bundles/{0.ordering-ui.d43a68e386178f10fff2.js → 0.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  18. /package/_bundles/{1.ordering-ui.d43a68e386178f10fff2.js → 1.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  19. /package/_bundles/{2.ordering-ui.d43a68e386178f10fff2.js → 2.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  20. /package/_bundles/{4.ordering-ui.d43a68e386178f10fff2.js → 4.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  21. /package/_bundles/{5.ordering-ui.d43a68e386178f10fff2.js → 5.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  22. /package/_bundles/{6.ordering-ui.d43a68e386178f10fff2.js → 6.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  23. /package/_bundles/{7.ordering-ui.d43a68e386178f10fff2.js.LICENSE.txt → 7.ordering-ui.a403107e2b344dcd35e9.js.LICENSE.txt} +0 -0
  24. /package/_bundles/{8.ordering-ui.d43a68e386178f10fff2.js → 8.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  25. /package/_bundles/{9.ordering-ui.d43a68e386178f10fff2.js → 9.ordering-ui.a403107e2b344dcd35e9.js} +0 -0
  26. /package/_bundles/{ordering-ui.d43a68e386178f10fff2.js.LICENSE.txt → ordering-ui.a403107e2b344dcd35e9.js.LICENSE.txt} +0 -0
@@ -44,7 +44,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
44
44
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
45
45
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
46
46
  var CartUI = function CartUI(props) {
47
- var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _theme$header, _theme$header$compone, _theme$header$compone2, _theme$header$compone3, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul, _orderState$carts, _props$cart, _theme$viewString, _theme$viewString$com, _theme$viewString$com2, _theme$viewString$com3, _theme$viewString$com4, _theme$viewString2, _theme$viewString2$co, _theme$viewString2$co2, _theme$viewString2$co3, _theme$viewString2$co4, _orderState$options, _orderState$options2, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers3$filter, _cart$offers4, _cart$offers4$filter, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes2, _cart$taxes3, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _cart$offers6$filter, _orderState$options3, _cart$offers7, _cart$offers8, _cart$offers8$filter, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options4, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _orderState$options5, _cart$business2, _cart$business3, _curProduct$calendar_, _openTaxModal$data, _openTaxModal$data2, _openTaxModal$data3, _openTaxModal$data4, _openTaxModal$data$fi, _openTaxModal$data5, _openTaxModal$data6, _props$afterComponent, _props$afterElements;
47
+ var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul, _orderState$carts, _props$cart, _theme$viewString, _theme$viewString$com, _theme$viewString$com2, _theme$viewString$com3, _theme$viewString$com4, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _theme$viewString2, _theme$viewString2$co, _theme$viewString2$co2, _theme$viewString2$co3, _theme$viewString2$co4, _orderState$options, _orderState$options2, _configs$format_numbe, _configs$format_numbe2, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers3$filter, _cart$offers4, _cart$offers4$filter, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes2, _cart$taxes3, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _cart$offers6$filter, _orderState$options3, _cart$offers7, _cart$offers8, _cart$offers8$filter, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options4, _validationFields$fie7, _validationFields$fie8, _validationFields$fie9, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _orderState$options5, _cart$business2, _cart$business3, _curProduct$calendar_, _openTaxModal$data, _openTaxModal$data2, _openTaxModal$data3, _openTaxModal$data4, _openTaxModal$data$fi, _openTaxModal$data5, _openTaxModal$data6, _props$afterComponent, _props$afterElements;
48
48
  var currentCartUuid = props.currentCartUuid,
49
49
  clearCart = props.clearCart,
50
50
  isProducts = props.isProducts,
@@ -142,28 +142,15 @@ var CartUI = function CartUI(props) {
142
142
  openChangeStore = _useState16[0],
143
143
  setOpenChangeStore = _useState16[1];
144
144
  var businessUrlTemplate = (site === null || site === void 0 ? void 0 : site.business_url_template) || '/store/:business_slug';
145
- var isChewLayout = (theme === null || theme === void 0 ? void 0 : (_theme$header = theme.header) === null || _theme$header === void 0 ? void 0 : (_theme$header$compone = _theme$header.components) === null || _theme$header$compone === void 0 ? void 0 : (_theme$header$compone2 = _theme$header$compone.layout) === null || _theme$header$compone2 === void 0 ? void 0 : (_theme$header$compone3 = _theme$header$compone2.type) === null || _theme$header$compone3 === void 0 ? void 0 : _theme$header$compone3.toLowerCase()) === 'chew';
146
145
  var isCouponEnabled = validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie = validationFields.fields) === null || _validationFields$fie === void 0 ? void 0 : (_validationFields$fie2 = _validationFields$fie.checkout) === null || _validationFields$fie2 === void 0 ? void 0 : (_validationFields$fie3 = _validationFields$fie2.coupon) === null || _validationFields$fie3 === void 0 ? void 0 : _validationFields$fie3.enabled;
147
146
  var cateringTypes = [7, 8];
148
147
  var isMultiCheckout = (configs === null || configs === void 0 ? void 0 : (_configs$checkout_mul = configs.checkout_multi_business_enabled) === null || _configs$checkout_mul === void 0 ? void 0 : _configs$checkout_mul.value) === '1';
149
148
  var cart = cartMulticart || (orderState === null || orderState === void 0 ? void 0 : (_orderState$carts = orderState.carts) === null || _orderState$carts === void 0 ? void 0 : _orderState$carts["businessId:".concat((_props$cart = props.cart) === null || _props$cart === void 0 ? void 0 : _props$cart.business_id)]);
150
149
  var viewString = isStore ? 'business_view' : 'header';
151
- var hideCartComments = theme === null || theme === void 0 ? void 0 : (_theme$viewString = theme[viewString]) === null || _theme$viewString === void 0 ? void 0 : (_theme$viewString$com = _theme$viewString.components) === null || _theme$viewString$com === void 0 ? void 0 : (_theme$viewString$com2 = _theme$viewString$com.cart) === null || _theme$viewString$com2 === void 0 ? void 0 : (_theme$viewString$com3 = _theme$viewString$com2.components) === null || _theme$viewString$com3 === void 0 ? void 0 : (_theme$viewString$com4 = _theme$viewString$com3.comments) === null || _theme$viewString$com4 === void 0 ? void 0 : _theme$viewString$com4.hidden;
152
- var hideCartDiscount = theme === null || theme === void 0 ? void 0 : (_theme$viewString2 = theme[viewString]) === null || _theme$viewString2 === void 0 ? void 0 : (_theme$viewString2$co = _theme$viewString2.components) === null || _theme$viewString2$co === void 0 ? void 0 : (_theme$viewString2$co2 = _theme$viewString2$co.cart) === null || _theme$viewString2$co2 === void 0 ? void 0 : (_theme$viewString2$co3 = _theme$viewString2$co2.components) === null || _theme$viewString2$co3 === void 0 ? void 0 : (_theme$viewString2$co4 = _theme$viewString2$co3.discount) === null || _theme$viewString2$co4 === void 0 ? void 0 : _theme$viewString2$co4.hidden;
150
+ var hideCartComments = (theme === null || theme === void 0 ? void 0 : (_theme$viewString = theme[viewString]) === null || _theme$viewString === void 0 ? void 0 : (_theme$viewString$com = _theme$viewString.components) === null || _theme$viewString$com === void 0 ? void 0 : (_theme$viewString$com2 = _theme$viewString$com.cart) === null || _theme$viewString$com2 === void 0 ? void 0 : (_theme$viewString$com3 = _theme$viewString$com2.components) === null || _theme$viewString$com3 === void 0 ? void 0 : (_theme$viewString$com4 = _theme$viewString$com3.comments) === null || _theme$viewString$com4 === void 0 ? void 0 : _theme$viewString$com4.hidden) || !(validationFields !== null && validationFields !== void 0 && (_validationFields$fie4 = validationFields.fields) !== null && _validationFields$fie4 !== void 0 && (_validationFields$fie5 = _validationFields$fie4.checkout) !== null && _validationFields$fie5 !== void 0 && (_validationFields$fie6 = _validationFields$fie5.comments) !== null && _validationFields$fie6 !== void 0 && _validationFields$fie6.enabled);
151
+ var hideCartDiscount = theme === null || theme === void 0 ? void 0 : (_theme$viewString2 = theme[viewString]) === null || _theme$viewString2 === void 0 ? void 0 : (_theme$viewString2$co = _theme$viewString2.components) === null || _theme$viewString2$co === void 0 ? void 0 : (_theme$viewString2$co2 = _theme$viewString2$co.cart) === null || _theme$viewString2$co2 === void 0 ? void 0 : (_theme$viewString2$co3 = _theme$viewString2$co2.components) === null || _theme$viewString2$co3 === void 0 ? void 0 : (_theme$viewString2$co4 = _theme$viewString2$co3.discount_coupon) === null || _theme$viewString2$co4 === void 0 ? void 0 : _theme$viewString2$co4.hidden;
153
152
  var cateringTypeString = (orderState === null || orderState === void 0 ? void 0 : (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 7 ? 'catering_delivery' : (orderState === null || orderState === void 0 ? void 0 : (_orderState$options2 = orderState.options) === null || _orderState$options2 === void 0 ? void 0 : _orderState$options2.type) === 8 ? 'catering_pickup' : null;
154
- var splitCateringValue = function splitCateringValue(configName) {
155
- var _businessConfigs$find, _businessConfigs$find2, _businessConfigs$find3, _businessConfigs$find4;
156
- return (_businessConfigs$find = businessConfigs.find(function (config) {
157
- return config.key === configName;
158
- })) === null || _businessConfigs$find === void 0 ? void 0 : (_businessConfigs$find2 = _businessConfigs$find.value) === null || _businessConfigs$find2 === void 0 ? void 0 : (_businessConfigs$find3 = _businessConfigs$find2.split('|')) === null || _businessConfigs$find3 === void 0 ? void 0 : (_businessConfigs$find4 = _businessConfigs$find3.find(function (val) {
159
- return val.includes(cateringTypeString);
160
- })) === null || _businessConfigs$find4 === void 0 ? void 0 : _businessConfigs$find4.split(',')[1];
161
- };
162
- var preorderSlotInterval = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_slot_interval'));
163
- var preorderLeadTime = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_lead_time'));
164
- var preorderTimeRange = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_time_range'));
165
- var preorderMaximumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_maximum_days'));
166
- var preorderMinimumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_minimum_days'));
153
+ var cateringValues = businessConfigs && (0, _utils.getCateringValues)(cateringTypeString, businessConfigs);
167
154
  var walletName = {
168
155
  cash: {
169
156
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
@@ -182,7 +169,7 @@ var CartUI = function CartUI(props) {
182
169
  }, 0);
183
170
  }
184
171
  };
185
- var loyaltyRewardValue = Math.round(((cart === null || cart === void 0 ? void 0 : cart.subtotal) + getIncludedTaxes()) / loyaltyRewardRate);
172
+ var loyaltyRewardValue = ((Math.trunc(((cart === null || cart === void 0 ? void 0 : cart.subtotal) + getIncludedTaxes()) * loyaltyRewardRate * 100) / 100).toFixed((_configs$format_numbe = (_configs$format_numbe2 = configs.format_number_decimal_length) === null || _configs$format_numbe2 === void 0 ? void 0 : _configs$format_numbe2.value) !== null && _configs$format_numbe !== void 0 ? _configs$format_numbe : 2), 10);
186
173
  var momentFormatted = !(orderState !== null && orderState !== void 0 && (_orderState$option = orderState.option) !== null && _orderState$option !== void 0 && _orderState$option.moment) ? t('RIGHT_NOW', 'Right Now') : parseDate(orderState === null || orderState === void 0 ? void 0 : (_orderState$option2 = orderState.option) === null || _orderState$option2 === void 0 ? void 0 : _orderState$option2.moment, {
187
174
  outputFormat: 'YYYY-MM-DD HH:mm'
188
175
  });
@@ -491,7 +478,7 @@ var CartUI = function CartUI(props) {
491
478
  })), (cart === null || cart === void 0 ? void 0 : cart.driver_tip) > 0 && !hideDriverTip && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DRIVER_TIP', 'Driver tip'), ' ', (cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate) > 0 && parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_t = configs.driver_tip_type) === null || _configs$driver_tip_t === void 0 ? void 0 : _configs$driver_tip_t.value, 10) === 2 && !parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_u = configs.driver_tip_use_custom) === null || _configs$driver_tip_u === void 0 ? void 0 : _configs$driver_tip_u.value, 10) && /*#__PURE__*/_react.default.createElement("span", null, "(".concat((0, _utils.verifyDecimals)(cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate, parseNumber), "%)"))), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.driver_tip))))), isCouponEnabled && !isCartPending && (isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover) && !hideCartDiscount && !hideCouponInput && /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
492
479
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
493
480
  price: cart === null || cart === void 0 ? void 0 : cart.total
494
- })), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === void 0 ? void 0 : (_orderState$options4 = orderState.options) === null || _orderState$options4 === void 0 ? void 0 : _orderState$options4.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie4 = validationFields.fields) === null || _validationFields$fie4 === void 0 ? void 0 : (_validationFields$fie5 = _validationFields$fie4.checkout) === null || _validationFields$fie5 === void 0 ? void 0 : (_validationFields$fie6 = _validationFields$fie5.driver_tip) === null || _validationFields$fie6 === void 0 ? void 0 : _validationFields$fie6.enabled) && driverTipsOptions.length > 0 && !useKioskApp && !isCheckout && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
481
+ })), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === void 0 ? void 0 : (_orderState$options4 = orderState.options) === null || _orderState$options4 === void 0 ? void 0 : _orderState$options4.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie7 = validationFields.fields) === null || _validationFields$fie7 === void 0 ? void 0 : (_validationFields$fie8 = _validationFields$fie7.checkout) === null || _validationFields$fie8 === void 0 ? void 0 : (_validationFields$fie9 = _validationFields$fie8.driver_tip) === null || _validationFields$fie9 === void 0 ? void 0 : _validationFields$fie9.enabled) && driverTipsOptions.length > 0 && !useKioskApp && !isCheckout && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
495
482
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
496
483
  driverTipsOptions: driverTipsOptions,
497
484
  isFixedPrice: parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_t2 = configs.driver_tip_type) === null || _configs$driver_tip_t2 === void 0 ? void 0 : _configs$driver_tip_t2.value, 10) === 1,
@@ -501,7 +488,7 @@ var CartUI = function CartUI(props) {
501
488
  useOrderContext: true
502
489
  }))), /*#__PURE__*/_react.default.createElement("table", {
503
490
  className: "total"
504
- }, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((cart === null || cart === void 0 ? void 0 : cart.total) >= 0 ? cart === null || cart === void 0 ? void 0 : cart.total : 0))), !!loyaltyRewardValue && isFinite(loyaltyRewardValue) && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, "\xA0"), /*#__PURE__*/_react.default.createElement("td", {
491
+ }, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((cart === null || cart === void 0 ? void 0 : cart.total) >= 0 ? cart === null || cart === void 0 ? void 0 : cart.total : 0))), !!loyaltyRewardValue && isFinite(loyaltyRewardValue) && !isMultiCheckout && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, "\xA0"), /*#__PURE__*/_react.default.createElement("td", {
505
492
  id: "loyalty"
506
493
  }, t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue))))), (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && !hideCartComments && /*#__PURE__*/_react.default.createElement("table", {
507
494
  className: "comments"
@@ -550,16 +537,11 @@ var CartUI = function CartUI(props) {
550
537
  style: {
551
538
  fontWeight: 'bold'
552
539
  }
553
- }, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), cateringTypes.includes(orderState === null || orderState === void 0 ? void 0 : (_orderState$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : _orderState$options5.type) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_MomentContent.MomentContent, {
540
+ }, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), cateringTypes.includes(orderState === null || orderState === void 0 ? void 0 : (_orderState$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : _orderState$options5.type) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_MomentContent.MomentContent, _extends({
554
541
  cateringPreorder: true,
555
542
  isCart: true,
556
- preorderSlotInterval: preorderSlotInterval,
557
- preorderLeadTime: preorderLeadTime,
558
- preorderTimeRange: preorderTimeRange,
559
- preorderMaximumDays: preorderMaximumDays,
560
- business: cart === null || cart === void 0 ? void 0 : cart.business,
561
- preorderMinimumDays: preorderMinimumDays
562
- })), (onClickCheckout || isForceOpenCart) && !isCheckout && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (!isMultiCheckout || isStore) && /*#__PURE__*/_react.default.createElement(_styles.CheckoutAction, null, /*#__PURE__*/_react.default.createElement("p", null, (cart === null || cart === void 0 ? void 0 : cart.total) >= 1 && parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
543
+ business: cart === null || cart === void 0 ? void 0 : cart.business
544
+ }, cateringValues))), (onClickCheckout || isForceOpenCart) && !isCheckout && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (!isMultiCheckout || isStore) && /*#__PURE__*/_react.default.createElement(_styles.CheckoutAction, null, /*#__PURE__*/_react.default.createElement("p", null, (cart === null || cart === void 0 ? void 0 : cart.total) >= 1 && parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
563
545
  color: !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) || !(cart !== null && cart !== void 0 && cart.valid_address) ? 'secundary' : 'primary',
564
546
  onClick: function onClick() {
565
547
  return checkOutBtnClick(cart === null || cart === void 0 ? void 0 : cart.uuid);
@@ -598,7 +580,8 @@ var CartUI = function CartUI(props) {
598
580
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
599
581
  categoryId: curProduct === null || curProduct === void 0 ? void 0 : curProduct.category_id,
600
582
  productId: curProduct === null || curProduct === void 0 ? void 0 : curProduct.id,
601
- onSave: handlerProductAction
583
+ onSave: handlerProductAction,
584
+ viewString: viewString
602
585
  }) : /*#__PURE__*/_react.default.createElement(_ServiceForm.ServiceForm, {
603
586
  isCartProduct: true,
604
587
  isService: true,
@@ -20,7 +20,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
20
20
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
  var CartContent = function CartContent(props) {
23
- var _configs$checkout_mul, _theme$images, _theme$images$general;
23
+ var _configs$checkout_mul, _carts$filter, _configs$multi_busine4, _configs$multi_busine5, _theme$images, _theme$images$general;
24
24
  var carts = props.carts,
25
25
  isOrderStateCarts = props.isOrderStateCarts,
26
26
  isCartPopover = props.isCartPopover,
@@ -38,6 +38,9 @@ var CartContent = function CartContent(props) {
38
38
  var _useOrder = (0, _orderingComponentsExternal.useOrder)(),
39
39
  _useOrder2 = _slicedToArray(_useOrder, 1),
40
40
  orderState = _useOrder2[0];
41
+ var _useUtils = (0, _orderingComponentsExternal.useUtils)(),
42
+ _useUtils2 = _slicedToArray(_useUtils, 1),
43
+ parsePrice = _useUtils2[0].parsePrice;
41
44
  var _useConfig = (0, _orderingComponentsExternal.useConfig)(),
42
45
  _useConfig2 = _slicedToArray(_useConfig, 1),
43
46
  configs = _useConfig2[0].configs;
@@ -46,6 +49,14 @@ var CartContent = function CartContent(props) {
46
49
  currentCartUuid = _useState2[0],
47
50
  setCurrentCartUuid = _useState2[1];
48
51
  var checkoutMultiBusinessEnabled = (configs === null || configs === void 0 ? void 0 : (_configs$checkout_mul = configs.checkout_multi_business_enabled) === null || _configs$checkout_mul === void 0 ? void 0 : _configs$checkout_mul.value) === '1';
52
+ var totalCartsPrice = (carts === null || carts === void 0 ? void 0 : carts.length) && carts.reduce(function (total, cart) {
53
+ return total + (cart === null || cart === void 0 ? void 0 : cart.total);
54
+ }, 0);
55
+ var totalCartsFee = (carts === null || carts === void 0 ? void 0 : carts.length) && (carts === null || carts === void 0 ? void 0 : (_carts$filter = carts.filter(function (cart) {
56
+ return (cart === null || cart === void 0 ? void 0 : cart.status) !== 1 && (cart === null || cart === void 0 ? void 0 : cart.valid);
57
+ })) === null || _carts$filter === void 0 ? void 0 : _carts$filter.reduce(function (total, cart) {
58
+ return total + (cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount);
59
+ }, 0));
49
60
  var handleAddProduct = function handleAddProduct(product, cart) {
50
61
  setCurrentCartUuid(cart === null || cart === void 0 ? void 0 : cart.uuid);
51
62
  };
@@ -100,13 +111,14 @@ var CartContent = function CartContent(props) {
100
111
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.Container, null, !isSlideBar && /*#__PURE__*/_react.default.createElement(_styles.WrapperContainer, null, /*#__PURE__*/_react.default.createElement(_styles.Title, null, t('YOUR_CART', 'Your cart')), checkoutMultiBusinessEnabled && (carts === null || carts === void 0 ? void 0 : carts.length) > 0 && /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
101
112
  onClick: handleClickCheckout,
102
113
  color: "primary"
103
- }, t('CHECKOUT', 'Checkout'))), isOrderStateCarts && (carts === null || carts === void 0 ? void 0 : carts.length) > 0 && carts.map(function (cart) {
104
- var _cart$business;
114
+ }, t('CHECKOUT', 'Checkout'))), isOrderStateCarts && (carts === null || carts === void 0 ? void 0 : carts.length) > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, carts.map(function (cart) {
115
+ var _cart$business, _configs$multi_busine, _configs$multi_busine2, _configs$multi_busine3;
105
116
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
106
117
  key: cart.uuid
107
118
  }, cart.products.length > 0 && /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
108
- isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
109
119
  cart: cart,
120
+ isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
121
+ isOpenCart: isOpenCart,
110
122
  isCartPopover: isCartPopover,
111
123
  isCheckout: window.location.pathname === "/checkout/".concat(cart === null || cart === void 0 ? void 0 : cart.uuid) && !isCartPopover,
112
124
  isForceOpenCart: isForceOpenCart,
@@ -114,10 +126,16 @@ var CartContent = function CartContent(props) {
114
126
  isProducts: cart.products.length,
115
127
  onClickCheckout: props.onClose,
116
128
  setPreorderBusiness: setPreorderBusiness,
117
- isOpenCart: isOpenCart,
118
- businessConfigs: cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.configs
129
+ businessConfigs: cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.configs,
130
+ hideCouponInput: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine = configs.multi_business_checkout_coupon_input_style) === null || _configs$multi_busine === void 0 ? void 0 : _configs$multi_busine.value) === 'group',
131
+ hideDeliveryFee: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine2 = configs.multi_business_checkout_show_combined_delivery_fee) === null || _configs$multi_busine2 === void 0 ? void 0 : _configs$multi_busine2.value) === '1',
132
+ hideDriverTip: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine3 = configs.multi_business_checkout_show_combined_driver_tip) === null || _configs$multi_busine3 === void 0 ? void 0 : _configs$multi_busine3.value) === '1'
119
133
  }));
120
- }), (!carts || (carts === null || carts === void 0 ? void 0 : carts.length) === 0) && /*#__PURE__*/_react.default.createElement(_styles.NotCarts, null, /*#__PURE__*/_react.default.createElement("img", {
134
+ }), checkoutMultiBusinessEnabled && !!carts.length && /*#__PURE__*/_react.default.createElement(_styles.MultiCartPriceContainer, null, !!totalCartsFee && (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine4 = configs.multi_business_checkout_show_combined_delivery_fee) === null || _configs$multi_busine4 === void 0 ? void 0 : _configs$multi_busine4.value) === '1' && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("p", null, t('TOTAL_DELIVERY_FEE', 'Total delivery fee')), /*#__PURE__*/_react.default.createElement("p", null, parsePrice(totalCartsFee))), carts.reduce(function (sum, cart) {
135
+ return sum + (cart === null || cart === void 0 ? void 0 : cart.driver_tip);
136
+ }, 0) > 0 && (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine5 = configs.multi_business_checkout_show_combined_driver_tip) === null || _configs$multi_busine5 === void 0 ? void 0 : _configs$multi_busine5.value) === '1' && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("p", null, t('DRIVER_TIP', 'Driver tip')), /*#__PURE__*/_react.default.createElement("p", null, parsePrice(carts.reduce(function (sum, cart) {
137
+ return sum + (cart === null || cart === void 0 ? void 0 : cart.driver_tip);
138
+ }, 0)))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", null, t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')), /*#__PURE__*/_react.default.createElement("h4", null, parsePrice(totalCartsPrice))))), (!carts || (carts === null || carts === void 0 ? void 0 : carts.length) === 0) && /*#__PURE__*/_react.default.createElement(_styles.NotCarts, null, /*#__PURE__*/_react.default.createElement("img", {
121
139
  src: (_theme$images = theme.images) === null || _theme$images === void 0 ? void 0 : (_theme$images$general = _theme$images.general) === null || _theme$images$general === void 0 ? void 0 : _theme$images$general.notFound,
122
140
  alt: "Not Found",
123
141
  width: "200px",
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WrapperContainer = exports.Title = exports.NotCarts = exports.Container = void 0;
6
+ exports.WrapperContainer = exports.Title = exports.NotCarts = exports.MultiCartPriceContainer = exports.Container = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
8
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
11
  var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0px 10px;\n\n div:not(:last-child) {\n padding-bottom: 5px;\n }\n\n @media (min-width: 769px) {\n margin-bottom: 10px;\n padding: 15px;\n }\n"])));
@@ -17,4 +17,8 @@ exports.NotCarts = NotCarts;
17
17
  var Title = _styledComponents.default.h1(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-weight: 600;\n font-size: 20px;\n color: ", ";\n margin-bottom: 8px;\n line-height: 30px;\n margin-top: 0;\n text-align: center;\n\n @media (min-width: 576px) {\n text-align: left;\n }\n"])), function (props) {
18
18
  return props.theme.colors.darkTextColor;
19
19
  });
20
- exports.Title = Title;
20
+ exports.Title = Title;
21
+ var MultiCartPriceContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-top: 38px;\n > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-top: 5px;\n margin-bottom: 5px;\n > h4 {\n font-size: 18px;\n margin: 0;\n }\n }\n > span {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 5px;\n }\n p {\n font-size: 14px;\n color: ", ";\n margin: 0;\n }\n"])), function (props) {
22
+ return props.theme.colors.darkGray;
23
+ });
24
+ exports.MultiCartPriceContainer = MultiCartPriceContainer;
@@ -62,7 +62,7 @@ var mapConfigs = {
62
62
  }
63
63
  };
64
64
  var CheckoutUI = function CheckoutUI(props) {
65
- var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _cardList$cards, _cartState$cart, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _instructionsOptions$2, _theme$checkout, _theme$checkout$compo, _theme$checkout$compo2, _theme$checkout$compo3, _theme$checkout$compo4, _theme$checkout2, _theme$checkout2$comp, _theme$checkout2$comp2, _theme$checkout3, _theme$checkout3$comp, _theme$checkout3$comp2, _theme$checkout3$comp3, _theme$checkout3$comp4, _theme$checkout4, _theme$checkout4$comp, _theme$checkout4$comp2, _validationFields$fie7, _validationFields$fie8, _validationFields$fie9, _loyaltyPlansState$re, _creditPointPlan$busi, _businessDetails$busi3, _businessDetails$busi4, _theme$images, _theme$images$dummies, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi9, _businessDetails$busi10, _businessDetails$busi11, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _cart$business3, _cart$products2, _ref, _creditPointPlanOnBus, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _validationFields$fie18, _validationFields$fie19, _validationFields$fie20, _validationFields$fie21, _validationFields$fie22, _validationFields$fie23, _customerState$user3;
65
+ var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _cardList$cards, _cartState$cart, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _instructionsOptions$2, _theme$checkout, _theme$checkout$compo, _theme$checkout$compo2, _theme$checkout$compo3, _theme$checkout$compo4, _theme$checkout2, _theme$checkout2$comp, _theme$checkout2$comp2, _theme$checkout3, _theme$checkout3$comp, _theme$checkout3$comp2, _theme$checkout3$comp3, _theme$checkout3$comp4, _theme$checkout4, _theme$checkout4$comp, _theme$checkout4$comp2, _validationFields$fie7, _validationFields$fie8, _validationFields$fie9, _loyaltyPlansState$re, _creditPointPlan$busi, _options$address, _businessDetails$busi3, _theme$images, _theme$images$dummies, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _businessDetails$busi4, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi8, _businessDetails$busi9, _businessDetails$busi10, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _cart$business3, _cart$products2, _ref, _creditPointPlanOnBus, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _validationFields$fie18, _validationFields$fie19, _validationFields$fie20, _validationFields$fie21, _validationFields$fie22, _validationFields$fie23, _customerState$user3;
66
66
  var cart = props.cart,
67
67
  errors = props.errors,
68
68
  placing = props.placing,
@@ -352,8 +352,8 @@ var CheckoutUI = function CheckoutUI(props) {
352
352
  }), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
353
353
  height: 150
354
354
  })) : /*#__PURE__*/_react.default.createElement(_AddressDetails.AddressDetails, {
355
- location: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi3 = businessDetails.business) === null || _businessDetails$busi3 === void 0 ? void 0 : _businessDetails$busi3.location,
356
- businessLogo: (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi4 = businessDetails.business) === null || _businessDetails$busi4 === void 0 ? void 0 : _businessDetails$busi4.logo) || ((_theme$images = theme.images) === null || _theme$images === void 0 ? void 0 : (_theme$images$dummies = _theme$images.dummies) === null || _theme$images$dummies === void 0 ? void 0 : _theme$images$dummies.businessLogo),
355
+ location: options === null || options === void 0 ? void 0 : (_options$address = options.address) === null || _options$address === void 0 ? void 0 : _options$address.location,
356
+ businessLogo: (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi3 = businessDetails.business) === null || _businessDetails$busi3 === void 0 ? void 0 : _businessDetails$busi3.logo) || ((_theme$images = theme.images) === null || _theme$images === void 0 ? void 0 : (_theme$images$dummies = _theme$images.dummies) === null || _theme$images$dummies === void 0 ? void 0 : _theme$images$dummies.businessLogo),
357
357
  isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
358
358
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
359
359
  apiKey: configs === null || configs === void 0 ? void 0 : (_configs$google_maps_ = configs.google_maps_api_key) === null || _configs$google_maps_ === void 0 ? void 0 : _configs$google_maps_.value,
@@ -442,7 +442,7 @@ var CheckoutUI = function CheckoutUI(props) {
442
442
  style: {
443
443
  marginBottom: '10px'
444
444
  }
445
- }))), !cartState.loading && (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business) && ((_Object$values = Object.values(businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business)) === null || _Object$values === void 0 ? void 0 : _Object$values.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement("div", null, !hideBusinessAddress && /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi5 = businessDetails.business) === null || _businessDetails$busi5 === void 0 ? void 0 : _businessDetails$busi5.address), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi6 = businessDetails.business) === null || _businessDetails$busi6 === void 0 ? void 0 : _businessDetails$busi6.name), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi7 = businessDetails.business) === null || _businessDetails$busi7 === void 0 ? void 0 : _businessDetails$busi7.email), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi8 = businessDetails.business) === null || _businessDetails$busi8 === void 0 ? void 0 : _businessDetails$busi8.cellphone))), (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error) && (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$erro = businessDetails.error) === null || _businessDetails$erro === void 0 ? void 0 : _businessDetails$erro.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
445
+ }))), !cartState.loading && (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business) && ((_Object$values = Object.values(businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business)) === null || _Object$values === void 0 ? void 0 : _Object$values.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement("div", null, !hideBusinessAddress && /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi4 = businessDetails.business) === null || _businessDetails$busi4 === void 0 ? void 0 : _businessDetails$busi4.address), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi5 = businessDetails.business) === null || _businessDetails$busi5 === void 0 ? void 0 : _businessDetails$busi5.name), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi6 = businessDetails.business) === null || _businessDetails$busi6 === void 0 ? void 0 : _businessDetails$busi6.email), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi7 = businessDetails.business) === null || _businessDetails$busi7 === void 0 ? void 0 : _businessDetails$busi7.cellphone))), (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error) && (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$erro = businessDetails.error) === null || _businessDetails$erro === void 0 ? void 0 : _businessDetails$erro.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
446
446
  content: (businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$erro2 = businessDetails.error[0]) === null || _businessDetails$erro2 === void 0 ? void 0 : _businessDetails$erro2.message) || (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error[0])
447
447
  }))), /*#__PURE__*/_react.default.createElement(_styles.CheckOutDivider, null)) : /*#__PURE__*/_react.default.createElement(_styles.WrapperActionsInput, null, /*#__PURE__*/_react.default.createElement("h1", null, t('WHATS_YOUR_NAME', "What's your name?")), /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
448
448
  placeholder: t('WRITE_YOUR_NAME', 'Write your name'),
@@ -477,9 +477,9 @@ var CheckoutUI = function CheckoutUI(props) {
477
477
  cart: cart,
478
478
  useKioskApp: useKioskApp,
479
479
  isDisabled: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
480
- businessId: !isGiftCardCart ? businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi9 = businessDetails.business) === null || _businessDetails$busi9 === void 0 ? void 0 : _businessDetails$busi9.id : -1,
480
+ businessId: !isGiftCardCart ? businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi8 = businessDetails.business) === null || _businessDetails$busi8 === void 0 ? void 0 : _businessDetails$busi8.id : -1,
481
481
  isLoading: !isGiftCardCart ? businessDetails.loading : false,
482
- paymethods: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi10 = businessDetails.business) === null || _businessDetails$busi10 === void 0 ? void 0 : _businessDetails$busi10.paymethods,
482
+ paymethods: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi9 = businessDetails.business) === null || _businessDetails$busi9 === void 0 ? void 0 : _businessDetails$busi9.paymethods,
483
483
  onPaymentChange: handlePaymethodChange,
484
484
  errorCash: errorCash,
485
485
  setErrorCash: setErrorCash,
@@ -492,7 +492,7 @@ var CheckoutUI = function CheckoutUI(props) {
492
492
  })), isWalletEnabled && !(businessDetails !== null && businessDetails !== void 0 && businessDetails.loading) && /*#__PURE__*/_react.default.createElement(_styles.WalletPaymentOptionContainer, null, /*#__PURE__*/_react.default.createElement(_PaymentOptionWallet.PaymentOptionWallet, {
493
493
  cart: cart,
494
494
  loyaltyPlansState: loyaltyPlansState,
495
- businessConfigs: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi11 = businessDetails.business) === null || _businessDetails$busi11 === void 0 ? void 0 : _businessDetails$busi11.configs
495
+ businessConfigs: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi10 = businessDetails.business) === null || _businessDetails$busi10 === void 0 ? void 0 : _businessDetails$busi10.configs
496
496
  })))), /*#__PURE__*/_react.default.createElement(_styles.WrapperRightContainer, null, !!(!isMultiDriverTips && driverTipsField) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
497
497
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
498
498
  driverTipsOptions: driverTipsOptions,
@@ -42,7 +42,7 @@ var mapConfigs = {
42
42
  }
43
43
  };
44
44
  var MultiCheckoutUI = function MultiCheckoutUI(props) {
45
- var _Object$values, _cartGroup$result, _paymethodSelected$pa, _cardList$cards, _configs$checkout_mul, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$multi_busine, _configs$driver_tip_o4, _configs$driver_tip_o5, _loyaltyPlansState$re, _creditPointPlan$busi, _creditPointPlan$busi2, _configs$google_maps_, _customerState$user, _cartGroup$result2, _cartGroup$result3, _validationFields$fie9, _validationFields$fie10, _validationFields$fie11, _configs$multi_busine2, _validationFields$fie12, _validationFields$fie13, _validationFields$fie14, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _openCarts$, _openCarts$2, _configs$multi_busine6, _configs$multi_busine7;
45
+ var _Object$values, _cartGroup$result, _paymethodSelected$pa, _cardList$cards, _configs$checkout_mul, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$multi_busine, _configs$driver_tip_o4, _configs$driver_tip_o5, _loyaltyPlansState$re, _creditPointPlan$busi, _creditPointPlan$busi2, _configs$format_numbe, _configs$format_numbe2, _configs$google_maps_, _customerState$user, _cartGroup$result2, _cartGroup$result3, _validationFields$fie9, _validationFields$fie10, _validationFields$fie11, _configs$multi_busine2, _validationFields$fie12, _validationFields$fie13, _validationFields$fie14, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _openCarts$, _openCarts$2, _configs$multi_busine6, _configs$multi_busine7;
46
46
  var placing = props.placing,
47
47
  isCustomerMode = props.isCustomerMode,
48
48
  openCarts = props.openCarts,
@@ -127,7 +127,8 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
127
127
  }) && creditPointPlan;
128
128
  var getIncludedTaxes = function getIncludedTaxes(cart) {
129
129
  if ((cart === null || cart === void 0 ? void 0 : cart.taxes) === null || !(cart !== null && cart !== void 0 && cart.taxes)) {
130
- return cart.business.tax_type === 1 ? cart === null || cart === void 0 ? void 0 : cart.tax : 0;
130
+ var _cart$business;
131
+ return (cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.tax_type) === 1 ? cart === null || cart === void 0 ? void 0 : cart.tax : 0;
131
132
  } else {
132
133
  return cart === null || cart === void 0 ? void 0 : cart.taxes.reduce(function (taxIncluded, tax) {
133
134
  var _tax$summary;
@@ -135,9 +136,10 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
135
136
  }, 0);
136
137
  }
137
138
  };
138
- var loyaltyRewardValue = creditPointPlanOnBusiness !== null && creditPointPlanOnBusiness !== void 0 && creditPointPlanOnBusiness.accumulation_rate ? Math.round(openCarts.reduce(function (sum, cart) {
139
- return sum + (cart === null || cart === void 0 ? void 0 : cart.subtotal) + getIncludedTaxes(cart);
140
- }, 0) / (creditPointPlanOnBusiness === null || creditPointPlanOnBusiness === void 0 ? void 0 : creditPointPlanOnBusiness.accumulation_rate)) : 0;
139
+ var subtotalAmount = openCarts.reduce(function (sum, cart) {
140
+ return sum + ((cart === null || cart === void 0 ? void 0 : cart.subtotal) + getIncludedTaxes(cart));
141
+ }, 0) * (creditPointPlanOnBusiness === null || creditPointPlanOnBusiness === void 0 ? void 0 : creditPointPlanOnBusiness.accumulation_rate);
142
+ var loyaltyRewardValue = creditPointPlanOnBusiness !== null && creditPointPlanOnBusiness !== void 0 && creditPointPlanOnBusiness.accumulation_rate ? (Math.trunc(subtotalAmount * 100) / 100).toFixed((_configs$format_numbe = (_configs$format_numbe2 = configs.format_number_decimal_length) === null || _configs$format_numbe2 === void 0 ? void 0 : _configs$format_numbe2.value) !== null && _configs$format_numbe !== void 0 ? _configs$format_numbe : 2) : 0;
141
143
  var handlePlaceOrder = function handlePlaceOrder() {
142
144
  if (!userErrors.length) {
143
145
  handleGroupPlaceOrder && handleGroupPlaceOrder();
@@ -278,7 +280,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
278
280
  driverTip: parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_t2 = configs.driver_tip_type) === null || _configs$driver_tip_t2 === void 0 ? void 0 : _configs$driver_tip_t2.value, 10) === 1 ? (_openCarts$ = openCarts[0]) === null || _openCarts$ === void 0 ? void 0 : _openCarts$.driver_tip : (_openCarts$2 = openCarts[0]) === null || _openCarts$2 === void 0 ? void 0 : _openCarts$2.driver_tip_rate,
279
281
  useOrderContext: true
280
282
  })))), /*#__PURE__*/_react.default.createElement(_styles.WrapperRightContainer, null, /*#__PURE__*/_react.default.createElement(_styles.CartContainer, null, /*#__PURE__*/_react.default.createElement(_styles.CartHeader, null, /*#__PURE__*/_react.default.createElement("h1", null, t('MOBILE_FRONT_YOUR_ORDER', 'Your order'))), openCarts.map(function (cart) {
281
- var _configs$multi_busine3, _cart$products2, _configs$multi_busine4, _configs$multi_busine5, _cart$business;
283
+ var _configs$multi_busine3, _cart$products2, _configs$multi_busine4, _configs$multi_busine5, _cart$business2;
282
284
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
283
285
  key: cart.uuid
284
286
  }, /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
@@ -289,7 +291,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
289
291
  isProducts: (cart === null || cart === void 0 ? void 0 : (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0,
290
292
  hideDeliveryFee: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine4 = configs.multi_business_checkout_show_combined_delivery_fee) === null || _configs$multi_busine4 === void 0 ? void 0 : _configs$multi_busine4.value) === '1',
291
293
  hideDriverTip: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine5 = configs.multi_business_checkout_show_combined_driver_tip) === null || _configs$multi_busine5 === void 0 ? void 0 : _configs$multi_busine5.value) === '1',
292
- businessConfigs: cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.configs
294
+ businessConfigs: cart === null || cart === void 0 ? void 0 : (_cart$business2 = cart.business) === null || _cart$business2 === void 0 ? void 0 : _cart$business2.configs
293
295
  }), /*#__PURE__*/_react.default.createElement(_styles.DriverTipDivider, null));
294
296
  }), walletCarts.length > 0 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PARTIAL_WALLET_CARTS', 'Important: One or more carts can`t be completed due a partial payment with cash/points wallet and requires to be paid individually')), openCarts.length > 0 && /*#__PURE__*/_react.default.createElement(_styles.MultiCartPriceContainer, {
295
297
  totalFeeEnabled: totalFeeEnabled
@@ -22,7 +22,7 @@ var OrderEta = function OrderEta(props) {
22
22
  outputFormat = props.outputFormat;
23
23
  var _useUtils = (0, _orderingComponentsExternal.useUtils)(),
24
24
  _useUtils2 = _slicedToArray(_useUtils, 1),
25
- parseTime = _useUtils2[0].parseTime;
25
+ parseDate = _useUtils2[0].parseDate;
26
26
  var _useState = (0, _react.useState)(null),
27
27
  _useState2 = _slicedToArray(_useState, 2),
28
28
  estimatedDeliveryTime = _useState2[0],
@@ -49,10 +49,13 @@ var OrderEta = function OrderEta(props) {
49
49
  if (diffTimeAsMinutes <= 0) {
50
50
  totalEta += Math.floor(Math.abs(diffTimeAsMinutes / (order === null || order === void 0 ? void 0 : order.eta_current_status_time)) + 1) * (order === null || order === void 0 ? void 0 : order.eta_current_status_penalty_time);
51
51
  }
52
- _estimatedTime = (0, _moment.default)(_delivery).add(totalEta, 'minutes');
52
+ _estimatedTime = _moment.default.utc(_delivery).add(totalEta, 'minutes');
53
53
  } else {
54
- _estimatedTime = (0, _moment.default)(_delivery).add(order === null || order === void 0 ? void 0 : order.eta_time, 'minutes');
54
+ _estimatedTime = _moment.default.utc(_delivery).add(order === null || order === void 0 ? void 0 : order.eta_time, 'minutes');
55
55
  }
56
+ _estimatedTime = outputFormat ? (0, _moment.default)(_estimatedTime).format(outputFormat) : parseDate(_estimatedTime, {
57
+ utc: false
58
+ });
56
59
  setEstimatedDeliveryTime(_estimatedTime);
57
60
  };
58
61
  (0, _react.useEffect)(function () {
@@ -63,9 +66,7 @@ var OrderEta = function OrderEta(props) {
63
66
  return function () {
64
67
  return clearInterval(interval);
65
68
  };
66
- }, [order]);
67
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !outputFormat ? parseTime(estimatedDeliveryTime) : parseTime(estimatedDeliveryTime, {
68
- outputFormat: 'hh:mm A'
69
- }));
69
+ }, [order, outputFormat]);
70
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, estimatedDeliveryTime);
70
71
  };
71
72
  exports.OrderEta = OrderEta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -86,7 +86,7 @@
86
86
  "libphonenumber-js": "^1.9.4",
87
87
  "lodash": "^4.17.19",
88
88
  "moment": "^2.29.4",
89
- "ordering-components-external": "2.5.2",
89
+ "ordering-components-external": "2.5.3",
90
90
  "polished": "^3.6.6",
91
91
  "react-bootstrap-icons": "^1.7.2",
92
92
  "react-calendar": "^3.3.1",
@@ -39,7 +39,7 @@ import {
39
39
  NoValidProductMessage,
40
40
  DriverTipContainer
41
41
  } from './styles'
42
- import { verifyDecimals } from '../../../../../utils'
42
+ import { getCateringValues, verifyDecimals } from '../../../../../utils'
43
43
  import BsInfoCircle from '@meronex/icons/bs/BsInfoCircle'
44
44
  import MdCloseCircle from '@meronex/icons/ios/MdCloseCircle'
45
45
  import { MomentContent } from '../MomentContent'
@@ -100,26 +100,21 @@ const CartUI = (props) => {
100
100
  const [openChangeStore, setOpenChangeStore] = useState(false)
101
101
 
102
102
  const businessUrlTemplate = site?.business_url_template || '/store/:business_slug'
103
- const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
104
103
 
105
104
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
106
105
  const cateringTypes = [7, 8]
107
106
  const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
108
107
  const cart = cartMulticart || orderState?.carts?.[`businessId:${props.cart?.business_id}`]
109
108
  const viewString = isStore ? 'business_view' : 'header'
110
- const hideCartComments = theme?.[viewString]?.components?.cart?.components?.comments?.hidden
111
- const hideCartDiscount = theme?.[viewString]?.components?.cart?.components?.discount?.hidden
109
+ const hideCartComments = theme?.[viewString]?.components?.cart?.components?.comments?.hidden || !validationFields?.fields?.checkout?.comments?.enabled
110
+ const hideCartDiscount = theme?.[viewString]?.components?.cart?.components?.discount_coupon?.hidden
112
111
  const cateringTypeString = orderState?.options?.type === 7
113
112
  ? 'catering_delivery'
114
113
  : orderState?.options?.type === 8
115
114
  ? 'catering_pickup'
116
115
  : null
117
- const splitCateringValue = (configName) => businessConfigs.find(config => config.key === configName)?.value?.split('|')?.find(val => val.includes(cateringTypeString))?.split(',')[1]
118
- const preorderSlotInterval = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_slot_interval'))
119
- const preorderLeadTime = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_lead_time'))
120
- const preorderTimeRange = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_time_range'))
121
- const preorderMaximumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_maximum_days'))
122
- const preorderMinimumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_minimum_days'))
116
+
117
+ const cateringValues = businessConfigs && getCateringValues(cateringTypeString, businessConfigs)
123
118
 
124
119
  const walletName = {
125
120
  cash: {
@@ -140,7 +135,9 @@ const CartUI = (props) => {
140
135
  }
141
136
  }
142
137
 
143
- const loyaltyRewardValue = Math.round((cart?.subtotal + getIncludedTaxes()) / loyaltyRewardRate)
138
+ const loyaltyRewardValue = ((
139
+ Math.trunc(((cart?.subtotal + getIncludedTaxes()) * loyaltyRewardRate) * 100) / 100
140
+ ).toFixed(configs.format_number_decimal_length?.value ?? 2), 10)
144
141
 
145
142
  const momentFormatted = !orderState?.option?.moment
146
143
  ? t('RIGHT_NOW', 'Right Now')
@@ -514,7 +511,7 @@ const CartUI = (props) => {
514
511
  <td>{t('TOTAL', 'Total')}</td>
515
512
  <td>{parsePrice(cart?.total >= 0 ? cart?.total : 0)}</td>
516
513
  </tr>
517
- {!!loyaltyRewardValue && isFinite(loyaltyRewardValue) && (
514
+ {!!loyaltyRewardValue && isFinite(loyaltyRewardValue) && !isMultiCheckout && (
518
515
  <tr>
519
516
  <td>&nbsp;</td>
520
517
  <td id='loyalty'>{t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue)}</td>
@@ -601,12 +598,8 @@ const CartUI = (props) => {
601
598
  <MomentContent
602
599
  cateringPreorder
603
600
  isCart
604
- preorderSlotInterval={preorderSlotInterval}
605
- preorderLeadTime={preorderLeadTime}
606
- preorderTimeRange={preorderTimeRange}
607
- preorderMaximumDays={preorderMaximumDays}
608
601
  business={cart?.business}
609
- preorderMinimumDays={preorderMinimumDays}
602
+ {...cateringValues}
610
603
  />
611
604
  </div>
612
605
  )}
@@ -657,6 +650,7 @@ const CartUI = (props) => {
657
650
  categoryId={curProduct?.category_id}
658
651
  productId={curProduct?.id}
659
652
  onSave={handlerProductAction}
653
+ viewString={viewString}
660
654
  />
661
655
  ) : (
662
656
  <ServiceForm
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { useTheme } from 'styled-components'
3
- import { useLanguage, useEvent, useConfig, useOrder } from 'ordering-components-external'
4
- import { Container, NotCarts, Title, WrapperContainer } from './styles'
3
+ import { useLanguage, useEvent, useConfig, useOrder, useUtils } from 'ordering-components-external'
4
+ import { Container, MultiCartPriceContainer, NotCarts, Title, WrapperContainer } from './styles'
5
5
 
6
6
  import { Cart } from '../Cart'
7
7
  import { Button } from '../../styles/Buttons'
@@ -21,11 +21,17 @@ export const CartContent = (props) => {
21
21
  const theme = useTheme()
22
22
  const [events] = useEvent()
23
23
  const [orderState] = useOrder()
24
+ const [{ parsePrice }] = useUtils()
24
25
  const [{ configs }] = useConfig()
25
26
 
26
27
  const [currentCartUuid, setCurrentCartUuid] = useState(null)
27
28
  const checkoutMultiBusinessEnabled = configs?.checkout_multi_business_enabled?.value === '1'
28
29
 
30
+ const totalCartsPrice = carts?.length && carts.reduce((total, cart) => { return total + cart?.total }, 0)
31
+ const totalCartsFee = carts?.length && carts
32
+ ?.filter((cart) => cart?.status !== 1 && cart?.valid)
33
+ ?.reduce((total, cart) => { return total + (cart?.delivery_price_with_discount) }, 0)
34
+
29
35
  const handleAddProduct = (product, cart) => {
30
36
  setCurrentCartUuid(cart?.uuid)
31
37
  }
@@ -85,26 +91,56 @@ export const CartContent = (props) => {
85
91
  )}
86
92
  </WrapperContainer>
87
93
  )}
88
- {isOrderStateCarts && carts?.length > 0 &&
89
- carts.map(cart => (
90
- <React.Fragment key={cart.uuid}>
91
- {cart.products.length > 0 && (
92
- <Cart
93
- isCartPending={cart?.status === 2}
94
- cart={cart}
95
- isCartPopover={isCartPopover}
96
- isCheckout={window.location.pathname === `/checkout/${cart?.uuid}` && !isCartPopover}
97
- isForceOpenCart={isForceOpenCart}
98
- currentCartUuid={currentCartUuid}
99
- isProducts={cart.products.length}
100
- onClickCheckout={props.onClose}
101
- setPreorderBusiness={setPreorderBusiness}
102
- isOpenCart={isOpenCart}
103
- businessConfigs={cart?.business?.configs}
104
- />
105
- )}
106
- </React.Fragment>
107
- ))}
94
+ {isOrderStateCarts && carts?.length > 0 && (
95
+ <>
96
+ {carts.map(cart => (
97
+ <React.Fragment key={cart.uuid}>
98
+ {cart.products.length > 0 && (
99
+ <Cart
100
+ cart={cart}
101
+ isCartPending={cart?.status === 2}
102
+ isOpenCart={isOpenCart}
103
+ isCartPopover={isCartPopover}
104
+ isCheckout={window.location.pathname === `/checkout/${cart?.uuid}` && !isCartPopover}
105
+ isForceOpenCart={isForceOpenCart}
106
+ currentCartUuid={currentCartUuid}
107
+ isProducts={cart.products.length}
108
+ onClickCheckout={props.onClose}
109
+ setPreorderBusiness={setPreorderBusiness}
110
+ businessConfigs={cart?.business?.configs}
111
+ hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
112
+ hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
113
+ hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
114
+ />
115
+ )}
116
+ </React.Fragment>
117
+ ))}
118
+ {checkoutMultiBusinessEnabled && !!carts.length && (
119
+ <MultiCartPriceContainer>
120
+ {!!totalCartsFee &&
121
+ configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' &&
122
+ (
123
+ <span>
124
+ <p>{t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}</p>
125
+ <p>{parsePrice(totalCartsFee)}</p>
126
+ </span>
127
+ )}
128
+ {carts.reduce((sum, cart) => sum + cart?.driver_tip, 0) > 0 &&
129
+ configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' &&
130
+ (
131
+ <span>
132
+ <p>{t('DRIVER_TIP', 'Driver tip')}</p>
133
+ <p>{parsePrice(carts.reduce((sum, cart) => sum + cart?.driver_tip, 0))}</p>
134
+ </span>
135
+ )}
136
+ <div>
137
+ <h4>{t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}</h4>
138
+ <h4>{parsePrice(totalCartsPrice)}</h4>
139
+ </div>
140
+ </MultiCartPriceContainer>
141
+ )}
142
+ </>
143
+ )}
108
144
  {(!carts || carts?.length === 0) && (
109
145
  <NotCarts>
110
146
  <img src={theme.images?.general?.notFound} alt='Not Found' width='200px' height='122px' loading='lazy' />