hart-estate-widget 0.0.48 → 0.0.51

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.
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = void 0;
7
9
 
8
- require("core-js/modules/web.dom-collections.iterator.js");
9
-
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _panzoom = _interopRequireDefault(require("panzoom"));
@@ -23,53 +23,90 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
23
 
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
 
26
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
28
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
29
+
30
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
31
+
32
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
33
+
34
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
35
+
36
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
37
+
38
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27
39
 
28
- const instructionSteps = [{
40
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
41
+
42
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
43
+
44
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
45
+
46
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
47
+
48
+ var instructionSteps = [{
29
49
  icon: _handMove.default,
30
50
  text: 'Вращать планировку'
31
51
  }];
32
52
 
33
- const RotationTab = _ref => {
34
- let {
35
- images,
36
- disabled = false
37
- } = _ref;
38
- const [showInstructions, setInstructionsState] = (0, _react.useState)(false);
39
- const [activeIndex, setActiveIndex] = (0, _react.useState)(0);
40
- const [active, setActiveState] = (0, _react.useState)(false);
53
+ var RotationTab = function RotationTab(_ref) {
54
+ var images = _ref.images,
55
+ _ref$disabled = _ref.disabled,
56
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
41
57
 
42
- const onStart = () => {
58
+ var _useState = (0, _react.useState)(false),
59
+ _useState2 = _slicedToArray(_useState, 2),
60
+ showInstructions = _useState2[0],
61
+ setInstructionsState = _useState2[1];
62
+
63
+ var _useState3 = (0, _react.useState)(0),
64
+ _useState4 = _slicedToArray(_useState3, 2),
65
+ activeIndex = _useState4[0],
66
+ setActiveIndex = _useState4[1];
67
+
68
+ var _useState5 = (0, _react.useState)(false),
69
+ _useState6 = _slicedToArray(_useState5, 2),
70
+ active = _useState6[0],
71
+ setActiveState = _useState6[1];
72
+
73
+ var onStart = function onStart() {
43
74
  setInstructionsState(false);
44
- const container = document.querySelector('.widget-tab__threesixty-container');
45
- const widgetTab = document.querySelector('.widget-tab');
46
- const rotation = new _threesixty.default(container, {
47
- image: [...images],
75
+ var container = document.querySelector('.widget-tab__threesixty-container');
76
+ var widgetTab = document.querySelector('.widget-tab');
77
+ var rotation = new _threesixty.default(container, {
78
+ image: _toConsumableArray(images),
48
79
  parentElement: widgetTab,
49
80
  inverted: true
50
81
  });
51
82
 
52
- rotation._update = () => setActiveIndex(rotation.index);
83
+ rotation._update = function () {
84
+ return setActiveIndex(rotation.index);
85
+ };
53
86
 
54
- let lastIndex = 0;
55
- const controller = (0, _panzoom.default)(container, {
87
+ var lastIndex = 0;
88
+ var controller = (0, _panzoom.default)(container, {
56
89
  maxZoom: 3,
57
90
  minZoom: 0.5,
58
- beforeMouseDown: e => !e.shiftKey
91
+ beforeMouseDown: function beforeMouseDown(e) {
92
+ return !e.shiftKey;
93
+ }
59
94
  });
60
- controller.on('panstart', () => {
95
+ controller.on('panstart', function () {
61
96
  lastIndex = rotation.index;
62
97
 
63
- rotation._update = () => {};
98
+ rotation._update = function () {};
64
99
  });
65
- controller.on('panend', () => {
100
+ controller.on('panend', function () {
66
101
  rotation.goto(lastIndex);
67
102
 
68
- rotation._update = () => setActiveIndex(rotation.index);
103
+ rotation._update = function () {
104
+ return setActiveIndex(rotation.index);
105
+ };
69
106
  });
70
107
  };
71
108
 
72
- const openInstructions = () => {
109
+ var openInstructions = function openInstructions() {
73
110
  setInstructionsState(true);
74
111
  setActiveState(true);
75
112
  };
@@ -78,12 +115,14 @@ const RotationTab = _ref => {
78
115
  className: "widget-tab__threesixty ".concat(active ? 'widget-tab__threesixty--active' : '')
79
116
  }, /*#__PURE__*/_react.default.createElement("div", {
80
117
  className: "widget-tab__threesixty-container"
81
- }, images.map((img, index) => /*#__PURE__*/_react.default.createElement("img", {
82
- src: img,
83
- key: index,
84
- alt: "rotation-view-".concat(index),
85
- className: activeIndex === index ? 'active' : ''
86
- })))), !active && !showInstructions && /*#__PURE__*/_react.default.createElement("button", {
118
+ }, images.map(function (img, index) {
119
+ return /*#__PURE__*/_react.default.createElement("img", {
120
+ src: img,
121
+ key: index,
122
+ alt: "rotation-view-".concat(index),
123
+ className: activeIndex === index ? 'active' : ''
124
+ });
125
+ }))), !active && !showInstructions && /*#__PURE__*/_react.default.createElement("button", {
87
126
  className: "widget-tab__threesixty-start",
88
127
  onClick: openInstructions
89
128
  }, /*#__PURE__*/_react.default.createElement("img", {
@@ -23,17 +23,25 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
23
23
 
24
24
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
25
 
26
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
+
28
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
29
+
30
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
+
26
32
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
33
 
28
- class Widget {
29
- constructor(container) {
30
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34
+ var Widget = /*#__PURE__*/function () {
35
+ function Widget(container) {
36
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
37
+
38
+ _classCallCheck(this, Widget);
31
39
 
32
- _defineProperty(this, "requiredParams", ['tabs', 'tabPanes', 'width', 'height', 'env']);
40
+ _defineProperty(this, "requiredParams", ['tabs', 'width', 'height', 'API_URL']);
33
41
 
34
- const config = _objectSpread(_objectSpread({}, _defaultConfig.default), options);
42
+ var config = _objectSpread(_objectSpread({}, _defaultConfig.default), options);
35
43
 
36
- const widgetContainer = document.querySelector(container);
44
+ var widgetContainer = document.querySelector(container);
37
45
  if (!widgetContainer) throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043D\u0430\u0439\u0442\u0438 \u044D\u043B\u0435\u043C\u0435\u043D\u0442: #".concat(container));
38
46
  config.containerElement = widgetContainer;
39
47
 
@@ -45,28 +53,36 @@ class Widget {
45
53
  }), widgetContainer);
46
54
  }
47
55
 
48
- get options() {
49
- return _store.default.config;
50
- }
51
-
52
- updateOptions(config) {
53
- const newConfig = _objectSpread({}, config);
54
-
55
- this.requiredParams.forEach(param => {
56
- if (config[param]) return;
57
- newConfig[param] = this.options[param];
58
- });
59
-
60
- _modelStore.default.removeHouse();
61
-
62
- _store.default.setConfig(newConfig);
63
- }
64
-
65
- on(event, callback) {
66
- _store.default.addEventListener(event, callback);
67
- }
68
-
69
- }
56
+ _createClass(Widget, [{
57
+ key: "options",
58
+ get: function get() {
59
+ return _store.default.config;
60
+ }
61
+ }, {
62
+ key: "updateOptions",
63
+ value: function updateOptions(config) {
64
+ var _this = this;
65
+
66
+ var newConfig = _objectSpread({}, config);
67
+
68
+ this.requiredParams.forEach(function (param) {
69
+ if (config[param]) return;
70
+ newConfig[param] = _this.options[param];
71
+ });
72
+
73
+ _modelStore.default.removeHouse();
74
+
75
+ _store.default.setConfig(newConfig);
76
+ }
77
+ }, {
78
+ key: "on",
79
+ value: function on(event, callback) {
80
+ _store.default.addEventListener(event, callback);
81
+ }
82
+ }]);
83
+
84
+ return Widget;
85
+ }();
70
86
 
71
87
  var _default = Widget;
72
88
  exports.default = _default;
@@ -7,13 +7,11 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _logo = _interopRequireDefault(require("../assets/img/logo.svg"));
11
-
12
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
11
 
14
- const defaultConfig = {
12
+ var defaultConfig = {
15
13
  tabs: ['rotation', 'panorama'],
16
- logo: _logo.default,
14
+ logo: null,
17
15
  logoUrl: null,
18
16
  width: null,
19
17
  height: null,
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.deviceOrientationStatus = void 0;
7
- const deviceOrientationStatus = {
7
+ var deviceOrientationStatus = {
8
8
  GRANTED: 'granted',
9
9
  DENIED: 'denied'
10
10
  };
@@ -4,18 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.removeExtention = exports.imgExtentions = void 0;
7
-
8
- require("core-js/modules/es.array.reduce.js");
9
-
10
- require("core-js/modules/es.regexp.exec.js");
11
-
12
- require("core-js/modules/es.string.replace.js");
13
-
14
- const imgExtentions = ['.png', '.PNG', '.jpg', '.JPG'];
7
+ var imgExtentions = ['.png', '.PNG', '.jpg', '.JPG'];
15
8
  exports.imgExtentions = imgExtentions;
16
9
 
17
- const removeExtention = str => imgExtentions.reduce((acc, extention) => {
18
- return acc.replace(extention, '');
19
- }, str);
10
+ var removeExtention = function removeExtention(str) {
11
+ return imgExtentions.reduce(function (acc, extention) {
12
+ return acc.replace(extention, '');
13
+ }, str);
14
+ };
20
15
 
21
16
  exports.removeExtention = removeExtention;
package/build/index.js CHANGED
@@ -58,18 +58,18 @@ require("./index.css");
58
58
 
59
59
  var _apiStore = _interopRequireDefault(require("./store/apiStore"));
60
60
 
61
- var _Widget = _interopRequireDefault(require("./components/Widget"));
62
-
63
- var _Loader = _interopRequireDefault(require("./components/Loader"));
64
-
65
61
  var _ImageTab = _interopRequireDefault(require("./components/ImageTab"));
66
62
 
67
63
  var _Instructions = _interopRequireDefault(require("./components/Instructions"));
68
64
 
69
- var _RotationTab = _interopRequireDefault(require("./components/RotationTab"));
65
+ var _Loader = _interopRequireDefault(require("./components/Loader"));
66
+
67
+ var _ModelTab = _interopRequireDefault(require("./components/ModelTab"));
70
68
 
71
69
  var _PanoramaTab = _interopRequireDefault(require("./components/PanoramaTab"));
72
70
 
73
- var _ModelTab = _interopRequireDefault(require("./components/ModelTab"));
71
+ var _RotationTab = _interopRequireDefault(require("./components/RotationTab"));
72
+
73
+ var _Widget = _interopRequireDefault(require("./components/Widget"));
74
74
 
75
75
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,62 +1,199 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = void 0;
7
9
 
8
- require("core-js/modules/es.promise.js");
9
-
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _mobx = require("mobx");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
17
+
18
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
19
+
20
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
21
+
22
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
+
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
+
26
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
+
16
28
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
29
 
18
30
  (0, _mobx.configure)({
19
31
  useProxies: 'never'
20
32
  });
21
33
 
22
- class ApiStore {
23
- constructor(API_URL) {
24
- _defineProperty(this, "API_URL", null);
25
-
26
- _defineProperty(this, "loadFurnitureData", async () => {
27
- const path = "".concat(this.API_URL, "/api/furniture");
28
- const response = await fetch(path);
29
- return await response.json();
30
- });
31
-
32
- _defineProperty(this, "loadWidgetData", async planId => {
33
- const path = "".concat(this.API_URL, "/api/plans/").concat(planId, "/widget");
34
- const response = await fetch(path);
35
- return await response.json();
36
- });
37
-
38
- _defineProperty(this, "loadEditorData", async (planId, token) => {
39
- const path = "".concat(this.API_URL, "/api/plans/").concat(planId, "/editor?token=").concat(token);
40
- const response = await fetch(path);
41
- return await response.json();
42
- });
43
-
44
- _defineProperty(this, "loadPanoramaData", async planId => {
45
- const path = "".concat(this.API_URL, "/api/plans/").concat(planId, "/panorama");
46
- const response = await fetch(path);
47
- return await response.json();
48
- });
49
-
50
- _defineProperty(this, "loadJson", async path => {
51
- const response = await fetch(path);
52
- return await response.json();
53
- });
54
-
55
- (0, _mobx.makeAutoObservable)(this);
56
- this.API_URL = API_URL;
57
- }
58
-
59
- }
34
+ var ApiStore = /*#__PURE__*/_createClass(function ApiStore(API_URL) {
35
+ var _this = this;
36
+
37
+ _classCallCheck(this, ApiStore);
38
+
39
+ _defineProperty(this, "API_URL", null);
40
+
41
+ _defineProperty(this, "loadFurnitureData", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
42
+ var path, response;
43
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
44
+ while (1) {
45
+ switch (_context.prev = _context.next) {
46
+ case 0:
47
+ path = "".concat(_this.API_URL, "/api/furniture");
48
+ _context.next = 3;
49
+ return fetch(path);
50
+
51
+ case 3:
52
+ response = _context.sent;
53
+ _context.next = 6;
54
+ return response.json();
55
+
56
+ case 6:
57
+ return _context.abrupt("return", _context.sent);
58
+
59
+ case 7:
60
+ case "end":
61
+ return _context.stop();
62
+ }
63
+ }
64
+ }, _callee);
65
+ })));
66
+
67
+ _defineProperty(this, "loadWidgetData", /*#__PURE__*/function () {
68
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(planId) {
69
+ var path, response;
70
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
71
+ while (1) {
72
+ switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ path = "".concat(_this.API_URL, "/api/plans/").concat(planId, "/widget");
75
+ _context2.next = 3;
76
+ return fetch(path);
77
+
78
+ case 3:
79
+ response = _context2.sent;
80
+ _context2.next = 6;
81
+ return response.json();
82
+
83
+ case 6:
84
+ return _context2.abrupt("return", _context2.sent);
85
+
86
+ case 7:
87
+ case "end":
88
+ return _context2.stop();
89
+ }
90
+ }
91
+ }, _callee2);
92
+ }));
93
+
94
+ return function (_x) {
95
+ return _ref2.apply(this, arguments);
96
+ };
97
+ }());
98
+
99
+ _defineProperty(this, "loadEditorData", /*#__PURE__*/function () {
100
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(planId, token) {
101
+ var path, response;
102
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
103
+ while (1) {
104
+ switch (_context3.prev = _context3.next) {
105
+ case 0:
106
+ path = "".concat(_this.API_URL, "/api/plans/").concat(planId, "/editor?token=").concat(token);
107
+ _context3.next = 3;
108
+ return fetch(path);
109
+
110
+ case 3:
111
+ response = _context3.sent;
112
+ _context3.next = 6;
113
+ return response.json();
114
+
115
+ case 6:
116
+ return _context3.abrupt("return", _context3.sent);
117
+
118
+ case 7:
119
+ case "end":
120
+ return _context3.stop();
121
+ }
122
+ }
123
+ }, _callee3);
124
+ }));
125
+
126
+ return function (_x2, _x3) {
127
+ return _ref3.apply(this, arguments);
128
+ };
129
+ }());
130
+
131
+ _defineProperty(this, "loadPanoramaData", /*#__PURE__*/function () {
132
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(planId) {
133
+ var path, response;
134
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
135
+ while (1) {
136
+ switch (_context4.prev = _context4.next) {
137
+ case 0:
138
+ path = "".concat(_this.API_URL, "/api/plans/").concat(planId, "/panorama");
139
+ _context4.next = 3;
140
+ return fetch(path);
141
+
142
+ case 3:
143
+ response = _context4.sent;
144
+ _context4.next = 6;
145
+ return response.json();
146
+
147
+ case 6:
148
+ return _context4.abrupt("return", _context4.sent);
149
+
150
+ case 7:
151
+ case "end":
152
+ return _context4.stop();
153
+ }
154
+ }
155
+ }, _callee4);
156
+ }));
157
+
158
+ return function (_x4) {
159
+ return _ref4.apply(this, arguments);
160
+ };
161
+ }());
162
+
163
+ _defineProperty(this, "loadJson", /*#__PURE__*/function () {
164
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(path) {
165
+ var response;
166
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
167
+ while (1) {
168
+ switch (_context5.prev = _context5.next) {
169
+ case 0:
170
+ _context5.next = 2;
171
+ return fetch(path);
172
+
173
+ case 2:
174
+ response = _context5.sent;
175
+ _context5.next = 5;
176
+ return response.json();
177
+
178
+ case 5:
179
+ return _context5.abrupt("return", _context5.sent);
180
+
181
+ case 6:
182
+ case "end":
183
+ return _context5.stop();
184
+ }
185
+ }
186
+ }, _callee5);
187
+ }));
188
+
189
+ return function (_x5) {
190
+ return _ref5.apply(this, arguments);
191
+ };
192
+ }());
193
+
194
+ (0, _mobx.makeAutoObservable)(this);
195
+ this.API_URL = API_URL;
196
+ });
60
197
 
61
198
  var _default = ApiStore;
62
199
  exports.default = _default;