@auxilium/datalynk-client 1.3.18 → 1.3.19

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/dist/index.cjs CHANGED
@@ -2345,6 +2345,37 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2345
2345
  __publicField(this, "nativeInstallPrompt", null);
2346
2346
  /** Resolved icon URL used for prompt + manifest */
2347
2347
  __publicField(this, "resolvedIconUrl", "https://datalynk-client.primary.auxilium.world/logo.png");
2348
+ /** Resolved manifest icons (prefer true 192/512 PNG data URLs) */
2349
+ __publicField(this, "resolvedManifestIcons", []);
2350
+ __publicField(this, "createSizedPng", async (url, size) => {
2351
+ if (this.headless || !url) return null;
2352
+ try {
2353
+ const img = await new Promise((res, rej) => {
2354
+ const el = new Image();
2355
+ const t = setTimeout(() => rej(new Error("icon-timeout")), 3500);
2356
+ el.crossOrigin = "anonymous";
2357
+ el.onload = () => {
2358
+ clearTimeout(t);
2359
+ res(el);
2360
+ };
2361
+ el.onerror = () => {
2362
+ clearTimeout(t);
2363
+ rej(new Error("icon-load-failed"));
2364
+ };
2365
+ el.src = url;
2366
+ });
2367
+ const canvas = document.createElement("canvas");
2368
+ canvas.width = size;
2369
+ canvas.height = size;
2370
+ const ctx = canvas.getContext("2d");
2371
+ if (!ctx) return null;
2372
+ ctx.clearRect(0, 0, size, size);
2373
+ ctx.drawImage(img, 0, 0, size, size);
2374
+ return canvas.toDataURL("image/png");
2375
+ } catch {
2376
+ return null;
2377
+ }
2378
+ });
2348
2379
  this.api = api;
2349
2380
  }
2350
2381
  get headless() {
@@ -2442,6 +2473,22 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2442
2473
  if (!ok) iconUrl = defaultIcon;
2443
2474
  }
2444
2475
  this.resolvedIconUrl = iconUrl;
2476
+ let icon192 = await this.createSizedPng(this.resolvedIconUrl, 192);
2477
+ let icon512 = await this.createSizedPng(this.resolvedIconUrl, 512);
2478
+ if ((!icon192 || !icon512) && this.resolvedIconUrl !== defaultIcon) {
2479
+ this.resolvedIconUrl = defaultIcon;
2480
+ icon192 = await this.createSizedPng(this.resolvedIconUrl, 192);
2481
+ icon512 = await this.createSizedPng(this.resolvedIconUrl, 512);
2482
+ }
2483
+ this.resolvedManifestIcons = icon192 && icon512 ? [
2484
+ { src: icon192, sizes: "192x192", type: "image/png", purpose: "any" },
2485
+ { src: icon512, sizes: "512x512", type: "image/png", purpose: "any" },
2486
+ { src: icon512, sizes: "512x512", type: "image/png", purpose: "maskable" }
2487
+ ] : [
2488
+ { src: this.resolvedIconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
2489
+ { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
2490
+ { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
2491
+ ];
2445
2492
  const meta = (key, name, value) => {
2446
2493
  const exists = document.querySelector(`meta[${key}="${name}"]`);
2447
2494
  if (value === void 0 || exists) return exists;
@@ -2474,11 +2521,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2474
2521
  ...manifest || {}
2475
2522
  };
2476
2523
  if (!((_c = manifestObj.icons) == null ? void 0 : _c.length)) {
2477
- manifestObj.icons = [
2478
- { src: this.resolvedIconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
2479
- { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
2480
- { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
2481
- ];
2524
+ manifestObj.icons = this.resolvedManifestIcons;
2482
2525
  }
2483
2526
  link.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
2484
2527
  if (!((_d = this.api.options.pwaSettings) == null ? void 0 : _d.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
@@ -3769,7 +3812,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3769
3812
  } });
3770
3813
  }
3771
3814
  }
3772
- const version = "1.3.18";
3815
+ const version = "1.3.19";
3773
3816
  class WebRtc {
3774
3817
  constructor(api) {
3775
3818
  __publicField(this, "ice");
package/dist/index.mjs CHANGED
@@ -2341,6 +2341,37 @@ class PWA {
2341
2341
  __publicField(this, "nativeInstallPrompt", null);
2342
2342
  /** Resolved icon URL used for prompt + manifest */
2343
2343
  __publicField(this, "resolvedIconUrl", "https://datalynk-client.primary.auxilium.world/logo.png");
2344
+ /** Resolved manifest icons (prefer true 192/512 PNG data URLs) */
2345
+ __publicField(this, "resolvedManifestIcons", []);
2346
+ __publicField(this, "createSizedPng", async (url, size) => {
2347
+ if (this.headless || !url) return null;
2348
+ try {
2349
+ const img = await new Promise((res, rej) => {
2350
+ const el = new Image();
2351
+ const t = setTimeout(() => rej(new Error("icon-timeout")), 3500);
2352
+ el.crossOrigin = "anonymous";
2353
+ el.onload = () => {
2354
+ clearTimeout(t);
2355
+ res(el);
2356
+ };
2357
+ el.onerror = () => {
2358
+ clearTimeout(t);
2359
+ rej(new Error("icon-load-failed"));
2360
+ };
2361
+ el.src = url;
2362
+ });
2363
+ const canvas = document.createElement("canvas");
2364
+ canvas.width = size;
2365
+ canvas.height = size;
2366
+ const ctx = canvas.getContext("2d");
2367
+ if (!ctx) return null;
2368
+ ctx.clearRect(0, 0, size, size);
2369
+ ctx.drawImage(img, 0, 0, size, size);
2370
+ return canvas.toDataURL("image/png");
2371
+ } catch {
2372
+ return null;
2373
+ }
2374
+ });
2344
2375
  this.api = api;
2345
2376
  }
2346
2377
  get headless() {
@@ -2438,6 +2469,22 @@ class PWA {
2438
2469
  if (!ok) iconUrl = defaultIcon;
2439
2470
  }
2440
2471
  this.resolvedIconUrl = iconUrl;
2472
+ let icon192 = await this.createSizedPng(this.resolvedIconUrl, 192);
2473
+ let icon512 = await this.createSizedPng(this.resolvedIconUrl, 512);
2474
+ if ((!icon192 || !icon512) && this.resolvedIconUrl !== defaultIcon) {
2475
+ this.resolvedIconUrl = defaultIcon;
2476
+ icon192 = await this.createSizedPng(this.resolvedIconUrl, 192);
2477
+ icon512 = await this.createSizedPng(this.resolvedIconUrl, 512);
2478
+ }
2479
+ this.resolvedManifestIcons = icon192 && icon512 ? [
2480
+ { src: icon192, sizes: "192x192", type: "image/png", purpose: "any" },
2481
+ { src: icon512, sizes: "512x512", type: "image/png", purpose: "any" },
2482
+ { src: icon512, sizes: "512x512", type: "image/png", purpose: "maskable" }
2483
+ ] : [
2484
+ { src: this.resolvedIconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
2485
+ { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
2486
+ { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
2487
+ ];
2441
2488
  const meta = (key, name, value) => {
2442
2489
  const exists = document.querySelector(`meta[${key}="${name}"]`);
2443
2490
  if (value === void 0 || exists) return exists;
@@ -2470,11 +2517,7 @@ class PWA {
2470
2517
  ...manifest || {}
2471
2518
  };
2472
2519
  if (!((_c = manifestObj.icons) == null ? void 0 : _c.length)) {
2473
- manifestObj.icons = [
2474
- { src: this.resolvedIconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
2475
- { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
2476
- { src: this.resolvedIconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
2477
- ];
2520
+ manifestObj.icons = this.resolvedManifestIcons;
2478
2521
  }
2479
2522
  link.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
2480
2523
  if (!((_d = this.api.options.pwaSettings) == null ? void 0 : _d.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
@@ -3765,7 +3808,7 @@ class Superuser {
3765
3808
  } });
3766
3809
  }
3767
3810
  }
3768
- const version = "1.3.18";
3811
+ const version = "1.3.19";
3769
3812
  class WebRtc {
3770
3813
  constructor(api) {
3771
3814
  __publicField(this, "ice");
package/dist/pwa.d.ts CHANGED
@@ -5,6 +5,8 @@ export declare class PWA {
5
5
  nativeInstallPrompt: any;
6
6
  /** Resolved icon URL used for prompt + manifest */
7
7
  private resolvedIconUrl;
8
+ /** Resolved manifest icons (prefer true 192/512 PNG data URLs) */
9
+ private resolvedManifestIcons;
8
10
  get headless(): boolean;
9
11
  get iframe(): boolean;
10
12
  get mobile(): boolean;
@@ -13,6 +15,7 @@ export declare class PWA {
13
15
  get pwa(): boolean;
14
16
  constructor(api: Api);
15
17
  private bindInstallButton;
18
+ private createSizedPng;
16
19
  /** Setup the PWA */
17
20
  setup(manifest?: any): Promise<void>;
18
21
  /** Prompt user to install the app */
package/dist/pwa.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pwa.d.ts","sourceRoot":"","sources":["../src/pwa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,qBAAa,GAAG;IAsCH,OAAO,CAAC,QAAQ,CAAC,GAAG;IArChC,4BAA4B;IACrB,mBAAmB,EAAE,GAAG,CAAQ;IAEvC,mDAAmD;IACnD,OAAO,CAAC,eAAe,CAAqE;IAE5F,IAAI,QAAQ,IAAI,OAAO,CAAyC;IAEhE,IAAI,MAAM,IAAI,OAAO,CAAyC;IAE9D,IAAI,MAAM,IAAI,OAAO,CAAuD;IAE5E,IAAI,QAAQ,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAQ1E;IAED,IAAI,OAAO,IAAI,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CASxF;IAED,IAAI,GAAG,IAAI,OAAO,CAEjB;gBAE4B,GAAG,EAAE,GAAG;IAErC,OAAO,CAAC,iBAAiB;IAiBzB,oBAAoB;IACd,KAAK,CAAC,QAAQ,GAAE,GAAQ;IA8H9B,qCAAqC;IAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CAyLzC"}
1
+ {"version":3,"file":"pwa.d.ts","sourceRoot":"","sources":["../src/pwa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,qBAAa,GAAG;IAyCH,OAAO,CAAC,QAAQ,CAAC,GAAG;IAxChC,4BAA4B;IACrB,mBAAmB,EAAE,GAAG,CAAQ;IAEvC,mDAAmD;IACnD,OAAO,CAAC,eAAe,CAAqE;IAE5F,kEAAkE;IAClE,OAAO,CAAC,qBAAqB,CAAa;IAE1C,IAAI,QAAQ,IAAI,OAAO,CAAyC;IAEhE,IAAI,MAAM,IAAI,OAAO,CAAyC;IAE9D,IAAI,MAAM,IAAI,OAAO,CAAuD;IAE5E,IAAI,QAAQ,IAAI,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAQ1E;IAED,IAAI,OAAO,IAAI,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CASxF;IAED,IAAI,GAAG,IAAI,OAAO,CAEjB;gBAE4B,GAAG,EAAE,GAAG;IAErC,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,cAAc,CA0BrB;IAED,oBAAoB;IACd,KAAK,CAAC,QAAQ,GAAE,GAAQ;IAiJ9B,qCAAqC;IAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CAyLzC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@auxilium/datalynk-client",
3
3
  "description": "Datalynk client library",
4
4
  "repository": "https://gitlab.auxiliumgroup.com/auxilium/datalynk/datalynk-client",
5
- "version": "1.3.18",
5
+ "version": "1.3.19",
6
6
  "author": "Zak Timson <zaktimson@gmail.com>",
7
7
  "private": false,
8
8
  "main": "./dist/index.cjs",