varminer-app-header 2.6.4 → 2.6.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.
- package/dist/AppHeader.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +48 -57
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +48 -57
- package/dist/index.js.map +1 -1
- package/dist/utils/localStorage.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/AppHeader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../src/AppHeader.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAe,MAAM,SAAS,CAAC;AAItD,OAAO,sBAAsB,CAAC;AAQ9B,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../src/AppHeader.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAe,MAAM,SAAS,CAAC;AAItD,OAAO,sBAAsB,CAAC;AAQ9B,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAo1BvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.MuiToolbar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important;min-height:var(--size-header-height,65px)!important;padding-left:15px!important}.MuiToolbar-root,.MuiToolbar-root .MuiButtonBase-root{color:var(--color-brand-primary,var(--color-brand-primary))!important}.MuiToolbar-root .MuiButtonBase-root{margin-right:0}.app-header{flex-shrink:0}.app-header,.app-header .MuiAppBar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important}.app-header .MuiAppBar-root{box-shadow:none!important;left:0;position:fixed!important;right:0;top:0;z-index:var(--size-header-zindex,200)!important}.app-header .MuiPaper-root:only-of-type{border-bottom:1px solid var(--color-border-header,var(--color-border-header));box-shadow:none!important;padding:0!important}.var{color:var(--color-brand-accent,var(--color-brand-accent))!important}.miner,.var{font:500 20px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.miner{color:var(--color-brand-deep-navy,var(--color-brand-deep-navy))!important}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-name{color:var(--color-profile-name,var(--color-brand-primary));font:600 16px/28px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-email{color:var(--color-profile-email,var(--color-text-secondary-alpha));font:400 14px/24px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-decoration:underline}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-role{color:var(--color-profile-role,var(--color-text-muted-alpha));font:400 12px/28px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-transform:uppercase}.account-menu:has(.profile-menu-item) .profile-menu-item{padding:10px 15px 5px}.account-menu:has(.profile-menu-item) .MuiMenu-paper{background:var(--color-menu-bg-gradient,linear-gradient(180deg,var(--color-white),var(--color-selected-row),var(--color-selected-row)));box-shadow:none!important;color:var(--color-menu-text,var(--color-black));margin:0;max-width:var(--size-menu-width,280px);width:var(--size-menu-width,280px)}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root{min-width:40px;padding:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root .MuiAvatar-circular{height:40px;margin-left:-10px;margin-right:0;width:40px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root:first-of-type{margin-top:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root .MuiListItemIcon-root .MuiSvgIcon-root{color:var(--color-brand-primary,var(--color-brand-primary))}
|
|
1
|
+
.MuiToolbar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important;min-height:var(--size-header-height,65px)!important;padding-left:15px!important}.MuiToolbar-root,.MuiToolbar-root .MuiButtonBase-root{color:var(--color-brand-primary,var(--color-brand-primary))!important}.MuiToolbar-root .MuiButtonBase-root{margin-right:0}.app-header{flex-shrink:0}.app-header,.app-header .MuiAppBar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important}.app-header .MuiAppBar-root{box-shadow:none!important;left:0;position:fixed!important;right:0;top:0;z-index:var(--size-header-zindex,200)!important}.app-header .MuiPaper-root:only-of-type{border-bottom:1px solid var(--color-border-header,var(--color-border-header));box-shadow:none!important;padding:0!important}.var{color:var(--color-brand-accent,var(--color-brand-accent))!important}.miner,.var{font:500 20px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.miner{color:var(--color-brand-deep-navy,var(--color-brand-deep-navy))!important}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-name,[id=account-menu]:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-name{color:var(--color-profile-name,var(--color-brand-primary,var(--color-brand-primary)));font:600 16px/28px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-email,[id=account-menu]:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-email{color:var(--color-profile-email,var(--color-text-secondary-alpha,var(--color-text-secondary-alpha)));font:400 14px/24px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-decoration:underline}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-role,[id=account-menu]:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-role{color:var(--color-profile-role,var(--color-text-muted-alpha,var(--color-text-muted-alpha)));font:400 12px/28px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-transform:uppercase}.profile-name{color:var(--color-profile-name,var(--color-brand-primary,var(--color-brand-primary)));font:600 16px/28px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.profile-email{color:var(--color-profile-email,var(--color-text-secondary-alpha,var(--color-text-secondary-alpha)));font:400 14px/24px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-decoration:underline}.profile-role{color:var(--color-profile-role,var(--color-text-muted-alpha,var(--color-text-muted-alpha)));font:400 12px/28px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-transform:uppercase}.account-menu:has(.profile-menu-item) .profile-menu-item,[id=account-menu]:has(.profile-menu-item) .profile-menu-item{padding:10px 15px 5px}.account-menu:has(.profile-menu-item) .MuiMenu-paper,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper{background:var(--color-menu-bg-gradient,linear-gradient(180deg,var(--color-white,var(--color-white)),var(--color-selected-row,var(--color-bg-subtle)),var(--color-selected-row,var(--color-bg-subtle))));box-shadow:none!important;color:var(--color-menu-text,var(--color-black,var(--color-black)));margin:0;max-width:var(--size-menu-width,280px);width:var(--size-menu-width,280px)}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root{min-width:40px;padding:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root .MuiAvatar-circular,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root .MuiAvatar-circular{height:40px;margin-left:-10px;margin-right:0;width:40px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root:first-of-type,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root:first-of-type{margin-top:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root .MuiListItemIcon-root .MuiSvgIcon-root,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root .MuiListItemIcon-root .MuiSvgIcon-root{color:var(--color-brand-primary,var(--color-brand-primary))}
|
package/dist/index.esm.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.MuiToolbar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important;min-height:var(--size-header-height,65px)!important;padding-left:15px!important}.MuiToolbar-root,.MuiToolbar-root .MuiButtonBase-root{color:var(--color-brand-primary,var(--color-brand-primary))!important}.MuiToolbar-root .MuiButtonBase-root{margin-right:0}.app-header{flex-shrink:0}.app-header,.app-header .MuiAppBar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important}.app-header .MuiAppBar-root{box-shadow:none!important;left:0;position:fixed!important;right:0;top:0;z-index:var(--size-header-zindex,200)!important}.app-header .MuiPaper-root:only-of-type{border-bottom:1px solid var(--color-border-header,var(--color-border-header));box-shadow:none!important;padding:0!important}.var{color:var(--color-brand-accent,var(--color-brand-accent))!important}.miner,.var{font:500 20px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.miner{color:var(--color-brand-deep-navy,var(--color-brand-deep-navy))!important}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-name{color:var(--color-profile-name,var(--color-brand-primary));font:600 16px/28px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-email{color:var(--color-profile-email,var(--color-text-secondary-alpha));font:400 14px/24px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-decoration:underline}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-role{color:var(--color-profile-role,var(--color-text-muted-alpha));font:400 12px/28px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-transform:uppercase}.account-menu:has(.profile-menu-item) .profile-menu-item{padding:10px 15px 5px}.account-menu:has(.profile-menu-item) .MuiMenu-paper{background:var(--color-menu-bg-gradient,linear-gradient(180deg,var(--color-white),var(--color-selected-row),var(--color-selected-row)));box-shadow:none!important;color:var(--color-menu-text,var(--color-black));margin:0;max-width:var(--size-menu-width,280px);width:var(--size-menu-width,280px)}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root{min-width:40px;padding:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root .MuiAvatar-circular{height:40px;margin-left:-10px;margin-right:0;width:40px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root:first-of-type{margin-top:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root .MuiListItemIcon-root .MuiSvgIcon-root{color:var(--color-brand-primary,var(--color-brand-primary))}
|
|
1
|
+
.MuiToolbar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important;min-height:var(--size-header-height,65px)!important;padding-left:15px!important}.MuiToolbar-root,.MuiToolbar-root .MuiButtonBase-root{color:var(--color-brand-primary,var(--color-brand-primary))!important}.MuiToolbar-root .MuiButtonBase-root{margin-right:0}.app-header{flex-shrink:0}.app-header,.app-header .MuiAppBar-root{background-color:var(--color-header-bg,var(--color-white))!important;height:var(--size-header-height,65px)!important}.app-header .MuiAppBar-root{box-shadow:none!important;left:0;position:fixed!important;right:0;top:0;z-index:var(--size-header-zindex,200)!important}.app-header .MuiPaper-root:only-of-type{border-bottom:1px solid var(--color-border-header,var(--color-border-header));box-shadow:none!important;padding:0!important}.var{color:var(--color-brand-accent,var(--color-brand-accent))!important}.miner,.var{font:500 20px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.miner{color:var(--color-brand-deep-navy,var(--color-brand-deep-navy))!important}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-name,[id=account-menu]:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-name{color:var(--color-profile-name,var(--color-brand-primary,var(--color-brand-primary)));font:600 16px/28px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-email,[id=account-menu]:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-email{color:var(--color-profile-email,var(--color-text-secondary-alpha,var(--color-text-secondary-alpha)));font:400 14px/24px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-decoration:underline}.account-menu:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-role,[id=account-menu]:has(.profile-menu-section) .MuiList-root .MuiListItem-root .MuiListItemText-root .MuiTypography-root.profile-role{color:var(--color-profile-role,var(--color-text-muted-alpha,var(--color-text-muted-alpha)));font:400 12px/28px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-transform:uppercase}.profile-name{color:var(--color-profile-name,var(--color-brand-primary,var(--color-brand-primary)));font:600 16px/28px var(--font-brand-semibold,"OpenSans-SemiBold",sans-serif)}.profile-email{color:var(--color-profile-email,var(--color-text-secondary-alpha,var(--color-text-secondary-alpha)));font:400 14px/24px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-decoration:underline}.profile-role{color:var(--color-profile-role,var(--color-text-muted-alpha,var(--color-text-muted-alpha)));font:400 12px/28px var(--font-brand-regular,"OpenSans-Regular",sans-serif);text-transform:uppercase}.account-menu:has(.profile-menu-item) .profile-menu-item,[id=account-menu]:has(.profile-menu-item) .profile-menu-item{padding:10px 15px 5px}.account-menu:has(.profile-menu-item) .MuiMenu-paper,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper{background:var(--color-menu-bg-gradient,linear-gradient(180deg,var(--color-white,var(--color-white)),var(--color-selected-row,var(--color-bg-subtle)),var(--color-selected-row,var(--color-bg-subtle))));box-shadow:none!important;color:var(--color-menu-text,var(--color-black,var(--color-black)));margin:0;max-width:var(--size-menu-width,280px);width:var(--size-menu-width,280px)}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root{min-width:40px;padding:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root .MuiAvatar-circular,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiListItemAvatar-root .MuiAvatar-circular{height:40px;margin-left:-10px;margin-right:0;width:40px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root:first-of-type,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root:first-of-type{margin-top:10px}.account-menu:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root .MuiListItemIcon-root .MuiSvgIcon-root,[id=account-menu]:has(.profile-menu-item) .MuiMenu-paper .MuiMenuItem-root .MuiListItemIcon-root .MuiSvgIcon-root{color:var(--color-brand-primary,var(--color-brand-primary))}
|
package/dist/index.esm.js
CHANGED
|
@@ -159,18 +159,19 @@ const getUserDataFromStorage = () => {
|
|
|
159
159
|
initials: name ? name.split(/\s+/).map((s) => s[0]).join("").slice(0, 2).toUpperCase() : undefined,
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
// authDetails.auth.user has firstname/lastname (lowercase n) + activeRole
|
|
162
|
+
// authDetails.auth.user has firstname/lastname (lowercase n) or firstName/lastName (camelCase) + activeRole
|
|
163
163
|
const authDetailsRaw = parseNested(outer.authDetails);
|
|
164
164
|
const auth = authDetailsRaw?.auth;
|
|
165
165
|
const userObj = auth?.user;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
166
|
+
const firstFromUser = (userObj?.firstname ?? userObj?.firstName ?? userObj?.given_name ?? userObj?.first_name) || "";
|
|
167
|
+
const lastFromUser = (userObj?.lastname ?? userObj?.lastName ?? userObj?.family_name ?? userObj?.last_name) || "";
|
|
168
|
+
const emailFromUser = (userObj?.email ?? userObj?.emailAddress) || (auth?.email ?? auth?.sub) || "";
|
|
169
|
+
if (auth && (firstFromUser || lastFromUser || emailFromUser)) {
|
|
170
|
+
const name = [firstFromUser, lastFromUser].filter(Boolean).join(" ").trim();
|
|
171
|
+
const role = auth.activeRole || auth.role || "";
|
|
171
172
|
return {
|
|
172
173
|
name,
|
|
173
|
-
email:
|
|
174
|
+
email: emailFromUser,
|
|
174
175
|
role,
|
|
175
176
|
avatar: undefined,
|
|
176
177
|
initials: name ? name.split(/\s+/).map((s) => s[0]).join("").slice(0, 2).toUpperCase() : undefined,
|
|
@@ -335,49 +336,7 @@ const getAllDataFromStorage = () => {
|
|
|
335
336
|
console.error("Error parsing header persist:", err);
|
|
336
337
|
}
|
|
337
338
|
}
|
|
338
|
-
// Fallback:
|
|
339
|
-
const tryParsePersistForAuth = (raw) => {
|
|
340
|
-
if (!raw)
|
|
341
|
-
return null;
|
|
342
|
-
try {
|
|
343
|
-
const outer = JSON.parse(raw);
|
|
344
|
-
const parseNested = (v) => typeof v === "string" ? (() => { try {
|
|
345
|
-
return JSON.parse(v);
|
|
346
|
-
}
|
|
347
|
-
catch {
|
|
348
|
-
return v;
|
|
349
|
-
} })() : v;
|
|
350
|
-
for (const key of Object.keys(outer)) {
|
|
351
|
-
const parsed = parseNested(outer[key]);
|
|
352
|
-
if (parsed?.accessToken || parsed?.access_token || parsed?.token || parsed?.refreshToken)
|
|
353
|
-
return parsed;
|
|
354
|
-
if (parsed?.auth && typeof parsed.auth === "object") {
|
|
355
|
-
const a = parsed.auth;
|
|
356
|
-
if (a.accessToken || a.access_token || a.token)
|
|
357
|
-
return a;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
catch {
|
|
362
|
-
/* ignore */
|
|
363
|
-
}
|
|
364
|
-
return null;
|
|
365
|
-
};
|
|
366
|
-
const iamPersist = localStorage.getItem("persist:linn-i-am");
|
|
367
|
-
const iamAuth = tryParsePersistForAuth(iamPersist);
|
|
368
|
-
if (iamAuth) {
|
|
369
|
-
const token = (iamAuth.accessToken ?? iamAuth.access_token ?? iamAuth.token);
|
|
370
|
-
if (token) {
|
|
371
|
-
const decodedToken = decodeJWT(token);
|
|
372
|
-
return {
|
|
373
|
-
...emptyStorageResult(),
|
|
374
|
-
auth: iamAuth,
|
|
375
|
-
decodedToken: decodedToken ? Object.fromEntries(Object.entries(decodedToken).map(([k, v]) => [k, v ?? null])) : null,
|
|
376
|
-
rawData: iamAuth,
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
// Fallback: read access token from persist:userdb (e.g. legacy or shared auth)
|
|
339
|
+
// Fallback: read access token from persist:userdb
|
|
381
340
|
const userDbString = localStorage.getItem("persist:userdb");
|
|
382
341
|
if (!userDbString) {
|
|
383
342
|
return emptyStorageResult();
|
|
@@ -578,7 +537,6 @@ function getTokenFromUserDbPersist(parsed) {
|
|
|
578
537
|
function getAccessTokenForRequest() {
|
|
579
538
|
const keysToTry = [
|
|
580
539
|
PERSIST_HEADER_KEY,
|
|
581
|
-
"persist:linn-i-am",
|
|
582
540
|
"persist:userdb",
|
|
583
541
|
"token",
|
|
584
542
|
"accessToken",
|
|
@@ -844,6 +802,35 @@ const AppHeader = ({ language: languageProp, accessToken: accessTokenProp, objec
|
|
|
844
802
|
let userName = "";
|
|
845
803
|
let userEmail = "";
|
|
846
804
|
let userRole = "";
|
|
805
|
+
// === DEBUG ===
|
|
806
|
+
const _allLSKeys = [];
|
|
807
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
808
|
+
const k = localStorage.key(i);
|
|
809
|
+
if (k)
|
|
810
|
+
_allLSKeys.push(k);
|
|
811
|
+
}
|
|
812
|
+
const _dbgRaw = {};
|
|
813
|
+
_allLSKeys.forEach(k => {
|
|
814
|
+
const v = localStorage.getItem(k);
|
|
815
|
+
if (v) {
|
|
816
|
+
try {
|
|
817
|
+
_dbgRaw[k] = JSON.parse(v);
|
|
818
|
+
}
|
|
819
|
+
catch {
|
|
820
|
+
_dbgRaw[k] = v;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
else {
|
|
824
|
+
_dbgRaw[k] = null;
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
console.warn("▶▶▶ [AppHeader DEBUG] ALL localStorage keys:", _allLSKeys);
|
|
828
|
+
console.warn("▶▶▶ [AppHeader DEBUG] ALL localStorage values:", _dbgRaw);
|
|
829
|
+
console.warn("▶▶▶ [AppHeader DEBUG] linn-i-am-userDetails:", localStorage.getItem("linn-i-am-userDetails"));
|
|
830
|
+
console.warn("▶▶▶ [AppHeader DEBUG] persist:userdb (raw):", localStorage.getItem("persist:userdb"));
|
|
831
|
+
console.warn("▶▶▶ [AppHeader DEBUG] getAllDataFromStorage():", allData);
|
|
832
|
+
console.warn("▶▶▶ [AppHeader DEBUG] getUserDataFromStorage():", getUserDataFromStorage());
|
|
833
|
+
// === END DEBUG ===
|
|
847
834
|
const buildNameFromFirstLast = (obj) => {
|
|
848
835
|
if (!obj || typeof obj !== "object")
|
|
849
836
|
return "";
|
|
@@ -868,8 +855,9 @@ const AppHeader = ({ language: languageProp, accessToken: accessTokenProp, objec
|
|
|
868
855
|
}
|
|
869
856
|
if (allData.auth) {
|
|
870
857
|
const auth = allData.auth;
|
|
871
|
-
|
|
872
|
-
|
|
858
|
+
const authUser = auth.user;
|
|
859
|
+
userEmail = userEmail || auth.email || auth.sub || authUser?.email || authUser?.emailAddress || "";
|
|
860
|
+
userName = userName || auth.name || buildNameFromFirstLast(auth) || buildNameFromFirstLast(authUser) || "";
|
|
873
861
|
userRole = userRole || auth.role || auth.activeRole || "";
|
|
874
862
|
}
|
|
875
863
|
if (allData.userDetails) {
|
|
@@ -912,13 +900,15 @@ const AppHeader = ({ language: languageProp, accessToken: accessTokenProp, objec
|
|
|
912
900
|
const initialsVal = storedUser?.initials ??
|
|
913
901
|
allData.auth?.initials ??
|
|
914
902
|
allData.profile?.initials;
|
|
915
|
-
|
|
903
|
+
const resolvedUser = {
|
|
916
904
|
name: userName || "",
|
|
917
905
|
email: userEmail || "",
|
|
918
906
|
role: userRole || "",
|
|
919
907
|
avatar: typeof avatarSrc === "string" ? avatarSrc : undefined,
|
|
920
908
|
initials: typeof initialsVal === "string" ? initialsVal : undefined,
|
|
921
909
|
};
|
|
910
|
+
console.warn("▶▶▶ [AppHeader DEBUG] Resolved user state (name/email/role):", resolvedUser);
|
|
911
|
+
return resolvedUser;
|
|
922
912
|
});
|
|
923
913
|
const [notificationCount, setNotificationCount] = React__default.useState(() => {
|
|
924
914
|
const count = getNotificationCountFromStorage();
|
|
@@ -986,8 +976,9 @@ const AppHeader = ({ language: languageProp, accessToken: accessTokenProp, objec
|
|
|
986
976
|
}
|
|
987
977
|
if (allData.auth) {
|
|
988
978
|
const auth = allData.auth;
|
|
989
|
-
|
|
990
|
-
|
|
979
|
+
const authUser = auth.user;
|
|
980
|
+
userEmail = userEmail || auth.email || auth.sub || authUser?.email || authUser?.emailAddress || "";
|
|
981
|
+
userName = userName || auth.name || buildNameFromFirstLast(auth) || buildNameFromFirstLast(authUser) || "";
|
|
991
982
|
userRole = userRole || auth.role || auth.activeRole || "";
|
|
992
983
|
userAvatar = userAvatar || auth.avatar || undefined;
|
|
993
984
|
userInitials = userInitials || auth.initials || undefined;
|
|
@@ -1198,7 +1189,7 @@ const AppHeader = ({ language: languageProp, accessToken: accessTokenProp, objec
|
|
|
1198
1189
|
width: "100%",
|
|
1199
1190
|
maxWidth: 360,
|
|
1200
1191
|
pointerEvents: "none",
|
|
1201
|
-
}, component: "div", "aria-hidden": "true", tabIndex: -1, children: jsxs(ListItem, { alignItems: "flex-start", className: "profile-menu-item", children: [jsx(ListItemAvatar, { children: isOnlineStatus ? (jsx(OnlineBadge, { overlap: "circular", anchorOrigin: { vertical: "bottom", horizontal: "right" }, variant: "dot", title: t.online, "aria-label": `${t.online} status badge`, "data-testid": "online-badge", children: jsx(Avatar, { sx: { bgcolor: deepOrange[500] }, alt: user.name, title: user.name, src: user.avatar, children: getInitials() }) })) : (jsx(OfflineBadge, { overlap: "circular", anchorOrigin: { vertical: "bottom", horizontal: "right" }, variant: "dot", title: t.offline, "aria-label": `${t.offline} status badge`, "data-testid": "offline-badge", children: jsx(Avatar, { sx: { bgcolor: deepOrange[500] }, alt: user.name, title: user.name, src: user.avatar, children: getInitials() }) })) }), jsx(ListItemText, { primary: jsx(Typography, { className: "profile-name", component: "span", children: user.name || user.email }), secondary: jsxs(React__default.Fragment, { children: [user.name && user.email ? (jsx(Typography, { className: "profile-email", component: "
|
|
1192
|
+
}, component: "div", "aria-hidden": "true", tabIndex: -1, children: jsxs(ListItem, { alignItems: "flex-start", className: "profile-menu-item", children: [jsx(ListItemAvatar, { children: isOnlineStatus ? (jsx(OnlineBadge, { overlap: "circular", anchorOrigin: { vertical: "bottom", horizontal: "right" }, variant: "dot", title: t.online, "aria-label": `${t.online} status badge`, "data-testid": "online-badge", children: jsx(Avatar, { sx: { bgcolor: deepOrange[500] }, alt: user.name, title: user.name, src: user.avatar, children: getInitials() }) })) : (jsx(OfflineBadge, { overlap: "circular", anchorOrigin: { vertical: "bottom", horizontal: "right" }, variant: "dot", title: t.offline, "aria-label": `${t.offline} status badge`, "data-testid": "offline-badge", children: jsx(Avatar, { sx: { bgcolor: deepOrange[500] }, alt: user.name, title: user.name, src: user.avatar, children: getInitials() }) })) }), jsx(ListItemText, { primaryTypographyProps: { component: "span" }, secondaryTypographyProps: { component: "span" }, primary: jsx(Typography, { className: "profile-name", component: "span", children: user.name || user.email }), secondary: jsxs(React__default.Fragment, { children: [user.name && user.email ? (jsx(Typography, { className: "profile-email", component: "span", display: "block", children: user.email })) : null, jsxs(Typography, { className: "profile-role", component: "span", display: "block", children: [t.role, ": ", user.role] })] }) })] }) }));
|
|
1202
1193
|
const renderMenu = (jsxs(Menu, { anchorEl: anchorEl, id: "account-menu", open: open, onClose: handleClose, onClick: handleClose, slotProps: {
|
|
1203
1194
|
paper: {
|
|
1204
1195
|
elevation: 0,
|