@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.
@@ -3070,6 +3070,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3070
3070
  var configurator_controller_1 = require("./controllers/configurator-controller");
3071
3071
  var vto_controller_1 = require("./controllers/vto-controller");
3072
3072
  var product_controller_1 = require("./controllers/product-controller");
3073
+ var util_1 = require("../util/util");
3073
3074
  /**
3074
3075
  * This tracks the current embed type
3075
3076
  */
@@ -3192,16 +3193,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3192
3193
  value: function _CreateLegacyEmbed() {
3193
3194
  // server cannot be changed once its set - defaults to production
3194
3195
  var server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
3195
- plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
3196
- this._controller = new product_controller_1.ProductController(this);
3197
- var init = this.hasAttribute("init") ? this.getAttribute("init") : null;
3198
- switch (init) {
3199
- case "viewer":
3200
- this.startViewer();
3201
- break;
3202
- case "qrcode":
3203
- this.startQRCode();
3204
- break;
3196
+ if (util_1.Util.isValidServerLocation(server)) {
3197
+ plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
3198
+ this._controller = new product_controller_1.ProductController(this);
3199
+ var init = this.hasAttribute("init") ? this.getAttribute("init") : null;
3200
+ switch (init) {
3201
+ case "viewer":
3202
+ this.startViewer();
3203
+ break;
3204
+ case "qrcode":
3205
+ this.startQRCode();
3206
+ break;
3207
+ }
3208
+ } else {
3209
+ console.warn("PlattarEmbed.CreateLegacy - cannot create as server attribute " + server + " is invalid, embed status remains unchanged");
3205
3210
  }
3206
3211
  }
3207
3212
  /**
@@ -3214,13 +3219,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3214
3219
  // check if controller needs to be destroyed due to server change
3215
3220
  var serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
3216
3221
  if (this._currentServer !== serverAttribute) {
3217
- this._currentSceneID = serverAttribute || "production";
3222
+ this._currentServer = serverAttribute || "production";
3218
3223
  // reset the controller if any
3219
3224
  if (this._controller) {
3220
3225
  this._controller.removeRenderer();
3221
3226
  this._controller = null;
3222
3227
  }
3223
3228
  }
3229
+ if (!util_1.Util.isValidServerLocation(this._currentServer)) {
3230
+ console.warn("PlattarEmbed.Create - cannot create as server attribute " + this._currentServer + " is invalid, embed status remains unchanged");
3231
+ return;
3232
+ }
3224
3233
  plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
3225
3234
  var embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
3226
3235
  var currentEmbed = this._currentType;
@@ -3427,6 +3436,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3427
3436
  }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
3428
3437
  exports["default"] = PlattarEmbed;
3429
3438
  }, {
3439
+ "../util/util": 15,
3430
3440
  "./controllers/configurator-controller": 8,
3431
3441
  "./controllers/product-controller": 10,
3432
3442
  "./controllers/vto-controller": 11,
@@ -4100,6 +4110,32 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4100
4110
  _classCallCheck(this, Util);
4101
4111
  }
4102
4112
  _createClass(Util, null, [{
4113
+ key: "isValidServerLocation",
4114
+ value: function isValidServerLocation(server) {
4115
+ if (!server) {
4116
+ return false;
4117
+ }
4118
+ switch (server.toLowerCase()) {
4119
+ case "staging.plattar.space":
4120
+ case "cdn-staging.plattar.space":
4121
+ case "staging":
4122
+ case "app.plattar.com":
4123
+ case "cdn.plattar.com":
4124
+ case "prod":
4125
+ case "production":
4126
+ case "review.plattar.com":
4127
+ case "review":
4128
+ case "qa":
4129
+ case "dev":
4130
+ case "developer":
4131
+ case "development":
4132
+ case "local":
4133
+ case "localhost":
4134
+ return true;
4135
+ }
4136
+ return false;
4137
+ }
4138
+ }, {
4103
4139
  key: "canAugment",
4104
4140
  value: function canAugment() {
4105
4141
  return Util.canQuicklook() || Util.canSceneViewer();
@@ -4199,7 +4235,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4199
4235
  Object.defineProperty(exports, "__esModule", {
4200
4236
  value: true
4201
4237
  });
4202
- exports["default"] = "1.167.5";
4238
+ exports["default"] = "1.167.7";
4203
4239
  }, {}],
4204
4240
  17: [function (require, module, exports) {
4205
4241
  "use strict";