willba-component-library 0.1.80 → 0.1.82

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
@@ -3986,17 +3986,30 @@ var useFilterBar = function (_a) {
3986
3986
  };
3987
3987
  }, [selectedFilter]);
3988
3988
  React__default.useEffect(function () {
3989
- // Handle default selected tab
3990
3989
  if (typeof window === 'undefined')
3991
3990
  return;
3992
3991
  var defaultTab = (tabs === null || tabs === void 0 ? void 0 : tabs.length) === 1 ? tabs[0] : tabs === null || tabs === void 0 ? void 0 : tabs.find(function (tab) { return tab.default; });
3993
- var currentPath = window.location.pathname.includes(Pages.EVENTS) ||
3994
- (defaultTab === null || defaultTab === void 0 ? void 0 : defaultTab.path) === Pages.EVENTS
3995
- ? Pages.EVENTS
3996
- : window.location.pathname.includes(Pages.ROOMS) ||
3997
- (defaultTab === null || defaultTab === void 0 ? void 0 : defaultTab.path) === Pages.ROOMS
3998
- ? Pages.ROOMS
3999
- : Pages.EVENTS;
3992
+ var findMatchingPath = function () {
3993
+ var e_1, _a;
3994
+ var paths = [Pages.EVENTS, Pages.ROOMS];
3995
+ try {
3996
+ for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
3997
+ var path = paths_1_1.value;
3998
+ if (window.location.pathname.includes(path)) {
3999
+ return path;
4000
+ }
4001
+ }
4002
+ }
4003
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4004
+ finally {
4005
+ try {
4006
+ if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);
4007
+ }
4008
+ finally { if (e_1) throw e_1.error; }
4009
+ }
4010
+ return defaultTab ? defaultTab.path : Pages.EVENTS;
4011
+ };
4012
+ var currentPath = findMatchingPath();
4000
4013
  setSelectedPath(currentPath);
4001
4014
  }, []);
4002
4015
  var updateGuestsCount = function (id, newCount) {
@@ -4009,7 +4022,7 @@ var useFilterBar = function (_a) {
4009
4022
  setSelectedFilter(id);
4010
4023
  };
4011
4024
  var handleSubmit = function () {
4012
- var e_1, _a;
4025
+ var e_2, _a;
4013
4026
  var newParams = {
4014
4027
  startDate: (calendarRange === null || calendarRange === void 0 ? void 0 : calendarRange.from)
4015
4028
  ? format(calendarRange.from, 'yyyy-MM-dd')
@@ -4030,12 +4043,12 @@ var useFilterBar = function (_a) {
4030
4043
  }
4031
4044
  }
4032
4045
  }
4033
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
4046
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4034
4047
  finally {
4035
4048
  try {
4036
4049
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4037
4050
  }
4038
- finally { if (e_1) throw e_1.error; }
4051
+ finally { if (e_2) throw e_2.error; }
4039
4052
  }
4040
4053
  handleSelectedFilter(false);
4041
4054
  return onSubmit && selectedPath === Pages.ROOMS