hart-estate-widget 0.0.38 → 0.0.41

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.
@@ -11,6 +11,8 @@ require("core-js/modules/es.regexp.exec.js");
11
11
 
12
12
  require("core-js/modules/es.string.replace.js");
13
13
 
14
+ require("core-js/modules/es.string.split.js");
15
+
14
16
  require("core-js/modules/es.string.includes.js");
15
17
 
16
18
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -87,14 +89,19 @@ const getPanoramas = (json, images, setLoadingState) => {
87
89
  const roomImages = images.filter(img => {
88
90
  const panoramaIdIndex = img.indexOf(pathName) + pathName.length;
89
91
  if (panoramaIdIndex < pathName.length) return false;
90
- let panoramaId = removeExtention(img.substring(panoramaIdIndex));
92
+ const indexAsString = String(index);
93
+ let panoramaId = String(removeExtention(img.substring(panoramaIdIndex))).split('.')[0];
91
94
 
92
95
  if (panoramaId.includes(cameraIdBeginning)) {
93
96
  const cameraIdIndex = panoramaId.indexOf(cameraIdBeginning) - 1;
94
97
  panoramaId = panoramaId.slice(0, cameraIdIndex);
95
98
  }
96
99
 
97
- return Number(panoramaId) === index;
100
+ const maxIndexLength = Math.max(indexAsString.length, panoramaId.length);
101
+ const imageInRoom = (0, _panoramaHelpers.getArrayFromNumber)(maxIndexLength).every(i => {
102
+ return panoramaId[i] === indexAsString[i];
103
+ });
104
+ return imageInRoom;
98
105
  });
99
106
  if (!roomImages.length) return acc;
100
107
  roomImages.forEach(image => {
@@ -59,9 +59,10 @@ class Store {
59
59
  json,
60
60
  panoramaImages
61
61
  } = this.config;
62
+ if (!json) return panoramaImages[0] || null;
62
63
  const roomIndex = json.Floors[0].Units[0].Rooms.findIndex(room => room.ID === this.hallRoomId);
63
64
  const image = panoramaImages.find(url => url.includes("".concat(roomIndex, ".png")));
64
- return image || panoramaImages[0];
65
+ return image || panoramaImages[0] || null;
65
66
  }
66
67
 
67
68
  setConfig(config) {
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getScale = exports.getRoomCoordinates = exports.findWallVertices = void 0;
6
+ exports.getScale = exports.getRoomCoordinates = exports.getArrayFromNumber = exports.findWallVertices = void 0;
7
+
8
+ require("core-js/modules/web.dom-collections.iterator.js");
7
9
 
8
10
  require("core-js/modules/es.array.reduce.js");
9
11
 
@@ -11,6 +13,10 @@ var _react = _interopRequireDefault(require("react"));
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
16
+ const getArrayFromNumber = num => [...Array(num).keys()];
17
+
18
+ exports.getArrayFromNumber = getArrayFromNumber;
19
+
14
20
  const findWallVertices = (walls, wall, vertices) => {
15
21
  const currentWall = walls.find(el => el.ID === wall);
16
22
  return currentWall.Vertices.map(vertexId => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "HART Estate widget",
4
4
  "author": "HART",
5
5
  "keywords": [],
6
- "version": "0.0.38",
6
+ "version": "0.0.41",
7
7
  "private": false,
8
8
  "main": "build/index.js",
9
9
  "module": "build/index.js",