ordering-ui-external 14.1.3 → 14.1.4

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.
@@ -200,7 +200,7 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
200
200
  })))), !(category !== null && category !== void 0 && category.id) && categories.filter(function (category) {
201
201
  return (category === null || category === void 0 ? void 0 : category.id) !== null;
202
202
  }).map(function (category, i, _categories) {
203
- var _categoryState$produc5, _categoryState$produc6, _categoryState$produc7, _categoryState$produc8, _category$description, _category$description2, _category$subcategori4, _category$subcategori5, _category$ribbon, _category$ribbon2, _category$ribbon3, _category$ribbon4, _category$ribbon5, _headerRef$current2, _category$description3, _category$subcategori6, _category$subcategori7, _products$filter, _category$subcategori8, _category$subcategori9;
203
+ var _categoryState$produc5, _categoryState$produc6, _categoryState$produc7, _categoryState$produc8, _category$description, _category$description2, _category$subcategori4, _category$subcategori5, _category$ribbon, _category$ribbon2, _category$ribbon3, _category$ribbon4, _category$ribbon5, _headerRef$current2, _category$description3, _category$subcategori6, _category$subcategori7, _products$sort$filter, _category$subcategori8, _category$subcategori9;
204
204
  var _products = !isUseParentCategory ? (_categoryState$produc5 = categoryState === null || categoryState === void 0 || (_categoryState$produc6 = categoryState.products) === null || _categoryState$produc6 === void 0 ? void 0 : _categoryState$produc6.filter(function (product) {
205
205
  return (product === null || product === void 0 ? void 0 : product.category_id) === (category === null || category === void 0 ? void 0 : category.id);
206
206
  })) !== null && _categoryState$produc5 !== void 0 ? _categoryState$produc5 : [] : (_categoryState$produc7 = categoryState === null || categoryState === void 0 || (_categoryState$produc8 = categoryState.products) === null || _categoryState$produc8 === void 0 ? void 0 : _categoryState$produc8.filter(function (product) {
@@ -251,9 +251,11 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
251
251
  onClickSubcategory: onClickSubcategory
252
252
  })), /*#__PURE__*/_react.default.createElement(_styles.ProductsListing, {
253
253
  isSubcategorySearch: isSubcategorySearch
254
- }, isSearchMode && (category === null || category === void 0 || (_category$subcategori7 = category.subcategories) === null || _category$subcategori7 === void 0 ? void 0 : _category$subcategori7.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products === null || products === void 0 || (_products$filter = products.filter(function (product, i) {
254
+ }, isSearchMode && (category === null || category === void 0 || (_category$subcategori7 = category.subcategories) === null || _category$subcategori7 === void 0 ? void 0 : _category$subcategori7.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products === null || products === void 0 || (_products$sort$filter = products.sort(function (a, b) {
255
+ return (a.rank || 0) - (b.rank || 0);
256
+ }).filter(function (product, i) {
255
257
  return i < 9 && (product === null || product === void 0 ? void 0 : product.category_id) === (category === null || category === void 0 ? void 0 : category.id) || (business === null || business === void 0 ? void 0 : business.food);
256
- })) === null || _products$filter === void 0 ? void 0 : _products$filter.map(function (product, i) {
258
+ })) === null || _products$sort$filter === void 0 ? void 0 : _products$sort$filter.map(function (product, i) {
257
259
  var _currentCart$products5;
258
260
  return /*#__PURE__*/_react.default.createElement(_SingleProductCard.SingleProductCard, {
259
261
  key: i,
@@ -280,7 +282,9 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
280
282
  display: 'flex',
281
283
  justifyContent: 'center'
282
284
  }
283
- })) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products.filter(function (_, i) {
285
+ })) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products === null || products === void 0 ? void 0 : products.sort(function (a, b) {
286
+ return (a.rank || 0) - (b.rank || 0);
287
+ }).filter(function (_, i) {
284
288
  return i < 9 || (business === null || business === void 0 ? void 0 : business.food);
285
289
  }).map(function (product, i) {
286
290
  var _currentCart$products6;
@@ -319,14 +323,14 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
319
323
  return (product === null || product === void 0 ? void 0 : product.category_id) === (subcategory === null || subcategory === void 0 ? void 0 : subcategory.id);
320
324
  });
321
325
  })) === null || _category$subcategori9 === void 0 ? void 0 : _category$subcategori9.map(function (subcategory) {
322
- var _products$filter2;
326
+ var _products$filter;
323
327
  return /*#__PURE__*/_react.default.createElement(_styles.SubcategorySearchContainer, {
324
328
  key: subcategory === null || subcategory === void 0 ? void 0 : subcategory.id
325
329
  }, /*#__PURE__*/_react.default.createElement("h4", null, subcategory === null || subcategory === void 0 ? void 0 : subcategory.name), /*#__PURE__*/_react.default.createElement(_styles.ProductsListing, {
326
330
  isSubcategorySearch: isSubcategorySearch
327
- }, products === null || products === void 0 || (_products$filter2 = products.filter(function (product) {
331
+ }, products === null || products === void 0 || (_products$filter = products.filter(function (product) {
328
332
  return (product === null || product === void 0 ? void 0 : product.category_id) === (subcategory === null || subcategory === void 0 ? void 0 : subcategory.id);
329
- })) === null || _products$filter2 === void 0 ? void 0 : _products$filter2.map(function (product, i) {
333
+ })) === null || _products$filter === void 0 ? void 0 : _products$filter.map(function (product, i) {
330
334
  var _currentCart$products7;
331
335
  return /*#__PURE__*/_react.default.createElement(_SingleProductCard.SingleProductCard, {
332
336
  key: i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "14.1.3",
3
+ "version": "14.1.4",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -258,7 +258,7 @@ const BusinessProductsListUI = (props) => {
258
258
  <ProductsListing isSubcategorySearch={isSubcategorySearch}>
259
259
  {isSearchMode && category?.subcategories?.length > 0 ? (
260
260
  <>
261
- {products?.filter((product, i) => (i < 9 && product?.category_id === category?.id) || business?.food)?.map((product, i) => (
261
+ {products?.sort((a, b) => (a.rank || 0) - (b.rank || 0)).filter((product, i) => (i < 9 && product?.category_id === category?.id) || business?.food)?.map((product, i) => (
262
262
  <SingleProductCard
263
263
  key={i}
264
264
  isSoldOut={product.inventoried && !product.quantity}
@@ -288,7 +288,7 @@ const BusinessProductsListUI = (props) => {
288
288
  ) : (
289
289
  <>
290
290
  {
291
- products.filter((_, i) => i < 9 || business?.food).map((product, i) => (
291
+ products?.sort((a, b) => (a.rank || 0) - (b.rank || 0)).filter((_, i) => i < 9 || business?.food).map((product, i) => (
292
292
  <SingleProductCard
293
293
  key={i}
294
294
  isSoldOut={product.inventoried && !product.quantity}