ordering-ui-external 2.3.7 → 2.4.0

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 (39) hide show
  1. package/_bundles/{7.ordering-ui.f7f389e931a1667d2943.js → 7.ordering-ui.514c8d0a101626d93843.js} +1 -1
  2. package/_bundles/ordering-ui.514c8d0a101626d93843.js +2 -0
  3. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +6 -1
  4. package/_modules/themes/five/src/components/Cart/index.js +16 -16
  5. package/_modules/themes/five/src/components/Messages/index.js +3 -1
  6. package/_modules/themes/five/src/components/MultiCartsPaymethodsAndWallets/index.js +33 -8
  7. package/_modules/themes/five/src/components/MultiCartsPaymethodsAndWallets/styles.js +10 -6
  8. package/_modules/themes/five/src/components/MultiCheckout/index.js +43 -15
  9. package/_modules/themes/five/src/components/MyOrders/styles.js +3 -3
  10. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +6 -4
  11. package/_modules/themes/five/src/components/OrderProgress/index.js +2 -1
  12. package/_modules/themes/five/src/components/PageBanner/index.js +6 -6
  13. package/_modules/themes/five/src/components/PaymentOptions/index.js +22 -22
  14. package/_modules/themes/five/src/components/QueryLoginSpoonity/index.js +3 -2
  15. package/package.json +2 -2
  16. package/src/themes/five/src/components/BusinessProductsListing/index.js +7 -1
  17. package/src/themes/five/src/components/Cart/index.js +13 -19
  18. package/src/themes/five/src/components/Messages/index.js +4 -9
  19. package/src/themes/five/src/components/MultiCartsPaymethodsAndWallets/index.js +52 -16
  20. package/src/themes/five/src/components/MultiCartsPaymethodsAndWallets/styles.js +12 -0
  21. package/src/themes/five/src/components/MultiCheckout/index.js +37 -3
  22. package/src/themes/five/src/components/MyOrders/styles.js +2 -4
  23. package/src/themes/five/src/components/OrderDetails/OrderEta.js +4 -4
  24. package/src/themes/five/src/components/OrderProgress/index.js +2 -2
  25. package/src/themes/five/src/components/PageBanner/index.js +6 -6
  26. package/src/themes/five/src/components/PaymentOptions/index.js +2 -3
  27. package/src/themes/five/src/components/QueryLoginSpoonity/index.js +9 -1
  28. package/template/app.js +12 -10
  29. package/_bundles/ordering-ui.f7f389e931a1667d2943.js +0 -2
  30. /package/_bundles/{0.ordering-ui.f7f389e931a1667d2943.js → 0.ordering-ui.514c8d0a101626d93843.js} +0 -0
  31. /package/_bundles/{1.ordering-ui.f7f389e931a1667d2943.js → 1.ordering-ui.514c8d0a101626d93843.js} +0 -0
  32. /package/_bundles/{2.ordering-ui.f7f389e931a1667d2943.js → 2.ordering-ui.514c8d0a101626d93843.js} +0 -0
  33. /package/_bundles/{4.ordering-ui.f7f389e931a1667d2943.js → 4.ordering-ui.514c8d0a101626d93843.js} +0 -0
  34. /package/_bundles/{5.ordering-ui.f7f389e931a1667d2943.js → 5.ordering-ui.514c8d0a101626d93843.js} +0 -0
  35. /package/_bundles/{6.ordering-ui.f7f389e931a1667d2943.js → 6.ordering-ui.514c8d0a101626d93843.js} +0 -0
  36. /package/_bundles/{7.ordering-ui.f7f389e931a1667d2943.js.LICENSE.txt → 7.ordering-ui.514c8d0a101626d93843.js.LICENSE.txt} +0 -0
  37. /package/_bundles/{8.ordering-ui.f7f389e931a1667d2943.js → 8.ordering-ui.514c8d0a101626d93843.js} +0 -0
  38. /package/_bundles/{9.ordering-ui.f7f389e931a1667d2943.js → 9.ordering-ui.514c8d0a101626d93843.js} +0 -0
  39. /package/_bundles/{ordering-ui.f7f389e931a1667d2943.js.LICENSE.txt → ordering-ui.514c8d0a101626d93843.js.LICENSE.txt} +0 -0
@@ -339,7 +339,7 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
339
339
  }
340
340
  setModalIsOpen(true);
341
341
  }
342
- }, [productModal]);
342
+ }, [productModal, categoryId, productId, isInitialRender]);
343
343
  (0, _react.useEffect)(function () {
344
344
  window.scrollTo(0, 0);
345
345
  if (categoryId && productId) {
@@ -356,6 +356,11 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
356
356
  events.off('product_banner_clicked', handleClickedBannerProduct);
357
357
  };
358
358
  }, []);
359
+ (0, _react.useEffect)(function () {
360
+ if (!categoryId && !productId) {
361
+ setModalIsOpen(false);
362
+ }
363
+ }, [categoryId, productId]);
359
364
  (0, _react.useEffect)(function () {
360
365
  if (loading) return;
361
366
  if (openProduct) {
@@ -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, _orderState$options4, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options5, _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$options6, _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, _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;
48
48
  var currentCartUuid = props.currentCartUuid,
49
49
  clearCart = props.clearCart,
50
50
  isProducts = props.isProducts,
@@ -172,7 +172,17 @@ var CartUI = function CartUI(props) {
172
172
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet')
173
173
  }
174
174
  };
175
- var loyaltyRewardValue = Math.round((cart === null || cart === void 0 ? void 0 : cart.subtotal) / loyaltyRewardRate);
175
+ var getIncludedTaxes = function getIncludedTaxes() {
176
+ if ((cart === null || cart === void 0 ? void 0 : cart.taxes) === null) {
177
+ return (cart === null || cart === void 0 ? void 0 : cart.business.tax_type) === 1 ? cart === null || cart === void 0 ? void 0 : cart.tax : 0;
178
+ } else {
179
+ return cart === null || cart === void 0 ? void 0 : cart.taxes.reduce(function (taxIncluded, tax) {
180
+ var _tax$summary;
181
+ return taxIncluded + (tax.type === 1 ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
182
+ }, 0);
183
+ }
184
+ };
185
+ var loyaltyRewardValue = Math.round(((cart === null || cart === void 0 ? void 0 : cart.subtotal) + getIncludedTaxes()) / loyaltyRewardRate);
176
186
  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, {
177
187
  outputFormat: 'YYYY-MM-DD HH:mm'
178
188
  });
@@ -278,16 +288,6 @@ var CartUI = function CartUI(props) {
278
288
  var checkOutBtnClick = function checkOutBtnClick(uuid) {
279
289
  handleClickCheckout(uuid);
280
290
  };
281
- var getIncludedTaxes = function getIncludedTaxes() {
282
- if ((cart === null || cart === void 0 ? void 0 : cart.taxes) === null) {
283
- return (cart === null || cart === void 0 ? void 0 : cart.business.tax_type) === 1 ? cart === null || cart === void 0 ? void 0 : cart.tax : 0;
284
- } else {
285
- return cart === null || cart === void 0 ? void 0 : cart.taxes.reduce(function (taxIncluded, tax) {
286
- var _tax$summary;
287
- return taxIncluded + (tax.type === 1 ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
288
- }, 0);
289
- }
290
- };
291
291
  var getIncludedTaxesDiscounts = function getIncludedTaxesDiscounts() {
292
292
  var _cart$taxes, _cart$taxes$filter;
293
293
  return cart === null || cart === void 0 ? void 0 : (_cart$taxes = cart.taxes) === null || _cart$taxes === void 0 ? void 0 : (_cart$taxes$filter = _cart$taxes.filter(function (tax) {
@@ -463,7 +463,7 @@ var CartUI = function CartUI(props) {
463
463
  return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
464
464
  }
465
465
  }))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 ? void 0 : (_offer$summary2 = offer.summary) === null || _offer$summary2 === void 0 ? void 0 : _offer$summary2.discount)));
466
- })), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price) > 0 && !hideDeliveryFee && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE', 'Delivery Fee')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.delivery_price))), !hideCartDiscount && (cart === null || cart === void 0 ? void 0 : (_cart$offers7 = cart.offers) === null || _cart$offers7 === void 0 ? void 0 : _cart$offers7.length) > 0 && (cart === null || cart === void 0 ? void 0 : (_cart$offers8 = cart.offers) === null || _cart$offers8 === void 0 ? void 0 : (_cart$offers8$filter = _cart$offers8.filter(function (offer) {
466
+ })), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount) > 0 && !hideDeliveryFee && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE', 'Delivery Fee')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount))), !hideCartDiscount && (cart === null || cart === void 0 ? void 0 : (_cart$offers7 = cart.offers) === null || _cart$offers7 === void 0 ? void 0 : _cart$offers7.length) > 0 && (cart === null || cart === void 0 ? void 0 : (_cart$offers8 = cart.offers) === null || _cart$offers8 === void 0 ? void 0 : (_cart$offers8$filter = _cart$offers8.filter(function (offer) {
467
467
  return (offer === null || offer === void 0 ? void 0 : offer.target) === 2;
468
468
  })) === null || _cart$offers8$filter === void 0 ? void 0 : _cart$offers8$filter.map(function (offer) {
469
469
  var _offer$summary3;
@@ -488,10 +488,10 @@ var CartUI = function CartUI(props) {
488
488
  return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
489
489
  }
490
490
  }))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 ? void 0 : (_offer$summary3 = offer.summary) === null || _offer$summary3 === void 0 ? void 0 : _offer$summary3.discount)));
491
- })), (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.delivery_price) > 0 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount) >= 0 && !hideDeliveryFee && isChewLayout && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount))), (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, {
491
+ })), (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
492
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
493
493
  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$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : _orderState$options5.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, {
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, {
495
495
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
496
496
  driverTipsOptions: driverTipsOptions,
497
497
  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,
@@ -550,7 +550,7 @@ var CartUI = function CartUI(props) {
550
550
  style: {
551
551
  fontWeight: 'bold'
552
552
  }
553
- }, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), cateringTypes.includes(orderState === null || orderState === void 0 ? void 0 : (_orderState$options6 = orderState.options) === null || _orderState$options6 === void 0 ? void 0 : _orderState$options6.type) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_MomentContent.MomentContent, {
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, {
554
554
  cateringPreorder: true,
555
555
  isCart: true,
556
556
  preorderSlotInterval: preorderSlotInterval,
@@ -93,6 +93,8 @@ var MessagesUI = function MessagesUI(props) {
93
93
  modalImage = _useState4[0],
94
94
  setModalImage = _useState4[1];
95
95
  var imageRef = (0, _react.useRef)(null);
96
+ var previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17];
97
+ var chatDisabled = previousStatus.includes(order === null || order === void 0 ? void 0 : order.status);
96
98
  var quickMessageList = [{
97
99
  key: 'message_1',
98
100
  text: t('CUSTOMER_MESSAGE_1', 'Lorem ipsum 1')
@@ -455,7 +457,7 @@ var MessagesUI = function MessagesUI(props) {
455
457
  outputFormat: 'MMM DD, YYYY'
456
458
  }))), /*#__PURE__*/_react.default.createElement(_styles.MessageConsole, null, /*#__PURE__*/_react.default.createElement(_styles.BubbleConsole, null, t('ORDER_PLACED_FOR', 'Order placed for'), " ", ' ', /*#__PURE__*/_react.default.createElement("strong", null, parseDate(order.created_at)), " ", ' ', t('VIA', 'Via'), ' ', /*#__PURE__*/_react.default.createElement("strong", null, order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')), ' ', /*#__PURE__*/_react.default.createElement(_styles.TimeofSent, null, parseTime(order.created_at)))), /*#__PURE__*/_react.default.createElement(MapMessages, {
457
459
  messages: messagesToShow !== null && messagesToShow !== void 0 && (_messagesToShow$messa2 = messagesToShow.messages) !== null && _messagesToShow$messa2 !== void 0 && _messagesToShow$messa2.length ? messagesToShow : messages
458
- }))), (parseInt(order === null || order === void 0 ? void 0 : order.status) === 1 || parseInt(order === null || order === void 0 ? void 0 : order.status) === 2 || parseInt(order === null || order === void 0 ? void 0 : order.status) === 5 || parseInt(order === null || order === void 0 ? void 0 : order.status) === 6 || parseInt(order === null || order === void 0 ? void 0 : order.status) === 10 || parseInt(order === null || order === void 0 ? void 0 : order.status) === 11 || parseInt(order === null || order === void 0 ? void 0 : order.status) === 12) && driver ? /*#__PURE__*/_react.default.createElement(_styles.NotSendMessage, null, /*#__PURE__*/_react.default.createElement(_MdcCloseOctagonOutline.default, null), /*#__PURE__*/_react.default.createElement("p", null, t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended'))) : /*#__PURE__*/_react.default.createElement(_styles.SendForm, null, /*#__PURE__*/_react.default.createElement(_styles.QuickMessageWrapper, null, quickMessageList.map(function (quickMessage, i) {
460
+ }))), chatDisabled ? /*#__PURE__*/_react.default.createElement(_styles.NotSendMessage, null, /*#__PURE__*/_react.default.createElement(_MdcCloseOctagonOutline.default, null), /*#__PURE__*/_react.default.createElement("p", null, t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended'))) : /*#__PURE__*/_react.default.createElement(_styles.SendForm, null, /*#__PURE__*/_react.default.createElement(_styles.QuickMessageWrapper, null, quickMessageList.map(function (quickMessage, i) {
459
461
  return /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
460
462
  key: i,
461
463
  color: "secundary",
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.MultiCartsPaymethodsAndWallets = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _orderingComponentsExternal = require("ordering-components-external");
10
+ var _styledComponents = require("styled-components");
10
11
  var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
11
- var _BilStripe = _interopRequireDefault(require("@meronex/icons/bi/BilStripe"));
12
12
  var _FaCcStripe = _interopRequireDefault(require("@meronex/icons/fa/FaCcStripe"));
13
13
  var _FaStripeS = _interopRequireDefault(require("@meronex/icons/fa/FaStripeS"));
14
14
  var _GrStripe = _interopRequireDefault(require("@meronex/icons/gr/GrStripe"));
@@ -71,13 +71,17 @@ var CreditCard2 = function CreditCard2() {
71
71
  var MultiCartsPaymethodsAndWalletsUI = function MultiCartsPaymethodsAndWalletsUI(props) {
72
72
  var _configs$wallet_cash_, _configs$wallet_credi, _paymethodSelected$pa, _paymethodSelected$pa2, _paymethodSelected$pa3, _paymethodSelected$pa4, _paymethodSelected$pa5, _paymethodSelected$pa6, _paymethodSelected$pa7, _paymethodSelected$pa8, _paymethodSelected$pa9, _paymethodSelected$pa10, _walletsState$result;
73
73
  var businessIds = props.businessIds,
74
+ balance = props.balance,
74
75
  paymethodsAndWallets = props.paymethodsAndWallets,
75
76
  walletsState = props.walletsState,
76
77
  paymethodSelected = props.paymethodSelected,
77
78
  handleSelectPaymethod = props.handleSelectPaymethod,
78
79
  handleSelectWallet = props.handleSelectWallet,
79
80
  handlePaymethodDataChange = props.handlePaymethodDataChange,
81
+ setCardList = props.setCardList,
82
+ walletsPaymethod = props.walletsPaymethod,
80
83
  isCustomerMode = props.isCustomerMode;
84
+ var theme = (0, _styledComponents.useTheme)();
81
85
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
82
86
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
83
87
  t = _useLanguage2[1];
@@ -153,21 +157,42 @@ var MultiCartsPaymethodsAndWalletsUI = function MultiCartsPaymethodsAndWalletsUI
153
157
  return item.type === wallet.type;
154
158
  });
155
159
  }).map(function (wallet, idx) {
156
- var _walletName$wallet$ty, _paymethodsAndWallets, _walletName$wallet$ty2;
160
+ var _walletName$wallet$ty, _paymethodsAndWallets, _walletsPaymethod$fin, _walletsPaymethod$fin2, _walletsPaymethod$fin4, _walletName$wallet$ty2;
157
161
  return ((_walletName$wallet$ty = walletName[wallet.type]) === null || _walletName$wallet$ty === void 0 ? void 0 : _walletName$wallet$ty.isActive) && /*#__PURE__*/_react.default.createElement(_styles.WalletOptionContainer, {
158
162
  key: wallet.type,
159
163
  isBottomBorder: idx === ((_paymethodsAndWallets = paymethodsAndWallets.wallets) === null || _paymethodsAndWallets === void 0 ? void 0 : _paymethodsAndWallets.length) - 1
160
- }, /*#__PURE__*/_react.default.createElement(_Checkbox.Checkbox, {
164
+ }, /*#__PURE__*/_react.default.createElement(_styles.SectionLeft, null, /*#__PURE__*/_react.default.createElement(_Checkbox.Checkbox, {
161
165
  name: "payment_option_".concat(wallet.type),
162
166
  id: "custom-checkbox-".concat(idx),
163
- disabled: wallet.balance === 0,
167
+ disabled: balance === 0 && !(walletsPaymethod !== null && walletsPaymethod !== void 0 && (_walletsPaymethod$fin = walletsPaymethod.find(function (walletPay) {
168
+ return walletPay.wallet_id === wallet.id;
169
+ })) !== null && _walletsPaymethod$fin !== void 0 && _walletsPaymethod$fin.id) || wallet.balance === 0,
164
170
  value: "payment_option_".concat(wallet.type),
165
- onChange: function onChange(e) {
166
- return handleSelectWallet(e.target.checked, wallet);
171
+ checked: !!(walletsPaymethod !== null && walletsPaymethod !== void 0 && (_walletsPaymethod$fin2 = walletsPaymethod.find(function (walletPay) {
172
+ return walletPay.wallet_id === wallet.id;
173
+ })) !== null && _walletsPaymethod$fin2 !== void 0 && _walletsPaymethod$fin2.id),
174
+ onChange: function onChange() {
175
+ var _walletsPaymethod$fin3;
176
+ return handleSelectWallet(!(walletsPaymethod !== null && walletsPaymethod !== void 0 && (_walletsPaymethod$fin3 = walletsPaymethod.find(function (walletPay) {
177
+ return walletPay.wallet_id === wallet.id;
178
+ })) !== null && _walletsPaymethod$fin3 !== void 0 && _walletsPaymethod$fin3.id), wallet);
167
179
  }
168
- }), /*#__PURE__*/_react.default.createElement("label", {
180
+ }), /*#__PURE__*/_react.default.createElement(_styles.SectionLeftText, null, /*#__PURE__*/_react.default.createElement("label", {
181
+ style: {
182
+ color: balance === 0 && !(walletsPaymethod !== null && walletsPaymethod !== void 0 && (_walletsPaymethod$fin4 = walletsPaymethod.find(function (walletPay) {
183
+ return walletPay.wallet_id === wallet.id;
184
+ })) !== null && _walletsPaymethod$fin4 !== void 0 && _walletsPaymethod$fin4.id) || wallet.balance === 0 ? theme.colors.darkGray : 'black'
185
+ },
169
186
  htmlFor: "custom-checkbox-".concat(idx)
170
- }, (_walletName$wallet$ty2 = walletName[wallet.type]) === null || _walletName$wallet$ty2 === void 0 ? void 0 : _walletName$wallet$ty2.name), /*#__PURE__*/_react.default.createElement("span", null, parsePrice(wallet.balance)));
187
+ }, (_walletName$wallet$ty2 = walletName[wallet.type]) === null || _walletName$wallet$ty2 === void 0 ? void 0 : _walletName$wallet$ty2.name))), /*#__PURE__*/_react.default.createElement("div", null, wallet.type === 'cash' && /*#__PURE__*/_react.default.createElement("span", null, parsePrice(wallet === null || wallet === void 0 ? void 0 : wallet.balance, {
188
+ isTruncable: true
189
+ })), wallet.type === 'credit_point' && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("span", {
190
+ style: {
191
+ color: theme.colors.primary
192
+ }
193
+ }, "".concat(wallet === null || wallet === void 0 ? void 0 : wallet.balance, " ").concat(t('POINTS', 'Points'))), " ", (wallet === null || wallet === void 0 ? void 0 : wallet.balance) > 0 && "= ".concat(parsePrice((wallet === null || wallet === void 0 ? void 0 : wallet.balance) / (wallet === null || wallet === void 0 ? void 0 : wallet.redemption_rate), {
194
+ isTruncable: true
195
+ })))));
171
196
  }))));
172
197
  };
173
198
  var MultiCartsPaymethodsAndWallets = function MultiCartsPaymethodsAndWallets(props) {
@@ -4,9 +4,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.WalletPaymentOptionContainer = exports.WalletOptionContainer = exports.PaymethodsListContainer = exports.PayCardSelected = exports.PayCard = exports.Container = exports.CardItemContent = void 0;
7
+ exports.WalletPaymentOptionContainer = exports.WalletOptionContainer = exports.SectionLeftText = exports.SectionLeft = exports.PaymethodsListContainer = exports.PayCardSelected = exports.PayCard = exports.Container = exports.CardItemContent = void 0;
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
9
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
10
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
12
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
@@ -29,7 +29,7 @@ var PayCard = _styledComponents.default.div(_templateObject3 || (_templateObject
29
29
  exports.PayCard = PayCard;
30
30
  var WalletPaymentOptionContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding-top: 20px;\n"])));
31
31
  exports.WalletPaymentOptionContainer = WalletPaymentOptionContainer;
32
- var WalletOptionContainer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n border-top: 1px solid ", ";\n ", "\n padding: 20px 0;\n\n > label {\n flex: 1;\n margin: 0 10px;\n }\n"])), function (props) {
32
+ var WalletOptionContainer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-top: 1px solid ", ";\n ", "\n padding: 20px 0;\n\n > label {\n flex: 1;\n margin: 0 10px;\n }\n"])), function (props) {
33
33
  return props.theme.colors.gray200;
34
34
  }, function (props) {
35
35
  return props.isBottomBorder && (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n border-bottom: 1px solid ", ";\n "])), function (props) {
@@ -37,12 +37,16 @@ var WalletOptionContainer = _styledComponents.default.div(_templateObject7 || (_
37
37
  });
38
38
  });
39
39
  exports.WalletOptionContainer = WalletOptionContainer;
40
- var PayCardSelected = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: 30px 0px 0px;\n"])));
40
+ var SectionLeft = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"])));
41
+ exports.SectionLeft = SectionLeft;
42
+ var SectionLeftText = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-left: 10px;\n"])));
43
+ exports.SectionLeftText = SectionLeftText;
44
+ var PayCardSelected = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n padding: 30px 0px 0px;\n"])));
41
45
  exports.PayCardSelected = PayCardSelected;
42
- var CardItemContent = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n font-weight: bold;\n\n span {\n display: flex;\n }\n\n .checks svg {\n color: ", ";\n font-size: 22px;\n }\n\n .brand img {\n width: 24px;\n }\n\n > * {\n margin-right: 10px\n ", "\n }\n"])), function (props) {
46
+ var CardItemContent = _styledComponents.default.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n font-weight: bold;\n\n span {\n display: flex;\n }\n\n .checks svg {\n color: ", ";\n font-size: 22px;\n }\n\n .brand img {\n width: 24px;\n }\n\n > * {\n margin-right: 10px\n ", "\n }\n"])), function (props) {
43
47
  return props.theme.colors.primary;
44
48
  }, function (props) {
45
49
  var _props$theme;
46
- return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.rtl) && (0, _styledComponents.css)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-left: 10px;\n margin-right: 0;\n "])));
50
+ return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.rtl) && (0, _styledComponents.css)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-left: 10px;\n margin-right: 0;\n "])));
47
51
  });
48
52
  exports.CardItemContent = CardItemContent;
@@ -42,7 +42,7 @@ var mapConfigs = {
42
42
  }
43
43
  };
44
44
  var MultiCheckoutUI = function MultiCheckoutUI(props) {
45
- var _paymethodSelected$pa, _Object$values, _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, _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$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,
@@ -57,6 +57,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
57
57
  cartGroup = props.cartGroup,
58
58
  cartUuid = props.cartUuid,
59
59
  totalCartsFee = props.totalCartsFee,
60
+ walletState = props.walletState,
60
61
  handleSearchRedirect = props.handleSearchRedirect;
61
62
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
62
63
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
@@ -80,26 +81,33 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
80
81
  _useOrder2 = _slicedToArray(_useOrder, 1),
81
82
  orderState = _useOrder2[0];
82
83
  var history = (0, _reactRouterDom.useHistory)();
84
+ var _useToast = (0, _orderingComponentsExternal.useToast)(),
85
+ _useToast2 = _slicedToArray(_useToast, 2),
86
+ showToast = _useToast2[1].showToast;
83
87
  var _useState = (0, _react.useState)([]),
84
88
  _useState2 = _slicedToArray(_useState, 2),
85
- userErrors = _useState2[0],
86
- setUserErrors = _useState2[1];
87
- var _useState3 = (0, _react.useState)(null),
89
+ cardList = _useState2[0],
90
+ setCardList = _useState2[1];
91
+ var _useState3 = (0, _react.useState)([]),
88
92
  _useState4 = _slicedToArray(_useState3, 2),
89
- isUserDetailsEdit = _useState4[0],
90
- setIsUserDetailsEdit = _useState4[1];
91
- var _useState5 = (0, _react.useState)({
93
+ userErrors = _useState4[0],
94
+ setUserErrors = _useState4[1];
95
+ var _useState5 = (0, _react.useState)(null),
96
+ _useState6 = _slicedToArray(_useState5, 2),
97
+ isUserDetailsEdit = _useState6[0],
98
+ setIsUserDetailsEdit = _useState6[1];
99
+ var _useState7 = (0, _react.useState)({
92
100
  open: false,
93
101
  content: []
94
102
  }),
95
- _useState6 = _slicedToArray(_useState5, 2),
96
- alertState = _useState6[0],
97
- setAlertState = _useState6[1];
98
- var isDisablePlaceOrderButton = !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_id || paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.wallet_id) || (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : (_paymethodSelected$pa = paymethodSelected.paymethod) === null || _paymethodSelected$pa === void 0 ? void 0 : _paymethodSelected$pa.gateway) === 'stripe' && !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_data);
103
+ _useState8 = _slicedToArray(_useState7, 2),
104
+ alertState = _useState8[0],
105
+ setAlertState = _useState8[1];
99
106
  var walletCarts = ((_Object$values = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (cart) {
100
107
  var _cart$products;
101
108
  return (cart === null || cart === void 0 ? void 0 : cart.products) && (cart === null || cart === void 0 ? void 0 : (_cart$products = cart.products) === null || _cart$products === void 0 ? void 0 : _cart$products.length) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (cart === null || cart === void 0 ? void 0 : cart.valid_schedule) && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.valid_maximum) && (cart === null || cart === void 0 ? void 0 : cart.valid_minimum) && (cart === null || cart === void 0 ? void 0 : cart.wallets);
102
109
  })) || null || [];
110
+ var isDisablePlaceOrderButton = (cartGroup === null || cartGroup === void 0 ? void 0 : cartGroup.loading) || !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_id || paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.wallet_id) && (cartGroup === null || cartGroup === void 0 ? void 0 : (_cartGroup$result = cartGroup.result) === null || _cartGroup$result === void 0 ? void 0 : _cartGroup$result.balance) > 0 || (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : (_paymethodSelected$pa = paymethodSelected.paymethod) === null || _paymethodSelected$pa === void 0 ? void 0 : _paymethodSelected$pa.gateway) === 'stripe' && !(paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_data) || (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) === 'stripe' && (cardList === null || cardList === void 0 ? void 0 : (_cardList$cards = cardList.cards) === null || _cardList$cards === void 0 ? void 0 : _cardList$cards.length) === 0 || walletCarts.length > 0;
103
111
  var isMultiDriverTips = (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';
104
112
  var driverTipsOptions = typeof (configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o = configs.driver_tip_options) === null || _configs$driver_tip_o === void 0 ? void 0 : _configs$driver_tip_o.value) === 'string' ? JSON.parse(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o2 = configs.driver_tip_options) === null || _configs$driver_tip_o2 === void 0 ? void 0 : _configs$driver_tip_o2.value) || [] : (configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o3 = configs.driver_tip_options) === null || _configs$driver_tip_o3 === void 0 ? void 0 : _configs$driver_tip_o3.value) || [];
105
113
  var totalFeeEnabled = (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine = configs.multi_business_checkout_show_combined_delivery_fee) === null || _configs$multi_busine === void 0 ? void 0 : _configs$multi_busine.value) === '1' ? JSON.parse(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o4 = configs.driver_tip_options) === null || _configs$driver_tip_o4 === void 0 ? void 0 : _configs$driver_tip_o4.value) || [] : (configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_o5 = configs.driver_tip_options) === null || _configs$driver_tip_o5 === void 0 ? void 0 : _configs$driver_tip_o5.value) || [];
@@ -117,8 +125,18 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
117
125
  var creditPointPlanOnBusiness = businessIds.every(function (bid) {
118
126
  return loyalBusinessIds.includes(bid);
119
127
  }) && creditPointPlan;
128
+ var getIncludedTaxes = function getIncludedTaxes(cart) {
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;
131
+ } else {
132
+ return cart === null || cart === void 0 ? void 0 : cart.taxes.reduce(function (taxIncluded, tax) {
133
+ var _tax$summary;
134
+ return taxIncluded + (tax.type === 1 ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
135
+ }, 0);
136
+ }
137
+ };
120
138
  var loyaltyRewardValue = creditPointPlanOnBusiness !== null && creditPointPlanOnBusiness !== void 0 && creditPointPlanOnBusiness.accumulation_rate ? Math.round(openCarts.reduce(function (sum, cart) {
121
- return sum + (cart === null || cart === void 0 ? void 0 : cart.subtotal);
139
+ return sum + (cart === null || cart === void 0 ? void 0 : cart.subtotal) + getIncludedTaxes(cart);
122
140
  }, 0) / (creditPointPlanOnBusiness === null || creditPointPlanOnBusiness === void 0 ? void 0 : creditPointPlanOnBusiness.accumulation_rate)) : 0;
123
141
  var handlePlaceOrder = function handlePlaceOrder() {
124
142
  if (!userErrors.length) {
@@ -192,6 +210,12 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
192
210
  page: 'search'
193
211
  });
194
212
  }, [openCarts, cartGroup]);
213
+ (0, _react.useEffect)(function () {
214
+ if (walletState.error) {
215
+ var _walletState$error, _walletState$error$;
216
+ showToast(_orderingComponentsExternal.ToastType.Error, t(walletState.error, (_walletState$error = walletState.error) === null || _walletState$error === void 0 ? void 0 : (_walletState$error$ = _walletState$error[0]) === null || _walletState$error$ === void 0 ? void 0 : _walletState$error$.replace(/_/g, ' ')));
217
+ }
218
+ }, [walletState.error]);
195
219
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !(cartGroup !== null && cartGroup !== void 0 && cartGroup.loading) && openCarts.length === 0 || !cartUuid ? /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
196
220
  content: t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.'),
197
221
  btnTitle: t('SEARCH_REDIRECT', 'Go to Businesses'),
@@ -221,12 +245,15 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
221
245
  }))), /*#__PURE__*/_react.default.createElement(_styles.PaymentMethodContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('PAYMENT_METHODS', 'Payment Methods')), /*#__PURE__*/_react.default.createElement(_MultiCartsPaymethodsAndWallets.MultiCartsPaymethodsAndWallets, {
222
246
  userId: props.userId,
223
247
  openCarts: openCarts,
248
+ balance: cartGroup === null || cartGroup === void 0 ? void 0 : (_cartGroup$result2 = cartGroup.result) === null || _cartGroup$result2 === void 0 ? void 0 : _cartGroup$result2.balance,
249
+ walletsPaymethod: cartGroup === null || cartGroup === void 0 ? void 0 : (_cartGroup$result3 = cartGroup.result) === null || _cartGroup$result3 === void 0 ? void 0 : _cartGroup$result3.wallets,
224
250
  paymethodSelected: paymethodSelected,
225
251
  handleSelectPaymethod: handleSelectPaymethod,
226
252
  handleSelectWallet: handleSelectWallet,
227
253
  handlePaymethodDataChange: handlePaymethodDataChange,
228
254
  cartUuid: cartUuid,
229
- isCustomerMode: isCustomerMode
255
+ isCustomerMode: isCustomerMode,
256
+ setCardList: setCardList
230
257
  })), (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie9 = validationFields.fields) === null || _validationFields$fie9 === void 0 ? void 0 : (_validationFields$fie10 = _validationFields$fie9.checkout) === null || _validationFields$fie10 === void 0 ? void 0 : (_validationFields$fie11 = _validationFields$fie10.coupon) === null || _validationFields$fie11 === void 0 ? void 0 : _validationFields$fie11.enabled) && openCarts.every(function (cart) {
231
258
  return cart.business_id && cart.status !== 2;
232
259
  }) && (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine2 = configs.multi_business_checkout_coupon_input_style) === null || _configs$multi_busine2 === void 0 ? void 0 : _configs$multi_busine2.value) === 'group' && /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DISCOUNT_COUPON', 'Discount coupon')), /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
@@ -251,7 +278,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
251
278
  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,
252
279
  useOrderContext: true
253
280
  })))), /*#__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) {
254
- var _configs$multi_busine3, _cart$products2, _configs$multi_busine4, _configs$multi_busine5;
281
+ var _configs$multi_busine3, _cart$products2, _configs$multi_busine4, _configs$multi_busine5, _cart$business;
255
282
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
256
283
  key: cart.uuid
257
284
  }, /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
@@ -261,7 +288,8 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
261
288
  hideCouponInput: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine3 = configs.multi_business_checkout_coupon_input_style) === null || _configs$multi_busine3 === void 0 ? void 0 : _configs$multi_busine3.value) === 'group',
262
289
  isProducts: (cart === null || cart === void 0 ? void 0 : (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0,
263
290
  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',
264
- 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'
291
+ 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
265
293
  }), /*#__PURE__*/_react.default.createElement(_styles.DriverTipDivider, null));
266
294
  }), 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, {
267
295
  totalFeeEnabled: totalFeeEnabled
@@ -10,9 +10,9 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
10
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
12
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 20px;\n overflow: hidden;\n min-height: auto;\n width: 100%;\n box-sizing: border-box;\n position: relative;\n\n > h1 {\n font-weight: 600;\n font-size: 32px;\n line-height: 48px;\n margin-bottom: 7px;\n margin-top: 0px;\n text-transform: capitalize;\n }\n\n @media (min-width: 769px) {\n ", "\n margin-left: auto;\n margin-right: auto;\n }\n\n"])), function (_ref) {
13
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 20px;\n overflow: hidden;\n min-height: auto;\n width: 100%;\n box-sizing: border-box;\n position: relative;\n min-height: calc(100vh - 320px);\n\n > h1 {\n font-weight: 600;\n font-size: 32px;\n line-height: 48px;\n margin-bottom: 7px;\n margin-top: 0px;\n text-transform: capitalize;\n }\n\n @media (min-width: 769px) {\n ", "\n margin-left: auto;\n margin-right: auto;\n }\n\n"])), function (_ref) {
14
14
  var hideOrders = _ref.hideOrders;
15
- return !hideOrders ? (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 40px;\n width: 100%;\n @media (min-width: 993px) {\n min-height: calc(100vh - 382px);\n }\n "]))) : (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0;\n width: 100%;\n\n @media (min-width: 993px) {\n min-height: 'auto';\n }\n "])));
15
+ return !hideOrders ? (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 40px;\n width: 100%;\n "]))) : (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0;\n width: 100%;\n\n @media (min-width: 993px) {\n min-height: 'auto';\n }\n "])));
16
16
  });
17
17
  exports.Container = Container;
18
18
  var Divider = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-top: 25px;\n background: #F8F9FA;\n height: 8px;\n width: 100%;\n"])));
@@ -23,7 +23,7 @@ var OrderGroupFilterWrapper = _styledComponents.default.div(_templateObject5 ||
23
23
  return props.theme.rtl && (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-right: 5px;\n margin-left: 0;\n "])));
24
24
  });
25
25
  exports.OrderGroupFilterWrapper = OrderGroupFilterWrapper;
26
- var NoOrdersWrapper = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 50px 0px;\n position: absolute;\n box-sizing: border-box;\n height: calc(100% - 120px);\n width: 100%;\n\n > p {\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n margin-top: 0px;\n margin-bottom: 25px;\n }\n\n button {\n height: 44px;\n }\n"])));
26
+ var NoOrdersWrapper = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 50px 0px;\n position: absolute;\n box-sizing: border-box;\n min-height: calc(100% - 120px);\n width: 100%;\n\n > p {\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n margin-top: 0px;\n margin-bottom: 25px;\n }\n\n button {\n height: 44px;\n }\n"])));
27
27
  exports.NoOrdersWrapper = NoOrdersWrapper;
28
28
  var MyOrdersMenuContainer = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n overflow-x: auto;\n padding: 5px 0px 0px 0px;\n background: ", ";\n z-index: 1000;\n position: sticky;\n top: 0;\n border-bottom: 1px solid #D9D9D9;\n text-align: center;\n width: 100%;\n margin-bottom: 30px;\n div.category {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n padding: 10px 0px;\n margin: 0 15px;\n &:nth-of-type(1) {\n margin-left: 0;\n ", "\n }\n }\n\n div.special {\n ", "\n }\n\n @media (min-width: 381px) {\n padding: 15px 0px 0px 0px;\n }\n @media (min-width: 992px) {\n width: auto;\n }\n"])), function (props) {
29
29
  return props.theme.colors.backgroundPage;
@@ -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
- parseDate = _useUtils2[0].parseDate;
25
+ parseTime = _useUtils2[0].parseTime;
26
26
  var _useState = (0, _react.useState)(null),
27
27
  _useState2 = _slicedToArray(_useState, 2),
28
28
  estimatedDeliveryTime = _useState2[0],
@@ -49,9 +49,9 @@ 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 = parseDate((0, _moment.default)(_delivery).add(totalEta, 'minutes'));
52
+ _estimatedTime = (0, _moment.default)(_delivery).add(totalEta, 'minutes');
53
53
  } else {
54
- _estimatedTime = parseDate((0, _moment.default)(_delivery).add(order === null || order === void 0 ? void 0 : order.eta_time, 'minutes'));
54
+ _estimatedTime = (0, _moment.default)(_delivery).add(order === null || order === void 0 ? void 0 : order.eta_time, 'minutes');
55
55
  }
56
56
  setEstimatedDeliveryTime(_estimatedTime);
57
57
  };
@@ -64,6 +64,8 @@ var OrderEta = function OrderEta(props) {
64
64
  return clearInterval(interval);
65
65
  };
66
66
  }, [order]);
67
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !outputFormat ? estimatedDeliveryTime : (0, _moment.default)(estimatedDeliveryTime).format(outputFormat));
67
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !outputFormat ? parseTime(estimatedDeliveryTime) : parseTime(estimatedDeliveryTime, {
68
+ outputFormat: 'hh:mm A'
69
+ }));
68
70
  };
69
71
  exports.OrderEta = OrderEta;
@@ -84,7 +84,8 @@ var OrderProgressUI = function OrderProgressUI(props) {
84
84
  width: (_getOrderStatus = (0, _utils.getOrderStatus)(lastOrder.status)) !== null && _getOrderStatus !== void 0 && _getOrderStatus.percentage ? "".concat((0, _utils.getOrderStatus)(lastOrder.status).percentage, "%") : '0%'
85
85
  }
86
86
  })), /*#__PURE__*/_react.default.createElement(_styles.ProgressTextWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.StatusWrapper, null, (_getOrderStatus2 = (0, _utils.getOrderStatus)(lastOrder === null || lastOrder === void 0 ? void 0 : lastOrder.status)) === null || _getOrderStatus2 === void 0 ? void 0 : _getOrderStatus2.value), /*#__PURE__*/_react.default.createElement(_styles.TimeWrapper, null, /*#__PURE__*/_react.default.createElement("span", null, t('ESTIMATED_DELIVERY', 'Estimated delivery'), ":\xA0"), /*#__PURE__*/_react.default.createElement("span", null, lastOrder !== null && lastOrder !== void 0 && lastOrder.delivery_datetime_utc ? parseTime(lastOrder === null || lastOrder === void 0 ? void 0 : lastOrder.delivery_datetime_utc, {
87
- outputFormat: 'hh:mm A'
87
+ outputFormat: 'hh:mm A',
88
+ utc: false
88
89
  }) : parseTime(lastOrder === null || lastOrder === void 0 ? void 0 : lastOrder.delivery_datetime, {
89
90
  utc: false
90
91
  }), "\xA0-\xA0", /*#__PURE__*/_react.default.createElement(_OrderEta.OrderEta, {
@@ -51,13 +51,13 @@ var PageBannerUI = function PageBannerUI(props) {
51
51
  params: {
52
52
  business_slug: slug
53
53
  },
54
- replace: true
54
+ replace: false
55
55
  });
56
56
  } else {
57
57
  return events.emit('go_to_page', {
58
58
  page: 'business',
59
59
  search: "?".concat(businessUrlTemplate.split('?')[1].replace(':business_slug', '')).concat(slug),
60
- replace: true
60
+ replace: false
61
61
  });
62
62
  }
63
63
  }
@@ -70,7 +70,7 @@ var PageBannerUI = function PageBannerUI(props) {
70
70
  category_slug: category,
71
71
  product_slug: product
72
72
  },
73
- replace: true
73
+ replace: false
74
74
  });
75
75
  }
76
76
  if (productUrlTemplate.includes('/store/:category_slug/:product_slug')) {
@@ -82,7 +82,7 @@ var PageBannerUI = function PageBannerUI(props) {
82
82
  product_slug: product
83
83
  },
84
84
  search: "?".concat(businessParameter, "=").concat(slug),
85
- replace: true
85
+ replace: false
86
86
  });
87
87
  }
88
88
  if (productUrlTemplate.includes('/store/:business_slug') && productUrlTemplate.includes('category_id')) {
@@ -95,7 +95,7 @@ var PageBannerUI = function PageBannerUI(props) {
95
95
  business_slug: slug
96
96
  },
97
97
  search: "?".concat(categoryParameter, "=").concat(category, "&").concat(productParameter, "=").concat(product),
98
- replace: true
98
+ replace: false
99
99
  });
100
100
  }
101
101
  if (productUrlTemplate.includes('/:business_slug') && !productUrlTemplate.includes('store')) {
@@ -108,7 +108,7 @@ var PageBannerUI = function PageBannerUI(props) {
108
108
  business_slug: slug
109
109
  },
110
110
  search: "?".concat(_categoryParameter, "=").concat(category, "&").concat(_productParameter, "=").concat(product),
111
- replace: true
111
+ replace: false
112
112
  });
113
113
  }
114
114
  };