varminer-app-header 2.2.1 → 2.2.3

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.
@@ -37,21 +37,38 @@ export interface UserDetailsItem {
37
37
  * Does not write or overwrite this key; IAM app is the source of truth.
38
38
  */
39
39
  export declare function getStoredUserDetails(): UserDetailsItem | null;
40
+ /** Unique localStorage key for this header package. Used only for access token; user details come from IAM (linn-i-am-userDetails). */
41
+ export declare const PERSIST_HEADER_KEY = "persist:varminer-app-header";
42
+ /** Auth shape stored under PERSIST_HEADER_KEY. Host app should call setHeaderAuth after login so the header can make authenticated calls. */
43
+ export interface HeaderAuthState {
44
+ accessToken?: string;
45
+ refreshToken?: string;
46
+ user_id?: number | string;
47
+ [key: string]: unknown;
48
+ }
49
+ /**
50
+ * Store auth (e.g. accessToken) in the header's own persist key. Call this after login so the header can use the token for profile picture etc.
51
+ * User details are not stored here; they come from IAM (linn-i-am-userDetails).
52
+ */
53
+ export declare function setHeaderAuth(auth: HeaderAuthState | null): void;
54
+ /**
55
+ * User display data: from IAM only (linn-i-am-userDetails). No dependency on persist:userdb.
56
+ */
40
57
  export declare const getUserDataFromStorage: () => {
41
- name: any;
42
- email: any;
43
- role: any;
44
- avatar: any;
45
- initials: any;
58
+ name: string;
59
+ email: string;
60
+ role: string;
61
+ avatar?: string;
62
+ initials?: string;
46
63
  } | null;
47
64
  export declare const getNotificationCountFromStorage: () => number;
48
65
  export declare const getMessageCountFromStorage: () => number | undefined;
49
66
  export declare const getI18nLocaleFromStorage: () => string | null;
50
67
  export declare const setI18nLocaleToStorage: (locale: string) => void;
51
68
  /**
52
- * Get all data from localStorage (persist:userdb) including decoded accessToken
53
- * This function reads all available data without hardcoding and doesn't require any parameters
54
- * @returns Comprehensive object containing all available data from localStorage and decoded JWT payload
69
+ * Get auth (and decoded token) for header use. Reads from header's own persist key first; falls back to persist:userdb only for access token.
70
+ * User details are not read from userdb—use getStoredUserDetails / getUserDataFromStorage (IAM) for that.
71
+ * @returns Object with auth, decodedToken, and other keys (user/userDetails/profile null when using header key)
55
72
  */
56
73
  export declare const getAllDataFromStorage: () => any;
57
74
  /**
@@ -60,31 +77,5 @@ export declare const getAllDataFromStorage: () => any;
60
77
  * @returns Profile picture URL or null if user_id is not available
61
78
  */
62
79
  export declare const getProfilePictureUrl: (baseUrl?: string) => string | null;
63
- /**
64
- * Get profile picture upload URL for the object store API.
65
- * URL format: {baseUrl}/v1/objectStore/profilePictureUpload?tenantId=&userId=&roleId=
66
- * @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
67
- * @returns Full upload URL with query params, or null if tenantId, userId, or roleId is missing
68
- */
69
- export declare const getProfilePictureUploadUrl: (baseUrl?: string) => string | null;
70
- /**
71
- * Fetch profile picture from API with headers, get S3 URL, generate presigned URL, and return as blob URL
72
- * This function:
73
- * 1. Fetches the profile picture path from the API
74
- * 2. Extracts the S3 filePath from the JSON response
75
- * 3. Generates a presigned URL for the S3 object
76
- * 4. Fetches the image using the presigned URL
77
- * 5. Converts it to a blob URL that can be used in img src
78
- * @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
79
- * @param messageId - Optional message ID for X-Message-Id header (default: generated UUID)
80
- * @param correlationId - Optional correlation ID for X-Correlation-Id header (default: generated UUID)
81
- * @param awsConfig - AWS configuration (accessKeyId, secretAccessKey, region, bucket)
82
- * @returns Promise that resolves to blob URL string or null if fetch fails
83
- */
84
- export declare const fetchProfilePictureAsBlobUrl: (baseUrl?: string, messageId?: string, correlationId?: string, awsConfig?: {
85
- accessKeyId: string;
86
- secretAccessKey: string;
87
- region?: string;
88
- bucket?: string;
89
- }) => Promise<string | null>;
80
+ export declare const fetchProfilePictureAsBlobUrl: (baseUrl?: string) => Promise<string | null>;
90
81
  //# sourceMappingURL=localStorage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../src/utils/localStorage.ts"],"names":[],"mappings":"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,IAOpD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,KAAG,IAMvD,CAAC;AA4CF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,WAkJjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAS,MAAoD,KAAG,MAAM,GAAG,IAW7G,CAAC;AAkBF,eAAO,MAAM,4BAA4B,GACvC,UAAS,MAAoD,KAC5D,OAAO,CAAC,MAAM,GAAG,IAAI,CA4BvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varminer-app-header",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "type": "module",
5
5
  "description": "A plug-and-play React header component with Material-UI, drawer toggle, notifications, and user profile menu",
6
6
  "main": "dist/index.js",