@plattar/plattar-ar-adapter 1.183.1 → 1.183.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.
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ConfiguratorAR = void 0;
8
8
  const plattar_analytics_1 = require("@plattar/plattar-analytics");
9
9
  const plattar_api_1 = require("@plattar/plattar-api");
10
- const plattar_services_1 = require("@plattar/plattar-services");
11
10
  const util_1 = require("../util/util");
12
11
  const quicklook_viewer_1 = __importDefault(require("../viewers/quicklook-viewer"));
13
12
  const scene_viewer_1 = __importDefault(require("../viewers/scene-viewer"));
@@ -59,31 +58,30 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
59
58
  * an AR File
60
59
  */
61
60
  async _Compose(output) {
62
- const objects = this._options.state.state.array();
63
- if (objects.length <= 0) {
64
- throw new Error("ConfiguratorAR.Compose() - cannot proceed as scene does not contain AR components");
65
- }
66
- // define our configurator
67
- const configurator = new plattar_services_1.Configurator();
68
- configurator.server = plattar_api_1.Server.location().type;
69
- configurator.output = output;
70
- let totalARObjectCount = 0;
71
- objects.forEach((object) => {
72
- if (object.meta_data.augment) {
73
- if (object.meta_data.type === "scenemodel") {
74
- configurator.addModel(object.scene_product_id);
75
- }
76
- else {
77
- configurator.addSceneProduct(object.scene_product_id, object.product_variation_id);
78
- }
79
- totalARObjectCount++;
61
+ const type = output === 'glb' ? "viewer" : "reality";
62
+ const url = `https://xrutils.plattar.com/v3/scene/${this._options.state.scene.id}/${type}`;
63
+ // grab our existing scene-graph from the saved API
64
+ try {
65
+ const response = await fetch(url, {
66
+ method: "POST",
67
+ headers: {
68
+ "Content-Type": "application/json"
69
+ },
70
+ body: JSON.stringify({
71
+ data: {
72
+ attributes: this._options.state.state.sceneGraph
73
+ }
74
+ })
75
+ });
76
+ if (!response.ok) {
77
+ throw new Error(`ConfiguratorAR - Fetching Existing Graph Error - network response was not ok ${response.status}`);
80
78
  }
81
- });
82
- if (totalARObjectCount <= 0) {
83
- throw new Error("ConfiguratorAR.Compose() - cannot proceed as scene does not contain any enabled AR components");
79
+ const data = await response.json();
80
+ return data.data.attributes.url;
81
+ }
82
+ catch (error) {
83
+ throw new Error(`ConfiguratorAR - Fetching Existing Graph Error - there was a request error to ${url}, error was ${error.message}`);
84
84
  }
85
- const results = await configurator.get();
86
- return results.filename;
87
85
  }
88
86
  /**
89
87
  * Initialise the SceneAR instance. This returns a Promise that resolves
@@ -170,7 +168,7 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
170
168
  }
171
169
  exports.ConfiguratorAR = ConfiguratorAR;
172
170
 
173
- },{"../util/util":19,"../version":20,"../viewers/quicklook-viewer":22,"../viewers/scene-viewer":24,"./launcher-ar":2,"@plattar/plattar-analytics":44,"@plattar/plattar-api":48,"@plattar/plattar-services":121}],2:[function(require,module,exports){
171
+ },{"../util/util":19,"../version":20,"../viewers/quicklook-viewer":22,"../viewers/scene-viewer":24,"./launcher-ar":2,"@plattar/plattar-analytics":44,"@plattar/plattar-api":48}],2:[function(require,module,exports){
174
172
  "use strict";
175
173
  Object.defineProperty(exports, "__esModule", { value: true });
176
174
  exports.LauncherAR = void 0;
@@ -3492,6 +3490,39 @@ class ConfiguratorState {
3492
3490
  encode() {
3493
3491
  return btoa(JSON.stringify(this._state));
3494
3492
  }
3493
+ /**
3494
+ * Compiles and returns the Dynamic Scene Graph (Updated for 2025 for DynamicAR)
3495
+ * NOTE: Eventually this structure should replace ConfiguratorState
3496
+ */
3497
+ get sceneGraph() {
3498
+ const objects = this.array();
3499
+ // in here we need to generate the schema input to be sent to the backend service
3500
+ const schema = {
3501
+ // ensure to only generate AR using files we pass into the backend
3502
+ strict: false,
3503
+ inputs: []
3504
+ };
3505
+ objects.forEach((object) => {
3506
+ if (object.meta_data.type === "scenemodel") {
3507
+ const data = {
3508
+ id: object.scene_product_id,
3509
+ type: 'scenemodel',
3510
+ visibility: object.meta_data.augment
3511
+ };
3512
+ schema.inputs.push(data);
3513
+ }
3514
+ else {
3515
+ const data = {
3516
+ id: object.scene_product_id,
3517
+ type: 'sceneproduct',
3518
+ variation_id: object.product_variation_id,
3519
+ visibility: object.meta_data.augment
3520
+ };
3521
+ schema.inputs.push(data);
3522
+ }
3523
+ });
3524
+ return schema;
3525
+ }
3495
3526
  }
3496
3527
  exports.ConfiguratorState = ConfiguratorState;
3497
3528
 
@@ -3596,7 +3627,7 @@ exports.Util = Util;
3596
3627
  },{}],20:[function(require,module,exports){
3597
3628
  "use strict";
3598
3629
  Object.defineProperty(exports, "__esModule", { value: true });
3599
- exports.default = "1.183.1";
3630
+ exports.default = "1.183.2";
3600
3631
 
3601
3632
  },{}],21:[function(require,module,exports){
3602
3633
  "use strict";