ordering-ui-external 10.10.17 → 10.10.19

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.
@@ -85,6 +85,9 @@ var CardFormCustom = function CardFormCustom(props) {
85
85
  focused: formState.focus,
86
86
  name: formState.name,
87
87
  number: formState.number,
88
+ locale: {
89
+ valid: t('VALID_THRU', 'Valid thru')
90
+ },
88
91
  placeholders: {
89
92
  name: t('YOUR_NAME_HERE', 'Your name here')
90
93
  }
@@ -44,7 +44,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
44
44
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
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, _validationFields$fie, _configs$checkout_mul, _orderState$carts, _props$cart, _theme$viewString, _validationFields$fie2, _theme$viewString2, _validationFields$fie3, _orderState$options, _orderState$options2, _cart$taxes, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers4, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes3, _cart$taxes4, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _orderState$options3, _cart$offers7, _cart$offers8, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options4, _validationFields$fie4, _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, _configs$checkout_mul, _orderState$carts, _props$cart, _theme$viewString, _validationFields$fie2, _theme$viewString2, _validationFields$fie3, _orderState$options, _orderState$options2, _cart$taxes, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers4, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes3, _cart$taxes4, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _orderState$options3, _cart$taxes5, _cart$taxes6, _cart$offers7, _cart$offers8, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options4, _validationFields$fie4, _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,
@@ -167,13 +167,13 @@ var CartUI = function CartUI(props) {
167
167
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet')
168
168
  }
169
169
  };
170
- var getIncludedTaxes = function getIncludedTaxes() {
170
+ var getIncludedTaxes = function getIncludedTaxes(isDeliveryFee) {
171
171
  if ((cart === null || cart === void 0 ? void 0 : cart.taxes) === null) {
172
172
  return (cart === null || cart === void 0 ? void 0 : cart.business.tax_type) === 1 ? cart === null || cart === void 0 ? void 0 : cart.tax : 0;
173
173
  } else {
174
174
  return cart === null || cart === void 0 ? void 0 : cart.taxes.reduce(function (taxIncluded, tax) {
175
175
  var _tax$summary;
176
- return taxIncluded + (tax.type === 1 ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
176
+ return taxIncluded + (!isDeliveryFee && tax.type === 1 && tax.target === 'product' || isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee' ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
177
177
  }, 0);
178
178
  }
179
179
  };
@@ -306,7 +306,7 @@ var CartUI = function CartUI(props) {
306
306
  var getIncludedTaxesDiscounts = function getIncludedTaxesDiscounts() {
307
307
  var _cart$taxes2;
308
308
  return cart === null || cart === void 0 || (_cart$taxes2 = cart.taxes) === null || _cart$taxes2 === void 0 || (_cart$taxes2 = _cart$taxes2.filter(function (tax) {
309
- return (tax === null || tax === void 0 ? void 0 : tax.type) === 1;
309
+ return (tax === null || tax === void 0 ? void 0 : tax.type) === 1 && (tax === null || tax === void 0 ? void 0 : tax.target) === 'product';
310
310
  })) === null || _cart$taxes2 === void 0 ? void 0 : _cart$taxes2.reduce(function (carry, tax) {
311
311
  var _tax$summary$tax_afte, _tax$summary2, _tax$summary3;
312
312
  return carry + ((_tax$summary$tax_afte = tax === null || tax === void 0 || (_tax$summary2 = tax.summary) === null || _tax$summary2 === void 0 ? void 0 : _tax$summary2.tax_after_discount) !== null && _tax$summary$tax_afte !== void 0 ? _tax$summary$tax_afte : tax === null || tax === void 0 || (_tax$summary3 = tax.summary) === null || _tax$summary3 === void 0 ? void 0 : _tax$summary3.tax);
@@ -483,7 +483,27 @@ var CartUI = function CartUI(props) {
483
483
  return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
484
484
  }
485
485
  }))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 || (_offer$summary2 = offer.summary) === null || _offer$summary2 === void 0 ? void 0 : _offer$summary2.discount)));
486
- })), (orderState === null || orderState === void 0 || (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 && !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 || (_cart$offers7 = cart.offers) === null || _cart$offers7 === void 0 ? void 0 : _cart$offers7.length) > 0 && (cart === null || cart === void 0 || (_cart$offers8 = cart.offers) === null || _cart$offers8 === void 0 || (_cart$offers8 = _cart$offers8.filter(function (offer) {
486
+ })), (orderState === null || orderState === void 0 || (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 && !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) + getIncludedTaxes(true)))), (cart === null || cart === void 0 || (_cart$taxes5 = cart.taxes) === null || _cart$taxes5 === void 0 ? void 0 : _cart$taxes5.length) > 0 && (cart === null || cart === void 0 || (_cart$taxes6 = cart.taxes) === null || _cart$taxes6 === void 0 ? void 0 : _cart$taxes6.filter(function (tax) {
487
+ return (tax === null || tax === void 0 ? void 0 : tax.type) === 2 && (tax === null || tax === void 0 ? void 0 : tax.rate) !== 0 && (tax === null || tax === void 0 ? void 0 : tax.target) === 'delivery_fee';
488
+ }).map(function (tax) {
489
+ var _ref4, _tax$summary$tax_afte3, _tax$summary6, _tax$summary7;
490
+ return /*#__PURE__*/_react.default.createElement("tr", {
491
+ key: tax === null || tax === void 0 ? void 0 : tax.id
492
+ }, /*#__PURE__*/_react.default.createElement("td", {
493
+ className: "icon"
494
+ }, tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business'), /*#__PURE__*/_react.default.createElement("span", null, "(".concat((0, _utils.verifyDecimals)(tax === null || tax === void 0 ? void 0 : tax.rate, parseNumber), "%)")), /*#__PURE__*/_react.default.createElement(_styles.IconContainer, {
495
+ onClick: function onClick() {
496
+ return setOpenTaxModal({
497
+ open: true,
498
+ data: tax,
499
+ type: 'tax'
500
+ });
501
+ }
502
+ }, /*#__PURE__*/_react.default.createElement(_BsInfoCircle.default, {
503
+ size: "20",
504
+ color: theme.colors.primary
505
+ }))), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((_ref4 = (_tax$summary$tax_afte3 = tax === null || tax === void 0 || (_tax$summary6 = tax.summary) === null || _tax$summary6 === void 0 ? void 0 : _tax$summary6.tax_after_discount) !== null && _tax$summary$tax_afte3 !== void 0 ? _tax$summary$tax_afte3 : tax === null || tax === void 0 || (_tax$summary7 = tax.summary) === null || _tax$summary7 === void 0 ? void 0 : _tax$summary7.tax) !== null && _ref4 !== void 0 ? _ref4 : 0)));
506
+ })), !hideCartDiscount && (cart === null || cart === void 0 || (_cart$offers7 = cart.offers) === null || _cart$offers7 === void 0 ? void 0 : _cart$offers7.length) > 0 && (cart === null || cart === void 0 || (_cart$offers8 = cart.offers) === null || _cart$offers8 === void 0 || (_cart$offers8 = _cart$offers8.filter(function (offer) {
487
507
  return (offer === null || offer === void 0 ? void 0 : offer.target) === 2;
488
508
  })) === null || _cart$offers8 === void 0 ? void 0 : _cart$offers8.map(function (offer) {
489
509
  var _offer$summary3;
@@ -27,7 +27,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
27
27
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
28
28
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
29
  var MyOrders = function MyOrders(props) {
30
- var _theme$orders, _theme$orders2, _theme$orders3, _props$beforeElements, _props$beforeComponen, _props$afterComponent, _props$afterElements;
30
+ var _theme$orders, _theme$orders2, _theme$orders3, _configs$cash_wallet, _configs$wallet_enabl, _configs$wallet_cash_, _configs$wallet_credi, _props$beforeElements, _props$beforeComponen, _props$afterComponent, _props$afterElements;
31
31
  var hideOrders = props.hideOrders,
32
32
  isFromBusinessListingSearch = props.isFromBusinessListingSearch,
33
33
  businessesSearchList = props.businessesSearchList,
@@ -38,6 +38,9 @@ var MyOrders = function MyOrders(props) {
38
38
  t = _useLanguage2[1];
39
39
  var history = (0, _reactRouterDom.useHistory)();
40
40
  var theme = (0, _styledComponents.useTheme)();
41
+ var _useConfig = (0, _orderingComponentsExternal.useConfig)(),
42
+ _useConfig2 = _slicedToArray(_useConfig, 1),
43
+ configs = _useConfig2[0].configs;
41
44
  var layout = (theme === null || theme === void 0 || (_theme$orders = theme.orders) === null || _theme$orders === void 0 || (_theme$orders = _theme$orders.components) === null || _theme$orders === void 0 || (_theme$orders = _theme$orders.layout) === null || _theme$orders === void 0 ? void 0 : _theme$orders.type) || 'original';
42
45
  var _useState = (0, _react.useState)(false),
43
46
  _useState2 = _slicedToArray(_useState, 2),
@@ -65,6 +68,7 @@ var MyOrders = function MyOrders(props) {
65
68
  setBusinessOrderIds = _useState12[1];
66
69
  var hideProductsTab = theme === null || theme === void 0 || (_theme$orders2 = theme.orders) === null || _theme$orders2 === void 0 || (_theme$orders2 = _theme$orders2.components) === null || _theme$orders2 === void 0 || (_theme$orders2 = _theme$orders2.products_tab) === null || _theme$orders2 === void 0 ? void 0 : _theme$orders2.hidden;
67
70
  var hideBusinessTab = theme === null || theme === void 0 || (_theme$orders3 = theme.orders) === null || _theme$orders3 === void 0 || (_theme$orders3 = _theme$orders3.components) === null || _theme$orders3 === void 0 || (_theme$orders3 = _theme$orders3.business_tab) === null || _theme$orders3 === void 0 ? void 0 : _theme$orders3.hidden;
71
+ var isWalletEnabled = (configs === null || configs === void 0 || (_configs$cash_wallet = configs.cash_wallet) === null || _configs$cash_wallet === void 0 ? void 0 : _configs$cash_wallet.value) && (configs === null || configs === void 0 || (_configs$wallet_enabl = configs.wallet_enabled) === null || _configs$wallet_enabl === void 0 ? void 0 : _configs$wallet_enabl.value) === '1' && ((configs === null || configs === void 0 || (_configs$wallet_cash_ = configs.wallet_cash_enabled) === null || _configs$wallet_cash_ === void 0 ? void 0 : _configs$wallet_cash_.value) === '1' || (configs === null || configs === void 0 || (_configs$wallet_credi = configs.wallet_credit_point_enabled) === null || _configs$wallet_credi === void 0 ? void 0 : _configs$wallet_credi.value) === '1');
68
72
  var MyOrdersMenu = [{
69
73
  key: 'orders',
70
74
  value: t('ORDERS', 'Orders'),
@@ -80,7 +84,7 @@ var MyOrders = function MyOrders(props) {
80
84
  }, {
81
85
  key: 'giftCards',
82
86
  value: t('GIFT_CARD', 'Gift card'),
83
- disabled: false
87
+ disabled: !isWalletEnabled
84
88
  }];
85
89
  var notOrderOptions = ['business', 'products', 'professionals'];
86
90
  var allEmpty = isEmptyActive && isEmptyPast && isEmptyPreorder || (isEmptyBusinesses || (businessOrderIds === null || businessOrderIds === void 0 ? void 0 : businessOrderIds.length) === 0) && hideOrders;
@@ -18,7 +18,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
18
18
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
  var OrderBillSection = function OrderBillSection(props) {
21
- var _theme$defaultLanguag, _order$summary$subtot, _order$summary2, _ref, _order$summary3, _order$offers, _theme$defaultLanguag2, _theme$defaultLanguag3, _order$summary$discou, _order$summary4, _order$offers2, _order$offers3, _order$summary5, _order$summary6, _order$summary7, _ref2, _order$summary8, _order$summary$subtot2, _order$summary9, _order$taxes3, _order$summary$tax2, _order$summary10, _order$fees, _order$summary$servic, _order$summary11, _order$taxes4, _order$taxes5, _order$fees2, _order$fees3, _order$offers4, _order$offers5, _order$summary12, _theme$defaultLanguag4, _order$summary13, _order$offers6, _order$offers7, _order$summary14, _theme$defaultLanguag5, _order$summary15, _configs$driver_tip_t, _configs$driver_tip_u, _order$summary$driver, _order$summary16, _theme$defaultLanguag6, _order$summary$total, _order$summary17, _order$payment_events, _order$payment_events2;
21
+ var _theme$defaultLanguag, _order$summary$subtot, _order$summary2, _ref, _order$summary3, _order$offers, _theme$defaultLanguag2, _theme$defaultLanguag3, _order$summary$discou, _order$summary4, _order$offers2, _order$offers3, _order$summary5, _order$summary6, _order$summary7, _ref2, _order$summary8, _order$summary$subtot2, _order$summary9, _order$taxes3, _order$summary$tax2, _order$summary10, _order$fees, _order$summary$servic, _order$summary11, _order$taxes4, _order$taxes5, _order$fees2, _order$fees3, _order$offers4, _order$offers5, _order$summary12, _theme$defaultLanguag4, _order$summary13, _order$taxes6, _order$taxes7, _order$offers6, _order$offers7, _order$summary14, _theme$defaultLanguag5, _order$summary15, _configs$driver_tip_t, _configs$driver_tip_u, _order$summary$driver, _order$summary16, _theme$defaultLanguag6, _order$summary$total, _order$summary17, _order$payment_events, _order$payment_events2;
22
22
  var order = props.order,
23
23
  setOpenTaxModal = props.setOpenTaxModal;
24
24
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
@@ -41,7 +41,7 @@ var OrderBillSection = function OrderBillSection(props) {
41
41
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet')
42
42
  }
43
43
  };
44
- var getIncludedTaxes = function getIncludedTaxes() {
44
+ var getIncludedTaxes = function getIncludedTaxes(isDeliveryFee) {
45
45
  var _order$taxes;
46
46
  if ((order === null || order === void 0 || (_order$taxes = order.taxes) === null || _order$taxes === void 0 ? void 0 : _order$taxes.length) === 0) {
47
47
  var _order$summary$tax, _order$summary;
@@ -49,14 +49,14 @@ var OrderBillSection = function OrderBillSection(props) {
49
49
  } else {
50
50
  return order === null || order === void 0 ? void 0 : order.taxes.reduce(function (taxIncluded, tax) {
51
51
  var _tax$summary;
52
- return taxIncluded + (tax.type === 1 ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
52
+ return taxIncluded + (!isDeliveryFee && tax.type === 1 && tax.target === 'product' || isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee' ? (_tax$summary = tax.summary) === null || _tax$summary === void 0 ? void 0 : _tax$summary.tax : 0);
53
53
  }, 0);
54
54
  }
55
55
  };
56
56
  var getIncludedTaxesDiscounts = function getIncludedTaxesDiscounts() {
57
57
  var _order$taxes2;
58
58
  return order === null || order === void 0 || (_order$taxes2 = order.taxes) === null || _order$taxes2 === void 0 || (_order$taxes2 = _order$taxes2.filter(function (tax) {
59
- return (tax === null || tax === void 0 ? void 0 : tax.type) === 1;
59
+ return (tax === null || tax === void 0 ? void 0 : tax.type) === 1 && (tax === null || tax === void 0 ? void 0 : tax.target) === 'product';
60
60
  })) === null || _order$taxes2 === void 0 ? void 0 : _order$taxes2.reduce(function (carry, tax) {
61
61
  var _tax$summary$tax_afte, _tax$summary2, _tax$summary3;
62
62
  return carry + ((_tax$summary$tax_afte = tax === null || tax === void 0 || (_tax$summary2 = tax.summary) === null || _tax$summary2 === void 0 ? void 0 : _tax$summary2.tax_after_discount) !== null && _tax$summary$tax_afte !== void 0 ? _tax$summary$tax_afte : tax === null || tax === void 0 || (_tax$summary3 = tax.summary) === null || _tax$summary3 === void 0 ? void 0 : _tax$summary3.tax);
@@ -134,7 +134,25 @@ var OrderBillSection = function OrderBillSection(props) {
134
134
  size: "20",
135
135
  color: theme.colors.primary
136
136
  }))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 || (_offer$summary2 = offer.summary) === null || _offer$summary2 === void 0 ? void 0 : _offer$summary2.discount)));
137
- })), typeof (order === null || order === void 0 || (_order$summary12 = order.summary) === null || _order$summary12 === void 0 ? void 0 : _order$summary12.delivery_price) === 'number' && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE', (theme === null || theme === void 0 || (_theme$defaultLanguag4 = theme.defaultLanguages) === null || _theme$defaultLanguag4 === void 0 ? void 0 : _theme$defaultLanguag4.DELIVERY_FEE) || 'Delivery Fee')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(order === null || order === void 0 || (_order$summary13 = order.summary) === null || _order$summary13 === void 0 ? void 0 : _order$summary13.delivery_price))), (order === null || order === void 0 || (_order$offers6 = order.offers) === null || _order$offers6 === void 0 ? void 0 : _order$offers6.length) > 0 && (order === null || order === void 0 || (_order$offers7 = order.offers) === null || _order$offers7 === void 0 || (_order$offers7 = _order$offers7.filter(function (offer) {
137
+ })), typeof (order === null || order === void 0 || (_order$summary12 = order.summary) === null || _order$summary12 === void 0 ? void 0 : _order$summary12.delivery_price) === 'number' && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE', (theme === null || theme === void 0 || (_theme$defaultLanguag4 = theme.defaultLanguages) === null || _theme$defaultLanguag4 === void 0 ? void 0 : _theme$defaultLanguag4.DELIVERY_FEE) || 'Delivery Fee')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((order === null || order === void 0 || (_order$summary13 = order.summary) === null || _order$summary13 === void 0 ? void 0 : _order$summary13.delivery_price) + getIncludedTaxes(true)))), (order === null || order === void 0 || (_order$taxes6 = order.taxes) === null || _order$taxes6 === void 0 ? void 0 : _order$taxes6.length) > 0 && (order === null || order === void 0 || (_order$taxes7 = order.taxes) === null || _order$taxes7 === void 0 ? void 0 : _order$taxes7.filter(function (tax) {
138
+ return (tax === null || tax === void 0 ? void 0 : tax.type) === 2 && (tax === null || tax === void 0 ? void 0 : tax.rate) !== 0 && (tax === null || tax === void 0 ? void 0 : tax.target) === 'delivery_fee';
139
+ }).map(function (tax) {
140
+ var _tax$name2, _ref5, _tax$summary$tax_afte3, _tax$summary6, _tax$summary7;
141
+ return /*#__PURE__*/_react.default.createElement("tr", {
142
+ key: tax === null || tax === void 0 ? void 0 : tax.id
143
+ }, /*#__PURE__*/_react.default.createElement("td", null, t(tax === null || tax === void 0 || (_tax$name2 = tax.name) === null || _tax$name2 === void 0 || (_tax$name2 = _tax$name2.toUpperCase()) === null || _tax$name2 === void 0 ? void 0 : _tax$name2.replace(/ /g, '_'), tax === null || tax === void 0 ? void 0 : tax.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business'), /*#__PURE__*/_react.default.createElement("span", null, "(".concat((0, _utils.verifyDecimals)(tax === null || tax === void 0 ? void 0 : tax.rate, parseNumber), "%)")), setOpenTaxModal && /*#__PURE__*/_react.default.createElement(_styles.Exclamation, {
144
+ onClick: function onClick() {
145
+ return setOpenTaxModal({
146
+ open: true,
147
+ data: tax,
148
+ type: 'tax'
149
+ });
150
+ }
151
+ }, /*#__PURE__*/_react.default.createElement(_BsInfoCircle.default, {
152
+ size: "20",
153
+ color: theme.colors.primary
154
+ }))), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((_ref5 = (_tax$summary$tax_afte3 = tax === null || tax === void 0 || (_tax$summary6 = tax.summary) === null || _tax$summary6 === void 0 ? void 0 : _tax$summary6.tax_after_discount) !== null && _tax$summary$tax_afte3 !== void 0 ? _tax$summary$tax_afte3 : tax === null || tax === void 0 || (_tax$summary7 = tax.summary) === null || _tax$summary7 === void 0 ? void 0 : _tax$summary7.tax) !== null && _ref5 !== void 0 ? _ref5 : 0)));
155
+ })), (order === null || order === void 0 || (_order$offers6 = order.offers) === null || _order$offers6 === void 0 ? void 0 : _order$offers6.length) > 0 && (order === null || order === void 0 || (_order$offers7 = order.offers) === null || _order$offers7 === void 0 || (_order$offers7 = _order$offers7.filter(function (offer) {
138
156
  return (offer === null || offer === void 0 ? void 0 : offer.target) === 2;
139
157
  })) === null || _order$offers7 === void 0 ? void 0 : _order$offers7.map(function (offer) {
140
158
  var _offer$name3, _offer$summary3;
@@ -193,6 +193,12 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
193
193
  content: []
194
194
  });
195
195
  };
196
+ var getNamePaymethod = function getNamePaymethod(paymethod) {
197
+ if ((paymethod === null || paymethod === void 0 ? void 0 : paymethod.id) === 132) {
198
+ return t("CREDIT_CARD_".concat(paymethod.gateway.toUpperCase()), "Credit card (".concat(paymethod.name, ")"));
199
+ }
200
+ return t(paymethod.gateway.toUpperCase(), paymethod.name);
201
+ };
196
202
  (0, _react.useEffect)(function () {
197
203
  var _supportedMethods$;
198
204
  if ((supportedMethods === null || supportedMethods === void 0 ? void 0 : supportedMethods.length) === 1 && !paymethodSelected && !popupMethods.includes((_supportedMethods$ = supportedMethods[0]) === null || _supportedMethods$ === void 0 ? void 0 : _supportedMethods$.gateway)) {
@@ -248,7 +254,7 @@ var PaymentOptionsUI = function PaymentOptionsUI(props) {
248
254
  onClick: function onClick() {
249
255
  return handlePaymentMethodClick(paymethod);
250
256
  }
251
- }, /*#__PURE__*/_react.default.createElement("div", null, getPayIcon(paymethod.id)), /*#__PURE__*/_react.default.createElement("p", null, t(paymethod.gateway.toUpperCase(), paymethod.name))));
257
+ }, /*#__PURE__*/_react.default.createElement("div", null, getPayIcon(paymethod.id)), /*#__PURE__*/_react.default.createElement("p", null, getNamePaymethod(paymethod))));
252
258
  }), (paymethodsList.loading || isLoading) && _toConsumableArray(Array(5).keys()).map(function (i) {
253
259
  return /*#__PURE__*/_react.default.createElement(_styles.PayCard, {
254
260
  key: i,
@@ -26,7 +26,7 @@ var TaxInformation = function TaxInformation(props) {
26
26
  var offersHideArray = ['offer_target_2', 'offer_target_3'];
27
27
  var hideProductsSectionOffers = offersHideArray.includes(type);
28
28
  var dataHideArray = ['platform', 'business'];
29
- var hideProductsSectionData = dataHideArray.includes(data.type);
29
+ var hideProductsSectionData = dataHideArray.includes(data.type) || (data === null || data === void 0 ? void 0 : data.target) === 'delivery_fee';
30
30
  var getFilterValidation = function getFilterValidation(product) {
31
31
  var _product$tax, _product$tax2, _product$tax3, _product$fee, _product$fee2, _product$fee3, _data$discounts;
32
32
  return type === 'tax' ? (_product$tax = product.tax) !== null && _product$tax !== void 0 && _product$tax.id ? ((_product$tax2 = product.tax) === null || _product$tax2 === void 0 ? void 0 : _product$tax2.id) === (data === null || data === void 0 ? void 0 : data.id) : ((_product$tax3 = product.tax) === null || _product$tax3 === void 0 ? void 0 : _product$tax3.id) === null && (data === null || data === void 0 ? void 0 : data.id) === null : type === 'fee' ? (_product$fee = product.fee) !== null && _product$fee !== void 0 && _product$fee.id ? ((_product$fee2 = product.fee) === null || _product$fee2 === void 0 ? void 0 : _product$fee2.id) === (data === null || data === void 0 ? void 0 : data.id) : ((_product$fee3 = product.fee) === null || _product$fee3 === void 0 ? void 0 : _product$fee3.id) === null && (data === null || data === void 0 ? void 0 : data.id) === null : Object.keys((_data$discounts = data === null || data === void 0 ? void 0 : data.discounts) !== null && _data$discounts !== void 0 ? _data$discounts : {}).find(function (code) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "10.10.17",
3
+ "version": "10.10.19",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -74,6 +74,9 @@ export const CardFormCustom = (props) => {
74
74
  focused={formState.focus}
75
75
  name={formState.name}
76
76
  number={formState.number}
77
+ locale={{
78
+ valid: t('VALID_THRU', 'Valid thru')
79
+ }}
77
80
  placeholders={{
78
81
  name: t('YOUR_NAME_HERE', 'Your name here')
79
82
  }}
@@ -133,12 +133,12 @@ const CartUI = (props) => {
133
133
  }
134
134
  }
135
135
 
136
- const getIncludedTaxes = () => {
136
+ const getIncludedTaxes = (isDeliveryFee) => {
137
137
  if (cart?.taxes === null) {
138
138
  return cart?.business.tax_type === 1 ? cart?.tax : 0
139
139
  } else {
140
140
  return cart?.taxes.reduce((taxIncluded, tax) => {
141
- return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
141
+ return taxIncluded + (((!isDeliveryFee && tax.type === 1 && tax.target === 'product') || (isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
142
142
  }, 0)
143
143
  }
144
144
  }
@@ -253,7 +253,7 @@ const CartUI = (props) => {
253
253
  }
254
254
 
255
255
  const getIncludedTaxesDiscounts = () => {
256
- return cart?.taxes?.filter(tax => tax?.type === 1)?.reduce((carry, tax) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
256
+ return cart?.taxes?.filter(tax => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry, tax) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
257
257
  }
258
258
 
259
259
  const onRemoveOffer = (id) => {
@@ -450,9 +450,23 @@ const CartUI = (props) => {
450
450
  {orderState?.options?.type === 1 && !hideDeliveryFee && (
451
451
  <tr>
452
452
  <td>{t('DELIVERY_FEE', 'Delivery Fee')}</td>
453
- <td>{parsePrice(cart?.delivery_price_with_discount)}</td>
453
+ <td>{parsePrice(cart?.delivery_price_with_discount + getIncludedTaxes(true))}</td>
454
454
  </tr>
455
455
  )}
456
+ {
457
+ cart?.taxes?.length > 0 && cart?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map(tax => (
458
+ <tr key={tax?.id}>
459
+ <td className='icon'>
460
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
461
+ <span>{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}</span>
462
+ <IconContainer onClick={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
463
+ <BsInfoCircle size='20' color={theme.colors.primary} />
464
+ </IconContainer>
465
+ </td>
466
+ <td>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</td>
467
+ </tr>
468
+ ))
469
+ }
456
470
  {
457
471
  !hideCartDiscount && cart?.offers?.length > 0 && cart?.offers?.filter(offer => offer?.target === 2)?.map(offer => (
458
472
  <tr key={offer.id}>
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { useLanguage } from 'ordering-components-external'
2
+ import { useConfig, useLanguage } from 'ordering-components-external'
3
3
  import { ProfileOptions } from '../../../../../components/UserProfileForm/ProfileOptions'
4
4
  import { OrdersOption } from '../OrdersOption'
5
5
  import { GiftCardOrdersList } from '../GiftCard/GiftCardOrdersList'
@@ -28,6 +28,7 @@ export const MyOrders = (props) => {
28
28
  const [, t] = useLanguage()
29
29
  const history = useHistory()
30
30
  const theme = useTheme()
31
+ const [{ configs }] = useConfig()
31
32
  const layout = theme?.orders?.components?.layout?.type || 'original'
32
33
 
33
34
  const [isEmptyActive, setIsEmptyActive] = useState(false)
@@ -39,12 +40,13 @@ export const MyOrders = (props) => {
39
40
 
40
41
  const hideProductsTab = theme?.orders?.components?.products_tab?.hidden
41
42
  const hideBusinessTab = theme?.orders?.components?.business_tab?.hidden
43
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
42
44
 
43
45
  const MyOrdersMenu = [
44
46
  { key: 'orders', value: t('ORDERS', 'Orders'), disabled: false },
45
47
  { key: 'business', value: t('BUSINESS', 'Business'), disabled: hideBusinessTab },
46
48
  { key: 'products', value: t('PRODUCTS', 'Products'), disabled: hideProductsTab },
47
- { key: 'giftCards', value: t('GIFT_CARD', 'Gift card'), disabled: false }
49
+ { key: 'giftCards', value: t('GIFT_CARD', 'Gift card'), disabled: !isWalletEnabled }
48
50
  ]
49
51
 
50
52
  const notOrderOptions = ['business', 'products', 'professionals']
@@ -34,18 +34,18 @@ export const OrderBillSection = (props) => {
34
34
  }
35
35
  }
36
36
 
37
- const getIncludedTaxes = () => {
37
+ const getIncludedTaxes = (isDeliveryFee) => {
38
38
  if (order?.taxes?.length === 0) {
39
39
  return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
40
40
  } else {
41
41
  return order?.taxes.reduce((taxIncluded, tax) => {
42
- return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
42
+ return taxIncluded + (((!isDeliveryFee && tax.type === 1 && tax.target === 'product') || (isDeliveryFee && tax.type === 1 && tax.target === 'delivery_fee')) ? tax.summary?.tax : 0)
43
43
  }, 0)
44
44
  }
45
45
  }
46
46
 
47
47
  const getIncludedTaxesDiscounts = () => {
48
- return order?.taxes?.filter(tax => tax?.type === 1)?.reduce((carry, tax) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
48
+ return order?.taxes?.filter(tax => (tax?.type === 1 && tax?.target === 'product'))?.reduce((carry, tax) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
49
49
  }
50
50
 
51
51
  return (
@@ -178,9 +178,25 @@ export const OrderBillSection = (props) => {
178
178
  {typeof order?.summary?.delivery_price === 'number' && (
179
179
  <tr>
180
180
  <td>{t('DELIVERY_FEE', theme?.defaultLanguages?.DELIVERY_FEE || 'Delivery Fee')}</td>
181
- <td>{parsePrice(order?.summary?.delivery_price)}</td>
181
+ <td>{parsePrice(order?.summary?.delivery_price + getIncludedTaxes(true))}</td>
182
182
  </tr>
183
183
  )}
184
+ {
185
+ order?.taxes?.length > 0 && order?.taxes?.filter(tax => tax?.type === 2 && tax?.rate !== 0 && tax?.target === 'delivery_fee').map(tax => (
186
+ <tr key={tax?.id}>
187
+ <td>
188
+ {t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
189
+ <span>{`(${verifyDecimals(tax?.rate, parseNumber)}%)`}</span>
190
+ {setOpenTaxModal && (
191
+ <Exclamation onClick={() => setOpenTaxModal({ open: true, data: tax, type: 'tax' })}>
192
+ <BsInfoCircle size='20' color={theme.colors.primary} />
193
+ </Exclamation>
194
+ )}
195
+ </td>
196
+ <td>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</td>
197
+ </tr>
198
+ ))
199
+ }
184
200
  {
185
201
  order?.offers?.length > 0 && order?.offers?.filter(offer => offer?.target === 2)?.map(offer => (
186
202
  <tr key={offer.id}>
@@ -172,6 +172,13 @@ const PaymentOptionsUI = (props) => {
172
172
  })
173
173
  }
174
174
 
175
+ const getNamePaymethod = (paymethod) => {
176
+ if (paymethod?.id === 132) {
177
+ return t(`CREDIT_CARD_${paymethod.gateway.toUpperCase()}`, `Credit card (${paymethod.name})`)
178
+ }
179
+ return t(paymethod.gateway.toUpperCase(), paymethod.name)
180
+ }
181
+
175
182
  useEffect(() => {
176
183
  if (supportedMethods?.length === 1 && !paymethodSelected && !popupMethods.includes(supportedMethods[0]?.gateway)) {
177
184
  handlePaymethodClick && handlePaymethodClick(supportedMethods[0])
@@ -231,13 +238,14 @@ const PaymentOptionsUI = (props) => {
231
238
  {getPayIcon(paymethod.id)}
232
239
  </div>
233
240
  <p>
234
- {t(paymethod.gateway.toUpperCase(), paymethod.name)}
241
+ {getNamePaymethod(paymethod)}
235
242
  </p>
236
243
  </PayCard>
237
244
  )
238
245
  }
239
246
  </React.Fragment>
240
- ))
247
+ )
248
+ )
241
249
  )}
242
250
 
243
251
  {(paymethodsList.loading || isLoading) && (
@@ -16,7 +16,7 @@ export const TaxInformation = (props) => {
16
16
  const offersHideArray = ['offer_target_2', 'offer_target_3']
17
17
  const hideProductsSectionOffers = offersHideArray.includes(type)
18
18
  const dataHideArray = ['platform', 'business']
19
- const hideProductsSectionData = dataHideArray.includes(data.type)
19
+ const hideProductsSectionData = dataHideArray.includes(data.type) || data?.target === 'delivery_fee'
20
20
 
21
21
  const getFilterValidation = (product) => {
22
22
  return (
package/template/app.js CHANGED
@@ -645,7 +645,9 @@ export const App = () => {
645
645
  ? isUserVerifyRequired && !guestCheckoutEnabled
646
646
  ? <Redirect to='/verify' />
647
647
  : (<MyOrders />)
648
- : <Redirect to={singleBusinessConfig.isActive ? `/${singleBusinessConfig.businessSlug}` : '/'} />}
648
+ : queryIntegrationToken && queryIntegrationCode === 'spoonity'
649
+ ? <QueryLoginSpoonity token={queryIntegrationToken} notificationState={oneSignalState} />
650
+ : <Redirect to={singleBusinessConfig.isActive ? `/${singleBusinessConfig.businessSlug}` : '/'} />}
649
651
  </Route>
650
652
  <Route exact path='/profile/addresses'>
651
653
  {auth