@plattar/plattar-ar-adapter 1.122.1 → 1.123.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 +8328 -5558
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +1280 -289
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/ar/raw-ar.d.ts +30 -0
- package/dist/ar/raw-ar.js +110 -0
- package/dist/embed/controllers/configurator-controller.d.ts +18 -0
- package/dist/embed/controllers/configurator-controller.js +186 -0
- package/dist/embed/controllers/plattar-controller.d.ts +62 -0
- package/dist/embed/controllers/plattar-controller.js +51 -0
- package/dist/embed/controllers/product-controller.d.ts +18 -0
- package/dist/embed/controllers/product-controller.js +141 -0
- package/dist/embed/controllers/viewer-controller.d.ts +18 -0
- package/dist/embed/controllers/viewer-controller.js +155 -0
- package/dist/embed/plattar-embed.d.ts +7 -8
- package/dist/embed/plattar-embed.js +72 -156
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -7
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewerController = void 0;
|
|
4
|
+
const plattar_api_1 = require("@plattar/plattar-api");
|
|
5
|
+
const product_ar_1 = require("../../ar/product-ar");
|
|
6
|
+
const util_1 = require("../../util/util");
|
|
7
|
+
const plattar_controller_1 = require("./plattar-controller");
|
|
8
|
+
/**
|
|
9
|
+
* Manages an instance of the <plattar-viewer> HTML Element
|
|
10
|
+
*/
|
|
11
|
+
class ViewerController extends plattar_controller_1.PlattarController {
|
|
12
|
+
constructor(parent) {
|
|
13
|
+
super(parent);
|
|
14
|
+
this._state = plattar_controller_1.ControllerState.None;
|
|
15
|
+
this._element = null;
|
|
16
|
+
this._prevQROpt = null;
|
|
17
|
+
}
|
|
18
|
+
onAttributesUpdated() {
|
|
19
|
+
const state = this._state;
|
|
20
|
+
// re-render the QR Code when attributes have changed
|
|
21
|
+
if (state === plattar_controller_1.ControllerState.QRCode) {
|
|
22
|
+
this.startQRCode(this._prevQROpt);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// use the messenger function to change variation when attributes have changed
|
|
26
|
+
if (state === plattar_controller_1.ControllerState.Renderer) {
|
|
27
|
+
const viewer = this._element;
|
|
28
|
+
if (viewer) {
|
|
29
|
+
const productID = this.getAttribute("product-id");
|
|
30
|
+
const variationID = this.getAttribute("variation-id");
|
|
31
|
+
viewer.messenger.selectVariation(productID, variationID);
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
startQRCode(options) {
|
|
37
|
+
return new Promise((accept, reject) => {
|
|
38
|
+
// remove the old renderer instance if any
|
|
39
|
+
this.removeRenderer();
|
|
40
|
+
const sceneID = this.getAttribute("scene-id");
|
|
41
|
+
if (sceneID) {
|
|
42
|
+
const opt = options || plattar_controller_1.PlattarController.DEFAULT_QR_OPTIONS;
|
|
43
|
+
const viewer = document.createElement("plattar-qrcode");
|
|
44
|
+
// required attributes with defaults for plattar-viewer node
|
|
45
|
+
const width = this.getAttribute("width") || "500px";
|
|
46
|
+
const height = this.getAttribute("height") || "500px";
|
|
47
|
+
viewer.setAttribute("width", width);
|
|
48
|
+
viewer.setAttribute("height", height);
|
|
49
|
+
if (opt.color) {
|
|
50
|
+
viewer.setAttribute("color", opt.color);
|
|
51
|
+
}
|
|
52
|
+
if (opt.margin) {
|
|
53
|
+
viewer.setAttribute("margin", "" + opt.margin);
|
|
54
|
+
}
|
|
55
|
+
if (opt.qrType) {
|
|
56
|
+
viewer.setAttribute("qr-type", opt.qrType);
|
|
57
|
+
}
|
|
58
|
+
let dst = plattar_api_1.Server.location().base + "renderer/viewer.html?scene_id=" + sceneID;
|
|
59
|
+
// optional attributes
|
|
60
|
+
const productID = this.getAttribute("product-id");
|
|
61
|
+
const variationID = this.getAttribute("variation-id");
|
|
62
|
+
if (productID) {
|
|
63
|
+
dst += "&productId=" + productID;
|
|
64
|
+
}
|
|
65
|
+
if (variationID) {
|
|
66
|
+
dst += "&variationId=" + variationID;
|
|
67
|
+
}
|
|
68
|
+
viewer.setAttribute("url", opt.url || dst);
|
|
69
|
+
viewer.onload = () => {
|
|
70
|
+
return accept(viewer);
|
|
71
|
+
};
|
|
72
|
+
this.append(viewer);
|
|
73
|
+
this._element = viewer;
|
|
74
|
+
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
75
|
+
this._prevQROpt = opt;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
return reject(new Error("ViewerController.startQRCode() - minimum required attributes not set, use scene-id as a minimum"));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
startRenderer() {
|
|
82
|
+
return new Promise((accept, reject) => {
|
|
83
|
+
// remove the old renderer instance if any
|
|
84
|
+
this.removeRenderer();
|
|
85
|
+
const sceneID = this.getAttribute("scene-id");
|
|
86
|
+
if (sceneID) {
|
|
87
|
+
// required attributes with defaults for plattar-viewer node
|
|
88
|
+
const width = this.getAttribute("width") || "500px";
|
|
89
|
+
const height = this.getAttribute("height") || "500px";
|
|
90
|
+
const server = this.getAttribute("server") || "production";
|
|
91
|
+
const viewer = document.createElement("plattar-viewer");
|
|
92
|
+
viewer.setAttribute("width", width);
|
|
93
|
+
viewer.setAttribute("height", height);
|
|
94
|
+
viewer.setAttribute("server", server);
|
|
95
|
+
viewer.setAttribute("scene-id", sceneID);
|
|
96
|
+
// optional attributes
|
|
97
|
+
const productID = this.getAttribute("product-id");
|
|
98
|
+
const variationID = this.getAttribute("variation-id");
|
|
99
|
+
if (productID) {
|
|
100
|
+
viewer.setAttribute("product-id", productID);
|
|
101
|
+
}
|
|
102
|
+
if (variationID) {
|
|
103
|
+
viewer.setAttribute("variation-id", variationID);
|
|
104
|
+
}
|
|
105
|
+
viewer.onload = () => {
|
|
106
|
+
return accept(viewer);
|
|
107
|
+
};
|
|
108
|
+
this.append(viewer);
|
|
109
|
+
this._element = viewer;
|
|
110
|
+
this._state = plattar_controller_1.ControllerState.Renderer;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
return reject(new Error("ViewerController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
startAR() {
|
|
117
|
+
return new Promise((accept, reject) => {
|
|
118
|
+
this.initAR().then((launcher) => {
|
|
119
|
+
launcher.start();
|
|
120
|
+
accept();
|
|
121
|
+
}).catch(reject);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
initAR() {
|
|
125
|
+
return new Promise((accept, reject) => {
|
|
126
|
+
if (!util_1.Util.canAugment()) {
|
|
127
|
+
return reject(new Error("ViewerController.initAR() - cannot proceed as AR not available in context"));
|
|
128
|
+
}
|
|
129
|
+
const productID = this.getAttribute("product-id");
|
|
130
|
+
if (productID) {
|
|
131
|
+
const variationID = this.getAttribute("variation-id");
|
|
132
|
+
const product = new product_ar_1.ProductAR(productID, variationID);
|
|
133
|
+
return product.init().then(accept).catch(reject);
|
|
134
|
+
}
|
|
135
|
+
const sceneID = this.getAttribute("scene-id");
|
|
136
|
+
// otherwise, scene was set so use SceneAR
|
|
137
|
+
if (sceneID) {
|
|
138
|
+
return reject(new Error("ViewerController.initAR() - AR mode for scene-id not yet supported, use product-id"));
|
|
139
|
+
}
|
|
140
|
+
return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use scene-id or product-id as a minimum"));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
removeRenderer() {
|
|
144
|
+
if (this._element) {
|
|
145
|
+
this._element.remove();
|
|
146
|
+
this._element = null;
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
get element() {
|
|
152
|
+
return this._element;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.ViewerController = ViewerController;
|
|
@@ -4,14 +4,8 @@ import { LauncherAR } from "../ar/launcher-ar";
|
|
|
4
4
|
* of Plattar related content
|
|
5
5
|
*/
|
|
6
6
|
export default class PlattarEmbed extends HTMLElement {
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private _variationID;
|
|
10
|
-
private _width;
|
|
11
|
-
private _height;
|
|
12
|
-
private _isReady;
|
|
13
|
-
private _server;
|
|
14
|
-
private _viewer;
|
|
7
|
+
private _currentType;
|
|
8
|
+
private _controller;
|
|
15
9
|
constructor();
|
|
16
10
|
get viewer(): HTMLElement | null;
|
|
17
11
|
connectedCallback(): void;
|
|
@@ -19,4 +13,9 @@ export default class PlattarEmbed extends HTMLElement {
|
|
|
19
13
|
startAR(): Promise<void>;
|
|
20
14
|
startViewer(): Promise<HTMLElement>;
|
|
21
15
|
startQRCode(options?: any | undefined | null): Promise<HTMLElement>;
|
|
16
|
+
/**
|
|
17
|
+
* This is called by the observer if any of the embed attributes have changed
|
|
18
|
+
* based on the state of the embed, we update the internal structure accordingly
|
|
19
|
+
*/
|
|
20
|
+
private _OnAttributesUpdated;
|
|
22
21
|
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const plattar_api_1 = require("@plattar/plattar-api");
|
|
4
|
-
const
|
|
4
|
+
const product_controller_1 = require("./controllers/product-controller");
|
|
5
|
+
const viewer_controller_1 = require("./controllers/viewer-controller");
|
|
6
|
+
const configurator_controller_1 = require("./controllers/configurator-controller");
|
|
7
|
+
/**
|
|
8
|
+
* This tracks the current embed type
|
|
9
|
+
*/
|
|
10
|
+
var EmbedType;
|
|
11
|
+
(function (EmbedType) {
|
|
12
|
+
EmbedType[EmbedType["Viewer"] = 0] = "Viewer";
|
|
13
|
+
EmbedType[EmbedType["Configurator"] = 1] = "Configurator";
|
|
14
|
+
})(EmbedType || (EmbedType = {}));
|
|
5
15
|
/**
|
|
6
16
|
* This is the primary <plattar-embed /> node that allows easy embedding
|
|
7
17
|
* of Plattar related content
|
|
@@ -9,36 +19,54 @@ const product_ar_1 = require("../ar/product-ar");
|
|
|
9
19
|
class PlattarEmbed extends HTMLElement {
|
|
10
20
|
constructor() {
|
|
11
21
|
super();
|
|
12
|
-
this
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this._isReady = false;
|
|
16
|
-
this._width = "500px";
|
|
17
|
-
this._height = "500px";
|
|
18
|
-
this._server = "production";
|
|
19
|
-
this._viewer = null;
|
|
22
|
+
// this is the current embed type, viewer by default
|
|
23
|
+
this._currentType = EmbedType.Viewer;
|
|
24
|
+
this._controller = null;
|
|
20
25
|
}
|
|
21
26
|
get viewer() {
|
|
22
|
-
return this.
|
|
27
|
+
return this._controller ? this._controller.element : null;
|
|
23
28
|
}
|
|
24
29
|
connectedCallback() {
|
|
30
|
+
const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "viewer";
|
|
31
|
+
if (embedType) {
|
|
32
|
+
switch (embedType.toLowerCase()) {
|
|
33
|
+
case "viewer":
|
|
34
|
+
this._currentType = EmbedType.Viewer;
|
|
35
|
+
break;
|
|
36
|
+
case "configurator":
|
|
37
|
+
this._currentType = EmbedType.Configurator;
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
this._currentType = EmbedType.Viewer;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const observer = new MutationObserver((mutations) => {
|
|
44
|
+
mutations.forEach((mutation) => {
|
|
45
|
+
if (mutation.type === "attributes") {
|
|
46
|
+
this._OnAttributesUpdated();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
observer.observe(this, {
|
|
51
|
+
attributes: true
|
|
52
|
+
});
|
|
25
53
|
const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
26
54
|
plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
const sceneID = this.hasAttribute("scene-id") ? this.getAttribute("scene-id") : null;
|
|
56
|
+
const productID = this.hasAttribute("product-id") ? this.getAttribute("product-id") : null;
|
|
57
|
+
// decide which controller to initialise
|
|
58
|
+
if (this._currentType === EmbedType.Viewer) {
|
|
59
|
+
// initialise product if scene-id is missing but product-id is defined
|
|
60
|
+
if (!sceneID && productID) {
|
|
61
|
+
this._controller = new product_controller_1.ProductController(this);
|
|
62
|
+
}
|
|
63
|
+
else if (sceneID) {
|
|
64
|
+
this._controller = new viewer_controller_1.ViewerController(this);
|
|
65
|
+
}
|
|
37
66
|
}
|
|
38
|
-
if (
|
|
39
|
-
this.
|
|
67
|
+
else if (this._currentType === EmbedType.Configurator) {
|
|
68
|
+
this._controller = new configurator_controller_1.ConfiguratorController(this);
|
|
40
69
|
}
|
|
41
|
-
this._isReady = true;
|
|
42
70
|
const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
|
|
43
71
|
if (init === "ar") {
|
|
44
72
|
this.startAR();
|
|
@@ -66,156 +94,44 @@ class PlattarEmbed extends HTMLElement {
|
|
|
66
94
|
}
|
|
67
95
|
initAR() {
|
|
68
96
|
return new Promise((accept, reject) => {
|
|
69
|
-
if (!this.
|
|
70
|
-
return reject(new Error("PlattarEmbed.initAR() - cannot execute as
|
|
71
|
-
}
|
|
72
|
-
// if scene is not set but product is, then use ProductAR
|
|
73
|
-
if (!this._sceneID && this._productID) {
|
|
74
|
-
const product = new product_ar_1.ProductAR(this._productID, this._variationID);
|
|
75
|
-
return product.init().then(accept).catch(reject);
|
|
76
|
-
}
|
|
77
|
-
// otherwise, scene was set so use SceneAR
|
|
78
|
-
if (this._sceneID) {
|
|
79
|
-
return reject(new Error("PlattarEmbed.initAR() - scene-id not yet supported"));
|
|
97
|
+
if (!this._controller) {
|
|
98
|
+
return reject(new Error("PlattarEmbed.initAR() - cannot execute as controller has not loaded yet"));
|
|
80
99
|
}
|
|
81
|
-
return
|
|
100
|
+
return this._controller.initAR().then(accept).catch(reject);
|
|
82
101
|
});
|
|
83
102
|
}
|
|
84
103
|
startAR() {
|
|
85
104
|
return new Promise((accept, reject) => {
|
|
86
|
-
if (!this.
|
|
87
|
-
return reject(new Error("PlattarEmbed.startAR() - cannot execute as
|
|
105
|
+
if (!this._controller) {
|
|
106
|
+
return reject(new Error("PlattarEmbed.startAR() - cannot execute as controller has not loaded yet"));
|
|
88
107
|
}
|
|
89
|
-
this.
|
|
90
|
-
launcher.start();
|
|
91
|
-
accept();
|
|
92
|
-
}).catch(reject);
|
|
108
|
+
return this._controller.startAR().then(accept).catch(reject);
|
|
93
109
|
});
|
|
94
110
|
}
|
|
95
111
|
startViewer() {
|
|
96
112
|
return new Promise((accept, reject) => {
|
|
97
|
-
if (!this.
|
|
98
|
-
return reject(new Error("PlattarEmbed.startViewer() - cannot execute as
|
|
99
|
-
}
|
|
100
|
-
if (this._viewer) {
|
|
101
|
-
this._viewer.remove();
|
|
102
|
-
this._viewer = null;
|
|
103
|
-
}
|
|
104
|
-
// if scene is set, we use <plattar-viewer /> node from plattar-web
|
|
105
|
-
if (this._sceneID) {
|
|
106
|
-
const viewer = document.createElement("plattar-viewer");
|
|
107
|
-
viewer.setAttribute("width", this._width);
|
|
108
|
-
viewer.setAttribute("height", this._height);
|
|
109
|
-
viewer.setAttribute("server", this._server);
|
|
110
|
-
viewer.setAttribute("scene-id", this._sceneID);
|
|
111
|
-
if (this._productID) {
|
|
112
|
-
viewer.setAttribute("product-id", this._productID);
|
|
113
|
-
}
|
|
114
|
-
if (this._variationID) {
|
|
115
|
-
viewer.setAttribute("variation-id", this._variationID);
|
|
116
|
-
}
|
|
117
|
-
viewer.onload = () => {
|
|
118
|
-
return accept(viewer);
|
|
119
|
-
};
|
|
120
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
121
|
-
shadow.append(viewer);
|
|
122
|
-
this._viewer = viewer;
|
|
123
|
-
return;
|
|
113
|
+
if (!this._controller) {
|
|
114
|
+
return reject(new Error("PlattarEmbed.startViewer() - cannot execute as controller has not loaded yet"));
|
|
124
115
|
}
|
|
125
|
-
|
|
126
|
-
if (this._productID) {
|
|
127
|
-
const viewer = document.createElement("plattar-product");
|
|
128
|
-
viewer.setAttribute("width", this._width);
|
|
129
|
-
viewer.setAttribute("height", this._height);
|
|
130
|
-
viewer.setAttribute("server", this._server);
|
|
131
|
-
viewer.setAttribute("product-id", this._productID);
|
|
132
|
-
if (this._variationID) {
|
|
133
|
-
viewer.setAttribute("variation-id", this._variationID);
|
|
134
|
-
}
|
|
135
|
-
viewer.onload = () => {
|
|
136
|
-
return accept(viewer);
|
|
137
|
-
};
|
|
138
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
139
|
-
shadow.append(viewer);
|
|
140
|
-
this._viewer = viewer;
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
return reject(new Error("PlattarEmbed.startViewer() - minimum required attributes not set, use scene-id or product-id as a minimum"));
|
|
116
|
+
return this._controller.startRenderer().then(accept).catch(reject);
|
|
144
117
|
});
|
|
145
118
|
}
|
|
146
119
|
startQRCode(options = null) {
|
|
147
120
|
return new Promise((accept, reject) => {
|
|
148
|
-
if (!this.
|
|
149
|
-
return reject(new Error("PlattarEmbed.startQRCode() - cannot execute as
|
|
150
|
-
}
|
|
151
|
-
const opt = options || {
|
|
152
|
-
color: "#101721",
|
|
153
|
-
qrType: "default",
|
|
154
|
-
margin: 0
|
|
155
|
-
};
|
|
156
|
-
if (this._viewer) {
|
|
157
|
-
this._viewer.remove();
|
|
158
|
-
this._viewer = null;
|
|
159
|
-
}
|
|
160
|
-
// if scene is set, we embed a QR code that takes us to viewer.html
|
|
161
|
-
if (this._sceneID) {
|
|
162
|
-
const viewer = document.createElement("plattar-qrcode");
|
|
163
|
-
viewer.setAttribute("width", this._width);
|
|
164
|
-
viewer.setAttribute("height", this._height);
|
|
165
|
-
if (opt.color) {
|
|
166
|
-
viewer.setAttribute("color", opt.color);
|
|
167
|
-
}
|
|
168
|
-
if (opt.margin) {
|
|
169
|
-
viewer.setAttribute("margin", "" + opt.margin);
|
|
170
|
-
}
|
|
171
|
-
if (opt.qrType) {
|
|
172
|
-
viewer.setAttribute("qr-type", opt.qrType);
|
|
173
|
-
}
|
|
174
|
-
let dst = plattar_api_1.Server.location().base + "renderer/viewer.html?scene_id=" + this._sceneID;
|
|
175
|
-
if (this._productID) {
|
|
176
|
-
dst += "&productId=" + this._productID;
|
|
177
|
-
}
|
|
178
|
-
if (this._variationID) {
|
|
179
|
-
dst += "&variationId=" + this._variationID;
|
|
180
|
-
}
|
|
181
|
-
viewer.setAttribute("url", dst);
|
|
182
|
-
viewer.onload = () => {
|
|
183
|
-
return accept(viewer);
|
|
184
|
-
};
|
|
185
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
186
|
-
shadow.append(viewer);
|
|
187
|
-
this._viewer = viewer;
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
// if product is set, we embed a QR code that takes us to product.html
|
|
191
|
-
if (this._productID) {
|
|
192
|
-
const viewer = document.createElement("plattar-qrcode");
|
|
193
|
-
viewer.setAttribute("width", this._width);
|
|
194
|
-
viewer.setAttribute("height", this._height);
|
|
195
|
-
if (opt.color) {
|
|
196
|
-
viewer.setAttribute("color", opt.color);
|
|
197
|
-
}
|
|
198
|
-
if (opt.margin) {
|
|
199
|
-
viewer.setAttribute("margin", "" + opt.margin);
|
|
200
|
-
}
|
|
201
|
-
if (opt.qrType) {
|
|
202
|
-
viewer.setAttribute("qr-type", opt.qrType);
|
|
203
|
-
}
|
|
204
|
-
let dst = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + this._productID;
|
|
205
|
-
if (this._variationID) {
|
|
206
|
-
dst += "&variation_id=" + this._variationID;
|
|
207
|
-
}
|
|
208
|
-
viewer.setAttribute("url", dst);
|
|
209
|
-
viewer.onload = () => {
|
|
210
|
-
return accept(viewer);
|
|
211
|
-
};
|
|
212
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
213
|
-
shadow.append(viewer);
|
|
214
|
-
this._viewer = viewer;
|
|
215
|
-
return;
|
|
121
|
+
if (!this._controller) {
|
|
122
|
+
return reject(new Error("PlattarEmbed.startQRCode() - cannot execute as controller has not loaded yet"));
|
|
216
123
|
}
|
|
217
|
-
return
|
|
124
|
+
return this._controller.startQRCode(options).then(accept).catch(reject);
|
|
218
125
|
});
|
|
219
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* This is called by the observer if any of the embed attributes have changed
|
|
129
|
+
* based on the state of the embed, we update the internal structure accordingly
|
|
130
|
+
*/
|
|
131
|
+
_OnAttributesUpdated() {
|
|
132
|
+
if (this._controller) {
|
|
133
|
+
this._controller.onAttributesUpdated();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
220
136
|
}
|
|
221
137
|
exports.default = PlattarEmbed;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.Util = exports.ModelAR = exports.SceneAR = exports.ProductAR = exports.ConfiguratorAR = exports.version = exports.PlattarQRCode = exports.PlattarWeb = void 0;
|
|
25
|
+
exports.Util = exports.RawAR = exports.ModelAR = exports.SceneAR = exports.ProductAR = exports.ConfiguratorAR = exports.version = exports.PlattarQRCode = exports.PlattarWeb = void 0;
|
|
26
26
|
exports.PlattarWeb = __importStar(require("@plattar/plattar-web"));
|
|
27
27
|
exports.PlattarQRCode = __importStar(require("@plattar/plattar-qrcode"));
|
|
28
28
|
exports.version = __importStar(require("./version"));
|
|
@@ -34,6 +34,8 @@ var scene_ar_1 = require("./ar/scene-ar");
|
|
|
34
34
|
Object.defineProperty(exports, "SceneAR", { enumerable: true, get: function () { return scene_ar_1.SceneAR; } });
|
|
35
35
|
var model_ar_1 = require("./ar/model-ar");
|
|
36
36
|
Object.defineProperty(exports, "ModelAR", { enumerable: true, get: function () { return model_ar_1.ModelAR; } });
|
|
37
|
+
var raw_ar_1 = require("./ar/raw-ar");
|
|
38
|
+
Object.defineProperty(exports, "RawAR", { enumerable: true, get: function () { return raw_ar_1.RawAR; } });
|
|
37
39
|
var util_1 = require("./util/util");
|
|
38
40
|
Object.defineProperty(exports, "Util", { enumerable: true, get: function () { return util_1.Util; } });
|
|
39
41
|
const plattar_embed_1 = __importDefault(require("./embed/plattar-embed"));
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.
|
|
1
|
+
declare const _default: "1.123.1";
|
|
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.123.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",
|
|
@@ -39,15 +39,16 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@plattar/plattar-analytics": "^1.117.2",
|
|
41
41
|
"@plattar/plattar-api": "^1.120.1",
|
|
42
|
-
"@plattar/plattar-qrcode": "1.
|
|
43
|
-
"@plattar/plattar-
|
|
42
|
+
"@plattar/plattar-qrcode": "1.122.1",
|
|
43
|
+
"@plattar/plattar-services": "^1.120.1",
|
|
44
|
+
"@plattar/plattar-web": "^1.122.3"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@babel/cli": "^7.
|
|
47
|
-
"@babel/core": "^7.
|
|
48
|
-
"@babel/preset-env": "^7.16.
|
|
47
|
+
"@babel/cli": "^7.17.0",
|
|
48
|
+
"@babel/core": "^7.17.0",
|
|
49
|
+
"@babel/preset-env": "^7.16.11",
|
|
49
50
|
"browserify": "^17.0.0",
|
|
50
|
-
"typescript": "^4.5.
|
|
51
|
+
"typescript": "^4.5.5",
|
|
51
52
|
"uglify-es": "^3.3.9"
|
|
52
53
|
},
|
|
53
54
|
"publishConfig": {
|