ordering-ui-external 2.0.1 → 2.0.2

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.
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.MultiCheckout = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _reactRouterDom = require("react-router-dom");
10
- var _styledComponents = require("styled-components");
11
10
  var _orderingComponentsExternal = require("ordering-components-external");
12
11
  var _libphonenumberJs = _interopRequireDefault(require("libphonenumber-js"));
13
12
  var _NotFoundSource = require("../NotFoundSource");
@@ -42,7 +41,7 @@ var mapConfigs = {
42
41
  }
43
42
  };
44
43
  var MultiCheckoutUI = function MultiCheckoutUI(props) {
45
- var _paymethodSelected$pa, _Object$values, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _theme$header, _theme$header$compone, _theme$header$compone2, _theme$header$compone3, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$multi_busine, _configs$driver_tip_o4, _configs$driver_tip_o5, _configs$google_maps_, _customerState$user, _validationFields$fie9, _validationFields$fie10, _validationFields$fie11, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _openCarts$, _openCarts$2, _configs$multi_busine4, _configs$multi_busine5;
44
+ 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, _configs$google_maps_, _customerState$user, _validationFields$fie9, _validationFields$fie10, _validationFields$fie11, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _openCarts$, _openCarts$2, _configs$multi_busine4, _configs$multi_busine5;
46
45
  var placing = props.placing,
47
46
  isCustomerMode = props.isCustomerMode,
48
47
  openCarts = props.openCarts,
@@ -57,7 +56,6 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
57
56
  cartUuid = props.cartUuid,
58
57
  totalCartsFee = props.totalCartsFee,
59
58
  handleSearchRedirect = props.handleSearchRedirect;
60
- var theme = (0, _styledComponents.useTheme)();
61
59
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
62
60
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
63
61
  t = _useLanguage2[1];
@@ -70,9 +68,6 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
70
68
  var _useCustomer = (0, _orderingComponentsExternal.useCustomer)(),
71
69
  _useCustomer2 = _slicedToArray(_useCustomer, 1),
72
70
  customerState = _useCustomer2[0];
73
- var _useOrderingTheme = (0, _orderingComponentsExternal.useOrderingTheme)(),
74
- _useOrderingTheme2 = _slicedToArray(_useOrderingTheme, 1),
75
- orderingTheme = _useOrderingTheme2[0];
76
71
  var _useValidationFields = (0, _orderingComponentsExternal.useValidationFields)(),
77
72
  _useValidationFields2 = _slicedToArray(_useValidationFields, 1),
78
73
  validationFields = _useValidationFields2[0];
@@ -103,7 +98,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
103
98
  var _cart$products;
104
99
  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);
105
100
  })) || null || [];
106
- var isMultiDriverTips = (orderingTheme === null || orderingTheme === void 0 ? void 0 : (_orderingTheme$theme = orderingTheme.theme) === null || _orderingTheme$theme === void 0 ? void 0 : (_orderingTheme$theme$ = _orderingTheme$theme.header) === null || _orderingTheme$theme$ === void 0 ? void 0 : (_orderingTheme$theme$2 = _orderingTheme$theme$.components) === null || _orderingTheme$theme$2 === void 0 ? void 0 : (_orderingTheme$theme$3 = _orderingTheme$theme$2.layout) === null || _orderingTheme$theme$3 === void 0 ? void 0 : (_orderingTheme$theme$4 = _orderingTheme$theme$3.type) === null || _orderingTheme$theme$4 === void 0 ? void 0 : _orderingTheme$theme$4.toLowerCase()) === 'chew' || (theme === null || theme === void 0 ? void 0 : (_theme$header = theme.header) === null || _theme$header === void 0 ? void 0 : (_theme$header$compone = _theme$header.components) === null || _theme$header$compone === void 0 ? void 0 : (_theme$header$compone2 = _theme$header$compone.layout) === null || _theme$header$compone2 === void 0 ? void 0 : (_theme$header$compone3 = _theme$header$compone2.type) === null || _theme$header$compone3 === void 0 ? void 0 : _theme$header$compone3.toLowerCase()) === 'chew';
101
+ 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';
107
102
  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) || [];
108
103
  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) || [];
109
104
  var handlePlaceOrder = function handlePlaceOrder() {
@@ -222,7 +217,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
222
217
  }, /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
223
218
  isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
224
219
  cart: cart,
225
- isMultiCheckout: isMultiDriverTips,
220
+ isMultiCheckout: true,
226
221
  isProducts: (cart === null || cart === void 0 ? void 0 : (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0,
227
222
  hideDeliveryFee: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine2 = configs.multi_business_checkout_show_combined_delivery_fee) === null || _configs$multi_busine2 === void 0 ? void 0 : _configs$multi_busine2.value) === '1',
228
223
  hideDriverTip: (configs === null || configs === void 0 ? void 0 : (_configs$multi_busine3 = configs.multi_business_checkout_show_combined_driver_tip) === null || _configs$multi_busine3 === void 0 ? void 0 : _configs$multi_busine3.value) === '1'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -1,6 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useHistory } from 'react-router-dom'
3
- import { useTheme } from 'styled-components'
4
3
  import {
5
4
  useLanguage,
6
5
  useUtils,
@@ -9,7 +8,6 @@ import {
9
8
  useSession,
10
9
  useValidationFields,
11
10
  useOrder,
12
- useOrderingTheme,
13
11
  MultiCheckout as MultiCheckoutController
14
12
  } from 'ordering-components-external'
15
13
 
@@ -67,12 +65,10 @@ const MultiCheckoutUI = (props) => {
67
65
  handleSearchRedirect
68
66
  } = props
69
67
 
70
- const theme = useTheme()
71
68
  const [, t] = useLanguage()
72
69
  const [{ configs }] = useConfig()
73
70
  const [{ parsePrice }] = useUtils()
74
71
  const [customerState] = useCustomer()
75
- const [orderingTheme] = useOrderingTheme()
76
72
  const [validationFields] = useValidationFields()
77
73
  const [{ user }] = useSession()
78
74
  const [orderState] = useOrder()
@@ -83,8 +79,7 @@ const MultiCheckoutUI = (props) => {
83
79
  const [alertState, setAlertState] = useState({ open: false, content: [] })
84
80
  const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || (paymethodSelected?.paymethod?.gateway === 'stripe' && !paymethodSelected?.paymethod_data)
85
81
  const walletCarts = (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && cart?.wallets) || null) || []
86
- const isMultiDriverTips = orderingTheme?.theme?.header?.components?.layout?.type?.toLowerCase() === 'chew' ||
87
- theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
82
+ const isMultiDriverTips = configs?.checkout_multi_business_enabled?.value === '1'
88
83
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
89
84
  ? JSON.parse(configs?.driver_tip_options?.value) || []
90
85
  : configs?.driver_tip_options?.value || []
@@ -251,7 +246,7 @@ const MultiCheckoutUI = (props) => {
251
246
  <Cart
252
247
  isCartPending={cart?.status === 2}
253
248
  cart={cart}
254
- isMultiCheckout={isMultiDriverTips}
249
+ isMultiCheckout
255
250
  isProducts={cart?.products?.length || 0}
256
251
  hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
257
252
  hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}