ba-js-common-header 0.0.47 → 0.0.50

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/README.md CHANGED
@@ -13,7 +13,7 @@ yarn add ba-js-common-header
13
13
  ```javascript
14
14
  // React
15
15
 
16
- import { Header } from 'ba-js-common-header'
16
+ import { Header } from 'ba-js-common-header/dist/ba-js-common-header.es.js'
17
17
 
18
18
  function App(props) {
19
19
  return <Header {...props} />
@@ -12095,11 +12095,15 @@ function Notifications() {
12095
12095
  if (notificationsConfig) {
12096
12096
  let {
12097
12097
  type,
12098
- items
12098
+ items = {}
12099
12099
  } = notificationsConfig;
12100
12100
  if (type === "fetch") {
12101
- const res = await fetch(items);
12102
- items = await res.json();
12101
+ try {
12102
+ const res = await fetch(items);
12103
+ items = await res.json();
12104
+ } catch (e2) {
12105
+ console.error(e2);
12106
+ }
12103
12107
  }
12104
12108
  dispatch(setNotifications(items));
12105
12109
  }
@@ -14404,10 +14408,10 @@ function HotelFinder(props) {
14404
14408
  onInputValueChange: ({
14405
14409
  inputValue
14406
14410
  }) => {
14411
+ const inputValueLC = inputValue.toLowerCase();
14407
14412
  setInputHotels(hotels.filter((hotel) => {
14408
14413
  const hotelNameLC = itemToString2(hotel).toLowerCase();
14409
- const inputValueLC = inputValue.toLowerCase();
14410
- return hotelNameLC.match(`(^|s)${inputValueLC}`);
14414
+ return hotelNameLC.match(`(^|\\s)${inputValueLC}`);
14411
14415
  }));
14412
14416
  }
14413
14417
  });
@@ -14520,11 +14524,15 @@ function PropertySelector(props) {
14520
14524
  if (propertySelector) {
14521
14525
  let {
14522
14526
  type,
14523
- items
14527
+ items = []
14524
14528
  } = propertySelector;
14525
14529
  if (type === "fetch") {
14526
- const res = await fetch(items);
14527
- items = await res.json();
14530
+ try {
14531
+ const res = await fetch(items);
14532
+ items = await res.json();
14533
+ } catch (e2) {
14534
+ console.error(e2);
14535
+ }
14528
14536
  }
14529
14537
  const foundHotel = items.find((hotel) => {
14530
14538
  const [hotelId, guideId] = hotel[1].split("_").map((id2) => +id2);
@@ -16706,7 +16714,8 @@ function Header(props) {
16706
16714
  }
16707
16715
  }, [windowWidth]);
16708
16716
  const {
16709
- headerConfig = {}
16717
+ headerConfig = {},
16718
+ error
16710
16719
  } = useHeaderConfig(config2);
16711
16720
  const {
16712
16721
  titleBar,
@@ -16727,6 +16736,10 @@ function Header(props) {
16727
16736
  headerRef.current.scrollTop = 0;
16728
16737
  }
16729
16738
  }, [subMenus.length]);
16739
+ if (error) {
16740
+ console.error(error);
16741
+ return null;
16742
+ }
16730
16743
  return /* @__PURE__ */ jsxs("div", {
16731
16744
  children: [/* @__PURE__ */ jsxs("div", {
16732
16745
  ref: headerRef,