@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.
@@ -1242,7 +1242,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1242
1242
  throw new Error("ConfiguratorController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
1243
1243
  }
1244
1244
  const state = (await this.getConfiguratorState()).state;
1245
- const first = state.first();
1245
+ const first = state.firstActiveOfType("sceneproduct");
1246
1246
  if (first) {
1247
1247
  //const sceneProductAR: SceneProductAR = new SceneProductAR(first.scene_product_id, first.product_variation_id);
1248
1248
  const sceneProductAR = new scene_product_ar_1.SceneProductAR({
@@ -1565,7 +1565,7 @@ class LauncherController extends plattar_controller_1.PlattarController {
1565
1565
  throw new Error("LauncherController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
1566
1566
  }
1567
1567
  const state = (await this.getConfiguratorState()).state;
1568
- const first = state.first();
1568
+ const first = state.firstActiveOfType("sceneproduct");
1569
1569
  if (first) {
1570
1570
  //const sceneProductAR: SceneProductAR = new SceneProductAR(first.scene_product_id, first.product_variation_id);
1571
1571
  const sceneProductAR = new scene_product_ar_1.SceneProductAR({
@@ -2346,7 +2346,7 @@ class VTOController extends plattar_controller_1.PlattarController {
2346
2346
  throw new Error("VTOController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
2347
2347
  }
2348
2348
  const state = (await this.getConfiguratorState()).state;
2349
- const first = state.first();
2349
+ const first = state.firstActiveOfType("sceneproduct");
2350
2350
  if (first) {
2351
2351
  const sceneProductAR = new __1.SceneProductAR({
2352
2352
  productID: first.scene_product_id,
@@ -3187,6 +3187,32 @@ class ConfiguratorState {
3187
3187
  }
3188
3188
  return null;
3189
3189
  }
3190
+ firstActiveOfType(type) {
3191
+ const states = this._state.states;
3192
+ if (states.length > 0) {
3193
+ const meta = this._state.meta;
3194
+ const found = states.find((productState) => {
3195
+ const check = productState[meta.scene_product_index];
3196
+ if (check !== null && check !== undefined) {
3197
+ return productState.length === 3 && productState[meta.meta_index].type === type && productState[meta.meta_index].augment === true;
3198
+ }
3199
+ return false;
3200
+ });
3201
+ if (!found) {
3202
+ return null;
3203
+ }
3204
+ const data = {
3205
+ scene_product_id: found[meta.scene_product_index],
3206
+ product_variation_id: found[meta.product_variation_index],
3207
+ meta_data: {
3208
+ augment: found[meta.meta_index].augment || true,
3209
+ type: found[meta.meta_index].type || type
3210
+ }
3211
+ };
3212
+ return data;
3213
+ }
3214
+ return null;
3215
+ }
3190
3216
  get length() {
3191
3217
  return this._state.states.length;
3192
3218
  }
@@ -3401,7 +3427,7 @@ exports.Util = Util;
3401
3427
  },{}],19:[function(require,module,exports){
3402
3428
  "use strict";
3403
3429
  Object.defineProperty(exports, "__esModule", { value: true });
3404
- exports.default = "1.183.3";
3430
+ exports.default = "1.183.4";
3405
3431
 
3406
3432
  },{}],20:[function(require,module,exports){
3407
3433
  "use strict";