@auxilium/datalynk-client 1.3.16 → 1.3.17
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 +72 -60
- package/dist/index.mjs +72 -60
- package/dist/pwa.d.ts +2 -0
- package/dist/pwa.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2343,6 +2343,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2343
2343
|
constructor(api) {
|
|
2344
2344
|
/** Capture Install Event */
|
|
2345
2345
|
__publicField(this, "nativeInstallPrompt", null);
|
|
2346
|
+
/** Resolved icon URL used for prompt + manifest (validated with fallback) */
|
|
2347
|
+
__publicField(this, "resolvedIconUrl", "https://datalynk-client.primary.auxilium.world/logo.png");
|
|
2346
2348
|
this.api = api;
|
|
2347
2349
|
}
|
|
2348
2350
|
get headless() {
|
|
@@ -2380,17 +2382,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2380
2382
|
const installBtn = document.querySelector("#installPwaBtn");
|
|
2381
2383
|
if (!installBtn) return;
|
|
2382
2384
|
installBtn.onclick = async () => {
|
|
2383
|
-
var _a;
|
|
2385
|
+
var _a, _b;
|
|
2384
2386
|
if (!this.nativeInstallPrompt) return console.warn("PWA is not supported");
|
|
2385
2387
|
this.nativeInstallPrompt.prompt();
|
|
2386
2388
|
const choice = await this.nativeInstallPrompt.userChoice;
|
|
2389
|
+
const storageKey = `${this.api.options.name}:pwa`;
|
|
2390
|
+
const expiryDays = Number(((_a = this.api.options.pwaSettings) == null ? void 0 : _a.dismissExpiry) ?? 7);
|
|
2387
2391
|
if (choice.outcome === "accepted") {
|
|
2388
2392
|
console.log("PWA installed");
|
|
2389
|
-
localStorage.setItem(
|
|
2393
|
+
localStorage.setItem(storageKey, "installed");
|
|
2390
2394
|
} else {
|
|
2391
|
-
localStorage.
|
|
2395
|
+
expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
|
|
2392
2396
|
}
|
|
2393
|
-
(
|
|
2397
|
+
(_b = document.querySelector(".pwa-prompt")) == null ? void 0 : _b.remove();
|
|
2394
2398
|
};
|
|
2395
2399
|
}
|
|
2396
2400
|
/** Setup the PWA */
|
|
@@ -2435,11 +2439,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2435
2439
|
exists.href = href;
|
|
2436
2440
|
return exists;
|
|
2437
2441
|
}
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
document.head.append(
|
|
2442
|
-
return
|
|
2442
|
+
const el = document.createElement("link");
|
|
2443
|
+
el.rel = rel;
|
|
2444
|
+
el.href = href;
|
|
2445
|
+
document.head.append(el);
|
|
2446
|
+
return el;
|
|
2443
2447
|
};
|
|
2444
2448
|
const resolveUrl = (href) => {
|
|
2445
2449
|
if (!href) return "";
|
|
@@ -2463,37 +2467,64 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2463
2467
|
const anyIcon = document.querySelector('link[rel~="icon"]');
|
|
2464
2468
|
return (anyIcon == null ? void 0 : anyIcon.href) ? resolveUrl(anyIcon.href) : "";
|
|
2465
2469
|
};
|
|
2466
|
-
const
|
|
2470
|
+
const firstWorkingIcon = async (...candidates) => {
|
|
2471
|
+
for (const c of candidates) {
|
|
2472
|
+
const url = resolveUrl(c);
|
|
2473
|
+
if (!url) continue;
|
|
2474
|
+
const ok = await new Promise((res) => {
|
|
2475
|
+
const img = new Image();
|
|
2476
|
+
const t = setTimeout(() => res(false), 2500);
|
|
2477
|
+
img.onload = () => {
|
|
2478
|
+
clearTimeout(t);
|
|
2479
|
+
res(true);
|
|
2480
|
+
};
|
|
2481
|
+
img.onerror = () => {
|
|
2482
|
+
clearTimeout(t);
|
|
2483
|
+
res(false);
|
|
2484
|
+
};
|
|
2485
|
+
img.src = url;
|
|
2486
|
+
});
|
|
2487
|
+
if (ok) return url;
|
|
2488
|
+
}
|
|
2489
|
+
return "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2490
|
+
};
|
|
2491
|
+
const iconUrl = await firstWorkingIcon(
|
|
2492
|
+
((_a = this.api.options.pwaSettings) == null ? void 0 : _a.icon) || "",
|
|
2493
|
+
pickFavicon() || "",
|
|
2494
|
+
"https://datalynk-client.primary.auxilium.world/logo.png"
|
|
2495
|
+
);
|
|
2496
|
+
this.resolvedIconUrl = iconUrl;
|
|
2467
2497
|
meta("name", "mobile-web-app-capable", "yes");
|
|
2468
2498
|
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
2469
2499
|
meta("name", "apple-mobile-web-app-title", this.api.options.name);
|
|
2470
2500
|
link("apple-touch-icon", iconUrl);
|
|
2471
2501
|
link("apple-touch-startup-image", iconUrl);
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
|
|
2478
|
-
const manifestObj = {
|
|
2479
|
-
name: this.api.options.name,
|
|
2480
|
-
short_name: this.api.options.name,
|
|
2481
|
-
start_url: startUrl,
|
|
2482
|
-
scope: scopePath || "/",
|
|
2483
|
-
display: "standalone",
|
|
2484
|
-
...this.api.options.manifest || {},
|
|
2485
|
-
...manifest || {}
|
|
2486
|
-
};
|
|
2487
|
-
if (!((_b = manifestObj.icons) == null ? void 0 : _b.length)) {
|
|
2488
|
-
manifestObj.icons = [
|
|
2489
|
-
{ src: iconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
|
|
2490
|
-
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
|
|
2491
|
-
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
|
|
2492
|
-
];
|
|
2493
|
-
}
|
|
2494
|
-
link2.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2495
|
-
document.head.append(link2);
|
|
2502
|
+
let manifestLink = document.querySelector('link[rel="manifest"]');
|
|
2503
|
+
if (!manifestLink) {
|
|
2504
|
+
manifestLink = document.createElement("link");
|
|
2505
|
+
manifestLink.rel = "manifest";
|
|
2506
|
+
document.head.append(manifestLink);
|
|
2496
2507
|
}
|
|
2508
|
+
const base = String(this.api.url).replace(/\/+$/, "");
|
|
2509
|
+
const startUrl = location.pathname;
|
|
2510
|
+
const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
|
|
2511
|
+
const manifestObj = {
|
|
2512
|
+
name: this.api.options.name,
|
|
2513
|
+
short_name: this.api.options.name,
|
|
2514
|
+
start_url: startUrl,
|
|
2515
|
+
scope: scopePath || "/",
|
|
2516
|
+
display: "standalone",
|
|
2517
|
+
...this.api.options.manifest || {},
|
|
2518
|
+
...manifest || {}
|
|
2519
|
+
};
|
|
2520
|
+
if (!((_b = manifestObj.icons) == null ? void 0 : _b.length)) {
|
|
2521
|
+
manifestObj.icons = [
|
|
2522
|
+
{ src: iconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
|
|
2523
|
+
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
|
|
2524
|
+
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
|
|
2525
|
+
];
|
|
2526
|
+
}
|
|
2527
|
+
manifestLink.href = `${base}/manifest?ts=${Date.now()}&json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2497
2528
|
if (!((_c = this.api.options.pwaSettings) == null ? void 0 : _c.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
|
|
2498
2529
|
const t = Number(this.api.options.pwaSettings.timeout ?? 30);
|
|
2499
2530
|
const timeoutMs = t >= 1e3 ? t : t * 1e3;
|
|
@@ -2516,35 +2547,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2516
2547
|
}
|
|
2517
2548
|
/** Prompt user to install the app */
|
|
2518
2549
|
async prompt(platform) {
|
|
2519
|
-
var _a
|
|
2550
|
+
var _a;
|
|
2520
2551
|
const storageKey = `${this.api.options.name}:pwa`;
|
|
2521
2552
|
if ((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) return;
|
|
2522
2553
|
if (this.pwa) return;
|
|
2523
2554
|
if (localStorage.getItem(storageKey) === "installed") return;
|
|
2524
2555
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2525
|
-
const
|
|
2526
|
-
if (!href) return "";
|
|
2527
|
-
try {
|
|
2528
|
-
return new URL(href, location.href).href;
|
|
2529
|
-
} catch (e) {
|
|
2530
|
-
return href;
|
|
2531
|
-
}
|
|
2532
|
-
};
|
|
2533
|
-
const pickFavicon = () => {
|
|
2534
|
-
const touch = document.querySelector('link[rel="apple-touch-icon"]');
|
|
2535
|
-
if (touch == null ? void 0 : touch.href) return resolveUrl(touch.href);
|
|
2536
|
-
const iconWithSizes = Array.from(document.querySelectorAll('link[rel~="icon"][sizes]'));
|
|
2537
|
-
if (iconWithSizes.length) {
|
|
2538
|
-
const best = iconWithSizes.sort((a, b) => {
|
|
2539
|
-
var _a2, _b2;
|
|
2540
|
-
return (parseInt((((_a2 = b.sizes) == null ? void 0 : _a2.value) || "0").split("x")[0]) || 0) - (parseInt((((_b2 = a.sizes) == null ? void 0 : _b2.value) || "0").split("x")[0]) || 0);
|
|
2541
|
-
})[0];
|
|
2542
|
-
if (best == null ? void 0 : best.href) return resolveUrl(best.href);
|
|
2543
|
-
}
|
|
2544
|
-
const anyIcon = document.querySelector('link[rel~="icon"]');
|
|
2545
|
-
return (anyIcon == null ? void 0 : anyIcon.href) ? resolveUrl(anyIcon.href) : "";
|
|
2546
|
-
};
|
|
2547
|
-
const iconUrl = resolveUrl((_b = this.api.options.pwaSettings) == null ? void 0 : _b.icon) || pickFavicon() || "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2556
|
+
const iconUrl = this.resolvedIconUrl || "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2548
2557
|
const targetPlatform = platform || this.platform;
|
|
2549
2558
|
const isAndroid = targetPlatform == "android";
|
|
2550
2559
|
const isIOS = targetPlatform == "ios";
|
|
@@ -2687,10 +2696,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2687
2696
|
const closeBtn = prompt.querySelector(".pwa-prompt-close");
|
|
2688
2697
|
closeBtn.onclick = () => {
|
|
2689
2698
|
var _a2;
|
|
2690
|
-
|
|
2699
|
+
const expiryDays = Number(((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ?? 7);
|
|
2700
|
+
expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
|
|
2691
2701
|
prompt.remove();
|
|
2692
2702
|
};
|
|
2693
2703
|
document.body.append(prompt);
|
|
2704
|
+
const img = prompt.querySelector(".pwa-prompt-header img");
|
|
2705
|
+
if (img) img.onerror = () => img.src = "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2694
2706
|
if (this.nativeInstallPrompt) this.bindInstallButton();
|
|
2695
2707
|
}
|
|
2696
2708
|
}
|
|
@@ -3802,7 +3814,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3802
3814
|
} });
|
|
3803
3815
|
}
|
|
3804
3816
|
}
|
|
3805
|
-
const version = "1.3.
|
|
3817
|
+
const version = "1.3.17";
|
|
3806
3818
|
class WebRtc {
|
|
3807
3819
|
constructor(api) {
|
|
3808
3820
|
__publicField(this, "ice");
|
package/dist/index.mjs
CHANGED
|
@@ -2339,6 +2339,8 @@ class PWA {
|
|
|
2339
2339
|
constructor(api) {
|
|
2340
2340
|
/** Capture Install Event */
|
|
2341
2341
|
__publicField(this, "nativeInstallPrompt", null);
|
|
2342
|
+
/** Resolved icon URL used for prompt + manifest (validated with fallback) */
|
|
2343
|
+
__publicField(this, "resolvedIconUrl", "https://datalynk-client.primary.auxilium.world/logo.png");
|
|
2342
2344
|
this.api = api;
|
|
2343
2345
|
}
|
|
2344
2346
|
get headless() {
|
|
@@ -2376,17 +2378,19 @@ class PWA {
|
|
|
2376
2378
|
const installBtn = document.querySelector("#installPwaBtn");
|
|
2377
2379
|
if (!installBtn) return;
|
|
2378
2380
|
installBtn.onclick = async () => {
|
|
2379
|
-
var _a;
|
|
2381
|
+
var _a, _b;
|
|
2380
2382
|
if (!this.nativeInstallPrompt) return console.warn("PWA is not supported");
|
|
2381
2383
|
this.nativeInstallPrompt.prompt();
|
|
2382
2384
|
const choice = await this.nativeInstallPrompt.userChoice;
|
|
2385
|
+
const storageKey = `${this.api.options.name}:pwa`;
|
|
2386
|
+
const expiryDays = Number(((_a = this.api.options.pwaSettings) == null ? void 0 : _a.dismissExpiry) ?? 7);
|
|
2383
2387
|
if (choice.outcome === "accepted") {
|
|
2384
2388
|
console.log("PWA installed");
|
|
2385
|
-
localStorage.setItem(
|
|
2389
|
+
localStorage.setItem(storageKey, "installed");
|
|
2386
2390
|
} else {
|
|
2387
|
-
localStorage.
|
|
2391
|
+
expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
|
|
2388
2392
|
}
|
|
2389
|
-
(
|
|
2393
|
+
(_b = document.querySelector(".pwa-prompt")) == null ? void 0 : _b.remove();
|
|
2390
2394
|
};
|
|
2391
2395
|
}
|
|
2392
2396
|
/** Setup the PWA */
|
|
@@ -2431,11 +2435,11 @@ class PWA {
|
|
|
2431
2435
|
exists.href = href;
|
|
2432
2436
|
return exists;
|
|
2433
2437
|
}
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
document.head.append(
|
|
2438
|
-
return
|
|
2438
|
+
const el = document.createElement("link");
|
|
2439
|
+
el.rel = rel;
|
|
2440
|
+
el.href = href;
|
|
2441
|
+
document.head.append(el);
|
|
2442
|
+
return el;
|
|
2439
2443
|
};
|
|
2440
2444
|
const resolveUrl = (href) => {
|
|
2441
2445
|
if (!href) return "";
|
|
@@ -2459,37 +2463,64 @@ class PWA {
|
|
|
2459
2463
|
const anyIcon = document.querySelector('link[rel~="icon"]');
|
|
2460
2464
|
return (anyIcon == null ? void 0 : anyIcon.href) ? resolveUrl(anyIcon.href) : "";
|
|
2461
2465
|
};
|
|
2462
|
-
const
|
|
2466
|
+
const firstWorkingIcon = async (...candidates) => {
|
|
2467
|
+
for (const c of candidates) {
|
|
2468
|
+
const url = resolveUrl(c);
|
|
2469
|
+
if (!url) continue;
|
|
2470
|
+
const ok = await new Promise((res) => {
|
|
2471
|
+
const img = new Image();
|
|
2472
|
+
const t = setTimeout(() => res(false), 2500);
|
|
2473
|
+
img.onload = () => {
|
|
2474
|
+
clearTimeout(t);
|
|
2475
|
+
res(true);
|
|
2476
|
+
};
|
|
2477
|
+
img.onerror = () => {
|
|
2478
|
+
clearTimeout(t);
|
|
2479
|
+
res(false);
|
|
2480
|
+
};
|
|
2481
|
+
img.src = url;
|
|
2482
|
+
});
|
|
2483
|
+
if (ok) return url;
|
|
2484
|
+
}
|
|
2485
|
+
return "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2486
|
+
};
|
|
2487
|
+
const iconUrl = await firstWorkingIcon(
|
|
2488
|
+
((_a = this.api.options.pwaSettings) == null ? void 0 : _a.icon) || "",
|
|
2489
|
+
pickFavicon() || "",
|
|
2490
|
+
"https://datalynk-client.primary.auxilium.world/logo.png"
|
|
2491
|
+
);
|
|
2492
|
+
this.resolvedIconUrl = iconUrl;
|
|
2463
2493
|
meta("name", "mobile-web-app-capable", "yes");
|
|
2464
2494
|
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
2465
2495
|
meta("name", "apple-mobile-web-app-title", this.api.options.name);
|
|
2466
2496
|
link("apple-touch-icon", iconUrl);
|
|
2467
2497
|
link("apple-touch-startup-image", iconUrl);
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
|
|
2474
|
-
const manifestObj = {
|
|
2475
|
-
name: this.api.options.name,
|
|
2476
|
-
short_name: this.api.options.name,
|
|
2477
|
-
start_url: startUrl,
|
|
2478
|
-
scope: scopePath || "/",
|
|
2479
|
-
display: "standalone",
|
|
2480
|
-
...this.api.options.manifest || {},
|
|
2481
|
-
...manifest || {}
|
|
2482
|
-
};
|
|
2483
|
-
if (!((_b = manifestObj.icons) == null ? void 0 : _b.length)) {
|
|
2484
|
-
manifestObj.icons = [
|
|
2485
|
-
{ src: iconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
|
|
2486
|
-
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
|
|
2487
|
-
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
|
|
2488
|
-
];
|
|
2489
|
-
}
|
|
2490
|
-
link2.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2491
|
-
document.head.append(link2);
|
|
2498
|
+
let manifestLink = document.querySelector('link[rel="manifest"]');
|
|
2499
|
+
if (!manifestLink) {
|
|
2500
|
+
manifestLink = document.createElement("link");
|
|
2501
|
+
manifestLink.rel = "manifest";
|
|
2502
|
+
document.head.append(manifestLink);
|
|
2492
2503
|
}
|
|
2504
|
+
const base = String(this.api.url).replace(/\/+$/, "");
|
|
2505
|
+
const startUrl = location.pathname;
|
|
2506
|
+
const scopePath = startUrl.endsWith("/") ? startUrl : startUrl.replace(/[^/]+$/, "");
|
|
2507
|
+
const manifestObj = {
|
|
2508
|
+
name: this.api.options.name,
|
|
2509
|
+
short_name: this.api.options.name,
|
|
2510
|
+
start_url: startUrl,
|
|
2511
|
+
scope: scopePath || "/",
|
|
2512
|
+
display: "standalone",
|
|
2513
|
+
...this.api.options.manifest || {},
|
|
2514
|
+
...manifest || {}
|
|
2515
|
+
};
|
|
2516
|
+
if (!((_b = manifestObj.icons) == null ? void 0 : _b.length)) {
|
|
2517
|
+
manifestObj.icons = [
|
|
2518
|
+
{ src: iconUrl, sizes: "192x192", type: "image/png", purpose: "any" },
|
|
2519
|
+
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "any" },
|
|
2520
|
+
{ src: iconUrl, sizes: "512x512", type: "image/png", purpose: "maskable" }
|
|
2521
|
+
];
|
|
2522
|
+
}
|
|
2523
|
+
manifestLink.href = `${base}/manifest?ts=${Date.now()}&json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2493
2524
|
if (!((_c = this.api.options.pwaSettings) == null ? void 0 : _c.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
|
|
2494
2525
|
const t = Number(this.api.options.pwaSettings.timeout ?? 30);
|
|
2495
2526
|
const timeoutMs = t >= 1e3 ? t : t * 1e3;
|
|
@@ -2512,35 +2543,13 @@ class PWA {
|
|
|
2512
2543
|
}
|
|
2513
2544
|
/** Prompt user to install the app */
|
|
2514
2545
|
async prompt(platform) {
|
|
2515
|
-
var _a
|
|
2546
|
+
var _a;
|
|
2516
2547
|
const storageKey = `${this.api.options.name}:pwa`;
|
|
2517
2548
|
if ((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) return;
|
|
2518
2549
|
if (this.pwa) return;
|
|
2519
2550
|
if (localStorage.getItem(storageKey) === "installed") return;
|
|
2520
2551
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2521
|
-
const
|
|
2522
|
-
if (!href) return "";
|
|
2523
|
-
try {
|
|
2524
|
-
return new URL(href, location.href).href;
|
|
2525
|
-
} catch (e) {
|
|
2526
|
-
return href;
|
|
2527
|
-
}
|
|
2528
|
-
};
|
|
2529
|
-
const pickFavicon = () => {
|
|
2530
|
-
const touch = document.querySelector('link[rel="apple-touch-icon"]');
|
|
2531
|
-
if (touch == null ? void 0 : touch.href) return resolveUrl(touch.href);
|
|
2532
|
-
const iconWithSizes = Array.from(document.querySelectorAll('link[rel~="icon"][sizes]'));
|
|
2533
|
-
if (iconWithSizes.length) {
|
|
2534
|
-
const best = iconWithSizes.sort((a, b) => {
|
|
2535
|
-
var _a2, _b2;
|
|
2536
|
-
return (parseInt((((_a2 = b.sizes) == null ? void 0 : _a2.value) || "0").split("x")[0]) || 0) - (parseInt((((_b2 = a.sizes) == null ? void 0 : _b2.value) || "0").split("x")[0]) || 0);
|
|
2537
|
-
})[0];
|
|
2538
|
-
if (best == null ? void 0 : best.href) return resolveUrl(best.href);
|
|
2539
|
-
}
|
|
2540
|
-
const anyIcon = document.querySelector('link[rel~="icon"]');
|
|
2541
|
-
return (anyIcon == null ? void 0 : anyIcon.href) ? resolveUrl(anyIcon.href) : "";
|
|
2542
|
-
};
|
|
2543
|
-
const iconUrl = resolveUrl((_b = this.api.options.pwaSettings) == null ? void 0 : _b.icon) || pickFavicon() || "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2552
|
+
const iconUrl = this.resolvedIconUrl || "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2544
2553
|
const targetPlatform = platform || this.platform;
|
|
2545
2554
|
const isAndroid = targetPlatform == "android";
|
|
2546
2555
|
const isIOS = targetPlatform == "ios";
|
|
@@ -2683,10 +2692,13 @@ class PWA {
|
|
|
2683
2692
|
const closeBtn = prompt.querySelector(".pwa-prompt-close");
|
|
2684
2693
|
closeBtn.onclick = () => {
|
|
2685
2694
|
var _a2;
|
|
2686
|
-
|
|
2695
|
+
const expiryDays = Number(((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ?? 7);
|
|
2696
|
+
expiryDays === 0 ? localStorage.removeItem(storageKey) : localStorage.setItem(storageKey, Date.now().toString());
|
|
2687
2697
|
prompt.remove();
|
|
2688
2698
|
};
|
|
2689
2699
|
document.body.append(prompt);
|
|
2700
|
+
const img = prompt.querySelector(".pwa-prompt-header img");
|
|
2701
|
+
if (img) img.onerror = () => img.src = "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2690
2702
|
if (this.nativeInstallPrompt) this.bindInstallButton();
|
|
2691
2703
|
}
|
|
2692
2704
|
}
|
|
@@ -3798,7 +3810,7 @@ class Superuser {
|
|
|
3798
3810
|
} });
|
|
3799
3811
|
}
|
|
3800
3812
|
}
|
|
3801
|
-
const version = "1.3.
|
|
3813
|
+
const version = "1.3.17";
|
|
3802
3814
|
class WebRtc {
|
|
3803
3815
|
constructor(api) {
|
|
3804
3816
|
__publicField(this, "ice");
|
package/dist/pwa.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare class PWA {
|
|
|
3
3
|
private readonly api;
|
|
4
4
|
/** Capture Install Event */
|
|
5
5
|
nativeInstallPrompt: any;
|
|
6
|
+
/** Resolved icon URL used for prompt + manifest (validated with fallback) */
|
|
7
|
+
private resolvedIconUrl;
|
|
6
8
|
get headless(): boolean;
|
|
7
9
|
get iframe(): boolean;
|
|
8
10
|
get mobile(): boolean;
|
package/dist/pwa.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pwa.d.ts","sourceRoot":"","sources":["../src/pwa.ts"],"names":[],"mappings":"
|
|
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,6EAA6E;IAC7E,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;IAsBzB,oBAAoB;IACd,KAAK,CAAC,QAAQ,GAAE,GAAQ;IA0K9B,qCAAqC;IAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CA0LzC"}
|
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.
|
|
5
|
+
"version": "1.3.17",
|
|
6
6
|
"author": "Zak Timson <zaktimson@gmail.com>",
|
|
7
7
|
"private": false,
|
|
8
8
|
"main": "./dist/index.cjs",
|