proximiio-js-library 1.9.8 → 1.9.9

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
@@ -176,6 +176,7 @@ const map = new Proximiio.Map({
176
176
  language: 'en', // optional, set default map language for poi features
177
177
  routeColor: '#000000', // optional, define route line color
178
178
  forceFloorLevel: 0, // optional, define floor number if you want to force routes visible for single level
179
+ amenityIdProperty: 'title', // optional, define amenity property to rewrite amenity id with, so poi icons can be initialized by different param
179
180
  });
180
181
  ```
181
182
 
@@ -85,6 +85,7 @@ interface Options {
85
85
  language?: string;
86
86
  routeColor?: string;
87
87
  forceFloorLevel?: number;
88
+ amenityIdProperty?: string;
88
89
  }
89
90
  interface PaddingOptions {
90
91
  bottom: number;
@@ -238,7 +238,7 @@ var Map = /** @class */ (function () {
238
238
  urlParams = new URLSearchParams(window.location.search);
239
239
  placeParam = urlParams.get(this.defaultOptions.urlParams.defaultPlace);
240
240
  }
241
- return [4 /*yield*/, repository_1.default.getPackage(this.defaultOptions.initPolygons)];
241
+ return [4 /*yield*/, repository_1.default.getPackage(this.defaultOptions.initPolygons, this.defaultOptions.amenityIdProperty)];
242
242
  case 1:
243
243
  _d = _e.sent(), places = _d.places, style = _d.style, styles = _d.styles, features = _d.features, amenities = _d.amenities;
244
244
  levelChangers = features.features.filter(function (f) { return f.properties.type === 'elevator' || f.properties.type === 'escalator' || f.properties.type === 'staircase'; });
@@ -1,10 +1,10 @@
1
1
  import Feature, { FeatureCollection } from '../models/feature';
2
2
  export declare const getFeatures: (initPolygons?: boolean) => Promise<FeatureCollection>;
3
- export declare const getAmenities: () => Promise<any>;
3
+ export declare const getAmenities: (amenityIdProperty?: string) => Promise<any>;
4
4
  export declare const getPois: () => Promise<Feature[]>;
5
5
  declare const _default: {
6
6
  getFeatures: (initPolygons?: boolean) => Promise<FeatureCollection>;
7
- getAmenities: () => Promise<any>;
7
+ getAmenities: (amenityIdProperty?: string) => Promise<any>;
8
8
  getPois: () => Promise<Feature[]>;
9
9
  };
10
10
  export default _default;
@@ -93,7 +93,7 @@ var getFeatures = function (initPolygons) { return __awaiter(void 0, void 0, voi
93
93
  });
94
94
  }); };
95
95
  exports.getFeatures = getFeatures;
96
- var getAmenities = function () { return __awaiter(void 0, void 0, void 0, function () {
96
+ var getAmenities = function (amenityIdProperty) { return __awaiter(void 0, void 0, void 0, function () {
97
97
  var url, res;
98
98
  return __generator(this, function (_a) {
99
99
  switch (_a.label) {
@@ -102,7 +102,12 @@ var getAmenities = function () { return __awaiter(void 0, void 0, void 0, functi
102
102
  return [4 /*yield*/, common_1.axios.get(url)];
103
103
  case 1:
104
104
  res = _a.sent();
105
- return [2 /*return*/, res.data.map(function (item) { return new amenity_1.AmenityModel(item); })];
105
+ return [2 /*return*/, res.data.map(function (item) {
106
+ if (amenityIdProperty && item[amenityIdProperty] && item.category !== 'default') {
107
+ item.id = item[amenityIdProperty].toLowerCase();
108
+ }
109
+ return new amenity_1.AmenityModel(item);
110
+ })];
106
111
  }
107
112
  });
108
113
  }); };
@@ -3,7 +3,7 @@ import { FloorModel } from '../models/floor';
3
3
  import StyleModel from '../models/style';
4
4
  import { FeatureCollection } from '../models/feature';
5
5
  import { AmenityModel } from '../models/amenity';
6
- export declare const getPackage: (initPolygons?: boolean) => Promise<{
6
+ export declare const getPackage: (initPolygons?: boolean, amenityIdProperty?: string) => Promise<{
7
7
  places: PlaceModel[];
8
8
  floors: FloorModel[];
9
9
  style: StyleModel;
@@ -12,7 +12,7 @@ export declare const getPackage: (initPolygons?: boolean) => Promise<{
12
12
  amenities: AmenityModel[];
13
13
  }>;
14
14
  declare const _default: {
15
- getPackage: (initPolygons?: boolean) => Promise<{
15
+ getPackage: (initPolygons?: boolean, amenityIdProperty?: string) => Promise<{
16
16
  places: PlaceModel[];
17
17
  floors: FloorModel[];
18
18
  style: StyleModel;
@@ -41,7 +41,7 @@ var places_1 = require("./places");
41
41
  var floors_1 = require("./floors");
42
42
  var style_1 = require("./style");
43
43
  var geo_1 = require("./geo");
44
- var getPackage = function (initPolygons) { return __awaiter(void 0, void 0, void 0, function () {
44
+ var getPackage = function (initPolygons, amenityIdProperty) { return __awaiter(void 0, void 0, void 0, function () {
45
45
  var result, promises;
46
46
  return __generator(this, function (_a) {
47
47
  switch (_a.label) {
@@ -53,7 +53,7 @@ var getPackage = function (initPolygons) { return __awaiter(void 0, void 0, void
53
53
  style_1.getStyle().then(function (style) { return (result.style = style); }),
54
54
  style_1.getStyles().then(function (styles) { return (result.styles = styles); }),
55
55
  geo_1.getFeatures(initPolygons).then(function (features) { return (result.features = features); }),
56
- geo_1.getAmenities().then(function (amenities) { return (result.amenities = amenities); }),
56
+ geo_1.getAmenities(amenityIdProperty).then(function (amenities) { return (result.amenities = amenities); }),
57
57
  ];
58
58
  return [4 /*yield*/, Promise.all(promises)];
59
59
  case 1: