@auxilium/datalynk-client 1.3.13 → 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/README.md +4 -4
- package/dist/index.cjs +33 -13
- package/dist/index.mjs +33 -13
- package/dist/pwa.d.ts.map +1 -1
- package/dist/service.worker.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Datalynk client library to integrate JavaScript clients with the Datalynk API.
|
|
|
11
11
|
- [Datalynk Client Library](#datalynk-client-library)
|
|
12
12
|
- [Table of Contents](#table-of-contents)
|
|
13
13
|
- [Quick Start](#quick-start)
|
|
14
|
-
- [API Documentation](https://datalynk-client.
|
|
14
|
+
- [API Documentation](https://datalynk-client.primary.auxilium.world)
|
|
15
15
|
- [Cheatsheet](#cheatsheet)
|
|
16
16
|
- [Integration](#integration)
|
|
17
17
|
- [Angular](#angular)
|
|
@@ -49,7 +49,7 @@ const api = new API('https://spoke.auxiliumgroup.com');
|
|
|
49
49
|
const resp = await api.request({'$/auth/current':{}});
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
## [API Documentation](https://datalynk-client.
|
|
52
|
+
## [API Documentation](https://datalynk-client.primary.auxilium.world)
|
|
53
53
|
|
|
54
54
|
## Cheatsheet
|
|
55
55
|
|
|
@@ -247,7 +247,7 @@ await prompt.wait; // Wait for the user to login/close the prompt
|
|
|
247
247
|
prompt.close(); // Close prompt manually
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
[Full list of options](https://datalynk-client.
|
|
250
|
+
[Full list of options](https://datalynk-client.primary.auxilium.world/types/login-prompt.LoginPromptOptions.html)
|
|
251
251
|
|
|
252
252
|
#### Manual Login
|
|
253
253
|
|
|
@@ -288,7 +288,7 @@ api.pwa.prompt();
|
|
|
288
288
|
```
|
|
289
289
|
|
|
290
290
|
#### Static assets
|
|
291
|
-
Upload the [service worker](https://datalynk-client.
|
|
291
|
+
Upload the [service worker](https://datalynk-client.primary.auxilium.world/dist/service.worker.mjs) `dist/service.worker.mjs` to the *root* directory of the server
|
|
292
292
|
to cache all files for use offline
|
|
293
293
|
```ts
|
|
294
294
|
const api = new Api(`https://${spoke}.auxiliumgroup.com`, {
|
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
|
|
@@ -2425,8 +2431,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2425
2431
|
meta("name", "mobile-web-app-capable", "yes");
|
|
2426
2432
|
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
2427
2433
|
meta("name", "apple-mobile-web-app-title", this.api.options.name);
|
|
2428
|
-
meta("name", "apple-touch-icon", `https://datalynk-client.
|
|
2429
|
-
meta("name", "apple-touch-startup-image", `https://datalynk-client.
|
|
2434
|
+
meta("name", "apple-touch-icon", `https://datalynk-client.primary.auxilium.world/logo.png`);
|
|
2435
|
+
meta("name", "apple-touch-startup-image", `https://datalynk-client.primary.auxilium.world/logo.png`);
|
|
2430
2436
|
if (!document.querySelector('link[rel="manifest"]')) {
|
|
2431
2437
|
const link = document.createElement("link");
|
|
2432
2438
|
link.rel = "manifest";
|
|
@@ -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";
|
|
@@ -2584,7 +2604,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2584
2604
|
prompt.classList.add("pwa-prompt");
|
|
2585
2605
|
prompt.innerHTML = `
|
|
2586
2606
|
<div class="pwa-prompt-header">
|
|
2587
|
-
<img src="https://datalynk-client.
|
|
2607
|
+
<img src="https://datalynk-client.primary.auxilium.world/logo.png" alt="Logo" />
|
|
2588
2608
|
<h1>Install ${this.api.options.name}</h1>
|
|
2589
2609
|
<button class="pwa-prompt-close">×</button>
|
|
2590
2610
|
</div>
|
|
@@ -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
|
|
@@ -2421,8 +2427,8 @@ class PWA {
|
|
|
2421
2427
|
meta("name", "mobile-web-app-capable", "yes");
|
|
2422
2428
|
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
2423
2429
|
meta("name", "apple-mobile-web-app-title", this.api.options.name);
|
|
2424
|
-
meta("name", "apple-touch-icon", `https://datalynk-client.
|
|
2425
|
-
meta("name", "apple-touch-startup-image", `https://datalynk-client.
|
|
2430
|
+
meta("name", "apple-touch-icon", `https://datalynk-client.primary.auxilium.world/logo.png`);
|
|
2431
|
+
meta("name", "apple-touch-startup-image", `https://datalynk-client.primary.auxilium.world/logo.png`);
|
|
2426
2432
|
if (!document.querySelector('link[rel="manifest"]')) {
|
|
2427
2433
|
const link = document.createElement("link");
|
|
2428
2434
|
link.rel = "manifest";
|
|
@@ -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";
|
|
@@ -2580,7 +2600,7 @@ class PWA {
|
|
|
2580
2600
|
prompt.classList.add("pwa-prompt");
|
|
2581
2601
|
prompt.innerHTML = `
|
|
2582
2602
|
<div class="pwa-prompt-header">
|
|
2583
|
-
<img src="https://datalynk-client.
|
|
2603
|
+
<img src="https://datalynk-client.primary.auxilium.world/logo.png" alt="Logo" />
|
|
2584
2604
|
<h1>Install ${this.api.options.name}</h1>
|
|
2585
2605
|
<button class="pwa-prompt-close">×</button>
|
|
2586
2606
|
</div>
|
|
@@ -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,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;
|
|
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"}
|
package/dist/service.worker.mjs
CHANGED
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",
|