@plattar/plattar-ar-adapter 2.5.1 → 2.7.1
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 +589 -359
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +336 -159
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/ar/configurator-ar.js +8 -3
- package/dist/ar/launcher-ar.js +1 -0
- package/dist/ar/model-ar.js +7 -2
- package/dist/ar/product-ar.js +6 -16
- package/dist/ar/raw-ar.js +7 -2
- package/dist/ar/scene-ar.js +7 -2
- package/dist/ar/scene-graph-ar.js +8 -3
- package/dist/ar/scene-product-ar.js +3 -3
- package/dist/embed/controllers/configurator-controller.js +21 -7
- package/dist/embed/controllers/gallery-controller.js +11 -5
- package/dist/embed/controllers/launcher-controller.js +1 -4
- package/dist/embed/controllers/plattar-controller.js +17 -7
- package/dist/embed/controllers/product-controller.js +20 -2
- package/dist/embed/controllers/vto-controller.js +11 -5
- package/dist/embed/controllers/webxr-controller.js +3 -4
- package/dist/embed/plattar-embed.js +7 -7
- package/dist/util/configurator-state.js +6 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/viewers/ar-viewer.js +2 -0
- package/dist/viewers/quicklook-viewer.js +1 -0
- package/dist/viewers/reality-viewer.js +1 -0
- package/dist/viewers/scene-viewer.js +3 -1
- package/package.json +9 -9
|
@@ -15,10 +15,14 @@ const version_1 = __importDefault(require("../version"));
|
|
|
15
15
|
* Performs AR functionality related to Plattar Scenes
|
|
16
16
|
*/
|
|
17
17
|
class ConfiguratorAR extends launcher_ar_1.LauncherAR {
|
|
18
|
+
// analytics instance
|
|
19
|
+
_analytics = null;
|
|
20
|
+
_options;
|
|
21
|
+
// this thing controls the actual AR view
|
|
22
|
+
// this is setup via .init() function
|
|
23
|
+
_ar;
|
|
18
24
|
constructor(options) {
|
|
19
25
|
super();
|
|
20
|
-
// analytics instance
|
|
21
|
-
this._analytics = null;
|
|
22
26
|
if (!options.state) {
|
|
23
27
|
throw new Error("ConfiguratorAR.constructor(state) - state must be defined");
|
|
24
28
|
}
|
|
@@ -58,7 +62,8 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
|
|
|
58
62
|
*/
|
|
59
63
|
async _Compose(output) {
|
|
60
64
|
const type = output === 'glb' ? "viewer" : "reality";
|
|
61
|
-
const
|
|
65
|
+
const serverLocation = plattar_api_1.Server.location().type === 'staging' ? 'https://xrutils.plattar.space/v3/scene' : 'https://xrutils.plattar.com/v3/scene';
|
|
66
|
+
const url = `${serverLocation}/${this._options.state.scene.id}/${type}`;
|
|
62
67
|
// grab our existing scene-graph from the saved API
|
|
63
68
|
try {
|
|
64
69
|
const response = await fetch(url, {
|
package/dist/ar/launcher-ar.js
CHANGED
package/dist/ar/model-ar.js
CHANGED
|
@@ -16,10 +16,15 @@ const version_1 = __importDefault(require("../version"));
|
|
|
16
16
|
* Performs AT Functionality using Plattar FileModel types
|
|
17
17
|
*/
|
|
18
18
|
class ModelAR extends launcher_ar_1.LauncherAR {
|
|
19
|
+
// analytics instance
|
|
20
|
+
_analytics = null;
|
|
21
|
+
// model ID
|
|
22
|
+
_options;
|
|
23
|
+
// this thing controls the actual AR view
|
|
24
|
+
// this is setup via .init() function
|
|
25
|
+
_ar;
|
|
19
26
|
constructor(options) {
|
|
20
27
|
super();
|
|
21
|
-
// analytics instance
|
|
22
|
-
this._analytics = null;
|
|
23
28
|
if (!options.modelID) {
|
|
24
29
|
throw new Error("ModelAR.constructor(modelID) - modelID must be defined");
|
|
25
30
|
}
|
package/dist/ar/product-ar.js
CHANGED
|
@@ -16,24 +16,14 @@ const version_1 = __importDefault(require("../version"));
|
|
|
16
16
|
* Performs AR functionality related to Plattar Products and Variation types
|
|
17
17
|
*/
|
|
18
18
|
class ProductAR extends launcher_ar_1.LauncherAR {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this._productID = productID;
|
|
28
|
-
this._variationSKU = variationSKU;
|
|
29
|
-
this._variationID = variationID ? variationID : (variationSKU ? null : "default");
|
|
30
|
-
this._ar = null;
|
|
31
|
-
}
|
|
32
|
-
*/
|
|
19
|
+
// analytics instance
|
|
20
|
+
_analytics = null;
|
|
21
|
+
_options;
|
|
22
|
+
// this thing controls the actual AR view
|
|
23
|
+
// this is setup via .init() function
|
|
24
|
+
_ar;
|
|
33
25
|
constructor(options) {
|
|
34
26
|
super();
|
|
35
|
-
// analytics instance
|
|
36
|
-
this._analytics = null;
|
|
37
27
|
if (!options.productID) {
|
|
38
28
|
throw new Error("ProductAR.constructor(productID, variationID) - productID must be defined");
|
|
39
29
|
}
|
package/dist/ar/raw-ar.js
CHANGED
|
@@ -16,10 +16,15 @@ const version_1 = __importDefault(require("../version"));
|
|
|
16
16
|
* Allows launching AR Experiences provided a single remote 3D Model file
|
|
17
17
|
*/
|
|
18
18
|
class RawAR extends launcher_ar_1.LauncherAR {
|
|
19
|
+
// model location
|
|
20
|
+
_options;
|
|
21
|
+
// this thing controls the actual AR view
|
|
22
|
+
// this is setup via .init() function
|
|
23
|
+
_ar;
|
|
24
|
+
// analytics instance
|
|
25
|
+
_analytics = null;
|
|
19
26
|
constructor(options) {
|
|
20
27
|
super();
|
|
21
|
-
// analytics instance
|
|
22
|
-
this._analytics = null;
|
|
23
28
|
if (!options.modelLocation) {
|
|
24
29
|
throw new Error("RawAR.constructor(modelLocation) - modelLocation must be defined");
|
|
25
30
|
}
|
package/dist/ar/scene-ar.js
CHANGED
|
@@ -16,10 +16,15 @@ const version_1 = __importDefault(require("../version"));
|
|
|
16
16
|
* Performs AR functionality related to Plattar Scenes
|
|
17
17
|
*/
|
|
18
18
|
class SceneAR extends launcher_ar_1.LauncherAR {
|
|
19
|
+
// analytics instance
|
|
20
|
+
_analytics = null;
|
|
21
|
+
// scene and selected variation IDs
|
|
22
|
+
_options;
|
|
23
|
+
// this thing controls the actual AR view
|
|
24
|
+
// this is setup via .init() function
|
|
25
|
+
_ar;
|
|
19
26
|
constructor(options) {
|
|
20
27
|
super();
|
|
21
|
-
// analytics instance
|
|
22
|
-
this._analytics = null;
|
|
23
28
|
if (!options.sceneID) {
|
|
24
29
|
throw new Error("SceneAR.constructor(sceneID) - sceneID must be defined");
|
|
25
30
|
}
|
|
@@ -15,10 +15,14 @@ const version_1 = __importDefault(require("../version"));
|
|
|
15
15
|
* Performs AR functionality related to Plattar Scenes
|
|
16
16
|
*/
|
|
17
17
|
class SceneGraphAR extends launcher_ar_1.LauncherAR {
|
|
18
|
+
// analytics instance
|
|
19
|
+
_analytics = null;
|
|
20
|
+
_options;
|
|
21
|
+
// this thing controls the actual AR view
|
|
22
|
+
// this is setup via .init() function
|
|
23
|
+
_ar;
|
|
18
24
|
constructor(options) {
|
|
19
25
|
super();
|
|
20
|
-
// analytics instance
|
|
21
|
-
this._analytics = null;
|
|
22
26
|
this._options = options;
|
|
23
27
|
this._ar = null;
|
|
24
28
|
}
|
|
@@ -55,7 +59,8 @@ class SceneGraphAR extends launcher_ar_1.LauncherAR {
|
|
|
55
59
|
*/
|
|
56
60
|
async _Compose(output) {
|
|
57
61
|
const type = output === 'glb' ? "viewer" : "reality";
|
|
58
|
-
const
|
|
62
|
+
const serverLocation = plattar_api_1.Server.location().type === 'staging' ? 'https://xrutils.plattar.space/v3/scene' : 'https://xrutils.plattar.com/v3/scene';
|
|
63
|
+
const url = `${serverLocation}/${this._options.sceneID}/${type}/${this._options.id}`;
|
|
59
64
|
// grab our existing scene-graph from the saved API
|
|
60
65
|
try {
|
|
61
66
|
const response = await fetch(url, {
|
|
@@ -9,11 +9,11 @@ const util_1 = require("../util/util");
|
|
|
9
9
|
* SceneProducts are much more convenient to grab from the Plattar CMS
|
|
10
10
|
*/
|
|
11
11
|
class SceneProductAR extends product_ar_1.ProductAR {
|
|
12
|
+
_sceneProductID;
|
|
13
|
+
// this is evaluated in the init() function
|
|
14
|
+
_attachedProductID = null;
|
|
12
15
|
constructor(options) {
|
|
13
|
-
//super(sceneProductID, variationID, variationSKU);
|
|
14
16
|
super(options);
|
|
15
|
-
// this is evaluated in the init() function
|
|
16
|
-
this._attachedProductID = null;
|
|
17
17
|
if (!options.productID) {
|
|
18
18
|
throw new Error("SceneProductAR.constructor(sceneProductID, variationID) - sceneProductID must be defined");
|
|
19
19
|
}
|
|
@@ -11,10 +11,7 @@ const scene_graph_ar_1 = require("../../ar/scene-graph-ar");
|
|
|
11
11
|
* Manages an instance of the <plattar-configurator> HTML Element
|
|
12
12
|
*/
|
|
13
13
|
class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
14
|
-
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this._cachedConfigState = null;
|
|
17
|
-
}
|
|
14
|
+
_cachedConfigState = null;
|
|
18
15
|
async getConfiguratorState() {
|
|
19
16
|
if (this._cachedConfigState) {
|
|
20
17
|
return this._cachedConfigState;
|
|
@@ -133,6 +130,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
|
133
130
|
const height = this.getAttribute("height") || "500px";
|
|
134
131
|
viewer.setAttribute("width", width);
|
|
135
132
|
viewer.setAttribute("height", height);
|
|
133
|
+
viewer.setAttribute("server", plattar_api_1.Server.location().type);
|
|
136
134
|
if (opt.color) {
|
|
137
135
|
viewer.setAttribute("color", opt.color);
|
|
138
136
|
}
|
|
@@ -143,13 +141,29 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
|
143
141
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
144
142
|
}
|
|
145
143
|
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
146
|
-
let dst =
|
|
144
|
+
let dst = `https://renderer.plattar.com/configurator.html?scene_id=${sceneID}`;
|
|
145
|
+
switch (plattar_api_1.Server.location().type) {
|
|
146
|
+
case 'review':
|
|
147
|
+
dst = `https://renderer-review.plattar.com/configurator.html?scene_id=${sceneID}`;
|
|
148
|
+
break;
|
|
149
|
+
case 'staging':
|
|
150
|
+
dst = `https://renderer.plattar.space/configurator.html?scene_id=${sceneID}`;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
147
153
|
const showAR = this.getAttribute("show-ar");
|
|
148
154
|
const showUI = this.getAttribute("show-ui");
|
|
149
155
|
const showBanner = this.getAttribute("show-ar-banner");
|
|
150
156
|
const sceneGraphID = this.getAttribute("scene-graph-id");
|
|
151
157
|
if (showUI && showUI === "true") {
|
|
152
|
-
dst =
|
|
158
|
+
dst = `https://configurator.plattar.com/index.html?scene_id=${sceneID}`;
|
|
159
|
+
switch (plattar_api_1.Server.location().type) {
|
|
160
|
+
case 'review':
|
|
161
|
+
dst = `https://configurator-review.plattar.com/configurator.html?scene_id=${sceneID}`;
|
|
162
|
+
break;
|
|
163
|
+
case 'staging':
|
|
164
|
+
dst = `https://configurator.plattar.space/configurator.html?scene_id=${sceneID}`;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
153
167
|
}
|
|
154
168
|
if (configState) {
|
|
155
169
|
dst += "&config_state=" + configState;
|
|
@@ -214,7 +228,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
|
|
|
214
228
|
// required attributes with defaults for plattar-configurator node
|
|
215
229
|
const width = this.getAttribute("width") || "500px";
|
|
216
230
|
const height = this.getAttribute("height") || "500px";
|
|
217
|
-
const server =
|
|
231
|
+
const server = plattar_api_1.Server.location().type;
|
|
218
232
|
const viewer = document.createElement("plattar-configurator");
|
|
219
233
|
this._element = viewer;
|
|
220
234
|
viewer.setAttribute("width", width);
|
|
@@ -7,10 +7,7 @@ const plattar_controller_1 = require("./plattar-controller");
|
|
|
7
7
|
* Manages an instance of the <plattar-configurator> HTML Element
|
|
8
8
|
*/
|
|
9
9
|
class GalleryController extends plattar_controller_1.PlattarController {
|
|
10
|
-
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this._cachedConfigState = null;
|
|
13
|
-
}
|
|
10
|
+
_cachedConfigState = null;
|
|
14
11
|
async getConfiguratorState() {
|
|
15
12
|
if (this._cachedConfigState) {
|
|
16
13
|
return this._cachedConfigState;
|
|
@@ -61,6 +58,7 @@ class GalleryController extends plattar_controller_1.PlattarController {
|
|
|
61
58
|
const height = this.getAttribute("height") || "500px";
|
|
62
59
|
viewer.setAttribute("width", width);
|
|
63
60
|
viewer.setAttribute("height", height);
|
|
61
|
+
viewer.setAttribute("server", plattar_api_1.Server.location().type);
|
|
64
62
|
if (opt.color) {
|
|
65
63
|
viewer.setAttribute("color", opt.color);
|
|
66
64
|
}
|
|
@@ -71,7 +69,15 @@ class GalleryController extends plattar_controller_1.PlattarController {
|
|
|
71
69
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
72
70
|
}
|
|
73
71
|
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
74
|
-
|
|
72
|
+
let dst = `https://renderer.plattar.com/gallery.html?scene_id=${sceneID}`;
|
|
73
|
+
switch (plattar_api_1.Server.location().type) {
|
|
74
|
+
case 'review':
|
|
75
|
+
dst = `https://renderer-review.plattar.com/gallery.html?scene_id=${sceneID}`;
|
|
76
|
+
break;
|
|
77
|
+
case 'staging':
|
|
78
|
+
dst = `https://renderer.plattar.space/gallery.html?scene_id=${sceneID}`;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
75
81
|
viewer.setAttribute("url", opt.url || dst);
|
|
76
82
|
this._prevQROpt = opt;
|
|
77
83
|
if (!opt.detached) {
|
|
@@ -10,10 +10,7 @@ const scene_graph_ar_1 = require("../../ar/scene-graph-ar");
|
|
|
10
10
|
* Manages an instance of the <plattar-configurator> HTML Element
|
|
11
11
|
*/
|
|
12
12
|
class LauncherController extends plattar_controller_1.PlattarController {
|
|
13
|
-
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this._cachedConfigState = null;
|
|
16
|
-
}
|
|
13
|
+
_cachedConfigState = null;
|
|
17
14
|
async getConfiguratorState() {
|
|
18
15
|
if (this._cachedConfigState) {
|
|
19
16
|
return this._cachedConfigState;
|
|
@@ -28,13 +28,14 @@ class PlattarController {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
;
|
|
31
|
+
_parent;
|
|
32
|
+
_state = ControllerState.None;
|
|
33
|
+
_element = null;
|
|
34
|
+
_prevQROpt = null;
|
|
35
|
+
_selectVariationObserver = null;
|
|
36
|
+
_selectVariationIDObserver = null;
|
|
37
|
+
_selectVariationSKUObserver = null;
|
|
31
38
|
constructor(parent) {
|
|
32
|
-
this._state = ControllerState.None;
|
|
33
|
-
this._element = null;
|
|
34
|
-
this._prevQROpt = null;
|
|
35
|
-
this._selectVariationObserver = null;
|
|
36
|
-
this._selectVariationIDObserver = null;
|
|
37
|
-
this._selectVariationSKUObserver = null;
|
|
38
39
|
this._parent = parent;
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
@@ -155,6 +156,7 @@ class PlattarController {
|
|
|
155
156
|
const height = this.getAttribute("height") || "500px";
|
|
156
157
|
viewer.setAttribute("width", width);
|
|
157
158
|
viewer.setAttribute("height", height);
|
|
159
|
+
viewer.setAttribute("server", plattar_api_1.Server.location().type);
|
|
158
160
|
if (opt.color) {
|
|
159
161
|
viewer.setAttribute("color", opt.color);
|
|
160
162
|
}
|
|
@@ -166,7 +168,15 @@ class PlattarController {
|
|
|
166
168
|
}
|
|
167
169
|
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
168
170
|
const qrOptions = btoa(JSON.stringify(opt));
|
|
169
|
-
let dst =
|
|
171
|
+
let dst = `https://renderer.plattar.com/launcher.html?qr_options=${qrOptions}`;
|
|
172
|
+
switch (plattar_api_1.Server.location().type) {
|
|
173
|
+
case 'review':
|
|
174
|
+
dst = `https://renderer-review.plattar.com/launcher.html?qr_options=${qrOptions}`;
|
|
175
|
+
break;
|
|
176
|
+
case 'staging':
|
|
177
|
+
dst = `https://renderer.plattar.space/launcher.html?qr_options=${qrOptions}`;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
170
180
|
//let configState: string | null = null;
|
|
171
181
|
const sceneID = this.getAttribute("scene-id");
|
|
172
182
|
const embedType = this.getAttribute("embed-type");
|
|
@@ -46,6 +46,7 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
46
46
|
const height = this.getAttribute("height") || "500px";
|
|
47
47
|
viewer.setAttribute("width", width);
|
|
48
48
|
viewer.setAttribute("height", height);
|
|
49
|
+
viewer.setAttribute("server", plattar_api_1.Server.location().type);
|
|
49
50
|
if (opt.color) {
|
|
50
51
|
viewer.setAttribute("color", opt.color);
|
|
51
52
|
}
|
|
@@ -60,7 +61,15 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
60
61
|
const variationID = this.getAttribute("variation-id");
|
|
61
62
|
const variationSKU = this.getAttribute("variation-sku");
|
|
62
63
|
const showAR = this.getAttribute("show-ar");
|
|
63
|
-
let dst =
|
|
64
|
+
let dst = `https://renderer.plattar.com/product.html?product_id=${productID}`;
|
|
65
|
+
switch (plattar_api_1.Server.location().type) {
|
|
66
|
+
case 'review':
|
|
67
|
+
dst = `https://renderer-review.plattar.com/product.html?product_id=${productID}`;
|
|
68
|
+
break;
|
|
69
|
+
case 'staging':
|
|
70
|
+
dst = `https://renderer.plattar.space/product.html?product_id=${productID}`;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
64
73
|
if (variationID) {
|
|
65
74
|
dst += "&variationId=" + variationID;
|
|
66
75
|
}
|
|
@@ -100,6 +109,7 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
100
109
|
const height = this.getAttribute("height") || "500px";
|
|
101
110
|
viewer.setAttribute("width", width);
|
|
102
111
|
viewer.setAttribute("height", height);
|
|
112
|
+
viewer.setAttribute("server", plattar_api_1.Server.location().type);
|
|
103
113
|
if (opt.color) {
|
|
104
114
|
viewer.setAttribute("color", opt.color);
|
|
105
115
|
}
|
|
@@ -111,7 +121,15 @@ class ProductController extends plattar_controller_1.PlattarController {
|
|
|
111
121
|
}
|
|
112
122
|
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
113
123
|
const qrOptions = btoa(JSON.stringify(opt));
|
|
114
|
-
let dst =
|
|
124
|
+
let dst = `https://renderer.plattar.com/launcher.html?qr_options=${qrOptions}`;
|
|
125
|
+
switch (plattar_api_1.Server.location().type) {
|
|
126
|
+
case 'review':
|
|
127
|
+
dst = `https://renderer-review.plattar.com/launcher.html?qr_options=${qrOptions}`;
|
|
128
|
+
break;
|
|
129
|
+
case 'staging':
|
|
130
|
+
dst = `https://renderer.plattar.space/launcher.html?qr_options=${qrOptions}`;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
115
133
|
const sceneID = this.getAttribute("scene-id");
|
|
116
134
|
const configState = this.getAttribute("config-state");
|
|
117
135
|
const embedType = this.getAttribute("embed-type");
|
|
@@ -10,10 +10,7 @@ const configurator_ar_1 = require("../../ar/configurator-ar");
|
|
|
10
10
|
* Manages an instance of the <plattar-configurator> HTML Element
|
|
11
11
|
*/
|
|
12
12
|
class VTOController extends plattar_controller_1.PlattarController {
|
|
13
|
-
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this._cachedConfigState = null;
|
|
16
|
-
}
|
|
13
|
+
_cachedConfigState = null;
|
|
17
14
|
async getConfiguratorState() {
|
|
18
15
|
if (this._cachedConfigState) {
|
|
19
16
|
return this._cachedConfigState;
|
|
@@ -84,6 +81,7 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
84
81
|
const height = this.getAttribute("height") || "500px";
|
|
85
82
|
viewer.setAttribute("width", width);
|
|
86
83
|
viewer.setAttribute("height", height);
|
|
84
|
+
viewer.setAttribute("server", plattar_api_1.Server.location().type);
|
|
87
85
|
if (opt.color) {
|
|
88
86
|
viewer.setAttribute("color", opt.color);
|
|
89
87
|
}
|
|
@@ -94,7 +92,15 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
94
92
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
95
93
|
}
|
|
96
94
|
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
97
|
-
let dst =
|
|
95
|
+
let dst = `https://renderer.plattar.com/facear.html?scene_id=${sceneID}`;
|
|
96
|
+
switch (plattar_api_1.Server.location().type) {
|
|
97
|
+
case 'review':
|
|
98
|
+
dst = `https://renderer-review.plattar.com/facear.html?scene_id=${sceneID}`;
|
|
99
|
+
break;
|
|
100
|
+
case 'staging':
|
|
101
|
+
dst = `https://renderer.plattar.space/facear.html?scene_id=${sceneID}`;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
98
104
|
// optional attributes
|
|
99
105
|
let configState = null;
|
|
100
106
|
try {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebXRController = void 0;
|
|
4
|
+
const plattar_api_1 = require("@plattar/plattar-api");
|
|
4
5
|
const util_1 = require("../../util/util");
|
|
5
6
|
const plattar_controller_1 = require("./plattar-controller");
|
|
6
7
|
/**
|
|
7
8
|
* Manages an instance of the <plattar-ewall> HTML Element
|
|
8
9
|
*/
|
|
9
10
|
class WebXRController extends plattar_controller_1.PlattarController {
|
|
10
|
-
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this._cachedConfigState = null;
|
|
13
|
-
}
|
|
11
|
+
_cachedConfigState = null;
|
|
14
12
|
async getConfiguratorState() {
|
|
15
13
|
if (this._cachedConfigState) {
|
|
16
14
|
return this._cachedConfigState;
|
|
@@ -83,6 +81,7 @@ class WebXRController extends plattar_controller_1.PlattarController {
|
|
|
83
81
|
const height = this.getAttribute("height") || "500px";
|
|
84
82
|
viewer.setAttribute("width", width);
|
|
85
83
|
viewer.setAttribute("height", height);
|
|
84
|
+
viewer.setAttribute("server", plattar_api_1.Server.location().type);
|
|
86
85
|
if (opt.color) {
|
|
87
86
|
viewer.setAttribute("color", opt.color);
|
|
88
87
|
}
|
|
@@ -34,15 +34,15 @@ var ObserverState;
|
|
|
34
34
|
* of Plattar related content
|
|
35
35
|
*/
|
|
36
36
|
class PlattarEmbed extends HTMLElement {
|
|
37
|
+
// this is the current embed type, viewer by default
|
|
38
|
+
_currentType = EmbedType.None;
|
|
39
|
+
_observerState = ObserverState.Unlocked;
|
|
40
|
+
_controller = null;
|
|
41
|
+
_currentSceneID = null;
|
|
42
|
+
_currentServer = null;
|
|
43
|
+
_observer = null;
|
|
37
44
|
constructor() {
|
|
38
45
|
super();
|
|
39
|
-
// this is the current embed type, viewer by default
|
|
40
|
-
this._currentType = EmbedType.None;
|
|
41
|
-
this._observerState = ObserverState.Unlocked;
|
|
42
|
-
this._controller = null;
|
|
43
|
-
this._currentSceneID = null;
|
|
44
|
-
this._currentServer = null;
|
|
45
|
-
this._observer = null;
|
|
46
46
|
}
|
|
47
47
|
get viewer() {
|
|
48
48
|
return this._controller ? this._controller.element : null;
|
|
@@ -7,6 +7,11 @@ const plattar_api_1 = require("@plattar/plattar-api");
|
|
|
7
7
|
* Allows easily changing
|
|
8
8
|
*/
|
|
9
9
|
class ConfiguratorState {
|
|
10
|
+
_state;
|
|
11
|
+
// This maps Variation ID against a Scene Product ID - populated by decodeScene() function
|
|
12
|
+
_mappedVariationIDValues;
|
|
13
|
+
// This maps Variation SKU against a Variation ID - populated by decodeScene() function
|
|
14
|
+
_mappedVariationSKUValues;
|
|
10
15
|
constructor(state = null) {
|
|
11
16
|
this._mappedVariationIDValues = new Map();
|
|
12
17
|
this._mappedVariationSKUValues = new Map();
|
|
@@ -445,7 +450,7 @@ class ConfiguratorState {
|
|
|
445
450
|
// some scene-graphs are very large in size, we store it remotely
|
|
446
451
|
// this storage will expire in 10 minutes so this is a non-permanent version
|
|
447
452
|
// and is designed for quick ar
|
|
448
|
-
const url =
|
|
453
|
+
const url = plattar_api_1.Server.location().type === 'staging' ? 'https://c.plattar.space/v3/redir/store' : 'https://c.plattar.com/v3/redir/store';
|
|
449
454
|
// finally send our scene-graph to the backend to generate the AR file and return
|
|
450
455
|
try {
|
|
451
456
|
const response = await fetch(url, {
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.
|
|
1
|
+
declare const _default: "2.7.1";
|
|
2
2
|
export default _default;
|
package/dist/version.js
CHANGED
|
@@ -17,6 +17,7 @@ class QuicklookViewer extends ar_viewer_1.ARViewer {
|
|
|
17
17
|
}
|
|
18
18
|
const anchor = document.createElement("a");
|
|
19
19
|
anchor.setAttribute("rel", "ar");
|
|
20
|
+
anchor.setAttribute("allowsContentScaling", "0");
|
|
20
21
|
anchor.appendChild(document.createElement("img"));
|
|
21
22
|
const banner = this.banner;
|
|
22
23
|
let url = this.modelUrl;
|
|
@@ -17,6 +17,7 @@ class RealityViewer extends ar_viewer_1.ARViewer {
|
|
|
17
17
|
}
|
|
18
18
|
const anchor = document.createElement("a");
|
|
19
19
|
anchor.setAttribute("rel", "ar");
|
|
20
|
+
anchor.setAttribute("allowsContentScaling", "0");
|
|
20
21
|
anchor.appendChild(document.createElement("img"));
|
|
21
22
|
anchor.setAttribute("href", this.modelUrl);
|
|
22
23
|
anchor.click();
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ar_viewer_1 = require("./ar-viewer");
|
|
4
4
|
class SceneViewer extends ar_viewer_1.ARViewer {
|
|
5
|
+
isVertical = false;
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
7
8
|
this.isVertical = false;
|
|
8
|
-
this.isVertical = false;
|
|
9
9
|
}
|
|
10
10
|
get nodeType() {
|
|
11
11
|
return "Scene Viewer";
|
|
@@ -27,6 +27,8 @@ class SceneViewer extends ar_viewer_1.ARViewer {
|
|
|
27
27
|
if (this.isVertical) {
|
|
28
28
|
intent += '&enable_vertical_placement=true';
|
|
29
29
|
}
|
|
30
|
+
// avoid allowing content to be resized
|
|
31
|
+
intent += '&resizable=false';
|
|
30
32
|
intent += '&a=b#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;';
|
|
31
33
|
intent += `S.browser_fallback_url=${linkOverride};end;`;
|
|
32
34
|
const anchor = document.createElement("a");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plattar/plattar-ar-adapter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
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,18 +37,18 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://www.plattar.com",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@plattar/plattar-analytics": "^
|
|
41
|
-
"@plattar/plattar-api": "^
|
|
42
|
-
"@plattar/plattar-qrcode": "
|
|
43
|
-
"@plattar/plattar-services": "^
|
|
44
|
-
"@plattar/plattar-web": "^2.
|
|
40
|
+
"@plattar/plattar-analytics": "^2.7.1",
|
|
41
|
+
"@plattar/plattar-api": "^2.7.1",
|
|
42
|
+
"@plattar/plattar-qrcode": "2.7.1",
|
|
43
|
+
"@plattar/plattar-services": "^2.7.2",
|
|
44
|
+
"@plattar/plattar-web": "^2.7.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/cli": "^7.28.6",
|
|
48
|
-
"@babel/core": "^7.
|
|
49
|
-
"@babel/preset-env": "^7.
|
|
48
|
+
"@babel/core": "^7.29.0",
|
|
49
|
+
"@babel/preset-env": "^7.29.5",
|
|
50
50
|
"browserify": "^17.0.1",
|
|
51
|
-
"typescript": "^
|
|
51
|
+
"typescript": "^6.0.3",
|
|
52
52
|
"uglify-js": "^3.19.3"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|