@zeniai/client-epic-state 5.0.12-beta2ND → 5.0.12-betaVR1
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/lib/coreEpics.js +1 -2
- package/lib/entity/tenant/tenantReducer.d.ts +1 -5
- package/lib/entity/tenant/tenantReducer.js +2 -23
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/epic.d.ts +6 -7
- package/lib/epic.js +6 -7
- package/lib/esm/coreEpics.js +1 -2
- package/lib/esm/entity/tenant/tenantReducer.js +1 -21
- package/lib/esm/epic.js +6 -7
- package/lib/esm/index.js +2 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +6 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -2
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +7 -3
- package/lib/index.d.ts +2 -5
- package/lib/index.js +30 -36
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +6 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -2
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +7 -7
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +7 -3
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -2
- package/package.json +2 -2
- package/lib/entity/tenant/SessionManager.d.ts +0 -56
- package/lib/entity/tenant/SessionManager.js +0 -310
- package/lib/entity/tenant/epic/sessionHeartbeatEpic.d.ts +0 -16
- package/lib/entity/tenant/epic/sessionHeartbeatEpic.js +0 -16
- package/lib/entity/tenant/sessionTypes.d.ts +0 -26
- package/lib/entity/tenant/sessionTypes.js +0 -12
- package/lib/esm/entity/tenant/SessionManager.js +0 -306
- package/lib/esm/entity/tenant/epic/sessionHeartbeatEpic.js +0 -12
- package/lib/esm/entity/tenant/sessionTypes.js +0 -9
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* SessionManager — Central session lifecycle manager.
|
|
4
|
-
*
|
|
5
|
-
* Responsibilities:
|
|
6
|
-
* 1. Track user activity (mousemove, keydown, click, scroll, touch)
|
|
7
|
-
* 2. Send heartbeat at configurable intervals — only when user has been active
|
|
8
|
-
* 3. Show warning popup after idle timeout
|
|
9
|
-
* 4. Auto-logout after warning countdown expires
|
|
10
|
-
* 5. Sync activity across same-origin tabs via BroadcastChannel so one
|
|
11
|
-
* active tab keeps other tabs' sessions alive (no cascading logout).
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.SessionManager = void 0;
|
|
15
|
-
const sessionTypes_1 = require("./sessionTypes");
|
|
16
|
-
/** Events that indicate user activity. */
|
|
17
|
-
const ACTIVITY_EVENTS = [
|
|
18
|
-
'mousemove',
|
|
19
|
-
'mousedown',
|
|
20
|
-
'keydown',
|
|
21
|
-
'scroll',
|
|
22
|
-
'touchstart',
|
|
23
|
-
'click',
|
|
24
|
-
];
|
|
25
|
-
/** Debounce interval for activity events (ms). */
|
|
26
|
-
const ACTIVITY_DEBOUNCE_MS = 1000;
|
|
27
|
-
/** Name of the BroadcastChannel used for cross-tab activity sync. */
|
|
28
|
-
const BROADCAST_CHANNEL_NAME = 'zeni-session-activity';
|
|
29
|
-
class SessionManager {
|
|
30
|
-
constructor() {
|
|
31
|
-
this.config = sessionTypes_1.DEFAULT_SESSION_CONFIG;
|
|
32
|
-
this.callbacks = null;
|
|
33
|
-
/** Timestamps and timers */
|
|
34
|
-
this.lastActivityTime = 0;
|
|
35
|
-
/** Timestamp of the last heartbeat fire (initial/periodic/continue/activity). */
|
|
36
|
-
this.lastHeartbeatTime = 0;
|
|
37
|
-
/** Set to true whenever user (or any same-origin tab) shows activity. */
|
|
38
|
-
this.hadActivitySinceLastHeartbeat = false;
|
|
39
|
-
this.idleCheckInterval = null;
|
|
40
|
-
this.heartbeatInterval = null;
|
|
41
|
-
this.countdownInterval = null;
|
|
42
|
-
this.activityDebounceTimer = null;
|
|
43
|
-
/** State */
|
|
44
|
-
this.running = false;
|
|
45
|
-
this.warningActive = false;
|
|
46
|
-
this.secondsRemaining = 0;
|
|
47
|
-
/** Wall-clock timestamp when the warning countdown began (for background-tab accuracy). */
|
|
48
|
-
this.warningStartTime = 0;
|
|
49
|
-
/** Cross-tab activity sync */
|
|
50
|
-
this.broadcastChannel = null;
|
|
51
|
-
/** Bound handlers for event listener cleanup. */
|
|
52
|
-
this.boundOnActivity = this.onActivity.bind(this);
|
|
53
|
-
this.boundOnVisibilityChange = this.onVisibilityChange.bind(this);
|
|
54
|
-
this.boundOnBroadcastMessage = this.onBroadcastMessage.bind(this);
|
|
55
|
-
}
|
|
56
|
-
// ─── Public API ────────────────────────────────────────────
|
|
57
|
-
start(config = {}, callbacks) {
|
|
58
|
-
if (this.running) {
|
|
59
|
-
this.stop();
|
|
60
|
-
}
|
|
61
|
-
this.config = { ...sessionTypes_1.DEFAULT_SESSION_CONFIG, ...config };
|
|
62
|
-
this.callbacks = callbacks;
|
|
63
|
-
this.running = true;
|
|
64
|
-
this.warningActive = false;
|
|
65
|
-
this.lastActivityTime = Date.now();
|
|
66
|
-
this.lastHeartbeatTime = 0; // fireHeartbeat('initial') below will set this
|
|
67
|
-
this.hadActivitySinceLastHeartbeat = true; // initial heartbeat is expected
|
|
68
|
-
console.log('[SessionManager] start() called with config:', this.config);
|
|
69
|
-
const heartbeatEnabled = this.config.heartbeatIntervalMinutes > 0;
|
|
70
|
-
const idleTrackingEnabled = this.config.isAutoLogoutEnabled;
|
|
71
|
-
if (!heartbeatEnabled && !idleTrackingEnabled) {
|
|
72
|
-
console.log('[SessionManager] Heartbeat and idle tracking both disabled — nothing to start');
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// Activity listeners — needed for both heartbeat activity-gate and idle
|
|
76
|
-
// detection. BroadcastChannel keeps multiple tabs in sync.
|
|
77
|
-
ACTIVITY_EVENTS.forEach((event) => {
|
|
78
|
-
document.addEventListener(event, this.boundOnActivity, {
|
|
79
|
-
capture: true,
|
|
80
|
-
passive: true,
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
this.setupBroadcastChannel();
|
|
84
|
-
if (heartbeatEnabled) {
|
|
85
|
-
this.startHeartbeat();
|
|
86
|
-
// Initial heartbeat on sign-in
|
|
87
|
-
this.fireHeartbeat('initial');
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
console.log('[SessionManager] Heartbeat disabled (heartbeatIntervalMinutes <= 0)');
|
|
91
|
-
}
|
|
92
|
-
if (idleTrackingEnabled) {
|
|
93
|
-
document.addEventListener('visibilitychange', this.boundOnVisibilityChange);
|
|
94
|
-
this.idleCheckInterval = setInterval(() => this.checkIdle(), 1000);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
console.log('[SessionManager] Idle tracking disabled for this user — heartbeat-only mode');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
stop() {
|
|
101
|
-
this.running = false;
|
|
102
|
-
this.warningActive = false;
|
|
103
|
-
ACTIVITY_EVENTS.forEach((event) => {
|
|
104
|
-
document.removeEventListener(event, this.boundOnActivity, {
|
|
105
|
-
capture: true,
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
document.removeEventListener('visibilitychange', this.boundOnVisibilityChange);
|
|
109
|
-
this.teardownBroadcastChannel();
|
|
110
|
-
this.clearTimer('idleCheckInterval');
|
|
111
|
-
this.clearTimer('heartbeatInterval');
|
|
112
|
-
this.clearTimer('countdownInterval');
|
|
113
|
-
this.clearTimer('activityDebounceTimer');
|
|
114
|
-
}
|
|
115
|
-
continueSession() {
|
|
116
|
-
if (!this.running) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this.warningActive = false;
|
|
120
|
-
this.secondsRemaining = 0;
|
|
121
|
-
this.lastActivityTime = Date.now();
|
|
122
|
-
this.hadActivitySinceLastHeartbeat = true;
|
|
123
|
-
this.clearTimer('countdownInterval');
|
|
124
|
-
// Fire heartbeat immediately — user explicitly extended the session
|
|
125
|
-
this.fireHeartbeat('continue-session');
|
|
126
|
-
this.callbacks?.onSessionExtended();
|
|
127
|
-
this.broadcast({ type: 'activity', timestamp: Date.now() });
|
|
128
|
-
this.startHeartbeat();
|
|
129
|
-
}
|
|
130
|
-
isWarningActive() {
|
|
131
|
-
return this.warningActive;
|
|
132
|
-
}
|
|
133
|
-
getSecondsRemaining() {
|
|
134
|
-
return this.secondsRemaining;
|
|
135
|
-
}
|
|
136
|
-
// ─── Private ───────────────────────────────────────────────
|
|
137
|
-
onActivity() {
|
|
138
|
-
if (!this.running || this.warningActive) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
// Debounce: only update lastActivityTime at most once per second
|
|
142
|
-
if (this.activityDebounceTimer != null) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const now = Date.now();
|
|
146
|
-
this.registerActivity(now);
|
|
147
|
-
this.broadcast({ type: 'activity', timestamp: now });
|
|
148
|
-
// If heartbeat is enabled and the interval has elapsed since the last
|
|
149
|
-
// heartbeat, fire one immediately and restart the timer. This covers
|
|
150
|
-
// the "user active again after >interval idle" case without waiting
|
|
151
|
-
// for the next scheduled tick.
|
|
152
|
-
if (this.config.heartbeatIntervalMinutes > 0) {
|
|
153
|
-
const intervalMs = this.config.heartbeatIntervalMinutes * 60 * 1000;
|
|
154
|
-
const timeSinceLastHeartbeat = now - this.lastHeartbeatTime;
|
|
155
|
-
if (timeSinceLastHeartbeat >= intervalMs) {
|
|
156
|
-
this.fireHeartbeat('activity-after-idle');
|
|
157
|
-
this.startHeartbeat();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
this.activityDebounceTimer = setTimeout(() => {
|
|
161
|
-
this.activityDebounceTimer = null;
|
|
162
|
-
}, ACTIVITY_DEBOUNCE_MS);
|
|
163
|
-
}
|
|
164
|
-
onVisibilityChange() {
|
|
165
|
-
if (!this.running) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (document.visibilityState === 'visible') {
|
|
169
|
-
if (this.warningActive) {
|
|
170
|
-
// Tab was hidden while countdown was running — check if it already expired.
|
|
171
|
-
const elapsed = Math.floor((Date.now() - this.warningStartTime) / 1000);
|
|
172
|
-
if (elapsed >= this.config.warningDurationSeconds) {
|
|
173
|
-
this.secondsRemaining = 0;
|
|
174
|
-
this.clearTimer('countdownInterval');
|
|
175
|
-
this.warningActive = false;
|
|
176
|
-
this.callbacks?.onAutoLogout();
|
|
177
|
-
}
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
// Industry-standard idle detection: resetting on tab focus is expected.
|
|
181
|
-
this.registerActivity(Date.now());
|
|
182
|
-
this.checkIdle();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/** Single source of truth for marking activity locally. */
|
|
186
|
-
registerActivity(timestamp) {
|
|
187
|
-
this.lastActivityTime = Math.max(this.lastActivityTime, timestamp);
|
|
188
|
-
this.hadActivitySinceLastHeartbeat = true;
|
|
189
|
-
}
|
|
190
|
-
checkIdle() {
|
|
191
|
-
if (!this.running || this.warningActive) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const idleMs = Date.now() - this.lastActivityTime;
|
|
195
|
-
const idleTimeoutMs = this.config.idleTimeoutMinutes * 60 * 1000;
|
|
196
|
-
if (idleMs >= idleTimeoutMs) {
|
|
197
|
-
this.startWarning();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
startWarning() {
|
|
201
|
-
this.warningActive = true;
|
|
202
|
-
this.warningStartTime = Date.now();
|
|
203
|
-
this.secondsRemaining = this.config.warningDurationSeconds;
|
|
204
|
-
// Don't extend session while warning is showing.
|
|
205
|
-
this.clearTimer('heartbeatInterval');
|
|
206
|
-
this.callbacks?.onWarningStart(this.secondsRemaining);
|
|
207
|
-
// Use wall-clock elapsed time so countdown stays accurate in background tabs.
|
|
208
|
-
// Browsers throttle setInterval when the tab is hidden, but each tick
|
|
209
|
-
// recomputes from the real start time so no seconds are "lost".
|
|
210
|
-
this.countdownInterval = setInterval(() => {
|
|
211
|
-
const elapsed = Math.floor((Date.now() - this.warningStartTime) / 1000);
|
|
212
|
-
const remaining = this.config.warningDurationSeconds - elapsed;
|
|
213
|
-
if (remaining <= 0) {
|
|
214
|
-
this.secondsRemaining = 0;
|
|
215
|
-
this.clearTimer('countdownInterval');
|
|
216
|
-
this.warningActive = false;
|
|
217
|
-
this.callbacks?.onAutoLogout();
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
this.secondsRemaining = remaining;
|
|
221
|
-
this.callbacks?.onWarningTick(this.secondsRemaining);
|
|
222
|
-
}
|
|
223
|
-
}, 1000);
|
|
224
|
-
}
|
|
225
|
-
startHeartbeat() {
|
|
226
|
-
this.clearTimer('heartbeatInterval');
|
|
227
|
-
const intervalMs = this.config.heartbeatIntervalMinutes * 60 * 1000;
|
|
228
|
-
console.log(`[SessionManager] Heartbeat timer set to fire every ${this.config.heartbeatIntervalMinutes} min (${intervalMs} ms)`);
|
|
229
|
-
this.heartbeatInterval = setInterval(() => {
|
|
230
|
-
if (!this.running || this.warningActive) {
|
|
231
|
-
console.log('[SessionManager] Heartbeat tick skipped — running:', this.running, 'warningActive:', this.warningActive);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
if (!this.hadActivitySinceLastHeartbeat) {
|
|
235
|
-
console.log('[SessionManager] Heartbeat tick skipped — no activity in this interval');
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
this.fireHeartbeat('periodic');
|
|
239
|
-
}, intervalMs);
|
|
240
|
-
}
|
|
241
|
-
fireHeartbeat(reason) {
|
|
242
|
-
console.log(`[SessionManager] Heartbeat fired (${reason})`);
|
|
243
|
-
this.lastHeartbeatTime = Date.now();
|
|
244
|
-
this.hadActivitySinceLastHeartbeat = false;
|
|
245
|
-
this.callbacks?.onHeartbeat();
|
|
246
|
-
// Let other tabs know we just fired a heartbeat — they can skip theirs
|
|
247
|
-
// this cycle to avoid N tabs all firing heartbeats.
|
|
248
|
-
this.broadcast({ type: 'heartbeat-fired', timestamp: this.lastHeartbeatTime });
|
|
249
|
-
}
|
|
250
|
-
// ─── BroadcastChannel (cross-tab activity sync) ───────────
|
|
251
|
-
setupBroadcastChannel() {
|
|
252
|
-
if (typeof BroadcastChannel === 'undefined') {
|
|
253
|
-
console.log('[SessionManager] BroadcastChannel not available — cross-tab sync disabled');
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
try {
|
|
257
|
-
this.broadcastChannel = new BroadcastChannel(BROADCAST_CHANNEL_NAME);
|
|
258
|
-
this.broadcastChannel.addEventListener('message', this.boundOnBroadcastMessage);
|
|
259
|
-
console.log('[SessionManager] BroadcastChannel ready for cross-tab sync');
|
|
260
|
-
}
|
|
261
|
-
catch (err) {
|
|
262
|
-
console.warn('[SessionManager] BroadcastChannel setup failed:', err);
|
|
263
|
-
this.broadcastChannel = null;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
teardownBroadcastChannel() {
|
|
267
|
-
if (this.broadcastChannel == null) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
this.broadcastChannel.removeEventListener('message', this.boundOnBroadcastMessage);
|
|
271
|
-
this.broadcastChannel.close();
|
|
272
|
-
this.broadcastChannel = null;
|
|
273
|
-
}
|
|
274
|
-
broadcast(message) {
|
|
275
|
-
this.broadcastChannel?.postMessage(message);
|
|
276
|
-
}
|
|
277
|
-
onBroadcastMessage(event) {
|
|
278
|
-
if (!this.running) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const msg = event.data;
|
|
282
|
-
if (msg == null) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
if (msg.type === 'activity') {
|
|
286
|
-
// Another tab saw user activity — treat as activity here too.
|
|
287
|
-
this.registerActivity(msg.timestamp);
|
|
288
|
-
}
|
|
289
|
-
else if (msg.type === 'heartbeat-fired') {
|
|
290
|
-
// Another tab already fired a heartbeat in this interval — backend
|
|
291
|
-
// session is already extended. Reset our local tracking so we don't
|
|
292
|
-
// also fire one this cycle.
|
|
293
|
-
this.lastHeartbeatTime = Math.max(this.lastHeartbeatTime, msg.timestamp);
|
|
294
|
-
this.hadActivitySinceLastHeartbeat = false;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
clearTimer(name) {
|
|
298
|
-
const timer = this[name];
|
|
299
|
-
if (timer != null) {
|
|
300
|
-
if (name === 'activityDebounceTimer') {
|
|
301
|
-
clearTimeout(timer);
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
clearInterval(timer);
|
|
305
|
-
}
|
|
306
|
-
this[name] = null;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
exports.SessionManager = SessionManager;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { RootState } from '../../../reducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { sendSessionHeartbeat, sessionHeartbeatFailure, sessionHeartbeatSuccess } from '../tenantReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof sendSessionHeartbeat> | ReturnType<typeof sessionHeartbeatSuccess> | ReturnType<typeof sessionHeartbeatFailure>;
|
|
6
|
-
export declare const sessionHeartbeatEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: {
|
|
8
|
-
expiresAt: string;
|
|
9
|
-
};
|
|
10
|
-
type: "tenant/sessionHeartbeatSuccess";
|
|
11
|
-
} | {
|
|
12
|
-
payload: {
|
|
13
|
-
error: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
14
|
-
};
|
|
15
|
-
type: "tenant/sessionHeartbeatFailure";
|
|
16
|
-
}>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sessionHeartbeatEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const tenantReducer_1 = require("../tenantReducer");
|
|
8
|
-
const sessionHeartbeatEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.sendSessionHeartbeat.match), (0, operators_1.switchMap)(() => zeniAPI
|
|
9
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/heartbeat`)
|
|
10
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
11
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
12
|
-
return (0, rxjs_1.of)((0, tenantReducer_1.sessionHeartbeatSuccess)(response.data?.expiry ?? ''));
|
|
13
|
-
}
|
|
14
|
-
return (0, rxjs_1.of)((0, tenantReducer_1.sessionHeartbeatFailure)(response.status));
|
|
15
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, tenantReducer_1.sessionHeartbeatFailure)((0, responsePayload_1.createZeniAPIStatus)('Heartbeat failed', 'Session heartbeat API call errored: ' + JSON.stringify(error))))))));
|
|
16
|
-
exports.sessionHeartbeatEpic = sessionHeartbeatEpic;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session management types for idle timeout and heartbeat.
|
|
3
|
-
*/
|
|
4
|
-
export interface SessionConfig {
|
|
5
|
-
/** Minutes between heartbeat API calls while user is active. Default: 10 */
|
|
6
|
-
heartbeatIntervalMinutes: number;
|
|
7
|
-
/** Minutes of inactivity before the warning popup appears. Default: 30 */
|
|
8
|
-
idleTimeoutMinutes: number;
|
|
9
|
-
/** Whether auto-logout is enabled. Default: true */
|
|
10
|
-
isAutoLogoutEnabled: boolean;
|
|
11
|
-
/** Seconds to count down in the warning popup before auto-logout. Default: 60 */
|
|
12
|
-
warningDurationSeconds: number;
|
|
13
|
-
}
|
|
14
|
-
export declare const DEFAULT_SESSION_CONFIG: SessionConfig;
|
|
15
|
-
export interface SessionCallbacks {
|
|
16
|
-
/** Called when the countdown reaches zero — app should sign out. */
|
|
17
|
-
onAutoLogout: () => void;
|
|
18
|
-
/** Called to send a heartbeat API request. */
|
|
19
|
-
onHeartbeat: () => void;
|
|
20
|
-
/** Called when the session is extended (heartbeat success or "Continue Session"). */
|
|
21
|
-
onSessionExtended: () => void;
|
|
22
|
-
/** Called when the warning countdown starts. */
|
|
23
|
-
onWarningStart: (secondsRemaining: number) => void;
|
|
24
|
-
/** Called every second during the countdown. */
|
|
25
|
-
onWarningTick: (secondsRemaining: number) => void;
|
|
26
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Session management types for idle timeout and heartbeat.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_SESSION_CONFIG = void 0;
|
|
7
|
-
exports.DEFAULT_SESSION_CONFIG = {
|
|
8
|
-
heartbeatIntervalMinutes: 10,
|
|
9
|
-
idleTimeoutMinutes: 30,
|
|
10
|
-
isAutoLogoutEnabled: true,
|
|
11
|
-
warningDurationSeconds: 60,
|
|
12
|
-
};
|