@plattar/plattar-ar-adapter 1.183.3 → 1.183.4

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.
@@ -272,7 +272,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
272
272
  throw new Error("ConfiguratorController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
273
273
  }
274
274
  const state = (await this.getConfiguratorState()).state;
275
- const first = state.first();
275
+ const first = state.firstActiveOfType("sceneproduct");
276
276
  if (first) {
277
277
  //const sceneProductAR: SceneProductAR = new SceneProductAR(first.scene_product_id, first.product_variation_id);
278
278
  const sceneProductAR = new scene_product_ar_1.SceneProductAR({
@@ -177,7 +177,7 @@ class LauncherController extends plattar_controller_1.PlattarController {
177
177
  throw new Error("LauncherController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
178
178
  }
179
179
  const state = (await this.getConfiguratorState()).state;
180
- const first = state.first();
180
+ const first = state.firstActiveOfType("sceneproduct");
181
181
  if (first) {
182
182
  //const sceneProductAR: SceneProductAR = new SceneProductAR(first.scene_product_id, first.product_variation_id);
183
183
  const sceneProductAR = new scene_product_ar_1.SceneProductAR({
@@ -208,7 +208,7 @@ class VTOController extends plattar_controller_1.PlattarController {
208
208
  throw new Error("VTOController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
209
209
  }
210
210
  const state = (await this.getConfiguratorState()).state;
211
- const first = state.first();
211
+ const first = state.firstActiveOfType("sceneproduct");
212
212
  if (first) {
213
213
  const sceneProductAR = new __1.SceneProductAR({
214
214
  productID: first.scene_product_id,
@@ -91,6 +91,7 @@ export declare class ConfiguratorState {
91
91
  * @returns Returns the first reference of data in the stack that matches a type, otherwise returns null
92
92
  */
93
93
  firstOfType(type: SceneProductDataMetaType): SceneProductData | null;
94
+ firstActiveOfType(type: SceneProductDataMetaType): SceneProductData | null;
94
95
  get length(): number;
95
96
  /**
96
97
  * Decodes and returns an instance of ConfiguratorState from a previously
@@ -304,6 +304,32 @@ class ConfiguratorState {
304
304
  }
305
305
  return null;
306
306
  }
307
+ firstActiveOfType(type) {
308
+ const states = this._state.states;
309
+ if (states.length > 0) {
310
+ const meta = this._state.meta;
311
+ const found = states.find((productState) => {
312
+ const check = productState[meta.scene_product_index];
313
+ if (check !== null && check !== undefined) {
314
+ return productState.length === 3 && productState[meta.meta_index].type === type && productState[meta.meta_index].augment === true;
315
+ }
316
+ return false;
317
+ });
318
+ if (!found) {
319
+ return null;
320
+ }
321
+ const data = {
322
+ scene_product_id: found[meta.scene_product_index],
323
+ product_variation_id: found[meta.product_variation_index],
324
+ meta_data: {
325
+ augment: found[meta.meta_index].augment || true,
326
+ type: found[meta.meta_index].type || type
327
+ }
328
+ };
329
+ return data;
330
+ }
331
+ return null;
332
+ }
307
333
  get length() {
308
334
  return this._state.states.length;
309
335
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.183.3";
1
+ declare const _default: "1.183.4";
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 = "1.183.3";
3
+ exports.default = "1.183.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plattar/plattar-ar-adapter",
3
- "version": "1.183.3",
3
+ "version": "1.183.4",
4
4
  "description": "Plattar AR Adapter for interfacing with Google & Apple WebAR",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -41,14 +41,14 @@
41
41
  "@plattar/plattar-api": "^1.178.1",
42
42
  "@plattar/plattar-qrcode": "1.178.1",
43
43
  "@plattar/plattar-services": "^1.157.1",
44
- "@plattar/plattar-web": "^1.178.2"
44
+ "@plattar/plattar-web": "^1.182.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/cli": "^7.25.9",
48
- "@babel/core": "^7.26.0",
49
- "@babel/preset-env": "^7.26.0",
47
+ "@babel/cli": "^7.26.4",
48
+ "@babel/core": "^7.26.10",
49
+ "@babel/preset-env": "^7.26.9",
50
50
  "browserify": "^17.0.1",
51
- "typescript": "^5.7.2",
51
+ "typescript": "^5.8.2",
52
52
  "uglify-js": "^3.19.3"
53
53
  },
54
54
  "publishConfig": {