@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.
@@ -94,7 +94,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
94
94
  exports.ConfiguratorAR = void 0;
95
95
  var plattar_analytics_1 = require("@plattar/plattar-analytics");
96
96
  var plattar_api_1 = require("@plattar/plattar-api");
97
- var plattar_services_1 = require("@plattar/plattar-services");
98
97
  var util_1 = require("../util/util");
99
98
  var quicklook_viewer_1 = __importDefault(require("../viewers/quicklook-viewer"));
100
99
  var scene_viewer_1 = __importDefault(require("../viewers/scene-viewer"));
@@ -155,48 +154,47 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
155
154
  key: "_Compose",
156
155
  value: (function () {
157
156
  var _Compose2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(output) {
158
- var objects, configurator, totalARObjectCount, results;
157
+ var type, url, response, data;
159
158
  return _regeneratorRuntime().wrap(function _callee$(_context) {
160
159
  while (1) switch (_context.prev = _context.next) {
161
160
  case 0:
162
- objects = this._options.state.state.array();
163
- if (!(objects.length <= 0)) {
164
- _context.next = 3;
165
- break;
166
- }
167
- throw new Error("ConfiguratorAR.Compose() - cannot proceed as scene does not contain AR components");
168
- case 3:
169
- // define our configurator
170
- configurator = new plattar_services_1.Configurator();
171
- configurator.server = plattar_api_1.Server.location().type;
172
- configurator.output = output;
173
- totalARObjectCount = 0;
174
- objects.forEach(function (object) {
175
- if (object.meta_data.augment) {
176
- if (object.meta_data.type === "scenemodel") {
177
- configurator.addModel(object.scene_product_id);
178
- } else {
179
- configurator.addSceneProduct(object.scene_product_id, object.product_variation_id);
161
+ type = output === 'glb' ? "viewer" : "reality";
162
+ url = "https://xrutils.plattar.com/v3/scene/".concat(this._options.state.scene.id, "/").concat(type); // grab our existing scene-graph from the saved API
163
+ _context.prev = 2;
164
+ _context.next = 5;
165
+ return fetch(url, {
166
+ method: "POST",
167
+ headers: {
168
+ "Content-Type": "application/json"
169
+ },
170
+ body: JSON.stringify({
171
+ data: {
172
+ attributes: this._options.state.state.sceneGraph
180
173
  }
181
- totalARObjectCount++;
182
- }
174
+ })
183
175
  });
184
- if (!(totalARObjectCount <= 0)) {
185
- _context.next = 10;
176
+ case 5:
177
+ response = _context.sent;
178
+ if (response.ok) {
179
+ _context.next = 8;
186
180
  break;
187
181
  }
188
- throw new Error("ConfiguratorAR.Compose() - cannot proceed as scene does not contain any enabled AR components");
182
+ throw new Error("ConfiguratorAR - Fetching Existing Graph Error - network response was not ok ".concat(response.status));
183
+ case 8:
184
+ _context.next = 10;
185
+ return response.json();
189
186
  case 10:
190
- _context.next = 12;
191
- return configurator.get();
192
- case 12:
193
- results = _context.sent;
194
- return _context.abrupt("return", results.filename);
187
+ data = _context.sent;
188
+ return _context.abrupt("return", data.data.attributes.url);
195
189
  case 14:
190
+ _context.prev = 14;
191
+ _context.t0 = _context["catch"](2);
192
+ throw new Error("ConfiguratorAR - Fetching Existing Graph Error - there was a request error to ".concat(url, ", error was ").concat(_context.t0.message));
193
+ case 17:
196
194
  case "end":
197
195
  return _context.stop();
198
196
  }
199
- }, _callee, this);
197
+ }, _callee, this, [[2, 14]]);
200
198
  }));
201
199
  function _Compose(_x) {
202
200
  return _Compose2.apply(this, arguments);
@@ -339,8 +337,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
339
337
  "../viewers/scene-viewer": 24,
340
338
  "./launcher-ar": 2,
341
339
  "@plattar/plattar-analytics": 44,
342
- "@plattar/plattar-api": 48,
343
- "@plattar/plattar-services": 121
340
+ "@plattar/plattar-api": 48
344
341
  }],
345
342
  2: [function (require, module, exports) {
346
343
  "use strict";
@@ -5251,6 +5248,40 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
5251
5248
  function encode() {
5252
5249
  return btoa(JSON.stringify(this._state));
5253
5250
  }
5251
+ /**
5252
+ * Compiles and returns the Dynamic Scene Graph (Updated for 2025 for DynamicAR)
5253
+ * NOTE: Eventually this structure should replace ConfiguratorState
5254
+ */
5255
+ }, {
5256
+ key: "sceneGraph",
5257
+ get: function get() {
5258
+ var objects = this.array();
5259
+ // in here we need to generate the schema input to be sent to the backend service
5260
+ var schema = {
5261
+ // ensure to only generate AR using files we pass into the backend
5262
+ strict: false,
5263
+ inputs: []
5264
+ };
5265
+ objects.forEach(function (object) {
5266
+ if (object.meta_data.type === "scenemodel") {
5267
+ var data = {
5268
+ id: object.scene_product_id,
5269
+ type: 'scenemodel',
5270
+ visibility: object.meta_data.augment
5271
+ };
5272
+ schema.inputs.push(data);
5273
+ } else {
5274
+ var _data = {
5275
+ id: object.scene_product_id,
5276
+ type: 'sceneproduct',
5277
+ variation_id: object.product_variation_id,
5278
+ visibility: object.meta_data.augment
5279
+ };
5280
+ schema.inputs.push(_data);
5281
+ }
5282
+ });
5283
+ return schema;
5284
+ }
5254
5285
  }], [{
5255
5286
  key: "decode",
5256
5287
  value: function decode(state) {
@@ -5552,7 +5583,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
5552
5583
  Object.defineProperty(exports, "__esModule", {
5553
5584
  value: true
5554
5585
  });
5555
- exports["default"] = "1.183.1";
5586
+ exports["default"] = "1.183.2";
5556
5587
  }, {}],
5557
5588
  21: [function (require, module, exports) {
5558
5589
  "use strict";