@iblai/mcp 1.0.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/README.md +199 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/data-layer.d.ts +8 -0
- package/dist/resources/data-layer.d.ts.map +1 -0
- package/dist/resources/data-layer.js +181 -0
- package/dist/resources/data-layer.js.map +1 -0
- package/dist/resources/guides-layout.d.ts +8 -0
- package/dist/resources/guides-layout.d.ts.map +1 -0
- package/dist/resources/guides-layout.js +235 -0
- package/dist/resources/guides-layout.js.map +1 -0
- package/dist/resources/guides-rbac.d.ts +8 -0
- package/dist/resources/guides-rbac.d.ts.map +1 -0
- package/dist/resources/guides-rbac.js +231 -0
- package/dist/resources/guides-rbac.js.map +1 -0
- package/dist/resources/guides-theme.d.ts +8 -0
- package/dist/resources/guides-theme.d.ts.map +1 -0
- package/dist/resources/guides-theme.js +183 -0
- package/dist/resources/guides-theme.js.map +1 -0
- package/dist/resources/index.d.ts +17 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +18 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/packages-overview.d.ts +8 -0
- package/dist/resources/packages-overview.d.ts.map +1 -0
- package/dist/resources/packages-overview.js +53 -0
- package/dist/resources/packages-overview.js.map +1 -0
- package/dist/resources/web-containers.d.ts +8 -0
- package/dist/resources/web-containers.d.ts.map +1 -0
- package/dist/resources/web-containers.js +122 -0
- package/dist/resources/web-containers.js.map +1 -0
- package/dist/resources/web-utils.d.ts +8 -0
- package/dist/resources/web-utils.d.ts.map +1 -0
- package/dist/resources/web-utils.js +210 -0
- package/dist/resources/web-utils.js.map +1 -0
- package/dist/tools/api-query-info.d.ts +16 -0
- package/dist/tools/api-query-info.d.ts.map +1 -0
- package/dist/tools/api-query-info.js +2398 -0
- package/dist/tools/api-query-info.js.map +1 -0
- package/dist/tools/component-info.d.ts +16 -0
- package/dist/tools/component-info.d.ts.map +1 -0
- package/dist/tools/component-info.js +1323 -0
- package/dist/tools/component-info.js.map +1 -0
- package/dist/tools/hook-info.d.ts +16 -0
- package/dist/tools/hook-info.d.ts.map +1 -0
- package/dist/tools/hook-info.js +1988 -0
- package/dist/tools/hook-info.js.map +1 -0
- package/dist/tools/index.d.ts +68 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +14 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/page-template.d.ts +28 -0
- package/dist/tools/page-template.d.ts.map +1 -0
- package/dist/tools/page-template.js +198 -0
- package/dist/tools/page-template.js.map +1 -0
- package/dist/tools/provider-setup.d.ts +24 -0
- package/dist/tools/provider-setup.d.ts.map +1 -0
- package/dist/tools/provider-setup.js +213 -0
- package/dist/tools/provider-setup.js.map +1 -0
- package/package.json +28 -0
|
@@ -0,0 +1,1988 @@
|
|
|
1
|
+
export const hookInfoTool = {
|
|
2
|
+
name: 'get_hook_info',
|
|
3
|
+
description: 'Get detailed information about a specific React hook',
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
hookName: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
description: 'Name of the hook (e.g., useAdvancedChat, useMentorSettings, useGetMentorsQuery)',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
required: ['hookName'],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const hooks = {
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// CHAT HOOKS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
useAdvancedChat: `# useAdvancedChat Hook
|
|
20
|
+
|
|
21
|
+
Main hook for AI mentor chat with WebSocket streaming and multi-tab support.
|
|
22
|
+
|
|
23
|
+
\`\`\`typescript
|
|
24
|
+
import { useAdvancedChat } from '@iblai/web-utils';
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
// State
|
|
28
|
+
messages, // Array of chat messages
|
|
29
|
+
isStreaming, // Whether AI is currently responding
|
|
30
|
+
isPending, // Whether a message is being sent
|
|
31
|
+
status, // Connection status
|
|
32
|
+
currentStreamingMessage, // Current message being streamed
|
|
33
|
+
sessionId, // Current chat session ID
|
|
34
|
+
isStopped, // Whether generation was stopped
|
|
35
|
+
isError, // Whether an error occurred
|
|
36
|
+
isConnected, // WebSocket connection status
|
|
37
|
+
isLoadingChats, // Loading previous chats
|
|
38
|
+
isLoadingSessionIds, // Loading session IDs
|
|
39
|
+
|
|
40
|
+
// Mentor info
|
|
41
|
+
mentorName, // AI mentor name
|
|
42
|
+
profileImage, // AI mentor avatar URL
|
|
43
|
+
uniqueMentorId, // Unique mentor identifier
|
|
44
|
+
enabledGuidedPrompts, // Available guided prompts
|
|
45
|
+
enableSafetyDisclaimer, // Safety disclaimer enabled
|
|
46
|
+
|
|
47
|
+
// Tabs (advanced mode)
|
|
48
|
+
activeTab, // Current tab
|
|
49
|
+
changeTab, // Switch tabs
|
|
50
|
+
|
|
51
|
+
// Session management
|
|
52
|
+
sessionIds, // All session IDs
|
|
53
|
+
startNewChat, // Start new session
|
|
54
|
+
|
|
55
|
+
// WebSocket
|
|
56
|
+
ws, // WebSocket instance
|
|
57
|
+
messageQueue, // Queued messages
|
|
58
|
+
resetConnection, // Reset WebSocket connection
|
|
59
|
+
|
|
60
|
+
// Actions
|
|
61
|
+
sendMessage, // Send a message
|
|
62
|
+
stopGenerating, // Stop AI response
|
|
63
|
+
setMessage, // Update input message
|
|
64
|
+
} = useAdvancedChat({
|
|
65
|
+
mentorId: string,
|
|
66
|
+
tenantKey: string,
|
|
67
|
+
username: string,
|
|
68
|
+
token: string,
|
|
69
|
+
wsUrl: string,
|
|
70
|
+
mode: 'advanced' | 'default',
|
|
71
|
+
stopGenerationWsUrl?: string,
|
|
72
|
+
errorHandler?: (error: Error) => void,
|
|
73
|
+
redirectToAuthSpa?: () => void,
|
|
74
|
+
on402Error?: () => void,
|
|
75
|
+
cachedSessionId?: string,
|
|
76
|
+
isOffline?: boolean,
|
|
77
|
+
onOfflineWithoutLocalLLM?: () => void,
|
|
78
|
+
onStartNewChat?: () => void,
|
|
79
|
+
isPreviewMode?: boolean,
|
|
80
|
+
mentorShareableToken?: string,
|
|
81
|
+
sendMessageToParentWebsite?: (payload: unknown) => void,
|
|
82
|
+
});
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
**File Location**: \`packages/web-utils/src/hooks/chat/use-advanced-chat.ts\``,
|
|
86
|
+
useChat: `# useChat Hook
|
|
87
|
+
|
|
88
|
+
Lower-level WebSocket chat hook for real-time message streaming.
|
|
89
|
+
|
|
90
|
+
\`\`\`typescript
|
|
91
|
+
import { useChat } from '@iblai/web-utils';
|
|
92
|
+
|
|
93
|
+
const {
|
|
94
|
+
messages,
|
|
95
|
+
isStreaming,
|
|
96
|
+
status,
|
|
97
|
+
isPending,
|
|
98
|
+
currentStreamingMessage,
|
|
99
|
+
sendMessage,
|
|
100
|
+
stopGenerating,
|
|
101
|
+
ws,
|
|
102
|
+
isConnected,
|
|
103
|
+
messageQueue,
|
|
104
|
+
resetConnection,
|
|
105
|
+
} = useChat({
|
|
106
|
+
mentorId: string,
|
|
107
|
+
tenantKey: string,
|
|
108
|
+
username: string,
|
|
109
|
+
token: string,
|
|
110
|
+
wsUrl: string,
|
|
111
|
+
stopGenerationWsUrl?: string,
|
|
112
|
+
errorHandler?: (error: Error) => void,
|
|
113
|
+
redirectToAuthSpa?: () => void,
|
|
114
|
+
on402Error?: () => void,
|
|
115
|
+
cachedSessionId?: string,
|
|
116
|
+
isOffline?: boolean,
|
|
117
|
+
onOfflineWithoutLocalLLM?: () => void,
|
|
118
|
+
});
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
**Features:**
|
|
122
|
+
- Real-time message streaming via WebSocket
|
|
123
|
+
- Automatic reconnection with retry logic
|
|
124
|
+
- Offline mode support with local LLM
|
|
125
|
+
- Message queue for pending messages
|
|
126
|
+
- 402 payment required error handling
|
|
127
|
+
|
|
128
|
+
**File Location**: \`packages/web-utils/src/hooks/chat/use-chat-v2.ts\``,
|
|
129
|
+
// ============================================================================
|
|
130
|
+
// MENTOR HOOKS
|
|
131
|
+
// ============================================================================
|
|
132
|
+
useMentorSettings: `# useMentorSettings Hook
|
|
133
|
+
|
|
134
|
+
Fetches mentor-specific configuration and settings.
|
|
135
|
+
|
|
136
|
+
\`\`\`typescript
|
|
137
|
+
import { useMentorSettings } from '@iblai/web-utils';
|
|
138
|
+
|
|
139
|
+
const {
|
|
140
|
+
profileImage, // Mentor avatar URL
|
|
141
|
+
mentorName, // Mentor display name
|
|
142
|
+
greetingMethod, // Initial greeting type ('proactive' | 'passive')
|
|
143
|
+
proactiveResponse, // Proactive message content
|
|
144
|
+
llmProvider, // LLM provider name (e.g., 'openai', 'anthropic')
|
|
145
|
+
llmName, // LLM model name (e.g., 'gpt-4', 'claude-3')
|
|
146
|
+
mentorUniqueId, // Unique mentor ID
|
|
147
|
+
mentorVisibility, // Visibility settings ('public' | 'private' | 'unlisted')
|
|
148
|
+
enableGuidedPrompts, // Whether guided prompts are enabled
|
|
149
|
+
mentorSlug, // URL slug
|
|
150
|
+
safetyDisclaimer, // Safety disclaimer content
|
|
151
|
+
mentorTools, // Available tools configuration
|
|
152
|
+
allowAnonymous, // Whether anonymous access is allowed
|
|
153
|
+
} = useMentorSettings({
|
|
154
|
+
mentorId: string,
|
|
155
|
+
tenantKey: string,
|
|
156
|
+
username: string, // Uses different API for authenticated vs anonymous
|
|
157
|
+
});
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
**File Location**: \`packages/web-utils/src/hooks/use-mentor-settings.ts\``,
|
|
161
|
+
useMentorTools: `# useMentorTools Hook
|
|
162
|
+
|
|
163
|
+
Manages mentor tools configuration and state.
|
|
164
|
+
|
|
165
|
+
\`\`\`typescript
|
|
166
|
+
import { useMentorTools } from '@iblai/web-utils';
|
|
167
|
+
|
|
168
|
+
const {
|
|
169
|
+
tools, // Available tools for mentor
|
|
170
|
+
enabledTools, // Currently enabled tools
|
|
171
|
+
updateTools, // Update tool configuration
|
|
172
|
+
} = useMentorTools({
|
|
173
|
+
mentorId: string,
|
|
174
|
+
tenantKey: string,
|
|
175
|
+
});
|
|
176
|
+
\`\`\`
|
|
177
|
+
|
|
178
|
+
**Available Tools:**
|
|
179
|
+
- WEB_SEARCH, WIKIPEDIA_SEARCH, COURSE_CREATION
|
|
180
|
+
- MCP, IMAGE_GENERATION, TRAINED_DOCUMENTS
|
|
181
|
+
- PLAYWRIGHT_BROWSER, HUMAN_SUPPORT, CODE_INTERPRETER
|
|
182
|
+
- DEEP_RESEARCH, MEMORY, SCREEN_SHARE
|
|
183
|
+
- POWERPOINT, PROMPT, QUIZ, RUBRIC
|
|
184
|
+
- RESOURCE, LESSON_PLAN, SYLLABUS
|
|
185
|
+
- CANVAS, GOOGLE_SLIDES, GOOGLE_DOCUMENT
|
|
186
|
+
|
|
187
|
+
**File Location**: \`packages/web-utils/src/hooks/use-mentor-tools.ts\``,
|
|
188
|
+
// ============================================================================
|
|
189
|
+
// PROFILE HOOKS
|
|
190
|
+
// ============================================================================
|
|
191
|
+
useUserProfileUpdate: `# useUserProfileUpdate Hook
|
|
192
|
+
|
|
193
|
+
Updates user profile data with safe field filtering.
|
|
194
|
+
|
|
195
|
+
\`\`\`typescript
|
|
196
|
+
import { useUserProfileUpdate } from '@iblai/web-utils';
|
|
197
|
+
|
|
198
|
+
const { updateProfile } = useUserProfileUpdate(username);
|
|
199
|
+
|
|
200
|
+
// Update profile
|
|
201
|
+
await updateProfile({
|
|
202
|
+
name?: string,
|
|
203
|
+
title?: string,
|
|
204
|
+
about?: string,
|
|
205
|
+
social_links?: Record<string, string>,
|
|
206
|
+
public_metadata?: {
|
|
207
|
+
bio?: string,
|
|
208
|
+
name?: string,
|
|
209
|
+
about?: string,
|
|
210
|
+
language?: string,
|
|
211
|
+
social_links?: Record<string, string>,
|
|
212
|
+
},
|
|
213
|
+
enable_sidebar_ai_mentor_display?: boolean,
|
|
214
|
+
enable_skills_leaderboard_display?: boolean,
|
|
215
|
+
});
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
**Behavior:**
|
|
219
|
+
- Filters out read-only fields (email, phone, date_joined, etc.)
|
|
220
|
+
- Sends only safe subset of data to backend
|
|
221
|
+
- Automatically refetches user metadata after update
|
|
222
|
+
|
|
223
|
+
**File Location**: \`packages/web-utils/src/hooks/profile/use-user-profile-update.ts\``,
|
|
224
|
+
useProfileImageUpload: `# useProfileImageUpload Hook
|
|
225
|
+
|
|
226
|
+
Handles profile image upload to S3 with presigned URLs.
|
|
227
|
+
|
|
228
|
+
\`\`\`typescript
|
|
229
|
+
import { useProfileImageUpload } from '@iblai/web-utils';
|
|
230
|
+
|
|
231
|
+
const {
|
|
232
|
+
uploadImage, // Upload image function
|
|
233
|
+
isUploading, // Upload in progress
|
|
234
|
+
progress, // Upload progress (0-100)
|
|
235
|
+
error, // Upload error
|
|
236
|
+
} = useProfileImageUpload({
|
|
237
|
+
username: string,
|
|
238
|
+
onSuccess?: (imageUrl: string) => void,
|
|
239
|
+
onError?: (error: Error) => void,
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Upload image
|
|
243
|
+
await uploadImage(file: File);
|
|
244
|
+
\`\`\`
|
|
245
|
+
|
|
246
|
+
**File Location**: \`packages/web-utils/src/hooks/profile/use-profile-image-upload.ts\``,
|
|
247
|
+
// ============================================================================
|
|
248
|
+
// SUBSCRIPTION HOOKS
|
|
249
|
+
// ============================================================================
|
|
250
|
+
useSubscriptionHandler: `# useSubscriptionHandler Hook
|
|
251
|
+
|
|
252
|
+
Manages subscription flow, free trials, and payment handling.
|
|
253
|
+
|
|
254
|
+
\`\`\`typescript
|
|
255
|
+
import { useSubscriptionHandler } from '@iblai/web-utils';
|
|
256
|
+
|
|
257
|
+
const {
|
|
258
|
+
handleSubscriptionCheck, // Check subscription status
|
|
259
|
+
handleIntervalSubscriptionCheck, // Set up periodic checks
|
|
260
|
+
trialCounterStarted, // Whether trial counter is active
|
|
261
|
+
bannerButtonTriggerCallback, // Handle subscription UI actions
|
|
262
|
+
} = useSubscriptionHandler({
|
|
263
|
+
subscriptionFlow: 'default' | 'trial' | 'paid',
|
|
264
|
+
});
|
|
265
|
+
\`\`\`
|
|
266
|
+
|
|
267
|
+
**Key Methods:**
|
|
268
|
+
- \`handleFreeTrialFlow()\` - Checks free usage count
|
|
269
|
+
- \`handleActiveAppSubscriptionFlow()\` - Manages active subscriptions
|
|
270
|
+
- \`handleFreeTrialSubscriptionExpiryFlow()\` - Handles trial expiration
|
|
271
|
+
- \`getUserActiveApp()\` - Fetches user's active application
|
|
272
|
+
- \`handleSubscribeUserTrigger()\` - Initiates subscription renewal
|
|
273
|
+
|
|
274
|
+
**File Location**: \`packages/web-utils/src/hooks/subscription/use-subscription-handler.ts\``,
|
|
275
|
+
// ============================================================================
|
|
276
|
+
// TENANT HOOKS
|
|
277
|
+
// ============================================================================
|
|
278
|
+
useTenantMetadata: `# useTenantMetadata Hook
|
|
279
|
+
|
|
280
|
+
Fetches tenant configuration and metadata with feature flags.
|
|
281
|
+
|
|
282
|
+
\`\`\`typescript
|
|
283
|
+
import { useTenantMetadata } from '@iblai/web-utils';
|
|
284
|
+
|
|
285
|
+
const {
|
|
286
|
+
metadata, // Full tenant metadata object
|
|
287
|
+
metadataLoaded, // Whether metadata has loaded
|
|
288
|
+
isMentorAIEnabled, // Check if mentor AI is enabled
|
|
289
|
+
isSkillsLeaderBoardEnabled, // Check leaderboard setting
|
|
290
|
+
// ... other feature flags
|
|
291
|
+
} = useTenantMetadata(tenantKey);
|
|
292
|
+
\`\`\`
|
|
293
|
+
|
|
294
|
+
**Metadata includes:**
|
|
295
|
+
- Tenant branding (logo, colors, name)
|
|
296
|
+
- Feature flags and settings
|
|
297
|
+
- Custom domain configuration
|
|
298
|
+
- RBAC settings
|
|
299
|
+
- Analytics configuration
|
|
300
|
+
|
|
301
|
+
**File Location**: \`packages/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.ts\``,
|
|
302
|
+
// ============================================================================
|
|
303
|
+
// TRACKING HOOKS
|
|
304
|
+
// ============================================================================
|
|
305
|
+
useTimeTracker: `# useTimeTracker Hook
|
|
306
|
+
|
|
307
|
+
Tracks time spent on pages/routes for analytics.
|
|
308
|
+
|
|
309
|
+
\`\`\`typescript
|
|
310
|
+
import { useTimeTracker } from '@iblai/web-utils';
|
|
311
|
+
|
|
312
|
+
const {
|
|
313
|
+
pause, // Pause tracking
|
|
314
|
+
resume, // Resume tracking
|
|
315
|
+
getCurrentUrl, // Get current URL
|
|
316
|
+
getTimeSpentSinceLastReset, // Get elapsed time in seconds
|
|
317
|
+
} = useTimeTracker({
|
|
318
|
+
intervalSeconds: 30, // Update frequency
|
|
319
|
+
onTimeUpdate: (url: string, timeSpent: number) => {
|
|
320
|
+
// Send analytics
|
|
321
|
+
},
|
|
322
|
+
enabled: true, // Toggle tracking
|
|
323
|
+
getCurrentUrl: () => window.location.pathname,
|
|
324
|
+
onRouteChange: (callback) => {
|
|
325
|
+
// Set up route change listener
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
\`\`\`
|
|
329
|
+
|
|
330
|
+
**File Location**: \`packages/web-utils/src/features/tracking/use-time-tracker.ts\``,
|
|
331
|
+
// ============================================================================
|
|
332
|
+
// DATE/TIME HOOKS
|
|
333
|
+
// ============================================================================
|
|
334
|
+
useDayJs: `# useDayJs Hook
|
|
335
|
+
|
|
336
|
+
Date/time utilities using day.js library.
|
|
337
|
+
|
|
338
|
+
\`\`\`typescript
|
|
339
|
+
import { useDayJs } from '@iblai/web-utils';
|
|
340
|
+
|
|
341
|
+
const {
|
|
342
|
+
getTimeDifferenceBetweenTwoDates,
|
|
343
|
+
getDayJSDurationObjFromSeconds,
|
|
344
|
+
generateFutureDateForNMinutes,
|
|
345
|
+
} = useDayJs();
|
|
346
|
+
|
|
347
|
+
// Calculate time difference
|
|
348
|
+
const diff = getTimeDifferenceBetweenTwoDates(
|
|
349
|
+
futureDate,
|
|
350
|
+
pastDate,
|
|
351
|
+
'days' | 'hours' | 'minutes' | 'seconds'
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
// Create duration object from seconds
|
|
355
|
+
const duration = getDayJSDurationObjFromSeconds(3600);
|
|
356
|
+
console.log(duration.hours()); // 1
|
|
357
|
+
|
|
358
|
+
// Generate future date with random microseconds
|
|
359
|
+
const futureDate = generateFutureDateForNMinutes(30);
|
|
360
|
+
\`\`\`
|
|
361
|
+
|
|
362
|
+
**File Location**: \`packages/web-utils/src/hooks/use-day-js.ts\``,
|
|
363
|
+
// ============================================================================
|
|
364
|
+
// RTK QUERY HOOKS - MENTOR
|
|
365
|
+
// ============================================================================
|
|
366
|
+
useGetMentorsQuery: `# useGetMentorsQuery Hook (RTK Query)
|
|
367
|
+
|
|
368
|
+
Fetches list of mentors for a tenant with pagination.
|
|
369
|
+
|
|
370
|
+
\`\`\`typescript
|
|
371
|
+
import { useGetMentorsQuery } from '@iblai/data-layer';
|
|
372
|
+
|
|
373
|
+
const { data, isLoading, error, refetch, isFetching } = useGetMentorsQuery({
|
|
374
|
+
org: string, // Tenant key (required)
|
|
375
|
+
page?: number, // Page number (default: 1)
|
|
376
|
+
pageSize?: number, // Items per page (default: 10)
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// Response type
|
|
380
|
+
interface MentorsResponse {
|
|
381
|
+
count: number;
|
|
382
|
+
results: Mentor[];
|
|
383
|
+
next: string | null;
|
|
384
|
+
previous: string | null;
|
|
385
|
+
}
|
|
386
|
+
\`\`\`
|
|
387
|
+
|
|
388
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
389
|
+
useGetMentorDetailsQuery: `# useGetMentorDetailsQuery Hook (RTK Query)
|
|
390
|
+
|
|
391
|
+
Fetches detailed information about a single mentor.
|
|
392
|
+
|
|
393
|
+
\`\`\`typescript
|
|
394
|
+
import { useGetMentorDetailsQuery } from '@iblai/data-layer';
|
|
395
|
+
|
|
396
|
+
const { data: mentor, isLoading, error } = useGetMentorDetailsQuery({
|
|
397
|
+
org: string, // Tenant key
|
|
398
|
+
mentorId: string, // Mentor unique ID
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// Returns full mentor object with settings, tools, and configuration
|
|
402
|
+
\`\`\`
|
|
403
|
+
|
|
404
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
405
|
+
useGetMentorSettingsQuery: `# useGetMentorSettingsQuery Hook (RTK Query)
|
|
406
|
+
|
|
407
|
+
Fetches mentor settings for authenticated users.
|
|
408
|
+
|
|
409
|
+
\`\`\`typescript
|
|
410
|
+
import { useGetMentorSettingsQuery } from '@iblai/data-layer';
|
|
411
|
+
|
|
412
|
+
const { data: settings, isLoading } = useGetMentorSettingsQuery({
|
|
413
|
+
org: string, // Tenant key
|
|
414
|
+
mentorId: string, // Mentor unique ID
|
|
415
|
+
username: string, // Current user
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
// settings contains mentor configuration, tools, prompts, etc.
|
|
419
|
+
\`\`\`
|
|
420
|
+
|
|
421
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
422
|
+
useGetMentorPublicSettingsQuery: `# useGetMentorPublicSettingsQuery Hook (RTK Query)
|
|
423
|
+
|
|
424
|
+
Fetches mentor settings for anonymous/unauthenticated users.
|
|
425
|
+
|
|
426
|
+
\`\`\`typescript
|
|
427
|
+
import { useGetMentorPublicSettingsQuery } from '@iblai/data-layer';
|
|
428
|
+
|
|
429
|
+
const { data: settings, isLoading } = useGetMentorPublicSettingsQuery({
|
|
430
|
+
org: string, // Tenant key
|
|
431
|
+
mentorId: string, // Mentor unique ID
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
// Returns public-safe mentor settings
|
|
435
|
+
\`\`\`
|
|
436
|
+
|
|
437
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
438
|
+
useCreateMentorMutation: `# useCreateMentorMutation Hook (RTK Query)
|
|
439
|
+
|
|
440
|
+
Creates a new AI mentor.
|
|
441
|
+
|
|
442
|
+
\`\`\`typescript
|
|
443
|
+
import { useCreateMentorMutation } from '@iblai/data-layer';
|
|
444
|
+
|
|
445
|
+
const [createMentor, { isLoading, error }] = useCreateMentorMutation();
|
|
446
|
+
|
|
447
|
+
await createMentor({
|
|
448
|
+
org: string,
|
|
449
|
+
name: string,
|
|
450
|
+
description?: string,
|
|
451
|
+
llm_provider?: string,
|
|
452
|
+
llm_name?: string,
|
|
453
|
+
system_prompt?: string,
|
|
454
|
+
visibility?: 'public' | 'private' | 'unlisted',
|
|
455
|
+
}).unwrap();
|
|
456
|
+
\`\`\`
|
|
457
|
+
|
|
458
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
459
|
+
useEditMentorMutation: `# useEditMentorMutation Hook (RTK Query)
|
|
460
|
+
|
|
461
|
+
Updates an existing AI mentor.
|
|
462
|
+
|
|
463
|
+
\`\`\`typescript
|
|
464
|
+
import { useEditMentorMutation } from '@iblai/data-layer';
|
|
465
|
+
|
|
466
|
+
const [editMentor, { isLoading }] = useEditMentorMutation();
|
|
467
|
+
|
|
468
|
+
await editMentor({
|
|
469
|
+
org: string,
|
|
470
|
+
mentorId: string,
|
|
471
|
+
name?: string,
|
|
472
|
+
description?: string,
|
|
473
|
+
llm_provider?: string,
|
|
474
|
+
llm_name?: string,
|
|
475
|
+
// ... other mentor fields
|
|
476
|
+
}).unwrap();
|
|
477
|
+
\`\`\`
|
|
478
|
+
|
|
479
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
480
|
+
useDeleteMentorMutation: `# useDeleteMentorMutation Hook (RTK Query)
|
|
481
|
+
|
|
482
|
+
Deletes an AI mentor.
|
|
483
|
+
|
|
484
|
+
\`\`\`typescript
|
|
485
|
+
import { useDeleteMentorMutation } from '@iblai/data-layer';
|
|
486
|
+
|
|
487
|
+
const [deleteMentor, { isLoading }] = useDeleteMentorMutation();
|
|
488
|
+
|
|
489
|
+
await deleteMentor({
|
|
490
|
+
org: string,
|
|
491
|
+
mentorId: string,
|
|
492
|
+
}).unwrap();
|
|
493
|
+
\`\`\`
|
|
494
|
+
|
|
495
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
496
|
+
useForkMentorMutation: `# useForkMentorMutation Hook (RTK Query)
|
|
497
|
+
|
|
498
|
+
Creates a copy/fork of an existing mentor.
|
|
499
|
+
|
|
500
|
+
\`\`\`typescript
|
|
501
|
+
import { useForkMentorMutation } from '@iblai/data-layer';
|
|
502
|
+
|
|
503
|
+
const [forkMentor, { isLoading }] = useForkMentorMutation();
|
|
504
|
+
|
|
505
|
+
const newMentor = await forkMentor({
|
|
506
|
+
org: string,
|
|
507
|
+
mentorId: string,
|
|
508
|
+
name?: string, // Optional new name
|
|
509
|
+
}).unwrap();
|
|
510
|
+
\`\`\`
|
|
511
|
+
|
|
512
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
513
|
+
useStarMentorMutation: `# useStarMentorMutation Hook (RTK Query)
|
|
514
|
+
|
|
515
|
+
Stars/favorites a mentor.
|
|
516
|
+
|
|
517
|
+
\`\`\`typescript
|
|
518
|
+
import { useStarMentorMutation } from '@iblai/data-layer';
|
|
519
|
+
|
|
520
|
+
const [starMentor, { isLoading }] = useStarMentorMutation();
|
|
521
|
+
|
|
522
|
+
await starMentor({
|
|
523
|
+
org: string,
|
|
524
|
+
mentorId: string,
|
|
525
|
+
}).unwrap();
|
|
526
|
+
\`\`\`
|
|
527
|
+
|
|
528
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
529
|
+
useUnstarMentorMutation: `# useUnstarMentorMutation Hook (RTK Query)
|
|
530
|
+
|
|
531
|
+
Removes star/favorite from a mentor.
|
|
532
|
+
|
|
533
|
+
\`\`\`typescript
|
|
534
|
+
import { useUnstarMentorMutation } from '@iblai/data-layer';
|
|
535
|
+
|
|
536
|
+
const [unstarMentor, { isLoading }] = useUnstarMentorMutation();
|
|
537
|
+
|
|
538
|
+
await unstarMentor({
|
|
539
|
+
org: string,
|
|
540
|
+
mentorId: string,
|
|
541
|
+
}).unwrap();
|
|
542
|
+
\`\`\`
|
|
543
|
+
|
|
544
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
545
|
+
useStarredMentorsQuery: `# useStarredMentorsQuery Hook (RTK Query)
|
|
546
|
+
|
|
547
|
+
Fetches user's starred/favorited mentors.
|
|
548
|
+
|
|
549
|
+
\`\`\`typescript
|
|
550
|
+
import { useStarredMentorsQuery } from '@iblai/data-layer';
|
|
551
|
+
|
|
552
|
+
const { data: starredMentors, isLoading } = useStarredMentorsQuery({
|
|
553
|
+
org: string,
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
// Returns array of starred mentor IDs
|
|
557
|
+
\`\`\`
|
|
558
|
+
|
|
559
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
560
|
+
useGetRecentlyAccessedMentorsQuery: `# useGetRecentlyAccessedMentorsQuery Hook (RTK Query)
|
|
561
|
+
|
|
562
|
+
Fetches mentors the user has recently interacted with.
|
|
563
|
+
|
|
564
|
+
\`\`\`typescript
|
|
565
|
+
import { useGetRecentlyAccessedMentorsQuery } from '@iblai/data-layer';
|
|
566
|
+
|
|
567
|
+
const { data: recentMentors, isLoading } = useGetRecentlyAccessedMentorsQuery({
|
|
568
|
+
org: string,
|
|
569
|
+
limit?: number, // Number of mentors to return
|
|
570
|
+
});
|
|
571
|
+
\`\`\`
|
|
572
|
+
|
|
573
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
574
|
+
useGetFreeUsageCountQuery: `# useGetFreeUsageCountQuery Hook (RTK Query)
|
|
575
|
+
|
|
576
|
+
Fetches remaining free usage count for trial users.
|
|
577
|
+
|
|
578
|
+
\`\`\`typescript
|
|
579
|
+
import { useGetFreeUsageCountQuery } from '@iblai/data-layer';
|
|
580
|
+
|
|
581
|
+
const { data, isLoading } = useGetFreeUsageCountQuery({
|
|
582
|
+
org: string,
|
|
583
|
+
mentorId: string,
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
// data.remaining_count - messages remaining
|
|
587
|
+
// data.total_count - total free messages
|
|
588
|
+
\`\`\`
|
|
589
|
+
|
|
590
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
591
|
+
useSeedMentorsMutation: `# useSeedMentorsMutation Hook (RTK Query)
|
|
592
|
+
|
|
593
|
+
Seeds default mentors for a tenant (admin only).
|
|
594
|
+
|
|
595
|
+
\`\`\`typescript
|
|
596
|
+
import { useSeedMentorsMutation } from '@iblai/data-layer';
|
|
597
|
+
|
|
598
|
+
const [seedMentors, { isLoading }] = useSeedMentorsMutation();
|
|
599
|
+
|
|
600
|
+
await seedMentors({
|
|
601
|
+
org: string,
|
|
602
|
+
}).unwrap();
|
|
603
|
+
\`\`\`
|
|
604
|
+
|
|
605
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
606
|
+
// ============================================================================
|
|
607
|
+
// RTK QUERY HOOKS - USER
|
|
608
|
+
// ============================================================================
|
|
609
|
+
useGetUserMetadataQuery: `# useGetUserMetadataQuery Hook (RTK Query)
|
|
610
|
+
|
|
611
|
+
Fetches user profile and metadata.
|
|
612
|
+
|
|
613
|
+
\`\`\`typescript
|
|
614
|
+
import { useGetUserMetadataQuery } from '@iblai/data-layer';
|
|
615
|
+
|
|
616
|
+
const { data: user, isLoading, error } = useGetUserMetadataQuery({
|
|
617
|
+
params: { username: string },
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
// user contains:
|
|
621
|
+
interface UserProfile {
|
|
622
|
+
name: string;
|
|
623
|
+
email: string;
|
|
624
|
+
about: string;
|
|
625
|
+
title: string;
|
|
626
|
+
social_links: Record<string, string>;
|
|
627
|
+
profile_image: string;
|
|
628
|
+
public_metadata: {
|
|
629
|
+
bio: string;
|
|
630
|
+
language: string;
|
|
631
|
+
};
|
|
632
|
+
enable_sidebar_ai_mentor_display: boolean;
|
|
633
|
+
enable_skills_leaderboard_display: boolean;
|
|
634
|
+
}
|
|
635
|
+
\`\`\`
|
|
636
|
+
|
|
637
|
+
**File Location**: \`packages/data-layer/src/features/user/api-slice.ts\``,
|
|
638
|
+
useUpdateUserMetadataMutation: `# useUpdateUserMetadataMutation Hook (RTK Query)
|
|
639
|
+
|
|
640
|
+
Updates user profile metadata.
|
|
641
|
+
|
|
642
|
+
\`\`\`typescript
|
|
643
|
+
import { useUpdateUserMetadataMutation } from '@iblai/data-layer';
|
|
644
|
+
|
|
645
|
+
const [updateUser, { isLoading }] = useUpdateUserMetadataMutation();
|
|
646
|
+
|
|
647
|
+
await updateUser({
|
|
648
|
+
username: string,
|
|
649
|
+
name?: string,
|
|
650
|
+
about?: string,
|
|
651
|
+
title?: string,
|
|
652
|
+
social_links?: Record<string, string>,
|
|
653
|
+
public_metadata?: object,
|
|
654
|
+
}).unwrap();
|
|
655
|
+
\`\`\`
|
|
656
|
+
|
|
657
|
+
**File Location**: \`packages/data-layer/src/features/user/api-slice.ts\``,
|
|
658
|
+
useUpdateUserAccountMutation: `# useUpdateUserAccountMutation Hook (RTK Query)
|
|
659
|
+
|
|
660
|
+
Updates user account settings.
|
|
661
|
+
|
|
662
|
+
\`\`\`typescript
|
|
663
|
+
import { useUpdateUserAccountMutation } from '@iblai/data-layer';
|
|
664
|
+
|
|
665
|
+
const [updateAccount, { isLoading }] = useUpdateUserAccountMutation();
|
|
666
|
+
|
|
667
|
+
await updateAccount({
|
|
668
|
+
username: string,
|
|
669
|
+
// Account-level settings
|
|
670
|
+
}).unwrap();
|
|
671
|
+
\`\`\`
|
|
672
|
+
|
|
673
|
+
**File Location**: \`packages/data-layer/src/features/user/api-slice.ts\``,
|
|
674
|
+
useResetPasswordMutation: `# useResetPasswordMutation Hook (RTK Query)
|
|
675
|
+
|
|
676
|
+
Initiates password reset flow.
|
|
677
|
+
|
|
678
|
+
\`\`\`typescript
|
|
679
|
+
import { useResetPasswordMutation } from '@iblai/data-layer';
|
|
680
|
+
|
|
681
|
+
const [resetPassword, { isLoading }] = useResetPasswordMutation();
|
|
682
|
+
|
|
683
|
+
await resetPassword({
|
|
684
|
+
email: string,
|
|
685
|
+
}).unwrap();
|
|
686
|
+
\`\`\`
|
|
687
|
+
|
|
688
|
+
**File Location**: \`packages/data-layer/src/features/user/api-slice.ts\``,
|
|
689
|
+
useUploadProfileImageMutation: `# useUploadProfileImageMutation Hook (RTK Query)
|
|
690
|
+
|
|
691
|
+
Uploads user profile image.
|
|
692
|
+
|
|
693
|
+
\`\`\`typescript
|
|
694
|
+
import { useUploadProfileImageMutation } from '@iblai/data-layer';
|
|
695
|
+
|
|
696
|
+
const [uploadImage, { isLoading }] = useUploadProfileImageMutation();
|
|
697
|
+
|
|
698
|
+
await uploadImage({
|
|
699
|
+
username: string,
|
|
700
|
+
file: File,
|
|
701
|
+
}).unwrap();
|
|
702
|
+
\`\`\`
|
|
703
|
+
|
|
704
|
+
**File Location**: \`packages/data-layer/src/features/user/api-slice.ts\``,
|
|
705
|
+
useRemoveProfileImageMutation: `# useRemoveProfileImageMutation Hook (RTK Query)
|
|
706
|
+
|
|
707
|
+
Removes user profile image.
|
|
708
|
+
|
|
709
|
+
\`\`\`typescript
|
|
710
|
+
import { useRemoveProfileImageMutation } from '@iblai/data-layer';
|
|
711
|
+
|
|
712
|
+
const [removeImage, { isLoading }] = useRemoveProfileImageMutation();
|
|
713
|
+
|
|
714
|
+
await removeImage({
|
|
715
|
+
username: string,
|
|
716
|
+
}).unwrap();
|
|
717
|
+
\`\`\`
|
|
718
|
+
|
|
719
|
+
**File Location**: \`packages/data-layer/src/features/user/api-slice.ts\``,
|
|
720
|
+
// ============================================================================
|
|
721
|
+
// RTK QUERY HOOKS - PLATFORM
|
|
722
|
+
// ============================================================================
|
|
723
|
+
useGetPlatformUsersQuery: `# useGetPlatformUsersQuery Hook (RTK Query)
|
|
724
|
+
|
|
725
|
+
Fetches platform users with pagination and filtering.
|
|
726
|
+
|
|
727
|
+
\`\`\`typescript
|
|
728
|
+
import { useGetPlatformUsersQuery } from '@iblai/data-layer';
|
|
729
|
+
|
|
730
|
+
const { data, isLoading, error } = useGetPlatformUsersQuery({
|
|
731
|
+
platformKey: string, // Tenant key
|
|
732
|
+
page?: number, // Page number
|
|
733
|
+
pageSize?: number, // Items per page
|
|
734
|
+
search?: string, // Search query
|
|
735
|
+
includeUserPolicies?: boolean, // Include user policies
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// Response type
|
|
739
|
+
interface PlatformUsersListResponse {
|
|
740
|
+
count: number;
|
|
741
|
+
results: PlatformUser[];
|
|
742
|
+
allowed_policies?: string[]; // If includeUserPolicies=true
|
|
743
|
+
}
|
|
744
|
+
\`\`\`
|
|
745
|
+
|
|
746
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
747
|
+
usePlatformUserGroupsQuery: `# usePlatformUserGroupsQuery Hook (RTK Query)
|
|
748
|
+
|
|
749
|
+
Fetches platform user groups (teams).
|
|
750
|
+
|
|
751
|
+
\`\`\`typescript
|
|
752
|
+
import { usePlatformUserGroupsQuery } from '@iblai/data-layer';
|
|
753
|
+
|
|
754
|
+
const { data: groups, isLoading } = usePlatformUserGroupsQuery({
|
|
755
|
+
platformKey: string,
|
|
756
|
+
includeUsers?: boolean, // Include users in each group
|
|
757
|
+
withPermissions?: boolean, // Include permission info
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
// Returns array of user groups/teams
|
|
761
|
+
\`\`\`
|
|
762
|
+
|
|
763
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
764
|
+
useGetPlatformUserGroupDetailsQuery: `# useGetPlatformUserGroupDetailsQuery Hook (RTK Query)
|
|
765
|
+
|
|
766
|
+
Fetches detailed information about a single user group.
|
|
767
|
+
|
|
768
|
+
\`\`\`typescript
|
|
769
|
+
import { useGetPlatformUserGroupDetailsQuery } from '@iblai/data-layer';
|
|
770
|
+
|
|
771
|
+
const { data: group, isLoading } = useGetPlatformUserGroupDetailsQuery({
|
|
772
|
+
id: number,
|
|
773
|
+
platformKey: string,
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
// Response type
|
|
777
|
+
interface PlatformUserGroupDetailsResponse {
|
|
778
|
+
id: number;
|
|
779
|
+
name: string;
|
|
780
|
+
description: string;
|
|
781
|
+
is_internal?: boolean;
|
|
782
|
+
users: PlatformUserGroupUser[];
|
|
783
|
+
}
|
|
784
|
+
\`\`\`
|
|
785
|
+
|
|
786
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
787
|
+
useCreatePlatformUserGroupMutation: `# useCreatePlatformUserGroupMutation Hook (RTK Query)
|
|
788
|
+
|
|
789
|
+
Creates a new platform user group.
|
|
790
|
+
|
|
791
|
+
\`\`\`typescript
|
|
792
|
+
import { useCreatePlatformUserGroupMutation } from '@iblai/data-layer';
|
|
793
|
+
|
|
794
|
+
const [createGroup, { isLoading }] = useCreatePlatformUserGroupMutation();
|
|
795
|
+
|
|
796
|
+
await createGroup({
|
|
797
|
+
platformKey: string,
|
|
798
|
+
name: string,
|
|
799
|
+
description?: string,
|
|
800
|
+
}).unwrap();
|
|
801
|
+
\`\`\`
|
|
802
|
+
|
|
803
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
804
|
+
useUpdatePlatformUserGroupMutation: `# useUpdatePlatformUserGroupMutation Hook (RTK Query)
|
|
805
|
+
|
|
806
|
+
Updates an existing platform user group.
|
|
807
|
+
|
|
808
|
+
\`\`\`typescript
|
|
809
|
+
import { useUpdatePlatformUserGroupMutation } from '@iblai/data-layer';
|
|
810
|
+
|
|
811
|
+
const [updateGroup, { isLoading }] = useUpdatePlatformUserGroupMutation();
|
|
812
|
+
|
|
813
|
+
await updateGroup({
|
|
814
|
+
id: number,
|
|
815
|
+
platformKey: string,
|
|
816
|
+
name?: string,
|
|
817
|
+
description?: string,
|
|
818
|
+
}).unwrap();
|
|
819
|
+
\`\`\`
|
|
820
|
+
|
|
821
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
822
|
+
useDeletePlatformUserGroupMutation: `# useDeletePlatformUserGroupMutation Hook (RTK Query)
|
|
823
|
+
|
|
824
|
+
Deletes a platform user group.
|
|
825
|
+
|
|
826
|
+
\`\`\`typescript
|
|
827
|
+
import { useDeletePlatformUserGroupMutation } from '@iblai/data-layer';
|
|
828
|
+
|
|
829
|
+
const [deleteGroup, { isLoading }] = useDeletePlatformUserGroupMutation();
|
|
830
|
+
|
|
831
|
+
await deleteGroup({
|
|
832
|
+
id: number,
|
|
833
|
+
platformKey: string,
|
|
834
|
+
}).unwrap();
|
|
835
|
+
\`\`\`
|
|
836
|
+
|
|
837
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
838
|
+
useInviteUserMutation: `# useInviteUserMutation Hook (RTK Query)
|
|
839
|
+
|
|
840
|
+
Invites a user to the platform.
|
|
841
|
+
|
|
842
|
+
\`\`\`typescript
|
|
843
|
+
import { useInviteUserMutation } from '@iblai/data-layer';
|
|
844
|
+
|
|
845
|
+
const [inviteUser, { isLoading }] = useInviteUserMutation();
|
|
846
|
+
|
|
847
|
+
await inviteUser({
|
|
848
|
+
email: string,
|
|
849
|
+
platform_key: string,
|
|
850
|
+
redirect_to: string,
|
|
851
|
+
source: string,
|
|
852
|
+
}).unwrap();
|
|
853
|
+
\`\`\`
|
|
854
|
+
|
|
855
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
856
|
+
useUpdatePlatformUserRoleWithPoliciesMutation: `# useUpdatePlatformUserRoleWithPoliciesMutation Hook (RTK Query)
|
|
857
|
+
|
|
858
|
+
Updates user role and policies on a platform.
|
|
859
|
+
|
|
860
|
+
\`\`\`typescript
|
|
861
|
+
import { useUpdatePlatformUserRoleWithPoliciesMutation } from '@iblai/data-layer';
|
|
862
|
+
|
|
863
|
+
const [updateRole, { isLoading }] = useUpdatePlatformUserRoleWithPoliciesMutation();
|
|
864
|
+
|
|
865
|
+
await updateRole({
|
|
866
|
+
platformKey: string,
|
|
867
|
+
userId: string,
|
|
868
|
+
role: string,
|
|
869
|
+
policies: string[],
|
|
870
|
+
}).unwrap();
|
|
871
|
+
\`\`\`
|
|
872
|
+
|
|
873
|
+
**File Location**: \`packages/data-layer/src/features/platform/api-slice.ts\``,
|
|
874
|
+
// ============================================================================
|
|
875
|
+
// RTK QUERY HOOKS - TENANT
|
|
876
|
+
// ============================================================================
|
|
877
|
+
useGetTenantMetadataQuery: `# useGetTenantMetadataQuery Hook (RTK Query)
|
|
878
|
+
|
|
879
|
+
Fetches tenant configuration and metadata.
|
|
880
|
+
|
|
881
|
+
\`\`\`typescript
|
|
882
|
+
import { useGetTenantMetadataQuery } from '@iblai/data-layer';
|
|
883
|
+
|
|
884
|
+
const { data: metadata, isLoading } = useGetTenantMetadataQuery({
|
|
885
|
+
org: string, // Tenant key
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
// metadata contains:
|
|
889
|
+
// - Tenant branding (logo, colors, name)
|
|
890
|
+
// - Feature flags and settings
|
|
891
|
+
// - Custom domain configuration
|
|
892
|
+
// - RBAC settings
|
|
893
|
+
// - Analytics configuration
|
|
894
|
+
\`\`\`
|
|
895
|
+
|
|
896
|
+
**File Location**: \`packages/data-layer/src/features/tenant/api-slice.ts\``,
|
|
897
|
+
useUpdateTenantMetadataMutation: `# useUpdateTenantMetadataMutation Hook (RTK Query)
|
|
898
|
+
|
|
899
|
+
Updates tenant metadata and settings.
|
|
900
|
+
|
|
901
|
+
\`\`\`typescript
|
|
902
|
+
import { useUpdateTenantMetadataMutation } from '@iblai/data-layer';
|
|
903
|
+
|
|
904
|
+
const [updateMetadata, { isLoading }] = useUpdateTenantMetadataMutation();
|
|
905
|
+
|
|
906
|
+
await updateMetadata({
|
|
907
|
+
org: string,
|
|
908
|
+
// Metadata fields to update
|
|
909
|
+
}).unwrap();
|
|
910
|
+
\`\`\`
|
|
911
|
+
|
|
912
|
+
**File Location**: \`packages/data-layer/src/features/tenant/api-slice.ts\``,
|
|
913
|
+
useGetUserTenantsQuery: `# useGetUserTenantsQuery Hook (RTK Query)
|
|
914
|
+
|
|
915
|
+
Fetches tenants the current user has access to.
|
|
916
|
+
|
|
917
|
+
\`\`\`typescript
|
|
918
|
+
import { useGetUserTenantsQuery } from '@iblai/data-layer';
|
|
919
|
+
|
|
920
|
+
const { data: tenants, isLoading } = useGetUserTenantsQuery();
|
|
921
|
+
|
|
922
|
+
// Returns array of tenants user can access
|
|
923
|
+
\`\`\`
|
|
924
|
+
|
|
925
|
+
**File Location**: \`packages/data-layer/src/features/tenant/api-slice.ts\``,
|
|
926
|
+
// ============================================================================
|
|
927
|
+
// RTK QUERY HOOKS - RBAC
|
|
928
|
+
// ============================================================================
|
|
929
|
+
useGetRbacGroupsQuery: `# useGetRbacGroupsQuery Hook (RTK Query)
|
|
930
|
+
|
|
931
|
+
Fetches RBAC groups for a platform.
|
|
932
|
+
|
|
933
|
+
\`\`\`typescript
|
|
934
|
+
import { useGetRbacGroupsQuery } from '@iblai/data-layer';
|
|
935
|
+
|
|
936
|
+
const { data: groups, isLoading } = useGetRbacGroupsQuery({
|
|
937
|
+
platformKey: string,
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
// Returns array of RBAC groups with permissions
|
|
941
|
+
\`\`\`
|
|
942
|
+
|
|
943
|
+
**File Location**: \`packages/data-layer/src/features/core/api-slice.ts\``,
|
|
944
|
+
useGetRbacPermissionsQuery: `# useGetRbacPermissionsQuery Hook (RTK Query)
|
|
945
|
+
|
|
946
|
+
Fetches RBAC permissions for current user.
|
|
947
|
+
|
|
948
|
+
\`\`\`typescript
|
|
949
|
+
import { useGetRbacPermissionsQuery } from '@iblai/data-layer';
|
|
950
|
+
|
|
951
|
+
const { data: permissions, isLoading } = useGetRbacPermissionsQuery({
|
|
952
|
+
platformKey: string,
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
// Returns user's RBAC permissions
|
|
956
|
+
\`\`\`
|
|
957
|
+
|
|
958
|
+
**File Location**: \`packages/data-layer/src/features/core/api-slice.ts\``,
|
|
959
|
+
// ============================================================================
|
|
960
|
+
// RTK QUERY HOOKS - MEMORY
|
|
961
|
+
// ============================================================================
|
|
962
|
+
useGetMemoriesQuery: `# useGetMemoriesQuery Hook (RTK Query)
|
|
963
|
+
|
|
964
|
+
Fetches mentor memories/context for RAG.
|
|
965
|
+
|
|
966
|
+
\`\`\`typescript
|
|
967
|
+
import { useGetMemoriesQuery } from '@iblai/data-layer';
|
|
968
|
+
|
|
969
|
+
const { data: memories, isLoading } = useGetMemoriesQuery({
|
|
970
|
+
org: string,
|
|
971
|
+
mentorId: string,
|
|
972
|
+
page?: number,
|
|
973
|
+
pageSize?: number,
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// Returns paginated list of memories
|
|
977
|
+
\`\`\`
|
|
978
|
+
|
|
979
|
+
**File Location**: \`packages/data-layer/src/features/memory/api-slice.ts\``,
|
|
980
|
+
useGetMemoryCategoriesQuery: `# useGetMemoryCategoriesQuery Hook (RTK Query)
|
|
981
|
+
|
|
982
|
+
Fetches available memory categories.
|
|
983
|
+
|
|
984
|
+
\`\`\`typescript
|
|
985
|
+
import { useGetMemoryCategoriesQuery } from '@iblai/data-layer';
|
|
986
|
+
|
|
987
|
+
const { data: categories, isLoading } = useGetMemoryCategoriesQuery({
|
|
988
|
+
org: string,
|
|
989
|
+
mentorId: string,
|
|
990
|
+
});
|
|
991
|
+
|
|
992
|
+
// Returns array of memory categories
|
|
993
|
+
\`\`\`
|
|
994
|
+
|
|
995
|
+
**File Location**: \`packages/data-layer/src/features/memory/api-slice.ts\``,
|
|
996
|
+
useCreateMemoryMutation: `# useCreateMemoryMutation Hook (RTK Query)
|
|
997
|
+
|
|
998
|
+
Creates a new memory entry.
|
|
999
|
+
|
|
1000
|
+
\`\`\`typescript
|
|
1001
|
+
import { useCreateMemoryMutation } from '@iblai/data-layer';
|
|
1002
|
+
|
|
1003
|
+
const [createMemory, { isLoading }] = useCreateMemoryMutation();
|
|
1004
|
+
|
|
1005
|
+
await createMemory({
|
|
1006
|
+
org: string,
|
|
1007
|
+
mentorId: string,
|
|
1008
|
+
content: string,
|
|
1009
|
+
category?: string,
|
|
1010
|
+
}).unwrap();
|
|
1011
|
+
\`\`\`
|
|
1012
|
+
|
|
1013
|
+
**File Location**: \`packages/data-layer/src/features/memory/api-slice.ts\``,
|
|
1014
|
+
useUpdateMemoryEntryMutation: `# useUpdateMemoryEntryMutation Hook (RTK Query)
|
|
1015
|
+
|
|
1016
|
+
Updates an existing memory entry.
|
|
1017
|
+
|
|
1018
|
+
\`\`\`typescript
|
|
1019
|
+
import { useUpdateMemoryEntryMutation } from '@iblai/data-layer';
|
|
1020
|
+
|
|
1021
|
+
const [updateMemory, { isLoading }] = useUpdateMemoryEntryMutation();
|
|
1022
|
+
|
|
1023
|
+
await updateMemory({
|
|
1024
|
+
org: string,
|
|
1025
|
+
mentorId: string,
|
|
1026
|
+
memoryId: string,
|
|
1027
|
+
content?: string,
|
|
1028
|
+
category?: string,
|
|
1029
|
+
}).unwrap();
|
|
1030
|
+
\`\`\`
|
|
1031
|
+
|
|
1032
|
+
**File Location**: \`packages/data-layer/src/features/memory/api-slice.ts\``,
|
|
1033
|
+
useDeleteMemoryMutation: `# useDeleteMemoryMutation Hook (RTK Query)
|
|
1034
|
+
|
|
1035
|
+
Deletes a memory entry.
|
|
1036
|
+
|
|
1037
|
+
\`\`\`typescript
|
|
1038
|
+
import { useDeleteMemoryMutation } from '@iblai/data-layer';
|
|
1039
|
+
|
|
1040
|
+
const [deleteMemory, { isLoading }] = useDeleteMemoryMutation();
|
|
1041
|
+
|
|
1042
|
+
await deleteMemory({
|
|
1043
|
+
org: string,
|
|
1044
|
+
mentorId: string,
|
|
1045
|
+
memoryId: string,
|
|
1046
|
+
}).unwrap();
|
|
1047
|
+
\`\`\`
|
|
1048
|
+
|
|
1049
|
+
**File Location**: \`packages/data-layer/src/features/memory/api-slice.ts\``,
|
|
1050
|
+
useGetMentorUserSettingsQuery: `# useGetMentorUserSettingsQuery Hook (RTK Query)
|
|
1051
|
+
|
|
1052
|
+
Fetches user-specific settings for a mentor.
|
|
1053
|
+
|
|
1054
|
+
\`\`\`typescript
|
|
1055
|
+
import { useGetMentorUserSettingsQuery } from '@iblai/data-layer';
|
|
1056
|
+
|
|
1057
|
+
const { data: settings, isLoading } = useGetMentorUserSettingsQuery({
|
|
1058
|
+
org: string,
|
|
1059
|
+
mentorId: string,
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1062
|
+
// Returns user preferences for this mentor
|
|
1063
|
+
\`\`\`
|
|
1064
|
+
|
|
1065
|
+
**File Location**: \`packages/data-layer/src/features/memory/api-slice.ts\``,
|
|
1066
|
+
useUpdateMentorUserSettingsMutation: `# useUpdateMentorUserSettingsMutation Hook (RTK Query)
|
|
1067
|
+
|
|
1068
|
+
Updates user-specific settings for a mentor.
|
|
1069
|
+
|
|
1070
|
+
\`\`\`typescript
|
|
1071
|
+
import { useUpdateMentorUserSettingsMutation } from '@iblai/data-layer';
|
|
1072
|
+
|
|
1073
|
+
const [updateSettings, { isLoading }] = useUpdateMentorUserSettingsMutation();
|
|
1074
|
+
|
|
1075
|
+
await updateSettings({
|
|
1076
|
+
org: string,
|
|
1077
|
+
mentorId: string,
|
|
1078
|
+
// User preference fields
|
|
1079
|
+
}).unwrap();
|
|
1080
|
+
\`\`\`
|
|
1081
|
+
|
|
1082
|
+
**File Location**: \`packages/data-layer/src/features/memory/api-slice.ts\``,
|
|
1083
|
+
// ============================================================================
|
|
1084
|
+
// RTK QUERY HOOKS - MCP
|
|
1085
|
+
// ============================================================================
|
|
1086
|
+
useGetMCPServersQuery: `# useGetMCPServersQuery Hook (RTK Query)
|
|
1087
|
+
|
|
1088
|
+
Fetches MCP server configurations.
|
|
1089
|
+
|
|
1090
|
+
\`\`\`typescript
|
|
1091
|
+
import { useGetMCPServersQuery } from '@iblai/data-layer';
|
|
1092
|
+
|
|
1093
|
+
const { data: servers, isLoading } = useGetMCPServersQuery({
|
|
1094
|
+
org: string,
|
|
1095
|
+
mentorId?: string,
|
|
1096
|
+
});
|
|
1097
|
+
|
|
1098
|
+
// Returns array of MCP server configurations
|
|
1099
|
+
\`\`\`
|
|
1100
|
+
|
|
1101
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1102
|
+
useCreateMCPServerMutation: `# useCreateMCPServerMutation Hook (RTK Query)
|
|
1103
|
+
|
|
1104
|
+
Creates a new MCP server configuration.
|
|
1105
|
+
|
|
1106
|
+
\`\`\`typescript
|
|
1107
|
+
import { useCreateMCPServerMutation } from '@iblai/data-layer';
|
|
1108
|
+
|
|
1109
|
+
const [createServer, { isLoading }] = useCreateMCPServerMutation();
|
|
1110
|
+
|
|
1111
|
+
await createServer({
|
|
1112
|
+
org: string,
|
|
1113
|
+
mentorId?: string,
|
|
1114
|
+
name: string,
|
|
1115
|
+
url: string,
|
|
1116
|
+
// Server configuration
|
|
1117
|
+
}).unwrap();
|
|
1118
|
+
\`\`\`
|
|
1119
|
+
|
|
1120
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1121
|
+
useUpdateMCPServerMutation: `# useUpdateMCPServerMutation Hook (RTK Query)
|
|
1122
|
+
|
|
1123
|
+
Updates an existing MCP server configuration.
|
|
1124
|
+
|
|
1125
|
+
\`\`\`typescript
|
|
1126
|
+
import { useUpdateMCPServerMutation } from '@iblai/data-layer';
|
|
1127
|
+
|
|
1128
|
+
const [updateServer, { isLoading }] = useUpdateMCPServerMutation();
|
|
1129
|
+
|
|
1130
|
+
await updateServer({
|
|
1131
|
+
org: string,
|
|
1132
|
+
serverId: string,
|
|
1133
|
+
name?: string,
|
|
1134
|
+
url?: string,
|
|
1135
|
+
}).unwrap();
|
|
1136
|
+
\`\`\`
|
|
1137
|
+
|
|
1138
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1139
|
+
useDeleteMCPServerMutation: `# useDeleteMCPServerMutation Hook (RTK Query)
|
|
1140
|
+
|
|
1141
|
+
Deletes an MCP server configuration.
|
|
1142
|
+
|
|
1143
|
+
\`\`\`typescript
|
|
1144
|
+
import { useDeleteMCPServerMutation } from '@iblai/data-layer';
|
|
1145
|
+
|
|
1146
|
+
const [deleteServer, { isLoading }] = useDeleteMCPServerMutation();
|
|
1147
|
+
|
|
1148
|
+
await deleteServer({
|
|
1149
|
+
org: string,
|
|
1150
|
+
serverId: string,
|
|
1151
|
+
}).unwrap();
|
|
1152
|
+
\`\`\`
|
|
1153
|
+
|
|
1154
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1155
|
+
useGetOAuthServicesQuery: `# useGetOAuthServicesQuery Hook (RTK Query)
|
|
1156
|
+
|
|
1157
|
+
Fetches available OAuth services for MCP.
|
|
1158
|
+
|
|
1159
|
+
\`\`\`typescript
|
|
1160
|
+
import { useGetOAuthServicesQuery } from '@iblai/data-layer';
|
|
1161
|
+
|
|
1162
|
+
const { data: services, isLoading } = useGetOAuthServicesQuery({
|
|
1163
|
+
org: string,
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
// Returns array of OAuth service providers
|
|
1167
|
+
\`\`\`
|
|
1168
|
+
|
|
1169
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1170
|
+
useGetConnectedServicesQuery: `# useGetConnectedServicesQuery Hook (RTK Query)
|
|
1171
|
+
|
|
1172
|
+
Fetches user's connected OAuth services.
|
|
1173
|
+
|
|
1174
|
+
\`\`\`typescript
|
|
1175
|
+
import { useGetConnectedServicesQuery } from '@iblai/data-layer';
|
|
1176
|
+
|
|
1177
|
+
const { data: connected, isLoading } = useGetConnectedServicesQuery({
|
|
1178
|
+
org: string,
|
|
1179
|
+
});
|
|
1180
|
+
|
|
1181
|
+
// Returns array of connected services
|
|
1182
|
+
\`\`\`
|
|
1183
|
+
|
|
1184
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1185
|
+
useStartOAuthFlowMutation: `# useStartOAuthFlowMutation Hook (RTK Query)
|
|
1186
|
+
|
|
1187
|
+
Initiates OAuth flow for a service.
|
|
1188
|
+
|
|
1189
|
+
\`\`\`typescript
|
|
1190
|
+
import { useStartOAuthFlowMutation } from '@iblai/data-layer';
|
|
1191
|
+
|
|
1192
|
+
const [startOAuth, { isLoading }] = useStartOAuthFlowMutation();
|
|
1193
|
+
|
|
1194
|
+
const { authUrl } = await startOAuth({
|
|
1195
|
+
org: string,
|
|
1196
|
+
serviceId: string,
|
|
1197
|
+
redirectUri: string,
|
|
1198
|
+
}).unwrap();
|
|
1199
|
+
|
|
1200
|
+
// Redirect user to authUrl
|
|
1201
|
+
\`\`\`
|
|
1202
|
+
|
|
1203
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1204
|
+
useDisconnectServiceMutation: `# useDisconnectServiceMutation Hook (RTK Query)
|
|
1205
|
+
|
|
1206
|
+
Disconnects an OAuth service.
|
|
1207
|
+
|
|
1208
|
+
\`\`\`typescript
|
|
1209
|
+
import { useDisconnectServiceMutation } from '@iblai/data-layer';
|
|
1210
|
+
|
|
1211
|
+
const [disconnect, { isLoading }] = useDisconnectServiceMutation();
|
|
1212
|
+
|
|
1213
|
+
await disconnect({
|
|
1214
|
+
org: string,
|
|
1215
|
+
serviceId: string,
|
|
1216
|
+
}).unwrap();
|
|
1217
|
+
\`\`\`
|
|
1218
|
+
|
|
1219
|
+
**File Location**: \`packages/data-layer/src/features/mcp/api-slice.ts\``,
|
|
1220
|
+
// ============================================================================
|
|
1221
|
+
// RTK QUERY HOOKS - NOTIFICATIONS
|
|
1222
|
+
// ============================================================================
|
|
1223
|
+
useGetNotificationsQuery: `# useGetNotificationsQuery Hook (RTK Query)
|
|
1224
|
+
|
|
1225
|
+
Fetches user notifications.
|
|
1226
|
+
|
|
1227
|
+
\`\`\`typescript
|
|
1228
|
+
import { useGetNotificationsQuery } from '@iblai/data-layer';
|
|
1229
|
+
|
|
1230
|
+
const { data: notifications, isLoading } = useGetNotificationsQuery({
|
|
1231
|
+
page?: number,
|
|
1232
|
+
pageSize?: number,
|
|
1233
|
+
});
|
|
1234
|
+
|
|
1235
|
+
// Returns paginated notifications
|
|
1236
|
+
\`\`\`
|
|
1237
|
+
|
|
1238
|
+
**File Location**: \`packages/data-layer/src/features/notifications/api-slice.ts\``,
|
|
1239
|
+
useGetNotificationsCountQuery: `# useGetNotificationsCountQuery Hook (RTK Query)
|
|
1240
|
+
|
|
1241
|
+
Fetches unread notification count.
|
|
1242
|
+
|
|
1243
|
+
\`\`\`typescript
|
|
1244
|
+
import { useGetNotificationsCountQuery } from '@iblai/data-layer';
|
|
1245
|
+
|
|
1246
|
+
const { data, isLoading } = useGetNotificationsCountQuery();
|
|
1247
|
+
|
|
1248
|
+
// data.count - unread notification count
|
|
1249
|
+
\`\`\`
|
|
1250
|
+
|
|
1251
|
+
**File Location**: \`packages/data-layer/src/features/notifications/api-slice.ts\``,
|
|
1252
|
+
useMarkAllAsReadMutation: `# useMarkAllAsReadMutation Hook (RTK Query)
|
|
1253
|
+
|
|
1254
|
+
Marks all notifications as read.
|
|
1255
|
+
|
|
1256
|
+
\`\`\`typescript
|
|
1257
|
+
import { useMarkAllAsReadMutation } from '@iblai/data-layer';
|
|
1258
|
+
|
|
1259
|
+
const [markAllRead, { isLoading }] = useMarkAllAsReadMutation();
|
|
1260
|
+
|
|
1261
|
+
await markAllRead().unwrap();
|
|
1262
|
+
\`\`\`
|
|
1263
|
+
|
|
1264
|
+
**File Location**: \`packages/data-layer/src/features/notifications/api-slice.ts\``,
|
|
1265
|
+
useSendNotificationMutation: `# useSendNotificationMutation Hook (RTK Query)
|
|
1266
|
+
|
|
1267
|
+
Sends a notification to users.
|
|
1268
|
+
|
|
1269
|
+
\`\`\`typescript
|
|
1270
|
+
import { useSendNotificationMutation } from '@iblai/data-layer';
|
|
1271
|
+
|
|
1272
|
+
const [sendNotification, { isLoading }] = useSendNotificationMutation();
|
|
1273
|
+
|
|
1274
|
+
await sendNotification({
|
|
1275
|
+
title: string,
|
|
1276
|
+
message: string,
|
|
1277
|
+
recipients: string[], // User IDs
|
|
1278
|
+
type?: string,
|
|
1279
|
+
}).unwrap();
|
|
1280
|
+
\`\`\`
|
|
1281
|
+
|
|
1282
|
+
**File Location**: \`packages/data-layer/src/features/notifications/api-slice.ts\``,
|
|
1283
|
+
// ============================================================================
|
|
1284
|
+
// RTK QUERY HOOKS - CHAT
|
|
1285
|
+
// ============================================================================
|
|
1286
|
+
usePinnedMessagesQuery: `# usePinnedMessagesQuery Hook (RTK Query)
|
|
1287
|
+
|
|
1288
|
+
Fetches pinned messages in a chat session.
|
|
1289
|
+
|
|
1290
|
+
\`\`\`typescript
|
|
1291
|
+
import { usePinnedMessagesQuery } from '@iblai/data-layer';
|
|
1292
|
+
|
|
1293
|
+
const { data: pinnedMessages, isLoading } = usePinnedMessagesQuery({
|
|
1294
|
+
org: string,
|
|
1295
|
+
mentorId: string,
|
|
1296
|
+
sessionId: string,
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
// Returns array of pinned messages
|
|
1300
|
+
\`\`\`
|
|
1301
|
+
|
|
1302
|
+
**File Location**: \`packages/data-layer/src/features/chat/api-slice.ts\``,
|
|
1303
|
+
useUpdateMessageFeedbackMutation: `# useUpdateMessageFeedbackMutation Hook (RTK Query)
|
|
1304
|
+
|
|
1305
|
+
Updates feedback (thumbs up/down) on a message.
|
|
1306
|
+
|
|
1307
|
+
\`\`\`typescript
|
|
1308
|
+
import { useUpdateMessageFeedbackMutation } from '@iblai/data-layer';
|
|
1309
|
+
|
|
1310
|
+
const [updateFeedback, { isLoading }] = useUpdateMessageFeedbackMutation();
|
|
1311
|
+
|
|
1312
|
+
await updateFeedback({
|
|
1313
|
+
org: string,
|
|
1314
|
+
mentorId: string,
|
|
1315
|
+
messageId: string,
|
|
1316
|
+
feedback: 'positive' | 'negative' | null,
|
|
1317
|
+
}).unwrap();
|
|
1318
|
+
\`\`\`
|
|
1319
|
+
|
|
1320
|
+
**File Location**: \`packages/data-layer/src/features/chat/api-slice.ts\``,
|
|
1321
|
+
useAudioToTextMutation: `# useAudioToTextMutation Hook (RTK Query)
|
|
1322
|
+
|
|
1323
|
+
Converts audio to text (speech-to-text).
|
|
1324
|
+
|
|
1325
|
+
\`\`\`typescript
|
|
1326
|
+
import { useAudioToTextMutation } from '@iblai/data-layer';
|
|
1327
|
+
|
|
1328
|
+
const [convertAudio, { isLoading }] = useAudioToTextMutation();
|
|
1329
|
+
|
|
1330
|
+
const { text } = await convertAudio({
|
|
1331
|
+
audio: Blob, // Audio blob
|
|
1332
|
+
format?: string, // Audio format
|
|
1333
|
+
}).unwrap();
|
|
1334
|
+
\`\`\`
|
|
1335
|
+
|
|
1336
|
+
**File Location**: \`packages/data-layer/src/features/chat/api-slice.ts\``,
|
|
1337
|
+
// ============================================================================
|
|
1338
|
+
// RTK QUERY HOOKS - CHAT HISTORY
|
|
1339
|
+
// ============================================================================
|
|
1340
|
+
useGetChatHistoryQuery: `# useGetChatHistoryQuery Hook (RTK Query)
|
|
1341
|
+
|
|
1342
|
+
Fetches chat history for a session.
|
|
1343
|
+
|
|
1344
|
+
\`\`\`typescript
|
|
1345
|
+
import { useGetChatHistoryQuery } from '@iblai/data-layer';
|
|
1346
|
+
|
|
1347
|
+
const { data: history, isLoading } = useGetChatHistoryQuery({
|
|
1348
|
+
org: string,
|
|
1349
|
+
mentorId: string,
|
|
1350
|
+
sessionId: string,
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
// Returns array of chat messages
|
|
1354
|
+
\`\`\`
|
|
1355
|
+
|
|
1356
|
+
**File Location**: \`packages/data-layer/src/features/chat-history/api-slice.ts\``,
|
|
1357
|
+
useGetSessionsQuery: `# useGetSessionsQuery Hook (RTK Query)
|
|
1358
|
+
|
|
1359
|
+
Fetches all chat sessions for a mentor.
|
|
1360
|
+
|
|
1361
|
+
\`\`\`typescript
|
|
1362
|
+
import { useGetSessionsQuery } from '@iblai/data-layer';
|
|
1363
|
+
|
|
1364
|
+
const { data: sessions, isLoading } = useGetSessionsQuery({
|
|
1365
|
+
org: string,
|
|
1366
|
+
mentorId: string,
|
|
1367
|
+
});
|
|
1368
|
+
|
|
1369
|
+
// Returns array of session IDs with metadata
|
|
1370
|
+
\`\`\`
|
|
1371
|
+
|
|
1372
|
+
**File Location**: \`packages/data-layer/src/features/chat-history/api-slice.ts\``,
|
|
1373
|
+
// ============================================================================
|
|
1374
|
+
// RTK QUERY HOOKS - SKILLS
|
|
1375
|
+
// ============================================================================
|
|
1376
|
+
useGetReportedSkillsQuery: `# useGetReportedSkillsQuery Hook (RTK Query)
|
|
1377
|
+
|
|
1378
|
+
Fetches user's self-reported skills.
|
|
1379
|
+
|
|
1380
|
+
\`\`\`typescript
|
|
1381
|
+
import { useGetReportedSkillsQuery } from '@iblai/data-layer';
|
|
1382
|
+
|
|
1383
|
+
const { data: skills, isLoading } = useGetReportedSkillsQuery({
|
|
1384
|
+
org: string,
|
|
1385
|
+
username: string,
|
|
1386
|
+
});
|
|
1387
|
+
|
|
1388
|
+
// Returns array of reported skills with proficiency levels
|
|
1389
|
+
\`\`\`
|
|
1390
|
+
|
|
1391
|
+
**File Location**: \`packages/data-layer/src/features/skills/api-slice.ts\``,
|
|
1392
|
+
useGetDesiredSkillsQuery: `# useGetDesiredSkillsQuery Hook (RTK Query)
|
|
1393
|
+
|
|
1394
|
+
Fetches user's desired skills to learn.
|
|
1395
|
+
|
|
1396
|
+
\`\`\`typescript
|
|
1397
|
+
import { useGetDesiredSkillsQuery } from '@iblai/data-layer';
|
|
1398
|
+
|
|
1399
|
+
const { data: skills, isLoading } = useGetDesiredSkillsQuery({
|
|
1400
|
+
org: string,
|
|
1401
|
+
username: string,
|
|
1402
|
+
});
|
|
1403
|
+
|
|
1404
|
+
// Returns array of desired skills
|
|
1405
|
+
\`\`\`
|
|
1406
|
+
|
|
1407
|
+
**File Location**: \`packages/data-layer/src/features/skills/api-slice.ts\``,
|
|
1408
|
+
useGetSkillsPointsPercentileQuery: `# useGetSkillsPointsPercentileQuery Hook (RTK Query)
|
|
1409
|
+
|
|
1410
|
+
Fetches user's skills points percentile for leaderboard.
|
|
1411
|
+
|
|
1412
|
+
\`\`\`typescript
|
|
1413
|
+
import { useGetSkillsPointsPercentileQuery } from '@iblai/data-layer';
|
|
1414
|
+
|
|
1415
|
+
const { data, isLoading } = useGetSkillsPointsPercentileQuery({
|
|
1416
|
+
org: string,
|
|
1417
|
+
username: string,
|
|
1418
|
+
});
|
|
1419
|
+
|
|
1420
|
+
// data.percentile - user's ranking percentile
|
|
1421
|
+
// data.points - total skills points
|
|
1422
|
+
\`\`\`
|
|
1423
|
+
|
|
1424
|
+
**File Location**: \`packages/data-layer/src/features/skills/api-slice.ts\``,
|
|
1425
|
+
useGetUserEarnedSkillsQuery: `# useGetUserEarnedSkillsQuery Hook (RTK Query)
|
|
1426
|
+
|
|
1427
|
+
Fetches skills user has earned through learning.
|
|
1428
|
+
|
|
1429
|
+
\`\`\`typescript
|
|
1430
|
+
import { useGetUserEarnedSkillsQuery } from '@iblai/data-layer';
|
|
1431
|
+
|
|
1432
|
+
const { data: skills, isLoading } = useGetUserEarnedSkillsQuery({
|
|
1433
|
+
org: string,
|
|
1434
|
+
username: string,
|
|
1435
|
+
});
|
|
1436
|
+
|
|
1437
|
+
// Returns array of earned skills with timestamps
|
|
1438
|
+
\`\`\`
|
|
1439
|
+
|
|
1440
|
+
**File Location**: \`packages/data-layer/src/features/skills/api-slice.ts\``,
|
|
1441
|
+
// ============================================================================
|
|
1442
|
+
// RTK QUERY HOOKS - CATALOG
|
|
1443
|
+
// ============================================================================
|
|
1444
|
+
useGetUserEnrolledPathwaysQuery: `# useGetUserEnrolledPathwaysQuery Hook (RTK Query)
|
|
1445
|
+
|
|
1446
|
+
Fetches pathways user is enrolled in.
|
|
1447
|
+
|
|
1448
|
+
\`\`\`typescript
|
|
1449
|
+
import { useGetUserEnrolledPathwaysQuery } from '@iblai/data-layer';
|
|
1450
|
+
|
|
1451
|
+
const { data: pathways, isLoading } = useGetUserEnrolledPathwaysQuery({
|
|
1452
|
+
org: string,
|
|
1453
|
+
username: string,
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
// Returns array of enrolled pathways with progress
|
|
1457
|
+
\`\`\`
|
|
1458
|
+
|
|
1459
|
+
**File Location**: \`packages/data-layer/src/features/catalog/api-slice.ts\``,
|
|
1460
|
+
useGetUserEnrolledProgramsQuery: `# useGetUserEnrolledProgramsQuery Hook (RTK Query)
|
|
1461
|
+
|
|
1462
|
+
Fetches programs user is enrolled in.
|
|
1463
|
+
|
|
1464
|
+
\`\`\`typescript
|
|
1465
|
+
import { useGetUserEnrolledProgramsQuery } from '@iblai/data-layer';
|
|
1466
|
+
|
|
1467
|
+
const { data: programs, isLoading } = useGetUserEnrolledProgramsQuery({
|
|
1468
|
+
org: string,
|
|
1469
|
+
username: string,
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
// Returns array of enrolled programs with progress
|
|
1473
|
+
\`\`\`
|
|
1474
|
+
|
|
1475
|
+
**File Location**: \`packages/data-layer/src/features/catalog/api-slice.ts\``,
|
|
1476
|
+
useGetCatalogRolesQuery: `# useGetCatalogRolesQuery Hook (RTK Query)
|
|
1477
|
+
|
|
1478
|
+
Fetches available catalog roles.
|
|
1479
|
+
|
|
1480
|
+
\`\`\`typescript
|
|
1481
|
+
import { useGetCatalogRolesQuery } from '@iblai/data-layer';
|
|
1482
|
+
|
|
1483
|
+
const { data: roles, isLoading } = useGetCatalogRolesQuery({
|
|
1484
|
+
org: string,
|
|
1485
|
+
});
|
|
1486
|
+
|
|
1487
|
+
// Returns array of role definitions
|
|
1488
|
+
\`\`\`
|
|
1489
|
+
|
|
1490
|
+
**File Location**: \`packages/data-layer/src/features/catalog/api-slice.ts\``,
|
|
1491
|
+
// ============================================================================
|
|
1492
|
+
// RTK QUERY HOOKS - SEARCH
|
|
1493
|
+
// ============================================================================
|
|
1494
|
+
useGetPersonnalizedSearchQuery: `# useGetPersonnalizedSearchQuery Hook (RTK Query)
|
|
1495
|
+
|
|
1496
|
+
Performs personalized search across mentors and catalog.
|
|
1497
|
+
|
|
1498
|
+
\`\`\`typescript
|
|
1499
|
+
import { useGetPersonnalizedSearchQuery } from '@iblai/data-layer';
|
|
1500
|
+
|
|
1501
|
+
const { data: results, isLoading } = useGetPersonnalizedSearchQuery({
|
|
1502
|
+
org: string,
|
|
1503
|
+
query: string,
|
|
1504
|
+
type?: 'mentor' | 'course' | 'all',
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
// Returns personalized search results
|
|
1508
|
+
\`\`\`
|
|
1509
|
+
|
|
1510
|
+
**File Location**: \`packages/data-layer/src/features/search/api-slice.ts\``,
|
|
1511
|
+
useGetAiSearchMentorsQuery: `# useGetAiSearchMentorsQuery Hook (RTK Query)
|
|
1512
|
+
|
|
1513
|
+
AI-powered mentor search and recommendations.
|
|
1514
|
+
|
|
1515
|
+
\`\`\`typescript
|
|
1516
|
+
import { useGetAiSearchMentorsQuery } from '@iblai/data-layer';
|
|
1517
|
+
|
|
1518
|
+
const { data: mentors, isLoading } = useGetAiSearchMentorsQuery({
|
|
1519
|
+
org: string,
|
|
1520
|
+
query: string,
|
|
1521
|
+
});
|
|
1522
|
+
|
|
1523
|
+
// Returns AI-ranked mentor recommendations
|
|
1524
|
+
\`\`\`
|
|
1525
|
+
|
|
1526
|
+
**File Location**: \`packages/data-layer/src/features/search/ai-search-api-slice.ts\``,
|
|
1527
|
+
useGetRecommendationsAiSearchQuery: `# useGetRecommendationsAiSearchQuery Hook (RTK Query)
|
|
1528
|
+
|
|
1529
|
+
Fetches AI-powered recommendations.
|
|
1530
|
+
|
|
1531
|
+
\`\`\`typescript
|
|
1532
|
+
import { useGetRecommendationsAiSearchQuery } from '@iblai/data-layer';
|
|
1533
|
+
|
|
1534
|
+
const { data: recommendations, isLoading } = useGetRecommendationsAiSearchQuery({
|
|
1535
|
+
org: string,
|
|
1536
|
+
userId?: string,
|
|
1537
|
+
});
|
|
1538
|
+
|
|
1539
|
+
// Returns personalized recommendations
|
|
1540
|
+
\`\`\`
|
|
1541
|
+
|
|
1542
|
+
**File Location**: \`packages/data-layer/src/features/search/ai-search-api-slice.ts\``,
|
|
1543
|
+
// ============================================================================
|
|
1544
|
+
// RTK QUERY HOOKS - PROJECTS
|
|
1545
|
+
// ============================================================================
|
|
1546
|
+
useGetUserProjectsQuery: `# useGetUserProjectsQuery Hook (RTK Query)
|
|
1547
|
+
|
|
1548
|
+
Fetches user's projects.
|
|
1549
|
+
|
|
1550
|
+
\`\`\`typescript
|
|
1551
|
+
import { useGetUserProjectsQuery } from '@iblai/data-layer';
|
|
1552
|
+
|
|
1553
|
+
const { data: projects, isLoading } = useGetUserProjectsQuery({
|
|
1554
|
+
org: string,
|
|
1555
|
+
username: string,
|
|
1556
|
+
});
|
|
1557
|
+
|
|
1558
|
+
// Returns array of user projects
|
|
1559
|
+
\`\`\`
|
|
1560
|
+
|
|
1561
|
+
**File Location**: \`packages/data-layer/src/features/projects/api-slice.ts\``,
|
|
1562
|
+
useCreateUserProjectMutation: `# useCreateUserProjectMutation Hook (RTK Query)
|
|
1563
|
+
|
|
1564
|
+
Creates a new user project.
|
|
1565
|
+
|
|
1566
|
+
\`\`\`typescript
|
|
1567
|
+
import { useCreateUserProjectMutation } from '@iblai/data-layer';
|
|
1568
|
+
|
|
1569
|
+
const [createProject, { isLoading }] = useCreateUserProjectMutation();
|
|
1570
|
+
|
|
1571
|
+
await createProject({
|
|
1572
|
+
org: string,
|
|
1573
|
+
name: string,
|
|
1574
|
+
description?: string,
|
|
1575
|
+
}).unwrap();
|
|
1576
|
+
\`\`\`
|
|
1577
|
+
|
|
1578
|
+
**File Location**: \`packages/data-layer/src/features/projects/api-slice.ts\``,
|
|
1579
|
+
useUpdateUserProjectMutation: `# useUpdateUserProjectMutation Hook (RTK Query)
|
|
1580
|
+
|
|
1581
|
+
Updates an existing user project.
|
|
1582
|
+
|
|
1583
|
+
\`\`\`typescript
|
|
1584
|
+
import { useUpdateUserProjectMutation } from '@iblai/data-layer';
|
|
1585
|
+
|
|
1586
|
+
const [updateProject, { isLoading }] = useUpdateUserProjectMutation();
|
|
1587
|
+
|
|
1588
|
+
await updateProject({
|
|
1589
|
+
org: string,
|
|
1590
|
+
projectId: string,
|
|
1591
|
+
name?: string,
|
|
1592
|
+
description?: string,
|
|
1593
|
+
}).unwrap();
|
|
1594
|
+
\`\`\`
|
|
1595
|
+
|
|
1596
|
+
**File Location**: \`packages/data-layer/src/features/projects/api-slice.ts\``,
|
|
1597
|
+
useDeleteUserProjectMutation: `# useDeleteUserProjectMutation Hook (RTK Query)
|
|
1598
|
+
|
|
1599
|
+
Deletes a user project.
|
|
1600
|
+
|
|
1601
|
+
\`\`\`typescript
|
|
1602
|
+
import { useDeleteUserProjectMutation } from '@iblai/data-layer';
|
|
1603
|
+
|
|
1604
|
+
const [deleteProject, { isLoading }] = useDeleteUserProjectMutation();
|
|
1605
|
+
|
|
1606
|
+
await deleteProject({
|
|
1607
|
+
org: string,
|
|
1608
|
+
projectId: string,
|
|
1609
|
+
}).unwrap();
|
|
1610
|
+
\`\`\`
|
|
1611
|
+
|
|
1612
|
+
**File Location**: \`packages/data-layer/src/features/projects/api-slice.ts\``,
|
|
1613
|
+
// ============================================================================
|
|
1614
|
+
// RTK QUERY HOOKS - AUTHENTICATION
|
|
1615
|
+
// ============================================================================
|
|
1616
|
+
useExchangeAppleTokenMutation: `# useExchangeAppleTokenMutation Hook (RTK Query)
|
|
1617
|
+
|
|
1618
|
+
Exchanges Apple Sign-In token for JWT.
|
|
1619
|
+
|
|
1620
|
+
\`\`\`typescript
|
|
1621
|
+
import { useExchangeAppleTokenMutation } from '@iblai/data-layer';
|
|
1622
|
+
|
|
1623
|
+
const [exchangeToken, { isLoading }] = useExchangeAppleTokenMutation();
|
|
1624
|
+
|
|
1625
|
+
const { access_token, refresh_token } = await exchangeToken({
|
|
1626
|
+
identityToken: string,
|
|
1627
|
+
authorizationCode: string,
|
|
1628
|
+
}).unwrap();
|
|
1629
|
+
\`\`\`
|
|
1630
|
+
|
|
1631
|
+
**File Location**: \`packages/data-layer/src/features/auth/api-slice.ts\``,
|
|
1632
|
+
useRefreshJwtTokenMutation: `# useRefreshJwtTokenMutation Hook (RTK Query)
|
|
1633
|
+
|
|
1634
|
+
Refreshes JWT token using refresh token.
|
|
1635
|
+
|
|
1636
|
+
\`\`\`typescript
|
|
1637
|
+
import { useRefreshJwtTokenMutation } from '@iblai/data-layer';
|
|
1638
|
+
|
|
1639
|
+
const [refreshToken, { isLoading }] = useRefreshJwtTokenMutation();
|
|
1640
|
+
|
|
1641
|
+
const { access_token } = await refreshToken({
|
|
1642
|
+
refresh_token: string,
|
|
1643
|
+
}).unwrap();
|
|
1644
|
+
\`\`\`
|
|
1645
|
+
|
|
1646
|
+
**File Location**: \`packages/data-layer/src/features/auth/api-slice.ts\``,
|
|
1647
|
+
useGetMfeContextQuery: `# useGetMfeContextQuery Hook (RTK Query)
|
|
1648
|
+
|
|
1649
|
+
Fetches Micro Frontend context for embedded apps.
|
|
1650
|
+
|
|
1651
|
+
\`\`\`typescript
|
|
1652
|
+
import { useGetMfeContextQuery } from '@iblai/data-layer';
|
|
1653
|
+
|
|
1654
|
+
const { data: context, isLoading } = useGetMfeContextQuery({
|
|
1655
|
+
appId: string,
|
|
1656
|
+
});
|
|
1657
|
+
|
|
1658
|
+
// Returns MFE configuration and user context
|
|
1659
|
+
\`\`\`
|
|
1660
|
+
|
|
1661
|
+
**File Location**: \`packages/data-layer/src/features/auth/api-slice.ts\``,
|
|
1662
|
+
// ============================================================================
|
|
1663
|
+
// RTK QUERY HOOKS - CREDENTIALS
|
|
1664
|
+
// ============================================================================
|
|
1665
|
+
useGetUserCredentialsQuery: `# useGetUserCredentialsQuery Hook (RTK Query)
|
|
1666
|
+
|
|
1667
|
+
Fetches user's credentials.
|
|
1668
|
+
|
|
1669
|
+
\`\`\`typescript
|
|
1670
|
+
import { useGetUserCredentialsQuery } from '@iblai/data-layer';
|
|
1671
|
+
|
|
1672
|
+
const { data: credentials, isLoading } = useGetUserCredentialsQuery({
|
|
1673
|
+
org: string,
|
|
1674
|
+
username: string,
|
|
1675
|
+
});
|
|
1676
|
+
|
|
1677
|
+
// Returns array of user credentials
|
|
1678
|
+
\`\`\`
|
|
1679
|
+
|
|
1680
|
+
**File Location**: \`packages/data-layer/src/features/credentials/api-slice.ts\``,
|
|
1681
|
+
useGetIntegrationCredentialsQuery: `# useGetIntegrationCredentialsQuery Hook (RTK Query)
|
|
1682
|
+
|
|
1683
|
+
Fetches integration credentials for third-party services.
|
|
1684
|
+
|
|
1685
|
+
\`\`\`typescript
|
|
1686
|
+
import { useGetIntegrationCredentialsQuery } from '@iblai/data-layer';
|
|
1687
|
+
|
|
1688
|
+
const { data: credentials, isLoading } = useGetIntegrationCredentialsQuery({
|
|
1689
|
+
org: string,
|
|
1690
|
+
});
|
|
1691
|
+
|
|
1692
|
+
// Returns integration credentials
|
|
1693
|
+
\`\`\`
|
|
1694
|
+
|
|
1695
|
+
**File Location**: \`packages/data-layer/src/features/credentials/api-slice.ts\``,
|
|
1696
|
+
// ============================================================================
|
|
1697
|
+
// RTK QUERY HOOKS - TRAINING DOCUMENTS
|
|
1698
|
+
// ============================================================================
|
|
1699
|
+
useGetTrainingDocumentsQuery: `# useGetTrainingDocumentsQuery Hook (RTK Query)
|
|
1700
|
+
|
|
1701
|
+
Fetches training documents for a mentor.
|
|
1702
|
+
|
|
1703
|
+
\`\`\`typescript
|
|
1704
|
+
import { useGetTrainingDocumentsQuery } from '@iblai/data-layer';
|
|
1705
|
+
|
|
1706
|
+
const { data: documents, isLoading } = useGetTrainingDocumentsQuery({
|
|
1707
|
+
org: string,
|
|
1708
|
+
mentorId: string,
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
// Returns array of training documents
|
|
1712
|
+
\`\`\`
|
|
1713
|
+
|
|
1714
|
+
**File Location**: \`packages/data-layer/src/features/training-documents/api-slice.ts\``,
|
|
1715
|
+
useUploadTrainingDocumentMutation: `# useUploadTrainingDocumentMutation Hook (RTK Query)
|
|
1716
|
+
|
|
1717
|
+
Uploads a training document for mentor knowledge base.
|
|
1718
|
+
|
|
1719
|
+
\`\`\`typescript
|
|
1720
|
+
import { useUploadTrainingDocumentMutation } from '@iblai/data-layer';
|
|
1721
|
+
|
|
1722
|
+
const [uploadDocument, { isLoading }] = useUploadTrainingDocumentMutation();
|
|
1723
|
+
|
|
1724
|
+
await uploadDocument({
|
|
1725
|
+
org: string,
|
|
1726
|
+
mentorId: string,
|
|
1727
|
+
file: File,
|
|
1728
|
+
name?: string,
|
|
1729
|
+
}).unwrap();
|
|
1730
|
+
\`\`\`
|
|
1731
|
+
|
|
1732
|
+
**File Location**: \`packages/data-layer/src/features/training-documents/api-slice.ts\``,
|
|
1733
|
+
useDeleteTrainingDocumentMutation: `# useDeleteTrainingDocumentMutation Hook (RTK Query)
|
|
1734
|
+
|
|
1735
|
+
Deletes a training document.
|
|
1736
|
+
|
|
1737
|
+
\`\`\`typescript
|
|
1738
|
+
import { useDeleteTrainingDocumentMutation } from '@iblai/data-layer';
|
|
1739
|
+
|
|
1740
|
+
const [deleteDocument, { isLoading }] = useDeleteTrainingDocumentMutation();
|
|
1741
|
+
|
|
1742
|
+
await deleteDocument({
|
|
1743
|
+
org: string,
|
|
1744
|
+
mentorId: string,
|
|
1745
|
+
documentId: string,
|
|
1746
|
+
}).unwrap();
|
|
1747
|
+
\`\`\`
|
|
1748
|
+
|
|
1749
|
+
**File Location**: \`packages/data-layer/src/features/training-documents/api-slice.ts\``,
|
|
1750
|
+
// ============================================================================
|
|
1751
|
+
// RTK QUERY HOOKS - BILLING/STRIPE
|
|
1752
|
+
// ============================================================================
|
|
1753
|
+
useGetBillingInfoQuery: `# useGetBillingInfoQuery Hook (RTK Query)
|
|
1754
|
+
|
|
1755
|
+
Fetches user billing information.
|
|
1756
|
+
|
|
1757
|
+
\`\`\`typescript
|
|
1758
|
+
import { useGetBillingInfoQuery } from '@iblai/data-layer';
|
|
1759
|
+
|
|
1760
|
+
const { data: billing, isLoading } = useGetBillingInfoQuery({
|
|
1761
|
+
org: string,
|
|
1762
|
+
});
|
|
1763
|
+
|
|
1764
|
+
// Returns billing and subscription information
|
|
1765
|
+
\`\`\`
|
|
1766
|
+
|
|
1767
|
+
**File Location**: \`packages/data-layer/src/features/billing/api-slice.ts\``,
|
|
1768
|
+
useCreateCheckoutSessionMutation: `# useCreateCheckoutSessionMutation Hook (RTK Query)
|
|
1769
|
+
|
|
1770
|
+
Creates a Stripe checkout session.
|
|
1771
|
+
|
|
1772
|
+
\`\`\`typescript
|
|
1773
|
+
import { useCreateCheckoutSessionMutation } from '@iblai/data-layer';
|
|
1774
|
+
|
|
1775
|
+
const [createSession, { isLoading }] = useCreateCheckoutSessionMutation();
|
|
1776
|
+
|
|
1777
|
+
const { sessionUrl } = await createSession({
|
|
1778
|
+
org: string,
|
|
1779
|
+
priceId: string,
|
|
1780
|
+
successUrl: string,
|
|
1781
|
+
cancelUrl: string,
|
|
1782
|
+
}).unwrap();
|
|
1783
|
+
|
|
1784
|
+
// Redirect to sessionUrl
|
|
1785
|
+
\`\`\`
|
|
1786
|
+
|
|
1787
|
+
**File Location**: \`packages/data-layer/src/features/stripe/api-slice.ts\``,
|
|
1788
|
+
useCreatePortalSessionMutation: `# useCreatePortalSessionMutation Hook (RTK Query)
|
|
1789
|
+
|
|
1790
|
+
Creates a Stripe billing portal session.
|
|
1791
|
+
|
|
1792
|
+
\`\`\`typescript
|
|
1793
|
+
import { useCreatePortalSessionMutation } from '@iblai/data-layer';
|
|
1794
|
+
|
|
1795
|
+
const [createPortal, { isLoading }] = useCreatePortalSessionMutation();
|
|
1796
|
+
|
|
1797
|
+
const { portalUrl } = await createPortal({
|
|
1798
|
+
org: string,
|
|
1799
|
+
returnUrl: string,
|
|
1800
|
+
}).unwrap();
|
|
1801
|
+
|
|
1802
|
+
// Redirect to portalUrl
|
|
1803
|
+
\`\`\`
|
|
1804
|
+
|
|
1805
|
+
**File Location**: \`packages/data-layer/src/features/stripe/api-slice.ts\``,
|
|
1806
|
+
// ============================================================================
|
|
1807
|
+
// RTK QUERY HOOKS - SHAREABLE LINKS
|
|
1808
|
+
// ============================================================================
|
|
1809
|
+
useCreateShareableLinkMutation: `# useCreateShareableLinkMutation Hook (RTK Query)
|
|
1810
|
+
|
|
1811
|
+
Creates a shareable link for a mentor.
|
|
1812
|
+
|
|
1813
|
+
\`\`\`typescript
|
|
1814
|
+
import { useCreateShareableLinkMutation } from '@iblai/data-layer';
|
|
1815
|
+
|
|
1816
|
+
const [createLink, { isLoading }] = useCreateShareableLinkMutation();
|
|
1817
|
+
|
|
1818
|
+
const { link, token } = await createLink({
|
|
1819
|
+
org: string,
|
|
1820
|
+
mentorId: string,
|
|
1821
|
+
expiresAt?: string, // ISO date
|
|
1822
|
+
}).unwrap();
|
|
1823
|
+
\`\`\`
|
|
1824
|
+
|
|
1825
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
1826
|
+
useUpdateShareableLinkMutation: `# useUpdateShareableLinkMutation Hook (RTK Query)
|
|
1827
|
+
|
|
1828
|
+
Updates a shareable link.
|
|
1829
|
+
|
|
1830
|
+
\`\`\`typescript
|
|
1831
|
+
import { useUpdateShareableLinkMutation } from '@iblai/data-layer';
|
|
1832
|
+
|
|
1833
|
+
const [updateLink, { isLoading }] = useUpdateShareableLinkMutation();
|
|
1834
|
+
|
|
1835
|
+
await updateLink({
|
|
1836
|
+
org: string,
|
|
1837
|
+
mentorId: string,
|
|
1838
|
+
token: string,
|
|
1839
|
+
expiresAt?: string,
|
|
1840
|
+
}).unwrap();
|
|
1841
|
+
\`\`\`
|
|
1842
|
+
|
|
1843
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
1844
|
+
useRevokeShareableLinkMutation: `# useRevokeShareableLinkMutation Hook (RTK Query)
|
|
1845
|
+
|
|
1846
|
+
Revokes a shareable link.
|
|
1847
|
+
|
|
1848
|
+
\`\`\`typescript
|
|
1849
|
+
import { useRevokeShareableLinkMutation } from '@iblai/data-layer';
|
|
1850
|
+
|
|
1851
|
+
const [revokeLink, { isLoading }] = useRevokeShareableLinkMutation();
|
|
1852
|
+
|
|
1853
|
+
await revokeLink({
|
|
1854
|
+
org: string,
|
|
1855
|
+
mentorId: string,
|
|
1856
|
+
token: string,
|
|
1857
|
+
}).unwrap();
|
|
1858
|
+
\`\`\`
|
|
1859
|
+
|
|
1860
|
+
**File Location**: \`packages/data-layer/src/features/mentor/api-slice.ts\``,
|
|
1861
|
+
};
|
|
1862
|
+
export function getHookInfo(hookName) {
|
|
1863
|
+
const info = hooks[hookName];
|
|
1864
|
+
if (!info) {
|
|
1865
|
+
return `Hook "${hookName}" not found.
|
|
1866
|
+
|
|
1867
|
+
**Web Utils Hooks (@iblai/web-utils):**
|
|
1868
|
+
- useAdvancedChat - AI chat with WebSocket streaming and multi-tab support
|
|
1869
|
+
- useChat - Lower-level WebSocket chat hook
|
|
1870
|
+
- useMentorSettings - Mentor configuration
|
|
1871
|
+
- useMentorTools - Mentor tools management
|
|
1872
|
+
- useUserProfileUpdate - Profile updates
|
|
1873
|
+
- useProfileImageUpload - Profile image upload
|
|
1874
|
+
- useTenantMetadata - Tenant configuration
|
|
1875
|
+
- useSubscriptionHandler - Subscription management
|
|
1876
|
+
- useTimeTracker - Time tracking for analytics
|
|
1877
|
+
- useDayJs - Date/time utilities
|
|
1878
|
+
|
|
1879
|
+
**Data Layer Hooks (@iblai/data-layer) - Mentor:**
|
|
1880
|
+
- useGetMentorsQuery - List mentors
|
|
1881
|
+
- useGetMentorDetailsQuery - Mentor details
|
|
1882
|
+
- useGetMentorSettingsQuery - Mentor settings (authenticated)
|
|
1883
|
+
- useGetMentorPublicSettingsQuery - Mentor settings (public)
|
|
1884
|
+
- useCreateMentorMutation - Create mentor
|
|
1885
|
+
- useEditMentorMutation - Update mentor
|
|
1886
|
+
- useDeleteMentorMutation - Delete mentor
|
|
1887
|
+
- useForkMentorMutation - Fork/copy mentor
|
|
1888
|
+
- useStarMentorMutation - Star mentor
|
|
1889
|
+
- useUnstarMentorMutation - Unstar mentor
|
|
1890
|
+
- useStarredMentorsQuery - Get starred mentors
|
|
1891
|
+
- useGetRecentlyAccessedMentorsQuery - Recent mentors
|
|
1892
|
+
- useGetFreeUsageCountQuery - Free usage remaining
|
|
1893
|
+
- useSeedMentorsMutation - Seed default mentors
|
|
1894
|
+
|
|
1895
|
+
**Data Layer Hooks - User:**
|
|
1896
|
+
- useGetUserMetadataQuery - User profile
|
|
1897
|
+
- useUpdateUserMetadataMutation - Update profile
|
|
1898
|
+
- useUpdateUserAccountMutation - Update account
|
|
1899
|
+
- useResetPasswordMutation - Password reset
|
|
1900
|
+
- useUploadProfileImageMutation - Upload avatar
|
|
1901
|
+
- useRemoveProfileImageMutation - Remove avatar
|
|
1902
|
+
|
|
1903
|
+
**Data Layer Hooks - Platform:**
|
|
1904
|
+
- useGetPlatformUsersQuery - Platform users
|
|
1905
|
+
- usePlatformUserGroupsQuery - User groups/teams
|
|
1906
|
+
- useGetPlatformUserGroupDetailsQuery - Group details
|
|
1907
|
+
- useCreatePlatformUserGroupMutation - Create group
|
|
1908
|
+
- useUpdatePlatformUserGroupMutation - Update group
|
|
1909
|
+
- useDeletePlatformUserGroupMutation - Delete group
|
|
1910
|
+
- useInviteUserMutation - Invite user
|
|
1911
|
+
- useUpdatePlatformUserRoleWithPoliciesMutation - Update user role
|
|
1912
|
+
|
|
1913
|
+
**Data Layer Hooks - Tenant:**
|
|
1914
|
+
- useGetTenantMetadataQuery - Tenant metadata
|
|
1915
|
+
- useUpdateTenantMetadataMutation - Update metadata
|
|
1916
|
+
- useGetUserTenantsQuery - User's tenants
|
|
1917
|
+
|
|
1918
|
+
**Data Layer Hooks - Memory:**
|
|
1919
|
+
- useGetMemoriesQuery - Mentor memories
|
|
1920
|
+
- useGetMemoryCategoriesQuery - Memory categories
|
|
1921
|
+
- useCreateMemoryMutation - Create memory
|
|
1922
|
+
- useUpdateMemoryEntryMutation - Update memory
|
|
1923
|
+
- useDeleteMemoryMutation - Delete memory
|
|
1924
|
+
- useGetMentorUserSettingsQuery - User settings for mentor
|
|
1925
|
+
- useUpdateMentorUserSettingsMutation - Update user settings
|
|
1926
|
+
|
|
1927
|
+
**Data Layer Hooks - MCP:**
|
|
1928
|
+
- useGetMCPServersQuery - MCP servers
|
|
1929
|
+
- useCreateMCPServerMutation - Create MCP server
|
|
1930
|
+
- useUpdateMCPServerMutation - Update MCP server
|
|
1931
|
+
- useDeleteMCPServerMutation - Delete MCP server
|
|
1932
|
+
- useGetOAuthServicesQuery - OAuth services
|
|
1933
|
+
- useGetConnectedServicesQuery - Connected services
|
|
1934
|
+
- useStartOAuthFlowMutation - Start OAuth
|
|
1935
|
+
- useDisconnectServiceMutation - Disconnect service
|
|
1936
|
+
|
|
1937
|
+
**Data Layer Hooks - Notifications:**
|
|
1938
|
+
- useGetNotificationsQuery - User notifications
|
|
1939
|
+
- useGetNotificationsCountQuery - Unread count
|
|
1940
|
+
- useMarkAllAsReadMutation - Mark all read
|
|
1941
|
+
- useSendNotificationMutation - Send notification
|
|
1942
|
+
|
|
1943
|
+
**Data Layer Hooks - Chat:**
|
|
1944
|
+
- usePinnedMessagesQuery - Pinned messages
|
|
1945
|
+
- useUpdateMessageFeedbackMutation - Message feedback
|
|
1946
|
+
- useAudioToTextMutation - Speech to text
|
|
1947
|
+
- useGetChatHistoryQuery - Chat history
|
|
1948
|
+
- useGetSessionsQuery - Chat sessions
|
|
1949
|
+
|
|
1950
|
+
**Data Layer Hooks - Skills:**
|
|
1951
|
+
- useGetReportedSkillsQuery - Reported skills
|
|
1952
|
+
- useGetDesiredSkillsQuery - Desired skills
|
|
1953
|
+
- useGetSkillsPointsPercentileQuery - Skills percentile
|
|
1954
|
+
- useGetUserEarnedSkillsQuery - Earned skills
|
|
1955
|
+
|
|
1956
|
+
**Data Layer Hooks - RBAC:**
|
|
1957
|
+
- useGetRbacGroupsQuery - RBAC groups
|
|
1958
|
+
- useGetRbacPermissionsQuery - RBAC permissions
|
|
1959
|
+
|
|
1960
|
+
**Data Layer Hooks - Search:**
|
|
1961
|
+
- useGetPersonnalizedSearchQuery - Personalized search
|
|
1962
|
+
- useGetAiSearchMentorsQuery - AI mentor search
|
|
1963
|
+
- useGetRecommendationsAiSearchQuery - AI recommendations
|
|
1964
|
+
|
|
1965
|
+
**Data Layer Hooks - Projects:**
|
|
1966
|
+
- useGetUserProjectsQuery - User projects
|
|
1967
|
+
- useCreateUserProjectMutation - Create project
|
|
1968
|
+
- useUpdateUserProjectMutation - Update project
|
|
1969
|
+
- useDeleteUserProjectMutation - Delete project
|
|
1970
|
+
|
|
1971
|
+
**Data Layer Hooks - Auth:**
|
|
1972
|
+
- useExchangeAppleTokenMutation - Apple Sign-In
|
|
1973
|
+
- useRefreshJwtTokenMutation - Refresh JWT
|
|
1974
|
+
- useGetMfeContextQuery - MFE context
|
|
1975
|
+
|
|
1976
|
+
**Data Layer Hooks - Billing:**
|
|
1977
|
+
- useGetBillingInfoQuery - Billing info
|
|
1978
|
+
- useCreateCheckoutSessionMutation - Stripe checkout
|
|
1979
|
+
- useCreatePortalSessionMutation - Billing portal
|
|
1980
|
+
|
|
1981
|
+
**Data Layer Hooks - Training Documents:**
|
|
1982
|
+
- useGetTrainingDocumentsQuery - Training docs
|
|
1983
|
+
- useUploadTrainingDocumentMutation - Upload doc
|
|
1984
|
+
- useDeleteTrainingDocumentMutation - Delete doc`;
|
|
1985
|
+
}
|
|
1986
|
+
return info;
|
|
1987
|
+
}
|
|
1988
|
+
//# sourceMappingURL=hook-info.js.map
|