@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.
@@ -2027,6 +2027,7 @@ const plattar_api_1 = require("@plattar/plattar-api");
2027
2027
  const configurator_controller_1 = require("./controllers/configurator-controller");
2028
2028
  const vto_controller_1 = require("./controllers/vto-controller");
2029
2029
  const product_controller_1 = require("./controllers/product-controller");
2030
+ const util_1 = require("../util/util");
2030
2031
  /**
2031
2032
  * This tracks the current embed type
2032
2033
  */
@@ -2131,16 +2132,21 @@ class PlattarEmbed extends HTMLElement {
2131
2132
  _CreateLegacyEmbed() {
2132
2133
  // server cannot be changed once its set - defaults to production
2133
2134
  const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
2134
- plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
2135
- this._controller = new product_controller_1.ProductController(this);
2136
- const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
2137
- switch (init) {
2138
- case "viewer":
2139
- this.startViewer();
2140
- break;
2141
- case "qrcode":
2142
- this.startQRCode();
2143
- break;
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");
2144
2150
  }
2145
2151
  }
2146
2152
  /**
@@ -2151,13 +2157,17 @@ class PlattarEmbed extends HTMLElement {
2151
2157
  // check if controller needs to be destroyed due to server change
2152
2158
  const serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
2153
2159
  if (this._currentServer !== serverAttribute) {
2154
- this._currentSceneID = serverAttribute || "production";
2160
+ this._currentServer = serverAttribute || "production";
2155
2161
  // reset the controller if any
2156
2162
  if (this._controller) {
2157
2163
  this._controller.removeRenderer();
2158
2164
  this._controller = null;
2159
2165
  }
2160
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
+ }
2161
2171
  plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
2162
2172
  const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
2163
2173
  const currentEmbed = this._currentType;
@@ -2277,7 +2287,7 @@ class PlattarEmbed extends HTMLElement {
2277
2287
  }
2278
2288
  exports.default = PlattarEmbed;
2279
2289
 
2280
- },{"./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){
2281
2291
  "use strict";
2282
2292
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2283
2293
  if (k2 === undefined) k2 = k;
@@ -2763,6 +2773,30 @@ exports.Util = void 0;
2763
2773
  * Static Utility Functions
2764
2774
  */
2765
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
+ }
2766
2800
  static canAugment() {
2767
2801
  return Util.canQuicklook() || Util.canSceneViewer();
2768
2802
  }
@@ -2832,7 +2866,7 @@ exports.Util = Util;
2832
2866
  },{}],16:[function(require,module,exports){
2833
2867
  "use strict";
2834
2868
  Object.defineProperty(exports, "__esModule", { value: true });
2835
- exports.default = "1.167.5";
2869
+ exports.default = "1.167.7";
2836
2870
 
2837
2871
  },{}],17:[function(require,module,exports){
2838
2872
  "use strict";