@plattar/plattar-ar-adapter 1.188.1 → 1.188.3
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.
|
@@ -18,7 +18,8 @@ function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).in
|
|
|
18
18
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
19
19
|
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
20
20
|
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
|
|
21
|
-
function
|
|
21
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
22
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
22
23
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
23
24
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
24
25
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -153,15 +154,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
153
154
|
}, {
|
|
154
155
|
key: "_Compose",
|
|
155
156
|
value: (function () {
|
|
156
|
-
var _Compose2 = _asyncToGenerator(/*#__PURE__*/
|
|
157
|
-
var type, url, response, data;
|
|
158
|
-
return
|
|
159
|
-
while (1) switch (_context.
|
|
157
|
+
var _Compose2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(output) {
|
|
158
|
+
var type, url, response, data, _t;
|
|
159
|
+
return _regenerator().w(function (_context) {
|
|
160
|
+
while (1) switch (_context.n) {
|
|
160
161
|
case 0:
|
|
161
162
|
type = output === 'glb' ? "viewer" : "reality";
|
|
162
163
|
url = "https://xrutils.plattar.com/v3/scene/".concat(this._options.state.scene.id, "/").concat(type); // grab our existing scene-graph from the saved API
|
|
163
|
-
_context.
|
|
164
|
-
_context.
|
|
164
|
+
_context.p = 1;
|
|
165
|
+
_context.n = 2;
|
|
165
166
|
return fetch(url, {
|
|
166
167
|
method: "POST",
|
|
167
168
|
headers: {
|
|
@@ -173,28 +174,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
173
174
|
}
|
|
174
175
|
})
|
|
175
176
|
});
|
|
176
|
-
case
|
|
177
|
-
response = _context.
|
|
177
|
+
case 2:
|
|
178
|
+
response = _context.v;
|
|
178
179
|
if (response.ok) {
|
|
179
|
-
_context.
|
|
180
|
+
_context.n = 3;
|
|
180
181
|
break;
|
|
181
182
|
}
|
|
182
183
|
throw new Error("ConfiguratorAR - Fetching Existing Graph Error - network response was not ok ".concat(response.status));
|
|
183
|
-
case
|
|
184
|
-
_context.
|
|
184
|
+
case 3:
|
|
185
|
+
_context.n = 4;
|
|
185
186
|
return response.json();
|
|
186
|
-
case
|
|
187
|
-
data = _context.
|
|
188
|
-
return _context.
|
|
189
|
-
case
|
|
190
|
-
_context.
|
|
191
|
-
|
|
192
|
-
throw new Error("ConfiguratorAR - Fetching Existing Graph Error - there was a request error to ".concat(url, ", error was ").concat(
|
|
193
|
-
case
|
|
194
|
-
|
|
195
|
-
return _context.stop();
|
|
187
|
+
case 4:
|
|
188
|
+
data = _context.v;
|
|
189
|
+
return _context.a(2, data.data.attributes.url);
|
|
190
|
+
case 5:
|
|
191
|
+
_context.p = 5;
|
|
192
|
+
_t = _context.v;
|
|
193
|
+
throw new Error("ConfiguratorAR - Fetching Existing Graph Error - there was a request error to ".concat(url, ", error was ").concat(_t.message));
|
|
194
|
+
case 6:
|
|
195
|
+
return _context.a(2);
|
|
196
196
|
}
|
|
197
|
-
}, _callee, this, [[
|
|
197
|
+
}, _callee, this, [[1, 5]]);
|
|
198
198
|
}));
|
|
199
199
|
function _Compose(_x) {
|
|
200
200
|
return _Compose2.apply(this, arguments);
|
|
@@ -212,67 +212,67 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
212
212
|
}, {
|
|
213
213
|
key: "init",
|
|
214
214
|
value: (function () {
|
|
215
|
-
var _init = _asyncToGenerator(/*#__PURE__*/
|
|
215
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
216
216
|
var scene, sceneOpt, modelUrl, _modelUrl, _modelUrl2, arviewer;
|
|
217
|
-
return
|
|
218
|
-
while (1) switch (_context2.
|
|
217
|
+
return _regenerator().w(function (_context2) {
|
|
218
|
+
while (1) switch (_context2.n) {
|
|
219
219
|
case 0:
|
|
220
220
|
if (util_1.Util.canAugment()) {
|
|
221
|
-
_context2.
|
|
221
|
+
_context2.n = 1;
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
224
|
throw new Error("ConfiguratorAR.init() - cannot proceed as AR not available in context");
|
|
225
|
-
case
|
|
225
|
+
case 1:
|
|
226
226
|
scene = this._options.state.scene;
|
|
227
227
|
this._SetupAnalytics();
|
|
228
228
|
sceneOpt = scene.attributes.custom_json || {}; // we need to define our AR module here
|
|
229
229
|
// we are in Safari/Quicklook mode here
|
|
230
230
|
if (!(util_1.Util.isSafari() || util_1.Util.isChromeOnIOS())) {
|
|
231
|
-
_context2.
|
|
231
|
+
_context2.n = 7;
|
|
232
232
|
break;
|
|
233
233
|
}
|
|
234
234
|
if (!(sceneOpt.anchor === "face")) {
|
|
235
|
-
_context2.
|
|
235
|
+
_context2.n = 4;
|
|
236
236
|
break;
|
|
237
237
|
}
|
|
238
238
|
if (!util_1.Util.canRealityViewer()) {
|
|
239
|
-
_context2.
|
|
239
|
+
_context2.n = 3;
|
|
240
240
|
break;
|
|
241
241
|
}
|
|
242
|
-
_context2.
|
|
242
|
+
_context2.n = 2;
|
|
243
243
|
return this._Compose("vto");
|
|
244
|
-
case
|
|
245
|
-
modelUrl = _context2.
|
|
244
|
+
case 2:
|
|
245
|
+
modelUrl = _context2.v;
|
|
246
246
|
this._ar = new quicklook_viewer_1["default"]();
|
|
247
247
|
this._ar.modelUrl = modelUrl;
|
|
248
248
|
this._ar.banner = this.options.banner;
|
|
249
|
-
return _context2.
|
|
250
|
-
case
|
|
249
|
+
return _context2.a(2, this);
|
|
250
|
+
case 3:
|
|
251
251
|
throw new Error("ConfiguratorAR.init() - cannot proceed as VTO AR requires Reality Viewer support");
|
|
252
|
-
case
|
|
252
|
+
case 4:
|
|
253
253
|
if (!util_1.Util.canQuicklook()) {
|
|
254
|
-
_context2.
|
|
254
|
+
_context2.n = 6;
|
|
255
255
|
break;
|
|
256
256
|
}
|
|
257
|
-
_context2.
|
|
257
|
+
_context2.n = 5;
|
|
258
258
|
return this._Compose("usdz");
|
|
259
|
-
case
|
|
260
|
-
_modelUrl = _context2.
|
|
259
|
+
case 5:
|
|
260
|
+
_modelUrl = _context2.v;
|
|
261
261
|
this._ar = new quicklook_viewer_1["default"]();
|
|
262
262
|
this._ar.modelUrl = _modelUrl;
|
|
263
263
|
this._ar.banner = this.options.banner;
|
|
264
|
-
return _context2.
|
|
265
|
-
case
|
|
264
|
+
return _context2.a(2, this);
|
|
265
|
+
case 6:
|
|
266
266
|
throw new Error("ConfiguratorAR.init() - cannot proceed as IOS device does not support AR Mode");
|
|
267
|
-
case
|
|
267
|
+
case 7:
|
|
268
268
|
if (!util_1.Util.canSceneViewer()) {
|
|
269
|
-
_context2.
|
|
269
|
+
_context2.n = 9;
|
|
270
270
|
break;
|
|
271
271
|
}
|
|
272
|
-
_context2.
|
|
272
|
+
_context2.n = 8;
|
|
273
273
|
return this._Compose("glb");
|
|
274
|
-
case
|
|
275
|
-
_modelUrl2 = _context2.
|
|
274
|
+
case 8:
|
|
275
|
+
_modelUrl2 = _context2.v;
|
|
276
276
|
arviewer = new scene_viewer_1["default"]();
|
|
277
277
|
arviewer.modelUrl = _modelUrl2;
|
|
278
278
|
arviewer.isVertical = this.options.anchor === "vertical" ? true : false;
|
|
@@ -281,12 +281,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
281
281
|
arviewer.isVertical = true;
|
|
282
282
|
}
|
|
283
283
|
this._ar = arviewer;
|
|
284
|
-
return _context2.
|
|
285
|
-
case
|
|
284
|
+
return _context2.a(2, this);
|
|
285
|
+
case 9:
|
|
286
286
|
throw new Error("ConfiguratorAR.init() - could not initialise AR correctly, check values");
|
|
287
|
-
case
|
|
288
|
-
|
|
289
|
-
return _context2.stop();
|
|
287
|
+
case 10:
|
|
288
|
+
return _context2.a(2);
|
|
290
289
|
}
|
|
291
290
|
}, _callee2, this);
|
|
292
291
|
}));
|
|
@@ -361,19 +360,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
361
360
|
return _createClass(LauncherAR, [{
|
|
362
361
|
key: "launch",
|
|
363
362
|
value: (function () {
|
|
364
|
-
var _launch = _asyncToGenerator(/*#__PURE__*/
|
|
363
|
+
var _launch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
365
364
|
var value;
|
|
366
|
-
return
|
|
367
|
-
while (1) switch (_context3.
|
|
365
|
+
return _regenerator().w(function (_context3) {
|
|
366
|
+
while (1) switch (_context3.n) {
|
|
368
367
|
case 0:
|
|
369
|
-
_context3.
|
|
368
|
+
_context3.n = 1;
|
|
370
369
|
return this.init();
|
|
371
|
-
case
|
|
372
|
-
value = _context3.
|
|
373
|
-
return _context3.
|
|
374
|
-
case 4:
|
|
375
|
-
case "end":
|
|
376
|
-
return _context3.stop();
|
|
370
|
+
case 1:
|
|
371
|
+
value = _context3.v;
|
|
372
|
+
return _context3.a(2, value.start());
|
|
377
373
|
}
|
|
378
374
|
}, _callee3, this);
|
|
379
375
|
}));
|
|
@@ -1288,17 +1284,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1288
1284
|
return _createClass(SceneGraphAR, [{
|
|
1289
1285
|
key: "_SetupAnalytics",
|
|
1290
1286
|
value: function () {
|
|
1291
|
-
var _SetupAnalytics2 = _asyncToGenerator(/*#__PURE__*/
|
|
1287
|
+
var _SetupAnalytics2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
1292
1288
|
var scene, fetchedScene, analytics, application;
|
|
1293
|
-
return
|
|
1294
|
-
while (1) switch (_context4.
|
|
1289
|
+
return _regenerator().w(function (_context4) {
|
|
1290
|
+
while (1) switch (_context4.n) {
|
|
1295
1291
|
case 0:
|
|
1296
1292
|
scene = new plattar_api_1.Scene(this._options.sceneID);
|
|
1297
1293
|
scene.include(plattar_api_1.Project);
|
|
1298
|
-
_context4.
|
|
1294
|
+
_context4.n = 1;
|
|
1299
1295
|
return scene.get();
|
|
1300
|
-
case
|
|
1301
|
-
fetchedScene = _context4.
|
|
1296
|
+
case 1:
|
|
1297
|
+
fetchedScene = _context4.v;
|
|
1302
1298
|
analytics = null;
|
|
1303
1299
|
analytics = new plattar_analytics_1.Analytics(fetchedScene.attributes.application_id);
|
|
1304
1300
|
analytics.origin = plattar_api_1.Server.location().type;
|
|
@@ -1319,10 +1315,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1319
1315
|
};
|
|
1320
1316
|
}
|
|
1321
1317
|
}
|
|
1322
|
-
return _context4.
|
|
1323
|
-
case 16:
|
|
1324
|
-
case "end":
|
|
1325
|
-
return _context4.stop();
|
|
1318
|
+
return _context4.a(2, fetchedScene);
|
|
1326
1319
|
}
|
|
1327
1320
|
}, _callee4, this);
|
|
1328
1321
|
}));
|
|
@@ -1338,43 +1331,42 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1338
1331
|
}, {
|
|
1339
1332
|
key: "_Compose",
|
|
1340
1333
|
value: (function () {
|
|
1341
|
-
var _Compose3 = _asyncToGenerator(/*#__PURE__*/
|
|
1342
|
-
var type, url, response, data;
|
|
1343
|
-
return
|
|
1344
|
-
while (1) switch (_context5.
|
|
1334
|
+
var _Compose3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(output) {
|
|
1335
|
+
var type, url, response, data, _t2;
|
|
1336
|
+
return _regenerator().w(function (_context5) {
|
|
1337
|
+
while (1) switch (_context5.n) {
|
|
1345
1338
|
case 0:
|
|
1346
1339
|
type = output === 'glb' ? "viewer" : "reality";
|
|
1347
1340
|
url = "https://xrutils.plattar.com/v3/scene/".concat(this._options.sceneID, "/").concat(type, "/").concat(this._options.id); // grab our existing scene-graph from the saved API
|
|
1348
|
-
_context5.
|
|
1349
|
-
_context5.
|
|
1341
|
+
_context5.p = 1;
|
|
1342
|
+
_context5.n = 2;
|
|
1350
1343
|
return fetch(url, {
|
|
1351
1344
|
method: "GET",
|
|
1352
1345
|
headers: {
|
|
1353
1346
|
"Content-Type": "application/json"
|
|
1354
1347
|
}
|
|
1355
1348
|
});
|
|
1356
|
-
case
|
|
1357
|
-
response = _context5.
|
|
1349
|
+
case 2:
|
|
1350
|
+
response = _context5.v;
|
|
1358
1351
|
if (response.ok) {
|
|
1359
|
-
_context5.
|
|
1352
|
+
_context5.n = 3;
|
|
1360
1353
|
break;
|
|
1361
1354
|
}
|
|
1362
1355
|
throw new Error("ARAdapter - Fetching Existing Graph Error - network response was not ok ".concat(response.status));
|
|
1363
|
-
case
|
|
1364
|
-
_context5.
|
|
1356
|
+
case 3:
|
|
1357
|
+
_context5.n = 4;
|
|
1365
1358
|
return response.json();
|
|
1366
|
-
case
|
|
1367
|
-
data = _context5.
|
|
1368
|
-
return _context5.
|
|
1369
|
-
case
|
|
1370
|
-
_context5.
|
|
1371
|
-
|
|
1372
|
-
throw new Error("ARAdapter - Fetching Existing Graph Error - there was a request error to ".concat(url, ", error was ").concat(
|
|
1373
|
-
case
|
|
1374
|
-
|
|
1375
|
-
return _context5.stop();
|
|
1359
|
+
case 4:
|
|
1360
|
+
data = _context5.v;
|
|
1361
|
+
return _context5.a(2, data.data.attributes.url);
|
|
1362
|
+
case 5:
|
|
1363
|
+
_context5.p = 5;
|
|
1364
|
+
_t2 = _context5.v;
|
|
1365
|
+
throw new Error("ARAdapter - Fetching Existing Graph Error - there was a request error to ".concat(url, ", error was ").concat(_t2.message));
|
|
1366
|
+
case 6:
|
|
1367
|
+
return _context5.a(2);
|
|
1376
1368
|
}
|
|
1377
|
-
}, _callee5, this, [[
|
|
1369
|
+
}, _callee5, this, [[1, 5]]);
|
|
1378
1370
|
}));
|
|
1379
1371
|
function _Compose(_x2) {
|
|
1380
1372
|
return _Compose3.apply(this, arguments);
|
|
@@ -1392,69 +1384,69 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1392
1384
|
}, {
|
|
1393
1385
|
key: "init",
|
|
1394
1386
|
value: (function () {
|
|
1395
|
-
var _init2 = _asyncToGenerator(/*#__PURE__*/
|
|
1387
|
+
var _init2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
1396
1388
|
var scene, sceneOpt, modelUrl, _modelUrl3, _modelUrl4, arviewer;
|
|
1397
|
-
return
|
|
1398
|
-
while (1) switch (_context6.
|
|
1389
|
+
return _regenerator().w(function (_context6) {
|
|
1390
|
+
while (1) switch (_context6.n) {
|
|
1399
1391
|
case 0:
|
|
1400
1392
|
if (util_1.Util.canAugment()) {
|
|
1401
|
-
_context6.
|
|
1393
|
+
_context6.n = 1;
|
|
1402
1394
|
break;
|
|
1403
1395
|
}
|
|
1404
1396
|
throw new Error("SceneGraphAR.init() - cannot proceed as AR not available in context");
|
|
1405
|
-
case
|
|
1406
|
-
_context6.
|
|
1397
|
+
case 1:
|
|
1398
|
+
_context6.n = 2;
|
|
1407
1399
|
return this._SetupAnalytics();
|
|
1408
|
-
case
|
|
1409
|
-
scene = _context6.
|
|
1400
|
+
case 2:
|
|
1401
|
+
scene = _context6.v;
|
|
1410
1402
|
sceneOpt = scene.attributes.custom_json || {}; // we need to define our AR module here
|
|
1411
1403
|
// we are in Safari/Quicklook mode here
|
|
1412
1404
|
if (!(util_1.Util.isSafari() || util_1.Util.isChromeOnIOS())) {
|
|
1413
|
-
_context6.
|
|
1405
|
+
_context6.n = 8;
|
|
1414
1406
|
break;
|
|
1415
1407
|
}
|
|
1416
1408
|
if (!(sceneOpt.anchor === "face")) {
|
|
1417
|
-
_context6.
|
|
1409
|
+
_context6.n = 5;
|
|
1418
1410
|
break;
|
|
1419
1411
|
}
|
|
1420
1412
|
if (!util_1.Util.canRealityViewer()) {
|
|
1421
|
-
_context6.
|
|
1413
|
+
_context6.n = 4;
|
|
1422
1414
|
break;
|
|
1423
1415
|
}
|
|
1424
|
-
_context6.
|
|
1416
|
+
_context6.n = 3;
|
|
1425
1417
|
return this._Compose("vto");
|
|
1426
|
-
case
|
|
1427
|
-
modelUrl = _context6.
|
|
1418
|
+
case 3:
|
|
1419
|
+
modelUrl = _context6.v;
|
|
1428
1420
|
this._ar = new quicklook_viewer_1["default"]();
|
|
1429
1421
|
this._ar.modelUrl = modelUrl;
|
|
1430
1422
|
this._ar.banner = this.options.banner;
|
|
1431
|
-
return _context6.
|
|
1432
|
-
case
|
|
1423
|
+
return _context6.a(2, this);
|
|
1424
|
+
case 4:
|
|
1433
1425
|
throw new Error("SceneGraphAR.init() - cannot proceed as VTO AR requires Reality Viewer support");
|
|
1434
|
-
case
|
|
1426
|
+
case 5:
|
|
1435
1427
|
if (!util_1.Util.canQuicklook()) {
|
|
1436
|
-
_context6.
|
|
1428
|
+
_context6.n = 7;
|
|
1437
1429
|
break;
|
|
1438
1430
|
}
|
|
1439
|
-
_context6.
|
|
1431
|
+
_context6.n = 6;
|
|
1440
1432
|
return this._Compose("usdz");
|
|
1441
|
-
case
|
|
1442
|
-
_modelUrl3 = _context6.
|
|
1433
|
+
case 6:
|
|
1434
|
+
_modelUrl3 = _context6.v;
|
|
1443
1435
|
this._ar = new quicklook_viewer_1["default"]();
|
|
1444
1436
|
this._ar.modelUrl = _modelUrl3;
|
|
1445
1437
|
this._ar.banner = this.options.banner;
|
|
1446
|
-
return _context6.
|
|
1447
|
-
case
|
|
1438
|
+
return _context6.a(2, this);
|
|
1439
|
+
case 7:
|
|
1448
1440
|
throw new Error("SceneGraphAR.init() - cannot proceed as IOS device does not support AR Mode");
|
|
1449
|
-
case
|
|
1441
|
+
case 8:
|
|
1450
1442
|
if (!util_1.Util.canSceneViewer()) {
|
|
1451
|
-
_context6.
|
|
1443
|
+
_context6.n = 10;
|
|
1452
1444
|
break;
|
|
1453
1445
|
}
|
|
1454
|
-
_context6.
|
|
1446
|
+
_context6.n = 9;
|
|
1455
1447
|
return this._Compose("glb");
|
|
1456
|
-
case
|
|
1457
|
-
_modelUrl4 = _context6.
|
|
1448
|
+
case 9:
|
|
1449
|
+
_modelUrl4 = _context6.v;
|
|
1458
1450
|
arviewer = new scene_viewer_1["default"]();
|
|
1459
1451
|
arviewer.modelUrl = _modelUrl4;
|
|
1460
1452
|
arviewer.isVertical = this.options.anchor === "vertical" ? true : false;
|
|
@@ -1463,12 +1455,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1463
1455
|
arviewer.isVertical = true;
|
|
1464
1456
|
}
|
|
1465
1457
|
this._ar = arviewer;
|
|
1466
|
-
return _context6.
|
|
1467
|
-
case
|
|
1458
|
+
return _context6.a(2, this);
|
|
1459
|
+
case 10:
|
|
1468
1460
|
throw new Error("SceneGraphAR.init() - could not initialise AR correctly, check values");
|
|
1469
|
-
case
|
|
1470
|
-
|
|
1471
|
-
return _context6.stop();
|
|
1461
|
+
case 11:
|
|
1462
|
+
return _context6.a(2);
|
|
1472
1463
|
}
|
|
1473
1464
|
}, _callee6, this);
|
|
1474
1465
|
}));
|
|
@@ -1619,21 +1610,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1619
1610
|
return _createClass(ConfiguratorController, [{
|
|
1620
1611
|
key: "getConfiguratorState",
|
|
1621
1612
|
value: function () {
|
|
1622
|
-
var _getConfiguratorState = _asyncToGenerator(/*#__PURE__*/
|
|
1623
|
-
return
|
|
1624
|
-
while (1) switch (_context7.
|
|
1613
|
+
var _getConfiguratorState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
1614
|
+
return _regenerator().w(function (_context7) {
|
|
1615
|
+
while (1) switch (_context7.n) {
|
|
1625
1616
|
case 0:
|
|
1626
1617
|
if (!this._cachedConfigState) {
|
|
1627
|
-
_context7.
|
|
1618
|
+
_context7.n = 1;
|
|
1628
1619
|
break;
|
|
1629
1620
|
}
|
|
1630
|
-
return _context7.
|
|
1631
|
-
case
|
|
1621
|
+
return _context7.a(2, this._cachedConfigState);
|
|
1622
|
+
case 1:
|
|
1632
1623
|
this._cachedConfigState = this.createConfiguratorState();
|
|
1633
|
-
return _context7.
|
|
1634
|
-
case 4:
|
|
1635
|
-
case "end":
|
|
1636
|
-
return _context7.stop();
|
|
1624
|
+
return _context7.a(2, this._cachedConfigState);
|
|
1637
1625
|
}
|
|
1638
1626
|
}, _callee7, this);
|
|
1639
1627
|
}));
|
|
@@ -1645,86 +1633,83 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1645
1633
|
}, {
|
|
1646
1634
|
key: "onAttributesUpdated",
|
|
1647
1635
|
value: function () {
|
|
1648
|
-
var _onAttributesUpdated = _asyncToGenerator(/*#__PURE__*/
|
|
1636
|
+
var _onAttributesUpdated = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(attributeName) {
|
|
1649
1637
|
var state, viewer, variationIDs, variationIDsList, variationSKUs, variationSKUList, configState, _variationIDs, _variationIDsList, _configState, _variationSKUs, _variationSKUList;
|
|
1650
|
-
return
|
|
1651
|
-
while (1) switch (_context8.
|
|
1638
|
+
return _regenerator().w(function (_context8) {
|
|
1639
|
+
while (1) switch (_context8.n) {
|
|
1652
1640
|
case 0:
|
|
1653
1641
|
state = this._state;
|
|
1654
1642
|
if (!(state === plattar_controller_1.ControllerState.Renderer)) {
|
|
1655
|
-
_context8.
|
|
1643
|
+
_context8.n = 3;
|
|
1656
1644
|
break;
|
|
1657
1645
|
}
|
|
1658
1646
|
viewer = this.element;
|
|
1659
1647
|
if (!viewer) {
|
|
1660
|
-
_context8.
|
|
1648
|
+
_context8.n = 2;
|
|
1661
1649
|
break;
|
|
1662
1650
|
}
|
|
1663
1651
|
if (!(attributeName === "variation-id")) {
|
|
1664
|
-
_context8.
|
|
1652
|
+
_context8.n = 1;
|
|
1665
1653
|
break;
|
|
1666
1654
|
}
|
|
1667
1655
|
variationIDs = this.getAttribute("variation-id");
|
|
1668
1656
|
variationIDsList = variationIDs ? variationIDs.split(",") : [];
|
|
1669
1657
|
if (!(variationIDsList.length > 0)) {
|
|
1670
|
-
_context8.
|
|
1658
|
+
_context8.n = 1;
|
|
1671
1659
|
break;
|
|
1672
1660
|
}
|
|
1673
|
-
_context8.
|
|
1661
|
+
_context8.n = 1;
|
|
1674
1662
|
return viewer.messenger.selectVariationID(variationIDsList);
|
|
1675
|
-
case
|
|
1663
|
+
case 1:
|
|
1676
1664
|
if (!(attributeName === "variation-sku")) {
|
|
1677
|
-
_context8.
|
|
1665
|
+
_context8.n = 2;
|
|
1678
1666
|
break;
|
|
1679
1667
|
}
|
|
1680
1668
|
variationSKUs = this.getAttribute("variation-sku");
|
|
1681
1669
|
variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
1682
1670
|
if (!(variationSKUList.length > 0)) {
|
|
1683
|
-
_context8.
|
|
1671
|
+
_context8.n = 2;
|
|
1684
1672
|
break;
|
|
1685
1673
|
}
|
|
1686
|
-
_context8.
|
|
1674
|
+
_context8.n = 2;
|
|
1687
1675
|
return viewer.messenger.selectVariationSKU(variationSKUList);
|
|
1688
|
-
case
|
|
1689
|
-
return _context8.
|
|
1690
|
-
case
|
|
1676
|
+
case 2:
|
|
1677
|
+
return _context8.a(2);
|
|
1678
|
+
case 3:
|
|
1691
1679
|
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
1692
|
-
_context8.
|
|
1680
|
+
_context8.n = 8;
|
|
1693
1681
|
break;
|
|
1694
1682
|
}
|
|
1695
1683
|
if (!(attributeName === "variation-id")) {
|
|
1696
|
-
_context8.
|
|
1684
|
+
_context8.n = 5;
|
|
1697
1685
|
break;
|
|
1698
1686
|
}
|
|
1699
|
-
_context8.
|
|
1687
|
+
_context8.n = 4;
|
|
1700
1688
|
return this.getConfiguratorState();
|
|
1701
|
-
case
|
|
1702
|
-
configState = _context8.
|
|
1689
|
+
case 4:
|
|
1690
|
+
configState = _context8.v;
|
|
1703
1691
|
_variationIDs = this.getAttribute("variation-id");
|
|
1704
1692
|
_variationIDsList = _variationIDs ? _variationIDs.split(",") : [];
|
|
1705
1693
|
_variationIDsList.forEach(function (variationID) {
|
|
1706
1694
|
configState.state.setVariationID(variationID);
|
|
1707
1695
|
});
|
|
1708
|
-
case
|
|
1696
|
+
case 5:
|
|
1709
1697
|
if (!(attributeName === "variation-sku")) {
|
|
1710
|
-
_context8.
|
|
1698
|
+
_context8.n = 7;
|
|
1711
1699
|
break;
|
|
1712
1700
|
}
|
|
1713
|
-
_context8.
|
|
1701
|
+
_context8.n = 6;
|
|
1714
1702
|
return this.getConfiguratorState();
|
|
1715
|
-
case
|
|
1716
|
-
_configState = _context8.
|
|
1703
|
+
case 6:
|
|
1704
|
+
_configState = _context8.v;
|
|
1717
1705
|
_variationSKUs = this.getAttribute("variation-sku");
|
|
1718
1706
|
_variationSKUList = _variationSKUs ? _variationSKUs.split(",") : [];
|
|
1719
1707
|
_variationSKUList.forEach(function (variationSKU) {
|
|
1720
1708
|
_configState.state.setVariationSKU(variationSKU);
|
|
1721
1709
|
});
|
|
1722
|
-
case
|
|
1710
|
+
case 7:
|
|
1723
1711
|
this.startQRCode(this._prevQROpt);
|
|
1724
|
-
return _context8.
|
|
1725
|
-
case 34:
|
|
1726
|
-
case "end":
|
|
1727
|
-
return _context8.stop();
|
|
1712
|
+
return _context8.a(2);
|
|
1728
1713
|
}
|
|
1729
1714
|
}, _callee8, this);
|
|
1730
1715
|
}));
|
|
@@ -1736,21 +1721,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1736
1721
|
}, {
|
|
1737
1722
|
key: "startARQRCode",
|
|
1738
1723
|
value: function () {
|
|
1739
|
-
var _startARQRCode = _asyncToGenerator(/*#__PURE__*/
|
|
1740
|
-
var dState, product, controller;
|
|
1741
|
-
return
|
|
1742
|
-
while (1) switch (_context9.
|
|
1724
|
+
var _startARQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(options) {
|
|
1725
|
+
var dState, product, controller, _t3;
|
|
1726
|
+
return _regenerator().w(function (_context9) {
|
|
1727
|
+
while (1) switch (_context9.n) {
|
|
1743
1728
|
case 0:
|
|
1744
|
-
_context9.
|
|
1745
|
-
_context9.
|
|
1729
|
+
_context9.p = 0;
|
|
1730
|
+
_context9.n = 1;
|
|
1746
1731
|
return this.getConfiguratorState();
|
|
1747
|
-
case
|
|
1748
|
-
dState = _context9.
|
|
1732
|
+
case 1:
|
|
1733
|
+
dState = _context9.v;
|
|
1749
1734
|
// if this is declared, we have a furniture scene that we need to re-create the embed
|
|
1750
1735
|
// with new attributes
|
|
1751
1736
|
product = dState.state.firstOfType("product");
|
|
1752
1737
|
if (!product) {
|
|
1753
|
-
_context9.
|
|
1738
|
+
_context9.n = 3;
|
|
1754
1739
|
break;
|
|
1755
1740
|
}
|
|
1756
1741
|
this.parent.lockObserver();
|
|
@@ -1760,25 +1745,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1760
1745
|
this.parent.unlockObserver();
|
|
1761
1746
|
controller = this.parent.create();
|
|
1762
1747
|
if (!controller) {
|
|
1763
|
-
_context9.
|
|
1748
|
+
_context9.n = 2;
|
|
1764
1749
|
break;
|
|
1765
1750
|
}
|
|
1766
|
-
return _context9.
|
|
1767
|
-
case
|
|
1768
|
-
return _context9.
|
|
1769
|
-
case
|
|
1770
|
-
_context9.
|
|
1751
|
+
return _context9.a(2, controller.startARQRCode(options));
|
|
1752
|
+
case 2:
|
|
1753
|
+
return _context9.a(2, Promise.reject(new Error("ConfiguratorController.startARQRCode() - legacy product transition failed")));
|
|
1754
|
+
case 3:
|
|
1755
|
+
_context9.n = 5;
|
|
1771
1756
|
break;
|
|
1772
|
-
case
|
|
1773
|
-
_context9.
|
|
1774
|
-
|
|
1775
|
-
case
|
|
1776
|
-
return _context9.
|
|
1777
|
-
case 20:
|
|
1778
|
-
case "end":
|
|
1779
|
-
return _context9.stop();
|
|
1757
|
+
case 4:
|
|
1758
|
+
_context9.p = 4;
|
|
1759
|
+
_t3 = _context9.v;
|
|
1760
|
+
case 5:
|
|
1761
|
+
return _context9.a(2, _superPropGet(ConfiguratorController, "startARQRCode", this, 3)([options]));
|
|
1780
1762
|
}
|
|
1781
|
-
}, _callee9, this, [[0,
|
|
1763
|
+
}, _callee9, this, [[0, 4]]);
|
|
1782
1764
|
}));
|
|
1783
1765
|
function startARQRCode(_x4) {
|
|
1784
1766
|
return _startARQRCode.apply(this, arguments);
|
|
@@ -1788,33 +1770,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1788
1770
|
}, {
|
|
1789
1771
|
key: "startViewerQRCode",
|
|
1790
1772
|
value: function () {
|
|
1791
|
-
var _startViewerQRCode = _asyncToGenerator(/*#__PURE__*/
|
|
1773
|
+
var _startViewerQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
|
|
1792
1774
|
var _this14 = this;
|
|
1793
|
-
var sceneID, configState, dState, product, controller, opt, viewer, width, height, dst, showAR, showUI, showBanner, sceneGraphID;
|
|
1794
|
-
return
|
|
1795
|
-
while (1) switch (_context0.
|
|
1775
|
+
var sceneID, configState, dState, product, controller, opt, viewer, width, height, dst, showAR, showUI, showBanner, sceneGraphID, _t4;
|
|
1776
|
+
return _regenerator().w(function (_context0) {
|
|
1777
|
+
while (1) switch (_context0.n) {
|
|
1796
1778
|
case 0:
|
|
1797
1779
|
// remove the old renderer instance if any
|
|
1798
1780
|
this.removeRenderer();
|
|
1799
1781
|
sceneID = this.getAttribute("scene-id");
|
|
1800
1782
|
if (sceneID) {
|
|
1801
|
-
_context0.
|
|
1783
|
+
_context0.n = 1;
|
|
1802
1784
|
break;
|
|
1803
1785
|
}
|
|
1804
1786
|
throw new Error("ConfiguratorController.startViewerQRCode() - minimum required attributes not set, use scene-id as a minimum");
|
|
1805
|
-
case
|
|
1787
|
+
case 1:
|
|
1806
1788
|
// optional attributes
|
|
1807
1789
|
configState = null;
|
|
1808
|
-
_context0.
|
|
1809
|
-
_context0.
|
|
1790
|
+
_context0.p = 2;
|
|
1791
|
+
_context0.n = 3;
|
|
1810
1792
|
return this.getConfiguratorState();
|
|
1811
|
-
case
|
|
1812
|
-
dState = _context0.
|
|
1793
|
+
case 3:
|
|
1794
|
+
dState = _context0.v;
|
|
1813
1795
|
// if this is declared, we have a furniture scene that we need to re-create the embed
|
|
1814
1796
|
// with new attributes
|
|
1815
1797
|
product = dState.state.firstOfType("product");
|
|
1816
1798
|
if (!product) {
|
|
1817
|
-
_context0.
|
|
1799
|
+
_context0.n = 5;
|
|
1818
1800
|
break;
|
|
1819
1801
|
}
|
|
1820
1802
|
this.parent.lockObserver();
|
|
@@ -1824,22 +1806,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1824
1806
|
this.parent.unlockObserver();
|
|
1825
1807
|
controller = this.parent.create();
|
|
1826
1808
|
if (!controller) {
|
|
1827
|
-
_context0.
|
|
1809
|
+
_context0.n = 4;
|
|
1828
1810
|
break;
|
|
1829
1811
|
}
|
|
1830
|
-
return _context0.
|
|
1831
|
-
case
|
|
1832
|
-
return _context0.
|
|
1833
|
-
case
|
|
1812
|
+
return _context0.a(2, controller.startViewerQRCode(options));
|
|
1813
|
+
case 4:
|
|
1814
|
+
return _context0.a(2, Promise.reject(new Error("ConfiguratorController.startViewerQRCode() - legacy product transition failed")));
|
|
1815
|
+
case 5:
|
|
1834
1816
|
configState = dState.state.encode();
|
|
1835
|
-
_context0.
|
|
1817
|
+
_context0.n = 7;
|
|
1836
1818
|
break;
|
|
1837
|
-
case
|
|
1838
|
-
_context0.
|
|
1839
|
-
|
|
1819
|
+
case 6:
|
|
1820
|
+
_context0.p = 6;
|
|
1821
|
+
_t4 = _context0.v;
|
|
1840
1822
|
// config state is not available
|
|
1841
1823
|
configState = null;
|
|
1842
|
-
case
|
|
1824
|
+
case 7:
|
|
1843
1825
|
opt = options || this._GetDefaultQROptions();
|
|
1844
1826
|
viewer = document.createElement("plattar-qrcode");
|
|
1845
1827
|
this._element = viewer;
|
|
@@ -1881,17 +1863,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1881
1863
|
viewer.setAttribute("url", opt.url || dst);
|
|
1882
1864
|
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
1883
1865
|
this._prevQROpt = opt;
|
|
1884
|
-
return _context0.
|
|
1866
|
+
return _context0.a(2, new Promise(function (accept, reject) {
|
|
1885
1867
|
viewer.onload = function () {
|
|
1886
1868
|
return accept(viewer);
|
|
1887
1869
|
};
|
|
1888
1870
|
_this14.append(viewer);
|
|
1889
1871
|
}));
|
|
1890
|
-
case 51:
|
|
1891
|
-
case "end":
|
|
1892
|
-
return _context0.stop();
|
|
1893
1872
|
}
|
|
1894
|
-
}, _callee0, this, [[
|
|
1873
|
+
}, _callee0, this, [[2, 6]]);
|
|
1895
1874
|
}));
|
|
1896
1875
|
function startViewerQRCode(_x5) {
|
|
1897
1876
|
return _startViewerQRCode.apply(this, arguments);
|
|
@@ -1901,34 +1880,34 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1901
1880
|
}, {
|
|
1902
1881
|
key: "startRenderer",
|
|
1903
1882
|
value: function () {
|
|
1904
|
-
var _startRenderer = _asyncToGenerator(/*#__PURE__*/
|
|
1883
|
+
var _startRenderer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
1905
1884
|
var _this15 = this;
|
|
1906
|
-
var sceneID, configState, dState, product, controller, width, height, server, viewer, showAR, showUI, encodedState;
|
|
1907
|
-
return
|
|
1908
|
-
while (1) switch (_context1.
|
|
1885
|
+
var sceneID, configState, dState, product, controller, width, height, server, viewer, showAR, showUI, encodedState, _t5;
|
|
1886
|
+
return _regenerator().w(function (_context1) {
|
|
1887
|
+
while (1) switch (_context1.n) {
|
|
1909
1888
|
case 0:
|
|
1910
1889
|
// remove the old renderer instance if any
|
|
1911
1890
|
this.removeRenderer();
|
|
1912
1891
|
sceneID = this.getAttribute("scene-id");
|
|
1913
1892
|
if (sceneID) {
|
|
1914
|
-
_context1.
|
|
1893
|
+
_context1.n = 1;
|
|
1915
1894
|
break;
|
|
1916
1895
|
}
|
|
1917
1896
|
throw new Error("ConfiguratorController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
|
|
1918
|
-
case
|
|
1897
|
+
case 1:
|
|
1919
1898
|
// optional attributes
|
|
1920
1899
|
configState = null;
|
|
1921
1900
|
this._state = plattar_controller_1.ControllerState.Renderer;
|
|
1922
|
-
_context1.
|
|
1923
|
-
_context1.
|
|
1901
|
+
_context1.p = 2;
|
|
1902
|
+
_context1.n = 3;
|
|
1924
1903
|
return this.getConfiguratorState();
|
|
1925
|
-
case
|
|
1926
|
-
dState = _context1.
|
|
1904
|
+
case 3:
|
|
1905
|
+
dState = _context1.v;
|
|
1927
1906
|
// if this is declared, we have a furniture scene that we need to re-create the embed
|
|
1928
1907
|
// with new attributes
|
|
1929
1908
|
product = dState.state.firstOfType("product");
|
|
1930
1909
|
if (!product) {
|
|
1931
|
-
_context1.
|
|
1910
|
+
_context1.n = 5;
|
|
1932
1911
|
break;
|
|
1933
1912
|
}
|
|
1934
1913
|
this.parent.lockObserver();
|
|
@@ -1938,22 +1917,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1938
1917
|
this.parent.unlockObserver();
|
|
1939
1918
|
controller = this.parent.create();
|
|
1940
1919
|
if (!controller) {
|
|
1941
|
-
_context1.
|
|
1920
|
+
_context1.n = 4;
|
|
1942
1921
|
break;
|
|
1943
1922
|
}
|
|
1944
|
-
return _context1.
|
|
1945
|
-
case
|
|
1946
|
-
return _context1.
|
|
1947
|
-
case
|
|
1923
|
+
return _context1.a(2, controller.startRenderer());
|
|
1924
|
+
case 4:
|
|
1925
|
+
return _context1.a(2, Promise.reject(new Error("ConfiguratorController.startRenderer() - legacy product transition failed")));
|
|
1926
|
+
case 5:
|
|
1948
1927
|
configState = dState;
|
|
1949
|
-
_context1.
|
|
1928
|
+
_context1.n = 7;
|
|
1950
1929
|
break;
|
|
1951
|
-
case
|
|
1952
|
-
_context1.
|
|
1953
|
-
|
|
1930
|
+
case 6:
|
|
1931
|
+
_context1.p = 6;
|
|
1932
|
+
_t5 = _context1.v;
|
|
1954
1933
|
// config state is not available
|
|
1955
1934
|
configState = null;
|
|
1956
|
-
case
|
|
1935
|
+
case 7:
|
|
1957
1936
|
// required attributes with defaults for plattar-configurator node
|
|
1958
1937
|
width = this.getAttribute("width") || "500px";
|
|
1959
1938
|
height = this.getAttribute("height") || "500px";
|
|
@@ -1978,18 +1957,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1978
1957
|
if (showUI) {
|
|
1979
1958
|
viewer.setAttribute("show-ui", showUI);
|
|
1980
1959
|
}
|
|
1981
|
-
return _context1.
|
|
1960
|
+
return _context1.a(2, new Promise(function (accept, reject) {
|
|
1982
1961
|
_this15.append(viewer);
|
|
1983
1962
|
if (configState) {
|
|
1984
1963
|
_this15.setupMessengerObservers(viewer, configState);
|
|
1985
1964
|
}
|
|
1986
1965
|
return accept(viewer);
|
|
1987
1966
|
}));
|
|
1988
|
-
case 42:
|
|
1989
|
-
case "end":
|
|
1990
|
-
return _context1.stop();
|
|
1991
1967
|
}
|
|
1992
|
-
}, _callee1, this, [[
|
|
1968
|
+
}, _callee1, this, [[2, 6]]);
|
|
1993
1969
|
}));
|
|
1994
1970
|
function startRenderer() {
|
|
1995
1971
|
return _startRenderer.apply(this, arguments);
|
|
@@ -1999,27 +1975,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1999
1975
|
}, {
|
|
2000
1976
|
key: "initAR",
|
|
2001
1977
|
value: function () {
|
|
2002
|
-
var _initAR = _asyncToGenerator(/*#__PURE__*/
|
|
2003
|
-
var dState, product, controller, arMode;
|
|
2004
|
-
return
|
|
2005
|
-
while (1) switch (_context10.
|
|
1978
|
+
var _initAR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
1979
|
+
var dState, product, controller, arMode, _t6, _t7;
|
|
1980
|
+
return _regenerator().w(function (_context10) {
|
|
1981
|
+
while (1) switch (_context10.n) {
|
|
2006
1982
|
case 0:
|
|
2007
1983
|
if (util_1.Util.canAugment()) {
|
|
2008
|
-
_context10.
|
|
1984
|
+
_context10.n = 1;
|
|
2009
1985
|
break;
|
|
2010
1986
|
}
|
|
2011
1987
|
throw new Error("ConfiguratorController.initAR() - cannot proceed as AR not available in context");
|
|
2012
|
-
case
|
|
2013
|
-
_context10.
|
|
2014
|
-
_context10.
|
|
1988
|
+
case 1:
|
|
1989
|
+
_context10.p = 1;
|
|
1990
|
+
_context10.n = 2;
|
|
2015
1991
|
return this.getConfiguratorState();
|
|
2016
|
-
case
|
|
2017
|
-
dState = _context10.
|
|
1992
|
+
case 2:
|
|
1993
|
+
dState = _context10.v;
|
|
2018
1994
|
// if this is declared, we have a furniture scene that we need to re-create the embed
|
|
2019
1995
|
// with new attributes
|
|
2020
1996
|
product = dState.state.firstOfType("product");
|
|
2021
1997
|
if (!product) {
|
|
2022
|
-
_context10.
|
|
1998
|
+
_context10.n = 4;
|
|
2023
1999
|
break;
|
|
2024
2000
|
}
|
|
2025
2001
|
this.parent.lockObserver();
|
|
@@ -2029,32 +2005,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2029
2005
|
this.parent.unlockObserver();
|
|
2030
2006
|
controller = this.parent.create();
|
|
2031
2007
|
if (!controller) {
|
|
2032
|
-
_context10.
|
|
2008
|
+
_context10.n = 3;
|
|
2033
2009
|
break;
|
|
2034
2010
|
}
|
|
2035
|
-
return _context10.
|
|
2036
|
-
case
|
|
2037
|
-
return _context10.
|
|
2038
|
-
case
|
|
2039
|
-
_context10.
|
|
2011
|
+
return _context10.a(2, controller.initAR());
|
|
2012
|
+
case 3:
|
|
2013
|
+
return _context10.a(2, Promise.reject(new Error("ConfiguratorController.initAR() - legacy product transition failed")));
|
|
2014
|
+
case 4:
|
|
2015
|
+
_context10.n = 6;
|
|
2040
2016
|
break;
|
|
2041
|
-
case
|
|
2042
|
-
_context10.
|
|
2043
|
-
|
|
2044
|
-
case
|
|
2017
|
+
case 5:
|
|
2018
|
+
_context10.p = 5;
|
|
2019
|
+
_t6 = _context10.v;
|
|
2020
|
+
case 6:
|
|
2045
2021
|
arMode = this.getAttribute("ar-mode") || "generated";
|
|
2046
|
-
|
|
2047
|
-
_context10.
|
|
2022
|
+
_t7 = arMode.toLowerCase();
|
|
2023
|
+
_context10.n = _t7 === "inherited" ? 7 : _t7 === "generated" ? 8 : 8;
|
|
2048
2024
|
break;
|
|
2049
|
-
case
|
|
2050
|
-
return _context10.
|
|
2051
|
-
case
|
|
2052
|
-
return _context10.
|
|
2053
|
-
case 27:
|
|
2054
|
-
case "end":
|
|
2055
|
-
return _context10.stop();
|
|
2025
|
+
case 7:
|
|
2026
|
+
return _context10.a(2, this._InitARInherited());
|
|
2027
|
+
case 8:
|
|
2028
|
+
return _context10.a(2, this._InitARGenerated());
|
|
2056
2029
|
}
|
|
2057
|
-
}, _callee10, this, [[
|
|
2030
|
+
}, _callee10, this, [[1, 5]]);
|
|
2058
2031
|
}));
|
|
2059
2032
|
function initAR() {
|
|
2060
2033
|
return _initAR.apply(this, arguments);
|
|
@@ -2067,25 +2040,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2067
2040
|
}, {
|
|
2068
2041
|
key: "_InitARInherited",
|
|
2069
2042
|
value: (function () {
|
|
2070
|
-
var _InitARInherited2 = _asyncToGenerator(/*#__PURE__*/
|
|
2043
|
+
var _InitARInherited2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
2071
2044
|
var sceneID, state, first, sceneProductAR;
|
|
2072
|
-
return
|
|
2073
|
-
while (1) switch (_context11.
|
|
2045
|
+
return _regenerator().w(function (_context11) {
|
|
2046
|
+
while (1) switch (_context11.n) {
|
|
2074
2047
|
case 0:
|
|
2075
2048
|
sceneID = this.getAttribute("scene-id");
|
|
2076
2049
|
if (sceneID) {
|
|
2077
|
-
_context11.
|
|
2050
|
+
_context11.n = 1;
|
|
2078
2051
|
break;
|
|
2079
2052
|
}
|
|
2080
2053
|
throw new Error("ConfiguratorController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
|
|
2081
|
-
case
|
|
2082
|
-
_context11.
|
|
2054
|
+
case 1:
|
|
2055
|
+
_context11.n = 2;
|
|
2083
2056
|
return this.getConfiguratorState();
|
|
2084
|
-
case
|
|
2085
|
-
state = _context11.
|
|
2057
|
+
case 2:
|
|
2058
|
+
state = _context11.v.state;
|
|
2086
2059
|
first = state.firstActiveOfType("sceneproduct");
|
|
2087
2060
|
if (!first) {
|
|
2088
|
-
_context11.
|
|
2061
|
+
_context11.n = 3;
|
|
2089
2062
|
break;
|
|
2090
2063
|
}
|
|
2091
2064
|
//const sceneProductAR: SceneProductAR = new SceneProductAR(first.scene_product_id, first.product_variation_id);
|
|
@@ -2095,12 +2068,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2095
2068
|
variationSKU: null,
|
|
2096
2069
|
useARBanner: this.getBooleanAttribute("show-ar-banner")
|
|
2097
2070
|
});
|
|
2098
|
-
return _context11.
|
|
2099
|
-
case
|
|
2071
|
+
return _context11.a(2, sceneProductAR.init());
|
|
2072
|
+
case 3:
|
|
2100
2073
|
throw new Error("ConfiguratorController.initAR() - invalid decoded config-state does not have any product states");
|
|
2101
|
-
case
|
|
2102
|
-
|
|
2103
|
-
return _context11.stop();
|
|
2074
|
+
case 4:
|
|
2075
|
+
return _context11.a(2);
|
|
2104
2076
|
}
|
|
2105
2077
|
}, _callee11, this);
|
|
2106
2078
|
}));
|
|
@@ -2116,21 +2088,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2116
2088
|
}, {
|
|
2117
2089
|
key: "_InitARGenerated",
|
|
2118
2090
|
value: (function () {
|
|
2119
|
-
var _InitARGenerated2 = _asyncToGenerator(/*#__PURE__*/
|
|
2120
|
-
var sceneID, graphID, _configAR, configAR;
|
|
2121
|
-
return
|
|
2122
|
-
while (1) switch (_context12.
|
|
2091
|
+
var _InitARGenerated2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
2092
|
+
var sceneID, graphID, _configAR, configAR, _t8, _t9, _t0, _t1;
|
|
2093
|
+
return _regenerator().w(function (_context12) {
|
|
2094
|
+
while (1) switch (_context12.n) {
|
|
2123
2095
|
case 0:
|
|
2124
2096
|
sceneID = this.getAttribute("scene-id");
|
|
2125
2097
|
if (sceneID) {
|
|
2126
|
-
_context12.
|
|
2098
|
+
_context12.n = 1;
|
|
2127
2099
|
break;
|
|
2128
2100
|
}
|
|
2129
2101
|
throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
|
|
2130
|
-
case
|
|
2102
|
+
case 1:
|
|
2131
2103
|
graphID = this.getAttribute("scene-graph-id"); // use the scene-graph route if available
|
|
2132
2104
|
if (!graphID) {
|
|
2133
|
-
_context12.
|
|
2105
|
+
_context12.n = 2;
|
|
2134
2106
|
break;
|
|
2135
2107
|
}
|
|
2136
2108
|
_configAR = new scene_graph_ar_1.SceneGraphAR({
|
|
@@ -2138,23 +2110,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2138
2110
|
id: graphID,
|
|
2139
2111
|
sceneID: sceneID
|
|
2140
2112
|
});
|
|
2141
|
-
return _context12.
|
|
2142
|
-
case
|
|
2143
|
-
|
|
2144
|
-
_context12.
|
|
2113
|
+
return _context12.a(2, _configAR.init());
|
|
2114
|
+
case 2:
|
|
2115
|
+
_t8 = configurator_ar_1.ConfiguratorAR;
|
|
2116
|
+
_context12.n = 3;
|
|
2145
2117
|
return this.getConfiguratorState();
|
|
2146
|
-
case
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
state:
|
|
2151
|
-
useARBanner:
|
|
2118
|
+
case 3:
|
|
2119
|
+
_t9 = _context12.v;
|
|
2120
|
+
_t0 = this.getBooleanAttribute("show-ar-banner");
|
|
2121
|
+
_t1 = {
|
|
2122
|
+
state: _t9,
|
|
2123
|
+
useARBanner: _t0
|
|
2152
2124
|
};
|
|
2153
|
-
configAR = new
|
|
2154
|
-
return _context12.
|
|
2155
|
-
case 15:
|
|
2156
|
-
case "end":
|
|
2157
|
-
return _context12.stop();
|
|
2125
|
+
configAR = new _t8(_t1);
|
|
2126
|
+
return _context12.a(2, configAR.init());
|
|
2158
2127
|
}
|
|
2159
2128
|
}, _callee12, this);
|
|
2160
2129
|
}));
|
|
@@ -2203,21 +2172,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2203
2172
|
return _createClass(GalleryController, [{
|
|
2204
2173
|
key: "getConfiguratorState",
|
|
2205
2174
|
value: function () {
|
|
2206
|
-
var _getConfiguratorState2 = _asyncToGenerator(/*#__PURE__*/
|
|
2207
|
-
return
|
|
2208
|
-
while (1) switch (_context13.
|
|
2175
|
+
var _getConfiguratorState2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
2176
|
+
return _regenerator().w(function (_context13) {
|
|
2177
|
+
while (1) switch (_context13.n) {
|
|
2209
2178
|
case 0:
|
|
2210
2179
|
if (!this._cachedConfigState) {
|
|
2211
|
-
_context13.
|
|
2180
|
+
_context13.n = 1;
|
|
2212
2181
|
break;
|
|
2213
2182
|
}
|
|
2214
|
-
return _context13.
|
|
2215
|
-
case
|
|
2183
|
+
return _context13.a(2, this._cachedConfigState);
|
|
2184
|
+
case 1:
|
|
2216
2185
|
this._cachedConfigState = this.createConfiguratorState();
|
|
2217
|
-
return _context13.
|
|
2218
|
-
case 4:
|
|
2219
|
-
case "end":
|
|
2220
|
-
return _context13.stop();
|
|
2186
|
+
return _context13.a(2, this._cachedConfigState);
|
|
2221
2187
|
}
|
|
2222
2188
|
}, _callee13, this);
|
|
2223
2189
|
}));
|
|
@@ -2229,49 +2195,46 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2229
2195
|
}, {
|
|
2230
2196
|
key: "onAttributesUpdated",
|
|
2231
2197
|
value: function () {
|
|
2232
|
-
var _onAttributesUpdated2 = _asyncToGenerator(/*#__PURE__*/
|
|
2198
|
+
var _onAttributesUpdated2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(attributeName) {
|
|
2233
2199
|
var state, configState, variationIDs, variationIDsList, _configState2, variationSKUs, variationSKUList;
|
|
2234
|
-
return
|
|
2235
|
-
while (1) switch (_context14.
|
|
2200
|
+
return _regenerator().w(function (_context14) {
|
|
2201
|
+
while (1) switch (_context14.n) {
|
|
2236
2202
|
case 0:
|
|
2237
2203
|
state = this._state; // re-render the QR Code when attributes have changed
|
|
2238
2204
|
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
2239
|
-
_context14.
|
|
2205
|
+
_context14.n = 5;
|
|
2240
2206
|
break;
|
|
2241
2207
|
}
|
|
2242
2208
|
if (!(attributeName === "variation-id")) {
|
|
2243
|
-
_context14.
|
|
2209
|
+
_context14.n = 2;
|
|
2244
2210
|
break;
|
|
2245
2211
|
}
|
|
2246
|
-
_context14.
|
|
2212
|
+
_context14.n = 1;
|
|
2247
2213
|
return this.getConfiguratorState();
|
|
2248
|
-
case
|
|
2249
|
-
configState = _context14.
|
|
2214
|
+
case 1:
|
|
2215
|
+
configState = _context14.v;
|
|
2250
2216
|
variationIDs = this.getAttribute("variation-id");
|
|
2251
2217
|
variationIDsList = variationIDs ? variationIDs.split(",") : [];
|
|
2252
2218
|
variationIDsList.forEach(function (variationID) {
|
|
2253
2219
|
configState.state.setVariationID(variationID);
|
|
2254
2220
|
});
|
|
2255
|
-
case
|
|
2221
|
+
case 2:
|
|
2256
2222
|
if (!(attributeName === "variation-sku")) {
|
|
2257
|
-
_context14.
|
|
2223
|
+
_context14.n = 4;
|
|
2258
2224
|
break;
|
|
2259
2225
|
}
|
|
2260
|
-
_context14.
|
|
2226
|
+
_context14.n = 3;
|
|
2261
2227
|
return this.getConfiguratorState();
|
|
2262
|
-
case
|
|
2263
|
-
_configState2 = _context14.
|
|
2228
|
+
case 3:
|
|
2229
|
+
_configState2 = _context14.v;
|
|
2264
2230
|
variationSKUs = this.getAttribute("variation-sku");
|
|
2265
2231
|
variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
2266
2232
|
variationSKUList.forEach(function (variationSKU) {
|
|
2267
2233
|
_configState2.state.setVariationSKU(variationSKU);
|
|
2268
2234
|
});
|
|
2269
|
-
case
|
|
2235
|
+
case 4:
|
|
2270
2236
|
this.startQRCode(this._prevQROpt);
|
|
2271
|
-
return _context14.
|
|
2272
|
-
case 18:
|
|
2273
|
-
case "end":
|
|
2274
|
-
return _context14.stop();
|
|
2237
|
+
return _context14.a(2);
|
|
2275
2238
|
}
|
|
2276
2239
|
}, _callee14, this);
|
|
2277
2240
|
}));
|
|
@@ -2283,21 +2246,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2283
2246
|
}, {
|
|
2284
2247
|
key: "startViewerQRCode",
|
|
2285
2248
|
value: function () {
|
|
2286
|
-
var _startViewerQRCode2 = _asyncToGenerator(/*#__PURE__*/
|
|
2249
|
+
var _startViewerQRCode2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(options) {
|
|
2287
2250
|
var _this17 = this;
|
|
2288
2251
|
var sceneID, opt, viewer, width, height, dst;
|
|
2289
|
-
return
|
|
2290
|
-
while (1) switch (_context15.
|
|
2252
|
+
return _regenerator().w(function (_context15) {
|
|
2253
|
+
while (1) switch (_context15.n) {
|
|
2291
2254
|
case 0:
|
|
2292
2255
|
// remove the old renderer instance if any
|
|
2293
2256
|
this.removeRenderer();
|
|
2294
2257
|
sceneID = this.getAttribute("scene-id");
|
|
2295
2258
|
if (sceneID) {
|
|
2296
|
-
_context15.
|
|
2259
|
+
_context15.n = 1;
|
|
2297
2260
|
break;
|
|
2298
2261
|
}
|
|
2299
2262
|
throw new Error("GalleryController.startViewerQRCode() - minimum required attributes not set, use scene-id as a minimum");
|
|
2300
|
-
case
|
|
2263
|
+
case 1:
|
|
2301
2264
|
opt = options || this._GetDefaultQROptions();
|
|
2302
2265
|
viewer = document.createElement("plattar-qrcode");
|
|
2303
2266
|
this._element = viewer;
|
|
@@ -2320,15 +2283,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2320
2283
|
viewer.setAttribute("url", opt.url || dst);
|
|
2321
2284
|
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
2322
2285
|
this._prevQROpt = opt;
|
|
2323
|
-
return _context15.
|
|
2286
|
+
return _context15.a(2, new Promise(function (accept, reject) {
|
|
2324
2287
|
viewer.onload = function () {
|
|
2325
2288
|
return accept(viewer);
|
|
2326
2289
|
};
|
|
2327
2290
|
_this17.append(viewer);
|
|
2328
2291
|
}));
|
|
2329
|
-
case 20:
|
|
2330
|
-
case "end":
|
|
2331
|
-
return _context15.stop();
|
|
2332
2292
|
}
|
|
2333
2293
|
}, _callee15, this);
|
|
2334
2294
|
}));
|
|
@@ -2340,21 +2300,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2340
2300
|
}, {
|
|
2341
2301
|
key: "startRenderer",
|
|
2342
2302
|
value: function () {
|
|
2343
|
-
var _startRenderer2 = _asyncToGenerator(/*#__PURE__*/
|
|
2303
|
+
var _startRenderer2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
2344
2304
|
var _this18 = this;
|
|
2345
2305
|
var sceneID, width, height, server, viewer;
|
|
2346
|
-
return
|
|
2347
|
-
while (1) switch (_context16.
|
|
2306
|
+
return _regenerator().w(function (_context16) {
|
|
2307
|
+
while (1) switch (_context16.n) {
|
|
2348
2308
|
case 0:
|
|
2349
2309
|
// remove the old renderer instance if any
|
|
2350
2310
|
this.removeRenderer();
|
|
2351
2311
|
sceneID = this.getAttribute("scene-id");
|
|
2352
2312
|
if (sceneID) {
|
|
2353
|
-
_context16.
|
|
2313
|
+
_context16.n = 1;
|
|
2354
2314
|
break;
|
|
2355
2315
|
}
|
|
2356
2316
|
throw new Error("GalleryController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
|
|
2357
|
-
case
|
|
2317
|
+
case 1:
|
|
2358
2318
|
this._state = plattar_controller_1.ControllerState.Renderer;
|
|
2359
2319
|
// required attributes with defaults for plattar-configurator node
|
|
2360
2320
|
width = this.getAttribute("width") || "500px";
|
|
@@ -2366,13 +2326,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2366
2326
|
viewer.setAttribute("height", height);
|
|
2367
2327
|
viewer.setAttribute("server", server);
|
|
2368
2328
|
viewer.setAttribute("scene-id", sceneID);
|
|
2369
|
-
return _context16.
|
|
2329
|
+
return _context16.a(2, new Promise(function (accept, reject) {
|
|
2370
2330
|
_this18.append(viewer);
|
|
2371
2331
|
return accept(viewer);
|
|
2372
2332
|
}));
|
|
2373
|
-
case 15:
|
|
2374
|
-
case "end":
|
|
2375
|
-
return _context16.stop();
|
|
2376
2333
|
}
|
|
2377
2334
|
}, _callee16, this);
|
|
2378
2335
|
}));
|
|
@@ -2384,14 +2341,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2384
2341
|
}, {
|
|
2385
2342
|
key: "initAR",
|
|
2386
2343
|
value: function () {
|
|
2387
|
-
var _initAR2 = _asyncToGenerator(/*#__PURE__*/
|
|
2388
|
-
return
|
|
2389
|
-
while (1) switch (_context17.
|
|
2344
|
+
var _initAR2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
2345
|
+
return _regenerator().w(function (_context17) {
|
|
2346
|
+
while (1) switch (_context17.n) {
|
|
2390
2347
|
case 0:
|
|
2391
2348
|
throw new Error("GalleryController.initAR() - cannot proceed as AR not available in gallery context");
|
|
2392
2349
|
case 1:
|
|
2393
|
-
|
|
2394
|
-
return _context17.stop();
|
|
2350
|
+
return _context17.a(2);
|
|
2395
2351
|
}
|
|
2396
2352
|
}, _callee17);
|
|
2397
2353
|
}));
|
|
@@ -2439,21 +2395,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2439
2395
|
return _createClass(LauncherController, [{
|
|
2440
2396
|
key: "getConfiguratorState",
|
|
2441
2397
|
value: function () {
|
|
2442
|
-
var _getConfiguratorState3 = _asyncToGenerator(/*#__PURE__*/
|
|
2443
|
-
return
|
|
2444
|
-
while (1) switch (_context18.
|
|
2398
|
+
var _getConfiguratorState3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
2399
|
+
return _regenerator().w(function (_context18) {
|
|
2400
|
+
while (1) switch (_context18.n) {
|
|
2445
2401
|
case 0:
|
|
2446
2402
|
if (!this._cachedConfigState) {
|
|
2447
|
-
_context18.
|
|
2403
|
+
_context18.n = 1;
|
|
2448
2404
|
break;
|
|
2449
2405
|
}
|
|
2450
|
-
return _context18.
|
|
2451
|
-
case
|
|
2406
|
+
return _context18.a(2, this._cachedConfigState);
|
|
2407
|
+
case 1:
|
|
2452
2408
|
this._cachedConfigState = this.createConfiguratorState();
|
|
2453
|
-
return _context18.
|
|
2454
|
-
case 4:
|
|
2455
|
-
case "end":
|
|
2456
|
-
return _context18.stop();
|
|
2409
|
+
return _context18.a(2, this._cachedConfigState);
|
|
2457
2410
|
}
|
|
2458
2411
|
}, _callee18, this);
|
|
2459
2412
|
}));
|
|
@@ -2465,49 +2418,46 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2465
2418
|
}, {
|
|
2466
2419
|
key: "onAttributesUpdated",
|
|
2467
2420
|
value: function () {
|
|
2468
|
-
var _onAttributesUpdated3 = _asyncToGenerator(/*#__PURE__*/
|
|
2421
|
+
var _onAttributesUpdated3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(attributeName) {
|
|
2469
2422
|
var state, configState, variationIDs, variationIDsList, _configState3, variationSKUs, variationSKUList;
|
|
2470
|
-
return
|
|
2471
|
-
while (1) switch (_context19.
|
|
2423
|
+
return _regenerator().w(function (_context19) {
|
|
2424
|
+
while (1) switch (_context19.n) {
|
|
2472
2425
|
case 0:
|
|
2473
2426
|
state = this._state; // re-render the QR Code when attributes have changed
|
|
2474
2427
|
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
2475
|
-
_context19.
|
|
2428
|
+
_context19.n = 5;
|
|
2476
2429
|
break;
|
|
2477
2430
|
}
|
|
2478
2431
|
if (!(attributeName === "variation-id")) {
|
|
2479
|
-
_context19.
|
|
2432
|
+
_context19.n = 2;
|
|
2480
2433
|
break;
|
|
2481
2434
|
}
|
|
2482
|
-
_context19.
|
|
2435
|
+
_context19.n = 1;
|
|
2483
2436
|
return this.getConfiguratorState();
|
|
2484
|
-
case
|
|
2485
|
-
configState = _context19.
|
|
2437
|
+
case 1:
|
|
2438
|
+
configState = _context19.v;
|
|
2486
2439
|
variationIDs = this.getAttribute("variation-id");
|
|
2487
2440
|
variationIDsList = variationIDs ? variationIDs.split(",") : [];
|
|
2488
2441
|
variationIDsList.forEach(function (variationID) {
|
|
2489
2442
|
configState.state.setVariationID(variationID);
|
|
2490
2443
|
});
|
|
2491
|
-
case
|
|
2444
|
+
case 2:
|
|
2492
2445
|
if (!(attributeName === "variation-sku")) {
|
|
2493
|
-
_context19.
|
|
2446
|
+
_context19.n = 4;
|
|
2494
2447
|
break;
|
|
2495
2448
|
}
|
|
2496
|
-
_context19.
|
|
2449
|
+
_context19.n = 3;
|
|
2497
2450
|
return this.getConfiguratorState();
|
|
2498
|
-
case
|
|
2499
|
-
_configState3 = _context19.
|
|
2451
|
+
case 3:
|
|
2452
|
+
_configState3 = _context19.v;
|
|
2500
2453
|
variationSKUs = this.getAttribute("variation-sku");
|
|
2501
2454
|
variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
2502
2455
|
variationSKUList.forEach(function (variationSKU) {
|
|
2503
2456
|
_configState3.state.setVariationSKU(variationSKU);
|
|
2504
2457
|
});
|
|
2505
|
-
case
|
|
2458
|
+
case 4:
|
|
2506
2459
|
this.startQRCode(this._prevQROpt);
|
|
2507
|
-
return _context19.
|
|
2508
|
-
case 18:
|
|
2509
|
-
case "end":
|
|
2510
|
-
return _context19.stop();
|
|
2460
|
+
return _context19.a(2);
|
|
2511
2461
|
}
|
|
2512
2462
|
}, _callee19, this);
|
|
2513
2463
|
}));
|
|
@@ -2519,21 +2469,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2519
2469
|
}, {
|
|
2520
2470
|
key: "startARQRCode",
|
|
2521
2471
|
value: function () {
|
|
2522
|
-
var _startARQRCode2 = _asyncToGenerator(/*#__PURE__*/
|
|
2523
|
-
var dState, product, controller;
|
|
2524
|
-
return
|
|
2525
|
-
while (1) switch (_context20.
|
|
2472
|
+
var _startARQRCode2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(options) {
|
|
2473
|
+
var dState, product, controller, _t10;
|
|
2474
|
+
return _regenerator().w(function (_context20) {
|
|
2475
|
+
while (1) switch (_context20.n) {
|
|
2526
2476
|
case 0:
|
|
2527
|
-
_context20.
|
|
2528
|
-
_context20.
|
|
2477
|
+
_context20.p = 0;
|
|
2478
|
+
_context20.n = 1;
|
|
2529
2479
|
return this.getConfiguratorState();
|
|
2530
|
-
case
|
|
2531
|
-
dState = _context20.
|
|
2480
|
+
case 1:
|
|
2481
|
+
dState = _context20.v;
|
|
2532
2482
|
// if this is declared, we have a furniture scene that we need to re-create the embed
|
|
2533
2483
|
// with new attributes
|
|
2534
2484
|
product = dState.state.firstOfType("product");
|
|
2535
2485
|
if (!product) {
|
|
2536
|
-
_context20.
|
|
2486
|
+
_context20.n = 3;
|
|
2537
2487
|
break;
|
|
2538
2488
|
}
|
|
2539
2489
|
this.parent.lockObserver();
|
|
@@ -2543,25 +2493,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2543
2493
|
this.parent.unlockObserver();
|
|
2544
2494
|
controller = this.parent.create();
|
|
2545
2495
|
if (!controller) {
|
|
2546
|
-
_context20.
|
|
2496
|
+
_context20.n = 2;
|
|
2547
2497
|
break;
|
|
2548
2498
|
}
|
|
2549
|
-
return _context20.
|
|
2550
|
-
case
|
|
2551
|
-
return _context20.
|
|
2552
|
-
case
|
|
2553
|
-
_context20.
|
|
2499
|
+
return _context20.a(2, controller.startARQRCode(options));
|
|
2500
|
+
case 2:
|
|
2501
|
+
return _context20.a(2, Promise.reject(new Error("LauncherController.startARQRCode() - legacy product transition failed")));
|
|
2502
|
+
case 3:
|
|
2503
|
+
_context20.n = 5;
|
|
2554
2504
|
break;
|
|
2555
|
-
case
|
|
2556
|
-
_context20.
|
|
2557
|
-
|
|
2558
|
-
case
|
|
2559
|
-
return _context20.
|
|
2560
|
-
case 20:
|
|
2561
|
-
case "end":
|
|
2562
|
-
return _context20.stop();
|
|
2505
|
+
case 4:
|
|
2506
|
+
_context20.p = 4;
|
|
2507
|
+
_t10 = _context20.v;
|
|
2508
|
+
case 5:
|
|
2509
|
+
return _context20.a(2, _superPropGet(LauncherController, "startARQRCode", this, 3)([options]));
|
|
2563
2510
|
}
|
|
2564
|
-
}, _callee20, this, [[0,
|
|
2511
|
+
}, _callee20, this, [[0, 4]]);
|
|
2565
2512
|
}));
|
|
2566
2513
|
function startARQRCode(_x9) {
|
|
2567
2514
|
return _startARQRCode2.apply(this, arguments);
|
|
@@ -2571,14 +2518,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2571
2518
|
}, {
|
|
2572
2519
|
key: "startViewerQRCode",
|
|
2573
2520
|
value: function () {
|
|
2574
|
-
var _startViewerQRCode3 = _asyncToGenerator(/*#__PURE__*/
|
|
2575
|
-
return
|
|
2576
|
-
while (1) switch (_context21.
|
|
2521
|
+
var _startViewerQRCode3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(options) {
|
|
2522
|
+
return _regenerator().w(function (_context21) {
|
|
2523
|
+
while (1) switch (_context21.n) {
|
|
2577
2524
|
case 0:
|
|
2578
|
-
return _context21.
|
|
2579
|
-
case 1:
|
|
2580
|
-
case "end":
|
|
2581
|
-
return _context21.stop();
|
|
2525
|
+
return _context21.a(2, this.startARQRCode(options));
|
|
2582
2526
|
}
|
|
2583
2527
|
}, _callee21, this);
|
|
2584
2528
|
}));
|
|
@@ -2590,25 +2534,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2590
2534
|
}, {
|
|
2591
2535
|
key: "startRenderer",
|
|
2592
2536
|
value: function () {
|
|
2593
|
-
var _startRenderer3 = _asyncToGenerator(/*#__PURE__*/
|
|
2537
|
+
var _startRenderer3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
|
|
2594
2538
|
var _this20 = this;
|
|
2595
2539
|
var sceneID, configState, qrOptions, embedType, productID, sceneProductID, variationID, variationSKU, arMode, showBanner, sceneGraphID, width, height, server, viewer, encodedState;
|
|
2596
|
-
return
|
|
2597
|
-
while (1) switch (_context22.
|
|
2540
|
+
return _regenerator().w(function (_context22) {
|
|
2541
|
+
while (1) switch (_context22.n) {
|
|
2598
2542
|
case 0:
|
|
2599
2543
|
// remove the old renderer instance if any
|
|
2600
2544
|
this.removeRenderer();
|
|
2601
2545
|
sceneID = this.getAttribute("scene-id");
|
|
2602
2546
|
if (sceneID) {
|
|
2603
|
-
_context22.
|
|
2547
|
+
_context22.n = 1;
|
|
2604
2548
|
break;
|
|
2605
2549
|
}
|
|
2606
2550
|
throw new Error("LauncherController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
|
|
2607
|
-
case
|
|
2608
|
-
_context22.
|
|
2551
|
+
case 1:
|
|
2552
|
+
_context22.n = 2;
|
|
2609
2553
|
return this.getConfiguratorState();
|
|
2610
|
-
case
|
|
2611
|
-
configState = _context22.
|
|
2554
|
+
case 2:
|
|
2555
|
+
configState = _context22.v;
|
|
2612
2556
|
this._state = plattar_controller_1.ControllerState.Renderer;
|
|
2613
2557
|
qrOptions = btoa(JSON.stringify(this._GetDefaultQROptions()));
|
|
2614
2558
|
embedType = this.getAttribute("embed-type");
|
|
@@ -2659,16 +2603,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2659
2603
|
if (sceneGraphID) {
|
|
2660
2604
|
viewer.setAttribute("scene-graph-id", sceneGraphID);
|
|
2661
2605
|
}
|
|
2662
|
-
return _context22.
|
|
2606
|
+
return _context22.a(2, new Promise(function (accept, reject) {
|
|
2663
2607
|
_this20.append(viewer);
|
|
2664
2608
|
if (configState) {
|
|
2665
2609
|
_this20.setupMessengerObservers(viewer, configState);
|
|
2666
2610
|
}
|
|
2667
2611
|
return accept(viewer);
|
|
2668
2612
|
}));
|
|
2669
|
-
case 37:
|
|
2670
|
-
case "end":
|
|
2671
|
-
return _context22.stop();
|
|
2672
2613
|
}
|
|
2673
2614
|
}, _callee22, this);
|
|
2674
2615
|
}));
|
|
@@ -2680,27 +2621,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2680
2621
|
}, {
|
|
2681
2622
|
key: "initAR",
|
|
2682
2623
|
value: function () {
|
|
2683
|
-
var _initAR3 = _asyncToGenerator(/*#__PURE__*/
|
|
2684
|
-
var dState, product, controller, arMode;
|
|
2685
|
-
return
|
|
2686
|
-
while (1) switch (_context23.
|
|
2624
|
+
var _initAR3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23() {
|
|
2625
|
+
var dState, product, controller, arMode, _t11, _t12;
|
|
2626
|
+
return _regenerator().w(function (_context23) {
|
|
2627
|
+
while (1) switch (_context23.n) {
|
|
2687
2628
|
case 0:
|
|
2688
2629
|
if (util_1.Util.canAugment()) {
|
|
2689
|
-
_context23.
|
|
2630
|
+
_context23.n = 1;
|
|
2690
2631
|
break;
|
|
2691
2632
|
}
|
|
2692
2633
|
throw new Error("LauncherController.initAR() - cannot proceed as AR not available in context");
|
|
2693
|
-
case
|
|
2694
|
-
_context23.
|
|
2695
|
-
_context23.
|
|
2634
|
+
case 1:
|
|
2635
|
+
_context23.p = 1;
|
|
2636
|
+
_context23.n = 2;
|
|
2696
2637
|
return this.getConfiguratorState();
|
|
2697
|
-
case
|
|
2698
|
-
dState = _context23.
|
|
2638
|
+
case 2:
|
|
2639
|
+
dState = _context23.v;
|
|
2699
2640
|
// if this is declared, we have a furniture scene that we need to re-create the embed
|
|
2700
2641
|
// with new attributes
|
|
2701
2642
|
product = dState.state.firstOfType("product");
|
|
2702
2643
|
if (!product) {
|
|
2703
|
-
_context23.
|
|
2644
|
+
_context23.n = 4;
|
|
2704
2645
|
break;
|
|
2705
2646
|
}
|
|
2706
2647
|
this.parent.lockObserver();
|
|
@@ -2710,32 +2651,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2710
2651
|
this.parent.unlockObserver();
|
|
2711
2652
|
controller = this.parent.create();
|
|
2712
2653
|
if (!controller) {
|
|
2713
|
-
_context23.
|
|
2654
|
+
_context23.n = 3;
|
|
2714
2655
|
break;
|
|
2715
2656
|
}
|
|
2716
|
-
return _context23.
|
|
2717
|
-
case
|
|
2718
|
-
return _context23.
|
|
2719
|
-
case
|
|
2720
|
-
_context23.
|
|
2657
|
+
return _context23.a(2, controller.initAR());
|
|
2658
|
+
case 3:
|
|
2659
|
+
return _context23.a(2, Promise.reject(new Error("LauncherController.initAR() - legacy product transition failed")));
|
|
2660
|
+
case 4:
|
|
2661
|
+
_context23.n = 6;
|
|
2721
2662
|
break;
|
|
2722
|
-
case
|
|
2723
|
-
_context23.
|
|
2724
|
-
|
|
2725
|
-
case
|
|
2663
|
+
case 5:
|
|
2664
|
+
_context23.p = 5;
|
|
2665
|
+
_t11 = _context23.v;
|
|
2666
|
+
case 6:
|
|
2726
2667
|
arMode = this.getAttribute("ar-mode") || "generated";
|
|
2727
|
-
|
|
2728
|
-
_context23.
|
|
2668
|
+
_t12 = arMode.toLowerCase();
|
|
2669
|
+
_context23.n = _t12 === "inherited" ? 7 : _t12 === "generated" ? 8 : 8;
|
|
2729
2670
|
break;
|
|
2730
|
-
case
|
|
2731
|
-
return _context23.
|
|
2732
|
-
case
|
|
2733
|
-
return _context23.
|
|
2734
|
-
case 27:
|
|
2735
|
-
case "end":
|
|
2736
|
-
return _context23.stop();
|
|
2671
|
+
case 7:
|
|
2672
|
+
return _context23.a(2, this._InitARInherited());
|
|
2673
|
+
case 8:
|
|
2674
|
+
return _context23.a(2, this._InitARGenerated());
|
|
2737
2675
|
}
|
|
2738
|
-
}, _callee23, this, [[
|
|
2676
|
+
}, _callee23, this, [[1, 5]]);
|
|
2739
2677
|
}));
|
|
2740
2678
|
function initAR() {
|
|
2741
2679
|
return _initAR3.apply(this, arguments);
|
|
@@ -2748,25 +2686,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2748
2686
|
}, {
|
|
2749
2687
|
key: "_InitARInherited",
|
|
2750
2688
|
value: (function () {
|
|
2751
|
-
var _InitARInherited3 = _asyncToGenerator(/*#__PURE__*/
|
|
2689
|
+
var _InitARInherited3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
|
|
2752
2690
|
var sceneID, state, first, sceneProductAR;
|
|
2753
|
-
return
|
|
2754
|
-
while (1) switch (_context24.
|
|
2691
|
+
return _regenerator().w(function (_context24) {
|
|
2692
|
+
while (1) switch (_context24.n) {
|
|
2755
2693
|
case 0:
|
|
2756
2694
|
sceneID = this.getAttribute("scene-id");
|
|
2757
2695
|
if (sceneID) {
|
|
2758
|
-
_context24.
|
|
2696
|
+
_context24.n = 1;
|
|
2759
2697
|
break;
|
|
2760
2698
|
}
|
|
2761
2699
|
throw new Error("LauncherController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
|
|
2762
|
-
case
|
|
2763
|
-
_context24.
|
|
2700
|
+
case 1:
|
|
2701
|
+
_context24.n = 2;
|
|
2764
2702
|
return this.getConfiguratorState();
|
|
2765
|
-
case
|
|
2766
|
-
state = _context24.
|
|
2703
|
+
case 2:
|
|
2704
|
+
state = _context24.v.state;
|
|
2767
2705
|
first = state.firstActiveOfType("sceneproduct");
|
|
2768
2706
|
if (!first) {
|
|
2769
|
-
_context24.
|
|
2707
|
+
_context24.n = 3;
|
|
2770
2708
|
break;
|
|
2771
2709
|
}
|
|
2772
2710
|
//const sceneProductAR: SceneProductAR = new SceneProductAR(first.scene_product_id, first.product_variation_id);
|
|
@@ -2776,12 +2714,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2776
2714
|
variationSKU: null,
|
|
2777
2715
|
useARBanner: this.getBooleanAttribute("show-ar-banner")
|
|
2778
2716
|
});
|
|
2779
|
-
return _context24.
|
|
2780
|
-
case
|
|
2717
|
+
return _context24.a(2, sceneProductAR.init());
|
|
2718
|
+
case 3:
|
|
2781
2719
|
throw new Error("LauncherController.initAR() - invalid decoded config-state does not have any product states");
|
|
2782
|
-
case
|
|
2783
|
-
|
|
2784
|
-
return _context24.stop();
|
|
2720
|
+
case 4:
|
|
2721
|
+
return _context24.a(2);
|
|
2785
2722
|
}
|
|
2786
2723
|
}, _callee24, this);
|
|
2787
2724
|
}));
|
|
@@ -2797,21 +2734,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2797
2734
|
}, {
|
|
2798
2735
|
key: "_InitARGenerated",
|
|
2799
2736
|
value: (function () {
|
|
2800
|
-
var _InitARGenerated3 = _asyncToGenerator(/*#__PURE__*/
|
|
2801
|
-
var sceneID, graphID, _configAR2, configAR;
|
|
2802
|
-
return
|
|
2803
|
-
while (1) switch (_context25.
|
|
2737
|
+
var _InitARGenerated3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
|
|
2738
|
+
var sceneID, graphID, _configAR2, configAR, _t13, _t14, _t15, _t16;
|
|
2739
|
+
return _regenerator().w(function (_context25) {
|
|
2740
|
+
while (1) switch (_context25.n) {
|
|
2804
2741
|
case 0:
|
|
2805
2742
|
sceneID = this.getAttribute("scene-id");
|
|
2806
2743
|
if (sceneID) {
|
|
2807
|
-
_context25.
|
|
2744
|
+
_context25.n = 1;
|
|
2808
2745
|
break;
|
|
2809
2746
|
}
|
|
2810
2747
|
throw new Error("LauncherController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
|
|
2811
|
-
case
|
|
2748
|
+
case 1:
|
|
2812
2749
|
graphID = this.getAttribute("scene-graph-id"); // use the scene-graph route if available
|
|
2813
2750
|
if (!graphID) {
|
|
2814
|
-
_context25.
|
|
2751
|
+
_context25.n = 2;
|
|
2815
2752
|
break;
|
|
2816
2753
|
}
|
|
2817
2754
|
_configAR2 = new scene_graph_ar_1.SceneGraphAR({
|
|
@@ -2819,23 +2756,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2819
2756
|
id: graphID,
|
|
2820
2757
|
sceneID: sceneID
|
|
2821
2758
|
});
|
|
2822
|
-
return _context25.
|
|
2823
|
-
case
|
|
2824
|
-
|
|
2825
|
-
_context25.
|
|
2759
|
+
return _context25.a(2, _configAR2.init());
|
|
2760
|
+
case 2:
|
|
2761
|
+
_t13 = configurator_ar_1.ConfiguratorAR;
|
|
2762
|
+
_context25.n = 3;
|
|
2826
2763
|
return this.getConfiguratorState();
|
|
2827
|
-
case
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
state:
|
|
2832
|
-
useARBanner:
|
|
2764
|
+
case 3:
|
|
2765
|
+
_t14 = _context25.v;
|
|
2766
|
+
_t15 = this.getBooleanAttribute("show-ar-banner");
|
|
2767
|
+
_t16 = {
|
|
2768
|
+
state: _t14,
|
|
2769
|
+
useARBanner: _t15
|
|
2833
2770
|
};
|
|
2834
|
-
configAR = new
|
|
2835
|
-
return _context25.
|
|
2836
|
-
case 15:
|
|
2837
|
-
case "end":
|
|
2838
|
-
return _context25.stop();
|
|
2771
|
+
configAR = new _t13(_t16);
|
|
2772
|
+
return _context25.a(2, configAR.init());
|
|
2839
2773
|
}
|
|
2840
2774
|
}, _callee25, this);
|
|
2841
2775
|
}));
|
|
@@ -2908,39 +2842,39 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2908
2842
|
}, {
|
|
2909
2843
|
key: "createConfiguratorState",
|
|
2910
2844
|
value: (function () {
|
|
2911
|
-
var _createConfiguratorState = _asyncToGenerator(/*#__PURE__*/
|
|
2912
|
-
var sceneID, configState, variationIDs, variationSKUs, decodedState, variationIDList, variationSKUList;
|
|
2913
|
-
return
|
|
2914
|
-
while (1) switch (_context26.
|
|
2845
|
+
var _createConfiguratorState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
|
|
2846
|
+
var sceneID, configState, variationIDs, variationSKUs, decodedState, variationIDList, variationSKUList, _t17;
|
|
2847
|
+
return _regenerator().w(function (_context26) {
|
|
2848
|
+
while (1) switch (_context26.n) {
|
|
2915
2849
|
case 0:
|
|
2916
2850
|
// get our Scene ID
|
|
2917
2851
|
sceneID = this.getAttribute("scene-id");
|
|
2918
2852
|
if (sceneID) {
|
|
2919
|
-
_context26.
|
|
2853
|
+
_context26.n = 1;
|
|
2920
2854
|
break;
|
|
2921
2855
|
}
|
|
2922
2856
|
throw new Error("PlattarController.createConfiguratorState() - cannot create as required attribute scene-id is not defined");
|
|
2923
|
-
case
|
|
2857
|
+
case 1:
|
|
2924
2858
|
configState = this.getAttribute("config-state"); // get a list of variation ID's to use for initialising
|
|
2925
2859
|
variationIDs = this.getAttribute("variation-id"); // get a list of variation SKU's to use for initialising
|
|
2926
2860
|
variationSKUs = this.getAttribute("variation-sku"); // generate the decoded configurator state
|
|
2927
2861
|
if (!configState) {
|
|
2928
|
-
_context26.
|
|
2862
|
+
_context26.n = 3;
|
|
2929
2863
|
break;
|
|
2930
2864
|
}
|
|
2931
|
-
_context26.
|
|
2865
|
+
_context26.n = 2;
|
|
2932
2866
|
return configurator_state_1.ConfiguratorState.decodeState(sceneID, configState);
|
|
2933
|
-
case
|
|
2934
|
-
|
|
2935
|
-
_context26.
|
|
2867
|
+
case 2:
|
|
2868
|
+
_t17 = _context26.v;
|
|
2869
|
+
_context26.n = 5;
|
|
2936
2870
|
break;
|
|
2937
|
-
case
|
|
2938
|
-
_context26.
|
|
2871
|
+
case 3:
|
|
2872
|
+
_context26.n = 4;
|
|
2939
2873
|
return configurator_state_1.ConfiguratorState.decodeScene(sceneID);
|
|
2940
|
-
case
|
|
2941
|
-
|
|
2942
|
-
case
|
|
2943
|
-
decodedState =
|
|
2874
|
+
case 4:
|
|
2875
|
+
_t17 = _context26.v;
|
|
2876
|
+
case 5:
|
|
2877
|
+
decodedState = _t17;
|
|
2944
2878
|
// change the ID's and SKU's (if any) of the default configuration state
|
|
2945
2879
|
variationIDList = variationIDs ? variationIDs.split(",") : [];
|
|
2946
2880
|
variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
@@ -2951,10 +2885,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2951
2885
|
decodedState.state.setVariationSKU(variationSKU);
|
|
2952
2886
|
});
|
|
2953
2887
|
// return fully modified configuration state
|
|
2954
|
-
return _context26.
|
|
2955
|
-
case 21:
|
|
2956
|
-
case "end":
|
|
2957
|
-
return _context26.stop();
|
|
2888
|
+
return _context26.a(2, decodedState);
|
|
2958
2889
|
}
|
|
2959
2890
|
}, _callee26, this);
|
|
2960
2891
|
}));
|
|
@@ -3024,19 +2955,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3024
2955
|
}, {
|
|
3025
2956
|
key: "startAR",
|
|
3026
2957
|
value: (function () {
|
|
3027
|
-
var _startAR = _asyncToGenerator(/*#__PURE__*/
|
|
2958
|
+
var _startAR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27() {
|
|
3028
2959
|
var launcher;
|
|
3029
|
-
return
|
|
3030
|
-
while (1) switch (_context27.
|
|
2960
|
+
return _regenerator().w(function (_context27) {
|
|
2961
|
+
while (1) switch (_context27.n) {
|
|
3031
2962
|
case 0:
|
|
3032
|
-
_context27.
|
|
2963
|
+
_context27.n = 1;
|
|
3033
2964
|
return this.initAR();
|
|
3034
|
-
case
|
|
3035
|
-
launcher = _context27.
|
|
3036
|
-
return _context27.
|
|
3037
|
-
case 4:
|
|
3038
|
-
case "end":
|
|
3039
|
-
return _context27.stop();
|
|
2965
|
+
case 1:
|
|
2966
|
+
launcher = _context27.v;
|
|
2967
|
+
return _context27.a(2, launcher.start());
|
|
3040
2968
|
}
|
|
3041
2969
|
}, _callee27, this);
|
|
3042
2970
|
}));
|
|
@@ -3054,22 +2982,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3054
2982
|
}, {
|
|
3055
2983
|
key: "startQRCode",
|
|
3056
2984
|
value: (function () {
|
|
3057
|
-
var _startQRCode = _asyncToGenerator(/*#__PURE__*/
|
|
3058
|
-
var qrType;
|
|
3059
|
-
return
|
|
3060
|
-
while (1) switch (_context28.
|
|
2985
|
+
var _startQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(options) {
|
|
2986
|
+
var qrType, _t18;
|
|
2987
|
+
return _regenerator().w(function (_context28) {
|
|
2988
|
+
while (1) switch (_context28.n) {
|
|
3061
2989
|
case 0:
|
|
3062
2990
|
qrType = this.getAttribute("qr-type") || "viewer";
|
|
3063
|
-
|
|
3064
|
-
_context28.
|
|
2991
|
+
_t18 = qrType.toLowerCase();
|
|
2992
|
+
_context28.n = _t18 === "ar" ? 1 : _t18 === "viewer" ? 2 : 2;
|
|
3065
2993
|
break;
|
|
3066
|
-
case
|
|
3067
|
-
return _context28.
|
|
3068
|
-
case
|
|
3069
|
-
return _context28.
|
|
3070
|
-
case 6:
|
|
3071
|
-
case "end":
|
|
3072
|
-
return _context28.stop();
|
|
2994
|
+
case 1:
|
|
2995
|
+
return _context28.a(2, this.startARQRCode(options));
|
|
2996
|
+
case 2:
|
|
2997
|
+
return _context28.a(2, this.startViewerQRCode(options));
|
|
3073
2998
|
}
|
|
3074
2999
|
}, _callee28, this);
|
|
3075
3000
|
}));
|
|
@@ -3087,11 +3012,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3087
3012
|
}, {
|
|
3088
3013
|
key: "startARQRCode",
|
|
3089
3014
|
value: (function () {
|
|
3090
|
-
var _startARQRCode3 = _asyncToGenerator(/*#__PURE__*/
|
|
3015
|
+
var _startARQRCode3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(options) {
|
|
3091
3016
|
var _this21 = this;
|
|
3092
|
-
var opt, viewer, width, height, qrOptions, dst, configState, sceneID, embedType, productID, sceneProductID, variationID, variationSKU, arMode, showBanner, sceneGraphID;
|
|
3093
|
-
return
|
|
3094
|
-
while (1) switch (_context29.
|
|
3017
|
+
var opt, viewer, width, height, qrOptions, dst, configState, sceneID, embedType, productID, sceneProductID, variationID, variationSKU, arMode, showBanner, sceneGraphID, _t19;
|
|
3018
|
+
return _regenerator().w(function (_context29) {
|
|
3019
|
+
while (1) switch (_context29.n) {
|
|
3095
3020
|
case 0:
|
|
3096
3021
|
// remove the old renderer instance if any
|
|
3097
3022
|
this.removeRenderer();
|
|
@@ -3125,19 +3050,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3125
3050
|
arMode = this.getAttribute("ar-mode");
|
|
3126
3051
|
showBanner = this.getAttribute("show-ar-banner");
|
|
3127
3052
|
sceneGraphID = this.getAttribute("scene-graph-id");
|
|
3128
|
-
_context29.
|
|
3129
|
-
_context29.
|
|
3053
|
+
_context29.p = 1;
|
|
3054
|
+
_context29.n = 2;
|
|
3130
3055
|
return this.getConfiguratorState();
|
|
3131
|
-
case
|
|
3132
|
-
configState = _context29.
|
|
3133
|
-
_context29.
|
|
3056
|
+
case 2:
|
|
3057
|
+
configState = _context29.v.state.encode();
|
|
3058
|
+
_context29.n = 4;
|
|
3134
3059
|
break;
|
|
3135
|
-
case
|
|
3136
|
-
_context29.
|
|
3137
|
-
|
|
3060
|
+
case 3:
|
|
3061
|
+
_context29.p = 3;
|
|
3062
|
+
_t19 = _context29.v;
|
|
3138
3063
|
// config state not available for some reason
|
|
3139
3064
|
configState = null;
|
|
3140
|
-
case
|
|
3065
|
+
case 4:
|
|
3141
3066
|
if (configState) {
|
|
3142
3067
|
dst += "&config_state=" + configState;
|
|
3143
3068
|
}
|
|
@@ -3171,17 +3096,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3171
3096
|
viewer.setAttribute("url", opt.url || dst);
|
|
3172
3097
|
this._state = ControllerState.QRCode;
|
|
3173
3098
|
this._prevQROpt = opt;
|
|
3174
|
-
return _context29.
|
|
3099
|
+
return _context29.a(2, new Promise(function (accept, reject) {
|
|
3175
3100
|
_this21.append(viewer);
|
|
3176
3101
|
viewer.onload = function () {
|
|
3177
3102
|
return accept(viewer);
|
|
3178
3103
|
};
|
|
3179
3104
|
}));
|
|
3180
|
-
case 47:
|
|
3181
|
-
case "end":
|
|
3182
|
-
return _context29.stop();
|
|
3183
3105
|
}
|
|
3184
|
-
}, _callee29, this, [[
|
|
3106
|
+
}, _callee29, this, [[1, 3]]);
|
|
3185
3107
|
}));
|
|
3186
3108
|
function startARQRCode(_x10) {
|
|
3187
3109
|
return _startARQRCode3.apply(this, arguments);
|
|
@@ -3330,14 +3252,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3330
3252
|
return _createClass(ProductController, [{
|
|
3331
3253
|
key: "getConfiguratorState",
|
|
3332
3254
|
value: function () {
|
|
3333
|
-
var _getConfiguratorState4 = _asyncToGenerator(/*#__PURE__*/
|
|
3334
|
-
return
|
|
3335
|
-
while (1) switch (_context30.
|
|
3255
|
+
var _getConfiguratorState4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30() {
|
|
3256
|
+
return _regenerator().w(function (_context30) {
|
|
3257
|
+
while (1) switch (_context30.n) {
|
|
3336
3258
|
case 0:
|
|
3337
3259
|
throw new Error("ProductController.getConfiguratorState() - legacy embeds do not support configurator states");
|
|
3338
3260
|
case 1:
|
|
3339
|
-
|
|
3340
|
-
return _context30.stop();
|
|
3261
|
+
return _context30.a(2);
|
|
3341
3262
|
}
|
|
3342
3263
|
}, _callee30);
|
|
3343
3264
|
}));
|
|
@@ -3349,19 +3270,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3349
3270
|
}, {
|
|
3350
3271
|
key: "onAttributesUpdated",
|
|
3351
3272
|
value: function () {
|
|
3352
|
-
var _onAttributesUpdated4 = _asyncToGenerator(/*#__PURE__*/
|
|
3273
|
+
var _onAttributesUpdated4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(attributeName) {
|
|
3353
3274
|
var state, viewer, variationID;
|
|
3354
|
-
return
|
|
3355
|
-
while (1) switch (_context31.
|
|
3275
|
+
return _regenerator().w(function (_context31) {
|
|
3276
|
+
while (1) switch (_context31.n) {
|
|
3356
3277
|
case 0:
|
|
3357
3278
|
state = this._state; // re-render the QR Code when attributes have changed
|
|
3358
3279
|
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
3359
|
-
_context31.
|
|
3280
|
+
_context31.n = 1;
|
|
3360
3281
|
break;
|
|
3361
3282
|
}
|
|
3362
3283
|
this.startQRCode(this._prevQROpt);
|
|
3363
|
-
return _context31.
|
|
3364
|
-
case
|
|
3284
|
+
return _context31.a(2);
|
|
3285
|
+
case 1:
|
|
3365
3286
|
// use the messenger function to change variation when attributes have changed
|
|
3366
3287
|
if (state === plattar_controller_1.ControllerState.Renderer) {
|
|
3367
3288
|
viewer = this._element;
|
|
@@ -3372,9 +3293,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3372
3293
|
}
|
|
3373
3294
|
}
|
|
3374
3295
|
}
|
|
3375
|
-
case
|
|
3376
|
-
|
|
3377
|
-
return _context31.stop();
|
|
3296
|
+
case 2:
|
|
3297
|
+
return _context31.a(2);
|
|
3378
3298
|
}
|
|
3379
3299
|
}, _callee31, this);
|
|
3380
3300
|
}));
|
|
@@ -3624,21 +3544,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3624
3544
|
return _createClass(VTOController, [{
|
|
3625
3545
|
key: "getConfiguratorState",
|
|
3626
3546
|
value: function () {
|
|
3627
|
-
var _getConfiguratorState5 = _asyncToGenerator(/*#__PURE__*/
|
|
3628
|
-
return
|
|
3629
|
-
while (1) switch (_context32.
|
|
3547
|
+
var _getConfiguratorState5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32() {
|
|
3548
|
+
return _regenerator().w(function (_context32) {
|
|
3549
|
+
while (1) switch (_context32.n) {
|
|
3630
3550
|
case 0:
|
|
3631
3551
|
if (!this._cachedConfigState) {
|
|
3632
|
-
_context32.
|
|
3552
|
+
_context32.n = 1;
|
|
3633
3553
|
break;
|
|
3634
3554
|
}
|
|
3635
|
-
return _context32.
|
|
3636
|
-
case
|
|
3555
|
+
return _context32.a(2, this._cachedConfigState);
|
|
3556
|
+
case 1:
|
|
3637
3557
|
this._cachedConfigState = this.createConfiguratorState();
|
|
3638
|
-
return _context32.
|
|
3639
|
-
case 4:
|
|
3640
|
-
case "end":
|
|
3641
|
-
return _context32.stop();
|
|
3558
|
+
return _context32.a(2, this._cachedConfigState);
|
|
3642
3559
|
}
|
|
3643
3560
|
}, _callee32, this);
|
|
3644
3561
|
}));
|
|
@@ -3650,86 +3567,83 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3650
3567
|
}, {
|
|
3651
3568
|
key: "onAttributesUpdated",
|
|
3652
3569
|
value: function () {
|
|
3653
|
-
var _onAttributesUpdated5 = _asyncToGenerator(/*#__PURE__*/
|
|
3570
|
+
var _onAttributesUpdated5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(attributeName) {
|
|
3654
3571
|
var state, viewer, variationIDs, variationIDsList, variationSKUs, variationSKUList, configState, _variationIDs2, _variationIDsList2, _configState4, _variationSKUs2, _variationSKUList2;
|
|
3655
|
-
return
|
|
3656
|
-
while (1) switch (_context33.
|
|
3572
|
+
return _regenerator().w(function (_context33) {
|
|
3573
|
+
while (1) switch (_context33.n) {
|
|
3657
3574
|
case 0:
|
|
3658
3575
|
state = this._state;
|
|
3659
3576
|
if (!(state === plattar_controller_1.ControllerState.Renderer)) {
|
|
3660
|
-
_context33.
|
|
3577
|
+
_context33.n = 3;
|
|
3661
3578
|
break;
|
|
3662
3579
|
}
|
|
3663
3580
|
viewer = this.element;
|
|
3664
3581
|
if (!viewer) {
|
|
3665
|
-
_context33.
|
|
3582
|
+
_context33.n = 2;
|
|
3666
3583
|
break;
|
|
3667
3584
|
}
|
|
3668
3585
|
if (!(attributeName === "variation-id")) {
|
|
3669
|
-
_context33.
|
|
3586
|
+
_context33.n = 1;
|
|
3670
3587
|
break;
|
|
3671
3588
|
}
|
|
3672
3589
|
variationIDs = this.getAttribute("variation-id");
|
|
3673
3590
|
variationIDsList = variationIDs ? variationIDs.split(",") : [];
|
|
3674
3591
|
if (!(variationIDsList.length > 0)) {
|
|
3675
|
-
_context33.
|
|
3592
|
+
_context33.n = 1;
|
|
3676
3593
|
break;
|
|
3677
3594
|
}
|
|
3678
|
-
_context33.
|
|
3595
|
+
_context33.n = 1;
|
|
3679
3596
|
return viewer.messenger.selectVariationID(variationIDsList);
|
|
3680
|
-
case
|
|
3597
|
+
case 1:
|
|
3681
3598
|
if (!(attributeName === "variation-sku")) {
|
|
3682
|
-
_context33.
|
|
3599
|
+
_context33.n = 2;
|
|
3683
3600
|
break;
|
|
3684
3601
|
}
|
|
3685
3602
|
variationSKUs = this.getAttribute("variation-sku");
|
|
3686
3603
|
variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
3687
3604
|
if (!(variationSKUList.length > 0)) {
|
|
3688
|
-
_context33.
|
|
3605
|
+
_context33.n = 2;
|
|
3689
3606
|
break;
|
|
3690
3607
|
}
|
|
3691
|
-
_context33.
|
|
3608
|
+
_context33.n = 2;
|
|
3692
3609
|
return viewer.messenger.selectVariationSKU(variationSKUList);
|
|
3693
|
-
case
|
|
3694
|
-
return _context33.
|
|
3695
|
-
case
|
|
3610
|
+
case 2:
|
|
3611
|
+
return _context33.a(2);
|
|
3612
|
+
case 3:
|
|
3696
3613
|
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
3697
|
-
_context33.
|
|
3614
|
+
_context33.n = 8;
|
|
3698
3615
|
break;
|
|
3699
3616
|
}
|
|
3700
3617
|
if (!(attributeName === "variation-id")) {
|
|
3701
|
-
_context33.
|
|
3618
|
+
_context33.n = 5;
|
|
3702
3619
|
break;
|
|
3703
3620
|
}
|
|
3704
|
-
_context33.
|
|
3621
|
+
_context33.n = 4;
|
|
3705
3622
|
return this.getConfiguratorState();
|
|
3706
|
-
case
|
|
3707
|
-
configState = _context33.
|
|
3623
|
+
case 4:
|
|
3624
|
+
configState = _context33.v;
|
|
3708
3625
|
_variationIDs2 = this.getAttribute("variation-id");
|
|
3709
3626
|
_variationIDsList2 = _variationIDs2 ? _variationIDs2.split(",") : [];
|
|
3710
3627
|
_variationIDsList2.forEach(function (variationID) {
|
|
3711
3628
|
configState.state.setVariationID(variationID);
|
|
3712
3629
|
});
|
|
3713
|
-
case
|
|
3630
|
+
case 5:
|
|
3714
3631
|
if (!(attributeName === "variation-sku")) {
|
|
3715
|
-
_context33.
|
|
3632
|
+
_context33.n = 7;
|
|
3716
3633
|
break;
|
|
3717
3634
|
}
|
|
3718
|
-
_context33.
|
|
3635
|
+
_context33.n = 6;
|
|
3719
3636
|
return this.getConfiguratorState();
|
|
3720
|
-
case
|
|
3721
|
-
_configState4 = _context33.
|
|
3637
|
+
case 6:
|
|
3638
|
+
_configState4 = _context33.v;
|
|
3722
3639
|
_variationSKUs2 = this.getAttribute("variation-sku");
|
|
3723
3640
|
_variationSKUList2 = _variationSKUs2 ? _variationSKUs2.split(",") : [];
|
|
3724
3641
|
_variationSKUList2.forEach(function (variationSKU) {
|
|
3725
3642
|
_configState4.state.setVariationSKU(variationSKU);
|
|
3726
3643
|
});
|
|
3727
|
-
case
|
|
3644
|
+
case 7:
|
|
3728
3645
|
this.startQRCode(this._prevQROpt);
|
|
3729
|
-
return _context33.
|
|
3730
|
-
case 34:
|
|
3731
|
-
case "end":
|
|
3732
|
-
return _context33.stop();
|
|
3646
|
+
return _context33.a(2);
|
|
3733
3647
|
}
|
|
3734
3648
|
}, _callee33, this);
|
|
3735
3649
|
}));
|
|
@@ -3741,21 +3655,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3741
3655
|
}, {
|
|
3742
3656
|
key: "startViewerQRCode",
|
|
3743
3657
|
value: function () {
|
|
3744
|
-
var _startViewerQRCode4 = _asyncToGenerator(/*#__PURE__*/
|
|
3658
|
+
var _startViewerQRCode4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(options) {
|
|
3745
3659
|
var _this27 = this;
|
|
3746
|
-
var sceneID, opt, viewer, width, height, dst, configState, showAR, productID, sceneProductID, variationID;
|
|
3747
|
-
return
|
|
3748
|
-
while (1) switch (_context34.
|
|
3660
|
+
var sceneID, opt, viewer, width, height, dst, configState, showAR, productID, sceneProductID, variationID, _t20;
|
|
3661
|
+
return _regenerator().w(function (_context34) {
|
|
3662
|
+
while (1) switch (_context34.n) {
|
|
3749
3663
|
case 0:
|
|
3750
3664
|
// remove the old renderer instance if any
|
|
3751
3665
|
this.removeRenderer();
|
|
3752
3666
|
sceneID = this.getAttribute("scene-id");
|
|
3753
3667
|
if (sceneID) {
|
|
3754
|
-
_context34.
|
|
3668
|
+
_context34.n = 1;
|
|
3755
3669
|
break;
|
|
3756
3670
|
}
|
|
3757
3671
|
throw new Error("VTOController.startQRCode() - minimum required attributes not set, use scene-id as a minimum");
|
|
3758
|
-
case
|
|
3672
|
+
case 1:
|
|
3759
3673
|
opt = options || this._GetDefaultQROptions();
|
|
3760
3674
|
viewer = document.createElement("plattar-qrcode");
|
|
3761
3675
|
this._element = viewer;
|
|
@@ -3776,19 +3690,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3776
3690
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
3777
3691
|
dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID; // optional attributes
|
|
3778
3692
|
configState = null;
|
|
3779
|
-
_context34.
|
|
3780
|
-
_context34.
|
|
3693
|
+
_context34.p = 2;
|
|
3694
|
+
_context34.n = 3;
|
|
3781
3695
|
return this.getConfiguratorState();
|
|
3782
|
-
case
|
|
3783
|
-
configState = _context34.
|
|
3784
|
-
_context34.
|
|
3696
|
+
case 3:
|
|
3697
|
+
configState = _context34.v;
|
|
3698
|
+
_context34.n = 5;
|
|
3785
3699
|
break;
|
|
3786
|
-
case
|
|
3787
|
-
_context34.
|
|
3788
|
-
|
|
3700
|
+
case 4:
|
|
3701
|
+
_context34.p = 4;
|
|
3702
|
+
_t20 = _context34.v;
|
|
3789
3703
|
// config state is not available
|
|
3790
3704
|
configState = null;
|
|
3791
|
-
case
|
|
3705
|
+
case 5:
|
|
3792
3706
|
showAR = this.getAttribute("show-ar");
|
|
3793
3707
|
productID = this.getAttribute("product-id");
|
|
3794
3708
|
sceneProductID = this.getAttribute("scene-product-id");
|
|
@@ -3811,17 +3725,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3811
3725
|
viewer.setAttribute("url", opt.url || dst);
|
|
3812
3726
|
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
3813
3727
|
this._prevQROpt = opt;
|
|
3814
|
-
return _context34.
|
|
3728
|
+
return _context34.a(2, new Promise(function (accept, reject) {
|
|
3815
3729
|
viewer.onload = function () {
|
|
3816
3730
|
return accept(viewer);
|
|
3817
3731
|
};
|
|
3818
3732
|
_this27.append(viewer);
|
|
3819
3733
|
}));
|
|
3820
|
-
case 39:
|
|
3821
|
-
case "end":
|
|
3822
|
-
return _context34.stop();
|
|
3823
3734
|
}
|
|
3824
|
-
}, _callee34, this, [[
|
|
3735
|
+
}, _callee34, this, [[2, 4]]);
|
|
3825
3736
|
}));
|
|
3826
3737
|
function startViewerQRCode(_x13) {
|
|
3827
3738
|
return _startViewerQRCode4.apply(this, arguments);
|
|
@@ -3831,21 +3742,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3831
3742
|
}, {
|
|
3832
3743
|
key: "startRenderer",
|
|
3833
3744
|
value: function () {
|
|
3834
|
-
var _startRenderer4 = _asyncToGenerator(/*#__PURE__*/
|
|
3745
|
+
var _startRenderer4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35() {
|
|
3835
3746
|
var _this28 = this;
|
|
3836
|
-
var sceneID, width, height, server, viewer, configState, showAR, productID, sceneProductID, variationID;
|
|
3837
|
-
return
|
|
3838
|
-
while (1) switch (_context35.
|
|
3747
|
+
var sceneID, width, height, server, viewer, configState, showAR, productID, sceneProductID, variationID, _t21;
|
|
3748
|
+
return _regenerator().w(function (_context35) {
|
|
3749
|
+
while (1) switch (_context35.n) {
|
|
3839
3750
|
case 0:
|
|
3840
3751
|
// remove the old renderer instance if any
|
|
3841
3752
|
this.removeRenderer();
|
|
3842
3753
|
sceneID = this.getAttribute("scene-id");
|
|
3843
3754
|
if (sceneID) {
|
|
3844
|
-
_context35.
|
|
3755
|
+
_context35.n = 1;
|
|
3845
3756
|
break;
|
|
3846
3757
|
}
|
|
3847
3758
|
throw new Error("VTOController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
|
|
3848
|
-
case
|
|
3759
|
+
case 1:
|
|
3849
3760
|
this._state = plattar_controller_1.ControllerState.Renderer;
|
|
3850
3761
|
// required attributes with defaults for plattar-facear node
|
|
3851
3762
|
width = this.getAttribute("width") || "500px";
|
|
@@ -3859,19 +3770,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3859
3770
|
viewer.setAttribute("scene-id", sceneID);
|
|
3860
3771
|
// optional attributes
|
|
3861
3772
|
configState = null;
|
|
3862
|
-
_context35.
|
|
3863
|
-
_context35.
|
|
3773
|
+
_context35.p = 2;
|
|
3774
|
+
_context35.n = 3;
|
|
3864
3775
|
return this.getConfiguratorState();
|
|
3865
|
-
case
|
|
3866
|
-
configState = _context35.
|
|
3867
|
-
_context35.
|
|
3776
|
+
case 3:
|
|
3777
|
+
configState = _context35.v;
|
|
3778
|
+
_context35.n = 5;
|
|
3868
3779
|
break;
|
|
3869
|
-
case
|
|
3870
|
-
_context35.
|
|
3871
|
-
|
|
3780
|
+
case 4:
|
|
3781
|
+
_context35.p = 4;
|
|
3782
|
+
_t21 = _context35.v;
|
|
3872
3783
|
// config state not available
|
|
3873
3784
|
configState = null;
|
|
3874
|
-
case
|
|
3785
|
+
case 5:
|
|
3875
3786
|
showAR = this.getAttribute("show-ar");
|
|
3876
3787
|
productID = this.getAttribute("product-id");
|
|
3877
3788
|
sceneProductID = this.getAttribute("scene-product-id");
|
|
@@ -3891,18 +3802,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3891
3802
|
if (variationID) {
|
|
3892
3803
|
viewer.setAttribute("variation-id", variationID);
|
|
3893
3804
|
}
|
|
3894
|
-
return _context35.
|
|
3805
|
+
return _context35.a(2, new Promise(function (accept, reject) {
|
|
3895
3806
|
_this28.append(viewer);
|
|
3896
3807
|
if (configState) {
|
|
3897
3808
|
_this28.setupMessengerObservers(viewer, configState);
|
|
3898
3809
|
}
|
|
3899
3810
|
return accept(viewer);
|
|
3900
3811
|
}));
|
|
3901
|
-
case 34:
|
|
3902
|
-
case "end":
|
|
3903
|
-
return _context35.stop();
|
|
3904
3812
|
}
|
|
3905
|
-
}, _callee35, this, [[
|
|
3813
|
+
}, _callee35, this, [[2, 4]]);
|
|
3906
3814
|
}));
|
|
3907
3815
|
function startRenderer() {
|
|
3908
3816
|
return _startRenderer4.apply(this, arguments);
|
|
@@ -3912,34 +3820,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3912
3820
|
}, {
|
|
3913
3821
|
key: "initAR",
|
|
3914
3822
|
value: function () {
|
|
3915
|
-
var _initAR4 = _asyncToGenerator(/*#__PURE__*/
|
|
3916
|
-
var arMode;
|
|
3917
|
-
return
|
|
3918
|
-
while (1) switch (_context36.
|
|
3823
|
+
var _initAR4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36() {
|
|
3824
|
+
var arMode, _t22;
|
|
3825
|
+
return _regenerator().w(function (_context36) {
|
|
3826
|
+
while (1) switch (_context36.n) {
|
|
3919
3827
|
case 0:
|
|
3920
3828
|
if (util_1.Util.canAugment()) {
|
|
3921
|
-
_context36.
|
|
3829
|
+
_context36.n = 1;
|
|
3922
3830
|
break;
|
|
3923
3831
|
}
|
|
3924
3832
|
throw new Error("VTOController.initAR() - cannot proceed as VTO AR not available in context");
|
|
3925
|
-
case
|
|
3833
|
+
case 1:
|
|
3926
3834
|
if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
|
|
3927
|
-
_context36.
|
|
3835
|
+
_context36.n = 2;
|
|
3928
3836
|
break;
|
|
3929
3837
|
}
|
|
3930
3838
|
throw new Error("VTOController.initAR() - cannot proceed as VTO AR only available on IOS Mobile devices");
|
|
3931
|
-
case
|
|
3839
|
+
case 2:
|
|
3932
3840
|
arMode = this.getAttribute("ar-mode") || "generated";
|
|
3933
|
-
|
|
3934
|
-
_context36.
|
|
3841
|
+
_t22 = arMode.toLowerCase();
|
|
3842
|
+
_context36.n = _t22 === "inherited" ? 3 : _t22 === "generated" ? 4 : 4;
|
|
3935
3843
|
break;
|
|
3936
|
-
case
|
|
3937
|
-
return _context36.
|
|
3938
|
-
case
|
|
3939
|
-
return _context36.
|
|
3940
|
-
case 10:
|
|
3941
|
-
case "end":
|
|
3942
|
-
return _context36.stop();
|
|
3844
|
+
case 3:
|
|
3845
|
+
return _context36.a(2, this._InitARInherited());
|
|
3846
|
+
case 4:
|
|
3847
|
+
return _context36.a(2, this._InitARGenerated());
|
|
3943
3848
|
}
|
|
3944
3849
|
}, _callee36, this);
|
|
3945
3850
|
}));
|
|
@@ -3954,25 +3859,25 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3954
3859
|
}, {
|
|
3955
3860
|
key: "_InitARInherited",
|
|
3956
3861
|
value: (function () {
|
|
3957
|
-
var _InitARInherited4 = _asyncToGenerator(/*#__PURE__*/
|
|
3862
|
+
var _InitARInherited4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37() {
|
|
3958
3863
|
var sceneID, state, first, sceneProductAR;
|
|
3959
|
-
return
|
|
3960
|
-
while (1) switch (_context37.
|
|
3864
|
+
return _regenerator().w(function (_context37) {
|
|
3865
|
+
while (1) switch (_context37.n) {
|
|
3961
3866
|
case 0:
|
|
3962
3867
|
sceneID = this.getAttribute("scene-id");
|
|
3963
3868
|
if (sceneID) {
|
|
3964
|
-
_context37.
|
|
3869
|
+
_context37.n = 1;
|
|
3965
3870
|
break;
|
|
3966
3871
|
}
|
|
3967
3872
|
throw new Error("VTOController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
|
|
3968
|
-
case
|
|
3969
|
-
_context37.
|
|
3873
|
+
case 1:
|
|
3874
|
+
_context37.n = 2;
|
|
3970
3875
|
return this.getConfiguratorState();
|
|
3971
|
-
case
|
|
3972
|
-
state = _context37.
|
|
3876
|
+
case 2:
|
|
3877
|
+
state = _context37.v.state;
|
|
3973
3878
|
first = state.firstActiveOfType("sceneproduct");
|
|
3974
3879
|
if (!first) {
|
|
3975
|
-
_context37.
|
|
3880
|
+
_context37.n = 3;
|
|
3976
3881
|
break;
|
|
3977
3882
|
}
|
|
3978
3883
|
sceneProductAR = new __1.SceneProductAR({
|
|
@@ -3981,12 +3886,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3981
3886
|
variationSKU: null,
|
|
3982
3887
|
useARBanner: this.getBooleanAttribute("show-ar-banner")
|
|
3983
3888
|
});
|
|
3984
|
-
return _context37.
|
|
3985
|
-
case
|
|
3889
|
+
return _context37.a(2, sceneProductAR.init());
|
|
3890
|
+
case 3:
|
|
3986
3891
|
throw new Error("VTOController.initAR() - invalid decoded config-state does not have any product states");
|
|
3987
|
-
case
|
|
3988
|
-
|
|
3989
|
-
return _context37.stop();
|
|
3892
|
+
case 4:
|
|
3893
|
+
return _context37.a(2);
|
|
3990
3894
|
}
|
|
3991
3895
|
}, _callee37, this);
|
|
3992
3896
|
}));
|
|
@@ -4002,33 +3906,30 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4002
3906
|
}, {
|
|
4003
3907
|
key: "_InitARGenerated",
|
|
4004
3908
|
value: (function () {
|
|
4005
|
-
var _InitARGenerated4 = _asyncToGenerator(/*#__PURE__*/
|
|
4006
|
-
var sceneID, configAR;
|
|
4007
|
-
return
|
|
4008
|
-
while (1) switch (_context38.
|
|
3909
|
+
var _InitARGenerated4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38() {
|
|
3910
|
+
var sceneID, configAR, _t23, _t24, _t25, _t26;
|
|
3911
|
+
return _regenerator().w(function (_context38) {
|
|
3912
|
+
while (1) switch (_context38.n) {
|
|
4009
3913
|
case 0:
|
|
4010
3914
|
sceneID = this.getAttribute("scene-id");
|
|
4011
3915
|
if (sceneID) {
|
|
4012
|
-
_context38.
|
|
3916
|
+
_context38.n = 1;
|
|
4013
3917
|
break;
|
|
4014
3918
|
}
|
|
4015
3919
|
throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
|
|
4016
|
-
case
|
|
4017
|
-
|
|
4018
|
-
_context38.
|
|
3920
|
+
case 1:
|
|
3921
|
+
_t23 = configurator_ar_1.ConfiguratorAR;
|
|
3922
|
+
_context38.n = 2;
|
|
4019
3923
|
return this.getConfiguratorState();
|
|
4020
|
-
case
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
state:
|
|
4025
|
-
useARBanner:
|
|
3924
|
+
case 2:
|
|
3925
|
+
_t24 = _context38.v;
|
|
3926
|
+
_t25 = this.getBooleanAttribute("show-ar-banner");
|
|
3927
|
+
_t26 = {
|
|
3928
|
+
state: _t24,
|
|
3929
|
+
useARBanner: _t25
|
|
4026
3930
|
};
|
|
4027
|
-
configAR = new
|
|
4028
|
-
return _context38.
|
|
4029
|
-
case 11:
|
|
4030
|
-
case "end":
|
|
4031
|
-
return _context38.stop();
|
|
3931
|
+
configAR = new _t23(_t26);
|
|
3932
|
+
return _context38.a(2, configAR.init());
|
|
4032
3933
|
}
|
|
4033
3934
|
}, _callee38, this);
|
|
4034
3935
|
}));
|
|
@@ -4076,21 +3977,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4076
3977
|
return _createClass(WebXRController, [{
|
|
4077
3978
|
key: "getConfiguratorState",
|
|
4078
3979
|
value: function () {
|
|
4079
|
-
var _getConfiguratorState6 = _asyncToGenerator(/*#__PURE__*/
|
|
4080
|
-
return
|
|
4081
|
-
while (1) switch (_context39.
|
|
3980
|
+
var _getConfiguratorState6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39() {
|
|
3981
|
+
return _regenerator().w(function (_context39) {
|
|
3982
|
+
while (1) switch (_context39.n) {
|
|
4082
3983
|
case 0:
|
|
4083
3984
|
if (!this._cachedConfigState) {
|
|
4084
|
-
_context39.
|
|
3985
|
+
_context39.n = 1;
|
|
4085
3986
|
break;
|
|
4086
3987
|
}
|
|
4087
|
-
return _context39.
|
|
4088
|
-
case
|
|
3988
|
+
return _context39.a(2, this._cachedConfigState);
|
|
3989
|
+
case 1:
|
|
4089
3990
|
this._cachedConfigState = this.createConfiguratorState();
|
|
4090
|
-
return _context39.
|
|
4091
|
-
case 4:
|
|
4092
|
-
case "end":
|
|
4093
|
-
return _context39.stop();
|
|
3991
|
+
return _context39.a(2, this._cachedConfigState);
|
|
4094
3992
|
}
|
|
4095
3993
|
}, _callee39, this);
|
|
4096
3994
|
}));
|
|
@@ -4102,86 +4000,83 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4102
4000
|
}, {
|
|
4103
4001
|
key: "onAttributesUpdated",
|
|
4104
4002
|
value: function () {
|
|
4105
|
-
var _onAttributesUpdated6 = _asyncToGenerator(/*#__PURE__*/
|
|
4003
|
+
var _onAttributesUpdated6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40(attributeName) {
|
|
4106
4004
|
var state, viewer, variationIDs, variationIDsList, variationSKUs, variationSKUList, configState, _variationIDs3, _variationIDsList3, _configState5, _variationSKUs3, _variationSKUList3;
|
|
4107
|
-
return
|
|
4108
|
-
while (1) switch (_context40.
|
|
4005
|
+
return _regenerator().w(function (_context40) {
|
|
4006
|
+
while (1) switch (_context40.n) {
|
|
4109
4007
|
case 0:
|
|
4110
4008
|
state = this._state;
|
|
4111
4009
|
if (!(state === plattar_controller_1.ControllerState.Renderer)) {
|
|
4112
|
-
_context40.
|
|
4010
|
+
_context40.n = 3;
|
|
4113
4011
|
break;
|
|
4114
4012
|
}
|
|
4115
4013
|
viewer = this.element;
|
|
4116
4014
|
if (!viewer) {
|
|
4117
|
-
_context40.
|
|
4015
|
+
_context40.n = 2;
|
|
4118
4016
|
break;
|
|
4119
4017
|
}
|
|
4120
4018
|
if (!(attributeName === "variation-id")) {
|
|
4121
|
-
_context40.
|
|
4019
|
+
_context40.n = 1;
|
|
4122
4020
|
break;
|
|
4123
4021
|
}
|
|
4124
4022
|
variationIDs = this.getAttribute("variation-id");
|
|
4125
4023
|
variationIDsList = variationIDs ? variationIDs.split(",") : [];
|
|
4126
4024
|
if (!(variationIDsList.length > 0)) {
|
|
4127
|
-
_context40.
|
|
4025
|
+
_context40.n = 1;
|
|
4128
4026
|
break;
|
|
4129
4027
|
}
|
|
4130
|
-
_context40.
|
|
4028
|
+
_context40.n = 1;
|
|
4131
4029
|
return viewer.messenger.selectVariationID(variationIDsList);
|
|
4132
|
-
case
|
|
4030
|
+
case 1:
|
|
4133
4031
|
if (!(attributeName === "variation-sku")) {
|
|
4134
|
-
_context40.
|
|
4032
|
+
_context40.n = 2;
|
|
4135
4033
|
break;
|
|
4136
4034
|
}
|
|
4137
4035
|
variationSKUs = this.getAttribute("variation-sku");
|
|
4138
4036
|
variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
4139
4037
|
if (!(variationSKUList.length > 0)) {
|
|
4140
|
-
_context40.
|
|
4038
|
+
_context40.n = 2;
|
|
4141
4039
|
break;
|
|
4142
4040
|
}
|
|
4143
|
-
_context40.
|
|
4041
|
+
_context40.n = 2;
|
|
4144
4042
|
return viewer.messenger.selectVariationSKU(variationSKUList);
|
|
4145
|
-
case
|
|
4146
|
-
return _context40.
|
|
4147
|
-
case
|
|
4043
|
+
case 2:
|
|
4044
|
+
return _context40.a(2);
|
|
4045
|
+
case 3:
|
|
4148
4046
|
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
4149
|
-
_context40.
|
|
4047
|
+
_context40.n = 8;
|
|
4150
4048
|
break;
|
|
4151
4049
|
}
|
|
4152
4050
|
if (!(attributeName === "variation-id")) {
|
|
4153
|
-
_context40.
|
|
4051
|
+
_context40.n = 5;
|
|
4154
4052
|
break;
|
|
4155
4053
|
}
|
|
4156
|
-
_context40.
|
|
4054
|
+
_context40.n = 4;
|
|
4157
4055
|
return this.getConfiguratorState();
|
|
4158
|
-
case
|
|
4159
|
-
configState = _context40.
|
|
4056
|
+
case 4:
|
|
4057
|
+
configState = _context40.v;
|
|
4160
4058
|
_variationIDs3 = this.getAttribute("variation-id");
|
|
4161
4059
|
_variationIDsList3 = _variationIDs3 ? _variationIDs3.split(",") : [];
|
|
4162
4060
|
_variationIDsList3.forEach(function (variationID) {
|
|
4163
4061
|
configState.state.setVariationID(variationID);
|
|
4164
4062
|
});
|
|
4165
|
-
case
|
|
4063
|
+
case 5:
|
|
4166
4064
|
if (!(attributeName === "variation-sku")) {
|
|
4167
|
-
_context40.
|
|
4065
|
+
_context40.n = 7;
|
|
4168
4066
|
break;
|
|
4169
4067
|
}
|
|
4170
|
-
_context40.
|
|
4068
|
+
_context40.n = 6;
|
|
4171
4069
|
return this.getConfiguratorState();
|
|
4172
|
-
case
|
|
4173
|
-
_configState5 = _context40.
|
|
4070
|
+
case 6:
|
|
4071
|
+
_configState5 = _context40.v;
|
|
4174
4072
|
_variationSKUs3 = this.getAttribute("variation-sku");
|
|
4175
4073
|
_variationSKUList3 = _variationSKUs3 ? _variationSKUs3.split(",") : [];
|
|
4176
4074
|
_variationSKUList3.forEach(function (variationSKU) {
|
|
4177
4075
|
_configState5.state.setVariationSKU(variationSKU);
|
|
4178
4076
|
});
|
|
4179
|
-
case
|
|
4077
|
+
case 7:
|
|
4180
4078
|
this.startQRCode(this._prevQROpt);
|
|
4181
|
-
return _context40.
|
|
4182
|
-
case 34:
|
|
4183
|
-
case "end":
|
|
4184
|
-
return _context40.stop();
|
|
4079
|
+
return _context40.a(2);
|
|
4185
4080
|
}
|
|
4186
4081
|
}, _callee40, this);
|
|
4187
4082
|
}));
|
|
@@ -4203,21 +4098,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4203
4098
|
}, {
|
|
4204
4099
|
key: "startQRCode",
|
|
4205
4100
|
value: function () {
|
|
4206
|
-
var _startQRCode2 = _asyncToGenerator(/*#__PURE__*/
|
|
4101
|
+
var _startQRCode2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41(options) {
|
|
4207
4102
|
var _this30 = this;
|
|
4208
4103
|
var sceneID, opt, viewer, width, height, dst;
|
|
4209
|
-
return
|
|
4210
|
-
while (1) switch (_context41.
|
|
4104
|
+
return _regenerator().w(function (_context41) {
|
|
4105
|
+
while (1) switch (_context41.n) {
|
|
4211
4106
|
case 0:
|
|
4212
4107
|
// remove the old renderer instance if any
|
|
4213
4108
|
this.removeRenderer();
|
|
4214
4109
|
sceneID = this.getAttribute("scene-id");
|
|
4215
4110
|
if (sceneID) {
|
|
4216
|
-
_context41.
|
|
4111
|
+
_context41.n = 1;
|
|
4217
4112
|
break;
|
|
4218
4113
|
}
|
|
4219
4114
|
throw new Error("WebXRController.startQRCode() - minimum required attributes not set, use scene-id as a minimum");
|
|
4220
|
-
case
|
|
4115
|
+
case 1:
|
|
4221
4116
|
opt = options || this._GetDefaultQROptions();
|
|
4222
4117
|
viewer = document.createElement("plattar-qrcode");
|
|
4223
4118
|
this._element = viewer;
|
|
@@ -4240,15 +4135,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4240
4135
|
viewer.setAttribute("url", opt.url || dst);
|
|
4241
4136
|
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
4242
4137
|
this._prevQROpt = opt;
|
|
4243
|
-
return _context41.
|
|
4138
|
+
return _context41.a(2, new Promise(function (accept, reject) {
|
|
4244
4139
|
viewer.onload = function () {
|
|
4245
4140
|
return accept(viewer);
|
|
4246
4141
|
};
|
|
4247
4142
|
_this30.append(viewer);
|
|
4248
4143
|
}));
|
|
4249
|
-
case 20:
|
|
4250
|
-
case "end":
|
|
4251
|
-
return _context41.stop();
|
|
4252
4144
|
}
|
|
4253
4145
|
}, _callee41, this);
|
|
4254
4146
|
}));
|
|
@@ -4260,27 +4152,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4260
4152
|
}, {
|
|
4261
4153
|
key: "startRenderer",
|
|
4262
4154
|
value: function () {
|
|
4263
|
-
var _startRenderer5 = _asyncToGenerator(/*#__PURE__*/
|
|
4155
|
+
var _startRenderer5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42() {
|
|
4264
4156
|
var _this31 = this;
|
|
4265
4157
|
var sceneID, width, height, server, viewer, showAR, showUI;
|
|
4266
|
-
return
|
|
4267
|
-
while (1) switch (_context42.
|
|
4158
|
+
return _regenerator().w(function (_context42) {
|
|
4159
|
+
while (1) switch (_context42.n) {
|
|
4268
4160
|
case 0:
|
|
4269
4161
|
// remove the old renderer instance if any
|
|
4270
4162
|
this.removeRenderer();
|
|
4271
4163
|
if (util_1.Util.canAugment()) {
|
|
4272
|
-
_context42.
|
|
4164
|
+
_context42.n = 1;
|
|
4273
4165
|
break;
|
|
4274
4166
|
}
|
|
4275
|
-
return _context42.
|
|
4276
|
-
case
|
|
4167
|
+
return _context42.a(2, this.startQRCode(this._GetDefaultQROptions()));
|
|
4168
|
+
case 1:
|
|
4277
4169
|
sceneID = this.getAttribute("scene-id");
|
|
4278
4170
|
if (sceneID) {
|
|
4279
|
-
_context42.
|
|
4171
|
+
_context42.n = 2;
|
|
4280
4172
|
break;
|
|
4281
4173
|
}
|
|
4282
4174
|
throw new Error("WebXRController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
|
|
4283
|
-
case
|
|
4175
|
+
case 2:
|
|
4284
4176
|
// required attributes with defaults for plattar-configurator node
|
|
4285
4177
|
width = this.getAttribute("width") || "500px";
|
|
4286
4178
|
height = this.getAttribute("height") || "500px";
|
|
@@ -4299,13 +4191,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4299
4191
|
if (showUI) {
|
|
4300
4192
|
viewer.setAttribute("show-ui", showUI);
|
|
4301
4193
|
}
|
|
4302
|
-
return _context42.
|
|
4194
|
+
return _context42.a(2, new Promise(function (accept, reject) {
|
|
4303
4195
|
_this31.append(viewer);
|
|
4304
4196
|
return accept(viewer);
|
|
4305
4197
|
}));
|
|
4306
|
-
case 20:
|
|
4307
|
-
case "end":
|
|
4308
|
-
return _context42.stop();
|
|
4309
4198
|
}
|
|
4310
4199
|
}, _callee42, this);
|
|
4311
4200
|
}));
|
|
@@ -4317,14 +4206,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4317
4206
|
}, {
|
|
4318
4207
|
key: "initAR",
|
|
4319
4208
|
value: function () {
|
|
4320
|
-
var _initAR5 = _asyncToGenerator(/*#__PURE__*/
|
|
4321
|
-
return
|
|
4322
|
-
while (1) switch (_context43.
|
|
4209
|
+
var _initAR5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43() {
|
|
4210
|
+
return _regenerator().w(function (_context43) {
|
|
4211
|
+
while (1) switch (_context43.n) {
|
|
4323
4212
|
case 0:
|
|
4324
4213
|
throw new Error("WebXRController.initAR() - cannot proceed as AR not available in webxr");
|
|
4325
4214
|
case 1:
|
|
4326
|
-
|
|
4327
|
-
return _context43.stop();
|
|
4215
|
+
return _context43.a(2);
|
|
4328
4216
|
}
|
|
4329
4217
|
}, _callee43);
|
|
4330
4218
|
}));
|
|
@@ -4592,20 +4480,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4592
4480
|
}, {
|
|
4593
4481
|
key: "initAR",
|
|
4594
4482
|
value: function () {
|
|
4595
|
-
var _initAR6 = _asyncToGenerator(/*#__PURE__*/
|
|
4596
|
-
return
|
|
4597
|
-
while (1) switch (_context44.
|
|
4483
|
+
var _initAR6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44() {
|
|
4484
|
+
return _regenerator().w(function (_context44) {
|
|
4485
|
+
while (1) switch (_context44.n) {
|
|
4598
4486
|
case 0:
|
|
4599
4487
|
if (this._controller) {
|
|
4600
|
-
_context44.
|
|
4488
|
+
_context44.n = 1;
|
|
4601
4489
|
break;
|
|
4602
4490
|
}
|
|
4603
4491
|
throw new Error("PlattarEmbed.initAR() - cannot execute as controller has not loaded yet");
|
|
4604
|
-
case
|
|
4605
|
-
return _context44.
|
|
4606
|
-
case 3:
|
|
4607
|
-
case "end":
|
|
4608
|
-
return _context44.stop();
|
|
4492
|
+
case 1:
|
|
4493
|
+
return _context44.a(2, this._controller.initAR());
|
|
4609
4494
|
}
|
|
4610
4495
|
}, _callee44, this);
|
|
4611
4496
|
}));
|
|
@@ -4617,20 +4502,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4617
4502
|
}, {
|
|
4618
4503
|
key: "startAR",
|
|
4619
4504
|
value: function () {
|
|
4620
|
-
var _startAR2 = _asyncToGenerator(/*#__PURE__*/
|
|
4621
|
-
return
|
|
4622
|
-
while (1) switch (_context45.
|
|
4505
|
+
var _startAR2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45() {
|
|
4506
|
+
return _regenerator().w(function (_context45) {
|
|
4507
|
+
while (1) switch (_context45.n) {
|
|
4623
4508
|
case 0:
|
|
4624
4509
|
if (this._controller) {
|
|
4625
|
-
_context45.
|
|
4510
|
+
_context45.n = 1;
|
|
4626
4511
|
break;
|
|
4627
4512
|
}
|
|
4628
4513
|
throw new Error("PlattarEmbed.startAR() - cannot execute as controller has not loaded yet");
|
|
4629
|
-
case
|
|
4630
|
-
return _context45.
|
|
4631
|
-
case 3:
|
|
4632
|
-
case "end":
|
|
4633
|
-
return _context45.stop();
|
|
4514
|
+
case 1:
|
|
4515
|
+
return _context45.a(2, this._controller.startAR());
|
|
4634
4516
|
}
|
|
4635
4517
|
}, _callee45, this);
|
|
4636
4518
|
}));
|
|
@@ -4642,20 +4524,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4642
4524
|
}, {
|
|
4643
4525
|
key: "startViewer",
|
|
4644
4526
|
value: function () {
|
|
4645
|
-
var _startViewer = _asyncToGenerator(/*#__PURE__*/
|
|
4646
|
-
return
|
|
4647
|
-
while (1) switch (_context46.
|
|
4527
|
+
var _startViewer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46() {
|
|
4528
|
+
return _regenerator().w(function (_context46) {
|
|
4529
|
+
while (1) switch (_context46.n) {
|
|
4648
4530
|
case 0:
|
|
4649
4531
|
if (this._controller) {
|
|
4650
|
-
_context46.
|
|
4532
|
+
_context46.n = 1;
|
|
4651
4533
|
break;
|
|
4652
4534
|
}
|
|
4653
4535
|
throw new Error("PlattarEmbed.startViewer() - cannot execute as controller has not loaded yet");
|
|
4654
|
-
case
|
|
4655
|
-
return _context46.
|
|
4656
|
-
case 3:
|
|
4657
|
-
case "end":
|
|
4658
|
-
return _context46.stop();
|
|
4536
|
+
case 1:
|
|
4537
|
+
return _context46.a(2, this._controller.startRenderer());
|
|
4659
4538
|
}
|
|
4660
4539
|
}, _callee46, this);
|
|
4661
4540
|
}));
|
|
@@ -4667,23 +4546,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4667
4546
|
}, {
|
|
4668
4547
|
key: "startQRCode",
|
|
4669
4548
|
value: function () {
|
|
4670
|
-
var _startQRCode3 = _asyncToGenerator(/*#__PURE__*/
|
|
4549
|
+
var _startQRCode3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47() {
|
|
4671
4550
|
var options,
|
|
4672
4551
|
_args47 = arguments;
|
|
4673
|
-
return
|
|
4674
|
-
while (1) switch (_context47.
|
|
4552
|
+
return _regenerator().w(function (_context47) {
|
|
4553
|
+
while (1) switch (_context47.n) {
|
|
4675
4554
|
case 0:
|
|
4676
4555
|
options = _args47.length > 0 && _args47[0] !== undefined ? _args47[0] : null;
|
|
4677
4556
|
if (this._controller) {
|
|
4678
|
-
_context47.
|
|
4557
|
+
_context47.n = 1;
|
|
4679
4558
|
break;
|
|
4680
4559
|
}
|
|
4681
4560
|
throw new Error("PlattarEmbed.startQRCode() - cannot execute as controller has not loaded yet");
|
|
4682
|
-
case
|
|
4683
|
-
return _context47.
|
|
4684
|
-
case 4:
|
|
4685
|
-
case "end":
|
|
4686
|
-
return _context47.stop();
|
|
4561
|
+
case 1:
|
|
4562
|
+
return _context47.a(2, this._controller.startQRCode(options));
|
|
4687
4563
|
}
|
|
4688
4564
|
}, _callee47, this);
|
|
4689
4565
|
}));
|
|
@@ -5324,24 +5200,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5324
5200
|
}, {
|
|
5325
5201
|
key: "decodeState",
|
|
5326
5202
|
value: (function () {
|
|
5327
|
-
var _decodeState = _asyncToGenerator(/*#__PURE__*/
|
|
5203
|
+
var _decodeState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48() {
|
|
5328
5204
|
var sceneID,
|
|
5329
5205
|
state,
|
|
5330
5206
|
configState,
|
|
5331
5207
|
fscene,
|
|
5332
5208
|
scene,
|
|
5333
5209
|
_args48 = arguments;
|
|
5334
|
-
return
|
|
5335
|
-
while (1) switch (_context48.
|
|
5210
|
+
return _regenerator().w(function (_context48) {
|
|
5211
|
+
while (1) switch (_context48.n) {
|
|
5336
5212
|
case 0:
|
|
5337
5213
|
sceneID = _args48.length > 0 && _args48[0] !== undefined ? _args48[0] : null;
|
|
5338
5214
|
state = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : null;
|
|
5339
5215
|
if (!(!sceneID || !state)) {
|
|
5340
|
-
_context48.
|
|
5216
|
+
_context48.n = 1;
|
|
5341
5217
|
break;
|
|
5342
5218
|
}
|
|
5343
5219
|
throw new Error("ConfiguratorState.decodeState(sceneID, state) - sceneID and state must be defined");
|
|
5344
|
-
case
|
|
5220
|
+
case 1:
|
|
5345
5221
|
configState = new ConfiguratorState(state);
|
|
5346
5222
|
fscene = new plattar_api_1.Scene(sceneID);
|
|
5347
5223
|
fscene.include(plattar_api_1.Project);
|
|
@@ -5349,17 +5225,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5349
5225
|
fscene.include(plattar_api_1.SceneProduct);
|
|
5350
5226
|
fscene.include(plattar_api_1.SceneModel);
|
|
5351
5227
|
fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
|
|
5352
|
-
_context48.
|
|
5228
|
+
_context48.n = 2;
|
|
5353
5229
|
return fscene.get();
|
|
5354
|
-
case
|
|
5355
|
-
scene = _context48.
|
|
5356
|
-
return _context48.
|
|
5230
|
+
case 2:
|
|
5231
|
+
scene = _context48.v;
|
|
5232
|
+
return _context48.a(2, {
|
|
5357
5233
|
scene: scene,
|
|
5358
5234
|
state: configState
|
|
5359
5235
|
});
|
|
5360
|
-
case 15:
|
|
5361
|
-
case "end":
|
|
5362
|
-
return _context48.stop();
|
|
5363
5236
|
}
|
|
5364
5237
|
}, _callee48);
|
|
5365
5238
|
}));
|
|
@@ -5378,7 +5251,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5378
5251
|
}, {
|
|
5379
5252
|
key: "decodeScene",
|
|
5380
5253
|
value: (function () {
|
|
5381
|
-
var _decodeScene = _asyncToGenerator(/*#__PURE__*/
|
|
5254
|
+
var _decodeScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49() {
|
|
5382
5255
|
var sceneID,
|
|
5383
5256
|
configState,
|
|
5384
5257
|
fscene,
|
|
@@ -5387,16 +5260,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5387
5260
|
sceneModels,
|
|
5388
5261
|
products,
|
|
5389
5262
|
_args49 = arguments;
|
|
5390
|
-
return
|
|
5391
|
-
while (1) switch (_context49.
|
|
5263
|
+
return _regenerator().w(function (_context49) {
|
|
5264
|
+
while (1) switch (_context49.n) {
|
|
5392
5265
|
case 0:
|
|
5393
5266
|
sceneID = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : null;
|
|
5394
5267
|
if (sceneID) {
|
|
5395
|
-
_context49.
|
|
5268
|
+
_context49.n = 1;
|
|
5396
5269
|
break;
|
|
5397
5270
|
}
|
|
5398
5271
|
throw new Error("ConfiguratorState.decodeScene(sceneID) - sceneID must be defined");
|
|
5399
|
-
case
|
|
5272
|
+
case 1:
|
|
5400
5273
|
configState = new ConfiguratorState();
|
|
5401
5274
|
fscene = new plattar_api_1.Scene(sceneID);
|
|
5402
5275
|
fscene.include(plattar_api_1.Project);
|
|
@@ -5404,10 +5277,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5404
5277
|
fscene.include(plattar_api_1.SceneModel);
|
|
5405
5278
|
fscene.include(plattar_api_1.Product);
|
|
5406
5279
|
fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
|
|
5407
|
-
_context49.
|
|
5280
|
+
_context49.n = 2;
|
|
5408
5281
|
return fscene.get();
|
|
5409
|
-
case
|
|
5410
|
-
scene = _context49.
|
|
5282
|
+
case 2:
|
|
5283
|
+
scene = _context49.v;
|
|
5411
5284
|
sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
|
|
5412
5285
|
sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
|
|
5413
5286
|
products = scene.relationships.filter(plattar_api_1.Product); // add our scene models
|
|
@@ -5451,13 +5324,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5451
5324
|
});
|
|
5452
5325
|
}
|
|
5453
5326
|
});
|
|
5454
|
-
return _context49.
|
|
5327
|
+
return _context49.a(2, {
|
|
5455
5328
|
scene: scene,
|
|
5456
5329
|
state: configState
|
|
5457
5330
|
});
|
|
5458
|
-
case 20:
|
|
5459
|
-
case "end":
|
|
5460
|
-
return _context49.stop();
|
|
5461
5331
|
}
|
|
5462
5332
|
}, _callee49);
|
|
5463
5333
|
}));
|
|
@@ -5611,7 +5481,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5611
5481
|
Object.defineProperty(exports, "__esModule", {
|
|
5612
5482
|
value: true
|
|
5613
5483
|
});
|
|
5614
|
-
exports["default"] = "1.188.
|
|
5484
|
+
exports["default"] = "1.188.3";
|
|
5615
5485
|
}, {}],
|
|
5616
5486
|
21: [function (require, module, exports) {
|
|
5617
5487
|
"use strict";
|
|
@@ -14993,8 +14863,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
14993
14863
|
var i,
|
|
14994
14864
|
r,
|
|
14995
14865
|
n = function () {
|
|
14996
|
-
var t = function t(
|
|
14997
|
-
var i =
|
|
14866
|
+
var t = function t(_t27, e) {
|
|
14867
|
+
var i = _t27,
|
|
14998
14868
|
r = s[e],
|
|
14999
14869
|
n = null,
|
|
15000
14870
|
o = 0,
|
|
@@ -15806,8 +15676,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
15806
15676
|
return $;
|
|
15807
15677
|
}
|
|
15808
15678
|
});
|
|
15809
|
-
var t = function t(
|
|
15810
|
-
return !!
|
|
15679
|
+
var t = function t(_t28) {
|
|
15680
|
+
return !!_t28 && "object" == _typeof(_t28) && !Array.isArray(_t28);
|
|
15811
15681
|
};
|
|
15812
15682
|
function e(i) {
|
|
15813
15683
|
for (var _len7 = arguments.length, r = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
@@ -16403,11 +16273,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16403
16273
|
}, {
|
|
16404
16274
|
key: "drawQR",
|
|
16405
16275
|
value: function () {
|
|
16406
|
-
var _drawQR = _asyncToGenerator(/*#__PURE__*/
|
|
16276
|
+
var _drawQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50(t) {
|
|
16407
16277
|
var _this83 = this;
|
|
16408
|
-
var e, i, r, n, s, _this$_options,
|
|
16409
|
-
return
|
|
16410
|
-
while (1) switch (_context50.
|
|
16278
|
+
var e, i, r, n, s, _this$_options, _t29, _i2, _r5, _a, _t30;
|
|
16279
|
+
return _regenerator().w(function (_context50) {
|
|
16280
|
+
while (1) switch (_context50.n) {
|
|
16411
16281
|
case 0:
|
|
16412
16282
|
e = t.getModuleCount(), i = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r = this._options.shape === g ? i / Math.sqrt(2) : i, n = this._roundSize(r / e);
|
|
16413
16283
|
s = {
|
|
@@ -16417,19 +16287,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16417
16287
|
height: 0
|
|
16418
16288
|
};
|
|
16419
16289
|
if (!(this._qr = t, this._options.image)) {
|
|
16420
|
-
_context50.
|
|
16290
|
+
_context50.n = 3;
|
|
16421
16291
|
break;
|
|
16422
16292
|
}
|
|
16423
|
-
_context50.
|
|
16293
|
+
_context50.n = 1;
|
|
16424
16294
|
return this.loadImage();
|
|
16425
|
-
case
|
|
16295
|
+
case 1:
|
|
16426
16296
|
if (this._image) {
|
|
16427
|
-
_context50.
|
|
16297
|
+
_context50.n = 2;
|
|
16428
16298
|
break;
|
|
16429
16299
|
}
|
|
16430
|
-
return _context50.
|
|
16431
|
-
case
|
|
16432
|
-
_this$_options = this._options,
|
|
16300
|
+
return _context50.a(2);
|
|
16301
|
+
case 2:
|
|
16302
|
+
_this$_options = this._options, _t29 = _this$_options.imageOptions, _i2 = _this$_options.qrOptions, _r5 = _t29.imageSize * o[_i2.errorCorrectionLevel], _a = Math.floor(_r5 * e * e);
|
|
16433
16303
|
s = function (_ref16) {
|
|
16434
16304
|
var t = _ref16.originalHeight,
|
|
16435
16305
|
e = _ref16.originalWidth,
|
|
@@ -16464,28 +16334,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16464
16334
|
maxHiddenAxisDots: e - 14,
|
|
16465
16335
|
dotSize: n
|
|
16466
16336
|
});
|
|
16467
|
-
case
|
|
16337
|
+
case 3:
|
|
16468
16338
|
this.drawBackground();
|
|
16469
16339
|
this.drawDots(function (t, i) {
|
|
16470
16340
|
var r, n, o, a, h, d;
|
|
16471
16341
|
return !(_this83._options.imageOptions.hideBackgroundDots && t >= (e - s.hideYDots) / 2 && t < (e + s.hideYDots) / 2 && i >= (e - s.hideXDots) / 2 && i < (e + s.hideXDots) / 2 || (null === (r = f[t]) || void 0 === r ? void 0 : r[i]) || (null === (n = f[t - e + 7]) || void 0 === n ? void 0 : n[i]) || (null === (o = f[t]) || void 0 === o ? void 0 : o[i - e + 7]) || (null === (a = w[t]) || void 0 === a ? void 0 : a[i]) || (null === (h = w[t - e + 7]) || void 0 === h ? void 0 : h[i]) || (null === (d = w[t]) || void 0 === d ? void 0 : d[i - e + 7]));
|
|
16472
16342
|
});
|
|
16473
16343
|
this.drawCorners();
|
|
16474
|
-
|
|
16475
|
-
if (!
|
|
16476
|
-
_context50.
|
|
16344
|
+
_t30 = this._options.image;
|
|
16345
|
+
if (!_t30) {
|
|
16346
|
+
_context50.n = 4;
|
|
16477
16347
|
break;
|
|
16478
16348
|
}
|
|
16479
|
-
_context50.
|
|
16349
|
+
_context50.n = 4;
|
|
16480
16350
|
return this.drawImage({
|
|
16481
16351
|
width: s.width,
|
|
16482
16352
|
height: s.height,
|
|
16483
16353
|
count: e,
|
|
16484
16354
|
dotSize: n
|
|
16485
16355
|
});
|
|
16486
|
-
case
|
|
16487
|
-
|
|
16488
|
-
return _context50.stop();
|
|
16356
|
+
case 4:
|
|
16357
|
+
return _context50.a(2);
|
|
16489
16358
|
}
|
|
16490
16359
|
}, _callee50, this);
|
|
16491
16360
|
}));
|
|
@@ -16506,8 +16375,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16506
16375
|
var _s6 = n.height,
|
|
16507
16376
|
_a2 = n.width;
|
|
16508
16377
|
if (_r6 || _o) {
|
|
16509
|
-
var
|
|
16510
|
-
this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", "clip-path-background-color-".concat(this._instanceId)), this._defs.appendChild(this._backgroundClipPath), (null === (i = n.backgroundOptions) || void 0 === i ? void 0 : i.round) && (_s6 = _a2 = Math.min(n.width, n.height),
|
|
16378
|
+
var _t31 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
16379
|
+
this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", "clip-path-background-color-".concat(this._instanceId)), this._defs.appendChild(this._backgroundClipPath), (null === (i = n.backgroundOptions) || void 0 === i ? void 0 : i.round) && (_s6 = _a2 = Math.min(n.width, n.height), _t31.setAttribute("rx", String(_s6 / 2 * n.backgroundOptions.round))), _t31.setAttribute("x", String(this._roundSize((n.width - _a2) / 2))), _t31.setAttribute("y", String(this._roundSize((n.height - _s6) / 2))), _t31.setAttribute("width", String(_a2)), _t31.setAttribute("height", String(_s6)), this._backgroundClipPath.appendChild(_t31), this._createColor({
|
|
16511
16380
|
options: _r6,
|
|
16512
16381
|
color: _o,
|
|
16513
16382
|
additionalRotation: 0,
|
|
@@ -16563,29 +16432,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16563
16432
|
_loop2(_e3);
|
|
16564
16433
|
}
|
|
16565
16434
|
if (r.shape === g) {
|
|
16566
|
-
var
|
|
16567
|
-
_e4 = n + 2 *
|
|
16568
|
-
_i3 = d -
|
|
16569
|
-
_r7 = u -
|
|
16435
|
+
var _t32 = this._roundSize((o / h - n) / 2),
|
|
16436
|
+
_e4 = n + 2 * _t32,
|
|
16437
|
+
_i3 = d - _t32 * h,
|
|
16438
|
+
_r7 = u - _t32 * h,
|
|
16570
16439
|
_s7 = [],
|
|
16571
16440
|
_a3 = this._roundSize(_e4 / 2);
|
|
16572
16441
|
for (var _i4 = 0; _i4 < _e4; _i4++) {
|
|
16573
16442
|
_s7[_i4] = [];
|
|
16574
|
-
for (var _r8 = 0; _r8 < _e4; _r8++) _i4 >=
|
|
16443
|
+
for (var _r8 = 0; _r8 < _e4; _r8++) _i4 >= _t32 - 1 && _i4 <= _e4 - _t32 && _r8 >= _t32 - 1 && _r8 <= _e4 - _t32 || Math.sqrt((_i4 - _a3) * (_i4 - _a3) + (_r8 - _a3) * (_r8 - _a3)) > _a3 ? _s7[_i4][_r8] = 0 : _s7[_i4][_r8] = this._qr.isDark(_r8 - 2 * _t32 < 0 ? _r8 : _r8 >= n ? _r8 - 2 * _t32 : _r8 - _t32, _i4 - 2 * _t32 < 0 ? _i4 : _i4 >= n ? _i4 - 2 * _t32 : _i4 - _t32) ? 1 : 0;
|
|
16575
16444
|
}
|
|
16576
|
-
var _loop3 = function _loop3(
|
|
16445
|
+
var _loop3 = function _loop3(_t33) {
|
|
16577
16446
|
var _loop4 = function _loop4(_n) {
|
|
16578
|
-
_s7[
|
|
16447
|
+
_s7[_t33][_n] && (c.draw(_i3 + _n * h, _r7 + _t33 * h, h, function (e, i) {
|
|
16579
16448
|
var r;
|
|
16580
|
-
return !!(null === (r = _s7[
|
|
16449
|
+
return !!(null === (r = _s7[_t33 + i]) || void 0 === r ? void 0 : r[_n + e]);
|
|
16581
16450
|
}), c._element && _this84._dotsClipPath && _this84._dotsClipPath.appendChild(c._element));
|
|
16582
16451
|
};
|
|
16583
16452
|
for (var _n = 0; _n < _e4; _n++) {
|
|
16584
16453
|
_loop4(_n);
|
|
16585
16454
|
}
|
|
16586
16455
|
};
|
|
16587
|
-
for (var
|
|
16588
|
-
_loop3(
|
|
16456
|
+
for (var _t33 = 0; _t33 < _e4; _t33++) {
|
|
16457
|
+
_loop3(_t33);
|
|
16589
16458
|
}
|
|
16590
16459
|
}
|
|
16591
16460
|
}
|
|
@@ -16625,24 +16494,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16625
16494
|
width: a,
|
|
16626
16495
|
name: "corners-square-color-".concat(t, "-").concat(r, "-").concat(_this85._instanceId)
|
|
16627
16496
|
})), (null === (y = e.cornersSquareOptions) || void 0 === y ? void 0 : y.type) && h.includes(e.cornersSquareOptions.type)) {
|
|
16628
|
-
var
|
|
16497
|
+
var _t34 = new d({
|
|
16629
16498
|
svg: _this85._element,
|
|
16630
16499
|
type: e.cornersSquareOptions.type,
|
|
16631
16500
|
window: _this85._window
|
|
16632
16501
|
});
|
|
16633
|
-
|
|
16502
|
+
_t34.draw(z, B, a, n), _t34._element && P && P.appendChild(_t34._element);
|
|
16634
16503
|
} else {
|
|
16635
|
-
var
|
|
16504
|
+
var _t35 = new s({
|
|
16636
16505
|
svg: _this85._element,
|
|
16637
16506
|
type: (null === (x = e.cornersSquareOptions) || void 0 === x ? void 0 : x.type) || e.dotsOptions.type,
|
|
16638
16507
|
window: _this85._window
|
|
16639
16508
|
});
|
|
16640
16509
|
var _loop6 = function _loop6(_e5) {
|
|
16641
16510
|
var _loop7 = function _loop7(_i5) {
|
|
16642
|
-
(null === (S = f[_e5]) || void 0 === S ? void 0 : S[_i5]) && (
|
|
16511
|
+
(null === (S = f[_e5]) || void 0 === S ? void 0 : S[_i5]) && (_t35.draw(z + _i5 * o, B + _e5 * o, o, function (t, r) {
|
|
16643
16512
|
var n;
|
|
16644
16513
|
return !!(null === (n = f[_e5 + r]) || void 0 === n ? void 0 : n[_i5 + t]);
|
|
16645
|
-
}),
|
|
16514
|
+
}), _t35._element && P && P.appendChild(_t35._element));
|
|
16646
16515
|
};
|
|
16647
16516
|
for (var _i5 = 0; _i5 < f[_e5].length; _i5++) {
|
|
16648
16517
|
_loop7(_i5);
|
|
@@ -16662,24 +16531,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16662
16531
|
width: u,
|
|
16663
16532
|
name: "corners-dot-color-".concat(t, "-").concat(r, "-").concat(_this85._instanceId)
|
|
16664
16533
|
})), (null === (O = e.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e.cornersDotOptions.type)) {
|
|
16665
|
-
var
|
|
16534
|
+
var _t36 = new l({
|
|
16666
16535
|
svg: _this85._element,
|
|
16667
16536
|
type: e.cornersDotOptions.type,
|
|
16668
16537
|
window: _this85._window
|
|
16669
16538
|
});
|
|
16670
|
-
|
|
16539
|
+
_t36.draw(z + 2 * o, B + 2 * o, u, n), _t36._element && I && I.appendChild(_t36._element);
|
|
16671
16540
|
} else {
|
|
16672
|
-
var
|
|
16541
|
+
var _t37 = new s({
|
|
16673
16542
|
svg: _this85._element,
|
|
16674
16543
|
type: (null === (D = e.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e.dotsOptions.type,
|
|
16675
16544
|
window: _this85._window
|
|
16676
16545
|
});
|
|
16677
16546
|
var _loop8 = function _loop8(_e6) {
|
|
16678
16547
|
var _loop9 = function _loop9(_i6) {
|
|
16679
|
-
(null === (k = w[_e6]) || void 0 === k ? void 0 : k[_i6]) && (
|
|
16548
|
+
(null === (k = w[_e6]) || void 0 === k ? void 0 : k[_i6]) && (_t37.draw(z + _i6 * o, B + _e6 * o, o, function (t, r) {
|
|
16680
16549
|
var n;
|
|
16681
16550
|
return !!(null === (n = w[_e6 + r]) || void 0 === n ? void 0 : n[_i6 + t]);
|
|
16682
|
-
}),
|
|
16551
|
+
}), _t37._element && I && I.appendChild(_t37._element));
|
|
16683
16552
|
};
|
|
16684
16553
|
for (var _i6 = 0; _i6 < w[_e6].length; _i6++) {
|
|
16685
16554
|
_loop9(_i6);
|
|
@@ -16702,28 +16571,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16702
16571
|
if (null === (i = r.nodeCanvas) || void 0 === i ? void 0 : i.loadImage) r.nodeCanvas.loadImage(r.image).then(function (e) {
|
|
16703
16572
|
var i, n;
|
|
16704
16573
|
if (_this86._image = e, _this86._options.imageOptions.saveAsBlob) {
|
|
16705
|
-
var
|
|
16706
|
-
null === (n = null ==
|
|
16574
|
+
var _t38 = null === (i = r.nodeCanvas) || void 0 === i ? void 0 : i.createCanvas(_this86._image.width, _this86._image.height);
|
|
16575
|
+
null === (n = null == _t38 ? void 0 : _t38.getContext("2d")) || void 0 === n || n.drawImage(e, 0, 0), _this86._imageUri = null == _t38 ? void 0 : _t38.toDataURL();
|
|
16707
16576
|
}
|
|
16708
16577
|
t();
|
|
16709
16578
|
})["catch"](e);else {
|
|
16710
16579
|
var _e7 = new _this86._window.Image();
|
|
16711
|
-
"string" == typeof r.imageOptions.crossOrigin && (_e7.crossOrigin = r.imageOptions.crossOrigin), _this86._image = _e7, _e7.onload = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
16712
|
-
|
|
16713
|
-
|
|
16580
|
+
"string" == typeof r.imageOptions.crossOrigin && (_e7.crossOrigin = r.imageOptions.crossOrigin), _this86._image = _e7, _e7.onload = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52() {
|
|
16581
|
+
var _t39;
|
|
16582
|
+
return _regenerator().w(function (_context52) {
|
|
16583
|
+
while (1) switch (_context52.n) {
|
|
16714
16584
|
case 0:
|
|
16715
|
-
|
|
16716
|
-
if (!
|
|
16717
|
-
_context52.
|
|
16585
|
+
_t39 = _this86._options.imageOptions.saveAsBlob;
|
|
16586
|
+
if (!_t39) {
|
|
16587
|
+
_context52.n = 2;
|
|
16718
16588
|
break;
|
|
16719
16589
|
}
|
|
16720
|
-
_context52.
|
|
16590
|
+
_context52.n = 1;
|
|
16721
16591
|
return function () {
|
|
16722
|
-
var _ref20 = _asyncToGenerator(/*#__PURE__*/
|
|
16723
|
-
return
|
|
16724
|
-
while (1) switch (_context51.
|
|
16592
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(t, e) {
|
|
16593
|
+
return _regenerator().w(function (_context51) {
|
|
16594
|
+
while (1) switch (_context51.n) {
|
|
16725
16595
|
case 0:
|
|
16726
|
-
return _context51.
|
|
16596
|
+
return _context51.a(2, new Promise(function (i) {
|
|
16727
16597
|
var r = new e.XMLHttpRequest();
|
|
16728
16598
|
r.onload = function () {
|
|
16729
16599
|
var t = new e.FileReader();
|
|
@@ -16732,9 +16602,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16732
16602
|
}, t.readAsDataURL(r.response);
|
|
16733
16603
|
}, r.open("GET", t), r.responseType = "blob", r.send();
|
|
16734
16604
|
}));
|
|
16735
|
-
case 1:
|
|
16736
|
-
case "end":
|
|
16737
|
-
return _context51.stop();
|
|
16738
16605
|
}
|
|
16739
16606
|
}, _callee51);
|
|
16740
16607
|
}));
|
|
@@ -16742,13 +16609,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16742
16609
|
return _ref20.apply(this, arguments);
|
|
16743
16610
|
};
|
|
16744
16611
|
}()(r.image || "", _this86._window);
|
|
16745
|
-
case
|
|
16746
|
-
_this86._imageUri = _context52.
|
|
16747
|
-
case
|
|
16612
|
+
case 1:
|
|
16613
|
+
_this86._imageUri = _context52.v;
|
|
16614
|
+
case 2:
|
|
16748
16615
|
t();
|
|
16749
|
-
case
|
|
16750
|
-
|
|
16751
|
-
return _context52.stop();
|
|
16616
|
+
case 3:
|
|
16617
|
+
return _context52.a(2);
|
|
16752
16618
|
}
|
|
16753
16619
|
}, _callee52);
|
|
16754
16620
|
})), _e7.src = r.image;
|
|
@@ -16758,17 +16624,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16758
16624
|
}, {
|
|
16759
16625
|
key: "drawImage",
|
|
16760
16626
|
value: function () {
|
|
16761
|
-
var _drawImage = _asyncToGenerator(/*#__PURE__*/
|
|
16627
|
+
var _drawImage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(_ref21) {
|
|
16762
16628
|
var t, e, i, r, n, o, s, a, h, d, u, c;
|
|
16763
|
-
return
|
|
16764
|
-
while (1) switch (_context53.
|
|
16629
|
+
return _regenerator().w(function (_context53) {
|
|
16630
|
+
while (1) switch (_context53.n) {
|
|
16765
16631
|
case 0:
|
|
16766
16632
|
t = _ref21.width, e = _ref21.height, i = _ref21.count, r = _ref21.dotSize;
|
|
16767
16633
|
n = this._options, o = this._roundSize((n.width - i * r) / 2), s = this._roundSize((n.height - i * r) / 2), a = o + this._roundSize(n.imageOptions.margin + (i * r - t) / 2), h = s + this._roundSize(n.imageOptions.margin + (i * r - e) / 2), d = t - 2 * n.imageOptions.margin, u = e - 2 * n.imageOptions.margin, c = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
16768
16634
|
c.setAttribute("href", this._imageUri || ""), c.setAttribute("xlink:href", this._imageUri || ""), c.setAttribute("x", String(a)), c.setAttribute("y", String(h)), c.setAttribute("width", "".concat(d, "px")), c.setAttribute("height", "".concat(u, "px")), this._element.appendChild(c);
|
|
16769
|
-
case
|
|
16770
|
-
|
|
16771
|
-
return _context53.stop();
|
|
16635
|
+
case 1:
|
|
16636
|
+
return _context53.a(2);
|
|
16772
16637
|
}
|
|
16773
16638
|
}, _callee53, this);
|
|
16774
16639
|
}));
|
|
@@ -16817,7 +16682,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16817
16682
|
var v = p,
|
|
16818
16683
|
_ = "canvas",
|
|
16819
16684
|
m = {};
|
|
16820
|
-
for (var
|
|
16685
|
+
for (var _t40 = 0; _t40 <= 40; _t40++) m[_t40] = _t40;
|
|
16821
16686
|
var b = {
|
|
16822
16687
|
type: _,
|
|
16823
16688
|
shape: "square",
|
|
@@ -16920,12 +16785,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16920
16785
|
t.width = _this89._options.width, t.height = _this89._options.height, null === (i = null === (e = _this89._nodeCanvas) || void 0 === e ? void 0 : e.getContext("2d")) || void 0 === i || i.drawImage(t, 0, 0);
|
|
16921
16786
|
});
|
|
16922
16787
|
{
|
|
16923
|
-
var
|
|
16788
|
+
var _t41 = new _this89._window.Image();
|
|
16924
16789
|
return new Promise(function (e) {
|
|
16925
|
-
|
|
16790
|
+
_t41.onload = function () {
|
|
16926
16791
|
var i, r;
|
|
16927
|
-
null === (r = null === (i = _this89._domCanvas) || void 0 === i ? void 0 : i.getContext("2d")) || void 0 === r || r.drawImage(
|
|
16928
|
-
},
|
|
16792
|
+
null === (r = null === (i = _this89._domCanvas) || void 0 === i ? void 0 : i.getContext("2d")) || void 0 === r || r.drawImage(_t41, 0, 0), e();
|
|
16793
|
+
}, _t41.src = n;
|
|
16929
16794
|
});
|
|
16930
16795
|
}
|
|
16931
16796
|
}));
|
|
@@ -16933,41 +16798,39 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16933
16798
|
}, {
|
|
16934
16799
|
key: "_getElement",
|
|
16935
16800
|
value: function () {
|
|
16936
|
-
var _getElement2 = _asyncToGenerator(/*#__PURE__*/
|
|
16801
|
+
var _getElement2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee54() {
|
|
16937
16802
|
var t,
|
|
16938
|
-
_args54 = arguments
|
|
16939
|
-
|
|
16940
|
-
|
|
16803
|
+
_args54 = arguments,
|
|
16804
|
+
_t42;
|
|
16805
|
+
return _regenerator().w(function (_context54) {
|
|
16806
|
+
while (1) switch (_context54.n) {
|
|
16941
16807
|
case 0:
|
|
16942
16808
|
t = _args54.length > 0 && _args54[0] !== undefined ? _args54[0] : "png";
|
|
16943
16809
|
if (this._qr) {
|
|
16944
|
-
_context54.
|
|
16810
|
+
_context54.n = 1;
|
|
16945
16811
|
break;
|
|
16946
16812
|
}
|
|
16947
16813
|
throw "QR code is empty";
|
|
16948
|
-
case
|
|
16814
|
+
case 1:
|
|
16949
16815
|
if (!("svg" === t.toLowerCase())) {
|
|
16950
|
-
_context54.
|
|
16816
|
+
_context54.n = 3;
|
|
16951
16817
|
break;
|
|
16952
16818
|
}
|
|
16953
16819
|
this._svg && this._svgDrawingPromise || this._setupSvg();
|
|
16954
|
-
_context54.
|
|
16820
|
+
_context54.n = 2;
|
|
16955
16821
|
return this._svgDrawingPromise;
|
|
16956
|
-
case
|
|
16957
|
-
|
|
16958
|
-
_context54.
|
|
16822
|
+
case 2:
|
|
16823
|
+
_t42 = this._svg;
|
|
16824
|
+
_context54.n = 5;
|
|
16959
16825
|
break;
|
|
16960
|
-
case
|
|
16826
|
+
case 3:
|
|
16961
16827
|
(this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas();
|
|
16962
|
-
_context54.
|
|
16828
|
+
_context54.n = 4;
|
|
16963
16829
|
return this._canvasDrawingPromise;
|
|
16964
|
-
case
|
|
16965
|
-
|
|
16966
|
-
case
|
|
16967
|
-
return _context54.
|
|
16968
|
-
case 15:
|
|
16969
|
-
case "end":
|
|
16970
|
-
return _context54.stop();
|
|
16830
|
+
case 4:
|
|
16831
|
+
_t42 = this._domCanvas || this._nodeCanvas;
|
|
16832
|
+
case 5:
|
|
16833
|
+
return _context54.a(2, _t42);
|
|
16971
16834
|
}
|
|
16972
16835
|
}, _callee54, this);
|
|
16973
16836
|
}));
|
|
@@ -17012,43 +16875,43 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
17012
16875
|
}, {
|
|
17013
16876
|
key: "getRawData",
|
|
17014
16877
|
value: function () {
|
|
17015
|
-
var _getRawData = _asyncToGenerator(/*#__PURE__*/
|
|
16878
|
+
var _getRawData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee55() {
|
|
17016
16879
|
var t,
|
|
17017
16880
|
e,
|
|
17018
16881
|
i,
|
|
17019
|
-
|
|
16882
|
+
_t43,
|
|
17020
16883
|
_args55 = arguments;
|
|
17021
|
-
return
|
|
17022
|
-
while (1) switch (_context55.
|
|
16884
|
+
return _regenerator().w(function (_context55) {
|
|
16885
|
+
while (1) switch (_context55.n) {
|
|
17023
16886
|
case 0:
|
|
17024
16887
|
t = _args55.length > 0 && _args55[0] !== undefined ? _args55[0] : "png";
|
|
17025
16888
|
if (this._qr) {
|
|
17026
|
-
_context55.
|
|
16889
|
+
_context55.n = 1;
|
|
17027
16890
|
break;
|
|
17028
16891
|
}
|
|
17029
16892
|
throw "QR code is empty";
|
|
17030
|
-
case
|
|
17031
|
-
_context55.
|
|
16893
|
+
case 1:
|
|
16894
|
+
_context55.n = 2;
|
|
17032
16895
|
return this._getElement(t);
|
|
17033
|
-
case
|
|
17034
|
-
e = _context55.
|
|
16896
|
+
case 2:
|
|
16897
|
+
e = _context55.v;
|
|
17035
16898
|
i = A(t);
|
|
17036
16899
|
if (e) {
|
|
17037
|
-
_context55.
|
|
16900
|
+
_context55.n = 3;
|
|
17038
16901
|
break;
|
|
17039
16902
|
}
|
|
17040
|
-
return _context55.
|
|
17041
|
-
case
|
|
16903
|
+
return _context55.a(2, null);
|
|
16904
|
+
case 3:
|
|
17042
16905
|
if (!("svg" === t.toLowerCase())) {
|
|
17043
|
-
_context55.
|
|
16906
|
+
_context55.n = 4;
|
|
17044
16907
|
break;
|
|
17045
16908
|
}
|
|
17046
|
-
|
|
17047
|
-
return _context55.
|
|
16909
|
+
_t43 = "<?xml version=\"1.0\" standalone=\"no\"?>\r\n".concat(new this._window.XMLSerializer().serializeToString(e));
|
|
16910
|
+
return _context55.a(2, "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(_t43) : new Blob([_t43], {
|
|
17048
16911
|
type: i
|
|
17049
16912
|
}));
|
|
17050
|
-
case
|
|
17051
|
-
return _context55.
|
|
16913
|
+
case 4:
|
|
16914
|
+
return _context55.a(2, new Promise(function (t) {
|
|
17052
16915
|
var r = e;
|
|
17053
16916
|
if ("toBuffer" in r) {
|
|
17054
16917
|
if ("image/png" === i) t(r.toBuffer(i));else if ("image/jpeg" === i) t(r.toBuffer(i));else {
|
|
@@ -17057,9 +16920,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
17057
16920
|
}
|
|
17058
16921
|
} else "toBlob" in r && r.toBlob(t, i, 1);
|
|
17059
16922
|
}));
|
|
17060
|
-
case 13:
|
|
17061
|
-
case "end":
|
|
17062
|
-
return _context55.stop();
|
|
17063
16923
|
}
|
|
17064
16924
|
}, _callee55, this);
|
|
17065
16925
|
}));
|
|
@@ -17071,36 +16931,35 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
17071
16931
|
}, {
|
|
17072
16932
|
key: "download",
|
|
17073
16933
|
value: function () {
|
|
17074
|
-
var _download = _asyncToGenerator(/*#__PURE__*/
|
|
17075
|
-
var e, i, r,
|
|
17076
|
-
return
|
|
17077
|
-
while (1) switch (_context56.
|
|
16934
|
+
var _download = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee56(t) {
|
|
16935
|
+
var e, i, r, _t44;
|
|
16936
|
+
return _regenerator().w(function (_context56) {
|
|
16937
|
+
while (1) switch (_context56.n) {
|
|
17078
16938
|
case 0:
|
|
17079
16939
|
if (this._qr) {
|
|
17080
|
-
_context56.
|
|
16940
|
+
_context56.n = 1;
|
|
17081
16941
|
break;
|
|
17082
16942
|
}
|
|
17083
16943
|
throw "QR code is empty";
|
|
17084
|
-
case
|
|
16944
|
+
case 1:
|
|
17085
16945
|
if (!("undefined" == typeof Blob)) {
|
|
17086
|
-
_context56.
|
|
16946
|
+
_context56.n = 2;
|
|
17087
16947
|
break;
|
|
17088
16948
|
}
|
|
17089
16949
|
throw "Cannot download in Node.js, call getRawData instead.";
|
|
17090
|
-
case
|
|
16950
|
+
case 2:
|
|
17091
16951
|
e = "png", i = "qr";
|
|
17092
16952
|
"string" == typeof t ? (e = t, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : "object" == _typeof(t) && null !== t && (t.name && (i = t.name), t.extension && (e = t.extension));
|
|
17093
|
-
_context56.
|
|
16953
|
+
_context56.n = 3;
|
|
17094
16954
|
return this._getElement(e);
|
|
17095
|
-
case
|
|
17096
|
-
r = _context56.
|
|
16955
|
+
case 3:
|
|
16956
|
+
r = _context56.v;
|
|
17097
16957
|
if (r) if ("svg" === e.toLowerCase()) {
|
|
17098
|
-
|
|
17099
|
-
|
|
16958
|
+
_t44 = new XMLSerializer().serializeToString(r);
|
|
16959
|
+
_t44 = '<?xml version="1.0" standalone="no"?>\r\n' + _t44, n("data:".concat(A(e), ";charset=utf-8,").concat(encodeURIComponent(_t44)), "".concat(i, ".svg"));
|
|
17100
16960
|
} else n(r.toDataURL(A(e)), "".concat(i, ".").concat(e));
|
|
17101
|
-
case
|
|
17102
|
-
|
|
17103
|
-
return _context56.stop();
|
|
16961
|
+
case 4:
|
|
16962
|
+
return _context56.a(2);
|
|
17104
16963
|
}
|
|
17105
16964
|
}, _callee56, this);
|
|
17106
16965
|
}));
|