@plattar/plattar-ar-adapter 1.167.4 → 1.167.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 +63 -42
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +58 -36
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/embed/controllers/configurator-controller.d.ts +0 -1
- package/dist/embed/controllers/configurator-controller.js +0 -9
- package/dist/embed/controllers/plattar-controller.d.ts +6 -1
- package/dist/embed/controllers/plattar-controller.js +27 -0
- package/dist/embed/controllers/product-controller.d.ts +0 -1
- package/dist/embed/controllers/product-controller.js +0 -8
- package/dist/embed/controllers/vto-controller.d.ts +0 -1
- package/dist/embed/controllers/vto-controller.js +0 -9
- package/dist/embed/plattar-embed.d.ts +1 -0
- package/dist/embed/plattar-embed.js +15 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -7
|
@@ -1263,15 +1263,6 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
|
1263
1263
|
const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
|
|
1264
1264
|
return configAR.init();
|
|
1265
1265
|
}
|
|
1266
|
-
removeRenderer() {
|
|
1267
|
-
if (this._element) {
|
|
1268
|
-
this._element.remove();
|
|
1269
|
-
this._element = null;
|
|
1270
|
-
return true;
|
|
1271
|
-
}
|
|
1272
|
-
this.removeMessengerObservers();
|
|
1273
|
-
return false;
|
|
1274
|
-
}
|
|
1275
1266
|
get element() {
|
|
1276
1267
|
return this._element;
|
|
1277
1268
|
}
|
|
@@ -1482,6 +1473,23 @@ class PlattarController {
|
|
|
1482
1473
|
};
|
|
1483
1474
|
});
|
|
1484
1475
|
}
|
|
1476
|
+
/**
|
|
1477
|
+
* Removes the currently active renderer view from the DOM
|
|
1478
|
+
*/
|
|
1479
|
+
removeRenderer() {
|
|
1480
|
+
// remove all other children
|
|
1481
|
+
const shadow = this.parent.shadowRoot;
|
|
1482
|
+
if (shadow) {
|
|
1483
|
+
let child = shadow.lastElementChild;
|
|
1484
|
+
while (child) {
|
|
1485
|
+
shadow.removeChild(child);
|
|
1486
|
+
child = shadow.lastElementChild;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
this._element = null;
|
|
1490
|
+
this.removeMessengerObservers();
|
|
1491
|
+
return true;
|
|
1492
|
+
}
|
|
1485
1493
|
/**
|
|
1486
1494
|
* Returns the Parent Instance
|
|
1487
1495
|
*/
|
|
@@ -1533,6 +1541,16 @@ class PlattarController {
|
|
|
1533
1541
|
const shadow = this.parent.shadowRoot || this.parent.attachShadow({ mode: 'open' });
|
|
1534
1542
|
shadow.append(element);
|
|
1535
1543
|
}
|
|
1544
|
+
/**
|
|
1545
|
+
*
|
|
1546
|
+
* @param element
|
|
1547
|
+
*/
|
|
1548
|
+
removeChild(element) {
|
|
1549
|
+
const shadow = this.parent.shadowRoot;
|
|
1550
|
+
if (shadow) {
|
|
1551
|
+
shadow.removeChild(element);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1536
1554
|
}
|
|
1537
1555
|
exports.PlattarController = PlattarController;
|
|
1538
1556
|
|
|
@@ -1756,14 +1774,6 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
1756
1774
|
return reject(new Error("ProductController.initAR() - minimum required attributes not set, use product-id as a minimum"));
|
|
1757
1775
|
});
|
|
1758
1776
|
}
|
|
1759
|
-
removeRenderer() {
|
|
1760
|
-
if (this._element) {
|
|
1761
|
-
this._element.remove();
|
|
1762
|
-
this._element = null;
|
|
1763
|
-
return true;
|
|
1764
|
-
}
|
|
1765
|
-
return false;
|
|
1766
|
-
}
|
|
1767
1777
|
get element() {
|
|
1768
1778
|
return this._element;
|
|
1769
1779
|
}
|
|
@@ -2004,15 +2014,6 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
2004
2014
|
const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
|
|
2005
2015
|
return configAR.init();
|
|
2006
2016
|
}
|
|
2007
|
-
removeRenderer() {
|
|
2008
|
-
if (this._element) {
|
|
2009
|
-
this._element.remove();
|
|
2010
|
-
this._element = null;
|
|
2011
|
-
return true;
|
|
2012
|
-
}
|
|
2013
|
-
this.removeMessengerObservers();
|
|
2014
|
-
return false;
|
|
2015
|
-
}
|
|
2016
2017
|
get element() {
|
|
2017
2018
|
return this._element;
|
|
2018
2019
|
}
|
|
@@ -2056,6 +2057,7 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2056
2057
|
this._observerState = ObserverState.Unlocked;
|
|
2057
2058
|
this._controller = null;
|
|
2058
2059
|
this._currentSceneID = null;
|
|
2060
|
+
this._currentServer = null;
|
|
2059
2061
|
this._observer = null;
|
|
2060
2062
|
}
|
|
2061
2063
|
get viewer() {
|
|
@@ -2071,9 +2073,6 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2071
2073
|
* creates a brand new instance of this embed
|
|
2072
2074
|
*/
|
|
2073
2075
|
create() {
|
|
2074
|
-
// server cannot be changed once its set - defaults to production
|
|
2075
|
-
const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
2076
|
-
plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
|
|
2077
2076
|
if (!this._observer) {
|
|
2078
2077
|
this._observer = new MutationObserver((mutations) => {
|
|
2079
2078
|
if (this._observerState === ObserverState.Unlocked) {
|
|
@@ -2130,6 +2129,9 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2130
2129
|
* embedding products with variations (without a scene-id)
|
|
2131
2130
|
*/
|
|
2132
2131
|
_CreateLegacyEmbed() {
|
|
2132
|
+
// server cannot be changed once its set - defaults to production
|
|
2133
|
+
const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
2134
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
|
|
2133
2135
|
this._controller = new product_controller_1.ProductController(this);
|
|
2134
2136
|
const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
|
|
2135
2137
|
switch (init) {
|
|
@@ -2146,6 +2148,17 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2146
2148
|
* this can also be called when attributes/state changes so embeds can be re-loaded
|
|
2147
2149
|
*/
|
|
2148
2150
|
_CreateEmbed(attributeName) {
|
|
2151
|
+
// check if controller needs to be destroyed due to server change
|
|
2152
|
+
const serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
2153
|
+
if (this._currentServer !== serverAttribute) {
|
|
2154
|
+
this._currentSceneID = serverAttribute || "production";
|
|
2155
|
+
// reset the controller if any
|
|
2156
|
+
if (this._controller) {
|
|
2157
|
+
this._controller.removeRenderer();
|
|
2158
|
+
this._controller = null;
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
|
|
2149
2162
|
const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
|
|
2150
2163
|
const currentEmbed = this._currentType;
|
|
2151
2164
|
if (embedType) {
|
|
@@ -2819,7 +2832,7 @@ exports.Util = Util;
|
|
|
2819
2832
|
},{}],16:[function(require,module,exports){
|
|
2820
2833
|
"use strict";
|
|
2821
2834
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2822
|
-
exports.default = "1.167.
|
|
2835
|
+
exports.default = "1.167.5";
|
|
2823
2836
|
|
|
2824
2837
|
},{}],17:[function(require,module,exports){
|
|
2825
2838
|
"use strict";
|
|
@@ -6770,11 +6783,21 @@ class BaseElement extends HTMLElement {
|
|
|
6770
6783
|
|
|
6771
6784
|
if (shortenURL && shortenURL.toLowerCase() === "true") {
|
|
6772
6785
|
this._ShortenURL(url).then((newURL) => {
|
|
6773
|
-
|
|
6786
|
+
// make sure by time promise is resolved that the original url hasn't been updated
|
|
6787
|
+
const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
|
|
6788
|
+
|
|
6789
|
+
if (updatedURL === url) {
|
|
6790
|
+
this._GenerateQRCode(newURL, width, height);
|
|
6791
|
+
}
|
|
6774
6792
|
}).catch((_err) => {
|
|
6775
6793
|
console.warn(_err);
|
|
6776
6794
|
// ignore error and just generate normal QR Code
|
|
6777
|
-
|
|
6795
|
+
// make sure by time promise is resolved that the original url hasn't been updated
|
|
6796
|
+
const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
|
|
6797
|
+
|
|
6798
|
+
if (updatedURL === url) {
|
|
6799
|
+
this._GenerateQRCode(url, width, height);
|
|
6800
|
+
}
|
|
6778
6801
|
});
|
|
6779
6802
|
}
|
|
6780
6803
|
else {
|
|
@@ -6924,7 +6947,7 @@ module.exports = {
|
|
|
6924
6947
|
version: Version
|
|
6925
6948
|
};
|
|
6926
6949
|
},{"./elements/qrcode-element.js":109,"./version":111}],111:[function(require,module,exports){
|
|
6927
|
-
module.exports = "1.
|
|
6950
|
+
module.exports = "1.165.1";
|
|
6928
6951
|
|
|
6929
6952
|
},{}],112:[function(require,module,exports){
|
|
6930
6953
|
"use strict";
|
|
@@ -8022,9 +8045,8 @@ class Util {
|
|
|
8022
8045
|
|
|
8023
8046
|
module.exports = Util;
|
|
8024
8047
|
},{}],131:[function(require,module,exports){
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
},{}],132:[function(require,module,exports){
|
|
8048
|
+
arguments[4][111][0].apply(exports,arguments)
|
|
8049
|
+
},{"dup":111}],132:[function(require,module,exports){
|
|
8028
8050
|
(function (global){(function (){
|
|
8029
8051
|
"use strict";
|
|
8030
8052
|
|