@plattar/plattar-ar-adapter 1.188.3 → 1.188.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es2015/plattar-ar-adapter.js +376 -234
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +147 -73
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/embed/controllers/configurator-controller.d.ts +2 -2
- package/dist/embed/controllers/configurator-controller.js +17 -8
- package/dist/embed/controllers/gallery-controller.d.ts +2 -2
- package/dist/embed/controllers/gallery-controller.js +17 -8
- package/dist/embed/controllers/launcher-controller.js +27 -22
- package/dist/embed/controllers/plattar-controller.d.ts +12 -4
- package/dist/embed/controllers/plattar-controller.js +37 -26
- package/dist/embed/controllers/vto-controller.d.ts +2 -2
- package/dist/embed/controllers/vto-controller.js +17 -8
- package/dist/util/configurator-state.d.ts +1 -0
- package/dist/util/configurator-state.js +31 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -18,7 +18,7 @@ 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 _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) && (
|
|
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) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = 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
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); }
|
|
23
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); }
|
|
24
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); }); }; }
|
|
@@ -1710,6 +1710,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1710
1710
|
case 7:
|
|
1711
1711
|
this.startQRCode(this._prevQROpt);
|
|
1712
1712
|
return _context8.a(2);
|
|
1713
|
+
case 8:
|
|
1714
|
+
return _context8.a(2);
|
|
1713
1715
|
}
|
|
1714
1716
|
}, _callee8, this);
|
|
1715
1717
|
}));
|
|
@@ -1772,12 +1774,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1772
1774
|
value: function () {
|
|
1773
1775
|
var _startViewerQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
|
|
1774
1776
|
var _this14 = this;
|
|
1775
|
-
var sceneID, configState, dState, product, controller,
|
|
1777
|
+
var opt, sceneID, configState, dState, product, controller, viewer, width, height, dst, showAR, showUI, showBanner, sceneGraphID, _t4;
|
|
1776
1778
|
return _regenerator().w(function (_context0) {
|
|
1777
1779
|
while (1) switch (_context0.n) {
|
|
1778
1780
|
case 0:
|
|
1779
|
-
// remove the old renderer instance if any
|
|
1780
|
-
|
|
1781
|
+
opt = this._GetDefaultQROptions(options); // remove the old renderer instance if any
|
|
1782
|
+
if (!opt.detached) {
|
|
1783
|
+
this.removeRenderer();
|
|
1784
|
+
}
|
|
1781
1785
|
sceneID = this.getAttribute("scene-id");
|
|
1782
1786
|
if (sceneID) {
|
|
1783
1787
|
_context0.n = 1;
|
|
@@ -1822,9 +1826,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1822
1826
|
// config state is not available
|
|
1823
1827
|
configState = null;
|
|
1824
1828
|
case 7:
|
|
1825
|
-
opt = options || this._GetDefaultQROptions();
|
|
1826
1829
|
viewer = document.createElement("plattar-qrcode");
|
|
1827
|
-
|
|
1830
|
+
if (!opt.detached) {
|
|
1831
|
+
this._element = viewer;
|
|
1832
|
+
}
|
|
1828
1833
|
// required attributes with defaults for plattar-viewer node
|
|
1829
1834
|
width = this.getAttribute("width") || "500px";
|
|
1830
1835
|
height = this.getAttribute("height") || "500px";
|
|
@@ -1861,14 +1866,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1861
1866
|
dst += "&scene_graph_id=" + sceneGraphID;
|
|
1862
1867
|
}
|
|
1863
1868
|
viewer.setAttribute("url", opt.url || dst);
|
|
1864
|
-
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
1865
1869
|
this._prevQROpt = opt;
|
|
1870
|
+
if (opt.detached) {
|
|
1871
|
+
_context0.n = 8;
|
|
1872
|
+
break;
|
|
1873
|
+
}
|
|
1874
|
+
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
1866
1875
|
return _context0.a(2, new Promise(function (accept, reject) {
|
|
1867
1876
|
viewer.onload = function () {
|
|
1868
1877
|
return accept(viewer);
|
|
1869
1878
|
};
|
|
1870
1879
|
_this14.append(viewer);
|
|
1871
1880
|
}));
|
|
1881
|
+
case 8:
|
|
1882
|
+
return _context0.a(2, new Promise(function (accept, reject) {
|
|
1883
|
+
return accept(viewer);
|
|
1884
|
+
}));
|
|
1872
1885
|
}
|
|
1873
1886
|
}, _callee0, this, [[2, 6]]);
|
|
1874
1887
|
}));
|
|
@@ -2026,6 +2039,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2026
2039
|
return _context10.a(2, this._InitARInherited());
|
|
2027
2040
|
case 8:
|
|
2028
2041
|
return _context10.a(2, this._InitARGenerated());
|
|
2042
|
+
case 9:
|
|
2043
|
+
return _context10.a(2);
|
|
2029
2044
|
}
|
|
2030
2045
|
}, _callee10, this, [[1, 5]]);
|
|
2031
2046
|
}));
|
|
@@ -2235,6 +2250,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2235
2250
|
case 4:
|
|
2236
2251
|
this.startQRCode(this._prevQROpt);
|
|
2237
2252
|
return _context14.a(2);
|
|
2253
|
+
case 5:
|
|
2254
|
+
return _context14.a(2);
|
|
2238
2255
|
}
|
|
2239
2256
|
}, _callee14, this);
|
|
2240
2257
|
}));
|
|
@@ -2248,12 +2265,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2248
2265
|
value: function () {
|
|
2249
2266
|
var _startViewerQRCode2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(options) {
|
|
2250
2267
|
var _this17 = this;
|
|
2251
|
-
var
|
|
2268
|
+
var opt, sceneID, viewer, width, height, dst;
|
|
2252
2269
|
return _regenerator().w(function (_context15) {
|
|
2253
2270
|
while (1) switch (_context15.n) {
|
|
2254
2271
|
case 0:
|
|
2255
|
-
// remove the old renderer instance if any
|
|
2256
|
-
|
|
2272
|
+
opt = this._GetDefaultQROptions(options); // remove the old renderer instance if any
|
|
2273
|
+
if (!opt.detached) {
|
|
2274
|
+
this.removeRenderer();
|
|
2275
|
+
}
|
|
2257
2276
|
sceneID = this.getAttribute("scene-id");
|
|
2258
2277
|
if (sceneID) {
|
|
2259
2278
|
_context15.n = 1;
|
|
@@ -2261,9 +2280,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2261
2280
|
}
|
|
2262
2281
|
throw new Error("GalleryController.startViewerQRCode() - minimum required attributes not set, use scene-id as a minimum");
|
|
2263
2282
|
case 1:
|
|
2264
|
-
opt = options || this._GetDefaultQROptions();
|
|
2265
2283
|
viewer = document.createElement("plattar-qrcode");
|
|
2266
|
-
|
|
2284
|
+
if (!opt.detached) {
|
|
2285
|
+
this._element = viewer;
|
|
2286
|
+
}
|
|
2267
2287
|
// required attributes with defaults for plattar-viewer node
|
|
2268
2288
|
width = this.getAttribute("width") || "500px";
|
|
2269
2289
|
height = this.getAttribute("height") || "500px";
|
|
@@ -2281,14 +2301,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2281
2301
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
2282
2302
|
dst = plattar_api_1.Server.location().base + "renderer/gallery.html?scene_id=" + sceneID;
|
|
2283
2303
|
viewer.setAttribute("url", opt.url || dst);
|
|
2284
|
-
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
2285
2304
|
this._prevQROpt = opt;
|
|
2305
|
+
if (opt.detached) {
|
|
2306
|
+
_context15.n = 2;
|
|
2307
|
+
break;
|
|
2308
|
+
}
|
|
2309
|
+
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
2286
2310
|
return _context15.a(2, new Promise(function (accept, reject) {
|
|
2287
2311
|
viewer.onload = function () {
|
|
2288
2312
|
return accept(viewer);
|
|
2289
2313
|
};
|
|
2290
2314
|
_this17.append(viewer);
|
|
2291
2315
|
}));
|
|
2316
|
+
case 2:
|
|
2317
|
+
return _context15.a(2, new Promise(function (accept, reject) {
|
|
2318
|
+
return accept(viewer);
|
|
2319
|
+
}));
|
|
2292
2320
|
}
|
|
2293
2321
|
}, _callee15, this);
|
|
2294
2322
|
}));
|
|
@@ -2423,11 +2451,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2423
2451
|
return _regenerator().w(function (_context19) {
|
|
2424
2452
|
while (1) switch (_context19.n) {
|
|
2425
2453
|
case 0:
|
|
2426
|
-
state = this._state;
|
|
2427
|
-
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
2428
|
-
_context19.n = 5;
|
|
2429
|
-
break;
|
|
2430
|
-
}
|
|
2454
|
+
state = this._state;
|
|
2431
2455
|
if (!(attributeName === "variation-id")) {
|
|
2432
2456
|
_context19.n = 2;
|
|
2433
2457
|
break;
|
|
@@ -2456,8 +2480,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2456
2480
|
_configState3.state.setVariationSKU(variationSKU);
|
|
2457
2481
|
});
|
|
2458
2482
|
case 4:
|
|
2483
|
+
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
2484
|
+
_context19.n = 5;
|
|
2485
|
+
break;
|
|
2486
|
+
}
|
|
2459
2487
|
this.startQRCode(this._prevQROpt);
|
|
2460
2488
|
return _context19.a(2);
|
|
2489
|
+
case 5:
|
|
2490
|
+
return _context19.a(2);
|
|
2461
2491
|
}
|
|
2462
2492
|
}, _callee19, this);
|
|
2463
2493
|
}));
|
|
@@ -2536,7 +2566,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2536
2566
|
value: function () {
|
|
2537
2567
|
var _startRenderer3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
|
|
2538
2568
|
var _this20 = this;
|
|
2539
|
-
var sceneID, configState, qrOptions, embedType, productID, sceneProductID, variationID, variationSKU, arMode, showBanner, sceneGraphID, width, height, server, viewer,
|
|
2569
|
+
var sceneID, configState, qrOptions, embedType, productID, sceneProductID, variationID, variationSKU, arMode, showBanner, sceneGraphID, width, height, server, viewer, _sceneGraphID, _t11;
|
|
2540
2570
|
return _regenerator().w(function (_context22) {
|
|
2541
2571
|
while (1) switch (_context22.n) {
|
|
2542
2572
|
case 0:
|
|
@@ -2594,15 +2624,32 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2594
2624
|
if (showBanner) {
|
|
2595
2625
|
viewer.setAttribute("show-ar-banner", showBanner);
|
|
2596
2626
|
}
|
|
2597
|
-
if (
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
viewer.setAttribute("config-state", encodedState);
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
if (sceneGraphID) {
|
|
2604
|
-
viewer.setAttribute("scene-graph-id", sceneGraphID);
|
|
2627
|
+
if (!sceneGraphID) {
|
|
2628
|
+
_context22.n = 3;
|
|
2629
|
+
break;
|
|
2605
2630
|
}
|
|
2631
|
+
viewer.setAttribute("scene-graph-id", sceneGraphID);
|
|
2632
|
+
_context22.n = 7;
|
|
2633
|
+
break;
|
|
2634
|
+
case 3:
|
|
2635
|
+
_context22.p = 3;
|
|
2636
|
+
_context22.n = 4;
|
|
2637
|
+
return this.getConfiguratorState();
|
|
2638
|
+
case 4:
|
|
2639
|
+
_context22.n = 5;
|
|
2640
|
+
return _context22.v.state.encodeSceneGraphID();
|
|
2641
|
+
case 5:
|
|
2642
|
+
_sceneGraphID = _context22.v;
|
|
2643
|
+
viewer.setAttribute("scene-graph-id", _sceneGraphID);
|
|
2644
|
+
_context22.n = 7;
|
|
2645
|
+
break;
|
|
2646
|
+
case 6:
|
|
2647
|
+
_context22.p = 6;
|
|
2648
|
+
_t11 = _context22.v;
|
|
2649
|
+
// scene graph ID not available for some reason
|
|
2650
|
+
// we will generate a new one
|
|
2651
|
+
console.error(_t11);
|
|
2652
|
+
case 7:
|
|
2606
2653
|
return _context22.a(2, new Promise(function (accept, reject) {
|
|
2607
2654
|
_this20.append(viewer);
|
|
2608
2655
|
if (configState) {
|
|
@@ -2611,7 +2658,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2611
2658
|
return accept(viewer);
|
|
2612
2659
|
}));
|
|
2613
2660
|
}
|
|
2614
|
-
}, _callee22, this);
|
|
2661
|
+
}, _callee22, this, [[3, 6]]);
|
|
2615
2662
|
}));
|
|
2616
2663
|
function startRenderer() {
|
|
2617
2664
|
return _startRenderer3.apply(this, arguments);
|
|
@@ -2622,7 +2669,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2622
2669
|
key: "initAR",
|
|
2623
2670
|
value: function () {
|
|
2624
2671
|
var _initAR3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23() {
|
|
2625
|
-
var dState, product, controller, arMode,
|
|
2672
|
+
var dState, product, controller, arMode, _t12, _t13;
|
|
2626
2673
|
return _regenerator().w(function (_context23) {
|
|
2627
2674
|
while (1) switch (_context23.n) {
|
|
2628
2675
|
case 0:
|
|
@@ -2662,16 +2709,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2662
2709
|
break;
|
|
2663
2710
|
case 5:
|
|
2664
2711
|
_context23.p = 5;
|
|
2665
|
-
|
|
2712
|
+
_t12 = _context23.v;
|
|
2666
2713
|
case 6:
|
|
2667
2714
|
arMode = this.getAttribute("ar-mode") || "generated";
|
|
2668
|
-
|
|
2669
|
-
_context23.n =
|
|
2715
|
+
_t13 = arMode.toLowerCase();
|
|
2716
|
+
_context23.n = _t13 === "inherited" ? 7 : _t13 === "generated" ? 8 : 8;
|
|
2670
2717
|
break;
|
|
2671
2718
|
case 7:
|
|
2672
2719
|
return _context23.a(2, this._InitARInherited());
|
|
2673
2720
|
case 8:
|
|
2674
2721
|
return _context23.a(2, this._InitARGenerated());
|
|
2722
|
+
case 9:
|
|
2723
|
+
return _context23.a(2);
|
|
2675
2724
|
}
|
|
2676
2725
|
}, _callee23, this, [[1, 5]]);
|
|
2677
2726
|
}));
|
|
@@ -2735,7 +2784,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2735
2784
|
key: "_InitARGenerated",
|
|
2736
2785
|
value: (function () {
|
|
2737
2786
|
var _InitARGenerated3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
|
|
2738
|
-
var sceneID, graphID, _configAR2, configAR,
|
|
2787
|
+
var sceneID, graphID, _configAR2, configAR, _t14, _t15, _t16, _t17;
|
|
2739
2788
|
return _regenerator().w(function (_context25) {
|
|
2740
2789
|
while (1) switch (_context25.n) {
|
|
2741
2790
|
case 0:
|
|
@@ -2758,17 +2807,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2758
2807
|
});
|
|
2759
2808
|
return _context25.a(2, _configAR2.init());
|
|
2760
2809
|
case 2:
|
|
2761
|
-
|
|
2810
|
+
_t14 = configurator_ar_1.ConfiguratorAR;
|
|
2762
2811
|
_context25.n = 3;
|
|
2763
2812
|
return this.getConfiguratorState();
|
|
2764
2813
|
case 3:
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
state:
|
|
2769
|
-
useARBanner:
|
|
2814
|
+
_t15 = _context25.v;
|
|
2815
|
+
_t16 = this.getBooleanAttribute("show-ar-banner");
|
|
2816
|
+
_t17 = {
|
|
2817
|
+
state: _t15,
|
|
2818
|
+
useARBanner: _t16
|
|
2770
2819
|
};
|
|
2771
|
-
configAR = new
|
|
2820
|
+
configAR = new _t14(_t17);
|
|
2772
2821
|
return _context25.a(2, configAR.init());
|
|
2773
2822
|
}
|
|
2774
2823
|
}, _callee25, this);
|
|
@@ -2832,18 +2881,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2832
2881
|
* Default QR Code rendering options
|
|
2833
2882
|
*/
|
|
2834
2883
|
function _GetDefaultQROptions() {
|
|
2884
|
+
var _options$color, _options$qrType, _options$shorten, _options$margin, _options$detached, _options$url;
|
|
2885
|
+
var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2886
|
+
var options = opt !== null && opt !== void 0 ? opt : {};
|
|
2835
2887
|
return {
|
|
2836
|
-
color: this.getAttribute("qr-color") || "#101721",
|
|
2837
|
-
qrType: this.getAttribute("qr-style") || "default",
|
|
2838
|
-
shorten: this.
|
|
2839
|
-
margin: 0
|
|
2888
|
+
color: (_options$color = options.color) !== null && _options$color !== void 0 ? _options$color : this.getAttribute("qr-color") || "#101721",
|
|
2889
|
+
qrType: (_options$qrType = options.qrType) !== null && _options$qrType !== void 0 ? _options$qrType : this.getAttribute("qr-style") || "default",
|
|
2890
|
+
shorten: (_options$shorten = options.shorten) !== null && _options$shorten !== void 0 ? _options$shorten : this.getBooleanAttribute("qr-shorten") || true,
|
|
2891
|
+
margin: (_options$margin = options.margin) !== null && _options$margin !== void 0 ? _options$margin : 0,
|
|
2892
|
+
detached: (_options$detached = options.detached) !== null && _options$detached !== void 0 ? _options$detached : this.getBooleanAttribute("qr-detached") || false,
|
|
2893
|
+
url: (_options$url = options.url) !== null && _options$url !== void 0 ? _options$url : null
|
|
2840
2894
|
};
|
|
2841
2895
|
}
|
|
2842
2896
|
}, {
|
|
2843
2897
|
key: "createConfiguratorState",
|
|
2844
2898
|
value: (function () {
|
|
2845
2899
|
var _createConfiguratorState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
|
|
2846
|
-
var sceneID, configState, variationIDs, variationSKUs, decodedState, variationIDList, variationSKUList,
|
|
2900
|
+
var sceneID, configState, variationIDs, variationSKUs, decodedState, variationIDList, variationSKUList, _t18;
|
|
2847
2901
|
return _regenerator().w(function (_context26) {
|
|
2848
2902
|
while (1) switch (_context26.n) {
|
|
2849
2903
|
case 0:
|
|
@@ -2865,16 +2919,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2865
2919
|
_context26.n = 2;
|
|
2866
2920
|
return configurator_state_1.ConfiguratorState.decodeState(sceneID, configState);
|
|
2867
2921
|
case 2:
|
|
2868
|
-
|
|
2922
|
+
_t18 = _context26.v;
|
|
2869
2923
|
_context26.n = 5;
|
|
2870
2924
|
break;
|
|
2871
2925
|
case 3:
|
|
2872
2926
|
_context26.n = 4;
|
|
2873
2927
|
return configurator_state_1.ConfiguratorState.decodeScene(sceneID);
|
|
2874
2928
|
case 4:
|
|
2875
|
-
|
|
2929
|
+
_t18 = _context26.v;
|
|
2876
2930
|
case 5:
|
|
2877
|
-
decodedState =
|
|
2931
|
+
decodedState = _t18;
|
|
2878
2932
|
// change the ID's and SKU's (if any) of the default configuration state
|
|
2879
2933
|
variationIDList = variationIDs ? variationIDs.split(",") : [];
|
|
2880
2934
|
variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
@@ -2983,18 +3037,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2983
3037
|
key: "startQRCode",
|
|
2984
3038
|
value: (function () {
|
|
2985
3039
|
var _startQRCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(options) {
|
|
2986
|
-
var qrType,
|
|
3040
|
+
var qrType, _t19;
|
|
2987
3041
|
return _regenerator().w(function (_context28) {
|
|
2988
3042
|
while (1) switch (_context28.n) {
|
|
2989
3043
|
case 0:
|
|
2990
3044
|
qrType = this.getAttribute("qr-type") || "viewer";
|
|
2991
|
-
|
|
2992
|
-
_context28.n =
|
|
3045
|
+
_t19 = qrType.toLowerCase();
|
|
3046
|
+
_context28.n = _t19 === "ar" ? 1 : _t19 === "viewer" ? 2 : 2;
|
|
2993
3047
|
break;
|
|
2994
3048
|
case 1:
|
|
2995
3049
|
return _context28.a(2, this.startARQRCode(options));
|
|
2996
3050
|
case 2:
|
|
2997
3051
|
return _context28.a(2, this.startViewerQRCode(options));
|
|
3052
|
+
case 3:
|
|
3053
|
+
return _context28.a(2);
|
|
2998
3054
|
}
|
|
2999
3055
|
}, _callee28, this);
|
|
3000
3056
|
}));
|
|
@@ -3014,15 +3070,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3014
3070
|
value: (function () {
|
|
3015
3071
|
var _startARQRCode3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(options) {
|
|
3016
3072
|
var _this21 = this;
|
|
3017
|
-
var opt, viewer, width, height, qrOptions, dst,
|
|
3073
|
+
var opt, viewer, width, height, qrOptions, dst, sceneID, embedType, productID, sceneProductID, variationID, variationSKU, arMode, showBanner, sceneGraphID, _sceneGraphID2, _t20;
|
|
3018
3074
|
return _regenerator().w(function (_context29) {
|
|
3019
3075
|
while (1) switch (_context29.n) {
|
|
3020
3076
|
case 0:
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
opt
|
|
3024
|
-
|
|
3025
|
-
|
|
3077
|
+
opt = this._GetDefaultQROptions(options);
|
|
3078
|
+
viewer = document.createElement("plattar-qrcode"); // remove the old renderer instance if any
|
|
3079
|
+
if (!opt.detached) {
|
|
3080
|
+
this.removeRenderer();
|
|
3081
|
+
this._element = viewer;
|
|
3082
|
+
}
|
|
3026
3083
|
// required attributes with defaults for plattar-viewer node
|
|
3027
3084
|
width = this.getAttribute("width") || "500px";
|
|
3028
3085
|
height = this.getAttribute("height") || "500px";
|
|
@@ -3032,15 +3089,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3032
3089
|
viewer.setAttribute("color", opt.color);
|
|
3033
3090
|
}
|
|
3034
3091
|
if (opt.margin) {
|
|
3035
|
-
viewer.setAttribute("margin", ""
|
|
3092
|
+
viewer.setAttribute("margin", "".concat(opt.margin));
|
|
3036
3093
|
}
|
|
3037
3094
|
if (opt.qrType) {
|
|
3038
3095
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
3039
3096
|
}
|
|
3040
3097
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
3041
3098
|
qrOptions = btoa(JSON.stringify(opt));
|
|
3042
|
-
dst = plattar_api_1.Server.location().base + "renderer/launcher.html?qr_options=" + qrOptions;
|
|
3043
|
-
configState = null;
|
|
3099
|
+
dst = plattar_api_1.Server.location().base + "renderer/launcher.html?qr_options=" + qrOptions; //let configState: string | null = null;
|
|
3044
3100
|
sceneID = this.getAttribute("scene-id");
|
|
3045
3101
|
embedType = this.getAttribute("embed-type");
|
|
3046
3102
|
productID = this.getAttribute("product-id");
|
|
@@ -3050,22 +3106,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3050
3106
|
arMode = this.getAttribute("ar-mode");
|
|
3051
3107
|
showBanner = this.getAttribute("show-ar-banner");
|
|
3052
3108
|
sceneGraphID = this.getAttribute("scene-graph-id");
|
|
3053
|
-
_context29.p = 1;
|
|
3054
|
-
_context29.n = 2;
|
|
3055
|
-
return this.getConfiguratorState();
|
|
3056
|
-
case 2:
|
|
3057
|
-
configState = _context29.v.state.encode();
|
|
3058
|
-
_context29.n = 4;
|
|
3059
|
-
break;
|
|
3060
|
-
case 3:
|
|
3061
|
-
_context29.p = 3;
|
|
3062
|
-
_t19 = _context29.v;
|
|
3063
|
-
// config state not available for some reason
|
|
3064
|
-
configState = null;
|
|
3065
|
-
case 4:
|
|
3066
|
-
if (configState) {
|
|
3067
|
-
dst += "&config_state=" + configState;
|
|
3068
|
-
}
|
|
3069
3109
|
if (embedType) {
|
|
3070
3110
|
dst += "&embed_type=" + embedType;
|
|
3071
3111
|
}
|
|
@@ -3090,20 +3130,51 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3090
3130
|
if (showBanner) {
|
|
3091
3131
|
dst += "&show_ar_banner=" + showBanner;
|
|
3092
3132
|
}
|
|
3093
|
-
if (sceneGraphID) {
|
|
3094
|
-
|
|
3133
|
+
if (!sceneGraphID) {
|
|
3134
|
+
_context29.n = 1;
|
|
3135
|
+
break;
|
|
3095
3136
|
}
|
|
3137
|
+
dst += "&scene_graph_id" + sceneGraphID;
|
|
3138
|
+
_context29.n = 5;
|
|
3139
|
+
break;
|
|
3140
|
+
case 1:
|
|
3141
|
+
_context29.p = 1;
|
|
3142
|
+
_context29.n = 2;
|
|
3143
|
+
return this.getConfiguratorState();
|
|
3144
|
+
case 2:
|
|
3145
|
+
_context29.n = 3;
|
|
3146
|
+
return _context29.v.state.encodeSceneGraphID();
|
|
3147
|
+
case 3:
|
|
3148
|
+
_sceneGraphID2 = _context29.v;
|
|
3149
|
+
dst += "&scene_graph_id=" + _sceneGraphID2;
|
|
3150
|
+
_context29.n = 5;
|
|
3151
|
+
break;
|
|
3152
|
+
case 4:
|
|
3153
|
+
_context29.p = 4;
|
|
3154
|
+
_t20 = _context29.v;
|
|
3155
|
+
// scene graph ID not available for some reason
|
|
3156
|
+
// we will generate a new one
|
|
3157
|
+
console.error(_t20);
|
|
3158
|
+
case 5:
|
|
3096
3159
|
viewer.setAttribute("url", opt.url || dst);
|
|
3097
|
-
this._state = ControllerState.QRCode;
|
|
3098
3160
|
this._prevQROpt = opt;
|
|
3161
|
+
if (opt.detached) {
|
|
3162
|
+
_context29.n = 6;
|
|
3163
|
+
break;
|
|
3164
|
+
}
|
|
3165
|
+
this._state = ControllerState.QRCode;
|
|
3099
3166
|
return _context29.a(2, new Promise(function (accept, reject) {
|
|
3100
3167
|
_this21.append(viewer);
|
|
3101
3168
|
viewer.onload = function () {
|
|
3102
3169
|
return accept(viewer);
|
|
3103
3170
|
};
|
|
3104
3171
|
}));
|
|
3172
|
+
case 6:
|
|
3173
|
+
return _context29.a(2, new Promise(function (accept, reject) {
|
|
3174
|
+
return accept(viewer);
|
|
3175
|
+
}));
|
|
3105
3176
|
}
|
|
3106
|
-
}, _callee29, this, [[1,
|
|
3177
|
+
}, _callee29, this, [[1, 4]]);
|
|
3107
3178
|
}));
|
|
3108
3179
|
function startARQRCode(_x10) {
|
|
3109
3180
|
return _startARQRCode3.apply(this, arguments);
|
|
@@ -3644,6 +3715,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3644
3715
|
case 7:
|
|
3645
3716
|
this.startQRCode(this._prevQROpt);
|
|
3646
3717
|
return _context33.a(2);
|
|
3718
|
+
case 8:
|
|
3719
|
+
return _context33.a(2);
|
|
3647
3720
|
}
|
|
3648
3721
|
}, _callee33, this);
|
|
3649
3722
|
}));
|
|
@@ -3657,12 +3730,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3657
3730
|
value: function () {
|
|
3658
3731
|
var _startViewerQRCode4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(options) {
|
|
3659
3732
|
var _this27 = this;
|
|
3660
|
-
var
|
|
3733
|
+
var opt, sceneID, viewer, width, height, dst, configState, showAR, productID, sceneProductID, variationID, _t21;
|
|
3661
3734
|
return _regenerator().w(function (_context34) {
|
|
3662
3735
|
while (1) switch (_context34.n) {
|
|
3663
3736
|
case 0:
|
|
3664
|
-
// remove the old renderer instance if any
|
|
3665
|
-
|
|
3737
|
+
opt = this._GetDefaultQROptions(options); // remove the old renderer instance if any
|
|
3738
|
+
if (!opt.detached) {
|
|
3739
|
+
this.removeRenderer();
|
|
3740
|
+
}
|
|
3666
3741
|
sceneID = this.getAttribute("scene-id");
|
|
3667
3742
|
if (sceneID) {
|
|
3668
3743
|
_context34.n = 1;
|
|
@@ -3670,9 +3745,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3670
3745
|
}
|
|
3671
3746
|
throw new Error("VTOController.startQRCode() - minimum required attributes not set, use scene-id as a minimum");
|
|
3672
3747
|
case 1:
|
|
3673
|
-
opt = options || this._GetDefaultQROptions();
|
|
3674
3748
|
viewer = document.createElement("plattar-qrcode");
|
|
3675
|
-
|
|
3749
|
+
if (!opt.detached) {
|
|
3750
|
+
this._element = viewer;
|
|
3751
|
+
}
|
|
3676
3752
|
// required attributes with defaults for plattar-viewer node
|
|
3677
3753
|
width = this.getAttribute("width") || "500px";
|
|
3678
3754
|
height = this.getAttribute("height") || "500px";
|
|
@@ -3699,7 +3775,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3699
3775
|
break;
|
|
3700
3776
|
case 4:
|
|
3701
3777
|
_context34.p = 4;
|
|
3702
|
-
|
|
3778
|
+
_t21 = _context34.v;
|
|
3703
3779
|
// config state is not available
|
|
3704
3780
|
configState = null;
|
|
3705
3781
|
case 5:
|
|
@@ -3723,14 +3799,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3723
3799
|
dst += "&variation_id=" + variationID;
|
|
3724
3800
|
}
|
|
3725
3801
|
viewer.setAttribute("url", opt.url || dst);
|
|
3726
|
-
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
3727
3802
|
this._prevQROpt = opt;
|
|
3803
|
+
if (opt.detached) {
|
|
3804
|
+
_context34.n = 6;
|
|
3805
|
+
break;
|
|
3806
|
+
}
|
|
3807
|
+
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
3728
3808
|
return _context34.a(2, new Promise(function (accept, reject) {
|
|
3729
3809
|
viewer.onload = function () {
|
|
3730
3810
|
return accept(viewer);
|
|
3731
3811
|
};
|
|
3732
3812
|
_this27.append(viewer);
|
|
3733
3813
|
}));
|
|
3814
|
+
case 6:
|
|
3815
|
+
return _context34.a(2, new Promise(function (accept, reject) {
|
|
3816
|
+
return accept(viewer);
|
|
3817
|
+
}));
|
|
3734
3818
|
}
|
|
3735
3819
|
}, _callee34, this, [[2, 4]]);
|
|
3736
3820
|
}));
|
|
@@ -3744,7 +3828,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3744
3828
|
value: function () {
|
|
3745
3829
|
var _startRenderer4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35() {
|
|
3746
3830
|
var _this28 = this;
|
|
3747
|
-
var sceneID, width, height, server, viewer, configState, showAR, productID, sceneProductID, variationID,
|
|
3831
|
+
var sceneID, width, height, server, viewer, configState, showAR, productID, sceneProductID, variationID, _t22;
|
|
3748
3832
|
return _regenerator().w(function (_context35) {
|
|
3749
3833
|
while (1) switch (_context35.n) {
|
|
3750
3834
|
case 0:
|
|
@@ -3779,7 +3863,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3779
3863
|
break;
|
|
3780
3864
|
case 4:
|
|
3781
3865
|
_context35.p = 4;
|
|
3782
|
-
|
|
3866
|
+
_t22 = _context35.v;
|
|
3783
3867
|
// config state not available
|
|
3784
3868
|
configState = null;
|
|
3785
3869
|
case 5:
|
|
@@ -3821,7 +3905,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3821
3905
|
key: "initAR",
|
|
3822
3906
|
value: function () {
|
|
3823
3907
|
var _initAR4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36() {
|
|
3824
|
-
var arMode,
|
|
3908
|
+
var arMode, _t23;
|
|
3825
3909
|
return _regenerator().w(function (_context36) {
|
|
3826
3910
|
while (1) switch (_context36.n) {
|
|
3827
3911
|
case 0:
|
|
@@ -3838,13 +3922,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3838
3922
|
throw new Error("VTOController.initAR() - cannot proceed as VTO AR only available on IOS Mobile devices");
|
|
3839
3923
|
case 2:
|
|
3840
3924
|
arMode = this.getAttribute("ar-mode") || "generated";
|
|
3841
|
-
|
|
3842
|
-
_context36.n =
|
|
3925
|
+
_t23 = arMode.toLowerCase();
|
|
3926
|
+
_context36.n = _t23 === "inherited" ? 3 : _t23 === "generated" ? 4 : 4;
|
|
3843
3927
|
break;
|
|
3844
3928
|
case 3:
|
|
3845
3929
|
return _context36.a(2, this._InitARInherited());
|
|
3846
3930
|
case 4:
|
|
3847
3931
|
return _context36.a(2, this._InitARGenerated());
|
|
3932
|
+
case 5:
|
|
3933
|
+
return _context36.a(2);
|
|
3848
3934
|
}
|
|
3849
3935
|
}, _callee36, this);
|
|
3850
3936
|
}));
|
|
@@ -3907,7 +3993,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3907
3993
|
key: "_InitARGenerated",
|
|
3908
3994
|
value: (function () {
|
|
3909
3995
|
var _InitARGenerated4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38() {
|
|
3910
|
-
var sceneID, configAR,
|
|
3996
|
+
var sceneID, configAR, _t24, _t25, _t26, _t27;
|
|
3911
3997
|
return _regenerator().w(function (_context38) {
|
|
3912
3998
|
while (1) switch (_context38.n) {
|
|
3913
3999
|
case 0:
|
|
@@ -3918,17 +4004,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3918
4004
|
}
|
|
3919
4005
|
throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
|
|
3920
4006
|
case 1:
|
|
3921
|
-
|
|
4007
|
+
_t24 = configurator_ar_1.ConfiguratorAR;
|
|
3922
4008
|
_context38.n = 2;
|
|
3923
4009
|
return this.getConfiguratorState();
|
|
3924
4010
|
case 2:
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
state:
|
|
3929
|
-
useARBanner:
|
|
4011
|
+
_t25 = _context38.v;
|
|
4012
|
+
_t26 = this.getBooleanAttribute("show-ar-banner");
|
|
4013
|
+
_t27 = {
|
|
4014
|
+
state: _t25,
|
|
4015
|
+
useARBanner: _t26
|
|
3930
4016
|
};
|
|
3931
|
-
configAR = new
|
|
4017
|
+
configAR = new _t24(_t27);
|
|
3932
4018
|
return _context38.a(2, configAR.init());
|
|
3933
4019
|
}
|
|
3934
4020
|
}, _callee38, this);
|
|
@@ -4077,6 +4163,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4077
4163
|
case 7:
|
|
4078
4164
|
this.startQRCode(this._prevQROpt);
|
|
4079
4165
|
return _context40.a(2);
|
|
4166
|
+
case 8:
|
|
4167
|
+
return _context40.a(2);
|
|
4080
4168
|
}
|
|
4081
4169
|
}, _callee40, this);
|
|
4082
4170
|
}));
|
|
@@ -5152,6 +5240,60 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5152
5240
|
function encode() {
|
|
5153
5241
|
return btoa(JSON.stringify(this._state));
|
|
5154
5242
|
}
|
|
5243
|
+
}, {
|
|
5244
|
+
key: "encodeSceneGraphID",
|
|
5245
|
+
value: function () {
|
|
5246
|
+
var _encodeSceneGraphID = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48() {
|
|
5247
|
+
var graph, url, response, data, _t28;
|
|
5248
|
+
return _regenerator().w(function (_context48) {
|
|
5249
|
+
while (1) switch (_context48.n) {
|
|
5250
|
+
case 0:
|
|
5251
|
+
graph = this.sceneGraph; // some scene-graphs are very large in size, we store it remotely
|
|
5252
|
+
// this storage will expire in 10 minutes so this is a non-permanent version
|
|
5253
|
+
// and is designed for quick ar
|
|
5254
|
+
url = "https://c.plattar.com/v3/redir/store"; // finally send our scene-graph to the backend to generate the AR file and return
|
|
5255
|
+
_context48.p = 1;
|
|
5256
|
+
_context48.n = 2;
|
|
5257
|
+
return fetch(url, {
|
|
5258
|
+
method: "POST",
|
|
5259
|
+
headers: {
|
|
5260
|
+
"Content-Type": "application/json"
|
|
5261
|
+
},
|
|
5262
|
+
body: JSON.stringify({
|
|
5263
|
+
data: {
|
|
5264
|
+
attributes: {
|
|
5265
|
+
data: graph
|
|
5266
|
+
}
|
|
5267
|
+
}
|
|
5268
|
+
})
|
|
5269
|
+
});
|
|
5270
|
+
case 2:
|
|
5271
|
+
response = _context48.v;
|
|
5272
|
+
if (response.ok) {
|
|
5273
|
+
_context48.n = 3;
|
|
5274
|
+
break;
|
|
5275
|
+
}
|
|
5276
|
+
throw new Error("ConfiguratorState.encodeSceneGraphID() - network response was not ok ".concat(response.status));
|
|
5277
|
+
case 3:
|
|
5278
|
+
_context48.n = 4;
|
|
5279
|
+
return response.json();
|
|
5280
|
+
case 4:
|
|
5281
|
+
data = _context48.v;
|
|
5282
|
+
return _context48.a(2, data.data.id);
|
|
5283
|
+
case 5:
|
|
5284
|
+
_context48.p = 5;
|
|
5285
|
+
_t28 = _context48.v;
|
|
5286
|
+
throw new Error("ConfiguratorState.encodeSceneGraphID() - there was a request error to ".concat(url, ", error was ").concat(_t28.message));
|
|
5287
|
+
case 6:
|
|
5288
|
+
return _context48.a(2);
|
|
5289
|
+
}
|
|
5290
|
+
}, _callee48, this, [[1, 5]]);
|
|
5291
|
+
}));
|
|
5292
|
+
function encodeSceneGraphID() {
|
|
5293
|
+
return _encodeSceneGraphID.apply(this, arguments);
|
|
5294
|
+
}
|
|
5295
|
+
return encodeSceneGraphID;
|
|
5296
|
+
}()
|
|
5155
5297
|
/**
|
|
5156
5298
|
* Compiles and returns the Dynamic Scene Graph (Updated for 2025 for DynamicAR)
|
|
5157
5299
|
* NOTE: Eventually this structure should replace ConfiguratorState
|
|
@@ -5200,20 +5342,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5200
5342
|
}, {
|
|
5201
5343
|
key: "decodeState",
|
|
5202
5344
|
value: (function () {
|
|
5203
|
-
var _decodeState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
5345
|
+
var _decodeState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49() {
|
|
5204
5346
|
var sceneID,
|
|
5205
5347
|
state,
|
|
5206
5348
|
configState,
|
|
5207
5349
|
fscene,
|
|
5208
5350
|
scene,
|
|
5209
|
-
|
|
5210
|
-
return _regenerator().w(function (
|
|
5211
|
-
while (1) switch (
|
|
5351
|
+
_args49 = arguments;
|
|
5352
|
+
return _regenerator().w(function (_context49) {
|
|
5353
|
+
while (1) switch (_context49.n) {
|
|
5212
5354
|
case 0:
|
|
5213
|
-
sceneID =
|
|
5214
|
-
state =
|
|
5355
|
+
sceneID = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : null;
|
|
5356
|
+
state = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : null;
|
|
5215
5357
|
if (!(!sceneID || !state)) {
|
|
5216
|
-
|
|
5358
|
+
_context49.n = 1;
|
|
5217
5359
|
break;
|
|
5218
5360
|
}
|
|
5219
5361
|
throw new Error("ConfiguratorState.decodeState(sceneID, state) - sceneID and state must be defined");
|
|
@@ -5225,16 +5367,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5225
5367
|
fscene.include(plattar_api_1.SceneProduct);
|
|
5226
5368
|
fscene.include(plattar_api_1.SceneModel);
|
|
5227
5369
|
fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
|
|
5228
|
-
|
|
5370
|
+
_context49.n = 2;
|
|
5229
5371
|
return fscene.get();
|
|
5230
5372
|
case 2:
|
|
5231
|
-
scene =
|
|
5232
|
-
return
|
|
5373
|
+
scene = _context49.v;
|
|
5374
|
+
return _context49.a(2, {
|
|
5233
5375
|
scene: scene,
|
|
5234
5376
|
state: configState
|
|
5235
5377
|
});
|
|
5236
5378
|
}
|
|
5237
|
-
},
|
|
5379
|
+
}, _callee49);
|
|
5238
5380
|
}));
|
|
5239
5381
|
function decodeState() {
|
|
5240
5382
|
return _decodeState.apply(this, arguments);
|
|
@@ -5251,7 +5393,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5251
5393
|
}, {
|
|
5252
5394
|
key: "decodeScene",
|
|
5253
5395
|
value: (function () {
|
|
5254
|
-
var _decodeScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
5396
|
+
var _decodeScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50() {
|
|
5255
5397
|
var sceneID,
|
|
5256
5398
|
configState,
|
|
5257
5399
|
fscene,
|
|
@@ -5259,13 +5401,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5259
5401
|
sceneProducts,
|
|
5260
5402
|
sceneModels,
|
|
5261
5403
|
products,
|
|
5262
|
-
|
|
5263
|
-
return _regenerator().w(function (
|
|
5264
|
-
while (1) switch (
|
|
5404
|
+
_args50 = arguments;
|
|
5405
|
+
return _regenerator().w(function (_context50) {
|
|
5406
|
+
while (1) switch (_context50.n) {
|
|
5265
5407
|
case 0:
|
|
5266
|
-
sceneID =
|
|
5408
|
+
sceneID = _args50.length > 0 && _args50[0] !== undefined ? _args50[0] : null;
|
|
5267
5409
|
if (sceneID) {
|
|
5268
|
-
|
|
5410
|
+
_context50.n = 1;
|
|
5269
5411
|
break;
|
|
5270
5412
|
}
|
|
5271
5413
|
throw new Error("ConfiguratorState.decodeScene(sceneID) - sceneID must be defined");
|
|
@@ -5277,10 +5419,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5277
5419
|
fscene.include(plattar_api_1.SceneModel);
|
|
5278
5420
|
fscene.include(plattar_api_1.Product);
|
|
5279
5421
|
fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
|
|
5280
|
-
|
|
5422
|
+
_context50.n = 2;
|
|
5281
5423
|
return fscene.get();
|
|
5282
5424
|
case 2:
|
|
5283
|
-
scene =
|
|
5425
|
+
scene = _context50.v;
|
|
5284
5426
|
sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
|
|
5285
5427
|
sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
|
|
5286
5428
|
products = scene.relationships.filter(plattar_api_1.Product); // add our scene models
|
|
@@ -5324,12 +5466,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5324
5466
|
});
|
|
5325
5467
|
}
|
|
5326
5468
|
});
|
|
5327
|
-
return
|
|
5469
|
+
return _context50.a(2, {
|
|
5328
5470
|
scene: scene,
|
|
5329
5471
|
state: configState
|
|
5330
5472
|
});
|
|
5331
5473
|
}
|
|
5332
|
-
},
|
|
5474
|
+
}, _callee50);
|
|
5333
5475
|
}));
|
|
5334
5476
|
function decodeScene() {
|
|
5335
5477
|
return _decodeScene.apply(this, arguments);
|
|
@@ -5481,7 +5623,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5481
5623
|
Object.defineProperty(exports, "__esModule", {
|
|
5482
5624
|
value: true
|
|
5483
5625
|
});
|
|
5484
|
-
exports["default"] = "1.188.
|
|
5626
|
+
exports["default"] = "1.188.5";
|
|
5485
5627
|
}, {}],
|
|
5486
5628
|
21: [function (require, module, exports) {
|
|
5487
5629
|
"use strict";
|
|
@@ -14863,8 +15005,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
14863
15005
|
var i,
|
|
14864
15006
|
r,
|
|
14865
15007
|
n = function () {
|
|
14866
|
-
var t = function t(
|
|
14867
|
-
var i =
|
|
15008
|
+
var t = function t(_t29, e) {
|
|
15009
|
+
var i = _t29,
|
|
14868
15010
|
r = s[e],
|
|
14869
15011
|
n = null,
|
|
14870
15012
|
o = 0,
|
|
@@ -15676,8 +15818,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
15676
15818
|
return $;
|
|
15677
15819
|
}
|
|
15678
15820
|
});
|
|
15679
|
-
var t = function t(
|
|
15680
|
-
return !!
|
|
15821
|
+
var t = function t(_t30) {
|
|
15822
|
+
return !!_t30 && "object" == _typeof(_t30) && !Array.isArray(_t30);
|
|
15681
15823
|
};
|
|
15682
15824
|
function e(i) {
|
|
15683
15825
|
for (var _len7 = arguments.length, r = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
@@ -16273,11 +16415,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16273
16415
|
}, {
|
|
16274
16416
|
key: "drawQR",
|
|
16275
16417
|
value: function () {
|
|
16276
|
-
var _drawQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
16418
|
+
var _drawQR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(t) {
|
|
16277
16419
|
var _this83 = this;
|
|
16278
|
-
var e, i, r, n, s, _this$_options,
|
|
16279
|
-
return _regenerator().w(function (
|
|
16280
|
-
while (1) switch (
|
|
16420
|
+
var e, i, r, n, s, _this$_options, _t31, _i2, _r5, _a, _t32;
|
|
16421
|
+
return _regenerator().w(function (_context51) {
|
|
16422
|
+
while (1) switch (_context51.n) {
|
|
16281
16423
|
case 0:
|
|
16282
16424
|
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);
|
|
16283
16425
|
s = {
|
|
@@ -16287,19 +16429,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16287
16429
|
height: 0
|
|
16288
16430
|
};
|
|
16289
16431
|
if (!(this._qr = t, this._options.image)) {
|
|
16290
|
-
|
|
16432
|
+
_context51.n = 3;
|
|
16291
16433
|
break;
|
|
16292
16434
|
}
|
|
16293
|
-
|
|
16435
|
+
_context51.n = 1;
|
|
16294
16436
|
return this.loadImage();
|
|
16295
16437
|
case 1:
|
|
16296
16438
|
if (this._image) {
|
|
16297
|
-
|
|
16439
|
+
_context51.n = 2;
|
|
16298
16440
|
break;
|
|
16299
16441
|
}
|
|
16300
|
-
return
|
|
16442
|
+
return _context51.a(2);
|
|
16301
16443
|
case 2:
|
|
16302
|
-
_this$_options = this._options,
|
|
16444
|
+
_this$_options = this._options, _t31 = _this$_options.imageOptions, _i2 = _this$_options.qrOptions, _r5 = _t31.imageSize * o[_i2.errorCorrectionLevel], _a = Math.floor(_r5 * e * e);
|
|
16303
16445
|
s = function (_ref16) {
|
|
16304
16446
|
var t = _ref16.originalHeight,
|
|
16305
16447
|
e = _ref16.originalWidth,
|
|
@@ -16341,12 +16483,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16341
16483
|
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]));
|
|
16342
16484
|
});
|
|
16343
16485
|
this.drawCorners();
|
|
16344
|
-
|
|
16345
|
-
if (!
|
|
16346
|
-
|
|
16486
|
+
_t32 = this._options.image;
|
|
16487
|
+
if (!_t32) {
|
|
16488
|
+
_context51.n = 4;
|
|
16347
16489
|
break;
|
|
16348
16490
|
}
|
|
16349
|
-
|
|
16491
|
+
_context51.n = 4;
|
|
16350
16492
|
return this.drawImage({
|
|
16351
16493
|
width: s.width,
|
|
16352
16494
|
height: s.height,
|
|
@@ -16354,9 +16496,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16354
16496
|
dotSize: n
|
|
16355
16497
|
});
|
|
16356
16498
|
case 4:
|
|
16357
|
-
return
|
|
16499
|
+
return _context51.a(2);
|
|
16358
16500
|
}
|
|
16359
|
-
},
|
|
16501
|
+
}, _callee51, this);
|
|
16360
16502
|
}));
|
|
16361
16503
|
function drawQR(_x16) {
|
|
16362
16504
|
return _drawQR.apply(this, arguments);
|
|
@@ -16375,8 +16517,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16375
16517
|
var _s6 = n.height,
|
|
16376
16518
|
_a2 = n.width;
|
|
16377
16519
|
if (_r6 || _o) {
|
|
16378
|
-
var
|
|
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),
|
|
16520
|
+
var _t33 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
16521
|
+
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), _t33.setAttribute("rx", String(_s6 / 2 * n.backgroundOptions.round))), _t33.setAttribute("x", String(this._roundSize((n.width - _a2) / 2))), _t33.setAttribute("y", String(this._roundSize((n.height - _s6) / 2))), _t33.setAttribute("width", String(_a2)), _t33.setAttribute("height", String(_s6)), this._backgroundClipPath.appendChild(_t33), this._createColor({
|
|
16380
16522
|
options: _r6,
|
|
16381
16523
|
color: _o,
|
|
16382
16524
|
additionalRotation: 0,
|
|
@@ -16432,29 +16574,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16432
16574
|
_loop2(_e3);
|
|
16433
16575
|
}
|
|
16434
16576
|
if (r.shape === g) {
|
|
16435
|
-
var
|
|
16436
|
-
_e4 = n + 2 *
|
|
16437
|
-
_i3 = d -
|
|
16438
|
-
_r7 = u -
|
|
16577
|
+
var _t34 = this._roundSize((o / h - n) / 2),
|
|
16578
|
+
_e4 = n + 2 * _t34,
|
|
16579
|
+
_i3 = d - _t34 * h,
|
|
16580
|
+
_r7 = u - _t34 * h,
|
|
16439
16581
|
_s7 = [],
|
|
16440
16582
|
_a3 = this._roundSize(_e4 / 2);
|
|
16441
16583
|
for (var _i4 = 0; _i4 < _e4; _i4++) {
|
|
16442
16584
|
_s7[_i4] = [];
|
|
16443
|
-
for (var _r8 = 0; _r8 < _e4; _r8++) _i4 >=
|
|
16585
|
+
for (var _r8 = 0; _r8 < _e4; _r8++) _i4 >= _t34 - 1 && _i4 <= _e4 - _t34 && _r8 >= _t34 - 1 && _r8 <= _e4 - _t34 || Math.sqrt((_i4 - _a3) * (_i4 - _a3) + (_r8 - _a3) * (_r8 - _a3)) > _a3 ? _s7[_i4][_r8] = 0 : _s7[_i4][_r8] = this._qr.isDark(_r8 - 2 * _t34 < 0 ? _r8 : _r8 >= n ? _r8 - 2 * _t34 : _r8 - _t34, _i4 - 2 * _t34 < 0 ? _i4 : _i4 >= n ? _i4 - 2 * _t34 : _i4 - _t34) ? 1 : 0;
|
|
16444
16586
|
}
|
|
16445
|
-
var _loop3 = function _loop3(
|
|
16587
|
+
var _loop3 = function _loop3(_t35) {
|
|
16446
16588
|
var _loop4 = function _loop4(_n) {
|
|
16447
|
-
_s7[
|
|
16589
|
+
_s7[_t35][_n] && (c.draw(_i3 + _n * h, _r7 + _t35 * h, h, function (e, i) {
|
|
16448
16590
|
var r;
|
|
16449
|
-
return !!(null === (r = _s7[
|
|
16591
|
+
return !!(null === (r = _s7[_t35 + i]) || void 0 === r ? void 0 : r[_n + e]);
|
|
16450
16592
|
}), c._element && _this84._dotsClipPath && _this84._dotsClipPath.appendChild(c._element));
|
|
16451
16593
|
};
|
|
16452
16594
|
for (var _n = 0; _n < _e4; _n++) {
|
|
16453
16595
|
_loop4(_n);
|
|
16454
16596
|
}
|
|
16455
16597
|
};
|
|
16456
|
-
for (var
|
|
16457
|
-
_loop3(
|
|
16598
|
+
for (var _t35 = 0; _t35 < _e4; _t35++) {
|
|
16599
|
+
_loop3(_t35);
|
|
16458
16600
|
}
|
|
16459
16601
|
}
|
|
16460
16602
|
}
|
|
@@ -16494,24 +16636,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16494
16636
|
width: a,
|
|
16495
16637
|
name: "corners-square-color-".concat(t, "-").concat(r, "-").concat(_this85._instanceId)
|
|
16496
16638
|
})), (null === (y = e.cornersSquareOptions) || void 0 === y ? void 0 : y.type) && h.includes(e.cornersSquareOptions.type)) {
|
|
16497
|
-
var
|
|
16639
|
+
var _t36 = new d({
|
|
16498
16640
|
svg: _this85._element,
|
|
16499
16641
|
type: e.cornersSquareOptions.type,
|
|
16500
16642
|
window: _this85._window
|
|
16501
16643
|
});
|
|
16502
|
-
|
|
16644
|
+
_t36.draw(z, B, a, n), _t36._element && P && P.appendChild(_t36._element);
|
|
16503
16645
|
} else {
|
|
16504
|
-
var
|
|
16646
|
+
var _t37 = new s({
|
|
16505
16647
|
svg: _this85._element,
|
|
16506
16648
|
type: (null === (x = e.cornersSquareOptions) || void 0 === x ? void 0 : x.type) || e.dotsOptions.type,
|
|
16507
16649
|
window: _this85._window
|
|
16508
16650
|
});
|
|
16509
16651
|
var _loop6 = function _loop6(_e5) {
|
|
16510
16652
|
var _loop7 = function _loop7(_i5) {
|
|
16511
|
-
(null === (S = f[_e5]) || void 0 === S ? void 0 : S[_i5]) && (
|
|
16653
|
+
(null === (S = f[_e5]) || void 0 === S ? void 0 : S[_i5]) && (_t37.draw(z + _i5 * o, B + _e5 * o, o, function (t, r) {
|
|
16512
16654
|
var n;
|
|
16513
16655
|
return !!(null === (n = f[_e5 + r]) || void 0 === n ? void 0 : n[_i5 + t]);
|
|
16514
|
-
}),
|
|
16656
|
+
}), _t37._element && P && P.appendChild(_t37._element));
|
|
16515
16657
|
};
|
|
16516
16658
|
for (var _i5 = 0; _i5 < f[_e5].length; _i5++) {
|
|
16517
16659
|
_loop7(_i5);
|
|
@@ -16531,24 +16673,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16531
16673
|
width: u,
|
|
16532
16674
|
name: "corners-dot-color-".concat(t, "-").concat(r, "-").concat(_this85._instanceId)
|
|
16533
16675
|
})), (null === (O = e.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e.cornersDotOptions.type)) {
|
|
16534
|
-
var
|
|
16676
|
+
var _t38 = new l({
|
|
16535
16677
|
svg: _this85._element,
|
|
16536
16678
|
type: e.cornersDotOptions.type,
|
|
16537
16679
|
window: _this85._window
|
|
16538
16680
|
});
|
|
16539
|
-
|
|
16681
|
+
_t38.draw(z + 2 * o, B + 2 * o, u, n), _t38._element && I && I.appendChild(_t38._element);
|
|
16540
16682
|
} else {
|
|
16541
|
-
var
|
|
16683
|
+
var _t39 = new s({
|
|
16542
16684
|
svg: _this85._element,
|
|
16543
16685
|
type: (null === (D = e.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e.dotsOptions.type,
|
|
16544
16686
|
window: _this85._window
|
|
16545
16687
|
});
|
|
16546
16688
|
var _loop8 = function _loop8(_e6) {
|
|
16547
16689
|
var _loop9 = function _loop9(_i6) {
|
|
16548
|
-
(null === (k = w[_e6]) || void 0 === k ? void 0 : k[_i6]) && (
|
|
16690
|
+
(null === (k = w[_e6]) || void 0 === k ? void 0 : k[_i6]) && (_t39.draw(z + _i6 * o, B + _e6 * o, o, function (t, r) {
|
|
16549
16691
|
var n;
|
|
16550
16692
|
return !!(null === (n = w[_e6 + r]) || void 0 === n ? void 0 : n[_i6 + t]);
|
|
16551
|
-
}),
|
|
16693
|
+
}), _t39._element && I && I.appendChild(_t39._element));
|
|
16552
16694
|
};
|
|
16553
16695
|
for (var _i6 = 0; _i6 < w[_e6].length; _i6++) {
|
|
16554
16696
|
_loop9(_i6);
|
|
@@ -16571,29 +16713,29 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16571
16713
|
if (null === (i = r.nodeCanvas) || void 0 === i ? void 0 : i.loadImage) r.nodeCanvas.loadImage(r.image).then(function (e) {
|
|
16572
16714
|
var i, n;
|
|
16573
16715
|
if (_this86._image = e, _this86._options.imageOptions.saveAsBlob) {
|
|
16574
|
-
var
|
|
16575
|
-
null === (n = null ==
|
|
16716
|
+
var _t40 = null === (i = r.nodeCanvas) || void 0 === i ? void 0 : i.createCanvas(_this86._image.width, _this86._image.height);
|
|
16717
|
+
null === (n = null == _t40 ? void 0 : _t40.getContext("2d")) || void 0 === n || n.drawImage(e, 0, 0), _this86._imageUri = null == _t40 ? void 0 : _t40.toDataURL();
|
|
16576
16718
|
}
|
|
16577
16719
|
t();
|
|
16578
16720
|
})["catch"](e);else {
|
|
16579
16721
|
var _e7 = new _this86._window.Image();
|
|
16580
|
-
"string" == typeof r.imageOptions.crossOrigin && (_e7.crossOrigin = r.imageOptions.crossOrigin), _this86._image = _e7, _e7.onload = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
16581
|
-
var
|
|
16582
|
-
return _regenerator().w(function (
|
|
16583
|
-
while (1) switch (
|
|
16722
|
+
"string" == typeof r.imageOptions.crossOrigin && (_e7.crossOrigin = r.imageOptions.crossOrigin), _this86._image = _e7, _e7.onload = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53() {
|
|
16723
|
+
var _t41;
|
|
16724
|
+
return _regenerator().w(function (_context53) {
|
|
16725
|
+
while (1) switch (_context53.n) {
|
|
16584
16726
|
case 0:
|
|
16585
|
-
|
|
16586
|
-
if (!
|
|
16587
|
-
|
|
16727
|
+
_t41 = _this86._options.imageOptions.saveAsBlob;
|
|
16728
|
+
if (!_t41) {
|
|
16729
|
+
_context53.n = 2;
|
|
16588
16730
|
break;
|
|
16589
16731
|
}
|
|
16590
|
-
|
|
16732
|
+
_context53.n = 1;
|
|
16591
16733
|
return function () {
|
|
16592
|
-
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
16593
|
-
return _regenerator().w(function (
|
|
16594
|
-
while (1) switch (
|
|
16734
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52(t, e) {
|
|
16735
|
+
return _regenerator().w(function (_context52) {
|
|
16736
|
+
while (1) switch (_context52.n) {
|
|
16595
16737
|
case 0:
|
|
16596
|
-
return
|
|
16738
|
+
return _context52.a(2, new Promise(function (i) {
|
|
16597
16739
|
var r = new e.XMLHttpRequest();
|
|
16598
16740
|
r.onload = function () {
|
|
16599
16741
|
var t = new e.FileReader();
|
|
@@ -16603,20 +16745,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16603
16745
|
}, r.open("GET", t), r.responseType = "blob", r.send();
|
|
16604
16746
|
}));
|
|
16605
16747
|
}
|
|
16606
|
-
},
|
|
16748
|
+
}, _callee52);
|
|
16607
16749
|
}));
|
|
16608
16750
|
return function (_x17, _x18) {
|
|
16609
16751
|
return _ref20.apply(this, arguments);
|
|
16610
16752
|
};
|
|
16611
16753
|
}()(r.image || "", _this86._window);
|
|
16612
16754
|
case 1:
|
|
16613
|
-
_this86._imageUri =
|
|
16755
|
+
_this86._imageUri = _context53.v;
|
|
16614
16756
|
case 2:
|
|
16615
16757
|
t();
|
|
16616
16758
|
case 3:
|
|
16617
|
-
return
|
|
16759
|
+
return _context53.a(2);
|
|
16618
16760
|
}
|
|
16619
|
-
},
|
|
16761
|
+
}, _callee53);
|
|
16620
16762
|
})), _e7.src = r.image;
|
|
16621
16763
|
}
|
|
16622
16764
|
});
|
|
@@ -16624,18 +16766,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16624
16766
|
}, {
|
|
16625
16767
|
key: "drawImage",
|
|
16626
16768
|
value: function () {
|
|
16627
|
-
var _drawImage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
16769
|
+
var _drawImage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee54(_ref21) {
|
|
16628
16770
|
var t, e, i, r, n, o, s, a, h, d, u, c;
|
|
16629
|
-
return _regenerator().w(function (
|
|
16630
|
-
while (1) switch (
|
|
16771
|
+
return _regenerator().w(function (_context54) {
|
|
16772
|
+
while (1) switch (_context54.n) {
|
|
16631
16773
|
case 0:
|
|
16632
16774
|
t = _ref21.width, e = _ref21.height, i = _ref21.count, r = _ref21.dotSize;
|
|
16633
16775
|
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");
|
|
16634
16776
|
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);
|
|
16635
16777
|
case 1:
|
|
16636
|
-
return
|
|
16778
|
+
return _context54.a(2);
|
|
16637
16779
|
}
|
|
16638
|
-
},
|
|
16780
|
+
}, _callee54, this);
|
|
16639
16781
|
}));
|
|
16640
16782
|
function drawImage(_x19) {
|
|
16641
16783
|
return _drawImage.apply(this, arguments);
|
|
@@ -16682,7 +16824,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16682
16824
|
var v = p,
|
|
16683
16825
|
_ = "canvas",
|
|
16684
16826
|
m = {};
|
|
16685
|
-
for (var
|
|
16827
|
+
for (var _t42 = 0; _t42 <= 40; _t42++) m[_t42] = _t42;
|
|
16686
16828
|
var b = {
|
|
16687
16829
|
type: _,
|
|
16688
16830
|
shape: "square",
|
|
@@ -16785,12 +16927,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16785
16927
|
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);
|
|
16786
16928
|
});
|
|
16787
16929
|
{
|
|
16788
|
-
var
|
|
16930
|
+
var _t43 = new _this89._window.Image();
|
|
16789
16931
|
return new Promise(function (e) {
|
|
16790
|
-
|
|
16932
|
+
_t43.onload = function () {
|
|
16791
16933
|
var i, r;
|
|
16792
|
-
null === (r = null === (i = _this89._domCanvas) || void 0 === i ? void 0 : i.getContext("2d")) || void 0 === r || r.drawImage(
|
|
16793
|
-
},
|
|
16934
|
+
null === (r = null === (i = _this89._domCanvas) || void 0 === i ? void 0 : i.getContext("2d")) || void 0 === r || r.drawImage(_t43, 0, 0), e();
|
|
16935
|
+
}, _t43.src = n;
|
|
16794
16936
|
});
|
|
16795
16937
|
}
|
|
16796
16938
|
}));
|
|
@@ -16798,41 +16940,41 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16798
16940
|
}, {
|
|
16799
16941
|
key: "_getElement",
|
|
16800
16942
|
value: function () {
|
|
16801
|
-
var _getElement2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
16943
|
+
var _getElement2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee55() {
|
|
16802
16944
|
var t,
|
|
16803
|
-
|
|
16804
|
-
|
|
16805
|
-
return _regenerator().w(function (
|
|
16806
|
-
while (1) switch (
|
|
16945
|
+
_args55 = arguments,
|
|
16946
|
+
_t44;
|
|
16947
|
+
return _regenerator().w(function (_context55) {
|
|
16948
|
+
while (1) switch (_context55.n) {
|
|
16807
16949
|
case 0:
|
|
16808
|
-
t =
|
|
16950
|
+
t = _args55.length > 0 && _args55[0] !== undefined ? _args55[0] : "png";
|
|
16809
16951
|
if (this._qr) {
|
|
16810
|
-
|
|
16952
|
+
_context55.n = 1;
|
|
16811
16953
|
break;
|
|
16812
16954
|
}
|
|
16813
16955
|
throw "QR code is empty";
|
|
16814
16956
|
case 1:
|
|
16815
16957
|
if (!("svg" === t.toLowerCase())) {
|
|
16816
|
-
|
|
16958
|
+
_context55.n = 3;
|
|
16817
16959
|
break;
|
|
16818
16960
|
}
|
|
16819
16961
|
this._svg && this._svgDrawingPromise || this._setupSvg();
|
|
16820
|
-
|
|
16962
|
+
_context55.n = 2;
|
|
16821
16963
|
return this._svgDrawingPromise;
|
|
16822
16964
|
case 2:
|
|
16823
|
-
|
|
16824
|
-
|
|
16965
|
+
_t44 = this._svg;
|
|
16966
|
+
_context55.n = 5;
|
|
16825
16967
|
break;
|
|
16826
16968
|
case 3:
|
|
16827
16969
|
(this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas();
|
|
16828
|
-
|
|
16970
|
+
_context55.n = 4;
|
|
16829
16971
|
return this._canvasDrawingPromise;
|
|
16830
16972
|
case 4:
|
|
16831
|
-
|
|
16973
|
+
_t44 = this._domCanvas || this._nodeCanvas;
|
|
16832
16974
|
case 5:
|
|
16833
|
-
return
|
|
16975
|
+
return _context55.a(2, _t44);
|
|
16834
16976
|
}
|
|
16835
|
-
},
|
|
16977
|
+
}, _callee55, this);
|
|
16836
16978
|
}));
|
|
16837
16979
|
function _getElement() {
|
|
16838
16980
|
return _getElement2.apply(this, arguments);
|
|
@@ -16875,43 +17017,43 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16875
17017
|
}, {
|
|
16876
17018
|
key: "getRawData",
|
|
16877
17019
|
value: function () {
|
|
16878
|
-
var _getRawData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
17020
|
+
var _getRawData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee56() {
|
|
16879
17021
|
var t,
|
|
16880
17022
|
e,
|
|
16881
17023
|
i,
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
return _regenerator().w(function (
|
|
16885
|
-
while (1) switch (
|
|
17024
|
+
_t45,
|
|
17025
|
+
_args56 = arguments;
|
|
17026
|
+
return _regenerator().w(function (_context56) {
|
|
17027
|
+
while (1) switch (_context56.n) {
|
|
16886
17028
|
case 0:
|
|
16887
|
-
t =
|
|
17029
|
+
t = _args56.length > 0 && _args56[0] !== undefined ? _args56[0] : "png";
|
|
16888
17030
|
if (this._qr) {
|
|
16889
|
-
|
|
17031
|
+
_context56.n = 1;
|
|
16890
17032
|
break;
|
|
16891
17033
|
}
|
|
16892
17034
|
throw "QR code is empty";
|
|
16893
17035
|
case 1:
|
|
16894
|
-
|
|
17036
|
+
_context56.n = 2;
|
|
16895
17037
|
return this._getElement(t);
|
|
16896
17038
|
case 2:
|
|
16897
|
-
e =
|
|
17039
|
+
e = _context56.v;
|
|
16898
17040
|
i = A(t);
|
|
16899
17041
|
if (e) {
|
|
16900
|
-
|
|
17042
|
+
_context56.n = 3;
|
|
16901
17043
|
break;
|
|
16902
17044
|
}
|
|
16903
|
-
return
|
|
17045
|
+
return _context56.a(2, null);
|
|
16904
17046
|
case 3:
|
|
16905
17047
|
if (!("svg" === t.toLowerCase())) {
|
|
16906
|
-
|
|
17048
|
+
_context56.n = 4;
|
|
16907
17049
|
break;
|
|
16908
17050
|
}
|
|
16909
|
-
|
|
16910
|
-
return
|
|
17051
|
+
_t45 = "<?xml version=\"1.0\" standalone=\"no\"?>\r\n".concat(new this._window.XMLSerializer().serializeToString(e));
|
|
17052
|
+
return _context56.a(2, "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(_t45) : new Blob([_t45], {
|
|
16911
17053
|
type: i
|
|
16912
17054
|
}));
|
|
16913
17055
|
case 4:
|
|
16914
|
-
return
|
|
17056
|
+
return _context56.a(2, new Promise(function (t) {
|
|
16915
17057
|
var r = e;
|
|
16916
17058
|
if ("toBuffer" in r) {
|
|
16917
17059
|
if ("image/png" === i) t(r.toBuffer(i));else if ("image/jpeg" === i) t(r.toBuffer(i));else {
|
|
@@ -16921,7 +17063,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16921
17063
|
} else "toBlob" in r && r.toBlob(t, i, 1);
|
|
16922
17064
|
}));
|
|
16923
17065
|
}
|
|
16924
|
-
},
|
|
17066
|
+
}, _callee56, this);
|
|
16925
17067
|
}));
|
|
16926
17068
|
function getRawData() {
|
|
16927
17069
|
return _getRawData.apply(this, arguments);
|
|
@@ -16931,37 +17073,37 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16931
17073
|
}, {
|
|
16932
17074
|
key: "download",
|
|
16933
17075
|
value: function () {
|
|
16934
|
-
var _download = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
16935
|
-
var e, i, r,
|
|
16936
|
-
return _regenerator().w(function (
|
|
16937
|
-
while (1) switch (
|
|
17076
|
+
var _download = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee57(t) {
|
|
17077
|
+
var e, i, r, _t46;
|
|
17078
|
+
return _regenerator().w(function (_context57) {
|
|
17079
|
+
while (1) switch (_context57.n) {
|
|
16938
17080
|
case 0:
|
|
16939
17081
|
if (this._qr) {
|
|
16940
|
-
|
|
17082
|
+
_context57.n = 1;
|
|
16941
17083
|
break;
|
|
16942
17084
|
}
|
|
16943
17085
|
throw "QR code is empty";
|
|
16944
17086
|
case 1:
|
|
16945
17087
|
if (!("undefined" == typeof Blob)) {
|
|
16946
|
-
|
|
17088
|
+
_context57.n = 2;
|
|
16947
17089
|
break;
|
|
16948
17090
|
}
|
|
16949
17091
|
throw "Cannot download in Node.js, call getRawData instead.";
|
|
16950
17092
|
case 2:
|
|
16951
17093
|
e = "png", i = "qr";
|
|
16952
17094
|
"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));
|
|
16953
|
-
|
|
17095
|
+
_context57.n = 3;
|
|
16954
17096
|
return this._getElement(e);
|
|
16955
17097
|
case 3:
|
|
16956
|
-
r =
|
|
17098
|
+
r = _context57.v;
|
|
16957
17099
|
if (r) if ("svg" === e.toLowerCase()) {
|
|
16958
|
-
|
|
16959
|
-
|
|
17100
|
+
_t46 = new XMLSerializer().serializeToString(r);
|
|
17101
|
+
_t46 = '<?xml version="1.0" standalone="no"?>\r\n' + _t46, n("data:".concat(A(e), ";charset=utf-8,").concat(encodeURIComponent(_t46)), "".concat(i, ".svg"));
|
|
16960
17102
|
} else n(r.toDataURL(A(e)), "".concat(i, ".").concat(e));
|
|
16961
17103
|
case 4:
|
|
16962
|
-
return
|
|
17104
|
+
return _context57.a(2);
|
|
16963
17105
|
}
|
|
16964
|
-
},
|
|
17106
|
+
}, _callee57, this);
|
|
16965
17107
|
}));
|
|
16966
17108
|
function download(_x20) {
|
|
16967
17109
|
return _download.apply(this, arguments);
|