@auxilium/datalynk-client 1.2.8 → 1.2.91
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.js +39 -22
- package/dist/index.mjs +39 -22
- package/dist/pwa.d.ts +1 -0
- package/dist/pwa.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2256,8 +2256,14 @@ class Auth {
|
|
|
2256
2256
|
}
|
|
2257
2257
|
class PWA {
|
|
2258
2258
|
constructor(api) {
|
|
2259
|
+
__publicField(this, "deferredPrompt", null);
|
|
2259
2260
|
this.api = api;
|
|
2261
|
+
window.addEventListener("beforeinstallprompt", (e) => {
|
|
2262
|
+
e.preventDefault();
|
|
2263
|
+
this.deferredPrompt = e;
|
|
2264
|
+
});
|
|
2260
2265
|
}
|
|
2266
|
+
// Holds the beforeinstallprompt event
|
|
2261
2267
|
get iframe() {
|
|
2262
2268
|
return (parent == null ? void 0 : parent.location) != location;
|
|
2263
2269
|
}
|
|
@@ -2306,16 +2312,16 @@ class PWA {
|
|
|
2306
2312
|
if (!this.iframe && !this.pwa && this.platform != "mac") setTimeout(() => {
|
|
2307
2313
|
const dismissed = !!localStorage.getItem(`${this.api.options.name}:pwa`);
|
|
2308
2314
|
if (!dismissed) this.prompt();
|
|
2309
|
-
},
|
|
2315
|
+
}, 1e4);
|
|
2310
2316
|
}
|
|
2311
2317
|
/** Prompt user to install the app */
|
|
2312
2318
|
async prompt(platform) {
|
|
2313
2319
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2314
|
-
this.api.url;
|
|
2315
2320
|
const android = (platform || this.platform) == "android";
|
|
2316
2321
|
let style = document.querySelector("style.pwa");
|
|
2317
2322
|
if (!style) {
|
|
2318
2323
|
style = document.createElement("style");
|
|
2324
|
+
style.classList.add("pwa");
|
|
2319
2325
|
style.innerHTML = `
|
|
2320
2326
|
.pwa-prompt-backdrop {
|
|
2321
2327
|
position: fixed;
|
|
@@ -2393,26 +2399,25 @@ class PWA {
|
|
|
2393
2399
|
</div>
|
|
2394
2400
|
<div style="display: flex; flex-direction: column; align-items: center">
|
|
2395
2401
|
<div style="border-top: 2px solid #00000020; border-bottom: 2px solid #00000020; padding: 0 1rem">
|
|
2396
|
-
|
|
2402
|
+
<p style="margin-top: 1rem; text-align: center">
|
|
2403
|
+
${this.deferredPrompt ? "Click the button below to install the app directly to your device." : "This website can be installed as an App! Add it to your home screen for quick access & fullscreen use."}
|
|
2404
|
+
</p>
|
|
2397
2405
|
</div>
|
|
2398
|
-
|
|
2399
|
-
<
|
|
2400
|
-
<
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
</
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
</td>
|
|
2414
|
-
</tr>
|
|
2415
|
-
</table>
|
|
2406
|
+
${this.deferredPrompt ? `<button id="installPwaBtn" style="background:#0B76FC;color:white;border:none;padding:.5rem 1rem;border-radius:5px;cursor:pointer;margin:1rem 0">Install</button>` : `
|
|
2407
|
+
<table style="margin: 1.5rem 0">
|
|
2408
|
+
<tr>
|
|
2409
|
+
<td style="width: 50px; text-align: center">
|
|
2410
|
+
${android ? '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="black" style="transform: scale(1.5)">...</svg>' : '<svg viewBox="0 0 566 670" xmlns="http://www.w3.org/2000/svg" fill="#0B76FC" height="40px">...</svg>'}
|
|
2411
|
+
</td>
|
|
2412
|
+
<td><p style="margin: 1rem 0">1) ${android ? "Open the dropdown menu" : 'Press the "Share" button'}</p></td>
|
|
2413
|
+
</tr>
|
|
2414
|
+
<tr>
|
|
2415
|
+
<td style="width: 50px; text-align: center">
|
|
2416
|
+
${android ? '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">...</svg>' : '<svg viewBox="0 0 578 584" xmlns="http://www.w3.org/2000/svg" fill="black" height="34px">...</svg>'}
|
|
2417
|
+
</td>
|
|
2418
|
+
<td><p style="margin: 1rem 0">2) Press "Add to Home Screen"</p></td>
|
|
2419
|
+
</tr>
|
|
2420
|
+
</table>`}
|
|
2416
2421
|
</div>`;
|
|
2417
2422
|
const close = document.createElement("button");
|
|
2418
2423
|
close.classList.add("pwa-prompt-close");
|
|
@@ -2429,6 +2434,18 @@ class PWA {
|
|
|
2429
2434
|
prompt.append(close);
|
|
2430
2435
|
backdrop.append(prompt);
|
|
2431
2436
|
document.body.append(backdrop);
|
|
2437
|
+
if (this.deferredPrompt) {
|
|
2438
|
+
const installBtn = prompt.querySelector("#installPwaBtn");
|
|
2439
|
+
if (installBtn) {
|
|
2440
|
+
installBtn.onclick = async () => {
|
|
2441
|
+
this.deferredPrompt.prompt();
|
|
2442
|
+
const choice = await this.deferredPrompt.userChoice;
|
|
2443
|
+
if (choice.outcome === "accepted") console.log("PWA installed");
|
|
2444
|
+
this.deferredPrompt = null;
|
|
2445
|
+
close.click();
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2432
2449
|
}
|
|
2433
2450
|
}
|
|
2434
2451
|
class Files {
|
|
@@ -3354,7 +3371,7 @@ class Superuser {
|
|
|
3354
3371
|
} });
|
|
3355
3372
|
}
|
|
3356
3373
|
}
|
|
3357
|
-
const version = "1.2.
|
|
3374
|
+
const version = "1.2.91";
|
|
3358
3375
|
class WebRtc {
|
|
3359
3376
|
constructor(api) {
|
|
3360
3377
|
__publicField(this, "ice");
|
package/dist/index.mjs
CHANGED
|
@@ -2254,8 +2254,14 @@ class Auth {
|
|
|
2254
2254
|
}
|
|
2255
2255
|
class PWA {
|
|
2256
2256
|
constructor(api) {
|
|
2257
|
+
__publicField(this, "deferredPrompt", null);
|
|
2257
2258
|
this.api = api;
|
|
2259
|
+
window.addEventListener("beforeinstallprompt", (e) => {
|
|
2260
|
+
e.preventDefault();
|
|
2261
|
+
this.deferredPrompt = e;
|
|
2262
|
+
});
|
|
2258
2263
|
}
|
|
2264
|
+
// Holds the beforeinstallprompt event
|
|
2259
2265
|
get iframe() {
|
|
2260
2266
|
return (parent == null ? void 0 : parent.location) != location;
|
|
2261
2267
|
}
|
|
@@ -2304,16 +2310,16 @@ class PWA {
|
|
|
2304
2310
|
if (!this.iframe && !this.pwa && this.platform != "mac") setTimeout(() => {
|
|
2305
2311
|
const dismissed = !!localStorage.getItem(`${this.api.options.name}:pwa`);
|
|
2306
2312
|
if (!dismissed) this.prompt();
|
|
2307
|
-
},
|
|
2313
|
+
}, 1e4);
|
|
2308
2314
|
}
|
|
2309
2315
|
/** Prompt user to install the app */
|
|
2310
2316
|
async prompt(platform) {
|
|
2311
2317
|
if (document.querySelector(".pwa-prompt")) return;
|
|
2312
|
-
this.api.url;
|
|
2313
2318
|
const android = (platform || this.platform) == "android";
|
|
2314
2319
|
let style = document.querySelector("style.pwa");
|
|
2315
2320
|
if (!style) {
|
|
2316
2321
|
style = document.createElement("style");
|
|
2322
|
+
style.classList.add("pwa");
|
|
2317
2323
|
style.innerHTML = `
|
|
2318
2324
|
.pwa-prompt-backdrop {
|
|
2319
2325
|
position: fixed;
|
|
@@ -2391,26 +2397,25 @@ class PWA {
|
|
|
2391
2397
|
</div>
|
|
2392
2398
|
<div style="display: flex; flex-direction: column; align-items: center">
|
|
2393
2399
|
<div style="border-top: 2px solid #00000020; border-bottom: 2px solid #00000020; padding: 0 1rem">
|
|
2394
|
-
|
|
2400
|
+
<p style="margin-top: 1rem; text-align: center">
|
|
2401
|
+
${this.deferredPrompt ? "Click the button below to install the app directly to your device." : "This website can be installed as an App! Add it to your home screen for quick access & fullscreen use."}
|
|
2402
|
+
</p>
|
|
2395
2403
|
</div>
|
|
2396
|
-
|
|
2397
|
-
<
|
|
2398
|
-
<
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
</
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
</td>
|
|
2412
|
-
</tr>
|
|
2413
|
-
</table>
|
|
2404
|
+
${this.deferredPrompt ? `<button id="installPwaBtn" style="background:#0B76FC;color:white;border:none;padding:.5rem 1rem;border-radius:5px;cursor:pointer;margin:1rem 0">Install</button>` : `
|
|
2405
|
+
<table style="margin: 1.5rem 0">
|
|
2406
|
+
<tr>
|
|
2407
|
+
<td style="width: 50px; text-align: center">
|
|
2408
|
+
${android ? '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="black" style="transform: scale(1.5)">...</svg>' : '<svg viewBox="0 0 566 670" xmlns="http://www.w3.org/2000/svg" fill="#0B76FC" height="40px">...</svg>'}
|
|
2409
|
+
</td>
|
|
2410
|
+
<td><p style="margin: 1rem 0">1) ${android ? "Open the dropdown menu" : 'Press the "Share" button'}</p></td>
|
|
2411
|
+
</tr>
|
|
2412
|
+
<tr>
|
|
2413
|
+
<td style="width: 50px; text-align: center">
|
|
2414
|
+
${android ? '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px">...</svg>' : '<svg viewBox="0 0 578 584" xmlns="http://www.w3.org/2000/svg" fill="black" height="34px">...</svg>'}
|
|
2415
|
+
</td>
|
|
2416
|
+
<td><p style="margin: 1rem 0">2) Press "Add to Home Screen"</p></td>
|
|
2417
|
+
</tr>
|
|
2418
|
+
</table>`}
|
|
2414
2419
|
</div>`;
|
|
2415
2420
|
const close = document.createElement("button");
|
|
2416
2421
|
close.classList.add("pwa-prompt-close");
|
|
@@ -2427,6 +2432,18 @@ class PWA {
|
|
|
2427
2432
|
prompt.append(close);
|
|
2428
2433
|
backdrop.append(prompt);
|
|
2429
2434
|
document.body.append(backdrop);
|
|
2435
|
+
if (this.deferredPrompt) {
|
|
2436
|
+
const installBtn = prompt.querySelector("#installPwaBtn");
|
|
2437
|
+
if (installBtn) {
|
|
2438
|
+
installBtn.onclick = async () => {
|
|
2439
|
+
this.deferredPrompt.prompt();
|
|
2440
|
+
const choice = await this.deferredPrompt.userChoice;
|
|
2441
|
+
if (choice.outcome === "accepted") console.log("PWA installed");
|
|
2442
|
+
this.deferredPrompt = null;
|
|
2443
|
+
close.click();
|
|
2444
|
+
};
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2430
2447
|
}
|
|
2431
2448
|
}
|
|
2432
2449
|
class Files {
|
|
@@ -3352,7 +3369,7 @@ class Superuser {
|
|
|
3352
3369
|
} });
|
|
3353
3370
|
}
|
|
3354
3371
|
}
|
|
3355
|
-
const version = "1.2.
|
|
3372
|
+
const version = "1.2.91";
|
|
3356
3373
|
class WebRtc {
|
|
3357
3374
|
constructor(api) {
|
|
3358
3375
|
__publicField(this, "ice");
|
package/dist/pwa.d.ts
CHANGED
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;IAqBH,OAAO,CAAC,QAAQ,CAAC,GAAG;IApBhC,OAAO,CAAC,cAAc,CAAa;IAEnC,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,GAAG,IAAI,OAAO,CAEjB;gBAE4B,GAAG,EAAE,GAAG;IAQrC,oBAAoB;IACd,KAAK,CAAC,QAAQ,GAAE,GAAQ;IAsC9B,qCAAqC;IAC/B,MAAM,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;CAiJzC"}
|
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.2.
|
|
5
|
+
"version": "1.2.91",
|
|
6
6
|
"author": "Zak Timson <zaktimson@gmail.com>",
|
|
7
7
|
"private": false,
|
|
8
8
|
"main": "./dist/index.cjs",
|