varminer-app-header 2.2.0 → 2.2.2

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
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../src/utils/localStorage.ts"],"names":[],"mappings":"AACA,uGAAuG;AACvG,eAAO,MAAM,wBAAwB,0BAA0B,CAAC;AAEhE,8DAA8D;AAC9D,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,YAAY,EAAE,eAAe,EAAE,CAAC;KACjC,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,eAAe,GAAG,IAAI,CAc7D;AAED,eAAO,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AAEF,eAAO,MAAM,0BAA0B,QAAO,MAAM,GAAG,SAkCtD,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAO,MAAM,GAAG,IAOpD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,KAAG,IAMvD,CAAC;AA4CF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,WAoHjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAS,MAAoD,KAAG,MAAM,GAAG,IAW7G,CAAC;AAwHF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAS,MAAoD,EAC7D,YAAY,MAAM,EAClB,gBAAgB,MAAM,EACtB,YAAY;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KACA,OAAO,CAAC,MAAM,GAAG,IAAI,CA2FvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varminer-app-header",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
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",