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.esm.js +23 -4
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +23 -4
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +23 -4
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +31 -3
package/lib/index.esm.js
CHANGED
|
@@ -3901,7 +3901,7 @@ var parseGuests = function (_a) {
|
|
|
3901
3901
|
};
|
|
3902
3902
|
|
|
3903
3903
|
var useFilterBar = function (_a) {
|
|
3904
|
-
var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply
|
|
3904
|
+
var redirectUrl = _a.redirectUrl, currentViewApply = _a.currentViewApply, ageCategories = _a.ageCategories;
|
|
3905
3905
|
var _b = __read(useState('/events'), 2), selectedPath = _b[0], setSelectedPath = _b[1];
|
|
3906
3906
|
var _c = __read(useState(false), 2), selectedFilter = _c[0], setSelectedFilter = _c[1];
|
|
3907
3907
|
var _d = __read(useState(), 2), calendarRange = _d[0], setCalendarRange = _d[1];
|
|
@@ -3960,9 +3960,10 @@ var useFilterBar = function (_a) {
|
|
|
3960
3960
|
: '',
|
|
3961
3961
|
endDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.to) ? format(calendarRange.to, 'yyyy-MM-dd') : '',
|
|
3962
3962
|
categories: categories,
|
|
3963
|
-
ageCategoryCounts:
|
|
3964
|
-
|
|
3965
|
-
:
|
|
3963
|
+
ageCategoryCounts: handleAgeCategoryRules({
|
|
3964
|
+
ageCategoryCounts: ageCategoryCounts,
|
|
3965
|
+
ageCategories: ageCategories,
|
|
3966
|
+
}),
|
|
3966
3967
|
};
|
|
3967
3968
|
if (currentViewApply) {
|
|
3968
3969
|
var currentSearchParams = new URLSearchParams(window.location.search);
|
|
@@ -4046,6 +4047,24 @@ var useFilterBar = function (_a) {
|
|
|
4046
4047
|
setSelectedPath: setSelectedPath,
|
|
4047
4048
|
};
|
|
4048
4049
|
};
|
|
4050
|
+
////////////
|
|
4051
|
+
var handleAgeCategoryRules = function (_a) {
|
|
4052
|
+
var ageCategoryCounts = _a.ageCategoryCounts, ageCategories = _a.ageCategories;
|
|
4053
|
+
if (ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.length) {
|
|
4054
|
+
ageCategories === null || ageCategories === void 0 ? void 0 : ageCategories.map(function (a) {
|
|
4055
|
+
if (a.minVal) {
|
|
4056
|
+
// Age categories rules
|
|
4057
|
+
var ageCategory = ageCategoryCounts["guests-".concat(a.id)];
|
|
4058
|
+
if (!ageCategory) {
|
|
4059
|
+
ageCategoryCounts["guests-".concat(a.id)] = a.minVal;
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
});
|
|
4063
|
+
}
|
|
4064
|
+
return Object.entries(ageCategoryCounts).length
|
|
4065
|
+
? JSON.stringify(ageCategoryCounts)
|
|
4066
|
+
: '';
|
|
4067
|
+
};
|
|
4049
4068
|
|
|
4050
4069
|
var useScrollInToView = function (_a) {
|
|
4051
4070
|
var selectedFilter = _a.selectedFilter;
|