@innspel/core 0.7.0 → 0.8.0

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 CHANGED
@@ -1274,7 +1274,7 @@ async function lastOppTilLagring(fetchImpl, presign, body, signal) {
1274
1274
  }
1275
1275
 
1276
1276
  // src/versjon.ts
1277
- var VERSJON = "0.7.0";
1277
+ var VERSJON = "0.8.0";
1278
1278
 
1279
1279
  // src/klient.ts
1280
1280
  var STANDARD_TIMEOUT_MS = 1e4;
@@ -1341,6 +1341,18 @@ function validerOpsjoner(o) {
1341
1341
  "mangler eller er ikke en funksjon"
1342
1342
  );
1343
1343
  }
1344
+ if (o.connectivity !== void 0) {
1345
+ krev(
1346
+ typeof o.connectivity?.isOnline === "function",
1347
+ "connectivity.isOnline",
1348
+ "mangler eller er ikke en funksjon. Gi et objekt med isOnline() og valgfri subscribe(), eller utelat opsjonen \u2014 se docs/sdk/README.md, \xABNettstatus\xBB"
1349
+ );
1350
+ krev(
1351
+ o.connectivity.subscribe === void 0 || typeof o.connectivity.subscribe === "function",
1352
+ "connectivity.subscribe",
1353
+ "er valgfri, men m\xE5 v\xE6re en funksjon som gir en avmelding tilbake"
1354
+ );
1355
+ }
1344
1356
  }
1345
1357
  function tilApiFeil(status, kropp, response) {
1346
1358
  const body = kropp ?? {};
@@ -1477,9 +1489,13 @@ function init(options) {
1477
1489
  (rad) => sendN\u00E5({ type: rad.type, text: rad.text }, rad.clientRef, kontekst),
1478
1490
  telemetri
1479
1491
  );
1492
+ options.connectivity?.subscribe?.((online) => {
1493
+ if (online) void flushK\u00F8().catch(() => void 0);
1494
+ });
1480
1495
  const innspel = {
1481
1496
  version: VERSJON,
1482
1497
  isAnonymous: anonym,
1498
+ connectivity: options.connectivity ?? null,
1483
1499
  settings,
1484
1500
  context: kontekst,
1485
1501
  async loadSettings() {