proximiio-js-library 1.17.4 → 1.17.5

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.
@@ -310,6 +310,7 @@ export class Map {
310
310
  this.throttledHandleFilterChange = throttle(this.handleFilterChange, 5000); // Adjust the delay as needed
311
311
  this.handleControllerError = (err) => {
312
312
  this.onMapFailedListener.next({ message: err.message ? err.message : JSON.stringify(err) });
313
+ return undefined;
313
314
  };
314
315
  this.InjectCSS = ({ id, css }) => {
315
316
  // Create the css
@@ -695,10 +696,19 @@ export class Map {
695
696
  });
696
697
  }
697
698
  }
699
+ else {
700
+ // Required data (places/floors/style) could not be loaded - e.g. offline with an empty
701
+ // cache. Without it the map is never created and no map-ready event is ever emitted, so
702
+ // emit an explicit failure instead of leaving the consumer stuck on a loading screen.
703
+ const missing = [!places && 'places', !floors && 'floors', !style && 'style'].filter(Boolean).join(', ');
704
+ this.onMapFailedListener.next({
705
+ message: `Map initialization aborted: required data (${missing}) could not be loaded.`,
706
+ });
707
+ }
698
708
  });
699
709
  }
700
710
  fetch() {
701
- var _a;
711
+ var _a, _b, _c;
702
712
  return __awaiter(this, void 0, void 0, function* () {
703
713
  const useBundle = !!this.defaultOptions.bundleUrl;
704
714
  const features = useBundle
@@ -752,7 +762,7 @@ export class Map {
752
762
  const ads = useBundle
753
763
  ? yield getAdsBundle({ bundleUrl: this.defaultOptions.bundleUrl }).catch((error) => this.handleControllerError(error))
754
764
  : yield getAds().catch((error) => this.handleControllerError(error));
755
- if (features && kiosks && ads) {
765
+ if (features) {
756
766
  const optimizedFeatures = new FeatureCollection({
757
767
  features: optimizeFeatures(features.modifiedFeatures.features),
758
768
  });
@@ -764,9 +774,17 @@ export class Map {
764
774
  this.geojsonSource.fetch(optimizedFeatures);
765
775
  this.routingSource.routing.setData(features.originalFeatures);
766
776
  this.prepareStyle(this.state.style);
767
- this.state = Object.assign(Object.assign({}, this.state), { initializing: false, kiosks: kiosks.data, amenities, features: features.modifiedFeatures, ads: ads.data, optimizedFeatures, allFeatures: new FeatureCollection(features.modifiedFeatures), levelChangers: new FeatureCollection({ features: levelChangers }), zoom: this.defaultOptions.zoomLevel ? this.defaultOptions.zoomLevel : (_a = this.defaultOptions.mapboxOptions) === null || _a === void 0 ? void 0 : _a.zoom });
777
+ this.state = Object.assign(Object.assign({}, this.state), { initializing: false, kiosks: (_a = kiosks === null || kiosks === void 0 ? void 0 : kiosks.data) !== null && _a !== void 0 ? _a : [], amenities, features: features.modifiedFeatures, ads: (_b = ads === null || ads === void 0 ? void 0 : ads.data) !== null && _b !== void 0 ? _b : [], optimizedFeatures, allFeatures: new FeatureCollection(features.modifiedFeatures), levelChangers: new FeatureCollection({ features: levelChangers }), zoom: this.defaultOptions.zoomLevel ? this.defaultOptions.zoomLevel : (_c = this.defaultOptions.mapboxOptions) === null || _c === void 0 ? void 0 : _c.zoom });
768
778
  this.onDataFetchedListener.next(true);
769
779
  }
780
+ else {
781
+ // Features are required to build the map data; kiosks/ads are optional and default to empty
782
+ // above so a single missing optional bundle (e.g. offline) no longer blocks the whole step.
783
+ // If features themselves failed there is nothing to render - surface it explicitly.
784
+ this.onMapFailedListener.next({
785
+ message: `Map data could not be loaded: features are unavailable.`,
786
+ });
787
+ }
770
788
  });
771
789
  }
772
790
  onMapReady(e) {
@@ -35,7 +35,7 @@ export const login = (email, password) => __awaiter(void 0, void 0, void 0, func
35
35
  const loginRes = yield axios.post(`core_auth/login`, authData);
36
36
  if (loginRes.data) {
37
37
  console.info(`Logged in successfully as ${loginRes.data.user.email}`);
38
- axios.defaults.headers.common.Authorization = loginRes.data.token;
38
+ axios.defaults.headers.common.Authorization = `Bearer ${loginRes.data.token}`;
39
39
  loggedUser = loginRes;
40
40
  }
41
41
  return loginRes;
@@ -63,7 +63,7 @@ export const loginWithToken = (token) => __awaiter(void 0, void 0, void 0, funct
63
63
  if (!token) {
64
64
  throw new Error(`Please provide your token`);
65
65
  }
66
- axios.defaults.headers.common.Authorization = token;
66
+ axios.defaults.headers.common.Authorization = `Bearer ${token}`;
67
67
  const currentUser = yield axios.get(`core/current_user`);
68
68
  if (currentUser.data) {
69
69
  console.info(`Logged in successfully as ${currentUser.data.email}`);
@@ -86,7 +86,7 @@ export const loginWithToken = (token) => __awaiter(void 0, void 0, void 0, funct
86
86
  * });
87
87
  */
88
88
  export const setToken = (token) => __awaiter(void 0, void 0, void 0, function* () {
89
- axios.defaults.headers.common.Authorization = token;
89
+ axios.defaults.headers.common.Authorization = `Bearer ${token}`;
90
90
  return `Token set successfully: ${token}`;
91
91
  });
92
92
  /**