ordering-ui-external 2.7.0 → 2.7.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.
@@ -31,7 +31,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
31
31
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
32
32
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
33
  var BusinessReviewsUI = function BusinessReviewsUI(props) {
34
- var _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _orderingTheme$theme$5, _orderingTheme$theme2, _orderingTheme$theme3, _orderingTheme$theme4, _orderingTheme$theme5, _orderingTheme$theme6, _orderingTheme$theme7, _orderingTheme$theme8, _orderingTheme$theme9, _orderingTheme$theme10, _orderingTheme$theme11, _orderingTheme$theme12, _orderingTheme$theme13, _orderingTheme$theme14, _orderingTheme$theme15, _orderingTheme$theme16, _orderingTheme$theme17, _orderingTheme$theme18, _orderingTheme$theme19, _props$beforeElements, _props$beforeComponen, _theme$images, _theme$images$general, _props$afterComponent, _props$afterElements;
34
+ var _theme$business_view, _theme$business_view$, _theme$business_view$2, _theme$business_view$3, _theme$business_view$4, _theme$business_view2, _theme$business_view3, _theme$business_view4, _theme$business_view5, _theme$business_view6, _theme$business_view7, _theme$business_view8, _theme$business_view9, _theme$business_view10, _theme$business_view11, _theme$business_view12, _theme$business_view13, _theme$business_view14, _theme$business_view15, _theme$business_view16, _props$beforeElements, _props$beforeComponen, _theme$images, _theme$images$general, _props$afterComponent, _props$afterElements;
35
35
  var stars = props.stars,
36
36
  reviewsList = props.reviewsList,
37
37
  handleClickOption = props.handleClickOption,
@@ -42,19 +42,16 @@ var BusinessReviewsUI = function BusinessReviewsUI(props) {
42
42
  var _useTheme = (0, _ThemeContext.useTheme)(),
43
43
  _useTheme2 = _slicedToArray(_useTheme, 1),
44
44
  theme = _useTheme2[0];
45
- var _useOrderingTheme = (0, _orderingComponentsExternal.useOrderingTheme)(),
46
- _useOrderingTheme2 = _slicedToArray(_useOrderingTheme, 1),
47
- orderingTheme = _useOrderingTheme2[0];
48
45
  var handleOnChange = function handleOnChange(evt) {
49
46
  if (evt.target.value) onChangeReview(evt.target.value);else onChangeReview('');
50
47
  };
51
48
  var handleClickRaiting = function handleClickRaiting(raiting) {
52
49
  if (raiting) handleClickOption(raiting);
53
50
  };
54
- var showRanking = !(orderingTheme !== null && orderingTheme !== void 0 && (_orderingTheme$theme = orderingTheme.theme) !== null && _orderingTheme$theme !== void 0 && (_orderingTheme$theme$ = _orderingTheme$theme.business_view) !== null && _orderingTheme$theme$ !== void 0 && (_orderingTheme$theme$2 = _orderingTheme$theme$.components) !== null && _orderingTheme$theme$2 !== void 0 && (_orderingTheme$theme$3 = _orderingTheme$theme$2.review) !== null && _orderingTheme$theme$3 !== void 0 && (_orderingTheme$theme$4 = _orderingTheme$theme$3.components) !== null && _orderingTheme$theme$4 !== void 0 && (_orderingTheme$theme$5 = _orderingTheme$theme$4.ranking) !== null && _orderingTheme$theme$5 !== void 0 && _orderingTheme$theme$5.hidden);
55
- var showReviewDate = !(orderingTheme !== null && orderingTheme !== void 0 && (_orderingTheme$theme2 = orderingTheme.theme) !== null && _orderingTheme$theme2 !== void 0 && (_orderingTheme$theme3 = _orderingTheme$theme2.business_view) !== null && _orderingTheme$theme3 !== void 0 && (_orderingTheme$theme4 = _orderingTheme$theme3.components) !== null && _orderingTheme$theme4 !== void 0 && (_orderingTheme$theme5 = _orderingTheme$theme4.review) !== null && _orderingTheme$theme5 !== void 0 && (_orderingTheme$theme6 = _orderingTheme$theme5.components) !== null && _orderingTheme$theme6 !== void 0 && (_orderingTheme$theme7 = _orderingTheme$theme6.review_date) !== null && _orderingTheme$theme7 !== void 0 && _orderingTheme$theme7.hidden);
56
- var showCustomerComments = !(orderingTheme !== null && orderingTheme !== void 0 && (_orderingTheme$theme8 = orderingTheme.theme) !== null && _orderingTheme$theme8 !== void 0 && (_orderingTheme$theme9 = _orderingTheme$theme8.business_view) !== null && _orderingTheme$theme9 !== void 0 && (_orderingTheme$theme10 = _orderingTheme$theme9.components) !== null && _orderingTheme$theme10 !== void 0 && (_orderingTheme$theme11 = _orderingTheme$theme10.review) !== null && _orderingTheme$theme11 !== void 0 && (_orderingTheme$theme12 = _orderingTheme$theme11.components) !== null && _orderingTheme$theme12 !== void 0 && (_orderingTheme$theme13 = _orderingTheme$theme12.customer_comments) !== null && _orderingTheme$theme13 !== void 0 && _orderingTheme$theme13.hidden);
57
- var showSearch = !(orderingTheme !== null && orderingTheme !== void 0 && (_orderingTheme$theme14 = orderingTheme.theme) !== null && _orderingTheme$theme14 !== void 0 && (_orderingTheme$theme15 = _orderingTheme$theme14.business_view) !== null && _orderingTheme$theme15 !== void 0 && (_orderingTheme$theme16 = _orderingTheme$theme15.components) !== null && _orderingTheme$theme16 !== void 0 && (_orderingTheme$theme17 = _orderingTheme$theme16.review) !== null && _orderingTheme$theme17 !== void 0 && (_orderingTheme$theme18 = _orderingTheme$theme17.components) !== null && _orderingTheme$theme18 !== void 0 && (_orderingTheme$theme19 = _orderingTheme$theme18.search) !== null && _orderingTheme$theme19 !== void 0 && _orderingTheme$theme19.hidden);
51
+ var showRanking = !(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$2 = _theme$business_view$.review) !== null && _theme$business_view$2 !== void 0 && (_theme$business_view$3 = _theme$business_view$2.components) !== null && _theme$business_view$3 !== void 0 && (_theme$business_view$4 = _theme$business_view$3.ranking) !== null && _theme$business_view$4 !== void 0 && _theme$business_view$4.hidden);
52
+ var showReviewDate = !(theme !== null && theme !== void 0 && (_theme$business_view2 = theme.business_view) !== null && _theme$business_view2 !== void 0 && (_theme$business_view3 = _theme$business_view2.components) !== null && _theme$business_view3 !== void 0 && (_theme$business_view4 = _theme$business_view3.review) !== null && _theme$business_view4 !== void 0 && (_theme$business_view5 = _theme$business_view4.components) !== null && _theme$business_view5 !== void 0 && (_theme$business_view6 = _theme$business_view5.review_date) !== null && _theme$business_view6 !== void 0 && _theme$business_view6.hidden);
53
+ var showCustomerComments = !(theme !== null && theme !== void 0 && (_theme$business_view7 = theme.business_view) !== null && _theme$business_view7 !== void 0 && (_theme$business_view8 = _theme$business_view7.components) !== null && _theme$business_view8 !== void 0 && (_theme$business_view9 = _theme$business_view8.review) !== null && _theme$business_view9 !== void 0 && (_theme$business_view10 = _theme$business_view9.components) !== null && _theme$business_view10 !== void 0 && (_theme$business_view11 = _theme$business_view10.customer_comments) !== null && _theme$business_view11 !== void 0 && _theme$business_view11.hidden);
54
+ var showSearch = !(theme !== null && theme !== void 0 && (_theme$business_view12 = theme.business_view) !== null && _theme$business_view12 !== void 0 && (_theme$business_view13 = _theme$business_view12.components) !== null && _theme$business_view13 !== void 0 && (_theme$business_view14 = _theme$business_view13.review) !== null && _theme$business_view14 !== void 0 && (_theme$business_view15 = _theme$business_view14.components) !== null && _theme$business_view15 !== void 0 && (_theme$business_view16 = _theme$business_view15.search) !== null && _theme$business_view16 !== void 0 && _theme$business_view16.hidden);
58
55
  var hideElement = !(!showReviewDate && !showCustomerComments);
59
56
  var reviewPoints = [1, 2, 3, 4, 5];
60
57
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (_props$beforeElements = props.beforeElements) === null || _props$beforeElements === void 0 ? void 0 : _props$beforeElements.map(function (BeforeElement, i) {
@@ -237,7 +237,9 @@ var ProductItemAccordion = function ProductItemAccordion(props) {
237
237
  className: "ingredient",
238
238
  key: ingredient.id
239
239
  }, /*#__PURE__*/_react.default.createElement("span", null, t('NO', 'No'), " ", ingredient.name));
240
- })), productInfo().options.length > 0 && /*#__PURE__*/_react.default.createElement(_styles.ProductOptionsList, null, productInfo().options.map(function (option) {
240
+ })), productInfo().options.length > 0 && /*#__PURE__*/_react.default.createElement(_styles.ProductOptionsList, null, productInfo().options.sort(function (a, b) {
241
+ return a.rank - b.rank;
242
+ }).map(function (option) {
241
243
  return /*#__PURE__*/_react.default.createElement("li", {
242
244
  key: option.id
243
245
  }, /*#__PURE__*/_react.default.createElement("p", null, option.name), /*#__PURE__*/_react.default.createElement(_styles.ProductOptionsList, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import Skeleton from 'react-loading-skeleton'
3
- import { BusinessReviews as BusinessReviewController, useLanguage, useOrderingTheme } from 'ordering-components-external'
3
+ import { BusinessReviews as BusinessReviewController, useLanguage } from 'ordering-components-external'
4
4
  import { useTheme } from '../../../../../contexts/ThemeContext'
5
5
  import moment from 'moment'
6
6
 
@@ -30,7 +30,6 @@ export const BusinessReviewsUI = (props) => {
30
30
  const { stars, reviewsList, handleClickOption, onChangeReview } = props
31
31
  const [, t] = useLanguage()
32
32
  const [theme] = useTheme()
33
- const [orderingTheme] = useOrderingTheme()
34
33
  const handleOnChange = (evt) => {
35
34
  if (evt.target.value) onChangeReview(evt.target.value)
36
35
  else onChangeReview('')
@@ -39,10 +38,10 @@ export const BusinessReviewsUI = (props) => {
39
38
  if (raiting) handleClickOption(raiting)
40
39
  }
41
40
 
42
- const showRanking = !orderingTheme?.theme?.business_view?.components?.review?.components?.ranking?.hidden
43
- const showReviewDate = !orderingTheme?.theme?.business_view?.components?.review?.components?.review_date?.hidden
44
- const showCustomerComments = !orderingTheme?.theme?.business_view?.components?.review?.components?.customer_comments?.hidden
45
- const showSearch = !orderingTheme?.theme?.business_view?.components?.review?.components?.search?.hidden
41
+ const showRanking = !theme?.business_view?.components?.review?.components?.ranking?.hidden
42
+ const showReviewDate = !theme?.business_view?.components?.review?.components?.review_date?.hidden
43
+ const showCustomerComments = !theme?.business_view?.components?.review?.components?.customer_comments?.hidden
44
+ const showSearch = !theme?.business_view?.components?.review?.components?.search?.hidden
46
45
  const hideElement = !(!showReviewDate && !showCustomerComments)
47
46
 
48
47
  const reviewPoints = [1, 2, 3, 4, 5]
@@ -316,7 +316,7 @@ export const ProductItemAccordion = (props) => {
316
316
  )}
317
317
  {productInfo().options.length > 0 && (
318
318
  <ProductOptionsList>
319
- {productInfo().options.map(option => (
319
+ {productInfo().options.sort((a, b) => a.rank - b.rank).map(option => (
320
320
  <li key={option.id}>
321
321
  <p>{option.name}</p>
322
322
  <ProductOptionsList className='suboption'>