@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.
@@ -1729,6 +1729,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1729
1729
 
1730
1730
  var scene_product_ar_1 = require("../../ar/scene-product-ar");
1731
1731
 
1732
+ var configurator_state_1 = require("../../util/configurator-state");
1733
+
1732
1734
  var util_1 = require("../../util/util");
1733
1735
 
1734
1736
  var plattar_controller_1 = require("./plattar-controller");
@@ -1922,14 +1924,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1922
1924
  return _product.init().then(accept)["catch"](reject);
1923
1925
  }
1924
1926
 
1925
- var sceneID = _this24.getAttribute("scene-id"); // otherwise, scene was set so use SceneAR
1927
+ var sceneID = _this24.getAttribute("scene-id"); // use the first default product-variation id if available
1926
1928
 
1927
1929
 
1928
1930
  if (sceneID) {
1929
- return reject(new Error("ViewerController.initAR() - AR mode for scene-id not yet supported, use product-id or scene-product-id"));
1931
+ return configurator_state_1.ConfiguratorState.decodeScene(sceneID).then(function (state) {
1932
+ var first = state.first();
1933
+
1934
+ if (first) {
1935
+ var sceneProductAR = new scene_product_ar_1.SceneProductAR(first.scene_product_id, first.product_variation_id);
1936
+ return sceneProductAR.init().then(accept)["catch"](reject);
1937
+ }
1938
+
1939
+ return reject(new Error("ViewerController.initAR() - your scene does not contain any valid products"));
1940
+ })["catch"](reject);
1930
1941
  }
1931
1942
 
1932
- return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use product-id or scene-product-id as a minimum"));
1943
+ return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use scene-id as a minimum"));
1933
1944
  });
1934
1945
  }
1935
1946
  }, {
@@ -1958,6 +1969,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1958
1969
  }, {
1959
1970
  "../../ar/product-ar": 3,
1960
1971
  "../../ar/scene-product-ar": 6,
1972
+ "../../util/configurator-state": 14,
1961
1973
  "../../util/util": 15,
1962
1974
  "./plattar-controller": 8,
1963
1975
  "@plattar/plattar-api": 42
@@ -3066,7 +3078,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3066
3078
  Object.defineProperty(exports, "__esModule", {
3067
3079
  value: true
3068
3080
  });
3069
- exports["default"] = "1.123.7";
3081
+ exports["default"] = "1.123.8";
3070
3082
  }, {}],
3071
3083
  17: [function (require, module, exports) {
3072
3084
  "use strict";