willba-component-library 0.1.44 → 0.1.45

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.
package/lib/index.umd.js CHANGED
@@ -3923,7 +3923,7 @@
3923
3923
  };
3924
3924
 
3925
3925
  var useFilterBar = function (_a) {
3926
- var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply; _a.ageCategories;
3926
+ var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply, ageCategories = _a.ageCategories;
3927
3927
  var _b = __read(React__default.useState('/events'), 2), selectedPath = _b[0], setSelectedPath = _b[1];
3928
3928
  var _c = __read(React__default.useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
3929
3929
  var _d = __read(React__default.useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
@@ -3982,9 +3982,10 @@
3982
3982
  : '',
3983
3983
  endDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? format(calendarRange.to, 'yyyy-MM-dd') : '',
3984
3984
  categories: categories,
3985
- ageCategoryCounts: Object.entries(ageCategoryCounts).length
3986
- ? JSON.stringify(ageCategoryCounts)
3987
- : '',
3985
+ ageCategoryCounts: handleAgeCategoryRules({
3986
+ ageCategoryCounts: ageCategoryCounts,
3987
+ ageCategories: ageCategories,
3988
+ }),
3988
3989
  };
3989
3990
  if (currentViewApply) {
3990
3991
  var currentSearchParams = new URLSearchParams(window.location.search);
@@ -4068,6 +4069,24 @@
4068
4069
  setSelectedPath: setSelectedPath,
4069
4070
  };
4070
4071
  };
4072
+ ////////////
4073
+ var handleAgeCategoryRules = function (_a) {
4074
+ var ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
4075
+ if (ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.length) {
4076
+ ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (a) {
4077
+ if (a.minVal) {
4078
+ // Age categories rules
4079
+ var ageCategory = ageCategoryCounts["guests-".concat(a.id)];
4080
+ if (!ageCategory) {
4081
+ ageCategoryCounts["guests-".concat(a.id)] = a.minVal;
4082
+ }
4083
+ }
4084
+ });
4085
+ }
4086
+ return Object.entries(ageCategoryCounts).length
4087
+ ? JSON.stringify(ageCategoryCounts)
4088
+ : '';
4089
+ };
4071
4090
 
4072
4091
  var useScrollInToView = function (_a) {
4073
4092
  var selectedFilter = _a.selectedFilter;