@plattar/plattar-ar-adapter 1.119.1 → 1.120.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.
@@ -134,7 +134,7 @@ class ProductAR extends launcher_ar_1.LauncherAR {
134
134
  this._setupAnalytics(product, variation);
135
135
  // we need to define our AR module here
136
136
  // we are in Safari/Quicklook mode here
137
- if (util_1.Util.isSafari()) {
137
+ if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
138
138
  // model needs to have either USDZ or REALITY files defined
139
139
  // we load REALITY stuff first if available
140
140
  if (model.attributes.reality_filename && util_1.Util.canRealityViewer()) {
@@ -489,18 +489,20 @@ exports.Util = void 0;
489
489
  */
490
490
  class Util {
491
491
  static canAugment() {
492
- if (/Macintosh|iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
492
+ const userAgent = navigator.userAgent;
493
+ // test google chrome on IOS and standard IOS test
494
+ if ((/CriOS/i.test(userAgent) || /Macintosh|iPad|iPhone|iPod/.test(userAgent)) && !window.MSStream) {
493
495
  // inside facebook browser
494
- if (/\bFB[\w_]+\//.test(navigator.userAgent)) {
496
+ if (/\bFB[\w_]+\//.test(userAgent)) {
495
497
  return false;
496
498
  }
497
499
  // inside instagram browser
498
- if (/\bInstagram/i.test(navigator.userAgent)) {
500
+ if (/\bInstagram/i.test(userAgent)) {
499
501
  return false;
500
502
  }
501
503
  return Util.canQuicklook();
502
504
  }
503
- else if (/android/i.test(navigator.userAgent)) {
505
+ else if (/android/i.test(userAgent)) {
504
506
  return true;
505
507
  }
506
508
  return false;
@@ -533,6 +535,13 @@ class Util {
533
535
  }
534
536
  return false;
535
537
  }
538
+ static isChromeOnIOS() {
539
+ const userAgent = navigator.userAgent;
540
+ if (userAgent) {
541
+ return Util.canAugment() && /CriOS/i.test(userAgent);
542
+ }
543
+ return false;
544
+ }
536
545
  static getIOSVersion() {
537
546
  if (/iP(hone|od|ad)/.test(navigator.platform)) {
538
547
  const v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
@@ -561,7 +570,7 @@ exports.Util = Util;
561
570
  },{}],8:[function(require,module,exports){
562
571
  "use strict";
563
572
  Object.defineProperty(exports, "__esModule", { value: true });
564
- exports.default = "1.119.1";
573
+ exports.default = "1.120.1";
565
574
 
566
575
  },{}],9:[function(require,module,exports){
567
576
  "use strict";
@@ -2886,7 +2895,7 @@ PlattarServer.match = (serverName) => {
2886
2895
  api_read: "https://staging.plattar.space/api/v2/",
2887
2896
  api_write: "https://cms.plattar.space/api/v2/",
2888
2897
  cdn: "https://cdn-staging.plattar.space/",
2889
- cdn_image: "http://plattar-staging.s3-website-ap-southeast-2.amazonaws.com/",
2898
+ cdn_image: "https://images.plattar.space/",
2890
2899
  analytics: "https://c.plattar.space/api/v2/analytics",
2891
2900
  type: "staging"
2892
2901
  }
@@ -2899,7 +2908,7 @@ PlattarServer.match = (serverName) => {
2899
2908
  api_read: "https://app.plattar.com/api/v2/",
2900
2909
  api_write: "https://cms.plattar.com/api/v2/",
2901
2910
  cdn: "https://cdn.plattar.com/",
2902
- cdn_image: "http://plattar-production.s3-website-ap-southeast-2.amazonaws.com/",
2911
+ cdn_image: "https://images.plattar.com/",
2903
2912
  analytics: "https://c.plattar.space/api/v2/analytics",
2904
2913
  type: "production"
2905
2914
  }
@@ -2914,7 +2923,7 @@ PlattarServer.match = (serverName) => {
2914
2923
  api_read: "https://localhost/api/v2/",
2915
2924
  api_write: "https://localhost/api/v2/",
2916
2925
  cdn: "https://cdn-dev.plattar.space/",
2917
- cdn_image: "http://plattar-dev.s3-website-ap-southeast-2.amazonaws.com/",
2926
+ cdn_image: "https://images-dev.plattar.space/'",
2918
2927
  analytics: "https://localhost:3000/api/v2/analytics/",
2919
2928
  type: "dev"
2920
2929
  }
@@ -4129,7 +4138,7 @@ PlattarUtil.match = (type) => {
4129
4138
 
4130
4139
  module.exports = PlattarUtil;
4131
4140
  },{"../types/application.js":37,"../types/content-pipeline/brief.js":38,"../types/content-pipeline/comment-brief.js":39,"../types/content-pipeline/comment-quote.js":40,"../types/content-pipeline/comment-solution.js":41,"../types/content-pipeline/folder.js":42,"../types/content-pipeline/pipeline-user.js":43,"../types/content-pipeline/quote.js":44,"../types/content-pipeline/rating.js":45,"../types/content-pipeline/solution.js":46,"../types/file/file-audio.js":47,"../types/file/file-image.js":49,"../types/file/file-model.js":50,"../types/file/file-script.js":51,"../types/file/file-video.js":52,"../types/interfaces/plattar-object.js":55,"../types/misc/application-build.js":56,"../types/misc/asset-library":57,"../types/misc/async-job.js":58,"../types/misc/script-event.js":59,"../types/misc/tag.js":60,"../types/page/card-button.js":62,"../types/page/card-html.js":63,"../types/page/card-iframe.js":64,"../types/page/card-image.js":65,"../types/page/card-map.js":66,"../types/page/card-paragraph.js":67,"../types/page/card-row.js":68,"../types/page/card-slider.js":69,"../types/page/card-title.js":70,"../types/page/card-video.js":71,"../types/page/card-youtube.js":72,"../types/page/page.js":73,"../types/product/product-annotation.js":74,"../types/product/product-variation.js":76,"../types/product/product.js":77,"../types/scene/scene-annotation.js":78,"../types/scene/scene-audio.js":79,"../types/scene/scene-button.js":81,"../types/scene/scene-camera.js":82,"../types/scene/scene-carousel.js":83,"../types/scene/scene-image.js":84,"../types/scene/scene-model.js":85,"../types/scene/scene-panorama.js":86,"../types/scene/scene-poller.js":87,"../types/scene/scene-product.js":88,"../types/scene/scene-script.js":89,"../types/scene/scene-shadow.js":90,"../types/scene/scene-video.js":91,"../types/scene/scene-volumetric.js":92,"../types/scene/scene-youtube.js":93,"../types/scene/scene.js":94,"../types/trigger/trigger-image.js":95}],97:[function(require,module,exports){
4132
- module.exports = "1.118.1";
4141
+ module.exports = "1.120.1";
4133
4142
 
4134
4143
  },{}],98:[function(require,module,exports){
4135
4144
  const QRCodeStyling = require("qr-code-styling");
@@ -4143,6 +4152,20 @@ class BaseElement extends HTMLElement {
4143
4152
  if (this.hasAttribute("url")) {
4144
4153
  this.renderQRCode();
4145
4154
  }
4155
+
4156
+ const observer = new MutationObserver((mutations) => {
4157
+ mutations.forEach((mutation) => {
4158
+ if (mutation.type === "attributes") {
4159
+ if (this.hasAttribute("url")) {
4160
+ this.renderQRCode();
4161
+ }
4162
+ }
4163
+ });
4164
+ });
4165
+
4166
+ observer.observe(this, {
4167
+ attributes: true
4168
+ });
4146
4169
  }
4147
4170
 
4148
4171
  download(options) {
@@ -4160,7 +4183,8 @@ class BaseElement extends HTMLElement {
4160
4183
  const url = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
4161
4184
 
4162
4185
  if (!url) {
4163
- throw new Error("BaseElement.renderQRCode() - required attribute \"url\" is missing or invalid");
4186
+ console.warn("PlattarQR.renderQRCode() - required attribute \"url\" is missing or invalid, QR Code will not render");
4187
+ return;
4164
4188
  }
4165
4189
 
4166
4190
  const width = this.hasAttribute("width") ? parseInt(this.getAttribute("width")) : 512;
@@ -4239,11 +4263,12 @@ class BaseElement extends HTMLElement {
4239
4263
  color2: "#ffffff",
4240
4264
  rotation: "0"
4241
4265
  }
4242
- }
4266
+ },
4267
+ width: 1024,
4268
+ height: 1024,
4269
+ type: "canvas"
4243
4270
  };
4244
4271
 
4245
- this._options.width = 2048;
4246
- this._options.height = 2048;
4247
4272
  this._options.data = url;
4248
4273
  this._options.margin = margin;
4249
4274
  this._options.image = image;
@@ -4268,25 +4293,40 @@ class BaseElement extends HTMLElement {
4268
4293
 
4269
4294
  if (!qrCode) {
4270
4295
  const div = document.createElement("div");
4271
- div.style.width = width + "px";
4272
- div.style.height = height + "px";
4273
-
4274
4296
  shadow.appendChild(div);
4275
4297
 
4298
+ this._divContainer = div;
4276
4299
  this._qrCode = new QRCodeStyling(this._options);
4277
4300
  this._qrCode.append(div);
4278
4301
 
4279
- const canvas = this._qrCode._canvas;
4280
-
4281
- if (canvas) {
4282
- canvas.style.width = "100%";
4283
- canvas.style.height = "100%";
4284
- }
4302
+ this._UpdateCanvas(width, height);
4285
4303
 
4286
4304
  return;
4287
4305
  }
4288
4306
 
4289
4307
  this._qrCode.update(this._options);
4308
+
4309
+ this._UpdateCanvas(width, height);
4310
+ }
4311
+
4312
+ _UpdateCanvas(width, height) {
4313
+ if (!this._qrCode) {
4314
+ return;
4315
+ }
4316
+
4317
+ const canvas = this._qrCode._canvas;
4318
+
4319
+ if (canvas) {
4320
+ canvas.style.width = "100%";
4321
+ canvas.style.height = "100%";
4322
+ }
4323
+
4324
+ if (this._divContainer) {
4325
+ const div = this._divContainer;
4326
+
4327
+ div.style.width = width + "px";
4328
+ div.style.height = height + "px";
4329
+ }
4290
4330
  }
4291
4331
  }
4292
4332
 
@@ -4314,7 +4354,7 @@ module.exports = {
4314
4354
  version: Version
4315
4355
  };
4316
4356
  },{"./elements/qrcode-element.js":99,"./version":101}],101:[function(require,module,exports){
4317
- module.exports = "1.119.1";
4357
+ module.exports = "1.120.3";
4318
4358
 
4319
4359
  },{}],102:[function(require,module,exports){
4320
4360
  const ElementController = require("../controllers/element-controller");