@serhii.olishevskyi/docs 1.1.4 → 1.1.5

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  UserPopoverComponent,
3
3
  UserPopoverComponent_default
4
- } from "./chunk-ERXHWCQ5.mjs";
4
+ } from "./chunk-UA57YNRJ.mjs";
5
5
  export {
6
6
  UserPopoverComponent,
7
7
  UserPopoverComponent_default as default
@@ -300,6 +300,19 @@ var trackUserSession = async (supabase, userId) => {
300
300
  { onConflict: "user_id, device_id" }
301
301
  );
302
302
  };
303
+ var trackUserSessionByRoute = async (supabase, userId, currentUrl) => {
304
+ const deviceId = getDeviceId();
305
+ await supabase.from("user_sessions").upsert(
306
+ {
307
+ user_id: userId,
308
+ device_id: deviceId,
309
+ user_agent: navigator.userAgent,
310
+ url: currentUrl || window.location.href,
311
+ last_seen_at: (/* @__PURE__ */ new Date()).toISOString()
312
+ },
313
+ { onConflict: "user_id, device_id" }
314
+ );
315
+ };
303
316
  var fetchUserSessions = async (supabase) => {
304
317
  const currentDeviceId = getDeviceId();
305
318
  const { data: { user } } = await supabase.auth.getUser();
@@ -2535,6 +2548,7 @@ var UserPopoverComponent_default = UserPopoverComponent;
2535
2548
  export {
2536
2549
  fetchCompanySessions,
2537
2550
  trackUserSession,
2551
+ trackUserSessionByRoute,
2538
2552
  fetchUserSessions,
2539
2553
  isCurrentSessionValid,
2540
2554
  groupSessionsByUser,
package/dist/index.d.mts CHANGED
@@ -519,6 +519,7 @@ declare const Services: {
519
519
  readonly SessionService: {
520
520
  readonly fetchCompanySessions: (supabase: _supabase_supabase_js.SupabaseClient, companyId: string, page?: number, pageSize?: number, searchQuery?: string) => Promise<FetchCompanySessionsResponse>;
521
521
  readonly trackUserSession: (supabase: _supabase_supabase_js.SupabaseClient, userId: string) => Promise<void>;
522
+ readonly trackUserSessionByRoute: (supabase: _supabase_supabase_js.SupabaseClient, userId: string, currentUrl?: string) => Promise<void>;
522
523
  readonly fetchUserSessions: (supabase: _supabase_supabase_js.SupabaseClient) => Promise<UserSessionItem[]>;
523
524
  readonly isCurrentSessionValid: (supabase: _supabase_supabase_js.SupabaseClient, userId: string) => Promise<boolean>;
524
525
  readonly groupSessionsByUser: (sessions: UserSessionItem[]) => UserGroupedSessions[];
package/dist/index.d.ts CHANGED
@@ -519,6 +519,7 @@ declare const Services: {
519
519
  readonly SessionService: {
520
520
  readonly fetchCompanySessions: (supabase: _supabase_supabase_js.SupabaseClient, companyId: string, page?: number, pageSize?: number, searchQuery?: string) => Promise<FetchCompanySessionsResponse>;
521
521
  readonly trackUserSession: (supabase: _supabase_supabase_js.SupabaseClient, userId: string) => Promise<void>;
522
+ readonly trackUserSessionByRoute: (supabase: _supabase_supabase_js.SupabaseClient, userId: string, currentUrl?: string) => Promise<void>;
522
523
  readonly fetchUserSessions: (supabase: _supabase_supabase_js.SupabaseClient) => Promise<UserSessionItem[]>;
523
524
  readonly isCurrentSessionValid: (supabase: _supabase_supabase_js.SupabaseClient, userId: string) => Promise<boolean>;
524
525
  readonly groupSessionsByUser: (sessions: UserSessionItem[]) => UserGroupedSessions[];
package/dist/index.js CHANGED
@@ -169,7 +169,7 @@ var init_deviceId = __esm({
169
169
  });
170
170
 
171
171
  // src/services/session.service.ts
172
- var fetchCompanySessions, trackUserSession, fetchUserSessions, isCurrentSessionValid, groupSessionsByUser, getUserLastSeenAt, getUsersLastSeenMap;
172
+ var fetchCompanySessions, trackUserSession, trackUserSessionByRoute, fetchUserSessions, isCurrentSessionValid, groupSessionsByUser, getUserLastSeenAt, getUsersLastSeenMap;
173
173
  var init_session_service = __esm({
174
174
  "src/services/session.service.ts"() {
175
175
  "use strict";
@@ -274,6 +274,19 @@ var init_session_service = __esm({
274
274
  { onConflict: "user_id, device_id" }
275
275
  );
276
276
  };
277
+ trackUserSessionByRoute = async (supabase, userId, currentUrl) => {
278
+ const deviceId = getDeviceId();
279
+ await supabase.from("user_sessions").upsert(
280
+ {
281
+ user_id: userId,
282
+ device_id: deviceId,
283
+ user_agent: navigator.userAgent,
284
+ url: currentUrl || window.location.href,
285
+ last_seen_at: (/* @__PURE__ */ new Date()).toISOString()
286
+ },
287
+ { onConflict: "user_id, device_id" }
288
+ );
289
+ };
277
290
  fetchUserSessions = async (supabase) => {
278
291
  const currentDeviceId = getDeviceId();
279
292
  const { data: { user } } = await supabase.auth.getUser();
@@ -4003,6 +4016,7 @@ var Services = {
4003
4016
  SessionService: {
4004
4017
  fetchCompanySessions,
4005
4018
  trackUserSession,
4019
+ trackUserSessionByRoute,
4006
4020
  fetchUserSessions,
4007
4021
  isCurrentSessionValid,
4008
4022
  groupSessionsByUser,
package/dist/index.mjs CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  groupSessionsByUser,
27
27
  isCurrentSessionValid,
28
28
  trackUserSession,
29
+ trackUserSessionByRoute,
29
30
  translationService,
30
31
  useAI,
31
32
  useAppSettings,
@@ -39,7 +40,7 @@ import {
39
40
  useTranslationEdit,
40
41
  useTranslationNamespace,
41
42
  useUserSettings
42
- } from "./chunk-ERXHWCQ5.mjs";
43
+ } from "./chunk-UA57YNRJ.mjs";
43
44
 
44
45
  // src/UI/components/inputs/TextFieldComponent.tsx
45
46
  import { useState } from "react";
@@ -737,7 +738,7 @@ var EmailInputComponent = ({
737
738
  import { useState as useState5, useEffect as useEffect2, lazy, Suspense } from "react";
738
739
  import { Avatar, Tooltip as Tooltip3, Typography as Typography2 } from "@mui/material";
739
740
  import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
740
- var LazyUserPopover = lazy(() => import("./UserPopoverComponent-ZG4UFBGJ.mjs"));
741
+ var LazyUserPopover = lazy(() => import("./UserPopoverComponent-5F4S3X4F.mjs"));
741
742
  var getInitials = (name) => {
742
743
  if (!name) return "?";
743
744
  const parts = name.trim().split(" ");
@@ -1279,6 +1280,7 @@ var Services = {
1279
1280
  SessionService: {
1280
1281
  fetchCompanySessions,
1281
1282
  trackUserSession,
1283
+ trackUserSessionByRoute,
1282
1284
  fetchUserSessions,
1283
1285
  isCurrentSessionValid,
1284
1286
  groupSessionsByUser,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serhii.olishevskyi/docs",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "DOCS.UA react packages",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",