varminer-app-header 2.1.9 → 2.2.1
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/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +44 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +44 -21
- package/dist/index.js.map +1 -1
- package/dist/utils/localStorage.d.ts +9 -2
- package/dist/utils/localStorage.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -97,11 +97,18 @@ declare const setI18nLocaleToStorage: (locale: string) => void;
|
|
|
97
97
|
*/
|
|
98
98
|
declare const getAllDataFromStorage: () => any;
|
|
99
99
|
/**
|
|
100
|
-
* Get profile picture URL from object store API using
|
|
100
|
+
* Get profile picture URL from object store API using user_id.
|
|
101
101
|
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
102
|
-
* @returns Profile picture URL or null if
|
|
102
|
+
* @returns Profile picture URL or null if user_id is not available
|
|
103
103
|
*/
|
|
104
104
|
declare const getProfilePictureUrl: (baseUrl?: string) => string | null;
|
|
105
|
+
/**
|
|
106
|
+
* Get profile picture upload URL for the object store API.
|
|
107
|
+
* URL format: {baseUrl}/v1/objectStore/profilePictureUpload?tenantId=&userId=&roleId=
|
|
108
|
+
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
109
|
+
* @returns Full upload URL with query params, or null if tenantId, userId, or roleId is missing
|
|
110
|
+
*/
|
|
111
|
+
declare const getProfilePictureUploadUrl: (baseUrl?: string) => string | null;
|
|
105
112
|
/**
|
|
106
113
|
* Fetch profile picture from API with headers, get S3 URL, generate presigned URL, and return as blob URL
|
|
107
114
|
* This function:
|
|
@@ -123,5 +130,5 @@ declare const fetchProfilePictureAsBlobUrl: (baseUrl?: string, messageId?: strin
|
|
|
123
130
|
bucket?: string;
|
|
124
131
|
}) => Promise<string | null>;
|
|
125
132
|
|
|
126
|
-
export { AppHeader, DrawerProvider, USER_DETAILS_STORAGE_KEY, fetchProfilePictureAsBlobUrl, getAllDataFromStorage, getI18nLocaleFromStorage, getMessageCountFromStorage, getNotificationCountFromStorage, getProfilePictureUrl, getStoredUserDetails, getTranslations, getUserDataFromStorage, setI18nLocaleToStorage, translations, useDrawer };
|
|
133
|
+
export { AppHeader, DrawerProvider, USER_DETAILS_STORAGE_KEY, fetchProfilePictureAsBlobUrl, getAllDataFromStorage, getI18nLocaleFromStorage, getMessageCountFromStorage, getNotificationCountFromStorage, getProfilePictureUploadUrl, getProfilePictureUrl, getStoredUserDetails, getTranslations, getUserDataFromStorage, setI18nLocaleToStorage, translations, useDrawer };
|
|
127
134
|
export type { AppHeaderProps, SupportedLanguage, Translations, UserDetailsItem, UserDetailsStoredResponse, UserProfile };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,+BAA+B,EAC/B,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,+BAA+B,EAC/B,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -356,38 +356,60 @@ const getAllDataFromStorage = () => {
|
|
|
356
356
|
}
|
|
357
357
|
};
|
|
358
358
|
/**
|
|
359
|
-
* Get profile picture URL from object store API using
|
|
359
|
+
* Get profile picture URL from object store API using user_id.
|
|
360
360
|
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
361
|
-
* @returns Profile picture URL or null if
|
|
361
|
+
* @returns Profile picture URL or null if user_id is not available
|
|
362
362
|
*/
|
|
363
363
|
const getProfilePictureUrl = (baseUrl = "http://objectstore.impact0mics.local:9012") => {
|
|
364
364
|
try {
|
|
365
365
|
const allData = getAllDataFromStorage();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
tenantId = allData.decodedToken.tenant_id || allData.decodedToken.tenant || null;
|
|
371
|
-
userId = allData.decodedToken.user_id || null;
|
|
372
|
-
}
|
|
373
|
-
// If not found in decoded token, try auth data
|
|
374
|
-
if ((!tenantId || !userId) && allData.auth) {
|
|
375
|
-
tenantId = tenantId || allData.auth.tenant_id || allData.auth.tenant || null;
|
|
376
|
-
userId = userId || allData.auth.user_id || null;
|
|
377
|
-
}
|
|
378
|
-
// Construct URL if we have both tenant_id and user_id
|
|
379
|
-
if (tenantId && userId) {
|
|
380
|
-
// Remove trailing slash from baseUrl if present
|
|
381
|
-
const cleanBaseUrl = baseUrl.replace(/\/$/, '');
|
|
382
|
-
return `${cleanBaseUrl}/v1/objectStore/profilePicture/path/${tenantId}/${userId}`;
|
|
383
|
-
}
|
|
384
|
-
return null;
|
|
366
|
+
const userId = allData.decodedToken?.user_id ?? allData.auth?.user_id ?? getStoredUserDetails()?.userId ?? null;
|
|
367
|
+
if (userId == null)
|
|
368
|
+
return null;
|
|
369
|
+
return `${baseUrl.replace(/\/$/, "")}/v1/objectStore/profilePicture/path/${userId}`;
|
|
385
370
|
}
|
|
386
371
|
catch (err) {
|
|
387
372
|
console.error("Error getting profile picture URL:", err);
|
|
388
373
|
return null;
|
|
389
374
|
}
|
|
390
375
|
};
|
|
376
|
+
/**
|
|
377
|
+
* Get profile picture upload URL for the object store API.
|
|
378
|
+
* URL format: {baseUrl}/v1/objectStore/profilePictureUpload?tenantId=&userId=&roleId=
|
|
379
|
+
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
380
|
+
* @returns Full upload URL with query params, or null if tenantId, userId, or roleId is missing
|
|
381
|
+
*/
|
|
382
|
+
const getProfilePictureUploadUrl = (baseUrl = "http://objectstore.impact0mics.local:9012") => {
|
|
383
|
+
try {
|
|
384
|
+
const allData = getAllDataFromStorage();
|
|
385
|
+
const iamUser = getStoredUserDetails();
|
|
386
|
+
const tenantId = allData.decodedToken?.tenant_id ??
|
|
387
|
+
allData.decodedToken?.tenant ??
|
|
388
|
+
allData.auth?.tenant_id ??
|
|
389
|
+
allData.auth?.tenant ??
|
|
390
|
+
null;
|
|
391
|
+
const userId = allData.decodedToken?.user_id ??
|
|
392
|
+
allData.auth?.user_id ??
|
|
393
|
+
iamUser?.userId ??
|
|
394
|
+
null;
|
|
395
|
+
const roleId = allData.decodedToken?.role_id ??
|
|
396
|
+
allData.auth?.role_id ??
|
|
397
|
+
null;
|
|
398
|
+
if (tenantId == null || userId == null || roleId == null)
|
|
399
|
+
return null;
|
|
400
|
+
const cleanBaseUrl = baseUrl.replace(/\/$/, "");
|
|
401
|
+
const params = new URLSearchParams({
|
|
402
|
+
tenantId: String(tenantId),
|
|
403
|
+
userId: String(userId),
|
|
404
|
+
roleId: String(roleId),
|
|
405
|
+
});
|
|
406
|
+
return `${cleanBaseUrl}/v1/objectStore/profilePictureUpload?${params.toString()}`;
|
|
407
|
+
}
|
|
408
|
+
catch (err) {
|
|
409
|
+
console.error("Error getting profile picture upload URL:", err);
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
391
413
|
/**
|
|
392
414
|
* Generate AWS S3 presigned URL for accessing S3 object
|
|
393
415
|
* @param s3Url - Full S3 URL (e.g., https://bucket.s3.region.amazonaws.com/key)
|
|
@@ -1142,5 +1164,5 @@ const AppHeader = ({ language: languageProp }) => {
|
|
|
1142
1164
|
}, children: jsx(MoreIcon, {}) }) })] }) }), renderMobileMenu, renderMenu] }));
|
|
1143
1165
|
};
|
|
1144
1166
|
|
|
1145
|
-
export { AppHeader, DrawerProvider, USER_DETAILS_STORAGE_KEY, fetchProfilePictureAsBlobUrl, getAllDataFromStorage, getI18nLocaleFromStorage, getMessageCountFromStorage, getNotificationCountFromStorage, getProfilePictureUrl, getStoredUserDetails, getTranslations, getUserDataFromStorage, setI18nLocaleToStorage, translations, useDrawer };
|
|
1167
|
+
export { AppHeader, DrawerProvider, USER_DETAILS_STORAGE_KEY, fetchProfilePictureAsBlobUrl, getAllDataFromStorage, getI18nLocaleFromStorage, getMessageCountFromStorage, getNotificationCountFromStorage, getProfilePictureUploadUrl, getProfilePictureUrl, getStoredUserDetails, getTranslations, getUserDataFromStorage, setI18nLocaleToStorage, translations, useDrawer };
|
|
1146
1168
|
//# sourceMappingURL=index.esm.js.map
|