ordering-ui-external 14.1.47 → 14.1.48

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 (16) hide show
  1. package/_bundles/{0.ordering-ui.a574355896c3077ecd50.js → 0.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  2. package/_bundles/{1.ordering-ui.a574355896c3077ecd50.js → 1.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  3. package/_bundles/{2.ordering-ui.a574355896c3077ecd50.js → 2.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  4. package/_bundles/{4.ordering-ui.a574355896c3077ecd50.js → 4.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  5. package/_bundles/{5.ordering-ui.a574355896c3077ecd50.js → 5.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  6. package/_bundles/{6.ordering-ui.a574355896c3077ecd50.js → 6.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  7. package/_bundles/{7.ordering-ui.a574355896c3077ecd50.js → 7.ordering-ui.4754b59ff7216a67c8b5.js} +2 -2
  8. package/_bundles/{8.ordering-ui.a574355896c3077ecd50.js → 8.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  9. package/_bundles/{9.ordering-ui.a574355896c3077ecd50.js → 9.ordering-ui.4754b59ff7216a67c8b5.js} +1 -1
  10. package/_bundles/ordering-ui.4754b59ff7216a67c8b5.js +2 -0
  11. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +20 -30
  12. package/package.json +2 -2
  13. package/src/themes/five/src/components/ProductItemAccordion/index.js +20 -27
  14. package/_bundles/ordering-ui.a574355896c3077ecd50.js +0 -2
  15. /package/_bundles/{7.ordering-ui.a574355896c3077ecd50.js.LICENSE.txt → 7.ordering-ui.4754b59ff7216a67c8b5.js.LICENSE.txt} +0 -0
  16. /package/_bundles/{ordering-ui.a574355896c3077ecd50.js.LICENSE.txt → ordering-ui.4754b59ff7216a67c8b5.js.LICENSE.txt} +0 -0
@@ -15,24 +15,24 @@ var _styledComponents = require("styled-components");
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  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); }
17
17
  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; }
18
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
- 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."); }
20
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
21
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
18
  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; }
24
19
  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; }
25
20
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
27
22
  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); }
23
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
24
+ 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."); }
25
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
26
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
28
28
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
29
  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."); }
30
30
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
31
31
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
32
32
  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; } }
33
33
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
- var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAccordion(props) {
35
- var _theme$viewString, _theme$business_view, _productInfo, _productInfo2, _props$beforeElements, _props$beforeComponen, _product$valid, _theme$images, _theme$images2, _product$calendar_eve, _configs$format_time, _product$calendar_eve2, _configs$format_time2, _toppingsRemoved$remo, _props$afterComponent, _props$afterElements;
34
+ var ProductItemAccordionUI = function ProductItemAccordionUI(props) {
35
+ var _theme$viewString, _theme$business_view, _productInfo$ingredie, _productInfo$options, _props$beforeElements, _props$beforeComponen, _product$valid, _theme$images, _theme$images2, _product$calendar_eve, _configs$format_time, _product$calendar_eve2, _configs$format_time2, _toppingsRemoved$remo, _props$afterComponent, _props$afterElements;
36
36
  var isDisabledEdit = props.isDisabledEdit,
37
37
  isCartPending = props.isCartPending,
38
38
  isCartProduct = props.isCartProduct,
@@ -45,7 +45,8 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
45
45
  isCheckout = props.isCheckout,
46
46
  isStore = props.isStore,
47
47
  isConfirmationPage = props.isConfirmationPage,
48
- toppingsRemoved = props.toppingsRemoved;
48
+ toppingsRemoved = props.toppingsRemoved,
49
+ productInfo = props.productInfo;
49
50
  var theme = (0, _styledComponents.useTheme)();
50
51
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
51
52
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
@@ -81,24 +82,7 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
81
82
  var viewString = isConfirmationPage ? 'confirmation' : isStore ? 'business_view' : 'header';
82
83
  var showProductImage = !(theme !== null && theme !== void 0 && (_theme$viewString = theme[viewString]) !== null && _theme$viewString !== void 0 && (_theme$viewString = _theme$viewString.components) !== null && _theme$viewString !== void 0 && (_theme$viewString = _theme$viewString.cart) !== null && _theme$viewString !== void 0 && (_theme$viewString = _theme$viewString.components) !== null && _theme$viewString !== void 0 && (_theme$viewString = _theme$viewString.products) !== null && _theme$viewString !== void 0 && (_theme$viewString = _theme$viewString.components) !== null && _theme$viewString !== void 0 && (_theme$viewString = _theme$viewString.image) !== null && _theme$viewString !== void 0 && _theme$viewString.hidden);
83
84
  var hideProductDummyLogo = theme === null || theme === void 0 || (_theme$business_view = theme.business_view) === null || _theme$business_view === void 0 || (_theme$business_view = _theme$business_view.components) === null || _theme$business_view === void 0 || (_theme$business_view = _theme$business_view.products) === null || _theme$business_view === void 0 || (_theme$business_view = _theme$business_view.components) === null || _theme$business_view === void 0 || (_theme$business_view = _theme$business_view.product) === null || _theme$business_view === void 0 || (_theme$business_view = _theme$business_view.components) === null || _theme$business_view === void 0 || (_theme$business_view = _theme$business_view.dummy) === null || _theme$business_view === void 0 ? void 0 : _theme$business_view.hidden;
84
- var productInfo = function productInfo() {
85
- if (isCartProduct) {
86
- var _product$ingredients, _product$options;
87
- var ingredients = JSON.parse(JSON.stringify(Object.values((_product$ingredients = product.ingredients) !== null && _product$ingredients !== void 0 ? _product$ingredients : {})));
88
- var options = JSON.parse(JSON.stringify(Object.values((_product$options = product.options) !== null && _product$options !== void 0 ? _product$options : {})));
89
- options = options.map(function (option) {
90
- var _option$suboptions;
91
- option.suboptions = Object.values((_option$suboptions = option.suboptions) !== null && _option$suboptions !== void 0 ? _option$suboptions : {});
92
- return option;
93
- });
94
- return _objectSpread(_objectSpread({}, productInfo), {}, {
95
- ingredients: ingredients,
96
- options: options
97
- });
98
- }
99
- return product;
100
- };
101
- var showArrowIcon = props.showArrowIcon && (((_productInfo = productInfo()) === null || _productInfo === void 0 || (_productInfo = _productInfo.ingredients) === null || _productInfo === void 0 ? void 0 : _productInfo.length) > 0 || ((_productInfo2 = productInfo()) === null || _productInfo2 === void 0 || (_productInfo2 = _productInfo2.options) === null || _productInfo2 === void 0 ? void 0 : _productInfo2.length) > 0 || (product === null || product === void 0 ? void 0 : product.comment));
85
+ var showArrowIcon = props.showArrowIcon && ((productInfo === null || productInfo === void 0 || (_productInfo$ingredie = productInfo.ingredients) === null || _productInfo$ingredie === void 0 ? void 0 : _productInfo$ingredie.length) > 0 || (productInfo === null || productInfo === void 0 || (_productInfo$options = productInfo.options) === null || _productInfo$options === void 0 ? void 0 : _productInfo$options.length) > 0 || (product === null || product === void 0 ? void 0 : product.comment));
102
86
  var toggleAccordion = function toggleAccordion(e) {
103
87
  var _productSelect$curren, _productActionsEdit$c, _productActionsDelete;
104
88
  var isActionsClick = ((_productSelect$curren = productSelect.current) === null || _productSelect$curren === void 0 ? void 0 : _productSelect$curren.contains(e.target)) || ((_productActionsEdit$c = productActionsEdit.current) === null || _productActionsEdit$c === void 0 ? void 0 : _productActionsEdit$c.contains(e.target)) || ((_productActionsDelete = productActionsDelete.current) === null || _productActionsDelete === void 0 ? void 0 : _productActionsDelete.contains(e.target));
@@ -182,7 +166,7 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
182
166
  className: "".concat(setRotate)
183
167
  }), product.valid && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ((product === null || product === void 0 ? void 0 : product.valid) || !isCartProduct) && windowSize.width > 410 && /*#__PURE__*/_react.default.createElement(_styles.ProductPriceSection, null, /*#__PURE__*/_react.default.createElement(_styles.ProductPrice, {
184
168
  className: "prod-price"
185
- }, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(product.total || product.price)), (productInfo().ingredients.length > 0 || productInfo().options.length > 0 || product.comment) && /*#__PURE__*/_react.default.createElement("p", null, /*#__PURE__*/_react.default.createElement(_IosArrowDown.default, {
169
+ }, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(product.total || product.price)), (productInfo.ingredients.length > 0 || productInfo.options.length > 0 || product.comment) && /*#__PURE__*/_react.default.createElement("p", null, /*#__PURE__*/_react.default.createElement(_IosArrowDown.default, {
186
170
  className: "".concat(setRotate)
187
171
  }))), isCartProduct && !isCartPending && /*#__PURE__*/_react.default.createElement(_styles.ProductActions, null, !isDisabledEdit && /*#__PURE__*/_react.default.createElement(_styles.ProductActionsEdit, {
188
172
  ref: productActionsEdit,
@@ -229,14 +213,14 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
229
213
  style: {
230
214
  maxHeight: "".concat(setHeight)
231
215
  }
232
- }, productInfo().ingredients.length > 0 && productInfo().ingredients.some(function (ingredient) {
216
+ }, productInfo.ingredients.length > 0 && productInfo.ingredients.some(function (ingredient) {
233
217
  return !ingredient.selected;
234
- }) && /*#__PURE__*/_react.default.createElement(_styles.ProductOptionsList, null, /*#__PURE__*/_react.default.createElement("p", null, t('INGREDIENTS', 'Ingredients')), productInfo().ingredients.map(function (ingredient) {
218
+ }) && /*#__PURE__*/_react.default.createElement(_styles.ProductOptionsList, null, /*#__PURE__*/_react.default.createElement("p", null, t('INGREDIENTS', 'Ingredients')), productInfo.ingredients.map(function (ingredient) {
235
219
  return !ingredient.selected && /*#__PURE__*/_react.default.createElement("li", {
236
220
  className: "ingredient",
237
221
  key: ingredient.id
238
222
  }, /*#__PURE__*/_react.default.createElement("span", null, t('NO', 'No'), " ", ingredient.name));
239
- })), productInfo().options.length > 0 && /*#__PURE__*/_react.default.createElement(_styles.ProductOptionsList, null, productInfo().options.sort(function (a, b) {
223
+ })), productInfo.options.length > 0 && /*#__PURE__*/_react.default.createElement(_styles.ProductOptionsList, null, productInfo.options.sort(function (a, b) {
240
224
  return a.rank - b.rank;
241
225
  }).map(function (option) {
242
226
  return /*#__PURE__*/_react.default.createElement("li", {
@@ -269,4 +253,10 @@ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAc
269
253
  key: i
270
254
  }, AfterElement);
271
255
  }));
256
+ };
257
+ var ProductItemAccordion = exports.ProductItemAccordion = function ProductItemAccordion(props) {
258
+ var productItemAccordion = _objectSpread(_objectSpread({}, props), {}, {
259
+ UIComponent: ProductItemAccordionUI
260
+ });
261
+ return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ProductItemAccordion, productItemAccordion);
272
262
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "14.1.47",
3
+ "version": "14.1.48",
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.0.40",
91
+ "ordering-components-external": "13.0.42",
92
92
  "payment": "^2.4.6",
93
93
  "polished": "^3.6.6",
94
94
  "react-bootstrap-icons": "^1.7.2",
@@ -4,7 +4,7 @@ import {
4
4
  Pencil,
5
5
  Trash
6
6
  } from 'react-bootstrap-icons'
7
- import { useUtils, useLanguage, useOrder, useConfig } from 'ordering-components-external'
7
+ import { useUtils, useLanguage, useOrder, useConfig, ProductItemAccordion as ProductItemAccordionController } from 'ordering-components-external'
8
8
  import { useWindowSize } from '../../../../../hooks/useWindowSize'
9
9
  import {
10
10
  AccordionSection,
@@ -31,7 +31,7 @@ import {
31
31
  } from './styles'
32
32
  import { useTheme } from 'styled-components'
33
33
 
34
- export const ProductItemAccordion = (props) => {
34
+ const ProductItemAccordionUI = (props) => {
35
35
  const {
36
36
  isDisabledEdit,
37
37
  isCartPending,
@@ -45,7 +45,8 @@ export const ProductItemAccordion = (props) => {
45
45
  isCheckout,
46
46
  isStore,
47
47
  isConfirmationPage,
48
- toppingsRemoved
48
+ toppingsRemoved,
49
+ productInfo
49
50
  } = props
50
51
  const theme = useTheme()
51
52
  const [, t] = useLanguage()
@@ -66,25 +67,7 @@ export const ProductItemAccordion = (props) => {
66
67
  const showProductImage = !theme?.[viewString]?.components?.cart?.components?.products?.components?.image?.hidden
67
68
  const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
68
69
 
69
- const productInfo = () => {
70
- if (isCartProduct) {
71
- const ingredients = JSON.parse(JSON.stringify(Object.values(product.ingredients ?? {})))
72
- let options = JSON.parse(JSON.stringify(Object.values(product.options ?? {})))
73
-
74
- options = options.map(option => {
75
- option.suboptions = Object.values(option.suboptions ?? {})
76
- return option
77
- })
78
- return {
79
- ...productInfo,
80
- ingredients,
81
- options
82
- }
83
- }
84
- return product
85
- }
86
-
87
- const showArrowIcon = props.showArrowIcon && (productInfo()?.ingredients?.length > 0 || productInfo()?.options?.length > 0 || product?.comment)
70
+ const showArrowIcon = props.showArrowIcon && (productInfo?.ingredients?.length > 0 || productInfo?.options?.length > 0 || product?.comment)
88
71
 
89
72
  const toggleAccordion = (e) => {
90
73
  const isActionsClick = productSelect.current?.contains(e.target) || productActionsEdit.current?.contains(e.target) || productActionsDelete.current?.contains(e.target)
@@ -220,7 +203,7 @@ export const ProductItemAccordion = (props) => {
220
203
  <span>
221
204
  {parsePrice(product.total || product.price)}
222
205
  </span>
223
- {(productInfo().ingredients.length > 0 || productInfo().options.length > 0 || product.comment) && (
206
+ {(productInfo.ingredients.length > 0 || productInfo.options.length > 0 || product.comment) && (
224
207
  <p>
225
208
  <IosArrowDown className={`${setRotate}`} />
226
209
  </p>
@@ -305,19 +288,19 @@ export const ProductItemAccordion = (props) => {
305
288
  ref={content}
306
289
  style={{ maxHeight: `${setHeight}` }}
307
290
  >
308
- {productInfo().ingredients.length > 0 && productInfo().ingredients.some(ingredient => !ingredient.selected) && (
291
+ {productInfo.ingredients.length > 0 && productInfo.ingredients.some(ingredient => !ingredient.selected) && (
309
292
  <ProductOptionsList>
310
293
  <p>{t('INGREDIENTS', 'Ingredients')}</p>
311
- {productInfo().ingredients.map(ingredient => !ingredient.selected && (
294
+ {productInfo.ingredients.map(ingredient => !ingredient.selected && (
312
295
  <li className='ingredient' key={ingredient.id}>
313
296
  <span>{t('NO', 'No')} {ingredient.name}</span>
314
297
  </li>
315
298
  ))}
316
299
  </ProductOptionsList>
317
300
  )}
318
- {productInfo().options.length > 0 && (
301
+ {productInfo.options.length > 0 && (
319
302
  <ProductOptionsList>
320
- {productInfo().options.sort((a, b) => a.rank - b.rank).map(option => (
303
+ {productInfo.options.sort((a, b) => a.rank - b.rank).map(option => (
321
304
  <li key={option.id}>
322
305
  <p>{option.name}</p>
323
306
  <ProductOptionsList className='suboption'>
@@ -373,3 +356,13 @@ export const ProductItemAccordion = (props) => {
373
356
  </>
374
357
  )
375
358
  }
359
+
360
+ export const ProductItemAccordion = (props) => {
361
+ const productItemAccordion = {
362
+ ...props,
363
+ UIComponent: ProductItemAccordionUI
364
+ }
365
+ return (
366
+ <ProductItemAccordionController {...productItemAccordion} />
367
+ )
368
+ }