@iblai/web-utils 1.1.17 → 1.2.0
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/memory/api-slice.d.ts +1492 -687
- package/dist/data-layer/src/features/memory/constants.d.ts +48 -27
- package/dist/data-layer/src/features/memory/types.d.ts +134 -97
- package/dist/index.d.ts +5 -4
- package/dist/index.esm.js +227 -171
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +227 -171
- package/dist/index.js.map +1 -1
- package/dist/package.json +31 -30
- package/dist/web-utils/src/providers/tenant-provider.d.ts +2 -1
- package/package.json +31 -30
package/dist/index.esm.js
CHANGED
|
@@ -3150,7 +3150,7 @@ const useTenantContext = () => useContext(TenantContext);
|
|
|
3150
3150
|
* 4. Handles tenant-specific domain redirects
|
|
3151
3151
|
* 5. Maintains tenant access state
|
|
3152
3152
|
*/
|
|
3153
|
-
function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed = false, setUseMentorProvider, skip = false, onLoadPlatformPermissions, }) {
|
|
3153
|
+
function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, username, isIframed = false, setUseMentorProvider, skip = false, onLoadPlatformPermissions, skipCustomDomainCheck = false, }) {
|
|
3154
3154
|
// If skip is true, just return children without any provider logic
|
|
3155
3155
|
if (skip) {
|
|
3156
3156
|
return jsx(Fragment, { children: children });
|
|
@@ -3167,7 +3167,7 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
3167
3167
|
const [metadata, setMetadata] = useState({});
|
|
3168
3168
|
// Fetch custom domain to get platform_key
|
|
3169
3169
|
const currentDomain = typeof window !== "undefined" ? window.location.hostname : "";
|
|
3170
|
-
const { data: customDomainData, isLoading: isLoadingCustomDomain, isError: isCustomDomainError, } = useGetCustomDomainsQuery({ params: { domain: currentDomain } }, { skip: !isWeb() || !currentDomain });
|
|
3170
|
+
const { data: customDomainData, isLoading: isLoadingCustomDomain, isError: isCustomDomainError, } = useGetCustomDomainsQuery({ params: { domain: currentDomain } }, { skip: !isWeb() || !currentDomain || skipCustomDomainCheck });
|
|
3171
3171
|
// Extract platform_key from custom domain response to use as requestedTenant
|
|
3172
3172
|
const { customDomainPlatformKey, isAdvertisingTenant } = React__default.useMemo(() => {
|
|
3173
3173
|
let platformKey;
|
|
@@ -3251,6 +3251,40 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
3251
3251
|
}
|
|
3252
3252
|
return tenants;
|
|
3253
3253
|
};
|
|
3254
|
+
/**
|
|
3255
|
+
* Joins a tenant, fetches fresh tokens and tenants, loads RBAC permissions,
|
|
3256
|
+
* and updates all relevant state. If the join fails, saves the tenant as a
|
|
3257
|
+
* visiting tenant instead.
|
|
3258
|
+
*/
|
|
3259
|
+
const joinAndActivateTenant = async (tenantKey, tenantMetadata, newCurrentTenant, { handleVisitingTenant = true } = {}) => {
|
|
3260
|
+
var _a;
|
|
3261
|
+
try {
|
|
3262
|
+
await joinTenant({ platform_key: tenantKey }).unwrap();
|
|
3263
|
+
const formData = new FormData();
|
|
3264
|
+
formData.append("platform_key", tenantKey);
|
|
3265
|
+
const { data: newTenants } = await fetchUserTenants();
|
|
3266
|
+
const enhancedNewTenants = await enhanceTenants(newTenants, tenantMetadata);
|
|
3267
|
+
const { data: tokenResponse } = await getAppToken(formData).unwrap();
|
|
3268
|
+
saveUserTokens === null || saveUserTokens === void 0 ? void 0 : saveUserTokens(tokenResponse);
|
|
3269
|
+
saveCurrentTenant(newCurrentTenant);
|
|
3270
|
+
if (enhancedNewTenants && enhancedNewTenants.length) {
|
|
3271
|
+
saveUserTenants(enhancedNewTenants);
|
|
3272
|
+
}
|
|
3273
|
+
const rbacPermissions = await loadPlatformPermissions(tenantMetadata.platform_key);
|
|
3274
|
+
onLoadPlatformPermissions === null || onLoadPlatformPermissions === void 0 ? void 0 : onLoadPlatformPermissions(rbacPermissions);
|
|
3275
|
+
onAutoJoinUserToTenant === null || onAutoJoinUserToTenant === void 0 ? void 0 : onAutoJoinUserToTenant((_a = tenantMetadata.platform_name) !== null && _a !== void 0 ? _a : tenantMetadata === null || tenantMetadata === void 0 ? void 0 : tenantMetadata.platform_key.toUpperCase());
|
|
3276
|
+
saveTenant === null || saveTenant === void 0 ? void 0 : saveTenant(tenantKey);
|
|
3277
|
+
setUserIsAccessingPublicRoute(false);
|
|
3278
|
+
removeVisitingTenant === null || removeVisitingTenant === void 0 ? void 0 : removeVisitingTenant();
|
|
3279
|
+
return true;
|
|
3280
|
+
}
|
|
3281
|
+
catch (e) {
|
|
3282
|
+
if (handleVisitingTenant) {
|
|
3283
|
+
saveVisitingTenant === null || saveVisitingTenant === void 0 ? void 0 : saveVisitingTenant(newCurrentTenant);
|
|
3284
|
+
}
|
|
3285
|
+
return false;
|
|
3286
|
+
}
|
|
3287
|
+
};
|
|
3254
3288
|
/**
|
|
3255
3289
|
* Determines which tenant the user should access by:
|
|
3256
3290
|
* 1. Fetching user's available tenants
|
|
@@ -3316,7 +3350,18 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
3316
3350
|
if (isWeb() && sessionStorage.getItem(guardKey)) {
|
|
3317
3351
|
sessionStorage.removeItem(guardKey);
|
|
3318
3352
|
console.warn(`[TenantProvider] User still does not belong to custom domain tenant after re-auth: ${customDomainPlatformKey}`);
|
|
3319
|
-
|
|
3353
|
+
const joined = await joinAndActivateTenant(customDomainPlatformKey, {
|
|
3354
|
+
platform_key: customDomainPlatformKey,
|
|
3355
|
+
platform_name: customDomainPlatformKey,
|
|
3356
|
+
}, {
|
|
3357
|
+
key: customDomainPlatformKey,
|
|
3358
|
+
is_admin: false,
|
|
3359
|
+
org: customDomainPlatformKey,
|
|
3360
|
+
platform_name: customDomainPlatformKey,
|
|
3361
|
+
}, { handleVisitingTenant: false });
|
|
3362
|
+
if (!joined) {
|
|
3363
|
+
onAuthFailure === null || onAuthFailure === void 0 ? void 0 : onAuthFailure(`You do not have access to this platform (${customDomainPlatformKey}). Please contact your administrator.`);
|
|
3364
|
+
}
|
|
3320
3365
|
return;
|
|
3321
3366
|
}
|
|
3322
3367
|
if (isWeb()) {
|
|
@@ -3407,7 +3452,7 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
3407
3452
|
}
|
|
3408
3453
|
}
|
|
3409
3454
|
async function handleLoadTenantMetadata(tenantKey) {
|
|
3410
|
-
var _a, _b
|
|
3455
|
+
var _a, _b;
|
|
3411
3456
|
setIsLoading(true);
|
|
3412
3457
|
const MAIN_TENANT_KEY = "main";
|
|
3413
3458
|
try {
|
|
@@ -3462,41 +3507,7 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
|
|
|
3462
3507
|
setIsLoading(false);
|
|
3463
3508
|
return;
|
|
3464
3509
|
}
|
|
3465
|
-
|
|
3466
|
-
await joinTenant({
|
|
3467
|
-
platform_key: tenantKey,
|
|
3468
|
-
}).unwrap();
|
|
3469
|
-
try {
|
|
3470
|
-
// succesfully joined tenant at this point
|
|
3471
|
-
// we want to fetch tokens for this new tenant
|
|
3472
|
-
const formData = new FormData();
|
|
3473
|
-
formData.append("platform_key", tenantKey);
|
|
3474
|
-
const { data: newTenants } = await fetchUserTenants();
|
|
3475
|
-
const enhancedNewTenants = await enhanceTenants(newTenants, data);
|
|
3476
|
-
const { data: tokenResponse } = await getAppToken(formData).unwrap();
|
|
3477
|
-
saveUserTokens === null || saveUserTokens === void 0 ? void 0 : saveUserTokens(tokenResponse);
|
|
3478
|
-
saveCurrentTenant(newCurrentTenant);
|
|
3479
|
-
if (enhancedNewTenants && enhancedNewTenants.length) {
|
|
3480
|
-
saveUserTenants(enhancedNewTenants);
|
|
3481
|
-
}
|
|
3482
|
-
else {
|
|
3483
|
-
// TODO: What happense when if for any reason we fetch tenants and it's an empty list
|
|
3484
|
-
}
|
|
3485
|
-
const rbacPermissions = await loadPlatformPermissions(data.platform_key);
|
|
3486
|
-
onLoadPlatformPermissions === null || onLoadPlatformPermissions === void 0 ? void 0 : onLoadPlatformPermissions(rbacPermissions);
|
|
3487
|
-
onAutoJoinUserToTenant === null || onAutoJoinUserToTenant === void 0 ? void 0 : onAutoJoinUserToTenant((_c = data.platform_name) !== null && _c !== void 0 ? _c : data === null || data === void 0 ? void 0 : data.platform_key.toUpperCase());
|
|
3488
|
-
saveTenant === null || saveTenant === void 0 ? void 0 : saveTenant(tenantKey);
|
|
3489
|
-
setUserIsAccessingPublicRoute(false);
|
|
3490
|
-
removeVisitingTenant === null || removeVisitingTenant === void 0 ? void 0 : removeVisitingTenant();
|
|
3491
|
-
}
|
|
3492
|
-
catch (e) {
|
|
3493
|
-
throw e;
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
catch (e) {
|
|
3497
|
-
// failed to join the visiting tenant so save the visiting tenant
|
|
3498
|
-
saveVisitingTenant === null || saveVisitingTenant === void 0 ? void 0 : saveVisitingTenant(newCurrentTenant);
|
|
3499
|
-
}
|
|
3510
|
+
await joinAndActivateTenant(tenantKey, data, newCurrentTenant);
|
|
3500
3511
|
}
|
|
3501
3512
|
else {
|
|
3502
3513
|
if (!currentTenant) {
|
|
@@ -16459,175 +16470,220 @@ createApi({
|
|
|
16459
16470
|
});
|
|
16460
16471
|
|
|
16461
16472
|
const MEMORY_REDUCER_PATH = 'memoryApiSlice';
|
|
16462
|
-
const
|
|
16463
|
-
|
|
16473
|
+
const MEMORY_QUERY_KEYS = {
|
|
16474
|
+
MEMSEARCH_USER_SETTINGS: () => ['MEMSEARCH_USER_SETTINGS'],
|
|
16475
|
+
MEMSEARCH_GLOBAL_MEMORIES: () => ['MEMSEARCH_GLOBAL_MEMORIES'],
|
|
16476
|
+
MEMSEARCH_MENTOR_MEMORIES: () => ['MEMSEARCH_MENTOR_MEMORIES'],
|
|
16477
|
+
MEMSEARCH_MEMORY_CATEGORIES: () => ['MEMSEARCH_MEMORY_CATEGORIES'],
|
|
16478
|
+
MEMSEARCH_PLATFORM_CONFIG: () => ['MEMSEARCH_PLATFORM_CONFIG'],
|
|
16479
|
+
};
|
|
16480
|
+
const MEMSEARCH_ENDPOINTS = {
|
|
16481
|
+
// User Memory Settings
|
|
16482
|
+
GET_USER_SETTINGS: {
|
|
16464
16483
|
service: SERVICES.AXD,
|
|
16465
|
-
path: (
|
|
16484
|
+
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/memsearch-settings/`,
|
|
16466
16485
|
},
|
|
16467
|
-
|
|
16486
|
+
UPDATE_USER_SETTINGS: {
|
|
16468
16487
|
service: SERVICES.AXD,
|
|
16469
|
-
path: (
|
|
16488
|
+
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/memsearch-settings/`,
|
|
16470
16489
|
},
|
|
16471
|
-
|
|
16490
|
+
// Global Memories
|
|
16491
|
+
GET_GLOBAL_MEMORIES: {
|
|
16472
16492
|
service: SERVICES.AXD,
|
|
16473
|
-
path: (
|
|
16493
|
+
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/global-memories/`,
|
|
16474
16494
|
},
|
|
16475
|
-
|
|
16495
|
+
CREATE_GLOBAL_MEMORY: {
|
|
16476
16496
|
service: SERVICES.AXD,
|
|
16477
|
-
path: (
|
|
16497
|
+
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/global-memories/`,
|
|
16478
16498
|
},
|
|
16479
|
-
|
|
16499
|
+
DELETE_GLOBAL_MEMORY: {
|
|
16480
16500
|
service: SERVICES.AXD,
|
|
16481
|
-
path: (
|
|
16501
|
+
path: (org, userId, memoryId) => `/api/ai-mentor/orgs/${org}/users/${userId}/global-memories/${memoryId}/`,
|
|
16482
16502
|
},
|
|
16483
|
-
|
|
16503
|
+
// Mentor-Specific Memories
|
|
16504
|
+
GET_MENTOR_MEMORIES: {
|
|
16484
16505
|
service: SERVICES.AXD,
|
|
16485
|
-
path: (
|
|
16506
|
+
path: (org, userId, mentorId) => `/api/ai-mentor/orgs/${org}/users/${userId}/mentors/${mentorId}/mentor-memories/`,
|
|
16486
16507
|
},
|
|
16487
|
-
|
|
16508
|
+
CREATE_MENTOR_MEMORY: {
|
|
16488
16509
|
service: SERVICES.AXD,
|
|
16489
|
-
path: (
|
|
16510
|
+
path: (org, userId, mentorId) => `/api/ai-mentor/orgs/${org}/users/${userId}/mentors/${mentorId}/mentor-memories/`,
|
|
16490
16511
|
},
|
|
16491
|
-
|
|
16512
|
+
UPDATE_MENTOR_MEMORY: {
|
|
16492
16513
|
service: SERVICES.AXD,
|
|
16493
|
-
path: (
|
|
16514
|
+
path: (org, userId, mentorId, memoryId) => `/api/ai-mentor/orgs/${org}/users/${userId}/mentors/${mentorId}/mentor-memories/${memoryId}/`,
|
|
16494
16515
|
},
|
|
16495
|
-
|
|
16516
|
+
DELETE_MENTOR_MEMORY: {
|
|
16496
16517
|
service: SERVICES.AXD,
|
|
16497
|
-
path: (
|
|
16518
|
+
path: (org, userId, mentorId, memoryId) => `/api/ai-mentor/orgs/${org}/users/${userId}/mentors/${mentorId}/mentor-memories/${memoryId}/`,
|
|
16498
16519
|
},
|
|
16499
|
-
|
|
16520
|
+
// Memory Categories (Admin)
|
|
16521
|
+
GET_MEMSEARCH_CATEGORIES: {
|
|
16500
16522
|
service: SERVICES.AXD,
|
|
16501
|
-
path: (
|
|
16523
|
+
path: (org, mentorId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/memory-categories/`,
|
|
16524
|
+
},
|
|
16525
|
+
CREATE_MEMSEARCH_CATEGORY: {
|
|
16526
|
+
service: SERVICES.AXD,
|
|
16527
|
+
path: (org, mentorId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/memory-categories/`,
|
|
16528
|
+
},
|
|
16529
|
+
UPDATE_MEMSEARCH_CATEGORY: {
|
|
16530
|
+
service: SERVICES.AXD,
|
|
16531
|
+
path: (org, mentorId, categoryId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/memory-categories/${categoryId}/`,
|
|
16532
|
+
},
|
|
16533
|
+
DELETE_MEMSEARCH_CATEGORY: {
|
|
16534
|
+
service: SERVICES.AXD,
|
|
16535
|
+
path: (org, mentorId, categoryId) => `/api/ai-mentor/orgs/${org}/mentors/${mentorId}/memory-categories/${categoryId}/`,
|
|
16536
|
+
},
|
|
16537
|
+
// Platform Configuration
|
|
16538
|
+
GET_MEMSEARCH_CONFIG: {
|
|
16539
|
+
service: SERVICES.AXD,
|
|
16540
|
+
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/memsearch-config/`,
|
|
16541
|
+
},
|
|
16542
|
+
UPDATE_MEMSEARCH_CONFIG: {
|
|
16543
|
+
service: SERVICES.AXD,
|
|
16544
|
+
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/memsearch-config/`,
|
|
16502
16545
|
},
|
|
16503
|
-
};
|
|
16504
|
-
const MEMORY_QUERY_KEYS = {
|
|
16505
|
-
GET_MEMORIES: () => ['MEMORIES'],
|
|
16506
|
-
GET_MEMORY_CATEGORIES: () => ['MEMORY_CATEGORIES'],
|
|
16507
|
-
GET_MENTOR_USER_SETTINGS: () => ['MENTOR_USER_SETTINGS'],
|
|
16508
|
-
GET_FILTERED_MEMORIES: () => ['FILTERED_MEMORIES'],
|
|
16509
16546
|
};
|
|
16510
16547
|
|
|
16511
16548
|
createApi({
|
|
16512
16549
|
reducerPath: MEMORY_REDUCER_PATH,
|
|
16513
16550
|
tagTypes: [
|
|
16514
|
-
...MEMORY_QUERY_KEYS.
|
|
16515
|
-
...MEMORY_QUERY_KEYS.
|
|
16516
|
-
...MEMORY_QUERY_KEYS.
|
|
16517
|
-
...MEMORY_QUERY_KEYS.
|
|
16551
|
+
...MEMORY_QUERY_KEYS.MEMSEARCH_USER_SETTINGS(),
|
|
16552
|
+
...MEMORY_QUERY_KEYS.MEMSEARCH_GLOBAL_MEMORIES(),
|
|
16553
|
+
...MEMORY_QUERY_KEYS.MEMSEARCH_MENTOR_MEMORIES(),
|
|
16554
|
+
...MEMORY_QUERY_KEYS.MEMSEARCH_MEMORY_CATEGORIES(),
|
|
16555
|
+
...MEMORY_QUERY_KEYS.MEMSEARCH_PLATFORM_CONFIG(),
|
|
16518
16556
|
],
|
|
16519
16557
|
baseQuery: iblFetchBaseQuery,
|
|
16520
16558
|
endpoints: (builder) => ({
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
},
|
|
16529
|
-
providesTags: MEMORY_QUERY_KEYS.GET_MEMORIES(),
|
|
16559
|
+
// User Memory Settings
|
|
16560
|
+
getUserMemorySettings: builder.query({
|
|
16561
|
+
query: (args) => ({
|
|
16562
|
+
url: MEMSEARCH_ENDPOINTS.GET_USER_SETTINGS.path(args.org, args.userId),
|
|
16563
|
+
service: MEMSEARCH_ENDPOINTS.GET_USER_SETTINGS.service,
|
|
16564
|
+
}),
|
|
16565
|
+
providesTags: MEMORY_QUERY_KEYS.MEMSEARCH_USER_SETTINGS(),
|
|
16530
16566
|
}),
|
|
16531
|
-
|
|
16532
|
-
query: (args) => {
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
},
|
|
16538
|
-
|
|
16567
|
+
updateUserMemorySettings: builder.mutation({
|
|
16568
|
+
query: (args) => ({
|
|
16569
|
+
url: MEMSEARCH_ENDPOINTS.UPDATE_USER_SETTINGS.path(args.org, args.userId),
|
|
16570
|
+
service: MEMSEARCH_ENDPOINTS.UPDATE_USER_SETTINGS.service,
|
|
16571
|
+
method: 'PUT',
|
|
16572
|
+
body: args.settings,
|
|
16573
|
+
}),
|
|
16574
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_USER_SETTINGS(),
|
|
16539
16575
|
}),
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
},
|
|
16547
|
-
providesTags: MEMORY_QUERY_KEYS.
|
|
16576
|
+
// Global Memories
|
|
16577
|
+
getGlobalMemories: builder.query({
|
|
16578
|
+
query: (args) => ({
|
|
16579
|
+
url: MEMSEARCH_ENDPOINTS.GET_GLOBAL_MEMORIES.path(args.org, args.userId),
|
|
16580
|
+
service: MEMSEARCH_ENDPOINTS.GET_GLOBAL_MEMORIES.service,
|
|
16581
|
+
params: args.params,
|
|
16582
|
+
}),
|
|
16583
|
+
providesTags: MEMORY_QUERY_KEYS.MEMSEARCH_GLOBAL_MEMORIES(),
|
|
16548
16584
|
}),
|
|
16549
|
-
|
|
16550
|
-
query: (args) => {
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
},
|
|
16558
|
-
invalidatesTags: MEMORY_QUERY_KEYS.GET_MENTOR_USER_SETTINGS(),
|
|
16585
|
+
createGlobalMemory: builder.mutation({
|
|
16586
|
+
query: (args) => ({
|
|
16587
|
+
url: MEMSEARCH_ENDPOINTS.CREATE_GLOBAL_MEMORY.path(args.org, args.userId),
|
|
16588
|
+
service: MEMSEARCH_ENDPOINTS.CREATE_GLOBAL_MEMORY.service,
|
|
16589
|
+
method: 'POST',
|
|
16590
|
+
body: { content: args.content },
|
|
16591
|
+
}),
|
|
16592
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_GLOBAL_MEMORIES(),
|
|
16559
16593
|
}),
|
|
16560
|
-
|
|
16561
|
-
query: (args) => {
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
|
|
16566
|
-
|
|
16567
|
-
},
|
|
16568
|
-
invalidatesTags: [
|
|
16569
|
-
...MEMORY_QUERY_KEYS.GET_MEMORIES(),
|
|
16570
|
-
...MEMORY_QUERY_KEYS.GET_FILTERED_MEMORIES(),
|
|
16571
|
-
],
|
|
16594
|
+
deleteGlobalMemory: builder.mutation({
|
|
16595
|
+
query: (args) => ({
|
|
16596
|
+
url: MEMSEARCH_ENDPOINTS.DELETE_GLOBAL_MEMORY.path(args.org, args.userId, args.memoryId),
|
|
16597
|
+
service: MEMSEARCH_ENDPOINTS.DELETE_GLOBAL_MEMORY.service,
|
|
16598
|
+
method: 'DELETE',
|
|
16599
|
+
}),
|
|
16600
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_GLOBAL_MEMORIES(),
|
|
16572
16601
|
}),
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
invalidatesTags: [
|
|
16582
|
-
...MEMORY_QUERY_KEYS.GET_MEMORIES(),
|
|
16583
|
-
...MEMORY_QUERY_KEYS.GET_FILTERED_MEMORIES(),
|
|
16584
|
-
],
|
|
16602
|
+
// Mentor-Specific Memories
|
|
16603
|
+
getMentorMemories: builder.query({
|
|
16604
|
+
query: (args) => ({
|
|
16605
|
+
url: MEMSEARCH_ENDPOINTS.GET_MENTOR_MEMORIES.path(args.org, args.userId, args.mentorId),
|
|
16606
|
+
service: MEMSEARCH_ENDPOINTS.GET_MENTOR_MEMORIES.service,
|
|
16607
|
+
params: args.params,
|
|
16608
|
+
}),
|
|
16609
|
+
providesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MENTOR_MEMORIES(),
|
|
16585
16610
|
}),
|
|
16586
|
-
|
|
16587
|
-
query: (args) => {
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
},
|
|
16595
|
-
invalidatesTags: [
|
|
16596
|
-
...MEMORY_QUERY_KEYS.GET_MEMORIES(),
|
|
16597
|
-
...MEMORY_QUERY_KEYS.GET_FILTERED_MEMORIES(),
|
|
16598
|
-
],
|
|
16611
|
+
createMentorMemory: builder.mutation({
|
|
16612
|
+
query: (args) => ({
|
|
16613
|
+
url: MEMSEARCH_ENDPOINTS.CREATE_MENTOR_MEMORY.path(args.org, args.userId, args.mentorId),
|
|
16614
|
+
service: MEMSEARCH_ENDPOINTS.CREATE_MENTOR_MEMORY.service,
|
|
16615
|
+
method: 'POST',
|
|
16616
|
+
body: args.data,
|
|
16617
|
+
}),
|
|
16618
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MENTOR_MEMORIES(),
|
|
16599
16619
|
}),
|
|
16600
|
-
|
|
16601
|
-
query: (args) => {
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
},
|
|
16609
|
-
invalidatesTags: [
|
|
16610
|
-
...MEMORY_QUERY_KEYS.GET_MEMORIES(),
|
|
16611
|
-
...MEMORY_QUERY_KEYS.GET_FILTERED_MEMORIES(),
|
|
16612
|
-
],
|
|
16620
|
+
updateMentorMemory: builder.mutation({
|
|
16621
|
+
query: (args) => ({
|
|
16622
|
+
url: MEMSEARCH_ENDPOINTS.UPDATE_MENTOR_MEMORY.path(args.org, args.userId, args.mentorId, args.memoryId),
|
|
16623
|
+
service: MEMSEARCH_ENDPOINTS.UPDATE_MENTOR_MEMORY.service,
|
|
16624
|
+
method: 'PATCH',
|
|
16625
|
+
body: args.data,
|
|
16626
|
+
}),
|
|
16627
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MENTOR_MEMORIES(),
|
|
16613
16628
|
}),
|
|
16614
|
-
|
|
16615
|
-
query: (args) => {
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16629
|
+
deleteMentorMemory: builder.mutation({
|
|
16630
|
+
query: (args) => ({
|
|
16631
|
+
url: MEMSEARCH_ENDPOINTS.DELETE_MENTOR_MEMORY.path(args.org, args.userId, args.mentorId, args.memoryId),
|
|
16632
|
+
service: MEMSEARCH_ENDPOINTS.DELETE_MENTOR_MEMORY.service,
|
|
16633
|
+
method: 'DELETE',
|
|
16634
|
+
}),
|
|
16635
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MENTOR_MEMORIES(),
|
|
16621
16636
|
}),
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16627
|
-
|
|
16628
|
-
|
|
16629
|
-
|
|
16630
|
-
|
|
16637
|
+
// Memory Categories (Admin)
|
|
16638
|
+
getMemoryCategoriesAdmin: builder.query({
|
|
16639
|
+
query: (args) => ({
|
|
16640
|
+
url: MEMSEARCH_ENDPOINTS.GET_MEMSEARCH_CATEGORIES.path(args.org, args.mentorId),
|
|
16641
|
+
service: MEMSEARCH_ENDPOINTS.GET_MEMSEARCH_CATEGORIES.service,
|
|
16642
|
+
}),
|
|
16643
|
+
providesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MEMORY_CATEGORIES(),
|
|
16644
|
+
}),
|
|
16645
|
+
createMemoryCategory: builder.mutation({
|
|
16646
|
+
query: (args) => ({
|
|
16647
|
+
url: MEMSEARCH_ENDPOINTS.CREATE_MEMSEARCH_CATEGORY.path(args.org, args.mentorId),
|
|
16648
|
+
service: MEMSEARCH_ENDPOINTS.CREATE_MEMSEARCH_CATEGORY.service,
|
|
16649
|
+
method: 'POST',
|
|
16650
|
+
body: args.data,
|
|
16651
|
+
}),
|
|
16652
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MEMORY_CATEGORIES(),
|
|
16653
|
+
}),
|
|
16654
|
+
updateMemoryCategory: builder.mutation({
|
|
16655
|
+
query: (args) => ({
|
|
16656
|
+
url: MEMSEARCH_ENDPOINTS.UPDATE_MEMSEARCH_CATEGORY.path(args.org, args.mentorId, args.categoryId),
|
|
16657
|
+
service: MEMSEARCH_ENDPOINTS.UPDATE_MEMSEARCH_CATEGORY.service,
|
|
16658
|
+
method: 'PATCH',
|
|
16659
|
+
body: args.data,
|
|
16660
|
+
}),
|
|
16661
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MEMORY_CATEGORIES(),
|
|
16662
|
+
}),
|
|
16663
|
+
deleteMemoryCategory: builder.mutation({
|
|
16664
|
+
query: (args) => ({
|
|
16665
|
+
url: MEMSEARCH_ENDPOINTS.DELETE_MEMSEARCH_CATEGORY.path(args.org, args.mentorId, args.categoryId),
|
|
16666
|
+
service: MEMSEARCH_ENDPOINTS.DELETE_MEMSEARCH_CATEGORY.service,
|
|
16667
|
+
method: 'DELETE',
|
|
16668
|
+
}),
|
|
16669
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_MEMORY_CATEGORIES(),
|
|
16670
|
+
}),
|
|
16671
|
+
// Platform Configuration
|
|
16672
|
+
getMemsearchConfig: builder.query({
|
|
16673
|
+
query: (args) => ({
|
|
16674
|
+
url: MEMSEARCH_ENDPOINTS.GET_MEMSEARCH_CONFIG.path(args.org, args.userId),
|
|
16675
|
+
service: MEMSEARCH_ENDPOINTS.GET_MEMSEARCH_CONFIG.service,
|
|
16676
|
+
}),
|
|
16677
|
+
providesTags: MEMORY_QUERY_KEYS.MEMSEARCH_PLATFORM_CONFIG(),
|
|
16678
|
+
}),
|
|
16679
|
+
updateMemsearchConfig: builder.mutation({
|
|
16680
|
+
query: (args) => ({
|
|
16681
|
+
url: MEMSEARCH_ENDPOINTS.UPDATE_MEMSEARCH_CONFIG.path(args.org, args.userId),
|
|
16682
|
+
service: MEMSEARCH_ENDPOINTS.UPDATE_MEMSEARCH_CONFIG.service,
|
|
16683
|
+
method: 'POST',
|
|
16684
|
+
body: args.config,
|
|
16685
|
+
}),
|
|
16686
|
+
invalidatesTags: MEMORY_QUERY_KEYS.MEMSEARCH_PLATFORM_CONFIG(),
|
|
16631
16687
|
}),
|
|
16632
16688
|
}),
|
|
16633
16689
|
});
|