@auxilium/datalynk-client 1.3.14 → 1.3.15
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 +30 -10
- package/dist/index.mjs +30 -10
- package/dist/pwa.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2396,6 +2396,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2396
2396
|
/** Setup the PWA */
|
|
2397
2397
|
async setup(manifest = {}) {
|
|
2398
2398
|
var _a;
|
|
2399
|
+
const storageKey = `${this.api.options.name}:pwa`;
|
|
2399
2400
|
window.addEventListener("beforeinstallprompt", (e) => {
|
|
2400
2401
|
e.preventDefault();
|
|
2401
2402
|
this.nativeInstallPrompt = e;
|
|
@@ -2405,6 +2406,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2405
2406
|
this.bindInstallButton();
|
|
2406
2407
|
}
|
|
2407
2408
|
});
|
|
2409
|
+
window.addEventListener("appinstalled", () => {
|
|
2410
|
+
var _a2;
|
|
2411
|
+
localStorage.setItem(storageKey, "installed");
|
|
2412
|
+
(_a2 = document.querySelector(".pwa-prompt")) == null ? void 0 : _a2.remove();
|
|
2413
|
+
});
|
|
2408
2414
|
this.api.options.pwaSettings = {
|
|
2409
2415
|
timeout: 30,
|
|
2410
2416
|
// Seconds
|
|
@@ -2445,19 +2451,33 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2445
2451
|
link.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2446
2452
|
document.head.append(link);
|
|
2447
2453
|
}
|
|
2448
|
-
if (!((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac")
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2454
|
+
if (!((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
|
|
2455
|
+
const t = Number(this.api.options.pwaSettings.timeout ?? 30);
|
|
2456
|
+
const timeoutMs = t >= 1e3 ? t : t * 1e3;
|
|
2457
|
+
setTimeout(() => {
|
|
2458
|
+
var _a2, _b, _c, _d;
|
|
2459
|
+
const raw = localStorage.getItem(storageKey);
|
|
2460
|
+
if (raw === "installed") return;
|
|
2461
|
+
if (((_b = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b.dismissExpiry) === 0) {
|
|
2462
|
+
if (raw !== "installed") localStorage.removeItem(storageKey);
|
|
2463
|
+
}
|
|
2464
|
+
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);
|
|
2466
|
+
if (dismissedAt && expiryDays > 0) {
|
|
2467
|
+
const expiryMs = expiryDays * 24 * 60 * 60 * 1e3;
|
|
2468
|
+
if (Date.now() < dismissedAt + expiryMs) return;
|
|
2469
|
+
}
|
|
2470
|
+
this.prompt();
|
|
2471
|
+
}, timeoutMs);
|
|
2472
|
+
}
|
|
2456
2473
|
}
|
|
2457
2474
|
/** Prompt user to install the app */
|
|
2458
2475
|
async prompt(platform) {
|
|
2459
2476
|
var _a;
|
|
2477
|
+
const storageKey = `${this.api.options.name}:pwa`;
|
|
2460
2478
|
if ((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) return;
|
|
2479
|
+
if (this.pwa) return;
|
|
2480
|
+
if (localStorage.getItem(storageKey) === "installed") return;
|
|
2461
2481
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2462
2482
|
const targetPlatform = platform || this.platform;
|
|
2463
2483
|
const isAndroid = targetPlatform == "android";
|
|
@@ -2601,7 +2621,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2601
2621
|
const closeBtn = prompt.querySelector(".pwa-prompt-close");
|
|
2602
2622
|
closeBtn.onclick = () => {
|
|
2603
2623
|
var _a2;
|
|
2604
|
-
!!((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ? localStorage.setItem(
|
|
2624
|
+
!!((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ? localStorage.setItem(storageKey, Date.now().toString()) : localStorage.removeItem(storageKey);
|
|
2605
2625
|
prompt.remove();
|
|
2606
2626
|
};
|
|
2607
2627
|
document.body.append(prompt);
|
|
@@ -3716,7 +3736,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3716
3736
|
} });
|
|
3717
3737
|
}
|
|
3718
3738
|
}
|
|
3719
|
-
const version = "1.3.
|
|
3739
|
+
const version = "1.3.15";
|
|
3720
3740
|
class WebRtc {
|
|
3721
3741
|
constructor(api) {
|
|
3722
3742
|
__publicField(this, "ice");
|
package/dist/index.mjs
CHANGED
|
@@ -2392,6 +2392,7 @@ class PWA {
|
|
|
2392
2392
|
/** Setup the PWA */
|
|
2393
2393
|
async setup(manifest = {}) {
|
|
2394
2394
|
var _a;
|
|
2395
|
+
const storageKey = `${this.api.options.name}:pwa`;
|
|
2395
2396
|
window.addEventListener("beforeinstallprompt", (e) => {
|
|
2396
2397
|
e.preventDefault();
|
|
2397
2398
|
this.nativeInstallPrompt = e;
|
|
@@ -2401,6 +2402,11 @@ class PWA {
|
|
|
2401
2402
|
this.bindInstallButton();
|
|
2402
2403
|
}
|
|
2403
2404
|
});
|
|
2405
|
+
window.addEventListener("appinstalled", () => {
|
|
2406
|
+
var _a2;
|
|
2407
|
+
localStorage.setItem(storageKey, "installed");
|
|
2408
|
+
(_a2 = document.querySelector(".pwa-prompt")) == null ? void 0 : _a2.remove();
|
|
2409
|
+
});
|
|
2404
2410
|
this.api.options.pwaSettings = {
|
|
2405
2411
|
timeout: 30,
|
|
2406
2412
|
// Seconds
|
|
@@ -2441,19 +2447,33 @@ class PWA {
|
|
|
2441
2447
|
link.href = `${base}/manifest?json=${encodeURIComponent(JSON.stringify(manifestObj))}`;
|
|
2442
2448
|
document.head.append(link);
|
|
2443
2449
|
}
|
|
2444
|
-
if (!((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac")
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2450
|
+
if (!((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) && !this.headless && !this.iframe && !this.pwa && this.platform != "mac") {
|
|
2451
|
+
const t = Number(this.api.options.pwaSettings.timeout ?? 30);
|
|
2452
|
+
const timeoutMs = t >= 1e3 ? t : t * 1e3;
|
|
2453
|
+
setTimeout(() => {
|
|
2454
|
+
var _a2, _b, _c, _d;
|
|
2455
|
+
const raw = localStorage.getItem(storageKey);
|
|
2456
|
+
if (raw === "installed") return;
|
|
2457
|
+
if (((_b = (_a2 = this.api.options) == null ? void 0 : _a2.pwaSettings) == null ? void 0 : _b.dismissExpiry) === 0) {
|
|
2458
|
+
if (raw !== "installed") localStorage.removeItem(storageKey);
|
|
2459
|
+
}
|
|
2460
|
+
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);
|
|
2462
|
+
if (dismissedAt && expiryDays > 0) {
|
|
2463
|
+
const expiryMs = expiryDays * 24 * 60 * 60 * 1e3;
|
|
2464
|
+
if (Date.now() < dismissedAt + expiryMs) return;
|
|
2465
|
+
}
|
|
2466
|
+
this.prompt();
|
|
2467
|
+
}, timeoutMs);
|
|
2468
|
+
}
|
|
2452
2469
|
}
|
|
2453
2470
|
/** Prompt user to install the app */
|
|
2454
2471
|
async prompt(platform) {
|
|
2455
2472
|
var _a;
|
|
2473
|
+
const storageKey = `${this.api.options.name}:pwa`;
|
|
2456
2474
|
if ((_a = this.api.options.pwaSettings) == null ? void 0 : _a.hidePWAPrompt) return;
|
|
2475
|
+
if (this.pwa) return;
|
|
2476
|
+
if (localStorage.getItem(storageKey) === "installed") return;
|
|
2457
2477
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2458
2478
|
const targetPlatform = platform || this.platform;
|
|
2459
2479
|
const isAndroid = targetPlatform == "android";
|
|
@@ -2597,7 +2617,7 @@ class PWA {
|
|
|
2597
2617
|
const closeBtn = prompt.querySelector(".pwa-prompt-close");
|
|
2598
2618
|
closeBtn.onclick = () => {
|
|
2599
2619
|
var _a2;
|
|
2600
|
-
!!((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ? localStorage.setItem(
|
|
2620
|
+
!!((_a2 = this.api.options.pwaSettings) == null ? void 0 : _a2.dismissExpiry) ? localStorage.setItem(storageKey, Date.now().toString()) : localStorage.removeItem(storageKey);
|
|
2601
2621
|
prompt.remove();
|
|
2602
2622
|
};
|
|
2603
2623
|
document.body.append(prompt);
|
|
@@ -3712,7 +3732,7 @@ class Superuser {
|
|
|
3712
3732
|
} });
|
|
3713
3733
|
}
|
|
3714
3734
|
}
|
|
3715
|
-
const version = "1.3.
|
|
3735
|
+
const version = "1.3.15";
|
|
3716
3736
|
class WebRtc {
|
|
3717
3737
|
constructor(api) {
|
|
3718
3738
|
__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,4B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IAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CAkLzC"}
|
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.15",
|
|
6
6
|
"author": "Zak Timson <zaktimson@gmail.com>",
|
|
7
7
|
"private": false,
|
|
8
8
|
"main": "./dist/index.cjs",
|