@plattar/plattar-ar-adapter 1.158.2 → 1.163.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.
Files changed (37) hide show
  1. package/build/es2015/plattar-ar-adapter.js +571 -335
  2. package/build/es2015/plattar-ar-adapter.min.js +1 -1
  3. package/build/es2019/plattar-ar-adapter.js +206 -100
  4. package/build/es2019/plattar-ar-adapter.min.js +1 -1
  5. package/dist/ar/configurator-ar.d.ts +6 -2
  6. package/dist/ar/configurator-ar.js +17 -8
  7. package/dist/ar/launcher-ar.d.ts +2 -0
  8. package/dist/ar/launcher-ar.js +2 -1
  9. package/dist/ar/model-ar.d.ts +6 -2
  10. package/dist/ar/model-ar.js +14 -4
  11. package/dist/ar/product-ar.d.ts +8 -4
  12. package/dist/ar/product-ar.js +28 -6
  13. package/dist/ar/raw-ar.d.ts +7 -3
  14. package/dist/ar/raw-ar.js +16 -8
  15. package/dist/ar/scene-ar.d.ts +7 -3
  16. package/dist/ar/scene-ar.js +16 -8
  17. package/dist/ar/scene-product-ar.d.ts +2 -2
  18. package/dist/ar/scene-product-ar.js +5 -4
  19. package/dist/embed/controllers/configurator-controller.js +16 -2
  20. package/dist/embed/controllers/plattar-controller.d.ts +12 -0
  21. package/dist/embed/controllers/plattar-controller.js +22 -0
  22. package/dist/embed/controllers/product-controller.js +11 -1
  23. package/dist/embed/controllers/vto-controller.js +7 -2
  24. package/dist/embed/plattar-embed.d.ts +2 -0
  25. package/dist/embed/plattar-embed.js +16 -0
  26. package/dist/index.d.ts +2 -0
  27. package/dist/version.d.ts +1 -1
  28. package/dist/version.js +1 -1
  29. package/dist/viewers/ar-viewer.d.ts +8 -1
  30. package/dist/viewers/ar-viewer.js +8 -2
  31. package/dist/viewers/quicklook-viewer.d.ts +1 -4
  32. package/dist/viewers/quicklook-viewer.js +9 -18
  33. package/dist/viewers/reality-viewer.d.ts +1 -1
  34. package/dist/viewers/reality-viewer.js +2 -5
  35. package/dist/viewers/scene-viewer.d.ts +1 -3
  36. package/dist/viewers/scene-viewer.js +9 -23
  37. package/package.json +7 -7
@@ -10,7 +10,6 @@ const plattar_api_1 = require("@plattar/plattar-api");
10
10
  const plattar_services_1 = require("@plattar/plattar-services");
11
11
  const util_1 = require("../util/util");
12
12
  const quicklook_viewer_1 = __importDefault(require("../viewers/quicklook-viewer"));
13
- const reality_viewer_1 = __importDefault(require("../viewers/reality-viewer"));
14
13
  const scene_viewer_1 = __importDefault(require("../viewers/scene-viewer"));
15
14
  const launcher_ar_1 = require("./launcher-ar");
16
15
  const version_1 = __importDefault(require("../version"));
@@ -18,18 +17,18 @@ const version_1 = __importDefault(require("../version"));
18
17
  * Performs AR functionality related to Plattar Scenes
19
18
  */
20
19
  class ConfiguratorAR extends launcher_ar_1.LauncherAR {
21
- constructor(state) {
20
+ constructor(options) {
22
21
  super();
23
22
  // analytics instance
24
23
  this._analytics = null;
25
- if (!state) {
24
+ if (!options.state) {
26
25
  throw new Error("ConfiguratorAR.constructor(state) - state must be defined");
27
26
  }
28
- this._state = state;
27
+ this._options = options;
29
28
  this._ar = null;
30
29
  }
31
30
  _SetupAnalytics() {
32
- const scene = this._state.scene;
31
+ const scene = this._options.state.scene;
33
32
  let analytics = null;
34
33
  // setup scene stuff (if any)
35
34
  if (scene) {
@@ -45,6 +44,13 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
45
44
  if (application) {
46
45
  analytics.data.push("applicationId", application.id);
47
46
  analytics.data.push("applicationTitle", application.attributes.title);
47
+ if (this._options.useARBanner) {
48
+ this.options.banner = {
49
+ title: application.attributes.title,
50
+ subtitle: scene.attributes.title,
51
+ button: 'Visit'
52
+ };
53
+ }
48
54
  }
49
55
  }
50
56
  }
@@ -53,7 +59,7 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
53
59
  * an AR File
54
60
  */
55
61
  async _Compose(output) {
56
- const objects = this._state.state.array();
62
+ const objects = this._options.state.state.array();
57
63
  if (objects.length <= 0) {
58
64
  throw new Error("ConfiguratorAR.Compose() - cannot proceed as scene does not contain AR components");
59
65
  }
@@ -90,7 +96,7 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
90
96
  if (!util_1.Util.canAugment()) {
91
97
  throw new Error("ConfiguratorAR.init() - cannot proceed as AR not available in context");
92
98
  }
93
- const scene = this._state.scene;
99
+ const scene = this._options.state.scene;
94
100
  this._SetupAnalytics();
95
101
  const sceneOpt = scene.attributes.custom_json || {};
96
102
  // we need to define our AR module here
@@ -101,8 +107,9 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
101
107
  if (sceneOpt.anchor === "face") {
102
108
  if (util_1.Util.canRealityViewer()) {
103
109
  const modelUrl = await this._Compose("vto");
104
- this._ar = new reality_viewer_1.default();
110
+ this._ar = new quicklook_viewer_1.default();
105
111
  this._ar.modelUrl = modelUrl;
112
+ this._ar.banner = this.options.banner;
106
113
  return this;
107
114
  }
108
115
  else {
@@ -114,6 +121,7 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
114
121
  const modelUrl = await this._Compose("usdz");
115
122
  this._ar = new quicklook_viewer_1.default();
116
123
  this._ar.modelUrl = modelUrl;
124
+ this._ar.banner = this.options.banner;
117
125
  return this;
118
126
  }
119
127
  throw new Error("ConfiguratorAR.init() - cannot proceed as IOS device does not support AR Mode");
@@ -124,6 +132,7 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
124
132
  const arviewer = new scene_viewer_1.default();
125
133
  arviewer.modelUrl = modelUrl;
126
134
  arviewer.isVertical = this.options.anchor === "vertical" ? true : false;
135
+ arviewer.banner = this.options.banner;
127
136
  if (sceneOpt.anchor === "vertical") {
128
137
  arviewer.isVertical = true;
129
138
  }
@@ -161,14 +170,15 @@ class ConfiguratorAR extends launcher_ar_1.LauncherAR {
161
170
  }
162
171
  exports.ConfiguratorAR = ConfiguratorAR;
163
172
 
164
- },{"../util/util":15,"../version":16,"../viewers/quicklook-viewer":18,"../viewers/reality-viewer":19,"../viewers/scene-viewer":20,"./launcher-ar":2,"@plattar/plattar-analytics":40,"@plattar/plattar-api":44,"@plattar/plattar-services":115}],2:[function(require,module,exports){
173
+ },{"../util/util":15,"../version":16,"../viewers/quicklook-viewer":18,"../viewers/scene-viewer":20,"./launcher-ar":2,"@plattar/plattar-analytics":40,"@plattar/plattar-api":44,"@plattar/plattar-services":115}],2:[function(require,module,exports){
165
174
  "use strict";
166
175
  Object.defineProperty(exports, "__esModule", { value: true });
167
176
  exports.LauncherAR = void 0;
168
177
  class LauncherAR {
169
178
  constructor() {
170
179
  this._opt = {
171
- anchor: "horizontal_vertical"
180
+ anchor: "horizontal_vertical",
181
+ banner: null
172
182
  };
173
183
  }
174
184
  /**
@@ -207,18 +217,18 @@ const version_1 = __importDefault(require("../version"));
207
217
  * Performs AT Functionality using Plattar FileModel types
208
218
  */
209
219
  class ModelAR extends launcher_ar_1.LauncherAR {
210
- constructor(modelID = null) {
220
+ constructor(options) {
211
221
  super();
212
222
  // analytics instance
213
223
  this._analytics = null;
214
- if (!modelID) {
224
+ if (!options.modelID) {
215
225
  throw new Error("ModelAR.constructor(modelID) - modelID must be defined");
216
226
  }
217
- this._modelID = modelID;
227
+ this._options = options;
218
228
  this._ar = null;
219
229
  }
220
230
  get modelID() {
221
- return this._modelID;
231
+ return this._options.modelID;
222
232
  }
223
233
  _SetupAnalytics(model) {
224
234
  let analytics = null;
@@ -234,6 +244,13 @@ class ModelAR extends launcher_ar_1.LauncherAR {
234
244
  analytics.data.push("modelId", model.id);
235
245
  analytics.data.push("modelTitle", model.attributes.title);
236
246
  this._analytics = analytics;
247
+ if (this._options.useARBanner) {
248
+ this.options.banner = {
249
+ title: project.attributes.title,
250
+ subtitle: model.attributes.title,
251
+ button: 'Visit'
252
+ };
253
+ }
237
254
  }
238
255
  }
239
256
  /**
@@ -261,12 +278,14 @@ class ModelAR extends launcher_ar_1.LauncherAR {
261
278
  if (model.attributes.reality_filename && util_1.Util.canRealityViewer()) {
262
279
  this._ar = new reality_viewer_1.default();
263
280
  this._ar.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.reality_filename;
281
+ this._ar.banner = this.options.banner;
264
282
  return accept(this);
265
283
  }
266
284
  // otherwise, load the USDZ stuff second if available
267
285
  if (model.attributes.usdz_filename && util_1.Util.canQuicklook()) {
268
286
  this._ar = new quicklook_viewer_1.default();
269
287
  this._ar.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.usdz_filename;
288
+ this._ar.banner = this.options.banner;
270
289
  return accept(this);
271
290
  }
272
291
  return reject(new Error("ModelAR.init() - cannot proceed as ModelFile does not have a defined .usdz or .reality file"));
@@ -276,6 +295,7 @@ class ModelAR extends launcher_ar_1.LauncherAR {
276
295
  const arviewer = new scene_viewer_1.default();
277
296
  arviewer.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.original_filename;
278
297
  arviewer.isVertical = this.options.anchor === "vertical" ? true : false;
298
+ arviewer.banner = this.options.banner;
279
299
  this._ar = arviewer;
280
300
  return accept(this);
281
301
  }
@@ -334,26 +354,38 @@ const version_1 = __importDefault(require("../version"));
334
354
  * Performs AR functionality related to Plattar Products and Variation types
335
355
  */
336
356
  class ProductAR extends launcher_ar_1.LauncherAR {
337
- constructor(productID = null, variationID = null, variationSKU = null) {
357
+ /*
358
+ constructor(productID: string | undefined | null = null, variationID: string | undefined | null = null, variationSKU: string | undefined | null = null) {
338
359
  super();
339
- // analytics instance
340
- this._analytics = null;
360
+
341
361
  if (!productID) {
342
362
  throw new Error("ProductAR.constructor(productID, variationID) - productID must be defined");
343
363
  }
364
+
344
365
  this._productID = productID;
345
366
  this._variationSKU = variationSKU;
346
367
  this._variationID = variationID ? variationID : (variationSKU ? null : "default");
347
368
  this._ar = null;
348
369
  }
370
+ */
371
+ constructor(options) {
372
+ super();
373
+ // analytics instance
374
+ this._analytics = null;
375
+ if (!options.productID) {
376
+ throw new Error("ProductAR.constructor(productID, variationID) - productID must be defined");
377
+ }
378
+ this._options = options;
379
+ this._ar = null;
380
+ }
349
381
  get productID() {
350
- return this._productID;
382
+ return this._options.productID;
351
383
  }
352
384
  get variationID() {
353
- return this._variationID;
385
+ return this._options.variationID;
354
386
  }
355
387
  get variationSKU() {
356
- return this._variationSKU;
388
+ return this._options.variationSKU;
357
389
  }
358
390
  _SetupAnalytics(product, variation) {
359
391
  let analytics = null;
@@ -372,6 +404,13 @@ class ProductAR extends launcher_ar_1.LauncherAR {
372
404
  if (application) {
373
405
  analytics.data.push("applicationId", application.id);
374
406
  analytics.data.push("applicationTitle", application.attributes.title);
407
+ if (this._options.useARBanner) {
408
+ this.options.banner = {
409
+ title: product.attributes.title,
410
+ subtitle: variation.attributes.title,
411
+ button: 'Visit'
412
+ };
413
+ }
375
414
  }
376
415
  }
377
416
  if (analytics) {
@@ -447,12 +486,14 @@ class ProductAR extends launcher_ar_1.LauncherAR {
447
486
  if (model.attributes.reality_filename && util_1.Util.canRealityViewer()) {
448
487
  this._ar = new reality_viewer_1.default();
449
488
  this._ar.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.reality_filename;
489
+ this._ar.banner = this.options.banner;
450
490
  return accept(this);
451
491
  }
452
492
  // otherwise, load the USDZ stuff second if available
453
493
  if (model.attributes.usdz_filename && util_1.Util.canQuicklook()) {
454
494
  this._ar = new quicklook_viewer_1.default();
455
495
  this._ar.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.usdz_filename;
496
+ this._ar.banner = this.options.banner;
456
497
  return accept(this);
457
498
  }
458
499
  return reject(new Error("ProductAR.init() - cannot proceed as ModelFile does not have a defined .usdz or .reality file"));
@@ -462,6 +503,7 @@ class ProductAR extends launcher_ar_1.LauncherAR {
462
503
  const arviewer = new scene_viewer_1.default();
463
504
  arviewer.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.original_filename;
464
505
  arviewer.isVertical = this.options.anchor === "vertical" ? true : false;
506
+ arviewer.banner = this.options.banner;
465
507
  const scene = product.relationships.find(plattar_api_1.Scene);
466
508
  if (scene) {
467
509
  const sceneOpt = scene.attributes.custom_json || {};
@@ -527,17 +569,16 @@ const version_1 = __importDefault(require("../version"));
527
569
  * Allows launching AR Experiences provided a single remote 3D Model file
528
570
  */
529
571
  class RawAR extends launcher_ar_1.LauncherAR {
530
- constructor(modelLocation = null, sceneID = null) {
572
+ constructor(options) {
531
573
  super();
532
574
  // analytics instance
533
575
  this._analytics = null;
534
- if (!modelLocation) {
576
+ if (!options.modelLocation) {
535
577
  throw new Error("RawAR.constructor(modelLocation) - modelLocation must be defined");
536
578
  }
537
- const lowerLoc = modelLocation.toLowerCase();
579
+ const lowerLoc = options.modelLocation.toLowerCase();
538
580
  if (lowerLoc.endsWith("usdz") || lowerLoc.endsWith("glb") || lowerLoc.endsWith("gltf") || lowerLoc.endsWith("reality")) {
539
- this._modelLocation = modelLocation;
540
- this._sceneID = sceneID;
581
+ this._options = options;
541
582
  this._ar = null;
542
583
  }
543
584
  else {
@@ -545,11 +586,11 @@ class RawAR extends launcher_ar_1.LauncherAR {
545
586
  }
546
587
  }
547
588
  get modelLocation() {
548
- return this._modelLocation;
589
+ return this._options.modelLocation;
549
590
  }
550
591
  _SetupAnalytics() {
551
592
  return new Promise((accept, _reject) => {
552
- const sceneID = this._sceneID;
593
+ const sceneID = this._options.sceneID;
553
594
  if (!sceneID) {
554
595
  return accept();
555
596
  }
@@ -568,6 +609,13 @@ class RawAR extends launcher_ar_1.LauncherAR {
568
609
  if (application) {
569
610
  analytics.data.push("applicationId", application.id);
570
611
  analytics.data.push("applicationTitle", application.attributes.title);
612
+ if (this._options.useARBanner) {
613
+ this.options.banner = {
614
+ title: application.attributes.title,
615
+ subtitle: scene.attributes.title,
616
+ button: 'Visit'
617
+ };
618
+ }
571
619
  }
572
620
  accept();
573
621
  }).catch((_err) => {
@@ -589,7 +637,7 @@ class RawAR extends launcher_ar_1.LauncherAR {
589
637
  }
590
638
  // send the analytics (if any)
591
639
  this._SetupAnalytics().then(() => {
592
- const modelLocation = this._modelLocation;
640
+ const modelLocation = this._options.modelLocation;
593
641
  const lowerLoc = modelLocation.toLowerCase();
594
642
  // we need to define our AR module here
595
643
  // we are in Safari/Quicklook mode here
@@ -598,6 +646,7 @@ class RawAR extends launcher_ar_1.LauncherAR {
598
646
  if (lowerLoc.endsWith("reality") && util_1.Util.canRealityViewer()) {
599
647
  this._ar = new reality_viewer_1.default();
600
648
  this._ar.modelUrl = modelLocation;
649
+ this._ar.banner = this.options.banner;
601
650
  return accept(this);
602
651
  }
603
652
  // load the usdz experience if dealing with usdz file
@@ -614,6 +663,7 @@ class RawAR extends launcher_ar_1.LauncherAR {
614
663
  const arviewer = new scene_viewer_1.default();
615
664
  arviewer.modelUrl = modelLocation;
616
665
  arviewer.isVertical = this.options.anchor === "vertical" ? true : false;
666
+ arviewer.banner = this.options.banner;
617
667
  this._ar = arviewer;
618
668
  return accept(this);
619
669
  }
@@ -667,7 +717,6 @@ const plattar_api_1 = require("@plattar/plattar-api");
667
717
  const plattar_services_1 = require("@plattar/plattar-services");
668
718
  const util_1 = require("../util/util");
669
719
  const quicklook_viewer_1 = __importDefault(require("../viewers/quicklook-viewer"));
670
- const reality_viewer_1 = __importDefault(require("../viewers/reality-viewer"));
671
720
  const scene_viewer_1 = __importDefault(require("../viewers/scene-viewer"));
672
721
  const launcher_ar_1 = require("./launcher-ar");
673
722
  const version_1 = __importDefault(require("../version"));
@@ -675,19 +724,18 @@ const version_1 = __importDefault(require("../version"));
675
724
  * Performs AR functionality related to Plattar Scenes
676
725
  */
677
726
  class SceneAR extends launcher_ar_1.LauncherAR {
678
- constructor(sceneID = null, variationSelection = null) {
727
+ constructor(options) {
679
728
  super();
680
729
  // analytics instance
681
730
  this._analytics = null;
682
- if (!sceneID) {
731
+ if (!options.sceneID) {
683
732
  throw new Error("SceneAR.constructor(sceneID) - sceneID must be defined");
684
733
  }
685
- this._sceneID = sceneID;
686
- this._variationSelection = variationSelection || {};
734
+ this._options = options;
687
735
  this._ar = null;
688
736
  }
689
737
  get sceneID() {
690
- return this._sceneID;
738
+ return this._options.sceneID;
691
739
  }
692
740
  _SetupAnalytics(scene) {
693
741
  let analytics = null;
@@ -705,6 +753,13 @@ class SceneAR extends launcher_ar_1.LauncherAR {
705
753
  if (application) {
706
754
  analytics.data.push("applicationId", application.id);
707
755
  analytics.data.push("applicationTitle", application.attributes.title);
756
+ if (this._options.useARBanner) {
757
+ this.options.banner = {
758
+ title: application.attributes.title,
759
+ subtitle: scene.attributes.title,
760
+ button: 'Visit'
761
+ };
762
+ }
708
763
  }
709
764
  }
710
765
  }
@@ -728,7 +783,7 @@ class SceneAR extends launcher_ar_1.LauncherAR {
728
783
  // add our scene products
729
784
  sceneProducts.forEach((sceneProduct) => {
730
785
  const product = sceneProduct.relationships.find(plattar_api_1.Product);
731
- const selection = this._variationSelection;
786
+ const selection = this._options.variationSelection;
732
787
  // we have a specific product selection
733
788
  if (sceneProduct.attributes.include_in_augment) {
734
789
  // check if this product is the one we want (from selection optionally)
@@ -793,8 +848,9 @@ class SceneAR extends launcher_ar_1.LauncherAR {
793
848
  if (sceneOpt.anchor === "face") {
794
849
  if (util_1.Util.canRealityViewer()) {
795
850
  return this._ComposeScene(scene, "vto").then((modelUrl) => {
796
- this._ar = new reality_viewer_1.default();
851
+ this._ar = new quicklook_viewer_1.default();
797
852
  this._ar.modelUrl = modelUrl;
853
+ this._ar.banner = this.options.banner;
798
854
  return accept(this);
799
855
  }).catch(reject);
800
856
  }
@@ -807,6 +863,7 @@ class SceneAR extends launcher_ar_1.LauncherAR {
807
863
  return this._ComposeScene(scene, "usdz").then((modelUrl) => {
808
864
  this._ar = new quicklook_viewer_1.default();
809
865
  this._ar.modelUrl = modelUrl;
866
+ this._ar.banner = this.options.banner;
810
867
  return accept(this);
811
868
  }).catch(reject);
812
869
  }
@@ -818,6 +875,7 @@ class SceneAR extends launcher_ar_1.LauncherAR {
818
875
  const arviewer = new scene_viewer_1.default();
819
876
  arviewer.modelUrl = modelUrl;
820
877
  arviewer.isVertical = this.options.anchor === "vertical" ? true : false;
878
+ arviewer.banner = this.options.banner;
821
879
  if (sceneOpt.anchor === "vertical") {
822
880
  arviewer.isVertical = true;
823
881
  }
@@ -858,7 +916,7 @@ class SceneAR extends launcher_ar_1.LauncherAR {
858
916
  }
859
917
  exports.SceneAR = SceneAR;
860
918
 
861
- },{"../util/util":15,"../version":16,"../viewers/quicklook-viewer":18,"../viewers/reality-viewer":19,"../viewers/scene-viewer":20,"./launcher-ar":2,"@plattar/plattar-analytics":40,"@plattar/plattar-api":44,"@plattar/plattar-services":115}],7:[function(require,module,exports){
919
+ },{"../util/util":15,"../version":16,"../viewers/quicklook-viewer":18,"../viewers/scene-viewer":20,"./launcher-ar":2,"@plattar/plattar-analytics":40,"@plattar/plattar-api":44,"@plattar/plattar-services":115}],7:[function(require,module,exports){
862
920
  "use strict";
863
921
  Object.defineProperty(exports, "__esModule", { value: true });
864
922
  exports.SceneProductAR = void 0;
@@ -870,14 +928,15 @@ const util_1 = require("../util/util");
870
928
  * SceneProducts are much more convenient to grab from the Plattar CMS
871
929
  */
872
930
  class SceneProductAR extends product_ar_1.ProductAR {
873
- constructor(sceneProductID = null, variationID = null, variationSKU = null) {
874
- super(sceneProductID, variationID, variationSKU);
931
+ constructor(options) {
932
+ //super(sceneProductID, variationID, variationSKU);
933
+ super(options);
875
934
  // this is evaluated in the init() function
876
935
  this._attachedProductID = null;
877
- if (!sceneProductID) {
936
+ if (!options.productID) {
878
937
  throw new Error("SceneProductAR.constructor(sceneProductID, variationID) - sceneProductID must be defined");
879
938
  }
880
- this._sceneProductID = sceneProductID;
939
+ this._sceneProductID = options.productID;
881
940
  }
882
941
  get sceneProductID() {
883
942
  return this._sceneProductID;
@@ -986,6 +1045,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
986
1045
  this.parent.lockObserver();
987
1046
  this.parent.destroy();
988
1047
  this.setAttribute("product-id", product.scene_product_id);
1048
+ this.removeAttribute("scene-id");
989
1049
  this.parent.unlockObserver();
990
1050
  const controller = this.parent.create();
991
1051
  if (controller) {
@@ -1016,6 +1076,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1016
1076
  this.parent.lockObserver();
1017
1077
  this.parent.destroy();
1018
1078
  this.setAttribute("product-id", product.scene_product_id);
1079
+ this.removeAttribute("scene-id");
1019
1080
  this.parent.unlockObserver();
1020
1081
  const controller = this.parent.create();
1021
1082
  if (controller) {
@@ -1050,6 +1111,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1050
1111
  let dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID;
1051
1112
  const showAR = this.getAttribute("show-ar");
1052
1113
  const showUI = this.getAttribute("show-ui");
1114
+ const showBanner = this.getAttribute("show-ar-banner");
1053
1115
  if (showUI && showUI === "true") {
1054
1116
  dst = plattar_api_1.Server.location().base + "configurator/dist/index.html?scene_id=" + sceneID;
1055
1117
  }
@@ -1059,6 +1121,9 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1059
1121
  if (showAR) {
1060
1122
  dst += "&show_ar=" + showAR;
1061
1123
  }
1124
+ if (showBanner) {
1125
+ dst += "&show_ar_banner=" + showBanner;
1126
+ }
1062
1127
  viewer.setAttribute("url", opt.url || dst);
1063
1128
  this._state = plattar_controller_1.ControllerState.QRCode;
1064
1129
  this._prevQROpt = opt;
@@ -1087,6 +1152,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1087
1152
  this.parent.lockObserver();
1088
1153
  this.parent.destroy();
1089
1154
  this.setAttribute("product-id", product.scene_product_id);
1155
+ this.removeAttribute("scene-id");
1090
1156
  this.parent.unlockObserver();
1091
1157
  const controller = this.parent.create();
1092
1158
  if (controller) {
@@ -1143,6 +1209,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1143
1209
  this.parent.lockObserver();
1144
1210
  this.parent.destroy();
1145
1211
  this.setAttribute("product-id", product.scene_product_id);
1212
+ this.removeAttribute("scene-id");
1146
1213
  this.parent.unlockObserver();
1147
1214
  const controller = this.parent.create();
1148
1215
  if (controller) {
@@ -1174,7 +1241,13 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1174
1241
  const state = (await this.getConfiguratorState()).state;
1175
1242
  const first = state.first();
1176
1243
  if (first) {
1177
- const sceneProductAR = new scene_product_ar_1.SceneProductAR(first.scene_product_id, first.product_variation_id);
1244
+ //const sceneProductAR: SceneProductAR = new SceneProductAR(first.scene_product_id, first.product_variation_id);
1245
+ const sceneProductAR = new scene_product_ar_1.SceneProductAR({
1246
+ productID: first.scene_product_id,
1247
+ variationID: first.product_variation_id,
1248
+ variationSKU: null,
1249
+ useARBanner: this.getBooleanAttribute("show-ar-banner")
1250
+ });
1178
1251
  return sceneProductAR.init();
1179
1252
  }
1180
1253
  throw new Error("ConfiguratorController.initAR() - invalid decoded config-state does not have any product states");
@@ -1187,7 +1260,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1187
1260
  if (!sceneID) {
1188
1261
  throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
1189
1262
  }
1190
- const configAR = new configurator_ar_1.ConfiguratorAR(await this.getConfiguratorState());
1263
+ const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
1191
1264
  return configAR.init();
1192
1265
  }
1193
1266
  removeRenderer() {
@@ -1364,6 +1437,7 @@ class PlattarController {
1364
1437
  const variationID = this.getAttribute("variation-id");
1365
1438
  const variationSKU = this.getAttribute("variation-sku");
1366
1439
  const arMode = this.getAttribute("ar-mode");
1440
+ const showBanner = this.getAttribute("show-ar-banner");
1367
1441
  try {
1368
1442
  configState = (await this.getConfiguratorState()).state.encode();
1369
1443
  }
@@ -1395,6 +1469,9 @@ class PlattarController {
1395
1469
  if (sceneID) {
1396
1470
  dst += "&scene_id=" + sceneID;
1397
1471
  }
1472
+ if (showBanner) {
1473
+ dst += "&show_ar_banner=" + showBanner;
1474
+ }
1398
1475
  viewer.setAttribute("url", opt.url || dst);
1399
1476
  this._state = ControllerState.QRCode;
1400
1477
  this._prevQROpt = opt;
@@ -1419,6 +1496,14 @@ class PlattarController {
1419
1496
  getAttribute(attribute) {
1420
1497
  return this.parent ? (this.parent.hasAttribute(attribute) ? this.parent.getAttribute(attribute) : null) : null;
1421
1498
  }
1499
+ /**
1500
+ * Returns the specified attribute from the parent as a boolean
1501
+ * @param attribute - The name of the attribute
1502
+ * @returns - The attribute value
1503
+ */
1504
+ getBooleanAttribute(attribute) {
1505
+ return this.parent ? (this.parent.hasAttribute(attribute) ? (this.parent.getAttribute(attribute)?.toLowerCase() === "true" ? true : false) : false) : false;
1506
+ }
1422
1507
  /**
1423
1508
  * Sets a particular attribute into the HTML DOM
1424
1509
  *
@@ -1430,6 +1515,16 @@ class PlattarController {
1430
1515
  this.parent.setAttribute(attribute, value);
1431
1516
  }
1432
1517
  }
1518
+ /**
1519
+ * Removes a particular attribute from HTML DOM
1520
+ *
1521
+ * @param attribute - The name of the attribute
1522
+ */
1523
+ removeAttribute(attribute) {
1524
+ if (this.parent) {
1525
+ this.parent.removeAttribute(attribute);
1526
+ }
1527
+ }
1433
1528
  /**
1434
1529
  * Appends the provided element into the shadow-root of the parent element
1435
1530
  * @param element - The element to append
@@ -1563,6 +1658,7 @@ class ProductController extends plattar_controller_1.PlattarController {
1563
1658
  const variationID = this.getAttribute("variation-id");
1564
1659
  const variationSKU = this.getAttribute("variation-sku");
1565
1660
  const arMode = this.getAttribute("ar-mode");
1661
+ const showBanner = this.getAttribute("show-ar-banner");
1566
1662
  if (configState) {
1567
1663
  dst += "&config_state=" + configState;
1568
1664
  }
@@ -1587,6 +1683,9 @@ class ProductController extends plattar_controller_1.PlattarController {
1587
1683
  if (sceneID) {
1588
1684
  dst += "&scene_id=" + sceneID;
1589
1685
  }
1686
+ if (showBanner) {
1687
+ dst += "&show_ar_banner=" + showBanner;
1688
+ }
1590
1689
  viewer.setAttribute("url", opt.url || dst);
1591
1690
  viewer.onload = () => {
1592
1691
  return accept(viewer);
@@ -1645,7 +1744,13 @@ class ProductController extends plattar_controller_1.PlattarController {
1645
1744
  if (productID) {
1646
1745
  const variationID = this.getAttribute("variation-id");
1647
1746
  const variationSKU = this.getAttribute("variation-sku");
1648
- const product = new product_ar_1.ProductAR(productID, variationID, variationSKU);
1747
+ //const product: ProductAR = new ProductAR(productID, variationID, variationSKU);
1748
+ const product = new product_ar_1.ProductAR({
1749
+ productID: productID,
1750
+ variationID: variationID ? variationID : (variationSKU ? null : "default"),
1751
+ variationSKU: variationSKU,
1752
+ useARBanner: this.getBooleanAttribute("show-ar-banner")
1753
+ });
1649
1754
  return product.init().then(accept).catch(reject);
1650
1755
  }
1651
1756
  return reject(new Error("ProductController.initAR() - minimum required attributes not set, use product-id as a minimum"));
@@ -1878,7 +1983,12 @@ class VTOController extends plattar_controller_1.PlattarController {
1878
1983
  const state = (await this.getConfiguratorState()).state;
1879
1984
  const first = state.first();
1880
1985
  if (first) {
1881
- const sceneProductAR = new __1.SceneProductAR(first.scene_product_id, first.product_variation_id);
1986
+ const sceneProductAR = new __1.SceneProductAR({
1987
+ productID: first.scene_product_id,
1988
+ variationID: first.product_variation_id,
1989
+ variationSKU: null,
1990
+ useARBanner: this.getBooleanAttribute("show-ar-banner")
1991
+ });
1882
1992
  return sceneProductAR.init();
1883
1993
  }
1884
1994
  throw new Error("VTOController.initAR() - invalid decoded config-state does not have any product states");
@@ -1891,7 +2001,7 @@ class VTOController extends plattar_controller_1.PlattarController {
1891
2001
  if (!sceneID) {
1892
2002
  throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
1893
2003
  }
1894
- const configAR = new configurator_ar_1.ConfiguratorAR(await this.getConfiguratorState());
2004
+ const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
1895
2005
  return configAR.init();
1896
2006
  }
1897
2007
  removeRenderer() {
@@ -2135,6 +2245,22 @@ class PlattarEmbed extends HTMLElement {
2135
2245
  this._controller.onAttributesUpdated(attributeName);
2136
2246
  }
2137
2247
  }
2248
+ addEventListener(type, listener, options) {
2249
+ // add to the element event listener
2250
+ super.addEventListener(type, listener, options);
2251
+ const eventType = 'arclick';
2252
+ if (type === eventType) {
2253
+ // automatically enable `show-ar-banner` to true if an arclick event is added
2254
+ this.setAttribute('show-ar-banner', 'true');
2255
+ // if this is a redirect url from an AR Action - we need to fire the event listener now
2256
+ const url = new URL(location.href);
2257
+ if (url.searchParams.get('plattar_ar_action') === 'true') {
2258
+ setTimeout(() => {
2259
+ this.dispatchEvent(new Event(eventType));
2260
+ }, 200);
2261
+ }
2262
+ }
2263
+ }
2138
2264
  }
2139
2265
  exports.default = PlattarEmbed;
2140
2266
 
@@ -2693,32 +2819,32 @@ exports.Util = Util;
2693
2819
  },{}],16:[function(require,module,exports){
2694
2820
  "use strict";
2695
2821
  Object.defineProperty(exports, "__esModule", { value: true });
2696
- exports.default = "1.158.2";
2822
+ exports.default = "1.163.1";
2697
2823
 
2698
2824
  },{}],17:[function(require,module,exports){
2699
2825
  "use strict";
2700
2826
  Object.defineProperty(exports, "__esModule", { value: true });
2827
+ exports.ARViewer = void 0;
2701
2828
  class ARViewer {
2702
2829
  constructor() {
2703
2830
  this.modelUrl = null;
2704
- this.modelUrl = null;
2831
+ this.banner = null;
2832
+ }
2833
+ get composedActionURL() {
2834
+ const link = new URL(location.href);
2835
+ link.searchParams.set("plattar_ar_action", "true");
2836
+ return encodeURI(link.href);
2705
2837
  }
2706
2838
  }
2707
- exports.default = ARViewer;
2839
+ exports.ARViewer = ARViewer;
2708
2840
 
2709
2841
  },{}],18:[function(require,module,exports){
2710
2842
  "use strict";
2711
- var __importDefault = (this && this.__importDefault) || function (mod) {
2712
- return (mod && mod.__esModule) ? mod : { "default": mod };
2713
- };
2714
2843
  Object.defineProperty(exports, "__esModule", { value: true });
2715
- const ar_viewer_1 = __importDefault(require("./ar-viewer"));
2716
- class QuicklookViewer extends ar_viewer_1.default {
2844
+ const ar_viewer_1 = require("./ar-viewer");
2845
+ class QuicklookViewer extends ar_viewer_1.ARViewer {
2717
2846
  constructor() {
2718
2847
  super();
2719
- this.araction = null;
2720
- this.titleHTML = "&checkoutTitle=" + document.title + "&checkoutSubtitle=" + document.title;
2721
- this.arcallback = () => { };
2722
2848
  }
2723
2849
  get nodeType() {
2724
2850
  return "Quick Look";
@@ -2733,23 +2859,20 @@ class QuicklookViewer extends ar_viewer_1.default {
2733
2859
  const anchor = document.createElement("a");
2734
2860
  anchor.setAttribute("rel", "ar");
2735
2861
  anchor.appendChild(document.createElement("img"));
2862
+ const banner = this.banner;
2736
2863
  let url = this.modelUrl;
2737
- const araction = this.araction;
2738
- if (araction) {
2864
+ if (banner) {
2865
+ url += `#callToAction=${banner.button}`;
2866
+ url += `&checkoutTitle=${banner.title}`;
2867
+ url += `&checkoutSubtitle=${banner.subtitle}`;
2739
2868
  const handleQuicklook = (event) => {
2740
2869
  if (event.data === "_apple_ar_quicklook_button_tapped") {
2741
- this.arcallback();
2870
+ window.location.assign(this.composedActionURL);
2742
2871
  }
2743
- document.body.removeChild(anchor);
2744
- anchor.removeEventListener("message", handleQuicklook, false);
2745
2872
  };
2746
2873
  anchor.addEventListener("message", handleQuicklook, false);
2747
- document.body.appendChild(anchor);
2748
- url += "#callToAction=" + araction;
2749
- if (this.titleHTML) {
2750
- url += this.titleHTML;
2751
- }
2752
2874
  }
2875
+ document.body.appendChild(anchor);
2753
2876
  anchor.setAttribute("href", encodeURI(url));
2754
2877
  anchor.click();
2755
2878
  }
@@ -2758,12 +2881,9 @@ exports.default = QuicklookViewer;
2758
2881
 
2759
2882
  },{"./ar-viewer":17}],19:[function(require,module,exports){
2760
2883
  "use strict";
2761
- var __importDefault = (this && this.__importDefault) || function (mod) {
2762
- return (mod && mod.__esModule) ? mod : { "default": mod };
2763
- };
2764
2884
  Object.defineProperty(exports, "__esModule", { value: true });
2765
- const ar_viewer_1 = __importDefault(require("./ar-viewer"));
2766
- class RealityViewer extends ar_viewer_1.default {
2885
+ const ar_viewer_1 = require("./ar-viewer");
2886
+ class RealityViewer extends ar_viewer_1.ARViewer {
2767
2887
  constructor() {
2768
2888
  super();
2769
2889
  }
@@ -2788,17 +2908,12 @@ exports.default = RealityViewer;
2788
2908
 
2789
2909
  },{"./ar-viewer":17}],20:[function(require,module,exports){
2790
2910
  "use strict";
2791
- var __importDefault = (this && this.__importDefault) || function (mod) {
2792
- return (mod && mod.__esModule) ? mod : { "default": mod };
2793
- };
2794
2911
  Object.defineProperty(exports, "__esModule", { value: true });
2795
- const ar_viewer_1 = __importDefault(require("./ar-viewer"));
2796
- class SceneViewer extends ar_viewer_1.default {
2912
+ const ar_viewer_1 = require("./ar-viewer");
2913
+ class SceneViewer extends ar_viewer_1.ARViewer {
2797
2914
  constructor() {
2798
2915
  super();
2799
- this.araction = null;
2800
2916
  this.isVertical = false;
2801
- this.titleHTML = "<b>" + document.title;
2802
2917
  this.isVertical = false;
2803
2918
  }
2804
2919
  get nodeType() {
@@ -2811,27 +2926,18 @@ class SceneViewer extends ar_viewer_1.default {
2811
2926
  if (!this.modelUrl) {
2812
2927
  throw new Error("SceneViewer.start() - model url not set, use SceneViewer.modelUrl");
2813
2928
  }
2814
- const araction = this.araction;
2815
- let composedLink = encodeURIComponent(location.href);
2816
- if (araction) {
2817
- const link = new URL(location.href);
2818
- link.searchParams.set("araction", araction);
2819
- composedLink = encodeURIComponent(link.href);
2820
- }
2821
- if (!composedLink) {
2822
- throw new Error("SceneViewer.start() - failed to create composition link, check parameters");
2823
- }
2824
- const linkOverride = encodeURIComponent(location.href + '#no-ar-fallback');
2825
- let intent = 'intent://arvr.google.com/scene-viewer/1.1';
2826
- intent += '?file=' + this.modelUrl;
2827
- intent += '&mode=ar_preferred';
2828
- intent += '&link=' + composedLink;
2829
- intent += '&title=<b>' + this.titleHTML;
2929
+ const linkOverride = encodeURIComponent(`${location.href}#no-ar-fallback`);
2930
+ let intent = `intent://arvr.google.com/scene-viewer/1.1?file=${this.modelUrl}&mode=ar_preferred`;
2931
+ const banner = this.banner;
2932
+ if (banner) {
2933
+ intent += `&title=<b>${banner.title}</b><br>${banner.subtitle}`;
2934
+ intent += `&link=${this.composedActionURL}`;
2935
+ }
2830
2936
  if (this.isVertical) {
2831
2937
  intent += '&enable_vertical_placement=true';
2832
2938
  }
2833
2939
  intent += ' #Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;';
2834
- intent += 'S.browser_fallback_url=' + linkOverride + ';end;';
2940
+ intent += `S.browser_fallback_url=${linkOverride};end;`;
2835
2941
  const anchor = document.createElement("a");
2836
2942
  anchor.setAttribute("href", intent);
2837
2943
  anchor.click();
@@ -5293,7 +5399,7 @@ PlattarServer.match = (serverName) => {
5293
5399
  api_read: "https://localhost:3000/v3/",
5294
5400
  api_write: "https://localhost:3000/v3/",
5295
5401
  cdn: "https://cdn-dev.plattar.space/",
5296
- cdn_image: "https://images-dev.plattar.space/'",
5402
+ cdn_image: "https://images-dev.plattar.space/",
5297
5403
  analytics: "https://localhost:3000/api/v2/analytics/",
5298
5404
  type: "dev"
5299
5405
  }
@@ -6508,7 +6614,7 @@ PlattarUtil.match = (type) => {
6508
6614
 
6509
6615
  module.exports = PlattarUtil;
6510
6616
  },{"../types/application.js":47,"../types/content-pipeline/brief.js":48,"../types/content-pipeline/comment-brief.js":49,"../types/content-pipeline/comment-quote.js":50,"../types/content-pipeline/comment-solution.js":51,"../types/content-pipeline/folder.js":52,"../types/content-pipeline/pipeline-user.js":53,"../types/content-pipeline/quote.js":54,"../types/content-pipeline/rating.js":55,"../types/content-pipeline/solution.js":56,"../types/file/file-audio.js":57,"../types/file/file-image.js":59,"../types/file/file-model.js":60,"../types/file/file-script.js":61,"../types/file/file-video.js":62,"../types/interfaces/plattar-object.js":65,"../types/misc/application-build.js":66,"../types/misc/asset-library":67,"../types/misc/async-job.js":68,"../types/misc/script-event.js":69,"../types/misc/tag.js":70,"../types/page/card-button.js":72,"../types/page/card-html.js":73,"../types/page/card-iframe.js":74,"../types/page/card-image.js":75,"../types/page/card-map.js":76,"../types/page/card-paragraph.js":77,"../types/page/card-row.js":78,"../types/page/card-slider.js":79,"../types/page/card-title.js":80,"../types/page/card-video.js":81,"../types/page/card-youtube.js":82,"../types/page/page.js":83,"../types/product/product-annotation.js":84,"../types/product/product-variation.js":86,"../types/product/product.js":87,"../types/scene/scene-annotation.js":88,"../types/scene/scene-audio.js":89,"../types/scene/scene-button.js":91,"../types/scene/scene-camera.js":92,"../types/scene/scene-carousel.js":93,"../types/scene/scene-image.js":94,"../types/scene/scene-model.js":95,"../types/scene/scene-panorama.js":96,"../types/scene/scene-poller.js":97,"../types/scene/scene-product.js":98,"../types/scene/scene-script.js":99,"../types/scene/scene-shadow.js":100,"../types/scene/scene-video.js":101,"../types/scene/scene-volumetric.js":102,"../types/scene/scene-youtube.js":103,"../types/scene/scene.js":104,"../types/trigger/trigger-image.js":105}],107:[function(require,module,exports){
6511
- module.exports = "1.154.1";
6617
+ module.exports = "1.159.1";
6512
6618
 
6513
6619
  },{}],108:[function(require,module,exports){
6514
6620
  const QRCodeStyling = require("qr-code-styling");
@@ -6724,7 +6830,7 @@ class BaseElement extends HTMLElement {
6724
6830
 
6725
6831
  this._UpdateCanvas(width, height);
6726
6832
 
6727
- div.style.display = "block";
6833
+ div.style.display = "flex";
6728
6834
 
6729
6835
  return;
6730
6836
  }
@@ -6818,7 +6924,7 @@ module.exports = {
6818
6924
  version: Version
6819
6925
  };
6820
6926
  },{"./elements/qrcode-element.js":109,"./version":111}],111:[function(require,module,exports){
6821
- module.exports = "1.150.2";
6927
+ module.exports = "1.160.1";
6822
6928
 
6823
6929
  },{}],112:[function(require,module,exports){
6824
6930
  "use strict";