@plattar/plattar-ar-adapter 1.131.1 → 1.135.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 +564 -397
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +242 -129
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/ar/scene-ar.js +18 -3
- package/dist/embed/controllers/configurator-controller.js +2 -1
- package/dist/embed/controllers/plattar-controller.d.ts +1 -1
- package/dist/embed/controllers/plattar-controller.js +6 -4
- package/dist/embed/controllers/product-controller.js +2 -1
- package/dist/embed/controllers/viewer-controller.js +2 -1
- package/dist/embed/controllers/vto-controller.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -9
package/dist/ar/scene-ar.js
CHANGED
|
@@ -54,21 +54,35 @@ class SceneAR extends launcher_ar_1.LauncherAR {
|
|
|
54
54
|
_ComposeScene(scene, output) {
|
|
55
55
|
return new Promise((accept, reject) => {
|
|
56
56
|
const sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
|
|
57
|
+
const sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
|
|
57
58
|
// nothing to do if no AR components can be found
|
|
58
|
-
if (sceneProducts.length <= 0) {
|
|
59
|
+
if ((sceneProducts.length + sceneModels.length) <= 0) {
|
|
59
60
|
return reject(new Error("SceneAR.ComposeScene() - cannot proceed as scene does not contain AR components"));
|
|
60
61
|
}
|
|
61
62
|
// define our configurator
|
|
62
63
|
const configurator = new plattar_services_1.Configurator();
|
|
63
64
|
configurator.server = plattar_api_1.Server.location().type;
|
|
64
65
|
configurator.output = output;
|
|
65
|
-
|
|
66
|
+
let totalARObjectCount = 0;
|
|
67
|
+
// add our scene products
|
|
66
68
|
sceneProducts.forEach((sceneProduct) => {
|
|
67
69
|
const product = sceneProduct.relationships.find(plattar_api_1.Product);
|
|
68
|
-
if (product && product.attributes.product_variation_id) {
|
|
70
|
+
if (sceneProduct.attributes.include_in_augment && product && product.attributes.product_variation_id) {
|
|
69
71
|
configurator.addSceneProduct(sceneProduct.id, product.attributes.product_variation_id);
|
|
72
|
+
totalARObjectCount++;
|
|
70
73
|
}
|
|
71
74
|
});
|
|
75
|
+
// add our scene models
|
|
76
|
+
sceneModels.forEach((sceneModel) => {
|
|
77
|
+
if (sceneModel.attributes.include_in_augment) {
|
|
78
|
+
configurator.addModel(sceneModel.id);
|
|
79
|
+
totalARObjectCount++;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// ensure we have actually added AR objects
|
|
83
|
+
if (totalARObjectCount <= 0) {
|
|
84
|
+
return reject(new Error("SceneAR.ComposeScene() - cannot proceed as scene does not contain any enabled AR components"));
|
|
85
|
+
}
|
|
72
86
|
return configurator.get().then((result) => {
|
|
73
87
|
accept(result.filename);
|
|
74
88
|
}).catch(reject);
|
|
@@ -90,6 +104,7 @@ class SceneAR extends launcher_ar_1.LauncherAR {
|
|
|
90
104
|
scene.include(plattar_api_1.Project);
|
|
91
105
|
scene.include(plattar_api_1.SceneProduct);
|
|
92
106
|
scene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product));
|
|
107
|
+
scene.include(plattar_api_1.SceneModel);
|
|
93
108
|
scene.get().then((scene) => {
|
|
94
109
|
this._SetupAnalytics(scene);
|
|
95
110
|
const sceneOpt = scene.attributes.custom_json || {};
|
|
@@ -30,7 +30,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
|
30
30
|
this.removeRenderer();
|
|
31
31
|
const sceneID = this.getAttribute("scene-id");
|
|
32
32
|
if (sceneID) {
|
|
33
|
-
const opt = options ||
|
|
33
|
+
const opt = options || this._GetDefaultQROptions();
|
|
34
34
|
const viewer = document.createElement("plattar-qrcode");
|
|
35
35
|
// required attributes with defaults for plattar-viewer node
|
|
36
36
|
const width = this.getAttribute("width") || "500px";
|
|
@@ -46,6 +46,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
|
46
46
|
if (opt.qrType) {
|
|
47
47
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
48
48
|
}
|
|
49
|
+
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
49
50
|
let dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID;
|
|
50
51
|
// optional attributes
|
|
51
52
|
const configState = this.getAttribute("config-state");
|
|
@@ -11,7 +11,7 @@ export declare abstract class PlattarController {
|
|
|
11
11
|
/**
|
|
12
12
|
* Default QR Code rendering options
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
protected _GetDefaultQROptions(): any;
|
|
15
15
|
private readonly _parent;
|
|
16
16
|
protected _state: ControllerState;
|
|
17
17
|
protected _element: HTMLElement | null;
|
|
@@ -21,10 +21,11 @@ class PlattarController {
|
|
|
21
21
|
/**
|
|
22
22
|
* Default QR Code rendering options
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
_GetDefaultQROptions() {
|
|
25
25
|
return {
|
|
26
|
-
color: "#101721",
|
|
27
|
-
qrType: "default",
|
|
26
|
+
color: this.getAttribute("qr-color") || "#101721",
|
|
27
|
+
qrType: this.getAttribute("qr-style") || "default",
|
|
28
|
+
shorten: this.getAttribute("qr-shorten") || false,
|
|
28
29
|
margin: 0
|
|
29
30
|
};
|
|
30
31
|
}
|
|
@@ -64,7 +65,7 @@ class PlattarController {
|
|
|
64
65
|
return new Promise((accept, reject) => {
|
|
65
66
|
// remove the old renderer instance if any
|
|
66
67
|
this.removeRenderer();
|
|
67
|
-
const opt = options ||
|
|
68
|
+
const opt = options || this._GetDefaultQROptions();
|
|
68
69
|
const viewer = document.createElement("plattar-qrcode");
|
|
69
70
|
// required attributes with defaults for plattar-viewer node
|
|
70
71
|
const width = this.getAttribute("width") || "500px";
|
|
@@ -80,6 +81,7 @@ class PlattarController {
|
|
|
80
81
|
if (opt.qrType) {
|
|
81
82
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
82
83
|
}
|
|
84
|
+
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
83
85
|
const qrOptions = btoa(JSON.stringify(opt));
|
|
84
86
|
let dst = plattar_api_1.Server.location().base + "renderer/launcher.html?qr_options=" + qrOptions;
|
|
85
87
|
const sceneID = this.getAttribute("scene-id");
|
|
@@ -37,7 +37,7 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
37
37
|
this.removeRenderer();
|
|
38
38
|
const productID = this.getAttribute("product-id");
|
|
39
39
|
if (productID) {
|
|
40
|
-
const opt = options ||
|
|
40
|
+
const opt = options || this._GetDefaultQROptions();
|
|
41
41
|
const viewer = document.createElement("plattar-qrcode");
|
|
42
42
|
// required attributes with defaults for plattar-viewer node
|
|
43
43
|
const width = this.getAttribute("width") || "500px";
|
|
@@ -53,6 +53,7 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
53
53
|
if (opt.qrType) {
|
|
54
54
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
55
55
|
}
|
|
56
|
+
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
56
57
|
// optional attributes
|
|
57
58
|
const variationID = this.getAttribute("variation-id");
|
|
58
59
|
const variationSKU = this.getAttribute("variation-sku");
|
|
@@ -41,7 +41,7 @@ class ViewerController extends plattar_controller_1.PlattarController {
|
|
|
41
41
|
this.removeRenderer();
|
|
42
42
|
const sceneID = this.getAttribute("scene-id");
|
|
43
43
|
if (sceneID) {
|
|
44
|
-
const opt = options ||
|
|
44
|
+
const opt = options || this._GetDefaultQROptions();
|
|
45
45
|
const viewer = document.createElement("plattar-qrcode");
|
|
46
46
|
// required attributes with defaults for plattar-viewer node
|
|
47
47
|
const width = this.getAttribute("width") || "500px";
|
|
@@ -57,6 +57,7 @@ class ViewerController extends plattar_controller_1.PlattarController {
|
|
|
57
57
|
if (opt.qrType) {
|
|
58
58
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
59
59
|
}
|
|
60
|
+
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
60
61
|
let dst = plattar_api_1.Server.location().base + "renderer/viewer.html?scene_id=" + sceneID;
|
|
61
62
|
// optional attributes
|
|
62
63
|
const productID = (this.getAttribute("product-id") || this.getAttribute("scene-product-id"));
|
|
@@ -28,7 +28,7 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
28
28
|
this.removeRenderer();
|
|
29
29
|
const sceneID = this.getAttribute("scene-id");
|
|
30
30
|
if (sceneID) {
|
|
31
|
-
const opt = options ||
|
|
31
|
+
const opt = options || this._GetDefaultQROptions();
|
|
32
32
|
const viewer = document.createElement("plattar-qrcode");
|
|
33
33
|
// required attributes with defaults for plattar-viewer node
|
|
34
34
|
const width = this.getAttribute("width") || "500px";
|
|
@@ -44,6 +44,7 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
44
44
|
if (opt.qrType) {
|
|
45
45
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
46
46
|
}
|
|
47
|
+
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
47
48
|
let dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID;
|
|
48
49
|
// optional attributes
|
|
49
50
|
const configState = this.getAttribute("config-state");
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.
|
|
1
|
+
declare const _default: "1.135.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.
|
|
3
|
+
"version": "1.135.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",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://www.plattar.com",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@plattar/plattar-analytics": "^1.
|
|
40
|
+
"@plattar/plattar-analytics": "^1.134.3",
|
|
41
41
|
"@plattar/plattar-api": "^1.120.1",
|
|
42
|
-
"@plattar/plattar-qrcode": "1.
|
|
42
|
+
"@plattar/plattar-qrcode": "1.134.1",
|
|
43
43
|
"@plattar/plattar-services": "^1.120.1",
|
|
44
|
-
"@plattar/plattar-web": "^1.
|
|
44
|
+
"@plattar/plattar-web": "^1.135.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/cli": "^7.
|
|
48
|
-
"@babel/core": "^7.18.
|
|
49
|
-
"@babel/preset-env": "^7.18.
|
|
47
|
+
"@babel/cli": "^7.18.10",
|
|
48
|
+
"@babel/core": "^7.18.13",
|
|
49
|
+
"@babel/preset-env": "^7.18.10",
|
|
50
50
|
"browserify": "^17.0.0",
|
|
51
|
-
"typescript": "^4.
|
|
52
|
-
"uglify-js": "^3.
|
|
51
|
+
"typescript": "^4.8.2",
|
|
52
|
+
"uglify-js": "^3.17.0"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|