@plattar/plattar-ar-adapter 1.167.5 → 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 +48 -12
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +47 -13
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/embed/plattar-embed.js +21 -11
- 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 +1 -1
|
@@ -4,6 +4,7 @@ const plattar_api_1 = require("@plattar/plattar-api");
|
|
|
4
4
|
const configurator_controller_1 = require("./controllers/configurator-controller");
|
|
5
5
|
const vto_controller_1 = require("./controllers/vto-controller");
|
|
6
6
|
const product_controller_1 = require("./controllers/product-controller");
|
|
7
|
+
const util_1 = require("../util/util");
|
|
7
8
|
/**
|
|
8
9
|
* This tracks the current embed type
|
|
9
10
|
*/
|
|
@@ -108,16 +109,21 @@ class PlattarEmbed extends HTMLElement {
|
|
|
108
109
|
_CreateLegacyEmbed() {
|
|
109
110
|
// server cannot be changed once its set - defaults to production
|
|
110
111
|
const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
if (util_1.Util.isValidServerLocation(server)) {
|
|
113
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
|
|
114
|
+
this._controller = new product_controller_1.ProductController(this);
|
|
115
|
+
const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
|
|
116
|
+
switch (init) {
|
|
117
|
+
case "viewer":
|
|
118
|
+
this.startViewer();
|
|
119
|
+
break;
|
|
120
|
+
case "qrcode":
|
|
121
|
+
this.startQRCode();
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.warn("PlattarEmbed.CreateLegacy - cannot create as server attribute " + server + " is invalid, embed status remains unchanged");
|
|
121
127
|
}
|
|
122
128
|
}
|
|
123
129
|
/**
|
|
@@ -128,13 +134,17 @@ class PlattarEmbed extends HTMLElement {
|
|
|
128
134
|
// check if controller needs to be destroyed due to server change
|
|
129
135
|
const serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
130
136
|
if (this._currentServer !== serverAttribute) {
|
|
131
|
-
this.
|
|
137
|
+
this._currentServer = serverAttribute || "production";
|
|
132
138
|
// reset the controller if any
|
|
133
139
|
if (this._controller) {
|
|
134
140
|
this._controller.removeRenderer();
|
|
135
141
|
this._controller = null;
|
|
136
142
|
}
|
|
137
143
|
}
|
|
144
|
+
if (!util_1.Util.isValidServerLocation(this._currentServer)) {
|
|
145
|
+
console.warn("PlattarEmbed.Create - cannot create as server attribute " + this._currentServer + " is invalid, embed status remains unchanged");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
138
148
|
plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
|
|
139
149
|
const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
|
|
140
150
|
const currentEmbed = this._currentType;
|
package/dist/util/util.d.ts
CHANGED
package/dist/util/util.js
CHANGED
|
@@ -5,6 +5,30 @@ exports.Util = void 0;
|
|
|
5
5
|
* Static Utility Functions
|
|
6
6
|
*/
|
|
7
7
|
class Util {
|
|
8
|
+
static isValidServerLocation(server) {
|
|
9
|
+
if (!server) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
switch (server.toLowerCase()) {
|
|
13
|
+
case "staging.plattar.space":
|
|
14
|
+
case "cdn-staging.plattar.space":
|
|
15
|
+
case "staging":
|
|
16
|
+
case "app.plattar.com":
|
|
17
|
+
case "cdn.plattar.com":
|
|
18
|
+
case "prod":
|
|
19
|
+
case "production":
|
|
20
|
+
case "review.plattar.com":
|
|
21
|
+
case "review":
|
|
22
|
+
case "qa":
|
|
23
|
+
case "dev":
|
|
24
|
+
case "developer":
|
|
25
|
+
case "development":
|
|
26
|
+
case "local":
|
|
27
|
+
case "localhost":
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
8
32
|
static canAugment() {
|
|
9
33
|
return Util.canQuicklook() || Util.canSceneViewer();
|
|
10
34
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.167.
|
|
1
|
+
declare const _default: "1.167.7";
|
|
2
2
|
export default _default;
|
package/dist/version.js
CHANGED