@forgeroute/ui 0.5.12 → 0.5.14
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/fesm2022/forgeroute-ui-map.mjs +1 -0
- package/fesm2022/forgeroute-ui-map.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-messaging.mjs +5 -0
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-offline.mjs +20 -0
- package/fesm2022/forgeroute-ui-offline.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-pdf.mjs +1 -0
- package/fesm2022/forgeroute-ui-pdf.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-quickbooks.mjs +55 -24
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs +167 -9
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +337 -41
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-ui-labels.es-CsmSdouE.mjs → forgeroute-ui-ui-labels.es-Dzj_XJJM.mjs} +18 -11
- package/fesm2022/forgeroute-ui-ui-labels.es-Dzj_XJJM.mjs.map +1 -0
- package/fesm2022/forgeroute-ui.mjs +196 -40
- package/fesm2022/forgeroute-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-messaging.d.ts +5 -5
- package/types/forgeroute-ui-offline.d.ts +4 -0
- package/types/forgeroute-ui-quickbooks.d.ts +17 -2
- package/types/forgeroute-ui-square.d.ts +75 -3
- package/types/forgeroute-ui-stripe.d.ts +124 -6
- package/types/forgeroute-ui.d.ts +83 -30
- package/fesm2022/forgeroute-ui-ui-labels.es-CsmSdouE.mjs.map +0 -1
|
@@ -177,6 +177,7 @@ function generateUuid() {
|
|
|
177
177
|
}
|
|
178
178
|
const ONLINE_DEBOUNCE_MS = 300;
|
|
179
179
|
const PROBE_TIMEOUT_MS = 5e3;
|
|
180
|
+
const SLOW_RECOVERY_FAST_COUNT = 2;
|
|
180
181
|
var ConnectionStateService = class ConnectionStateService {
|
|
181
182
|
constructor() {
|
|
182
183
|
this.cfg = resolveConfig(inject(OFFLINE_SUPPORT_CONFIG, { optional: true }) ?? { getUserId: () => null });
|
|
@@ -198,6 +199,7 @@ var ConnectionStateService = class ConnectionStateService {
|
|
|
198
199
|
this.recovered$ = new Subject();
|
|
199
200
|
this.failures = [];
|
|
200
201
|
this.slowTimes = [];
|
|
202
|
+
this.fastStreak = 0;
|
|
201
203
|
this.quietTimer = null;
|
|
202
204
|
this.onlineTimer = null;
|
|
203
205
|
this.probeTimer = null;
|
|
@@ -229,7 +231,12 @@ var ConnectionStateService = class ConnectionStateService {
|
|
|
229
231
|
this.failures = [];
|
|
230
232
|
if (this.unreachable()) this.clearUnreachable("online");
|
|
231
233
|
if (info.long) return;
|
|
234
|
+
if (info.durationMs < this.cfg.slow.slowMs) {
|
|
235
|
+
this.fastStreak++;
|
|
236
|
+
if (this.slowFlag() && this.fastStreak >= SLOW_RECOVERY_FAST_COUNT) this.resetSlow();
|
|
237
|
+
}
|
|
232
238
|
if (info.durationMs >= this.cfg.slow.slowMs) {
|
|
239
|
+
this.fastStreak = 0;
|
|
233
240
|
this.slowTimes = this.slowTimes.filter((t) => now - t <= this.cfg.slow.windowMs);
|
|
234
241
|
this.slowTimes.push(now);
|
|
235
242
|
if (this.slowTimes.length >= this.cfg.slow.slowCount || this.slowFlag()) this.markSlow();
|
|
@@ -325,6 +332,7 @@ var ConnectionStateService = class ConnectionStateService {
|
|
|
325
332
|
if (!this.unreachable()) return;
|
|
326
333
|
this.unreachable.set(false);
|
|
327
334
|
this.stopRecoveryTimers();
|
|
335
|
+
this.resetSlow();
|
|
328
336
|
this.recompute();
|
|
329
337
|
if (this.browserOnline()) this.recovered$.next(trigger);
|
|
330
338
|
}
|
|
@@ -338,6 +346,17 @@ var ConnectionStateService = class ConnectionStateService {
|
|
|
338
346
|
this.optimisticTimer = null;
|
|
339
347
|
}
|
|
340
348
|
}
|
|
349
|
+
resetSlow() {
|
|
350
|
+
this.fastStreak = 0;
|
|
351
|
+
this.slowTimes = [];
|
|
352
|
+
if (this.quietTimer) {
|
|
353
|
+
clearTimeout(this.quietTimer);
|
|
354
|
+
this.quietTimer = null;
|
|
355
|
+
}
|
|
356
|
+
if (!this.slowFlag()) return;
|
|
357
|
+
this.slowFlag.set(false);
|
|
358
|
+
this.recompute();
|
|
359
|
+
}
|
|
341
360
|
markSlow() {
|
|
342
361
|
this.slowFlag.set(true);
|
|
343
362
|
if (this.quietTimer) clearTimeout(this.quietTimer);
|
|
@@ -371,6 +390,7 @@ var ConnectionStateService = class ConnectionStateService {
|
|
|
371
390
|
this.unreachable.set(false);
|
|
372
391
|
this.stopRecoveryTimers();
|
|
373
392
|
}
|
|
393
|
+
this.resetSlow();
|
|
374
394
|
this.recompute();
|
|
375
395
|
this.recovered$.next("online");
|
|
376
396
|
} else this.recompute();
|