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