@auxilium/datalynk-client 1.3.15 → 1.3.17-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.d.ts CHANGED
@@ -66,6 +66,8 @@ export type ApiOptions = {
66
66
  loginLink?: boolean;
67
67
  /** Hide/disable the in-app PWA install popup entirely */
68
68
  hidePWAPrompt?: boolean;
69
+ /** Optional: override the installed-app icon (should be a PNG, ideally 512x512) */
70
+ icon?: string;
69
71
  };
70
72
  };
71
73
  /**
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAC,eAAe,EAAuB,MAAM,MAAM,CAAC;AAC3D,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,OAAO,EAAE,KAAK,EAAC,MAAM,SAAS,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,MAAM,MAAM,UAAU,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC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E,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;CAIjE"}
package/dist/index.cjs CHANGED
@@ -2380,22 +2380,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2380
2380
  const installBtn = document.querySelector("#installPwaBtn");
2381
2381
  if (!installBtn) return;
2382
2382
  installBtn.onclick = async () => {
2383
- var _a;
2383
+ var _a, _b, _c;
2384
2384
  if (!this.nativeInstallPrompt) return console.warn("PWA is not supported");
2385
2385
  this.nativeInstallPrompt.prompt();
2386
2386
  const choice = await this.nativeInstallPrompt.userChoice;
2387
+ const storageKey = `${this.api.options.name}:pwa`;
2388
+ const expiryDays = Number(((_b = (_a = this.api.options) == null ? void 0 : _a.pwaSettings) == null ? void 0 : _b.dismissExpiry) ?? 7);
2387
2389
  if (choice.outcome === "accepted") {
2388
2390
  console.log("PWA installed");
2389
- localStorage.setItem(`${this.api.options.name}:pwa`, "installed");
2391
+ localStorage.setItem(storageKey, "installed");
2390
2392
  } else {
2391
- localStorage.setItem(`${this.api.options.name}:pwa`, Date.now().toString());
2393
+ expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
2392
2394
  }
2393
- (_a = document.querySelector(".pwa-prompt")) == null ? void 0 : _a.remove();
2395
+ (_c = document.querySelector(".pwa-prompt")) == null ? void 0 : _c.remove();
2394
2396
  };
2395
2397
  }
2396
2398
  /** Setup the PWA */
2397
2399
  async setup(manifest = {}) {
2398
- var _a;
2400
+ var _a, _b, _c, _d;
2399
2401
  const storageKey = `${this.api.options.name}:pwa`;
2400
2402
  window.addEventListener("beforeinstallprompt", (e) => {
2401
2403
  e.preventDefault();
@@ -2433,36 +2435,62 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2433
2435
  meta("name", "apple-mobile-web-app-title", this.api.options.name);
2434
2436
  meta("name", "apple-touch-icon", `https://datalynk-client.primary.auxilium.world/logo.png`);
2435
2437
  meta("name", "apple-touch-startup-image", `https://datalynk-client.primary.auxilium.world/logo.png`);
2436
- if (!document.querySelector('link[rel="manifest"]')) {
2437
- const link = document.createElement("link");
2438
- link.rel = "manifest";
2439
- const base = String(this.api.url).replace(/\/+$/, "");
2440
- const startUrl = location.pathname;
2441
- const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
2442
- const manifestObj = {
2443
- name: this.api.options.name,
2444
- short_name: this.api.options.name,
2445
- start_url: startUrl,
2446
- scope: scopePath || "/",
2447
- display: "standalone",
2448
- ...this.api.options.manifest || {},
2449
- ...manifest || {}
2438
+ const defaultIcon = "https://datalynk-client.primary.auxilium.world/logo.png";
2439
+ let iconUrl = ((_b = (_a = this.api.options) == null ? void 0 : _a.pwaSettings) == null ? void 0 : _b.icon) || defaultIcon;
2440
+ const canLoad = (url) => new Promise((res) => {
2441
+ const img = new Image();
2442
+ const t = setTimeout(() => res(false), 2500);
2443
+ img.onload = () => {
2444
+ clearTimeout(t);
2445
+ res(true);
2446
+ };
2447
+ img.onerror = () => {
2448
+ clearTimeout(t);
2449
+ res(false);
2450
2450
  };
2451
- link.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
2452
- document.head.append(link);
2451
+ img.src = url;
2452
+ });
2453
+ if (iconUrl && iconUrl !== defaultIcon) {
2454
+ const ok = await canLoad(iconUrl);
2455
+ if (!ok) iconUrl = defaultIcon;
2456
+ }
2457
+ let manifestLink = document.querySelector('link[rel="manifest"]');
2458
+ if (!manifestLink) {
2459
+ manifestLink = document.createElement("link");
2460
+ manifestLink.rel = "manifest";
2461
+ document.head.append(manifestLink);
2453
2462
  }
2454
- if (!((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
2463
+ const base = String(this.api.url).replace(/\/+$/, "");
2464
+ const startUrl = location.pathname;
2465
+ const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
2466
+ const manifestObj = {
2467
+ name: this.api.options.name,
2468
+ short_name: this.api.options.name,
2469
+ start_url: startUrl,
2470
+ scope: scopePath || "/",
2471
+ display: "standalone",
2472
+ ...this.api.options.manifest || {},
2473
+ ...manifest || {}
2474
+ };
2475
+ if (!((_c = manifestObj.icons) == null ? void 0 : _c.length)) {
2476
+ manifestObj.icons = [
2477
+ { src: iconUrl, sizes: "192x192", type: "image/png" },
2478
+ { src: iconUrl, sizes: "512x512", type: "image/png" }
2479
+ ];
2480
+ }
2481
+ manifestLink.href = `${base}/manifest?ts=${Date.now()}&json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
2482
+ if (!((_d = this.api.options.pwaSettings) == null ? void 0 : _d.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
2455
2483
  const t = Number(this.api.options.pwaSettings.timeout ?? 30);
2456
2484
  const timeoutMs = t >= 1e3 ? t : t * 1e3;
2457
2485
  setTimeout(() => {
2458
- var _a2, _b, _c, _d;
2486
+ var _a2, _b2, _c2, _d2;
2459
2487
  const raw = localStorage.getItem(storageKey);
2460
2488
  if (raw === "installed") return;
2461
- if (((_b = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b.dismissExpiry) === 0) {
2489
+ if (((_b2 = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b2.dismissExpiry) === 0) {
2462
2490
  if (raw !== "installed") localStorage.removeItem(storageKey);
2463
2491
  }
2464
2492
  const dismissedAt = raw ? Number(raw) : 0;
2465
- const expiryDays = Number(((_d = (_c = this.api.options) == null ? void 0 : _c.pwaSettings) == null ? void 0 : _d.dismissExpiry) ?? 0);
2493
+ const expiryDays = Number(((_d2 = (_c2 = this.api.options) == null ? void 0 : _c2.pwaSettings) == null ? void 0 : _d2.dismissExpiry) ?? 0);
2466
2494
  if (dismissedAt && expiryDays > 0) {
2467
2495
  const expiryMs = expiryDays * 24 * 60 * 60 * 1e3;
2468
2496
  if (Date.now() < dismissedAt + expiryMs) return;
@@ -2473,12 +2501,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2473
2501
  }
2474
2502
  /** Prompt user to install the app */
2475
2503
  async prompt(platform) {
2476
- var _a;
2504
+ var _a, _b, _c;
2477
2505
  const storageKey = `${this.api.options.name}:pwa`;
2478
2506
  if ((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) return;
2479
2507
  if (this.pwa) return;
2480
2508
  if (localStorage.getItem(storageKey) === "installed") return;
2481
2509
  if (document.querySelector(".pwa-prompt")) return;
2510
+ const defaultIcon = "https://datalynk-client.primary.auxilium.world/logo.png";
2511
+ const iconUrl = ((_c = (_b = this.api.options) == null ? void 0 : _b.pwaSettings) == null ? void 0 : _c.icon) || defaultIcon;
2482
2512
  const targetPlatform = platform || this.platform;
2483
2513
  const isAndroid = targetPlatform == "android";
2484
2514
  const isIOS = targetPlatform == "ios";
@@ -2604,7 +2634,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2604
2634
  prompt.classList.add("pwa-prompt");
2605
2635
  prompt.innerHTML = `
2606
2636
  <div class="pwa-prompt-header">
2607
- <img src="https://datalynk-client.primary.auxilium.world/logo.png" alt="Logo" />
2637
+ <img src="${iconUrl}" alt="Logo" />
2608
2638
  <h1>Install ${this.api.options.name}</h1>
2609
2639
  <button class="pwa-prompt-close">&times;</button>
2610
2640
  </div>
@@ -2620,11 +2650,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2620
2650
  `;
2621
2651
  const closeBtn = prompt.querySelector(".pwa-prompt-close");
2622
2652
  closeBtn.onclick = () => {
2623
- var _a2;
2624
- !!((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ? localStorage.setItem(storageKey, Date.now().toString()) : localStorage.removeItem(storageKey);
2653
+ var _a2, _b2;
2654
+ const expiryDays = Number(((_b2 = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b2.dismissExpiry) ?? 7);
2655
+ expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
2625
2656
  prompt.remove();
2626
2657
  };
2627
2658
  document.body.append(prompt);
2659
+ const img = prompt.querySelector(".pwa-prompt-header img");
2660
+ if (img) img.onerror = () => img.src = defaultIcon;
2628
2661
  if (this.nativeInstallPrompt) this.bindInstallButton();
2629
2662
  }
2630
2663
  }
@@ -3736,7 +3769,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3736
3769
  } });
3737
3770
  }
3738
3771
  }
3739
- const version = "1.3.15";
3772
+ const version = "1.3.17-1";
3740
3773
  class WebRtc {
3741
3774
  constructor(api) {
3742
3775
  __publicField(this, "ice");
package/dist/index.mjs CHANGED
@@ -2376,22 +2376,24 @@ class PWA {
2376
2376
  const installBtn = document.querySelector("#installPwaBtn");
2377
2377
  if (!installBtn) return;
2378
2378
  installBtn.onclick = async () => {
2379
- var _a;
2379
+ var _a, _b, _c;
2380
2380
  if (!this.nativeInstallPrompt) return console.warn("PWA is not supported");
2381
2381
  this.nativeInstallPrompt.prompt();
2382
2382
  const choice = await this.nativeInstallPrompt.userChoice;
2383
+ const storageKey = `${this.api.options.name}:pwa`;
2384
+ const expiryDays = Number(((_b = (_a = this.api.options) == null ? void 0 : _a.pwaSettings) == null ? void 0 : _b.dismissExpiry) ?? 7);
2383
2385
  if (choice.outcome === "accepted") {
2384
2386
  console.log("PWA installed");
2385
- localStorage.setItem(`${this.api.options.name}:pwa`, "installed");
2387
+ localStorage.setItem(storageKey, "installed");
2386
2388
  } else {
2387
- localStorage.setItem(`${this.api.options.name}:pwa`, Date.now().toString());
2389
+ expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
2388
2390
  }
2389
- (_a = document.querySelector(".pwa-prompt")) == null ? void 0 : _a.remove();
2391
+ (_c = document.querySelector(".pwa-prompt")) == null ? void 0 : _c.remove();
2390
2392
  };
2391
2393
  }
2392
2394
  /** Setup the PWA */
2393
2395
  async setup(manifest = {}) {
2394
- var _a;
2396
+ var _a, _b, _c, _d;
2395
2397
  const storageKey = `${this.api.options.name}:pwa`;
2396
2398
  window.addEventListener("beforeinstallprompt", (e) => {
2397
2399
  e.preventDefault();
@@ -2429,36 +2431,62 @@ class PWA {
2429
2431
  meta("name", "apple-mobile-web-app-title", this.api.options.name);
2430
2432
  meta("name", "apple-touch-icon", `https://datalynk-client.primary.auxilium.world/logo.png`);
2431
2433
  meta("name", "apple-touch-startup-image", `https://datalynk-client.primary.auxilium.world/logo.png`);
2432
- if (!document.querySelector('link[rel="manifest"]')) {
2433
- const link = document.createElement("link");
2434
- link.rel = "manifest";
2435
- const base = String(this.api.url).replace(/\/+$/, "");
2436
- const startUrl = location.pathname;
2437
- const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
2438
- const manifestObj = {
2439
- name: this.api.options.name,
2440
- short_name: this.api.options.name,
2441
- start_url: startUrl,
2442
- scope: scopePath || "/",
2443
- display: "standalone",
2444
- ...this.api.options.manifest || {},
2445
- ...manifest || {}
2434
+ const defaultIcon = "https://datalynk-client.primary.auxilium.world/logo.png";
2435
+ let iconUrl = ((_b = (_a = this.api.options) == null ? void 0 : _a.pwaSettings) == null ? void 0 : _b.icon) || defaultIcon;
2436
+ const canLoad = (url) => new Promise((res) => {
2437
+ const img = new Image();
2438
+ const t = setTimeout(() => res(false), 2500);
2439
+ img.onload = () => {
2440
+ clearTimeout(t);
2441
+ res(true);
2442
+ };
2443
+ img.onerror = () => {
2444
+ clearTimeout(t);
2445
+ res(false);
2446
2446
  };
2447
- link.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
2448
- document.head.append(link);
2447
+ img.src = url;
2448
+ });
2449
+ if (iconUrl && iconUrl !== defaultIcon) {
2450
+ const ok = await canLoad(iconUrl);
2451
+ if (!ok) iconUrl = defaultIcon;
2452
+ }
2453
+ let manifestLink = document.querySelector('link[rel="manifest"]');
2454
+ if (!manifestLink) {
2455
+ manifestLink = document.createElement("link");
2456
+ manifestLink.rel = "manifest";
2457
+ document.head.append(manifestLink);
2449
2458
  }
2450
- if (!((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
2459
+ const base = String(this.api.url).replace(/\/+$/, "");
2460
+ const startUrl = location.pathname;
2461
+ const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
2462
+ const manifestObj = {
2463
+ name: this.api.options.name,
2464
+ short_name: this.api.options.name,
2465
+ start_url: startUrl,
2466
+ scope: scopePath || "/",
2467
+ display: "standalone",
2468
+ ...this.api.options.manifest || {},
2469
+ ...manifest || {}
2470
+ };
2471
+ if (!((_c = manifestObj.icons) == null ? void 0 : _c.length)) {
2472
+ manifestObj.icons = [
2473
+ { src: iconUrl, sizes: "192x192", type: "image/png" },
2474
+ { src: iconUrl, sizes: "512x512", type: "image/png" }
2475
+ ];
2476
+ }
2477
+ manifestLink.href = `${base}/manifest?ts=${Date.now()}&json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
2478
+ if (!((_d = this.api.options.pwaSettings) == null ? void 0 : _d.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
2451
2479
  const t = Number(this.api.options.pwaSettings.timeout ?? 30);
2452
2480
  const timeoutMs = t >= 1e3 ? t : t * 1e3;
2453
2481
  setTimeout(() => {
2454
- var _a2, _b, _c, _d;
2482
+ var _a2, _b2, _c2, _d2;
2455
2483
  const raw = localStorage.getItem(storageKey);
2456
2484
  if (raw === "installed") return;
2457
- if (((_b = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b.dismissExpiry) === 0) {
2485
+ if (((_b2 = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b2.dismissExpiry) === 0) {
2458
2486
  if (raw !== "installed") localStorage.removeItem(storageKey);
2459
2487
  }
2460
2488
  const dismissedAt = raw ? Number(raw) : 0;
2461
- const expiryDays = Number(((_d = (_c = this.api.options) == null ? void 0 : _c.pwaSettings) == null ? void 0 : _d.dismissExpiry) ?? 0);
2489
+ const expiryDays = Number(((_d2 = (_c2 = this.api.options) == null ? void 0 : _c2.pwaSettings) == null ? void 0 : _d2.dismissExpiry) ?? 0);
2462
2490
  if (dismissedAt && expiryDays > 0) {
2463
2491
  const expiryMs = expiryDays * 24 * 60 * 60 * 1e3;
2464
2492
  if (Date.now() < dismissedAt + expiryMs) return;
@@ -2469,12 +2497,14 @@ class PWA {
2469
2497
  }
2470
2498
  /** Prompt user to install the app */
2471
2499
  async prompt(platform) {
2472
- var _a;
2500
+ var _a, _b, _c;
2473
2501
  const storageKey = `${this.api.options.name}:pwa`;
2474
2502
  if ((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) return;
2475
2503
  if (this.pwa) return;
2476
2504
  if (localStorage.getItem(storageKey) === "installed") return;
2477
2505
  if (document.querySelector(".pwa-prompt")) return;
2506
+ const defaultIcon = "https://datalynk-client.primary.auxilium.world/logo.png";
2507
+ const iconUrl = ((_c = (_b = this.api.options) == null ? void 0 : _b.pwaSettings) == null ? void 0 : _c.icon) || defaultIcon;
2478
2508
  const targetPlatform = platform || this.platform;
2479
2509
  const isAndroid = targetPlatform == "android";
2480
2510
  const isIOS = targetPlatform == "ios";
@@ -2600,7 +2630,7 @@ class PWA {
2600
2630
  prompt.classList.add("pwa-prompt");
2601
2631
  prompt.innerHTML = `
2602
2632
  <div class="pwa-prompt-header">
2603
- <img src="https://datalynk-client.primary.auxilium.world/logo.png" alt="Logo" />
2633
+ <img src="${iconUrl}" alt="Logo" />
2604
2634
  <h1>Install ${this.api.options.name}</h1>
2605
2635
  <button class="pwa-prompt-close">&times;</button>
2606
2636
  </div>
@@ -2616,11 +2646,14 @@ class PWA {
2616
2646
  `;
2617
2647
  const closeBtn = prompt.querySelector(".pwa-prompt-close");
2618
2648
  closeBtn.onclick = () => {
2619
- var _a2;
2620
- !!((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ? localStorage.setItem(storageKey, Date.now().toString()) : localStorage.removeItem(storageKey);
2649
+ var _a2, _b2;
2650
+ const expiryDays = Number(((_b2 = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b2.dismissExpiry) ?? 7);
2651
+ expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
2621
2652
  prompt.remove();
2622
2653
  };
2623
2654
  document.body.append(prompt);
2655
+ const img = prompt.querySelector(".pwa-prompt-header img");
2656
+ if (img) img.onerror = () => img.src = defaultIcon;
2624
2657
  if (this.nativeInstallPrompt) this.bindInstallButton();
2625
2658
  }
2626
2659
  }
@@ -3732,7 +3765,7 @@ class Superuser {
3732
3765
  } });
3733
3766
  }
3734
3767
  }
3735
- const version = "1.3.15";
3768
+ const version = "1.3.17-1";
3736
3769
  class WebRtc {
3737
3770
  constructor(api) {
3738
3771
  __publicField(this, "ice");
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;IAmCH,OAAO,CAAC,QAAQ,CAAC,GAAG;IAlChC,4BAA4B;IACrB,mBAAmB,EAAE,GAAG,CAAQ;IAEvC,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;IAgG9B,qCAAqC;IAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CAkLzC"}
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;IAmCH,OAAO,CAAC,QAAQ,CAAC,GAAG;IAlChC,4BAA4B;IACrB,mBAAmB,EAAE,GAAG,CAAQ;IAEvC,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;IAuBzB,oBAAoB;IACd,KAAK,CAAC,QAAQ,GAAE,GAAQ;IA8H9B,qCAAqC;IAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CA2LzC"}
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.15",
5
+ "version": "1.3.17-1",
6
6
  "author": "Zak Timson <zaktimson@gmail.com>",
7
7
  "private": false,
8
8
  "main": "./dist/index.cjs",