@plattar/plattar-ar-adapter 1.123.1 → 1.123.5
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 +1460 -949
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +605 -224
- package/build/es2019/plattar-ar-adapter.min.js +9 -1
- package/dist/ar/launcher-ar.d.ts +8 -1
- package/dist/ar/launcher-ar.js +12 -0
- package/dist/ar/model-ar.d.ts +0 -5
- package/dist/ar/model-ar.js +1 -12
- package/dist/ar/product-ar.d.ts +1 -6
- package/dist/ar/product-ar.js +3 -14
- package/dist/ar/raw-ar.d.ts +0 -5
- package/dist/ar/raw-ar.js +0 -12
- package/dist/ar/scene-ar.d.ts +21 -1
- package/dist/ar/scene-ar.js +148 -5
- package/dist/embed/controllers/configurator-controller.d.ts +0 -1
- package/dist/embed/controllers/configurator-controller.js +0 -8
- package/dist/embed/controllers/plattar-controller.d.ts +1 -1
- package/dist/embed/controllers/plattar-controller.js +11 -0
- package/dist/embed/controllers/product-controller.d.ts +0 -1
- package/dist/embed/controllers/product-controller.js +3 -9
- package/dist/embed/controllers/viewer-controller.d.ts +0 -1
- package/dist/embed/controllers/viewer-controller.js +3 -9
- package/dist/embed/controllers/vto-controller.d.ts +17 -0
- package/dist/embed/controllers/vto-controller.js +169 -0
- package/dist/embed/plattar-embed.d.ts +6 -0
- package/dist/embed/plattar-embed.js +19 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/util/configurator-state.d.ts +26 -0
- package/dist/util/configurator-state.js +92 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/dist/ar/configurator-ar.d.ts +0 -9
- package/dist/ar/configurator-ar.js +0 -19
package/dist/ar/launcher-ar.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export declare abstract class LauncherAR {
|
|
2
2
|
constructor();
|
|
3
3
|
abstract init(): Promise<LauncherAR>;
|
|
4
|
-
abstract launch(): Promise<void>;
|
|
5
4
|
abstract start(): void;
|
|
5
|
+
abstract canQuicklook(): boolean;
|
|
6
|
+
abstract canRealityViewer(): boolean;
|
|
7
|
+
abstract canSceneViewer(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
10
|
+
* Use .init() and .start() separately for fine-grained control
|
|
11
|
+
*/
|
|
12
|
+
launch(): Promise<void>;
|
|
6
13
|
}
|
package/dist/ar/launcher-ar.js
CHANGED
|
@@ -3,5 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LauncherAR = void 0;
|
|
4
4
|
class LauncherAR {
|
|
5
5
|
constructor() { }
|
|
6
|
+
/**
|
|
7
|
+
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
8
|
+
* Use .init() and .start() separately for fine-grained control
|
|
9
|
+
*/
|
|
10
|
+
launch() {
|
|
11
|
+
return new Promise((accept, reject) => {
|
|
12
|
+
this.init().then((value) => {
|
|
13
|
+
value.start();
|
|
14
|
+
return accept();
|
|
15
|
+
}).catch(reject);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
6
18
|
}
|
|
7
19
|
exports.LauncherAR = LauncherAR;
|
package/dist/ar/model-ar.d.ts
CHANGED
|
@@ -17,11 +17,6 @@ export declare class ModelAR extends LauncherAR {
|
|
|
17
17
|
* cannot be performed.
|
|
18
18
|
*/
|
|
19
19
|
init(): Promise<LauncherAR>;
|
|
20
|
-
/**
|
|
21
|
-
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
22
|
-
* Use .init() and .start() separately for fine-grained control
|
|
23
|
-
*/
|
|
24
|
-
launch(): Promise<void>;
|
|
25
20
|
/**
|
|
26
21
|
* Launches the internal AR instance using an appropriate version of AR Viewers
|
|
27
22
|
*/
|
package/dist/ar/model-ar.js
CHANGED
|
@@ -35,6 +35,7 @@ class ModelAR extends launcher_ar_1.LauncherAR {
|
|
|
35
35
|
if (project) {
|
|
36
36
|
analytics = new plattar_analytics_1.Analytics(project.id);
|
|
37
37
|
analytics.origin = plattar_api_1.Server.location().type;
|
|
38
|
+
analytics.data.push("type", "model-ar");
|
|
38
39
|
analytics.data.push("applicationId", project.id);
|
|
39
40
|
analytics.data.push("applicationTitle", project.attributes.title);
|
|
40
41
|
analytics.data.push("modelId", model.id);
|
|
@@ -89,18 +90,6 @@ class ModelAR extends launcher_ar_1.LauncherAR {
|
|
|
89
90
|
}).catch(reject);
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
94
|
-
* Use .init() and .start() separately for fine-grained control
|
|
95
|
-
*/
|
|
96
|
-
launch() {
|
|
97
|
-
return new Promise((accept, reject) => {
|
|
98
|
-
this.init().then((value) => {
|
|
99
|
-
value.start();
|
|
100
|
-
return accept();
|
|
101
|
-
}).catch(reject);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
93
|
/**
|
|
105
94
|
* Launches the internal AR instance using an appropriate version of AR Viewers
|
|
106
95
|
*/
|
package/dist/ar/product-ar.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare class ProductAR extends LauncherAR {
|
|
|
10
10
|
constructor(productID?: string | undefined | null, variationID?: string | undefined | null);
|
|
11
11
|
get productID(): string;
|
|
12
12
|
get variationID(): string;
|
|
13
|
-
private
|
|
13
|
+
private _SetupAnalytics;
|
|
14
14
|
/**
|
|
15
15
|
* Initialise the ProductAR instance. This returns a Promise that resolves
|
|
16
16
|
* successfully if initialisation is successful, otherwise it will fail.
|
|
@@ -19,11 +19,6 @@ export declare class ProductAR extends LauncherAR {
|
|
|
19
19
|
* cannot be performed.
|
|
20
20
|
*/
|
|
21
21
|
init(): Promise<LauncherAR>;
|
|
22
|
-
/**
|
|
23
|
-
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
24
|
-
* Use .init() and .start() separately for fine-grained control
|
|
25
|
-
*/
|
|
26
|
-
launch(): Promise<void>;
|
|
27
22
|
/**
|
|
28
23
|
* Launches the internal AR instance using an appropriate version of AR Viewers
|
|
29
24
|
*/
|
package/dist/ar/product-ar.js
CHANGED
|
@@ -32,7 +32,7 @@ class ProductAR extends launcher_ar_1.LauncherAR {
|
|
|
32
32
|
get variationID() {
|
|
33
33
|
return this._variationID;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
_SetupAnalytics(product, variation) {
|
|
36
36
|
let analytics = null;
|
|
37
37
|
const scene = product.relationships.find(plattar_api_1.Scene);
|
|
38
38
|
// setup scene stuff (if any)
|
|
@@ -40,6 +40,7 @@ class ProductAR extends launcher_ar_1.LauncherAR {
|
|
|
40
40
|
analytics = new plattar_analytics_1.Analytics(scene.attributes.application_id);
|
|
41
41
|
analytics.origin = plattar_api_1.Server.location().type;
|
|
42
42
|
this._analytics = analytics;
|
|
43
|
+
analytics.data.push("type", "product-ar");
|
|
43
44
|
analytics.data.push("sceneId", scene.id);
|
|
44
45
|
analytics.data.push("sceneTitle", scene.attributes.title);
|
|
45
46
|
const application = scene.relationships.find(plattar_api_1.Project);
|
|
@@ -100,7 +101,7 @@ class ProductAR extends launcher_ar_1.LauncherAR {
|
|
|
100
101
|
if (!model) {
|
|
101
102
|
return reject(new Error("ProductAR.init() - cannot proceed as ModelFile for selected variation is corrupt"));
|
|
102
103
|
}
|
|
103
|
-
this.
|
|
104
|
+
this._SetupAnalytics(product, variation);
|
|
104
105
|
// we need to define our AR module here
|
|
105
106
|
// we are in Safari/Quicklook mode here
|
|
106
107
|
if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
|
|
@@ -131,18 +132,6 @@ class ProductAR extends launcher_ar_1.LauncherAR {
|
|
|
131
132
|
}).catch(reject);
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
136
|
-
* Use .init() and .start() separately for fine-grained control
|
|
137
|
-
*/
|
|
138
|
-
launch() {
|
|
139
|
-
return new Promise((accept, reject) => {
|
|
140
|
-
this.init().then((value) => {
|
|
141
|
-
value.start();
|
|
142
|
-
return accept();
|
|
143
|
-
}).catch(reject);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
135
|
/**
|
|
147
136
|
* Launches the internal AR instance using an appropriate version of AR Viewers
|
|
148
137
|
*/
|
package/dist/ar/raw-ar.d.ts
CHANGED
|
@@ -15,11 +15,6 @@ export declare class RawAR extends LauncherAR {
|
|
|
15
15
|
* cannot be performed.
|
|
16
16
|
*/
|
|
17
17
|
init(): Promise<LauncherAR>;
|
|
18
|
-
/**
|
|
19
|
-
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
20
|
-
* Use .init() and .start() separately for fine-grained control
|
|
21
|
-
*/
|
|
22
|
-
launch(): Promise<void>;
|
|
23
18
|
/**
|
|
24
19
|
* Launches the internal AR instance using an appropriate version of AR Viewers
|
|
25
20
|
*/
|
package/dist/ar/raw-ar.js
CHANGED
|
@@ -75,18 +75,6 @@ class RawAR extends launcher_ar_1.LauncherAR {
|
|
|
75
75
|
return reject(new Error("RawAR.init() - could not initialise AR correctly, check values"));
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
80
|
-
* Use .init() and .start() separately for fine-grained control
|
|
81
|
-
*/
|
|
82
|
-
launch() {
|
|
83
|
-
return new Promise((accept, reject) => {
|
|
84
|
-
this.init().then((value) => {
|
|
85
|
-
value.start();
|
|
86
|
-
return accept();
|
|
87
|
-
}).catch(reject);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
78
|
/**
|
|
91
79
|
* Launches the internal AR instance using an appropriate version of AR Viewers
|
|
92
80
|
*/
|
package/dist/ar/scene-ar.d.ts
CHANGED
|
@@ -3,7 +3,27 @@ import { LauncherAR } from "./launcher-ar";
|
|
|
3
3
|
* Performs AR functionality related to Plattar Scenes
|
|
4
4
|
*/
|
|
5
5
|
export declare class SceneAR extends LauncherAR {
|
|
6
|
+
private _analytics;
|
|
7
|
+
private readonly _sceneID;
|
|
8
|
+
private _ar;
|
|
9
|
+
constructor(sceneID?: string | undefined | null);
|
|
10
|
+
get sceneID(): string;
|
|
11
|
+
private _SetupAnalytics;
|
|
12
|
+
/**
|
|
13
|
+
* Composes a Scene into an AR Model (remote operation) that can be used to launch
|
|
14
|
+
* an AR File
|
|
15
|
+
*/
|
|
16
|
+
private _ComposeScene;
|
|
17
|
+
/**
|
|
18
|
+
* Initialise the SceneAR instance. This returns a Promise that resolves
|
|
19
|
+
* successfully if initialisation is successful, otherwise it will fail.
|
|
20
|
+
*
|
|
21
|
+
* filure can occur for a number of reasons but it generally means that AR
|
|
22
|
+
* cannot be performed.
|
|
23
|
+
*/
|
|
6
24
|
init(): Promise<LauncherAR>;
|
|
7
|
-
launch(): Promise<void>;
|
|
8
25
|
start(): void;
|
|
26
|
+
canQuicklook(): boolean;
|
|
27
|
+
canRealityViewer(): boolean;
|
|
28
|
+
canSceneViewer(): boolean;
|
|
9
29
|
}
|
package/dist/ar/scene-ar.js
CHANGED
|
@@ -1,19 +1,162 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.SceneAR = void 0;
|
|
7
|
+
const plattar_analytics_1 = require("@plattar/plattar-analytics");
|
|
8
|
+
const plattar_api_1 = require("@plattar/plattar-api");
|
|
9
|
+
const plattar_services_1 = require("@plattar/plattar-services");
|
|
10
|
+
const util_1 = require("../util/util");
|
|
11
|
+
const quicklook_viewer_1 = __importDefault(require("../viewers/quicklook-viewer"));
|
|
12
|
+
const reality_viewer_1 = __importDefault(require("../viewers/reality-viewer"));
|
|
13
|
+
const scene_viewer_1 = __importDefault(require("../viewers/scene-viewer"));
|
|
4
14
|
const launcher_ar_1 = require("./launcher-ar");
|
|
5
15
|
/**
|
|
6
16
|
* Performs AR functionality related to Plattar Scenes
|
|
7
17
|
*/
|
|
8
18
|
class SceneAR extends launcher_ar_1.LauncherAR {
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
constructor(sceneID = null) {
|
|
20
|
+
super();
|
|
21
|
+
// analytics instance
|
|
22
|
+
this._analytics = null;
|
|
23
|
+
if (!sceneID) {
|
|
24
|
+
throw new Error("SceneAR.constructor(sceneID) - sceneID must be defined");
|
|
25
|
+
}
|
|
26
|
+
this._sceneID = sceneID;
|
|
27
|
+
this._ar = null;
|
|
28
|
+
}
|
|
29
|
+
get sceneID() {
|
|
30
|
+
return this._sceneID;
|
|
31
|
+
}
|
|
32
|
+
_SetupAnalytics(scene) {
|
|
33
|
+
let analytics = null;
|
|
34
|
+
// setup scene stuff (if any)
|
|
35
|
+
if (scene) {
|
|
36
|
+
analytics = new plattar_analytics_1.Analytics(scene.attributes.application_id);
|
|
37
|
+
analytics.origin = plattar_api_1.Server.location().type;
|
|
38
|
+
this._analytics = analytics;
|
|
39
|
+
analytics.data.push("type", "scene-ar");
|
|
40
|
+
analytics.data.push("sceneId", scene.id);
|
|
41
|
+
analytics.data.push("sceneTitle", scene.attributes.title);
|
|
42
|
+
const application = scene.relationships.find(plattar_api_1.Project);
|
|
43
|
+
// setup application stuff (if any)
|
|
44
|
+
if (application) {
|
|
45
|
+
analytics.data.push("applicationId", application.id);
|
|
46
|
+
analytics.data.push("applicationTitle", application.attributes.title);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Composes a Scene into an AR Model (remote operation) that can be used to launch
|
|
52
|
+
* an AR File
|
|
53
|
+
*/
|
|
54
|
+
_ComposeScene(scene, output) {
|
|
55
|
+
return new Promise((accept, reject) => {
|
|
56
|
+
const sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
|
|
57
|
+
// nothing to do if no AR components can be found
|
|
58
|
+
if (sceneProducts.length <= 0) {
|
|
59
|
+
return reject(new Error("SceneAR.ComposeScene() - cannot proceed as scene does not contain AR components"));
|
|
60
|
+
}
|
|
61
|
+
// define our configurator
|
|
62
|
+
const configurator = new plattar_services_1.Configurator();
|
|
63
|
+
configurator.server = plattar_api_1.Server.location().type;
|
|
64
|
+
configurator.output = output;
|
|
65
|
+
// add out scene models
|
|
66
|
+
sceneProducts.forEach((sceneProduct) => {
|
|
67
|
+
const product = sceneProduct.relationships.find(plattar_api_1.Product);
|
|
68
|
+
if (product && product.attributes.product_variation_id) {
|
|
69
|
+
configurator.addSceneProduct(sceneProduct.id, product.attributes.product_variation_id);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return configurator.get().then((result) => {
|
|
73
|
+
accept(result.filename);
|
|
74
|
+
}).catch(reject);
|
|
75
|
+
});
|
|
11
76
|
}
|
|
12
|
-
|
|
13
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Initialise the SceneAR instance. This returns a Promise that resolves
|
|
79
|
+
* successfully if initialisation is successful, otherwise it will fail.
|
|
80
|
+
*
|
|
81
|
+
* filure can occur for a number of reasons but it generally means that AR
|
|
82
|
+
* cannot be performed.
|
|
83
|
+
*/
|
|
84
|
+
init() {
|
|
85
|
+
return new Promise((accept, reject) => {
|
|
86
|
+
if (!util_1.Util.canAugment()) {
|
|
87
|
+
return reject(new Error("SceneAR.init() - cannot proceed as AR not available in context"));
|
|
88
|
+
}
|
|
89
|
+
const scene = new plattar_api_1.Scene(this.sceneID);
|
|
90
|
+
scene.include(plattar_api_1.Project);
|
|
91
|
+
scene.include(plattar_api_1.SceneProduct);
|
|
92
|
+
scene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product));
|
|
93
|
+
scene.get().then((scene) => {
|
|
94
|
+
this._SetupAnalytics(scene);
|
|
95
|
+
const sceneOpt = scene.attributes.custom_json || {};
|
|
96
|
+
// we need to define our AR module here
|
|
97
|
+
// we are in Safari/Quicklook mode here
|
|
98
|
+
if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
|
|
99
|
+
// we need to launch a VTO experience here
|
|
100
|
+
// VTO requires Reality Support
|
|
101
|
+
if (sceneOpt.anchor === "face") {
|
|
102
|
+
if (util_1.Util.canRealityViewer()) {
|
|
103
|
+
return this._ComposeScene(scene, "vto").then((modelUrl) => {
|
|
104
|
+
this._ar = new reality_viewer_1.default();
|
|
105
|
+
this._ar.modelUrl = modelUrl;
|
|
106
|
+
return accept(this);
|
|
107
|
+
}).catch(reject);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return reject(new Error("SceneAR.init() - cannot proceed as VTO AR requires Reality Viewer support"));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// otherwise, load the USDZ stuff second if available
|
|
114
|
+
if (util_1.Util.canQuicklook()) {
|
|
115
|
+
return this._ComposeScene(scene, "usdz").then((modelUrl) => {
|
|
116
|
+
this._ar = new quicklook_viewer_1.default();
|
|
117
|
+
this._ar.modelUrl = modelUrl;
|
|
118
|
+
return accept(this);
|
|
119
|
+
}).catch(reject);
|
|
120
|
+
}
|
|
121
|
+
return reject(new Error("SceneAR.init() - cannot proceed as IOS device does not support AR Mode"));
|
|
122
|
+
}
|
|
123
|
+
// check android
|
|
124
|
+
if (util_1.Util.canSceneViewer()) {
|
|
125
|
+
return this._ComposeScene(scene, "glb").then((modelUrl) => {
|
|
126
|
+
this._ar = new scene_viewer_1.default();
|
|
127
|
+
this._ar.modelUrl = modelUrl;
|
|
128
|
+
return accept(this);
|
|
129
|
+
}).catch(reject);
|
|
130
|
+
}
|
|
131
|
+
// otherwise, we didn't have AR available - it should never really reach this stage as this should be caught
|
|
132
|
+
// earlier in the process
|
|
133
|
+
return reject(new Error("SceneAR.init() - could not initialise AR correctly, check values"));
|
|
134
|
+
}).catch(reject);
|
|
135
|
+
});
|
|
14
136
|
}
|
|
15
137
|
start() {
|
|
16
|
-
|
|
138
|
+
if (!this._ar) {
|
|
139
|
+
throw new Error("SceneAR.start() - cannot proceed as AR instance is null");
|
|
140
|
+
}
|
|
141
|
+
const analytics = this._analytics;
|
|
142
|
+
if (analytics) {
|
|
143
|
+
analytics.data.push("device", this._ar.device);
|
|
144
|
+
analytics.data.push("eventCategory", this._ar.nodeType);
|
|
145
|
+
analytics.data.push("eventAction", "Start Scene Augment");
|
|
146
|
+
analytics.write();
|
|
147
|
+
analytics.startRecordEngagement();
|
|
148
|
+
}
|
|
149
|
+
// this was initialised via the init() function
|
|
150
|
+
this._ar.start();
|
|
151
|
+
}
|
|
152
|
+
canQuicklook() {
|
|
153
|
+
return this._ar && this._ar.nodeType === "Quick Look" ? true : false;
|
|
154
|
+
}
|
|
155
|
+
canRealityViewer() {
|
|
156
|
+
return this._ar && this._ar.nodeType === "Reality Viewer" ? true : false;
|
|
157
|
+
}
|
|
158
|
+
canSceneViewer() {
|
|
159
|
+
return this._ar && this._ar.nodeType === "Scene Viewer" ? true : false;
|
|
17
160
|
}
|
|
18
161
|
}
|
|
19
162
|
exports.SceneAR = SceneAR;
|
|
@@ -11,7 +11,6 @@ export declare class ConfiguratorController extends PlattarController {
|
|
|
11
11
|
onAttributesUpdated(): void;
|
|
12
12
|
startQRCode(options: any): Promise<HTMLElement>;
|
|
13
13
|
startRenderer(): Promise<HTMLElement>;
|
|
14
|
-
startAR(): Promise<void>;
|
|
15
14
|
initAR(): Promise<LauncherAR>;
|
|
16
15
|
removeRenderer(): boolean;
|
|
17
16
|
get element(): HTMLElement | null;
|
|
@@ -104,14 +104,6 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
|
104
104
|
return reject(new Error("ConfiguratorController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
startAR() {
|
|
108
|
-
return new Promise((accept, reject) => {
|
|
109
|
-
this.initAR().then((launcher) => {
|
|
110
|
-
launcher.start();
|
|
111
|
-
accept();
|
|
112
|
-
}).catch(reject);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
107
|
initAR() {
|
|
116
108
|
return new Promise((accept, reject) => {
|
|
117
109
|
if (!util_1.Util.canAugment()) {
|
|
@@ -25,6 +25,17 @@ class PlattarController {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
;
|
|
28
|
+
/**
|
|
29
|
+
* Initialise and start AR mode if available
|
|
30
|
+
*/
|
|
31
|
+
startAR() {
|
|
32
|
+
return new Promise((accept, reject) => {
|
|
33
|
+
this.initAR().then((launcher) => {
|
|
34
|
+
launcher.start();
|
|
35
|
+
accept();
|
|
36
|
+
}).catch(reject);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
28
39
|
/**
|
|
29
40
|
* Returns the Parent Instance
|
|
30
41
|
*/
|
|
@@ -11,7 +11,6 @@ export declare class ProductController extends PlattarController {
|
|
|
11
11
|
onAttributesUpdated(): void;
|
|
12
12
|
startQRCode(options: any): Promise<HTMLElement>;
|
|
13
13
|
startRenderer(): Promise<HTMLElement>;
|
|
14
|
-
startAR(): Promise<void>;
|
|
15
14
|
initAR(): Promise<LauncherAR>;
|
|
16
15
|
removeRenderer(): boolean;
|
|
17
16
|
get element(): HTMLElement | null;
|
|
@@ -27,7 +27,9 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
27
27
|
const viewer = this._element;
|
|
28
28
|
if (viewer) {
|
|
29
29
|
const variationID = this.getAttribute("variation-id");
|
|
30
|
-
viewer.messenger
|
|
30
|
+
if (variationID && viewer.messenger) {
|
|
31
|
+
viewer.messenger.selectVariation(variationID);
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
34
|
return;
|
|
33
35
|
}
|
|
@@ -104,14 +106,6 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
104
106
|
return reject(new Error("ProductController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
|
-
startAR() {
|
|
108
|
-
return new Promise((accept, reject) => {
|
|
109
|
-
this.initAR().then((launcher) => {
|
|
110
|
-
launcher.start();
|
|
111
|
-
accept();
|
|
112
|
-
}).catch(reject);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
109
|
initAR() {
|
|
116
110
|
return new Promise((accept, reject) => {
|
|
117
111
|
if (!util_1.Util.canAugment()) {
|
|
@@ -11,7 +11,6 @@ export declare class ViewerController extends PlattarController {
|
|
|
11
11
|
onAttributesUpdated(): void;
|
|
12
12
|
startQRCode(options: any): Promise<HTMLElement>;
|
|
13
13
|
startRenderer(): Promise<HTMLElement>;
|
|
14
|
-
startAR(): Promise<void>;
|
|
15
14
|
initAR(): Promise<LauncherAR>;
|
|
16
15
|
removeRenderer(): boolean;
|
|
17
16
|
get element(): HTMLElement | null;
|
|
@@ -28,7 +28,9 @@ class ViewerController extends plattar_controller_1.PlattarController {
|
|
|
28
28
|
if (viewer) {
|
|
29
29
|
const productID = this.getAttribute("product-id");
|
|
30
30
|
const variationID = this.getAttribute("variation-id");
|
|
31
|
-
|
|
31
|
+
if (productID && variationID && viewer.messenger) {
|
|
32
|
+
viewer.messenger.selectVariation(productID, variationID);
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
@@ -113,14 +115,6 @@ class ViewerController extends plattar_controller_1.PlattarController {
|
|
|
113
115
|
return reject(new Error("ViewerController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
|
-
startAR() {
|
|
117
|
-
return new Promise((accept, reject) => {
|
|
118
|
-
this.initAR().then((launcher) => {
|
|
119
|
-
launcher.start();
|
|
120
|
-
accept();
|
|
121
|
-
}).catch(reject);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
118
|
initAR() {
|
|
125
119
|
return new Promise((accept, reject) => {
|
|
126
120
|
if (!util_1.Util.canAugment()) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LauncherAR } from "../../ar/launcher-ar";
|
|
2
|
+
import { PlattarController } from "./plattar-controller";
|
|
3
|
+
/**
|
|
4
|
+
* Manages an instance of the <plattar-configurator> HTML Element
|
|
5
|
+
*/
|
|
6
|
+
export declare class VTOController extends PlattarController {
|
|
7
|
+
private _state;
|
|
8
|
+
private _element;
|
|
9
|
+
private _prevQROpt;
|
|
10
|
+
constructor(parent: HTMLElement);
|
|
11
|
+
onAttributesUpdated(): void;
|
|
12
|
+
startQRCode(options: any): Promise<HTMLElement>;
|
|
13
|
+
startRenderer(): Promise<HTMLElement>;
|
|
14
|
+
initAR(): Promise<LauncherAR>;
|
|
15
|
+
removeRenderer(): boolean;
|
|
16
|
+
get element(): HTMLElement | null;
|
|
17
|
+
}
|