@plattar/plattar-ar-adapter 1.123.7 → 1.123.8

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.
@@ -4,6 +4,7 @@ exports.ViewerController = void 0;
4
4
  const plattar_api_1 = require("@plattar/plattar-api");
5
5
  const product_ar_1 = require("../../ar/product-ar");
6
6
  const scene_product_ar_1 = require("../../ar/scene-product-ar");
7
+ const configurator_state_1 = require("../../util/configurator-state");
7
8
  const util_1 = require("../../util/util");
8
9
  const plattar_controller_1 = require("./plattar-controller");
9
10
  /**
@@ -136,11 +137,18 @@ class ViewerController extends plattar_controller_1.PlattarController {
136
137
  return product.init().then(accept).catch(reject);
137
138
  }
138
139
  const sceneID = this.getAttribute("scene-id");
139
- // otherwise, scene was set so use SceneAR
140
+ // use the first default product-variation id if available
140
141
  if (sceneID) {
141
- return reject(new Error("ViewerController.initAR() - AR mode for scene-id not yet supported, use product-id or scene-product-id"));
142
+ return configurator_state_1.ConfiguratorState.decodeScene(sceneID).then((state) => {
143
+ const first = state.first();
144
+ if (first) {
145
+ const sceneProductAR = new scene_product_ar_1.SceneProductAR(first.scene_product_id, first.product_variation_id);
146
+ return sceneProductAR.init().then(accept).catch(reject);
147
+ }
148
+ return reject(new Error("ViewerController.initAR() - your scene does not contain any valid products"));
149
+ }).catch(reject);
142
150
  }
143
- return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use product-id or scene-product-id as a minimum"));
151
+ return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use scene-id as a minimum"));
144
152
  });
145
153
  }
146
154
  removeRenderer() {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.123.7";
1
+ declare const _default: "1.123.8";
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.123.7";
3
+ exports.default = "1.123.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plattar/plattar-ar-adapter",
3
- "version": "1.123.7",
3
+ "version": "1.123.8",
4
4
  "description": "Plattar AR Adapter for interfacing with Google & Apple WebAR",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",