@iblai/web-utils 1.2.11 → 1.2.13

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,3 +1,4 @@
1
+ export type AuditLogChange = [oldValue: string, newValue: string];
1
2
  export interface AuditLogEntry {
2
3
  id: number;
3
4
  timestamp: string;
@@ -7,10 +8,7 @@ export interface AuditLogEntry {
7
8
  resource_type: string;
8
9
  resource_id: string;
9
10
  resource_repr: string;
10
- changes: Record<string, {
11
- old?: unknown;
12
- new?: unknown;
13
- }>;
11
+ changes: Record<string, AuditLogChange>;
14
12
  }
15
13
  export type AuditLogsResponse = {
16
14
  count: number;
package/dist/index.d.ts CHANGED
@@ -1532,7 +1532,7 @@ type Props$2 = {
1532
1532
  * 4. Handles redirects to auth SPA when needed
1533
1533
  * 5. Manages public route access state
1534
1534
  */
1535
- declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1535
+ declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
1536
1536
 
1537
1537
  /**
1538
1538
  * Props for the MentorProvider component
@@ -1565,7 +1565,7 @@ type Props$1 = {
1565
1565
  * 3. Manages redirection based on mentor availability
1566
1566
  * 4. Integrates with tenant context for access control
1567
1567
  */
1568
- declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, onLoadMentorsPermissions, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, forceDetermineMentor, onComplete, skip, }: Props$1): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1568
+ declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, onLoadMentorsPermissions, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, forceDetermineMentor, onComplete, skip, }: Props$1): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
1569
1569
 
1570
1570
  /**
1571
1571
  * Type definition for the tenant context
@@ -1628,7 +1628,7 @@ type Props = {
1628
1628
  * 4. Handles tenant-specific domain redirects
1629
1629
  * 5. Maintains tenant access state
1630
1630
  */
1631
- declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed, setUseMentorProvider, skip, onLoadPlatformPermissions, skipCustomDomainCheck, }: Props): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1631
+ declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed, setUseMentorProvider, skip, onLoadPlatformPermissions, skipCustomDomainCheck, }: Props): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | null | undefined;
1632
1632
 
1633
1633
  /**
1634
1634
  * Chat area size constants
package/dist/index.esm.js CHANGED
@@ -730,7 +730,7 @@ const LOCAL_STORAGE_KEYS = {
730
730
  USER_DATA: "userData",
731
731
  USER_TENANTS: "tenants",
732
732
  EDX_TOKEN_KEY: "edx_jwt_token",
733
- DM_TOKEN_KEY: "dm_token_key",
733
+ DM_TOKEN_KEY: "dm_token",
734
734
  DM_TOKEN_EXPIRES: "dm_token_expires",
735
735
  };
736
736
  const TOOLS = {
@@ -2992,11 +2992,19 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
2992
2992
  // Check JWT token expiry and force logout for protected routes
2993
2993
  if (isProtectedRoute && storageService) {
2994
2994
  const dmTokenInLocalStorage = await storageService.getItem(LOCAL_STORAGE_KEYS.DM_TOKEN_KEY);
2995
+ console.log('[auth-redirect] local storage keys ', LOCAL_STORAGE_KEYS);
2995
2996
  const dmTokenExpired = await isDmTokenExpired(storageService);
2996
2997
  if (!dmTokenInLocalStorage || dmTokenExpired) {
2997
- console.log("[auth-redirect] DM token has expired, forcing logout");
2998
+ if (!!dmTokenInLocalStorage) {
2999
+ console.log("[auth-redirect] DM token doesn't exists");
3000
+ }
3001
+ else {
3002
+ console.log("[auth-redirect] DM token doesn't exists, forcing logout");
3003
+ }
2998
3004
  // Clear all auth-related storage keys
2999
- clearAuthCookies();
3005
+ if (!!dmTokenInLocalStorage) {
3006
+ clearAuthCookies();
3007
+ }
3000
3008
  const reason = "DM token expired";
3001
3009
  onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(reason);
3002
3010
  safeRedirectToAuthSpa(undefined, undefined, !!dmTokenInLocalStorage); // with no dm token at all in storage, don't force logout