@iblai/web-utils 1.2.9 → 1.2.11
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/data-layer/src/features/reports/api-slice.d.ts +150 -279
- package/dist/index.d.ts +7 -4
- package/dist/index.esm.js +39 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/web-utils/src/utils/constants.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -780,6 +780,9 @@ const TOOLS = {
|
|
|
780
780
|
GOOGLE_SLIDES: "google-slides",
|
|
781
781
|
GOOGLE_DOCUMENT: "google-docs",
|
|
782
782
|
};
|
|
783
|
+
const REQUIRED_ACTIONS_FOR_GROUPS = {
|
|
784
|
+
NOTIFICATIONS: "Ibl.Notifications/Notification/action",
|
|
785
|
+
};
|
|
783
786
|
|
|
784
787
|
const isJSON = (text) => {
|
|
785
788
|
if (typeof text !== "string") {
|
|
@@ -2778,7 +2781,7 @@ async function isDmTokenExpired(storageService) {
|
|
|
2778
2781
|
try {
|
|
2779
2782
|
const dmTokenExpires = await storageService.getItem(LOCAL_STORAGE_KEYS.DM_TOKEN_EXPIRES);
|
|
2780
2783
|
if (!dmTokenExpires) {
|
|
2781
|
-
return
|
|
2784
|
+
return false;
|
|
2782
2785
|
}
|
|
2783
2786
|
const expiryTime = new Date(dmTokenExpires).getTime();
|
|
2784
2787
|
const currentTime = Date.now();
|
|
@@ -3008,14 +3011,15 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
|
|
|
3008
3011
|
}
|
|
3009
3012
|
// Check JWT token expiry and force logout for protected routes
|
|
3010
3013
|
if (isProtectedRoute && storageService) {
|
|
3014
|
+
const dmTokenInLocalStorage = await storageService.getItem(LOCAL_STORAGE_KEYS.DM_TOKEN_KEY);
|
|
3011
3015
|
const dmTokenExpired = await isDmTokenExpired(storageService);
|
|
3012
|
-
if (dmTokenExpired) {
|
|
3016
|
+
if (!dmTokenInLocalStorage || dmTokenExpired) {
|
|
3013
3017
|
console.log("[auth-redirect] DM token has expired, forcing logout");
|
|
3014
3018
|
// Clear all auth-related storage keys
|
|
3015
3019
|
clearAuthCookies();
|
|
3016
3020
|
const reason = "DM token expired";
|
|
3017
3021
|
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(reason);
|
|
3018
|
-
safeRedirectToAuthSpa(undefined, undefined,
|
|
3022
|
+
safeRedirectToAuthSpa(undefined, undefined, !!dmTokenInLocalStorage); // with no dm token at all in storage, don't force logout
|
|
3019
3023
|
return;
|
|
3020
3024
|
}
|
|
3021
3025
|
// Validate JWT token user_id
|
|
@@ -16080,7 +16084,37 @@ createApi({
|
|
|
16080
16084
|
tagTypes: ['reports', 'reportDetail'],
|
|
16081
16085
|
endpoints: (builder) => ({
|
|
16082
16086
|
getReports: builder.query({
|
|
16083
|
-
|
|
16087
|
+
async queryFn({ key, mentor_id }) {
|
|
16088
|
+
var _a, _b;
|
|
16089
|
+
try {
|
|
16090
|
+
const baseUrl = getServiceUrl(SERVICES.DM);
|
|
16091
|
+
const authHeaders = await getHeaders(SERVICES.DM);
|
|
16092
|
+
const url = new URL(`/dm/api/reports/platforms/${encodeURIComponent(key)}/`, baseUrl);
|
|
16093
|
+
if (mentor_id) {
|
|
16094
|
+
url.searchParams.set('mentor_id', mentor_id);
|
|
16095
|
+
}
|
|
16096
|
+
const response = await fetch(url.toString(), {
|
|
16097
|
+
method: 'GET',
|
|
16098
|
+
headers: {
|
|
16099
|
+
'Content-Type': 'application/json',
|
|
16100
|
+
...(authHeaders !== null && authHeaders !== void 0 ? authHeaders : {}),
|
|
16101
|
+
},
|
|
16102
|
+
});
|
|
16103
|
+
const data = (await response.json());
|
|
16104
|
+
if (!response.ok) {
|
|
16105
|
+
return { error: { status: response.status, data } };
|
|
16106
|
+
}
|
|
16107
|
+
return { data };
|
|
16108
|
+
}
|
|
16109
|
+
catch (err) {
|
|
16110
|
+
return {
|
|
16111
|
+
error: {
|
|
16112
|
+
status: (_a = err === null || err === void 0 ? void 0 : err.status) !== null && _a !== void 0 ? _a : 500,
|
|
16113
|
+
data: (_b = err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : 'Unknown error',
|
|
16114
|
+
},
|
|
16115
|
+
};
|
|
16116
|
+
}
|
|
16117
|
+
},
|
|
16084
16118
|
providesTags: ['reports'],
|
|
16085
16119
|
}),
|
|
16086
16120
|
getReportDetail: builder.query({
|
|
@@ -23544,6 +23578,7 @@ exports.MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS = MAX_INITIAL_WEBSOCKET_CONNEC
|
|
|
23544
23578
|
exports.MENTOR_CHAT_DOCUMENTS_EXTENSIONS = MENTOR_CHAT_DOCUMENTS_EXTENSIONS;
|
|
23545
23579
|
exports.METADATAS = METADATAS;
|
|
23546
23580
|
exports.MentorProvider = MentorProvider;
|
|
23581
|
+
exports.REQUIRED_ACTIONS_FOR_GROUPS = REQUIRED_ACTIONS_FOR_GROUPS;
|
|
23547
23582
|
exports.STREAMING_CONTENT_BUFFER_THRESHOLD = STREAMING_CONTENT_BUFFER_THRESHOLD;
|
|
23548
23583
|
exports.STREAMING_CONTENT_FLUSH_INTERVAL = STREAMING_CONTENT_FLUSH_INTERVAL;
|
|
23549
23584
|
exports.SUBSCRIPTION_MESSAGES = SUBSCRIPTION_MESSAGES;
|