@plattar/plattar-ar-adapter 1.158.3 → 1.163.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/build/es2015/plattar-ar-adapter.js +513 -293
  2. package/build/es2015/plattar-ar-adapter.min.js +1 -1
  3. package/build/es2019/plattar-ar-adapter.js +192 -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 +12 -2
  20. package/dist/embed/controllers/plattar-controller.d.ts +6 -0
  21. package/dist/embed/controllers/plattar-controller.js +12 -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;
@@ -1052,6 +1111,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1052
1111
  let dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID;
1053
1112
  const showAR = this.getAttribute("show-ar");
1054
1113
  const showUI = this.getAttribute("show-ui");
1114
+ const showBanner = this.getAttribute("show-ar-banner");
1055
1115
  if (showUI && showUI === "true") {
1056
1116
  dst = plattar_api_1.Server.location().base + "configurator/dist/index.html?scene_id=" + sceneID;
1057
1117
  }
@@ -1061,6 +1121,9 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1061
1121
  if (showAR) {
1062
1122
  dst += "&show_ar=" + showAR;
1063
1123
  }
1124
+ if (showBanner) {
1125
+ dst += "&show_ar_banner=" + showBanner;
1126
+ }
1064
1127
  viewer.setAttribute("url", opt.url || dst);
1065
1128
  this._state = plattar_controller_1.ControllerState.QRCode;
1066
1129
  this._prevQROpt = opt;
@@ -1178,7 +1241,13 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1178
1241
  const state = (await this.getConfiguratorState()).state;
1179
1242
  const first = state.first();
1180
1243
  if (first) {
1181
- 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
+ });
1182
1251
  return sceneProductAR.init();
1183
1252
  }
1184
1253
  throw new Error("ConfiguratorController.initAR() - invalid decoded config-state does not have any product states");
@@ -1191,7 +1260,7 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1191
1260
  if (!sceneID) {
1192
1261
  throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
1193
1262
  }
1194
- 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") });
1195
1264
  return configAR.init();
1196
1265
  }
1197
1266
  removeRenderer() {
@@ -1368,6 +1437,7 @@ class PlattarController {
1368
1437
  const variationID = this.getAttribute("variation-id");
1369
1438
  const variationSKU = this.getAttribute("variation-sku");
1370
1439
  const arMode = this.getAttribute("ar-mode");
1440
+ const showBanner = this.getAttribute("show-ar-banner");
1371
1441
  try {
1372
1442
  configState = (await this.getConfiguratorState()).state.encode();
1373
1443
  }
@@ -1399,6 +1469,9 @@ class PlattarController {
1399
1469
  if (sceneID) {
1400
1470
  dst += "&scene_id=" + sceneID;
1401
1471
  }
1472
+ if (showBanner) {
1473
+ dst += "&show_ar_banner=" + showBanner;
1474
+ }
1402
1475
  viewer.setAttribute("url", opt.url || dst);
1403
1476
  this._state = ControllerState.QRCode;
1404
1477
  this._prevQROpt = opt;
@@ -1423,6 +1496,14 @@ class PlattarController {
1423
1496
  getAttribute(attribute) {
1424
1497
  return this.parent ? (this.parent.hasAttribute(attribute) ? this.parent.getAttribute(attribute) : null) : null;
1425
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
+ }
1426
1507
  /**
1427
1508
  * Sets a particular attribute into the HTML DOM
1428
1509
  *
@@ -1577,6 +1658,7 @@ class ProductController extends plattar_controller_1.PlattarController {
1577
1658
  const variationID = this.getAttribute("variation-id");
1578
1659
  const variationSKU = this.getAttribute("variation-sku");
1579
1660
  const arMode = this.getAttribute("ar-mode");
1661
+ const showBanner = this.getAttribute("show-ar-banner");
1580
1662
  if (configState) {
1581
1663
  dst += "&config_state=" + configState;
1582
1664
  }
@@ -1601,6 +1683,9 @@ class ProductController extends plattar_controller_1.PlattarController {
1601
1683
  if (sceneID) {
1602
1684
  dst += "&scene_id=" + sceneID;
1603
1685
  }
1686
+ if (showBanner) {
1687
+ dst += "&show_ar_banner=" + showBanner;
1688
+ }
1604
1689
  viewer.setAttribute("url", opt.url || dst);
1605
1690
  viewer.onload = () => {
1606
1691
  return accept(viewer);
@@ -1659,7 +1744,13 @@ class ProductController extends plattar_controller_1.PlattarController {
1659
1744
  if (productID) {
1660
1745
  const variationID = this.getAttribute("variation-id");
1661
1746
  const variationSKU = this.getAttribute("variation-sku");
1662
- 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
+ });
1663
1754
  return product.init().then(accept).catch(reject);
1664
1755
  }
1665
1756
  return reject(new Error("ProductController.initAR() - minimum required attributes not set, use product-id as a minimum"));
@@ -1892,7 +1983,12 @@ class VTOController extends plattar_controller_1.PlattarController {
1892
1983
  const state = (await this.getConfiguratorState()).state;
1893
1984
  const first = state.first();
1894
1985
  if (first) {
1895
- 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
+ });
1896
1992
  return sceneProductAR.init();
1897
1993
  }
1898
1994
  throw new Error("VTOController.initAR() - invalid decoded config-state does not have any product states");
@@ -1905,7 +2001,7 @@ class VTOController extends plattar_controller_1.PlattarController {
1905
2001
  if (!sceneID) {
1906
2002
  throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
1907
2003
  }
1908
- 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") });
1909
2005
  return configAR.init();
1910
2006
  }
1911
2007
  removeRenderer() {
@@ -2149,6 +2245,22 @@ class PlattarEmbed extends HTMLElement {
2149
2245
  this._controller.onAttributesUpdated(attributeName);
2150
2246
  }
2151
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
+ }
2152
2264
  }
2153
2265
  exports.default = PlattarEmbed;
2154
2266
 
@@ -2707,32 +2819,32 @@ exports.Util = Util;
2707
2819
  },{}],16:[function(require,module,exports){
2708
2820
  "use strict";
2709
2821
  Object.defineProperty(exports, "__esModule", { value: true });
2710
- exports.default = "1.158.3";
2822
+ exports.default = "1.163.2";
2711
2823
 
2712
2824
  },{}],17:[function(require,module,exports){
2713
2825
  "use strict";
2714
2826
  Object.defineProperty(exports, "__esModule", { value: true });
2827
+ exports.ARViewer = void 0;
2715
2828
  class ARViewer {
2716
2829
  constructor() {
2717
2830
  this.modelUrl = null;
2718
- 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);
2719
2837
  }
2720
2838
  }
2721
- exports.default = ARViewer;
2839
+ exports.ARViewer = ARViewer;
2722
2840
 
2723
2841
  },{}],18:[function(require,module,exports){
2724
2842
  "use strict";
2725
- var __importDefault = (this && this.__importDefault) || function (mod) {
2726
- return (mod && mod.__esModule) ? mod : { "default": mod };
2727
- };
2728
2843
  Object.defineProperty(exports, "__esModule", { value: true });
2729
- const ar_viewer_1 = __importDefault(require("./ar-viewer"));
2730
- class QuicklookViewer extends ar_viewer_1.default {
2844
+ const ar_viewer_1 = require("./ar-viewer");
2845
+ class QuicklookViewer extends ar_viewer_1.ARViewer {
2731
2846
  constructor() {
2732
2847
  super();
2733
- this.araction = null;
2734
- this.titleHTML = "&checkoutTitle=" + document.title + "&checkoutSubtitle=" + document.title;
2735
- this.arcallback = () => { };
2736
2848
  }
2737
2849
  get nodeType() {
2738
2850
  return "Quick Look";
@@ -2747,23 +2859,20 @@ class QuicklookViewer extends ar_viewer_1.default {
2747
2859
  const anchor = document.createElement("a");
2748
2860
  anchor.setAttribute("rel", "ar");
2749
2861
  anchor.appendChild(document.createElement("img"));
2862
+ const banner = this.banner;
2750
2863
  let url = this.modelUrl;
2751
- const araction = this.araction;
2752
- if (araction) {
2864
+ if (banner) {
2865
+ url += `#callToAction=${banner.button}`;
2866
+ url += `&checkoutTitle=${banner.title}`;
2867
+ url += `&checkoutSubtitle=${banner.subtitle}`;
2753
2868
  const handleQuicklook = (event) => {
2754
2869
  if (event.data === "_apple_ar_quicklook_button_tapped") {
2755
- this.arcallback();
2870
+ window.location.assign(this.composedActionURL);
2756
2871
  }
2757
- document.body.removeChild(anchor);
2758
- anchor.removeEventListener("message", handleQuicklook, false);
2759
2872
  };
2760
2873
  anchor.addEventListener("message", handleQuicklook, false);
2761
- document.body.appendChild(anchor);
2762
- url += "#callToAction=" + araction;
2763
- if (this.titleHTML) {
2764
- url += this.titleHTML;
2765
- }
2766
2874
  }
2875
+ document.body.appendChild(anchor);
2767
2876
  anchor.setAttribute("href", encodeURI(url));
2768
2877
  anchor.click();
2769
2878
  }
@@ -2772,12 +2881,9 @@ exports.default = QuicklookViewer;
2772
2881
 
2773
2882
  },{"./ar-viewer":17}],19:[function(require,module,exports){
2774
2883
  "use strict";
2775
- var __importDefault = (this && this.__importDefault) || function (mod) {
2776
- return (mod && mod.__esModule) ? mod : { "default": mod };
2777
- };
2778
2884
  Object.defineProperty(exports, "__esModule", { value: true });
2779
- const ar_viewer_1 = __importDefault(require("./ar-viewer"));
2780
- class RealityViewer extends ar_viewer_1.default {
2885
+ const ar_viewer_1 = require("./ar-viewer");
2886
+ class RealityViewer extends ar_viewer_1.ARViewer {
2781
2887
  constructor() {
2782
2888
  super();
2783
2889
  }
@@ -2802,17 +2908,12 @@ exports.default = RealityViewer;
2802
2908
 
2803
2909
  },{"./ar-viewer":17}],20:[function(require,module,exports){
2804
2910
  "use strict";
2805
- var __importDefault = (this && this.__importDefault) || function (mod) {
2806
- return (mod && mod.__esModule) ? mod : { "default": mod };
2807
- };
2808
2911
  Object.defineProperty(exports, "__esModule", { value: true });
2809
- const ar_viewer_1 = __importDefault(require("./ar-viewer"));
2810
- class SceneViewer extends ar_viewer_1.default {
2912
+ const ar_viewer_1 = require("./ar-viewer");
2913
+ class SceneViewer extends ar_viewer_1.ARViewer {
2811
2914
  constructor() {
2812
2915
  super();
2813
- this.araction = null;
2814
2916
  this.isVertical = false;
2815
- this.titleHTML = "<b>" + document.title;
2816
2917
  this.isVertical = false;
2817
2918
  }
2818
2919
  get nodeType() {
@@ -2825,27 +2926,18 @@ class SceneViewer extends ar_viewer_1.default {
2825
2926
  if (!this.modelUrl) {
2826
2927
  throw new Error("SceneViewer.start() - model url not set, use SceneViewer.modelUrl");
2827
2928
  }
2828
- const araction = this.araction;
2829
- let composedLink = encodeURIComponent(location.href);
2830
- if (araction) {
2831
- const link = new URL(location.href);
2832
- link.searchParams.set("araction", araction);
2833
- composedLink = encodeURIComponent(link.href);
2834
- }
2835
- if (!composedLink) {
2836
- throw new Error("SceneViewer.start() - failed to create composition link, check parameters");
2837
- }
2838
- const linkOverride = encodeURIComponent(location.href + '#no-ar-fallback');
2839
- let intent = 'intent://arvr.google.com/scene-viewer/1.1';
2840
- intent += '?file=' + this.modelUrl;
2841
- intent += '&mode=ar_preferred';
2842
- intent += '&link=' + composedLink;
2843
- 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
+ }
2844
2936
  if (this.isVertical) {
2845
2937
  intent += '&enable_vertical_placement=true';
2846
2938
  }
2847
2939
  intent += ' #Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;';
2848
- intent += 'S.browser_fallback_url=' + linkOverride + ';end;';
2940
+ intent += `S.browser_fallback_url=${linkOverride};end;`;
2849
2941
  const anchor = document.createElement("a");
2850
2942
  anchor.setAttribute("href", intent);
2851
2943
  anchor.click();
@@ -5307,7 +5399,7 @@ PlattarServer.match = (serverName) => {
5307
5399
  api_read: "https://localhost:3000/v3/",
5308
5400
  api_write: "https://localhost:3000/v3/",
5309
5401
  cdn: "https://cdn-dev.plattar.space/",
5310
- cdn_image: "https://images-dev.plattar.space/'",
5402
+ cdn_image: "https://images-dev.plattar.space/",
5311
5403
  analytics: "https://localhost:3000/api/v2/analytics/",
5312
5404
  type: "dev"
5313
5405
  }
@@ -6522,7 +6614,7 @@ PlattarUtil.match = (type) => {
6522
6614
 
6523
6615
  module.exports = PlattarUtil;
6524
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){
6525
- module.exports = "1.154.1";
6617
+ module.exports = "1.159.1";
6526
6618
 
6527
6619
  },{}],108:[function(require,module,exports){
6528
6620
  const QRCodeStyling = require("qr-code-styling");
@@ -6738,7 +6830,7 @@ class BaseElement extends HTMLElement {
6738
6830
 
6739
6831
  this._UpdateCanvas(width, height);
6740
6832
 
6741
- div.style.display = "block";
6833
+ div.style.display = "flex";
6742
6834
 
6743
6835
  return;
6744
6836
  }
@@ -6832,7 +6924,7 @@ module.exports = {
6832
6924
  version: Version
6833
6925
  };
6834
6926
  },{"./elements/qrcode-element.js":109,"./version":111}],111:[function(require,module,exports){
6835
- module.exports = "1.150.2";
6927
+ module.exports = "1.160.1";
6836
6928
 
6837
6929
  },{}],112:[function(require,module,exports){
6838
6930
  "use strict";