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