ordering-ui-external 14.1.84 → 14.1.86

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 (20) hide show
  1. package/_bundles/{7.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 7.ordering-ui.1ce4b8d73dd617e1f222.js} +1 -1
  2. package/_bundles/ordering-ui.1ce4b8d73dd617e1f222.js +2 -0
  3. package/_modules/components/UpsellingPage/index.js +4 -1
  4. package/_modules/themes/five/src/components/ProductForm/index.js +18 -15
  5. package/_modules/themes/five/src/components/UpsellingPage/index.js +18 -10
  6. package/package.json +2 -2
  7. package/src/components/UpsellingPage/index.js +3 -1
  8. package/src/themes/five/src/components/ProductForm/index.js +5 -5
  9. package/src/themes/five/src/components/UpsellingPage/index.js +8 -4
  10. package/_bundles/ordering-ui.fe49d7d5f6a41ca2fd3f.js +0 -2
  11. /package/_bundles/{0.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 0.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  12. /package/_bundles/{1.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 1.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  13. /package/_bundles/{2.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 2.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  14. /package/_bundles/{4.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 4.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  15. /package/_bundles/{5.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 5.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  16. /package/_bundles/{6.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 6.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  17. /package/_bundles/{7.ordering-ui.fe49d7d5f6a41ca2fd3f.js.LICENSE.txt → 7.ordering-ui.1ce4b8d73dd617e1f222.js.LICENSE.txt} +0 -0
  18. /package/_bundles/{8.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 8.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  19. /package/_bundles/{9.ordering-ui.fe49d7d5f6a41ca2fd3f.js → 9.ordering-ui.1ce4b8d73dd617e1f222.js} +0 -0
  20. /package/_bundles/{ordering-ui.fe49d7d5f6a41ca2fd3f.js.LICENSE.txt → ordering-ui.1ce4b8d73dd617e1f222.js.LICENSE.txt} +0 -0
@@ -148,8 +148,11 @@ var UpsellingPageUI = function UpsellingPageUI(props) {
148
148
  })));
149
149
  };
150
150
  var UpsellingPage = exports.UpsellingPage = function UpsellingPage(props) {
151
+ var _JSON$parse;
152
+ var useSuggestiveUpselling = (_JSON$parse = JSON.parse(window.localStorage.getItem('suggestive-upselling'))) !== null && _JSON$parse !== void 0 ? _JSON$parse : false;
151
153
  var UpsellingPageProps = _objectSpread(_objectSpread({}, props), {}, {
152
- UIComponent: UpsellingPageUI
154
+ UIComponent: UpsellingPageUI,
155
+ useSuggestiveUpselling: useSuggestiveUpselling
153
156
  });
154
157
  return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.UpsellingPage, UpsellingPageProps);
155
158
  };
@@ -55,7 +55,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
55
55
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
56
56
  _swiper.default.use([_swiper.Navigation, _swiper.Thumbs]);
57
57
  var ProductOptionsUI = function ProductOptionsUI(props) {
58
- var _configs$unaddressed_, _configs$guest_checko, _orderState$options, _configs$allowed_orde, _orderState$options2, _theme$business_view, _theme$business_view2, _theme$business_view3, _theme$defaultLanguag, _product$tags, _product$ingredients2, _product$extras, _product$ingredients3, _product$ingredients4, _product$ingredients5, _product$extras2, _theme$defaultLanguag2, _theme$defaultLanguag3, _props$afterMidElemen, _props$afterMidCompon, _orderState$options3, _orderState$options4, _orderState$options5, _orderState$options6, _theme$defaultLanguag4, _theme$defaultLanguag5, _theme$defaultLanguag6, _orderState$options7, _orderState$options8, _theme$defaultLanguag7, _orderState$options9, _theme$defaultLanguag8, _theme$defaultLanguag9, _theme$defaultLanguag10, _theme$defaultLanguag11, _theme$defaultLanguag12, _theme$defaultLanguag13, _error$;
58
+ var _configs$unaddressed_, _configs$guest_checko, _orderState$options, _configs$allowed_orde, _orderState$options2, _theme$business_view, _theme$business_view2, _theme$business_view3, _theme$defaultLanguag, _product$tags, _product$ingredients2, _product$extras3, _product$ingredients3, _product$extras4, _product$ingredients4, _product$ingredients5, _product$extras5, _theme$defaultLanguag2, _theme$defaultLanguag3, _props$afterMidElemen, _props$afterMidCompon, _orderState$options3, _orderState$options4, _orderState$options5, _orderState$options6, _theme$defaultLanguag4, _theme$defaultLanguag5, _theme$defaultLanguag6, _orderState$options7, _orderState$options8, _theme$defaultLanguag7, _orderState$options9, _theme$defaultLanguag8, _theme$defaultLanguag9, _theme$defaultLanguag10, _theme$defaultLanguag11, _theme$defaultLanguag12, _theme$defaultLanguag13, _error$;
59
59
  var businessSlug = props.businessSlug,
60
60
  editMode = props.editMode,
61
61
  isSoldOut = props.isSoldOut,
@@ -309,17 +309,19 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
309
309
  (0, _react.useEffect)(function () {
310
310
  var scrollElement = document.querySelector('.popup-dialog');
311
311
  var handleScroll = function handleScroll() {
312
+ var _product$extras;
312
313
  var extraHeight = 60;
313
- if ((product === null || product === void 0 ? void 0 : product.ingredients.length) > 0 || (product === null || product === void 0 ? void 0 : product.extras.length) > 0) {
314
- var _product$ingredients;
314
+ if ((product === null || product === void 0 ? void 0 : product.ingredients.length) > 0 || (product === null || product === void 0 || (_product$extras = product.extras) === null || _product$extras === void 0 ? void 0 : _product$extras.length) > 0) {
315
+ var _product$ingredients, _product$extras2;
315
316
  var menuList = [];
316
317
  if ((product === null || product === void 0 || (_product$ingredients = product.ingredients) === null || _product$ingredients === void 0 ? void 0 : _product$ingredients.length) > 0) {
317
318
  menuList.push('ingredients');
318
319
  }
319
- ((product === null || product === void 0 ? void 0 : product.extras.length) > 0 && (product === null || product === void 0 ? void 0 : product.extras) || []).sort(function (a, b) {
320
+ ((product === null || product === void 0 || (_product$extras2 = product.extras) === null || _product$extras2 === void 0 ? void 0 : _product$extras2.length) > 0 && (product === null || product === void 0 ? void 0 : product.extras) || []).sort(function (a, b) {
320
321
  return a.rank - b.rank;
321
322
  }).forEach(function (extra) {
322
- ((extra === null || extra === void 0 ? void 0 : extra.options.length) > 0 && (extra === null || extra === void 0 ? void 0 : extra.options) || []).sort(function (a, b) {
323
+ var _extra$options;
324
+ ((extra === null || extra === void 0 || (_extra$options = extra.options) === null || _extra$options === void 0 ? void 0 : _extra$options.length) > 0 && (extra === null || extra === void 0 ? void 0 : extra.options) || []).sort(function (a, b) {
323
325
  return a.rank - b.rank;
324
326
  }).forEach(function (option) {
325
327
  showOption(option) && menuList.push("id_".concat(option === null || option === void 0 ? void 0 : option.id));
@@ -567,7 +569,7 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
567
569
  src: optimizeImage((tag === null || tag === void 0 ? void 0 : tag.image) || ((_theme$images2 = theme.images) === null || _theme$images2 === void 0 || (_theme$images2 = _theme$images2.dummies) === null || _theme$images2 === void 0 ? void 0 : _theme$images2.product), 'h_40,c_limit'),
568
570
  alt: ""
569
571
  }), /*#__PURE__*/_react.default.createElement("span", null, tag.name));
570
- })), /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement(_styles.ProductEdition, null, ((product === null || product === void 0 || (_product$ingredients2 = product.ingredients) === null || _product$ingredients2 === void 0 ? void 0 : _product$ingredients2.length) > 0 || (product === null || product === void 0 || (_product$extras = product.extras) === null || _product$extras === void 0 ? void 0 : _product$extras.length) > 0) && /*#__PURE__*/_react.default.createElement(_styles.ProductTabContainer, {
572
+ })), /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement(_styles.ProductEdition, null, ((product === null || product === void 0 || (_product$ingredients2 = product.ingredients) === null || _product$ingredients2 === void 0 ? void 0 : _product$ingredients2.length) > 0 || (product === null || product === void 0 || (_product$extras3 = product.extras) === null || _product$extras3 === void 0 ? void 0 : _product$extras3.length) > 0) && /*#__PURE__*/_react.default.createElement(_styles.ProductTabContainer, {
571
573
  id: "all"
572
574
  }, /*#__PURE__*/_react.default.createElement(_Tabs.Tabs, null, /*#__PURE__*/_react.default.createElement(_AutoScroll.AutoScroll, {
573
575
  scrollId: "optionList"
@@ -579,12 +581,12 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
579
581
  return handleChangeTabValue('ingredients');
580
582
  },
581
583
  borderBottom: true
582
- }, t('INGREDIENTS', 'ingredients')), product === null || product === void 0 ? void 0 : product.extras.sort(function (a, b) {
583
- return a.rank - b.rank;
584
+ }, t('INGREDIENTS', 'ingredients')), product === null || product === void 0 || (_product$extras4 = product.extras) === null || _product$extras4 === void 0 ? void 0 : _product$extras4.sort(function (a, b) {
585
+ return (a === null || a === void 0 ? void 0 : a.rank) - (b === null || b === void 0 ? void 0 : b.rank);
584
586
  }).map(function (extra) {
585
- var _extra$options;
586
- return (_extra$options = extra.options) === null || _extra$options === void 0 ? void 0 : _extra$options.sort(function (a, b) {
587
- return a.rank - b.rank;
587
+ var _extra$options2;
588
+ return extra === null || extra === void 0 || (_extra$options2 = extra.options) === null || _extra$options2 === void 0 ? void 0 : _extra$options2.sort(function (a, b) {
589
+ return (a === null || a === void 0 ? void 0 : a.rank) - (b === null || b === void 0 ? void 0 : b.rank);
588
590
  }).map(function (option) {
589
591
  return showOption(option) && /*#__PURE__*/_react.default.createElement(_Tabs.Tab, {
590
592
  key: option === null || option === void 0 ? void 0 : option.id,
@@ -608,11 +610,12 @@ var ProductOptionsUI = function ProductOptionsUI(props) {
608
610
  onChange: handleChangeIngredientState,
609
611
  isSoldOut: isSoldOut
610
612
  });
611
- }))), /*#__PURE__*/_react.default.createElement("div", null, product === null || product === void 0 || (_product$extras2 = product.extras) === null || _product$extras2 === void 0 ? void 0 : _product$extras2.sort(function (a, b) {
612
- return a.rank - b.rank;
613
+ }))), /*#__PURE__*/_react.default.createElement("div", null, product === null || product === void 0 || (_product$extras5 = product.extras) === null || _product$extras5 === void 0 ? void 0 : _product$extras5.sort(function (a, b) {
614
+ return (a === null || a === void 0 ? void 0 : a.rank) - (b === null || b === void 0 ? void 0 : b.rank);
613
615
  }).map(function (extra) {
614
- return extra.options.sort(function (a, b) {
615
- return a.rank - b.rank;
616
+ var _extra$options3;
617
+ return extra === null || extra === void 0 || (_extra$options3 = extra.options) === null || _extra$options3 === void 0 ? void 0 : _extra$options3.sort(function (a, b) {
618
+ return (a === null || a === void 0 ? void 0 : a.rank) - (b === null || b === void 0 ? void 0 : b.rank);
616
619
  }).map(function (option) {
617
620
  var currentState = productCart.options["id:".concat(option === null || option === void 0 ? void 0 : option.id)] || {};
618
621
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
@@ -18,16 +18,16 @@ var _AutoScroll = require("../AutoScroll");
18
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
24
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
21
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
27
22
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
28
23
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
29
24
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
30
25
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
26
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
28
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
29
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
30
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
31
31
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
32
32
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
33
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -35,14 +35,15 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
35
35
  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; } }
36
36
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
37
37
  var UpsellingPageUI = function UpsellingPageUI(props) {
38
- var _theme$business_view, _upsellingProducts$pr4;
38
+ var _theme$business_view, _upsellingProducts$pr4, _actualProduct$api;
39
39
  var upsellingProducts = props.upsellingProducts,
40
40
  handleUpsellingPage = props.handleUpsellingPage,
41
41
  openUpselling = props.openUpselling,
42
42
  canOpenUpselling = props.canOpenUpselling,
43
43
  setCanOpenUpselling = props.setCanOpenUpselling,
44
44
  business = props.business,
45
- isCustomMode = props.isCustomMode;
45
+ isCustomMode = props.isCustomMode,
46
+ businessId = props.businessId;
46
47
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
47
48
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
48
49
  t = _useLanguage2[1];
@@ -77,7 +78,11 @@ var UpsellingPageUI = function UpsellingPageUI(props) {
77
78
  if ((upsellingProducts === null || upsellingProducts === void 0 ? void 0 : upsellingProducts.products.length) > 0) setShowUpSelling(true);else setShowUpSelling(false);
78
79
  }, [upsellingProducts === null || upsellingProducts === void 0 ? void 0 : upsellingProducts.products.length]);
79
80
  var handleFormProduct = function handleFormProduct(product) {
80
- setActualProduct(product);
81
+ setActualProduct(_objectSpread(_objectSpread({}, product), {}, {
82
+ api: _objectSpread(_objectSpread({}, product === null || product === void 0 ? void 0 : product.api), {}, {
83
+ businessId: businessId
84
+ })
85
+ }));
81
86
  setModalIsOpen(true);
82
87
  };
83
88
  var handleSaveProduct = function handleSaveProduct() {
@@ -185,7 +190,7 @@ var UpsellingPageUI = function UpsellingPageUI(props) {
185
190
  }, actualProduct && /*#__PURE__*/_react.default.createElement(_ProductForm.ProductForm, {
186
191
  useKioskApp: props.useKioskApp,
187
192
  product: actualProduct,
188
- businessId: actualProduct.api.businessId,
193
+ businessId: actualProduct === null || actualProduct === void 0 || (_actualProduct$api = actualProduct.api) === null || _actualProduct$api === void 0 ? void 0 : _actualProduct$api.businessId,
189
194
  businessSlug: business.slug,
190
195
  onSave: function onSave() {
191
196
  return handleSaveProduct();
@@ -193,8 +198,11 @@ var UpsellingPageUI = function UpsellingPageUI(props) {
193
198
  })));
194
199
  };
195
200
  var UpsellingPage = exports.UpsellingPage = function UpsellingPage(props) {
201
+ var _JSON$parse;
202
+ var useSuggestiveUpselling = (_JSON$parse = JSON.parse(window.localStorage.getItem('suggestive-upselling'))) !== null && _JSON$parse !== void 0 ? _JSON$parse : false;
196
203
  var UpsellingPageProps = _objectSpread(_objectSpread({}, props), {}, {
197
- UIComponent: UpsellingPageUI
204
+ UIComponent: UpsellingPageUI,
205
+ useSuggestiveUpselling: useSuggestiveUpselling
198
206
  });
199
207
  return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.UpsellingPage, UpsellingPageProps);
200
208
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "14.1.84",
3
+ "version": "14.1.86",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -88,7 +88,7 @@
88
88
  "lodash": "^4.17.19",
89
89
  "moment": "^2.29.4",
90
90
  "nanoid": "^4.0.0",
91
- "ordering-components-external": "13.2.17",
91
+ "ordering-components-external": "13.2.20",
92
92
  "payment": "^2.4.6",
93
93
  "polished": "^3.6.6",
94
94
  "react-bootstrap-icons": "^1.7.2",
@@ -141,9 +141,11 @@ const UpsellingPageUI = (props) => {
141
141
  }
142
142
 
143
143
  export const UpsellingPage = (props) => {
144
+ const useSuggestiveUpselling = JSON.parse(window.localStorage.getItem('suggestive-upselling')) ?? false
144
145
  const UpsellingPageProps = {
145
146
  ...props,
146
- UIComponent: UpsellingPageUI
147
+ UIComponent: UpsellingPageUI,
148
+ useSuggestiveUpselling
147
149
  }
148
150
 
149
151
  return <UpsellingPageController {...UpsellingPageProps} />
@@ -289,13 +289,13 @@ const ProductOptionsUI = (props) => {
289
289
  const scrollElement = document.querySelector('.popup-dialog')
290
290
  const handleScroll = () => {
291
291
  const extraHeight = 60
292
- if (product?.ingredients.length > 0 || product?.extras.length > 0) {
292
+ if (product?.ingredients.length > 0 || product?.extras?.length > 0) {
293
293
  const menuList = []
294
294
  if (product?.ingredients?.length > 0) {
295
295
  menuList.push('ingredients')
296
296
  }
297
- ((product?.extras.length > 0 && product?.extras) || []).sort((a, b) => a.rank - b.rank).forEach(extra => {
298
- ((extra?.options.length > 0 && extra?.options) || []).sort((a, b) => a.rank - b.rank).forEach(option => {
297
+ ((product?.extras?.length > 0 && product?.extras) || []).sort((a, b) => a.rank - b.rank).forEach(extra => {
298
+ ((extra?.options?.length > 0 && extra?.options) || []).sort((a, b) => a.rank - b.rank).forEach(option => {
299
299
  showOption(option) && menuList.push(`id_${option?.id}`)
300
300
  })
301
301
  })
@@ -604,7 +604,7 @@ const ProductOptionsUI = (props) => {
604
604
  )
605
605
  }
606
606
  {
607
- product?.extras.sort((a, b) => a.rank - b.rank).map(extra => extra.options?.sort((a, b) => a.rank - b.rank).map(option => {
607
+ product?.extras?.sort((a, b) => a?.rank - b?.rank).map(extra => extra?.options?.sort((a, b) => a?.rank - b?.rank).map(option => {
608
608
  return (
609
609
  showOption(option) && (
610
610
  <Tab
@@ -643,7 +643,7 @@ const ProductOptionsUI = (props) => {
643
643
  )}
644
644
  <div>
645
645
  {
646
- product?.extras?.sort((a, b) => a.rank - b.rank).map(extra => extra.options.sort((a, b) => a.rank - b.rank).map(option => {
646
+ product?.extras?.sort((a, b) => a?.rank - b?.rank).map(extra => extra?.options?.sort((a, b) => a?.rank - b?.rank).map(option => {
647
647
  const currentState = productCart.options[`id:${option?.id}`] || {}
648
648
  return (
649
649
  <React.Fragment key={option?.id}>
@@ -32,7 +32,8 @@ const UpsellingPageUI = (props) => {
32
32
  canOpenUpselling,
33
33
  setCanOpenUpselling,
34
34
  business,
35
- isCustomMode
35
+ isCustomMode,
36
+ businessId
36
37
  } = props
37
38
 
38
39
  const [, t] = useLanguage()
@@ -61,7 +62,7 @@ const UpsellingPageUI = (props) => {
61
62
  }, [upsellingProducts?.products.length])
62
63
 
63
64
  const handleFormProduct = (product) => {
64
- setActualProduct(product)
65
+ setActualProduct({ ...product, api: { ...product?.api, businessId } })
65
66
  setModalIsOpen(true)
66
67
  }
67
68
 
@@ -210,7 +211,7 @@ const UpsellingPageUI = (props) => {
210
211
  <ProductForm
211
212
  useKioskApp={props.useKioskApp}
212
213
  product={actualProduct}
213
- businessId={actualProduct.api.businessId}
214
+ businessId={actualProduct?.api?.businessId}
214
215
  businessSlug={business.slug}
215
216
  onSave={() => handleSaveProduct()}
216
217
  />
@@ -221,9 +222,12 @@ const UpsellingPageUI = (props) => {
221
222
  }
222
223
 
223
224
  export const UpsellingPage = (props) => {
225
+ const useSuggestiveUpselling = JSON.parse(window.localStorage.getItem('suggestive-upselling')) ?? false
226
+
224
227
  const UpsellingPageProps = {
225
228
  ...props,
226
- UIComponent: UpsellingPageUI
229
+ UIComponent: UpsellingPageUI,
230
+ useSuggestiveUpselling
227
231
  }
228
232
 
229
233
  return <UpsellingPageController {...UpsellingPageProps} />