@auxilium/datalynk-client 1.3.15 → 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/api.d.ts +2 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/index.cjs +133 -34
- package/dist/index.mjs +133 -34
- package/dist/pwa.d.ts +2 -0
- package/dist/pwa.d.ts.map +1 -1
- package/package.json +1 -1
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,MAA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,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC;IAClE,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE;QAAC,OAAO,EAAE,IAAI,CAAA;KAAC,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAWjG;;;;;;;;;;;OAWG;IACI,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE;QAAC,OAAO,EAAE,IAAI,CAAA;KAAC,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IA2CnG;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,CAAC,SAAS,IAAI,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;CAIjE"}
|
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,22 +2382,24 @@ 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 */
|
|
2397
2401
|
async setup(manifest = {}) {
|
|
2398
|
-
var _a;
|
|
2402
|
+
var _a, _b, _c;
|
|
2399
2403
|
const storageKey = `${this.api.options.name}:pwa`;
|
|
2400
2404
|
window.addEventListener("beforeinstallprompt", (e) => {
|
|
2401
2405
|
e.preventDefault();
|
|
@@ -2428,41 +2432,111 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2428
2432
|
meta2.content = value;
|
|
2429
2433
|
document.head.append(meta2);
|
|
2430
2434
|
};
|
|
2435
|
+
const link = (rel, href) => {
|
|
2436
|
+
const exists = document.querySelector(`link[rel="${rel}"]`);
|
|
2437
|
+
if (href === void 0) return exists;
|
|
2438
|
+
if (exists) {
|
|
2439
|
+
exists.href = href;
|
|
2440
|
+
return exists;
|
|
2441
|
+
}
|
|
2442
|
+
const el = document.createElement("link");
|
|
2443
|
+
el.rel = rel;
|
|
2444
|
+
el.href = href;
|
|
2445
|
+
document.head.append(el);
|
|
2446
|
+
return el;
|
|
2447
|
+
};
|
|
2448
|
+
const resolveUrl = (href) => {
|
|
2449
|
+
if (!href) return "";
|
|
2450
|
+
try {
|
|
2451
|
+
return new URL(href, location.href).href;
|
|
2452
|
+
} catch (e) {
|
|
2453
|
+
return href;
|
|
2454
|
+
}
|
|
2455
|
+
};
|
|
2456
|
+
const pickFavicon = () => {
|
|
2457
|
+
const touch = document.querySelector('link[rel="apple-touch-icon"]');
|
|
2458
|
+
if (touch == null ? void 0 : touch.href) return resolveUrl(touch.href);
|
|
2459
|
+
const iconWithSizes = Array.from(document.querySelectorAll('link[rel~="icon"][sizes]'));
|
|
2460
|
+
if (iconWithSizes.length) {
|
|
2461
|
+
const best = iconWithSizes.sort((a, b) => {
|
|
2462
|
+
var _a2, _b2;
|
|
2463
|
+
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);
|
|
2464
|
+
})[0];
|
|
2465
|
+
if (best == null ? void 0 : best.href) return resolveUrl(best.href);
|
|
2466
|
+
}
|
|
2467
|
+
const anyIcon = document.querySelector('link[rel~="icon"]');
|
|
2468
|
+
return (anyIcon == null ? void 0 : anyIcon.href) ? resolveUrl(anyIcon.href) : "";
|
|
2469
|
+
};
|
|
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;
|
|
2431
2497
|
meta("name", "mobile-web-app-capable", "yes");
|
|
2432
2498
|
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
2433
2499
|
meta("name", "apple-mobile-web-app-title", this.api.options.name);
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2500
|
+
link("apple-touch-icon", iconUrl);
|
|
2501
|
+
link("apple-touch-startup-image", iconUrl);
|
|
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);
|
|
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
|
+
];
|
|
2453
2526
|
}
|
|
2454
|
-
|
|
2527
|
+
manifestLink.href = `${base}/manifest?ts=${Date.now()}&json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2528
|
+
if (!((_c = this.api.options.pwaSettings) == null ? void 0 : _c.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
|
|
2455
2529
|
const t = Number(this.api.options.pwaSettings.timeout ?? 30);
|
|
2456
2530
|
const timeoutMs = t >= 1e3 ? t : t * 1e3;
|
|
2457
2531
|
setTimeout(() => {
|
|
2458
|
-
var _a2,
|
|
2532
|
+
var _a2, _b2, _c2, _d;
|
|
2459
2533
|
const raw = localStorage.getItem(storageKey);
|
|
2460
2534
|
if (raw === "installed") return;
|
|
2461
|
-
if (((
|
|
2535
|
+
if (((_b2 = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b2.dismissExpiry) === 0) {
|
|
2462
2536
|
if (raw !== "installed") localStorage.removeItem(storageKey);
|
|
2463
2537
|
}
|
|
2464
2538
|
const dismissedAt = raw ? Number(raw) : 0;
|
|
2465
|
-
const expiryDays = Number(((_d = (
|
|
2539
|
+
const expiryDays = Number(((_d = (_c2 = this.api.options) == null ? void 0 : _c2.pwaSettings) == null ? void 0 : _d.dismissExpiry) ?? 0);
|
|
2466
2540
|
if (dismissedAt && expiryDays > 0) {
|
|
2467
2541
|
const expiryMs = expiryDays * 24 * 60 * 60 * 1e3;
|
|
2468
2542
|
if (Date.now() < dismissedAt + expiryMs) return;
|
|
@@ -2479,6 +2553,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2479
2553
|
if (this.pwa) return;
|
|
2480
2554
|
if (localStorage.getItem(storageKey) === "installed") return;
|
|
2481
2555
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2556
|
+
const iconUrl = this.resolvedIconUrl || "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2482
2557
|
const targetPlatform = platform || this.platform;
|
|
2483
2558
|
const isAndroid = targetPlatform == "android";
|
|
2484
2559
|
const isIOS = targetPlatform == "ios";
|
|
@@ -2604,7 +2679,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2604
2679
|
prompt.classList.add("pwa-prompt");
|
|
2605
2680
|
prompt.innerHTML = `
|
|
2606
2681
|
<div class="pwa-prompt-header">
|
|
2607
|
-
<img src="
|
|
2682
|
+
<img src="${iconUrl}" alt="Logo" />
|
|
2608
2683
|
<h1>Install ${this.api.options.name}</h1>
|
|
2609
2684
|
<button class="pwa-prompt-close">×</button>
|
|
2610
2685
|
</div>
|
|
@@ -2621,10 +2696,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2621
2696
|
const closeBtn = prompt.querySelector(".pwa-prompt-close");
|
|
2622
2697
|
closeBtn.onclick = () => {
|
|
2623
2698
|
var _a2;
|
|
2624
|
-
|
|
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());
|
|
2625
2701
|
prompt.remove();
|
|
2626
2702
|
};
|
|
2627
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";
|
|
2628
2706
|
if (this.nativeInstallPrompt) this.bindInstallButton();
|
|
2629
2707
|
}
|
|
2630
2708
|
}
|
|
@@ -3736,7 +3814,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3736
3814
|
} });
|
|
3737
3815
|
}
|
|
3738
3816
|
}
|
|
3739
|
-
const version = "1.3.
|
|
3817
|
+
const version = "1.3.17";
|
|
3740
3818
|
class WebRtc {
|
|
3741
3819
|
constructor(api) {
|
|
3742
3820
|
__publicField(this, "ice");
|
|
@@ -3973,18 +4051,39 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3973
4051
|
(_b = this.options.offline) == null ? void 0 : _b.forEach((id) => this.slice(id));
|
|
3974
4052
|
if (this.options.serviceWorker && typeof navigator["serviceWorker"] != "undefined") {
|
|
3975
4053
|
(async () => {
|
|
4054
|
+
let initDone = false;
|
|
3976
4055
|
const init = () => {
|
|
3977
4056
|
var _a2;
|
|
4057
|
+
if (initDone) return;
|
|
4058
|
+
initDone = true;
|
|
3978
4059
|
(_a2 = navigator.serviceWorker.controller) == null ? void 0 : _a2.postMessage({ options: { ...this.options, url: this.url } });
|
|
3979
4060
|
this.token$.subscribe((token) => {
|
|
3980
4061
|
var _a3;
|
|
3981
4062
|
return (_a3 = navigator.serviceWorker.controller) == null ? void 0 : _a3.postMessage({ token });
|
|
3982
4063
|
});
|
|
3983
4064
|
};
|
|
3984
|
-
|
|
4065
|
+
const scope = "/";
|
|
4066
|
+
const reg = await navigator.serviceWorker.getRegistration(scope).then((reg2) => reg2 ?? navigator.serviceWorker.register(this.options.serviceWorker, { scope: "/", type: "module" }));
|
|
4067
|
+
try {
|
|
4068
|
+
await reg.update();
|
|
4069
|
+
} catch (e) {
|
|
4070
|
+
}
|
|
4071
|
+
if (typeof document !== "undefined") {
|
|
4072
|
+
document.addEventListener("visibilitychange", () => {
|
|
4073
|
+
if (document.visibilityState === "visible") reg.update().catch(() => {
|
|
4074
|
+
});
|
|
4075
|
+
});
|
|
4076
|
+
}
|
|
3985
4077
|
navigator.serviceWorker.ready.then(() => {
|
|
3986
4078
|
if (navigator.serviceWorker.controller) navigator.serviceWorker.ready.then(() => init());
|
|
3987
4079
|
else navigator.serviceWorker.addEventListener("controllerchange", () => init(), { once: true });
|
|
4080
|
+
let refreshed = false;
|
|
4081
|
+
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
|
4082
|
+
if (refreshed) return;
|
|
4083
|
+
refreshed = true;
|
|
4084
|
+
const standalone = matchMedia("(display-mode: standalone)").matches || (navigator == null ? void 0 : navigator.standalone);
|
|
4085
|
+
if (standalone) location.reload();
|
|
4086
|
+
});
|
|
3988
4087
|
});
|
|
3989
4088
|
})();
|
|
3990
4089
|
}
|
|
@@ -4042,9 +4141,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4042
4141
|
}),
|
|
4043
4142
|
body: JSON.stringify(_Api.translateTokens(req))
|
|
4044
4143
|
}).then(async (resp) => {
|
|
4045
|
-
const warning = resp.headers
|
|
4144
|
+
const warning = resp.headers.get("X-Warning");
|
|
4046
4145
|
if (warning) console.warn(warning);
|
|
4047
|
-
const banner = resp.headers
|
|
4146
|
+
const banner = resp.headers.get("X-User-Notice");
|
|
4048
4147
|
if (banner) {
|
|
4049
4148
|
createBanner(banner);
|
|
4050
4149
|
setTimeout(() => removeBanner(), 1e4);
|
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,22 +2378,24 @@ 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 */
|
|
2393
2397
|
async setup(manifest = {}) {
|
|
2394
|
-
var _a;
|
|
2398
|
+
var _a, _b, _c;
|
|
2395
2399
|
const storageKey = `${this.api.options.name}:pwa`;
|
|
2396
2400
|
window.addEventListener("beforeinstallprompt", (e) => {
|
|
2397
2401
|
e.preventDefault();
|
|
@@ -2424,41 +2428,111 @@ class PWA {
|
|
|
2424
2428
|
meta2.content = value;
|
|
2425
2429
|
document.head.append(meta2);
|
|
2426
2430
|
};
|
|
2431
|
+
const link = (rel, href) => {
|
|
2432
|
+
const exists = document.querySelector(`link[rel="${rel}"]`);
|
|
2433
|
+
if (href === void 0) return exists;
|
|
2434
|
+
if (exists) {
|
|
2435
|
+
exists.href = href;
|
|
2436
|
+
return exists;
|
|
2437
|
+
}
|
|
2438
|
+
const el = document.createElement("link");
|
|
2439
|
+
el.rel = rel;
|
|
2440
|
+
el.href = href;
|
|
2441
|
+
document.head.append(el);
|
|
2442
|
+
return el;
|
|
2443
|
+
};
|
|
2444
|
+
const resolveUrl = (href) => {
|
|
2445
|
+
if (!href) return "";
|
|
2446
|
+
try {
|
|
2447
|
+
return new URL(href, location.href).href;
|
|
2448
|
+
} catch (e) {
|
|
2449
|
+
return href;
|
|
2450
|
+
}
|
|
2451
|
+
};
|
|
2452
|
+
const pickFavicon = () => {
|
|
2453
|
+
const touch = document.querySelector('link[rel="apple-touch-icon"]');
|
|
2454
|
+
if (touch == null ? void 0 : touch.href) return resolveUrl(touch.href);
|
|
2455
|
+
const iconWithSizes = Array.from(document.querySelectorAll('link[rel~="icon"][sizes]'));
|
|
2456
|
+
if (iconWithSizes.length) {
|
|
2457
|
+
const best = iconWithSizes.sort((a, b) => {
|
|
2458
|
+
var _a2, _b2;
|
|
2459
|
+
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);
|
|
2460
|
+
})[0];
|
|
2461
|
+
if (best == null ? void 0 : best.href) return resolveUrl(best.href);
|
|
2462
|
+
}
|
|
2463
|
+
const anyIcon = document.querySelector('link[rel~="icon"]');
|
|
2464
|
+
return (anyIcon == null ? void 0 : anyIcon.href) ? resolveUrl(anyIcon.href) : "";
|
|
2465
|
+
};
|
|
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;
|
|
2427
2493
|
meta("name", "mobile-web-app-capable", "yes");
|
|
2428
2494
|
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
2429
2495
|
meta("name", "apple-mobile-web-app-title", this.api.options.name);
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2496
|
+
link("apple-touch-icon", iconUrl);
|
|
2497
|
+
link("apple-touch-startup-image", iconUrl);
|
|
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);
|
|
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
|
+
];
|
|
2449
2522
|
}
|
|
2450
|
-
|
|
2523
|
+
manifestLink.href = `${base}/manifest?ts=${Date.now()}&json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2524
|
+
if (!((_c = this.api.options.pwaSettings) == null ? void 0 : _c.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
|
|
2451
2525
|
const t = Number(this.api.options.pwaSettings.timeout ?? 30);
|
|
2452
2526
|
const timeoutMs = t >= 1e3 ? t : t * 1e3;
|
|
2453
2527
|
setTimeout(() => {
|
|
2454
|
-
var _a2,
|
|
2528
|
+
var _a2, _b2, _c2, _d;
|
|
2455
2529
|
const raw = localStorage.getItem(storageKey);
|
|
2456
2530
|
if (raw === "installed") return;
|
|
2457
|
-
if (((
|
|
2531
|
+
if (((_b2 = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b2.dismissExpiry) === 0) {
|
|
2458
2532
|
if (raw !== "installed") localStorage.removeItem(storageKey);
|
|
2459
2533
|
}
|
|
2460
2534
|
const dismissedAt = raw ? Number(raw) : 0;
|
|
2461
|
-
const expiryDays = Number(((_d = (
|
|
2535
|
+
const expiryDays = Number(((_d = (_c2 = this.api.options) == null ? void 0 : _c2.pwaSettings) == null ? void 0 : _d.dismissExpiry) ?? 0);
|
|
2462
2536
|
if (dismissedAt && expiryDays > 0) {
|
|
2463
2537
|
const expiryMs = expiryDays * 24 * 60 * 60 * 1e3;
|
|
2464
2538
|
if (Date.now() < dismissedAt + expiryMs) return;
|
|
@@ -2475,6 +2549,7 @@ class PWA {
|
|
|
2475
2549
|
if (this.pwa) return;
|
|
2476
2550
|
if (localStorage.getItem(storageKey) === "installed") return;
|
|
2477
2551
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2552
|
+
const iconUrl = this.resolvedIconUrl || "https://datalynk-client.primary.auxilium.world/logo.png";
|
|
2478
2553
|
const targetPlatform = platform || this.platform;
|
|
2479
2554
|
const isAndroid = targetPlatform == "android";
|
|
2480
2555
|
const isIOS = targetPlatform == "ios";
|
|
@@ -2600,7 +2675,7 @@ class PWA {
|
|
|
2600
2675
|
prompt.classList.add("pwa-prompt");
|
|
2601
2676
|
prompt.innerHTML = `
|
|
2602
2677
|
<div class="pwa-prompt-header">
|
|
2603
|
-
<img src="
|
|
2678
|
+
<img src="${iconUrl}" alt="Logo" />
|
|
2604
2679
|
<h1>Install ${this.api.options.name}</h1>
|
|
2605
2680
|
<button class="pwa-prompt-close">×</button>
|
|
2606
2681
|
</div>
|
|
@@ -2617,10 +2692,13 @@ class PWA {
|
|
|
2617
2692
|
const closeBtn = prompt.querySelector(".pwa-prompt-close");
|
|
2618
2693
|
closeBtn.onclick = () => {
|
|
2619
2694
|
var _a2;
|
|
2620
|
-
|
|
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());
|
|
2621
2697
|
prompt.remove();
|
|
2622
2698
|
};
|
|
2623
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";
|
|
2624
2702
|
if (this.nativeInstallPrompt) this.bindInstallButton();
|
|
2625
2703
|
}
|
|
2626
2704
|
}
|
|
@@ -3732,7 +3810,7 @@ class Superuser {
|
|
|
3732
3810
|
} });
|
|
3733
3811
|
}
|
|
3734
3812
|
}
|
|
3735
|
-
const version = "1.3.
|
|
3813
|
+
const version = "1.3.17";
|
|
3736
3814
|
class WebRtc {
|
|
3737
3815
|
constructor(api) {
|
|
3738
3816
|
__publicField(this, "ice");
|
|
@@ -3969,18 +4047,39 @@ const _Api = class _Api {
|
|
|
3969
4047
|
(_b = this.options.offline) == null ? void 0 : _b.forEach((id) => this.slice(id));
|
|
3970
4048
|
if (this.options.serviceWorker && typeof navigator["serviceWorker"] != "undefined") {
|
|
3971
4049
|
(async () => {
|
|
4050
|
+
let initDone = false;
|
|
3972
4051
|
const init = () => {
|
|
3973
4052
|
var _a2;
|
|
4053
|
+
if (initDone) return;
|
|
4054
|
+
initDone = true;
|
|
3974
4055
|
(_a2 = navigator.serviceWorker.controller) == null ? void 0 : _a2.postMessage({ options: { ...this.options, url: this.url } });
|
|
3975
4056
|
this.token$.subscribe((token) => {
|
|
3976
4057
|
var _a3;
|
|
3977
4058
|
return (_a3 = navigator.serviceWorker.controller) == null ? void 0 : _a3.postMessage({ token });
|
|
3978
4059
|
});
|
|
3979
4060
|
};
|
|
3980
|
-
|
|
4061
|
+
const scope = "/";
|
|
4062
|
+
const reg = await navigator.serviceWorker.getRegistration(scope).then((reg2) => reg2 ?? navigator.serviceWorker.register(this.options.serviceWorker, { scope: "/", type: "module" }));
|
|
4063
|
+
try {
|
|
4064
|
+
await reg.update();
|
|
4065
|
+
} catch (e) {
|
|
4066
|
+
}
|
|
4067
|
+
if (typeof document !== "undefined") {
|
|
4068
|
+
document.addEventListener("visibilitychange", () => {
|
|
4069
|
+
if (document.visibilityState === "visible") reg.update().catch(() => {
|
|
4070
|
+
});
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
3981
4073
|
navigator.serviceWorker.ready.then(() => {
|
|
3982
4074
|
if (navigator.serviceWorker.controller) navigator.serviceWorker.ready.then(() => init());
|
|
3983
4075
|
else navigator.serviceWorker.addEventListener("controllerchange", () => init(), { once: true });
|
|
4076
|
+
let refreshed = false;
|
|
4077
|
+
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
|
4078
|
+
if (refreshed) return;
|
|
4079
|
+
refreshed = true;
|
|
4080
|
+
const standalone = matchMedia("(display-mode: standalone)").matches || (navigator == null ? void 0 : navigator.standalone);
|
|
4081
|
+
if (standalone) location.reload();
|
|
4082
|
+
});
|
|
3984
4083
|
});
|
|
3985
4084
|
})();
|
|
3986
4085
|
}
|
|
@@ -4038,9 +4137,9 @@ const _Api = class _Api {
|
|
|
4038
4137
|
}),
|
|
4039
4138
|
body: JSON.stringify(_Api.translateTokens(req))
|
|
4040
4139
|
}).then(async (resp) => {
|
|
4041
|
-
const warning = resp.headers
|
|
4140
|
+
const warning = resp.headers.get("X-Warning");
|
|
4042
4141
|
if (warning) console.warn(warning);
|
|
4043
|
-
const banner = resp.headers
|
|
4142
|
+
const banner = resp.headers.get("X-User-Notice");
|
|
4044
4143
|
if (banner) {
|
|
4045
4144
|
createBanner(banner);
|
|
4046
4145
|
setTimeout(() => removeBanner(), 1e4);
|
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":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,qBAAa,GAAG;
|
|
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",
|