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.js
CHANGED
|
@@ -393,6 +393,43 @@ const getProfilePictureUrl = (baseUrl = "http://objectstore.impact0mics.local:90
|
|
|
393
393
|
return null;
|
|
394
394
|
}
|
|
395
395
|
};
|
|
396
|
+
/**
|
|
397
|
+
* Get profile picture upload URL for the object store API.
|
|
398
|
+
* URL format: {baseUrl}/v1/objectStore/profilePictureUpload?tenantId=&userId=&roleId=
|
|
399
|
+
* @param baseUrl - Base URL for the object store API (default: http://objectstore.impact0mics.local:9012)
|
|
400
|
+
* @returns Full upload URL with query params, or null if tenantId, userId, or roleId is missing
|
|
401
|
+
*/
|
|
402
|
+
const getProfilePictureUploadUrl = (baseUrl = "http://objectstore.impact0mics.local:9012") => {
|
|
403
|
+
try {
|
|
404
|
+
const allData = getAllDataFromStorage();
|
|
405
|
+
const iamUser = getStoredUserDetails();
|
|
406
|
+
const tenantId = allData.decodedToken?.tenant_id ??
|
|
407
|
+
allData.decodedToken?.tenant ??
|
|
408
|
+
allData.auth?.tenant_id ??
|
|
409
|
+
allData.auth?.tenant ??
|
|
410
|
+
null;
|
|
411
|
+
const userId = allData.decodedToken?.user_id ??
|
|
412
|
+
allData.auth?.user_id ??
|
|
413
|
+
iamUser?.userId ??
|
|
414
|
+
null;
|
|
415
|
+
const roleId = allData.decodedToken?.role_id ??
|
|
416
|
+
allData.auth?.role_id ??
|
|
417
|
+
null;
|
|
418
|
+
if (tenantId == null || userId == null || roleId == null)
|
|
419
|
+
return null;
|
|
420
|
+
const cleanBaseUrl = baseUrl.replace(/\/$/, "");
|
|
421
|
+
const params = new URLSearchParams({
|
|
422
|
+
tenantId: String(tenantId),
|
|
423
|
+
userId: String(userId),
|
|
424
|
+
roleId: String(roleId),
|
|
425
|
+
});
|
|
426
|
+
return `${cleanBaseUrl}/v1/objectStore/profilePictureUpload?${params.toString()}`;
|
|
427
|
+
}
|
|
428
|
+
catch (err) {
|
|
429
|
+
console.error("Error getting profile picture upload URL:", err);
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
};
|
|
396
433
|
/**
|
|
397
434
|
* Generate AWS S3 presigned URL for accessing S3 object
|
|
398
435
|
* @param s3Url - Full S3 URL (e.g., https://bucket.s3.region.amazonaws.com/key)
|
|
@@ -1155,6 +1192,7 @@ exports.getAllDataFromStorage = getAllDataFromStorage;
|
|
|
1155
1192
|
exports.getI18nLocaleFromStorage = getI18nLocaleFromStorage;
|
|
1156
1193
|
exports.getMessageCountFromStorage = getMessageCountFromStorage;
|
|
1157
1194
|
exports.getNotificationCountFromStorage = getNotificationCountFromStorage;
|
|
1195
|
+
exports.getProfilePictureUploadUrl = getProfilePictureUploadUrl;
|
|
1158
1196
|
exports.getProfilePictureUrl = getProfilePictureUrl;
|
|
1159
1197
|
exports.getStoredUserDetails = getStoredUserDetails;
|
|
1160
1198
|
exports.getTranslations = getTranslations;
|