@plattar/plattar-ar-adapter 2.5.1 → 2.7.2

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.
@@ -15,10 +15,14 @@ const version_1 = __importDefault(require("../version"));
15
15
  * Performs AR functionality related to Plattar Scenes
16
16
  */
17
17
  class ConfiguratorAR extends launcher_ar_1.LauncherAR {
18
+ // analytics instance
19
+ _analytics = null;
20
+ _options;
21
+ // this thing controls the actual AR view
22
+ // this is setup via .init() function
23
+ _ar;
18
24
  constructor(options) {
19
25
  super();
20
- // analytics instance
21
- this._analytics = null;
22
26
  if (!options.state) {
23
27
  throw new Error("ConfiguratorAR.constructor(state) - state must be defined");
24
28
  }
@@ -58,7 +62,8 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
58
62
  */
59
63
  async _Compose(output) {
60
64
  const type = output === 'glb' ? "viewer" : "reality";
61
- const url = `https://xrutils.plattar.com/v3/scene/${this._options.state.scene.id}/${type}`;
65
+ const serverLocation = plattar_api_1.Server.location().type === 'staging' ? 'https://xrutils.plattar.space/v3/scene' : 'https://xrutils.plattar.com/v3/scene';
66
+ const url = `${serverLocation}/${this._options.state.scene.id}/${type}`;
62
67
  // grab our existing scene-graph from the saved API
63
68
  try {
64
69
  const response = await fetch(url, {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LauncherAR = void 0;
4
4
  class LauncherAR {
5
+ _opt;
5
6
  constructor() {
6
7
  this._opt = {
7
8
  anchor: "horizontal_vertical",
@@ -16,10 +16,15 @@ const version_1 = __importDefault(require("../version"));
16
16
  * Performs AT Functionality using Plattar FileModel types
17
17
  */
18
18
  class ModelAR extends launcher_ar_1.LauncherAR {
19
+ // analytics instance
20
+ _analytics = null;
21
+ // model ID
22
+ _options;
23
+ // this thing controls the actual AR view
24
+ // this is setup via .init() function
25
+ _ar;
19
26
  constructor(options) {
20
27
  super();
21
- // analytics instance
22
- this._analytics = null;
23
28
  if (!options.modelID) {
24
29
  throw new Error("ModelAR.constructor(modelID) - modelID must be defined");
25
30
  }
@@ -16,24 +16,14 @@ const version_1 = __importDefault(require("../version"));
16
16
  * Performs AR functionality related to Plattar Products and Variation types
17
17
  */
18
18
  class ProductAR extends launcher_ar_1.LauncherAR {
19
- /*
20
- constructor(productID: string | undefined | null = null, variationID: string | undefined | null = null, variationSKU: string | undefined | null = null) {
21
- super();
22
-
23
- if (!productID) {
24
- throw new Error("ProductAR.constructor(productID, variationID) - productID must be defined");
25
- }
26
-
27
- this._productID = productID;
28
- this._variationSKU = variationSKU;
29
- this._variationID = variationID ? variationID : (variationSKU ? null : "default");
30
- this._ar = null;
31
- }
32
- */
19
+ // analytics instance
20
+ _analytics = null;
21
+ _options;
22
+ // this thing controls the actual AR view
23
+ // this is setup via .init() function
24
+ _ar;
33
25
  constructor(options) {
34
26
  super();
35
- // analytics instance
36
- this._analytics = null;
37
27
  if (!options.productID) {
38
28
  throw new Error("ProductAR.constructor(productID, variationID) - productID must be defined");
39
29
  }
package/dist/ar/raw-ar.js CHANGED
@@ -16,10 +16,15 @@ const version_1 = __importDefault(require("../version"));
16
16
  * Allows launching AR Experiences provided a single remote 3D Model file
17
17
  */
18
18
  class RawAR extends launcher_ar_1.LauncherAR {
19
+ // model location
20
+ _options;
21
+ // this thing controls the actual AR view
22
+ // this is setup via .init() function
23
+ _ar;
24
+ // analytics instance
25
+ _analytics = null;
19
26
  constructor(options) {
20
27
  super();
21
- // analytics instance
22
- this._analytics = null;
23
28
  if (!options.modelLocation) {
24
29
  throw new Error("RawAR.constructor(modelLocation) - modelLocation must be defined");
25
30
  }
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SceneAR = void 0;
7
7
  const plattar_analytics_1 = require("@plattar/plattar-analytics");
8
8
  const plattar_api_1 = require("@plattar/plattar-api");
9
- const plattar_services_1 = require("@plattar/plattar-services");
10
9
  const util_1 = require("../util/util");
11
10
  const quicklook_viewer_1 = __importDefault(require("../viewers/quicklook-viewer"));
12
11
  const scene_viewer_1 = __importDefault(require("../viewers/scene-viewer"));
@@ -16,10 +15,15 @@ const version_1 = __importDefault(require("../version"));
16
15
  * Performs AR functionality related to Plattar Scenes
17
16
  */
18
17
  class SceneAR extends launcher_ar_1.LauncherAR {
18
+ // analytics instance
19
+ _analytics = null;
20
+ // scene and selected variation IDs
21
+ _options;
22
+ // this thing controls the actual AR view
23
+ // this is setup via .init() function
24
+ _ar;
19
25
  constructor(options) {
20
26
  super();
21
- // analytics instance
22
- this._analytics = null;
23
27
  if (!options.sceneID) {
24
28
  throw new Error("SceneAR.constructor(sceneID) - sceneID must be defined");
25
29
  }
@@ -59,58 +63,87 @@ class SceneAR extends launcher_ar_1.LauncherAR {
59
63
  * Composes a Scene into an AR Model (remote operation) that can be used to launch
60
64
  * an AR File
61
65
  */
62
- _ComposeScene(scene, output) {
63
- return new Promise((accept, reject) => {
64
- const sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
65
- const sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
66
- // nothing to do if no AR components can be found
67
- if ((sceneProducts.length + sceneModels.length) <= 0) {
68
- return reject(new Error("SceneAR.ComposeScene() - cannot proceed as scene does not contain AR components"));
66
+ async _ComposeScene(scene, output) {
67
+ const sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
68
+ const sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
69
+ // nothing to do if no AR components can be found
70
+ if ((sceneProducts.length + sceneModels.length) <= 0) {
71
+ throw new Error("SceneAR.ComposeScene() - cannot proceed as scene does not contain AR components");
72
+ }
73
+ const url = `${plattar_api_1.Server.location().type === 'staging' ? 'https://converter.plattar.space' : 'https://converter.plattar.com'}/v3/converter/config-to-model`;
74
+ const payload = {
75
+ data: {
76
+ attributes: {
77
+ quality: 100,
78
+ output: output,
79
+ maps: new Array()
80
+ }
69
81
  }
70
- // define our configurator
71
- const configurator = new plattar_services_1.Configurator();
72
- configurator.server = plattar_api_1.Server.location().type;
73
- configurator.output = output;
74
- let totalARObjectCount = 0;
75
- // add our scene products
76
- sceneProducts.forEach((sceneProduct) => {
77
- const product = sceneProduct.relationships.find(plattar_api_1.Product);
78
- const selection = this._options.variationSelection;
79
- // we have a specific product selection
80
- if (sceneProduct.attributes.include_in_augment) {
81
- // check if this product is the one we want (from selection optionally)
82
- if (product && (product.id === selection.productID) && selection.variationID) {
83
- configurator.addSceneProduct(sceneProduct.id, selection.variationID);
82
+ };
83
+ let totalARObjectCount = 0;
84
+ // add our scene products
85
+ sceneProducts.forEach((sceneProduct) => {
86
+ const product = sceneProduct.relationships.find(plattar_api_1.Product);
87
+ const selection = this._options.variationSelection;
88
+ // we have a specific product selection
89
+ if (sceneProduct.attributes.include_in_augment) {
90
+ // check if this product is the one we want (from selection optionally)
91
+ if (product && (product.id === selection.productID) && selection.variationID) {
92
+ payload.data.attributes.maps.push({
93
+ sceneproduct: sceneProduct.id,
94
+ productvariation: selection.variationID
95
+ });
96
+ totalARObjectCount++;
97
+ }
98
+ else if (product) {
99
+ // check if this scene-product is the one we want (from selection)
100
+ if ((sceneProduct.id === selection.sceneProductID) && selection.variationID) {
101
+ payload.data.attributes.maps.push({
102
+ sceneproduct: sceneProduct.id,
103
+ productvariation: selection.variationID
104
+ });
84
105
  totalARObjectCount++;
85
106
  }
86
- else if (product) {
87
- // check if this scene-product is the one we want (from selection)
88
- if ((sceneProduct.id === selection.sceneProductID) && selection.variationID) {
89
- configurator.addSceneProduct(sceneProduct.id, selection.variationID);
90
- totalARObjectCount++;
91
- }
92
- else if (product.attributes.product_variation_id) {
93
- configurator.addSceneProduct(sceneProduct.id, product.attributes.product_variation_id);
94
- totalARObjectCount++;
95
- }
107
+ else if (product.attributes.product_variation_id) {
108
+ payload.data.attributes.maps.push({
109
+ sceneproduct: sceneProduct.id,
110
+ productvariation: product.attributes.product_variation_id
111
+ });
112
+ totalARObjectCount++;
96
113
  }
97
114
  }
98
- });
99
- // add our scene models
100
- sceneModels.forEach((sceneModel) => {
101
- if (sceneModel.attributes.include_in_augment) {
102
- configurator.addModel(sceneModel.id);
103
- totalARObjectCount++;
104
- }
105
- });
106
- // ensure we have actually added AR objects
107
- if (totalARObjectCount <= 0) {
108
- return reject(new Error("SceneAR.ComposeScene() - cannot proceed as scene does not contain any enabled AR components"));
109
115
  }
110
- return configurator.get().then((result) => {
111
- accept(result.filename);
112
- }).catch(reject);
113
116
  });
117
+ // add our scene models
118
+ sceneModels.forEach((sceneModel) => {
119
+ if (sceneModel.attributes.include_in_augment) {
120
+ payload.data.attributes.maps.push({
121
+ scenemodel: sceneModel.id
122
+ });
123
+ totalARObjectCount++;
124
+ }
125
+ });
126
+ // ensure we have actually added AR objects
127
+ if (totalARObjectCount <= 0) {
128
+ throw new Error("SceneAR.ComposeScene() - cannot proceed as scene does not contain any enabled AR components");
129
+ }
130
+ try {
131
+ const response = await fetch(url, {
132
+ method: "POST",
133
+ headers: {
134
+ "Content-Type": "application/json"
135
+ },
136
+ body: JSON.stringify(payload)
137
+ });
138
+ if (!response.ok) {
139
+ throw new Error(`SceneAR.ComposeScene() - network response was not ok ${response.status}`);
140
+ }
141
+ const data = await response.json();
142
+ return data.data.attributes.filename;
143
+ }
144
+ catch (error) {
145
+ throw new Error(`SceneAR.ComposeScene() - there was a request error to ${url}, error was ${error.message}`);
146
+ }
114
147
  }
115
148
  /**
116
149
  * Initialise the SceneAR instance. This returns a Promise that resolves
@@ -15,10 +15,14 @@ const version_1 = __importDefault(require("../version"));
15
15
  * Performs AR functionality related to Plattar Scenes
16
16
  */
17
17
  class SceneGraphAR extends launcher_ar_1.LauncherAR {
18
+ // analytics instance
19
+ _analytics = null;
20
+ _options;
21
+ // this thing controls the actual AR view
22
+ // this is setup via .init() function
23
+ _ar;
18
24
  constructor(options) {
19
25
  super();
20
- // analytics instance
21
- this._analytics = null;
22
26
  this._options = options;
23
27
  this._ar = null;
24
28
  }
@@ -55,7 +59,8 @@ class SceneGraphAR extends launcher_ar_1.LauncherAR {
55
59
  */
56
60
  async _Compose(output) {
57
61
  const type = output === 'glb' ? "viewer" : "reality";
58
- const url = `https://xrutils.plattar.com/v3/scene/${this._options.sceneID}/${type}/${this._options.id}`;
62
+ const serverLocation = plattar_api_1.Server.location().type === 'staging' ? 'https://xrutils.plattar.space/v3/scene' : 'https://xrutils.plattar.com/v3/scene';
63
+ const url = `${serverLocation}/${this._options.sceneID}/${type}/${this._options.id}`;
59
64
  // grab our existing scene-graph from the saved API
60
65
  try {
61
66
  const response = await fetch(url, {
@@ -9,11 +9,11 @@ const util_1 = require("../util/util");
9
9
  * SceneProducts are much more convenient to grab from the Plattar CMS
10
10
  */
11
11
  class SceneProductAR extends product_ar_1.ProductAR {
12
+ _sceneProductID;
13
+ // this is evaluated in the init() function
14
+ _attachedProductID = null;
12
15
  constructor(options) {
13
- //super(sceneProductID, variationID, variationSKU);
14
16
  super(options);
15
- // this is evaluated in the init() function
16
- this._attachedProductID = null;
17
17
  if (!options.productID) {
18
18
  throw new Error("SceneProductAR.constructor(sceneProductID, variationID) - sceneProductID must be defined");
19
19
  }
@@ -11,10 +11,7 @@ const scene_graph_ar_1 = require("../../ar/scene-graph-ar");
11
11
  * Manages an instance of the <plattar-configurator> HTML Element
12
12
  */
13
13
  class ConfiguratorController extends plattar_controller_1.PlattarController {
14
- constructor() {
15
- super(...arguments);
16
- this._cachedConfigState = null;
17
- }
14
+ _cachedConfigState = null;
18
15
  async getConfiguratorState() {
19
16
  if (this._cachedConfigState) {
20
17
  return this._cachedConfigState;
@@ -133,6 +130,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
133
130
  const height = this.getAttribute("height") || "500px";
134
131
  viewer.setAttribute("width", width);
135
132
  viewer.setAttribute("height", height);
133
+ viewer.setAttribute("server", plattar_api_1.Server.location().type);
136
134
  if (opt.color) {
137
135
  viewer.setAttribute("color", opt.color);
138
136
  }
@@ -143,13 +141,29 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
143
141
  viewer.setAttribute("qr-type", opt.qrType);
144
142
  }
145
143
  viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
146
- let dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID;
144
+ let dst = `https://renderer.plattar.com/configurator.html?scene_id=${sceneID}`;
145
+ switch (plattar_api_1.Server.location().type) {
146
+ case 'review':
147
+ dst = `https://renderer-review.plattar.com/configurator.html?scene_id=${sceneID}`;
148
+ break;
149
+ case 'staging':
150
+ dst = `https://renderer.plattar.space/configurator.html?scene_id=${sceneID}`;
151
+ break;
152
+ }
147
153
  const showAR = this.getAttribute("show-ar");
148
154
  const showUI = this.getAttribute("show-ui");
149
155
  const showBanner = this.getAttribute("show-ar-banner");
150
156
  const sceneGraphID = this.getAttribute("scene-graph-id");
151
157
  if (showUI && showUI === "true") {
152
- dst = plattar_api_1.Server.location().base + "configurator/dist/index.html?scene_id=" + sceneID;
158
+ dst = `https://configurator.plattar.com/index.html?scene_id=${sceneID}`;
159
+ switch (plattar_api_1.Server.location().type) {
160
+ case 'review':
161
+ dst = `https://configurator-review.plattar.com/configurator.html?scene_id=${sceneID}`;
162
+ break;
163
+ case 'staging':
164
+ dst = `https://configurator.plattar.space/configurator.html?scene_id=${sceneID}`;
165
+ break;
166
+ }
153
167
  }
154
168
  if (configState) {
155
169
  dst += "&config_state=" + configState;
@@ -214,7 +228,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
214
228
  // required attributes with defaults for plattar-configurator node
215
229
  const width = this.getAttribute("width") || "500px";
216
230
  const height = this.getAttribute("height") || "500px";
217
- const server = this.getAttribute("server") || "production";
231
+ const server = plattar_api_1.Server.location().type;
218
232
  const viewer = document.createElement("plattar-configurator");
219
233
  this._element = viewer;
220
234
  viewer.setAttribute("width", width);
@@ -7,10 +7,7 @@ const plattar_controller_1 = require("./plattar-controller");
7
7
  * Manages an instance of the <plattar-configurator> HTML Element
8
8
  */
9
9
  class GalleryController extends plattar_controller_1.PlattarController {
10
- constructor() {
11
- super(...arguments);
12
- this._cachedConfigState = null;
13
- }
10
+ _cachedConfigState = null;
14
11
  async getConfiguratorState() {
15
12
  if (this._cachedConfigState) {
16
13
  return this._cachedConfigState;
@@ -61,6 +58,7 @@ class GalleryController extends plattar_controller_1.PlattarController {
61
58
  const height = this.getAttribute("height") || "500px";
62
59
  viewer.setAttribute("width", width);
63
60
  viewer.setAttribute("height", height);
61
+ viewer.setAttribute("server", plattar_api_1.Server.location().type);
64
62
  if (opt.color) {
65
63
  viewer.setAttribute("color", opt.color);
66
64
  }
@@ -71,7 +69,15 @@ class GalleryController extends plattar_controller_1.PlattarController {
71
69
  viewer.setAttribute("qr-type", opt.qrType);
72
70
  }
73
71
  viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
74
- const dst = plattar_api_1.Server.location().base + "renderer/gallery.html?scene_id=" + sceneID;
72
+ let dst = `https://renderer.plattar.com/gallery.html?scene_id=${sceneID}`;
73
+ switch (plattar_api_1.Server.location().type) {
74
+ case 'review':
75
+ dst = `https://renderer-review.plattar.com/gallery.html?scene_id=${sceneID}`;
76
+ break;
77
+ case 'staging':
78
+ dst = `https://renderer.plattar.space/gallery.html?scene_id=${sceneID}`;
79
+ break;
80
+ }
75
81
  viewer.setAttribute("url", opt.url || dst);
76
82
  this._prevQROpt = opt;
77
83
  if (!opt.detached) {
@@ -10,10 +10,7 @@ const scene_graph_ar_1 = require("../../ar/scene-graph-ar");
10
10
  * Manages an instance of the <plattar-configurator> HTML Element
11
11
  */
12
12
  class LauncherController extends plattar_controller_1.PlattarController {
13
- constructor() {
14
- super(...arguments);
15
- this._cachedConfigState = null;
16
- }
13
+ _cachedConfigState = null;
17
14
  async getConfiguratorState() {
18
15
  if (this._cachedConfigState) {
19
16
  return this._cachedConfigState;
@@ -28,13 +28,14 @@ class PlattarController {
28
28
  };
29
29
  }
30
30
  ;
31
+ _parent;
32
+ _state = ControllerState.None;
33
+ _element = null;
34
+ _prevQROpt = null;
35
+ _selectVariationObserver = null;
36
+ _selectVariationIDObserver = null;
37
+ _selectVariationSKUObserver = null;
31
38
  constructor(parent) {
32
- this._state = ControllerState.None;
33
- this._element = null;
34
- this._prevQROpt = null;
35
- this._selectVariationObserver = null;
36
- this._selectVariationIDObserver = null;
37
- this._selectVariationSKUObserver = null;
38
39
  this._parent = parent;
39
40
  }
40
41
  /**
@@ -155,6 +156,7 @@ class PlattarController {
155
156
  const height = this.getAttribute("height") || "500px";
156
157
  viewer.setAttribute("width", width);
157
158
  viewer.setAttribute("height", height);
159
+ viewer.setAttribute("server", plattar_api_1.Server.location().type);
158
160
  if (opt.color) {
159
161
  viewer.setAttribute("color", opt.color);
160
162
  }
@@ -166,7 +168,15 @@ class PlattarController {
166
168
  }
167
169
  viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
168
170
  const qrOptions = btoa(JSON.stringify(opt));
169
- let dst = plattar_api_1.Server.location().base + "renderer/launcher.html?qr_options=" + qrOptions;
171
+ let dst = `https://renderer.plattar.com/launcher.html?qr_options=${qrOptions}`;
172
+ switch (plattar_api_1.Server.location().type) {
173
+ case 'review':
174
+ dst = `https://renderer-review.plattar.com/launcher.html?qr_options=${qrOptions}`;
175
+ break;
176
+ case 'staging':
177
+ dst = `https://renderer.plattar.space/launcher.html?qr_options=${qrOptions}`;
178
+ break;
179
+ }
170
180
  //let configState: string | null = null;
171
181
  const sceneID = this.getAttribute("scene-id");
172
182
  const embedType = this.getAttribute("embed-type");
@@ -46,6 +46,7 @@ class ProductController extends plattar_controller_1.PlattarController {
46
46
  const height = this.getAttribute("height") || "500px";
47
47
  viewer.setAttribute("width", width);
48
48
  viewer.setAttribute("height", height);
49
+ viewer.setAttribute("server", plattar_api_1.Server.location().type);
49
50
  if (opt.color) {
50
51
  viewer.setAttribute("color", opt.color);
51
52
  }
@@ -60,7 +61,15 @@ class ProductController extends plattar_controller_1.PlattarController {
60
61
  const variationID = this.getAttribute("variation-id");
61
62
  const variationSKU = this.getAttribute("variation-sku");
62
63
  const showAR = this.getAttribute("show-ar");
63
- let dst = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + productID;
64
+ let dst = `https://renderer.plattar.com/product.html?product_id=${productID}`;
65
+ switch (plattar_api_1.Server.location().type) {
66
+ case 'review':
67
+ dst = `https://renderer-review.plattar.com/product.html?product_id=${productID}`;
68
+ break;
69
+ case 'staging':
70
+ dst = `https://renderer.plattar.space/product.html?product_id=${productID}`;
71
+ break;
72
+ }
64
73
  if (variationID) {
65
74
  dst += "&variationId=" + variationID;
66
75
  }
@@ -100,6 +109,7 @@ class ProductController extends plattar_controller_1.PlattarController {
100
109
  const height = this.getAttribute("height") || "500px";
101
110
  viewer.setAttribute("width", width);
102
111
  viewer.setAttribute("height", height);
112
+ viewer.setAttribute("server", plattar_api_1.Server.location().type);
103
113
  if (opt.color) {
104
114
  viewer.setAttribute("color", opt.color);
105
115
  }
@@ -111,7 +121,15 @@ class ProductController extends plattar_controller_1.PlattarController {
111
121
  }
112
122
  viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
113
123
  const qrOptions = btoa(JSON.stringify(opt));
114
- let dst = plattar_api_1.Server.location().base + "renderer/launcher.html?qr_options=" + qrOptions;
124
+ let dst = `https://renderer.plattar.com/launcher.html?qr_options=${qrOptions}`;
125
+ switch (plattar_api_1.Server.location().type) {
126
+ case 'review':
127
+ dst = `https://renderer-review.plattar.com/launcher.html?qr_options=${qrOptions}`;
128
+ break;
129
+ case 'staging':
130
+ dst = `https://renderer.plattar.space/launcher.html?qr_options=${qrOptions}`;
131
+ break;
132
+ }
115
133
  const sceneID = this.getAttribute("scene-id");
116
134
  const configState = this.getAttribute("config-state");
117
135
  const embedType = this.getAttribute("embed-type");
@@ -10,10 +10,7 @@ const configurator_ar_1 = require("../../ar/configurator-ar");
10
10
  * Manages an instance of the <plattar-configurator> HTML Element
11
11
  */
12
12
  class VTOController extends plattar_controller_1.PlattarController {
13
- constructor() {
14
- super(...arguments);
15
- this._cachedConfigState = null;
16
- }
13
+ _cachedConfigState = null;
17
14
  async getConfiguratorState() {
18
15
  if (this._cachedConfigState) {
19
16
  return this._cachedConfigState;
@@ -84,6 +81,7 @@ class VTOController extends plattar_controller_1.PlattarController {
84
81
  const height = this.getAttribute("height") || "500px";
85
82
  viewer.setAttribute("width", width);
86
83
  viewer.setAttribute("height", height);
84
+ viewer.setAttribute("server", plattar_api_1.Server.location().type);
87
85
  if (opt.color) {
88
86
  viewer.setAttribute("color", opt.color);
89
87
  }
@@ -94,7 +92,15 @@ class VTOController extends plattar_controller_1.PlattarController {
94
92
  viewer.setAttribute("qr-type", opt.qrType);
95
93
  }
96
94
  viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
97
- let dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID;
95
+ let dst = `https://renderer.plattar.com/facear.html?scene_id=${sceneID}`;
96
+ switch (plattar_api_1.Server.location().type) {
97
+ case 'review':
98
+ dst = `https://renderer-review.plattar.com/facear.html?scene_id=${sceneID}`;
99
+ break;
100
+ case 'staging':
101
+ dst = `https://renderer.plattar.space/facear.html?scene_id=${sceneID}`;
102
+ break;
103
+ }
98
104
  // optional attributes
99
105
  let configState = null;
100
106
  try {
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebXRController = void 0;
4
+ const plattar_api_1 = require("@plattar/plattar-api");
4
5
  const util_1 = require("../../util/util");
5
6
  const plattar_controller_1 = require("./plattar-controller");
6
7
  /**
7
8
  * Manages an instance of the <plattar-ewall> HTML Element
8
9
  */
9
10
  class WebXRController extends plattar_controller_1.PlattarController {
10
- constructor() {
11
- super(...arguments);
12
- this._cachedConfigState = null;
13
- }
11
+ _cachedConfigState = null;
14
12
  async getConfiguratorState() {
15
13
  if (this._cachedConfigState) {
16
14
  return this._cachedConfigState;
@@ -83,6 +81,7 @@ class WebXRController extends plattar_controller_1.PlattarController {
83
81
  const height = this.getAttribute("height") || "500px";
84
82
  viewer.setAttribute("width", width);
85
83
  viewer.setAttribute("height", height);
84
+ viewer.setAttribute("server", plattar_api_1.Server.location().type);
86
85
  if (opt.color) {
87
86
  viewer.setAttribute("color", opt.color);
88
87
  }
@@ -34,15 +34,15 @@ var ObserverState;
34
34
  * of Plattar related content
35
35
  */
36
36
  class PlattarEmbed extends HTMLElement {
37
+ // this is the current embed type, viewer by default
38
+ _currentType = EmbedType.None;
39
+ _observerState = ObserverState.Unlocked;
40
+ _controller = null;
41
+ _currentSceneID = null;
42
+ _currentServer = null;
43
+ _observer = null;
37
44
  constructor() {
38
45
  super();
39
- // this is the current embed type, viewer by default
40
- this._currentType = EmbedType.None;
41
- this._observerState = ObserverState.Unlocked;
42
- this._controller = null;
43
- this._currentSceneID = null;
44
- this._currentServer = null;
45
- this._observer = null;
46
46
  }
47
47
  get viewer() {
48
48
  return this._controller ? this._controller.element : null;
@@ -7,6 +7,11 @@ const plattar_api_1 = require("@plattar/plattar-api");
7
7
  * Allows easily changing
8
8
  */
9
9
  class ConfiguratorState {
10
+ _state;
11
+ // This maps Variation ID against a Scene Product ID - populated by decodeScene() function
12
+ _mappedVariationIDValues;
13
+ // This maps Variation SKU against a Variation ID - populated by decodeScene() function
14
+ _mappedVariationSKUValues;
10
15
  constructor(state = null) {
11
16
  this._mappedVariationIDValues = new Map();
12
17
  this._mappedVariationSKUValues = new Map();
@@ -445,7 +450,7 @@ class ConfiguratorState {
445
450
  // some scene-graphs are very large in size, we store it remotely
446
451
  // this storage will expire in 10 minutes so this is a non-permanent version
447
452
  // and is designed for quick ar
448
- const url = `https://c.plattar.com/v3/redir/store`;
453
+ const url = plattar_api_1.Server.location().type === 'staging' ? 'https://c.plattar.space/v3/redir/store' : 'https://c.plattar.com/v3/redir/store';
449
454
  // finally send our scene-graph to the backend to generate the AR file and return
450
455
  try {
451
456
  const response = await fetch(url, {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "2.5.1";
1
+ declare const _default: "2.7.2";
2
2
  export default _default;
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = "2.5.1";
3
+ exports.default = "2.7.2";
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ARViewer = void 0;
4
4
  class ARViewer {
5
+ modelUrl;
6
+ banner;
5
7
  constructor() {
6
8
  this.modelUrl = null;
7
9
  this.banner = null;