@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.
- package/build/es2015/plattar-ar-adapter.js +65 -34
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +57 -26
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/ar/configurator-ar.js +22 -24
- package/dist/util/configurator-state.d.ts +5 -0
- package/dist/util/configurator-state.js +33 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ConfiguratorAR = void 0;
|
|
7
7
|
const plattar_analytics_1 = require("@plattar/plattar-analytics");
|
|
8
8
|
const plattar_api_1 = require("@plattar/plattar-api");
|
|
9
|
-
const plattar_services_1 = require("@plattar/plattar-services");
|
|
10
9
|
const util_1 = require("../util/util");
|
|
11
10
|
const quicklook_viewer_1 = __importDefault(require("../viewers/quicklook-viewer"));
|
|
12
11
|
const scene_viewer_1 = __importDefault(require("../viewers/scene-viewer"));
|
|
@@ -58,31 +57,30 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
|
|
|
58
57
|
* an AR File
|
|
59
58
|
*/
|
|
60
59
|
async _Compose(output) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
totalARObjectCount++;
|
|
60
|
+
const type = output === 'glb' ? "viewer" : "reality";
|
|
61
|
+
const url = `https://xrutils.plattar.com/v3/scene/${this._options.state.scene.id}/${type}`;
|
|
62
|
+
// grab our existing scene-graph from the saved API
|
|
63
|
+
try {
|
|
64
|
+
const response = await fetch(url, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: {
|
|
67
|
+
"Content-Type": "application/json"
|
|
68
|
+
},
|
|
69
|
+
body: JSON.stringify({
|
|
70
|
+
data: {
|
|
71
|
+
attributes: this._options.state.state.sceneGraph
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
if (!response.ok) {
|
|
76
|
+
throw new Error(`ConfiguratorAR - Fetching Existing Graph Error - network response was not ok ${response.status}`);
|
|
79
77
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
const data = await response.json();
|
|
79
|
+
return data.data.attributes.url;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new Error(`ConfiguratorAR - Fetching Existing Graph Error - there was a request error to ${url}, error was ${error.message}`);
|
|
83
83
|
}
|
|
84
|
-
const results = await configurator.get();
|
|
85
|
-
return results.filename;
|
|
86
84
|
}
|
|
87
85
|
/**
|
|
88
86
|
* Initialise the SceneAR instance. This returns a Promise that resolves
|
|
@@ -118,4 +118,9 @@ export declare class ConfiguratorState {
|
|
|
118
118
|
* @returns - Base64 String
|
|
119
119
|
*/
|
|
120
120
|
encode(): string;
|
|
121
|
+
/**
|
|
122
|
+
* Compiles and returns the Dynamic Scene Graph (Updated for 2025 for DynamicAR)
|
|
123
|
+
* NOTE: Eventually this structure should replace ConfiguratorState
|
|
124
|
+
*/
|
|
125
|
+
get sceneGraph(): any;
|
|
121
126
|
}
|
|
@@ -414,5 +414,38 @@ class ConfiguratorState {
|
|
|
414
414
|
encode() {
|
|
415
415
|
return btoa(JSON.stringify(this._state));
|
|
416
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Compiles and returns the Dynamic Scene Graph (Updated for 2025 for DynamicAR)
|
|
419
|
+
* NOTE: Eventually this structure should replace ConfiguratorState
|
|
420
|
+
*/
|
|
421
|
+
get sceneGraph() {
|
|
422
|
+
const objects = this.array();
|
|
423
|
+
// in here we need to generate the schema input to be sent to the backend service
|
|
424
|
+
const schema = {
|
|
425
|
+
// ensure to only generate AR using files we pass into the backend
|
|
426
|
+
strict: false,
|
|
427
|
+
inputs: []
|
|
428
|
+
};
|
|
429
|
+
objects.forEach((object) => {
|
|
430
|
+
if (object.meta_data.type === "scenemodel") {
|
|
431
|
+
const data = {
|
|
432
|
+
id: object.scene_product_id,
|
|
433
|
+
type: 'scenemodel',
|
|
434
|
+
visibility: object.meta_data.augment
|
|
435
|
+
};
|
|
436
|
+
schema.inputs.push(data);
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
const data = {
|
|
440
|
+
id: object.scene_product_id,
|
|
441
|
+
type: 'sceneproduct',
|
|
442
|
+
variation_id: object.product_variation_id,
|
|
443
|
+
visibility: object.meta_data.augment
|
|
444
|
+
};
|
|
445
|
+
schema.inputs.push(data);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
return schema;
|
|
449
|
+
}
|
|
417
450
|
}
|
|
418
451
|
exports.ConfiguratorState = ConfiguratorState;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.183.
|
|
1
|
+
declare const _default: "1.183.2";
|
|
2
2
|
export default _default;
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plattar/plattar-ar-adapter",
|
|
3
|
-
"version": "1.183.
|
|
3
|
+
"version": "1.183.2",
|
|
4
4
|
"description": "Plattar AR Adapter for interfacing with Google & Apple WebAR",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@babel/core": "^7.26.9",
|
|
49
49
|
"@babel/preset-env": "^7.26.9",
|
|
50
50
|
"browserify": "^17.0.1",
|
|
51
|
-
"typescript": "^5.
|
|
51
|
+
"typescript": "^5.8.2",
|
|
52
52
|
"uglify-js": "^3.19.3"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|