@plattar/plattar-ar-adapter 1.167.6 → 1.167.7
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 +108 -51
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +102 -46
- 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 +34 -12
- package/dist/util/util.d.ts +1 -0
- package/dist/util/util.js +24 -0
- 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
|
}
|
|
@@ -2026,6 +2027,7 @@ const plattar_api_1 = require("@plattar/plattar-api");
|
|
|
2026
2027
|
const configurator_controller_1 = require("./controllers/configurator-controller");
|
|
2027
2028
|
const vto_controller_1 = require("./controllers/vto-controller");
|
|
2028
2029
|
const product_controller_1 = require("./controllers/product-controller");
|
|
2030
|
+
const util_1 = require("../util/util");
|
|
2029
2031
|
/**
|
|
2030
2032
|
* This tracks the current embed type
|
|
2031
2033
|
*/
|
|
@@ -2056,6 +2058,7 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2056
2058
|
this._observerState = ObserverState.Unlocked;
|
|
2057
2059
|
this._controller = null;
|
|
2058
2060
|
this._currentSceneID = null;
|
|
2061
|
+
this._currentServer = null;
|
|
2059
2062
|
this._observer = null;
|
|
2060
2063
|
}
|
|
2061
2064
|
get viewer() {
|
|
@@ -2071,9 +2074,6 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2071
2074
|
* creates a brand new instance of this embed
|
|
2072
2075
|
*/
|
|
2073
2076
|
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
2077
|
if (!this._observer) {
|
|
2078
2078
|
this._observer = new MutationObserver((mutations) => {
|
|
2079
2079
|
if (this._observerState === ObserverState.Unlocked) {
|
|
@@ -2130,15 +2130,23 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2130
2130
|
* embedding products with variations (without a scene-id)
|
|
2131
2131
|
*/
|
|
2132
2132
|
_CreateLegacyEmbed() {
|
|
2133
|
-
|
|
2134
|
-
const
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2133
|
+
// server cannot be changed once its set - defaults to production
|
|
2134
|
+
const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
2135
|
+
if (util_1.Util.isValidServerLocation(server)) {
|
|
2136
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
|
|
2137
|
+
this._controller = new product_controller_1.ProductController(this);
|
|
2138
|
+
const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
|
|
2139
|
+
switch (init) {
|
|
2140
|
+
case "viewer":
|
|
2141
|
+
this.startViewer();
|
|
2142
|
+
break;
|
|
2143
|
+
case "qrcode":
|
|
2144
|
+
this.startQRCode();
|
|
2145
|
+
break;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
else {
|
|
2149
|
+
console.warn("PlattarEmbed.CreateLegacy - cannot create as server attribute " + server + " is invalid, embed status remains unchanged");
|
|
2142
2150
|
}
|
|
2143
2151
|
}
|
|
2144
2152
|
/**
|
|
@@ -2146,6 +2154,21 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2146
2154
|
* this can also be called when attributes/state changes so embeds can be re-loaded
|
|
2147
2155
|
*/
|
|
2148
2156
|
_CreateEmbed(attributeName) {
|
|
2157
|
+
// check if controller needs to be destroyed due to server change
|
|
2158
|
+
const serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
2159
|
+
if (this._currentServer !== serverAttribute) {
|
|
2160
|
+
this._currentServer = serverAttribute || "production";
|
|
2161
|
+
// reset the controller if any
|
|
2162
|
+
if (this._controller) {
|
|
2163
|
+
this._controller.removeRenderer();
|
|
2164
|
+
this._controller = null;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
if (!util_1.Util.isValidServerLocation(this._currentServer)) {
|
|
2168
|
+
console.warn("PlattarEmbed.Create - cannot create as server attribute " + this._currentServer + " is invalid, embed status remains unchanged");
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
|
|
2149
2172
|
const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
|
|
2150
2173
|
const currentEmbed = this._currentType;
|
|
2151
2174
|
if (embedType) {
|
|
@@ -2264,7 +2287,7 @@ class PlattarEmbed extends HTMLElement {
|
|
|
2264
2287
|
}
|
|
2265
2288
|
exports.default = PlattarEmbed;
|
|
2266
2289
|
|
|
2267
|
-
},{"./controllers/configurator-controller":8,"./controllers/product-controller":10,"./controllers/vto-controller":11,"@plattar/plattar-api":44}],13:[function(require,module,exports){
|
|
2290
|
+
},{"../util/util":15,"./controllers/configurator-controller":8,"./controllers/product-controller":10,"./controllers/vto-controller":11,"@plattar/plattar-api":44}],13:[function(require,module,exports){
|
|
2268
2291
|
"use strict";
|
|
2269
2292
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2270
2293
|
if (k2 === undefined) k2 = k;
|
|
@@ -2750,6 +2773,30 @@ exports.Util = void 0;
|
|
|
2750
2773
|
* Static Utility Functions
|
|
2751
2774
|
*/
|
|
2752
2775
|
class Util {
|
|
2776
|
+
static isValidServerLocation(server) {
|
|
2777
|
+
if (!server) {
|
|
2778
|
+
return false;
|
|
2779
|
+
}
|
|
2780
|
+
switch (server.toLowerCase()) {
|
|
2781
|
+
case "staging.plattar.space":
|
|
2782
|
+
case "cdn-staging.plattar.space":
|
|
2783
|
+
case "staging":
|
|
2784
|
+
case "app.plattar.com":
|
|
2785
|
+
case "cdn.plattar.com":
|
|
2786
|
+
case "prod":
|
|
2787
|
+
case "production":
|
|
2788
|
+
case "review.plattar.com":
|
|
2789
|
+
case "review":
|
|
2790
|
+
case "qa":
|
|
2791
|
+
case "dev":
|
|
2792
|
+
case "developer":
|
|
2793
|
+
case "development":
|
|
2794
|
+
case "local":
|
|
2795
|
+
case "localhost":
|
|
2796
|
+
return true;
|
|
2797
|
+
}
|
|
2798
|
+
return false;
|
|
2799
|
+
}
|
|
2753
2800
|
static canAugment() {
|
|
2754
2801
|
return Util.canQuicklook() || Util.canSceneViewer();
|
|
2755
2802
|
}
|
|
@@ -2819,7 +2866,7 @@ exports.Util = Util;
|
|
|
2819
2866
|
},{}],16:[function(require,module,exports){
|
|
2820
2867
|
"use strict";
|
|
2821
2868
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2822
|
-
exports.default = "1.167.
|
|
2869
|
+
exports.default = "1.167.7";
|
|
2823
2870
|
|
|
2824
2871
|
},{}],17:[function(require,module,exports){
|
|
2825
2872
|
"use strict";
|
|
@@ -6770,11 +6817,21 @@ class BaseElement extends HTMLElement {
|
|
|
6770
6817
|
|
|
6771
6818
|
if (shortenURL && shortenURL.toLowerCase() === "true") {
|
|
6772
6819
|
this._ShortenURL(url).then((newURL) => {
|
|
6773
|
-
|
|
6820
|
+
// make sure by time promise is resolved that the original url hasn't been updated
|
|
6821
|
+
const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
|
|
6822
|
+
|
|
6823
|
+
if (updatedURL === url) {
|
|
6824
|
+
this._GenerateQRCode(newURL, width, height);
|
|
6825
|
+
}
|
|
6774
6826
|
}).catch((_err) => {
|
|
6775
6827
|
console.warn(_err);
|
|
6776
6828
|
// ignore error and just generate normal QR Code
|
|
6777
|
-
|
|
6829
|
+
// make sure by time promise is resolved that the original url hasn't been updated
|
|
6830
|
+
const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
|
|
6831
|
+
|
|
6832
|
+
if (updatedURL === url) {
|
|
6833
|
+
this._GenerateQRCode(url, width, height);
|
|
6834
|
+
}
|
|
6778
6835
|
});
|
|
6779
6836
|
}
|
|
6780
6837
|
else {
|
|
@@ -6924,7 +6981,7 @@ module.exports = {
|
|
|
6924
6981
|
version: Version
|
|
6925
6982
|
};
|
|
6926
6983
|
},{"./elements/qrcode-element.js":109,"./version":111}],111:[function(require,module,exports){
|
|
6927
|
-
module.exports = "1.
|
|
6984
|
+
module.exports = "1.165.1";
|
|
6928
6985
|
|
|
6929
6986
|
},{}],112:[function(require,module,exports){
|
|
6930
6987
|
"use strict";
|
|
@@ -8022,9 +8079,8 @@ class Util {
|
|
|
8022
8079
|
|
|
8023
8080
|
module.exports = Util;
|
|
8024
8081
|
},{}],131:[function(require,module,exports){
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
},{}],132:[function(require,module,exports){
|
|
8082
|
+
arguments[4][111][0].apply(exports,arguments)
|
|
8083
|
+
},{"dup":111}],132:[function(require,module,exports){
|
|
8028
8084
|
(function (global){(function (){
|
|
8029
8085
|
"use strict";
|
|
8030
8086
|
|