varminer-app-header 2.2.0 → 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 +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +38 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/localStorage.d.ts +7 -0
- package/dist/utils/localStorage.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -102,6 +102,13 @@ declare const getAllDataFromStorage: () => any;
|
|
|
102
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
|
@@ -373,6 +373,43 @@ const getProfilePictureUrl = (baseUrl = "http://objectstore.impact0mics.local:90
|
|
|
373
373
|
return null;
|
|
374
374
|
}
|
|
375
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
|
+
};
|
|
376
413
|
/**
|
|
377
414
|
* Generate AWS S3 presigned URL for accessing S3 object
|
|
378
415
|
* @param s3Url - Full S3 URL (e.g., https://bucket.s3.region.amazonaws.com/key)
|
|
@@ -1127,5 +1164,5 @@ const AppHeader = ({ language: languageProp }) => {
|
|
|
1127
1164
|
}, children: jsx(MoreIcon, {}) }) })] }) }), renderMobileMenu, renderMenu] }));
|
|
1128
1165
|
};
|
|
1129
1166
|
|
|
1130
|
-
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 };
|
|
1131
1168
|
//# sourceMappingURL=index.esm.js.map
|