@iblai/iblai-js 2.3.16 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60579,6 +60579,14 @@ var analyticsAnalyticsAuditLogStats$3 = {
|
|
|
60579
60579
|
colAction: "ACTION",
|
|
60580
60580
|
colTime: "TIME"
|
|
60581
60581
|
};
|
|
60582
|
+
var analyticsAnalyticsAgentPicker$3 = {
|
|
60583
|
+
analyticsScope: "Analytics scope",
|
|
60584
|
+
allAgents: "All Agents",
|
|
60585
|
+
agents: "Agents",
|
|
60586
|
+
searchAgents: "Search agents…",
|
|
60587
|
+
noAgentsFound: "No agents found",
|
|
60588
|
+
loading: "Loading…"
|
|
60589
|
+
};
|
|
60582
60590
|
var analyticsAnalyticsCourseDetail$3 = {
|
|
60583
60591
|
goBackAriaLabel: "Go back to courses list",
|
|
60584
60592
|
activeEnrollments: "Active Enrollments",
|
|
@@ -66167,6 +66175,7 @@ var en = {
|
|
|
66167
66175
|
agentSearchLabels: agentSearchLabels$3,
|
|
66168
66176
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap$3,
|
|
66169
66177
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats$3,
|
|
66178
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker$3,
|
|
66170
66179
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail$3,
|
|
66171
66180
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses$3,
|
|
66172
66181
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats$3,
|
|
@@ -67043,6 +67052,14 @@ var analyticsAnalyticsAuditLogStats$2 = {
|
|
|
67043
67052
|
colAction: "ACTION",
|
|
67044
67053
|
colTime: "HEURE"
|
|
67045
67054
|
};
|
|
67055
|
+
var analyticsAnalyticsAgentPicker$2 = {
|
|
67056
|
+
analyticsScope: "Portée des analyses",
|
|
67057
|
+
allAgents: "Tous les agents",
|
|
67058
|
+
agents: "Agents",
|
|
67059
|
+
searchAgents: "Rechercher des agents…",
|
|
67060
|
+
noAgentsFound: "Aucun agent trouvé",
|
|
67061
|
+
loading: "Chargement…"
|
|
67062
|
+
};
|
|
67046
67063
|
var analyticsAnalyticsCourseDetail$2 = {
|
|
67047
67064
|
goBackAriaLabel: "Retour à la liste des cours",
|
|
67048
67065
|
activeEnrollments: "Inscriptions actives",
|
|
@@ -72631,6 +72648,7 @@ var fr = {
|
|
|
72631
72648
|
agentSearchLabels: agentSearchLabels$2,
|
|
72632
72649
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap$2,
|
|
72633
72650
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats$2,
|
|
72651
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker$2,
|
|
72634
72652
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail$2,
|
|
72635
72653
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses$2,
|
|
72636
72654
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats$2,
|
|
@@ -73507,6 +73525,14 @@ var analyticsAnalyticsAuditLogStats$1 = {
|
|
|
73507
73525
|
colAction: "ACCIÓN",
|
|
73508
73526
|
colTime: "HORA"
|
|
73509
73527
|
};
|
|
73528
|
+
var analyticsAnalyticsAgentPicker$1 = {
|
|
73529
|
+
analyticsScope: "Alcance de analíticas",
|
|
73530
|
+
allAgents: "Todos los agentes",
|
|
73531
|
+
agents: "Agentes",
|
|
73532
|
+
searchAgents: "Buscar agentes…",
|
|
73533
|
+
noAgentsFound: "No se encontraron agentes",
|
|
73534
|
+
loading: "Cargando…"
|
|
73535
|
+
};
|
|
73510
73536
|
var analyticsAnalyticsCourseDetail$1 = {
|
|
73511
73537
|
goBackAriaLabel: "Volver a la lista de cursos",
|
|
73512
73538
|
activeEnrollments: "Inscripciones activas",
|
|
@@ -79095,6 +79121,7 @@ var es = {
|
|
|
79095
79121
|
agentSearchLabels: agentSearchLabels$1,
|
|
79096
79122
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap$1,
|
|
79097
79123
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats$1,
|
|
79124
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker$1,
|
|
79098
79125
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail$1,
|
|
79099
79126
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses$1,
|
|
79100
79127
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats$1,
|
|
@@ -79971,6 +79998,14 @@ var analyticsAnalyticsAuditLogStats = {
|
|
|
79971
79998
|
colAction: "操作",
|
|
79972
79999
|
colTime: "时间"
|
|
79973
80000
|
};
|
|
80001
|
+
var analyticsAnalyticsAgentPicker = {
|
|
80002
|
+
analyticsScope: "分析范围",
|
|
80003
|
+
allAgents: "所有智能体",
|
|
80004
|
+
agents: "智能体",
|
|
80005
|
+
searchAgents: "搜索智能体…",
|
|
80006
|
+
noAgentsFound: "未找到智能体",
|
|
80007
|
+
loading: "加载中…"
|
|
80008
|
+
};
|
|
79974
80009
|
var analyticsAnalyticsCourseDetail = {
|
|
79975
80010
|
goBackAriaLabel: "返回课程列表",
|
|
79976
80011
|
activeEnrollments: "活跃注册",
|
|
@@ -85559,6 +85594,7 @@ var zh = {
|
|
|
85559
85594
|
agentSearchLabels: agentSearchLabels,
|
|
85560
85595
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap,
|
|
85561
85596
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats,
|
|
85597
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker,
|
|
85562
85598
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail,
|
|
85563
85599
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses,
|
|
85564
85600
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats,
|
|
@@ -147533,9 +147569,12 @@ function SubmissionDetail({ platformKey, submissionId, onBack, }) {
|
|
|
147533
147569
|
: [((_b = answers) !== null && _b !== void 0 ? _b : {})];
|
|
147534
147570
|
return (jsxs("div", { className: "rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900", children: [jsx("p", { className: "border-b border-gray-100 px-4 py-2 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:border-gray-800", children: section.title || section.key }), jsx("div", { className: "divide-y divide-gray-50 dark:divide-gray-800", children: entries.map((entry, index) => {
|
|
147535
147571
|
var _a, _b;
|
|
147536
|
-
return (jsxs("div", { className: "px-4 py-2.5", children: [section.repeatable && (jsx("p", { className: "mb-1 text-xs font-medium text-gray-400", children: t('profileApplicationsTab.entryN', { n: index + 1 }) })), jsx("dl", { className: "grid gap-x-6 gap-y-
|
|
147572
|
+
return (jsxs("div", { className: "px-4 py-2.5", children: [section.repeatable && (jsx("p", { className: "mb-1 text-xs font-medium text-gray-400", children: t('profileApplicationsTab.entryN', { n: index + 1 }) })), jsx("dl", { className: "grid gap-x-6 gap-y-3 sm:grid-cols-2", children: ((_a = section.fields) !== null && _a !== void 0 ? _a : [])
|
|
147537
147573
|
.filter((field) => field.type !== 'info')
|
|
147538
|
-
.map((field) => (jsxs("div", {
|
|
147574
|
+
.map((field) => (jsxs("div", {
|
|
147575
|
+
/* Free-text answers get the full width — they are the
|
|
147576
|
+
ones long enough to need it. */
|
|
147577
|
+
className: `min-w-0 ${field.type === 'textarea' ? 'sm:col-span-2' : ''}`, children: [jsx("dt", { className: "break-words text-xs leading-snug text-gray-500", children: field.label || field.key }), jsx("dd", { className: "mt-0.5 whitespace-pre-wrap break-words text-sm text-gray-800 dark:text-gray-200", children: masked.has(`${section.key}.${field.key}`) ? (jsxs("span", { className: "inline-flex items-center gap-1 text-gray-400", children: [jsx(EyeOff, { className: "h-3 w-3" }), t('profileApplicationsTab.maskedValue')] })) : (displayValue(field, entry[field.key], t)) })] }, field.key))) })] }, (_b = entry._id) !== null && _b !== void 0 ? _b : index));
|
|
147539
147578
|
}) })] }, section.key));
|
|
147540
147579
|
})] }), ((_l = detail.attachments) !== null && _l !== void 0 ? _l : []).length > 0 && (jsxs("section", { className: "space-y-3", children: [jsxs("h5", { className: "flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-gray-100", children: [jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-400", children: jsx(Paperclip, { className: "h-3.5 w-3.5" }) }), t('profileApplicationsTab.attachmentsHeading')] }), jsx("div", { className: "flex flex-wrap gap-2", children: ((_m = detail.attachments) !== null && _m !== void 0 ? _m : []).map((attachment) => (jsxs("button", { type: "button", onClick: () => handleDownload(attachment.id, attachment.filename), className: "inline-flex items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2.5 py-1.5 text-xs text-gray-700 shadow-sm hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800", children: [jsx(Download, { className: "h-3.5 w-3.5" }), attachment.filename || `#${attachment.id}`] }, attachment.id))) })] })), acceptedCandidates.length > 0 && (jsxs(Fragment$1, { children: [jsx(PlacementsSection, { platformKey: platformKey, submissionId: submissionId, detail: detail, candidateLabel: candidateLabel, onAdd: () => setPlacementDialogOpen(true) }), jsx(AssignmentsSection, { platformKey: platformKey, submissionId: submissionId, detail: detail, candidateLabel: candidateLabel, onAdd: () => setAssignmentDialogOpen(true), onChanged: refetch })] })), jsx(NotesSection, { platformKey: platformKey, submissionId: submissionId, detail: detail }), jsxs("section", { className: "space-y-3", children: [jsxs("h5", { className: "flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-gray-100", children: [jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-400", children: jsx(History, { className: "h-3.5 w-3.5" }) }), t('profileApplicationsTab.auditHeading')] }), ((_o = detail.status_events) !== null && _o !== void 0 ? _o : []).length === 0 ? (jsx("p", { className: "text-sm text-gray-400", children: t('profileApplicationsTab.noEvents') })) : (jsx("ul", { className: "space-y-1.5", children: ((_p = detail.status_events) !== null && _p !== void 0 ? _p : []).map((event) => {
|
|
147541
147580
|
var _a;
|
|
@@ -148067,7 +148106,7 @@ function BlocksView({ platformKey, onBack, }) {
|
|
|
148067
148106
|
|
|
148068
148107
|
const FILTER_ORDER = ['all', ...APPLICATION_STATUSES];
|
|
148069
148108
|
const PAGE_SIZE$3 = 20;
|
|
148070
|
-
const SEARCH_DEBOUNCE_MS$
|
|
148109
|
+
const SEARCH_DEBOUNCE_MS$2 = 300;
|
|
148071
148110
|
/**
|
|
148072
148111
|
* The public application URL on the auth SPA for one form of a platform
|
|
148073
148112
|
* (`<auth-url>/applications/<platform-key>/<form-id>?redirect-to=<origin>`), or
|
|
@@ -148178,7 +148217,7 @@ function SubmissionsPipeline({ platformKey, form, onBack, onOpen, }) {
|
|
|
148178
148217
|
const timer = setTimeout(() => {
|
|
148179
148218
|
setDebouncedSearch(search.trim());
|
|
148180
148219
|
setDebouncedCandidateFilter(candidateFilter.trim());
|
|
148181
|
-
}, SEARCH_DEBOUNCE_MS$
|
|
148220
|
+
}, SEARCH_DEBOUNCE_MS$2);
|
|
148182
148221
|
return () => clearTimeout(timer);
|
|
148183
148222
|
}, [search, candidateFilter]);
|
|
148184
148223
|
// New filters restart paging.
|
|
@@ -152915,7 +152954,7 @@ function SearchableMultiSelect({ items, selectedItems, onSelectionChange, search
|
|
|
152915
152954
|
}) }))] }));
|
|
152916
152955
|
}
|
|
152917
152956
|
|
|
152918
|
-
function useDebouncedValue$
|
|
152957
|
+
function useDebouncedValue$5(value, delay) {
|
|
152919
152958
|
const [debouncedValue, setDebouncedValue] = React__default.useState(value);
|
|
152920
152959
|
React__default.useEffect(() => {
|
|
152921
152960
|
const timer = window.setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -152960,8 +152999,8 @@ function TokenPolicyFields({ tenantKey, mode, onModeChange, policies, onPolicies
|
|
|
152960
152999
|
const t = useT();
|
|
152961
153000
|
const [policySearch, setPolicySearch] = React__default.useState('');
|
|
152962
153001
|
const [groupSearch, setGroupSearch] = React__default.useState('');
|
|
152963
|
-
const debouncedPolicySearch = useDebouncedValue$
|
|
152964
|
-
const debouncedGroupSearch = useDebouncedValue$
|
|
153002
|
+
const debouncedPolicySearch = useDebouncedValue$5(policySearch, RBAC_SEARCH_DEBOUNCE_MS);
|
|
153003
|
+
const debouncedGroupSearch = useDebouncedValue$5(groupSearch, RBAC_SEARCH_DEBOUNCE_MS);
|
|
152965
153004
|
const canWriteMode = canWriteField(fieldPermissions, 'mode');
|
|
152966
153005
|
const canWritePolicies = canWriteField(fieldPermissions, 'policies_to_add') ||
|
|
152967
153006
|
canWriteField(fieldPermissions, 'policies_to_remove');
|
|
@@ -185842,7 +185881,7 @@ function PolicyConfigDialog({ open, onOpenChange, config, onSave, }) {
|
|
|
185842
185881
|
return (jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: jsxs(DialogContent, { className: "sm:max-w-md", "aria-describedby": "policy-config-description", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: t('componentsPolicyConfigDialog.title') }), jsx(DialogDescription, { id: "policy-config-description", children: t('componentsPolicyConfigDialog.description') })] }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { children: [jsx(Label$2, { htmlFor: "policy-config-role-name", className: "text-sm font-medium text-gray-700", children: t('componentsPolicyConfigDialog.roleName') }), jsx(Input, { id: "policy-config-role-name", value: (_a = draft === null || draft === void 0 ? void 0 : draft.role_name) !== null && _a !== void 0 ? _a : '', disabled: true, className: "bg-gray-50" })] }), jsxs("div", { className: "flex items-center space-x-2", children: [jsx(Checkbox, { id: "policy-config-enabled", checked: (_b = draft === null || draft === void 0 ? void 0 : draft.enabled) !== null && _b !== void 0 ? _b : true, onCheckedChange: (checked) => updateDraft({ enabled: checked === true }) }), jsx(Label$2, { htmlFor: "policy-config-enabled", className: "text-sm font-medium text-gray-700 cursor-pointer", children: t('componentsPolicyConfigDialog.enabled') })] }), jsxs("div", { className: "flex items-center space-x-2", children: [jsx(Checkbox, { id: "policy-config-notify-assignment", checked: (_c = draft === null || draft === void 0 ? void 0 : draft.notify_on_assignment) !== null && _c !== void 0 ? _c : true, onCheckedChange: (checked) => updateDraft({ notify_on_assignment: checked === true }) }), jsx(Label$2, { htmlFor: "policy-config-notify-assignment", className: "text-sm font-medium text-gray-700 cursor-pointer", children: t('componentsPolicyConfigDialog.notifyOnAssignment') })] }), jsxs("div", { className: "flex items-center space-x-2", children: [jsx(Checkbox, { id: "policy-config-notify-removal", checked: (_d = draft === null || draft === void 0 ? void 0 : draft.notify_on_removal) !== null && _d !== void 0 ? _d : true, onCheckedChange: (checked) => updateDraft({ notify_on_removal: checked === true }) }), jsx(Label$2, { htmlFor: "policy-config-notify-removal", className: "text-sm font-medium text-gray-700 cursor-pointer", children: t('componentsPolicyConfigDialog.notifyOnRemoval') })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label$2, { htmlFor: "policy-config-subject", className: "text-sm font-medium text-gray-700", children: t('componentsPolicyConfigDialog.subject') }), jsx(Textarea, { id: "policy-config-subject", value: (_e = draft === null || draft === void 0 ? void 0 : draft.subject) !== null && _e !== void 0 ? _e : '', onChange: (event) => updateDraft({ subject: event.target.value }), placeholder: t('componentsPolicyConfigDialog.subjectPlaceholder'), rows: 3 }), jsx("p", { className: "text-xs text-gray-500", children: t('componentsPolicyConfigDialog.subjectHint') })] })] }), jsxs(DialogFooter, { className: "pt-2", children: [jsx(Button$1, { variant: "outline", onClick: () => onOpenChange(false), children: t('componentsPolicyConfigDialog.cancel') }), jsx(Button$1, { className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white", onClick: handleSave, disabled: !config, children: t('componentsPolicyConfigDialog.saveConfiguration') })] })] }) }));
|
|
185843
185882
|
}
|
|
185844
185883
|
|
|
185845
|
-
function useDebouncedValue$
|
|
185884
|
+
function useDebouncedValue$4(value, delay) {
|
|
185846
185885
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
185847
185886
|
useEffect(() => {
|
|
185848
185887
|
const timer = window.setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -185871,7 +185910,7 @@ function ProactiveSettingsSection({ platformKey, username, isSaving, userLocalTi
|
|
|
185871
185910
|
const [isPromptDialogOpen, setIsPromptDialogOpen] = useState(false);
|
|
185872
185911
|
const customIntervalErrorId = 'proactive-custom-interval-error';
|
|
185873
185912
|
const executionTimeErrorId = 'proactive-execution-time-error';
|
|
185874
|
-
const debouncedMentorSearch = useDebouncedValue$
|
|
185913
|
+
const debouncedMentorSearch = useDebouncedValue$4(mentorSearch, 300);
|
|
185875
185914
|
const showUseLocalTimezone = periodicTimezone !== userLocalTimezone;
|
|
185876
185915
|
const shouldFetchMentors = Boolean(platformKey) && Boolean(username);
|
|
185877
185916
|
const { data: mentorsResponse, isLoading: isMentorsLoading } = useGetMentorsQuery({
|
|
@@ -185968,7 +186007,7 @@ function ProactiveSettingsSection({ platformKey, username, isSaving, userLocalTi
|
|
|
185968
186007
|
}) })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label$2, { htmlFor: "periodic-execution-time", className: "text-sm font-medium text-gray-700", children: t('componentsProactiveSettingsSection.executionTimeLabel') }), jsx(Input, { id: "periodic-execution-time", type: "time", value: periodicExecutionTime, onChange: (event) => onExecutionTimeChange(event.target.value), disabled: isSaving, "aria-invalid": isExecutionTimeMissing, "aria-describedby": isExecutionTimeMissing ? executionTimeErrorId : undefined }), renderTimezoneNotice(t('componentsProactiveSettingsSection.chooseWhenNotice'))] })] })), periodicFrequency !== 'CUSTOM' && (jsxs("div", { className: "space-y-2", children: [jsx(Label$2, { htmlFor: "periodic-execution-time", className: "text-sm font-medium text-gray-700", children: t('componentsProactiveSettingsSection.executionTimeLabel') }), jsx(Input, { id: "periodic-execution-time", type: "time", value: periodicExecutionTime, onChange: (event) => onExecutionTimeChange(event.target.value), disabled: isSaving }), renderTimezoneNotice(t('componentsProactiveSettingsSection.optionalChooseWhenNotice'))] })), isProactiveInvalid && (jsxs("div", { className: "space-y-1", "aria-live": "polite", children: [isCustomIntervalMissing && (jsx("p", { id: customIntervalErrorId, className: "text-sm text-red-600", role: "alert", children: t('componentsProactiveSettingsSection.customIntervalError') })), isExecutionTimeMissing && (jsx("p", { id: executionTimeErrorId, className: "text-sm text-red-600", role: "alert", children: t('componentsProactiveSettingsSection.executionTimeError') }))] })), jsxs("div", { className: "space-y-2", children: [jsx(Label$2, { className: "text-sm font-medium text-gray-700", htmlFor: "periodic-mentors", children: t('componentsProactiveSettingsSection.periodicAgentsLabel') }), jsx(SearchableMultiSelect, { items: mentorOptions, selectedItems: selectedMentors, onSelectionChange: handleMentorSelectionChange, searchQuery: mentorSearch, onSearchChange: setMentorSearch, isLoading: isMentorsLoading, placeholder: t('componentsProactiveSettingsSection.searchAgentsPlaceholder'), getItemValue: (mentor) => mentor.unique_id, getItemLabel: (mentor) => mentor.name ? `${mentor.name} (${mentor.unique_id})` : mentor.unique_id, onSelectedItemAction: handleEditMentorPrompt, selectedItemActionIcon: jsx(SquarePen, { className: "h-3 w-3", "aria-hidden": "true" }), selectedItemActionAriaLabel: t('componentsProactiveSettingsSection.editAgentPromptAriaLabel'), inputId: "periodic-mentors", ariaDescribedBy: "periodic-mentors-help", className: "max-w-full" }), jsx("p", { id: "periodic-mentors-help", className: "text-xs text-gray-500", children: t('componentsProactiveSettingsSection.periodicAgentsHelp') })] })] }), jsx(MentorPromptDialog, { open: isPromptDialogOpen, onOpenChange: setIsPromptDialogOpen, mentor: activePromptMentor, initialPrompt: activePromptMentor ? ((_b = mentorPrompts[activePromptMentor.id]) !== null && _b !== void 0 ? _b : '') : '', onSave: handlePromptSave })] }));
|
|
185969
186008
|
}
|
|
185970
186009
|
|
|
185971
|
-
function useDebouncedValue$
|
|
186010
|
+
function useDebouncedValue$3(value, delay) {
|
|
185972
186011
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
185973
186012
|
useEffect(() => {
|
|
185974
186013
|
const timer = window.setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -186000,7 +186039,7 @@ function PolicyAssignmentSection({ platformKey, isSaving, notifyOnAssignment, on
|
|
|
186000
186039
|
const [isPolicyConfigDialogOpen, setIsPolicyConfigDialogOpen] = useState(false);
|
|
186001
186040
|
// Track the last initialized data to detect when new data arrives
|
|
186002
186041
|
const lastInitializedRef = useRef('');
|
|
186003
|
-
const debouncedPolicySearch = useDebouncedValue$
|
|
186042
|
+
const debouncedPolicySearch = useDebouncedValue$3(policySearch, 300);
|
|
186004
186043
|
const shouldFetchPolicies = Boolean(platformKey);
|
|
186005
186044
|
const { data: policiesResponse, isLoading: isPoliciesLoading } = useGetRbacPoliciesQuery({ platformKey }, { skip: !shouldFetchPolicies });
|
|
186006
186045
|
const policyOptions = useMemo(() => {
|
|
@@ -186095,7 +186134,7 @@ function PolicyAssignmentSection({ platformKey, isSaving, notifyOnAssignment, on
|
|
|
186095
186134
|
return (jsxs(Fragment$1, { children: [jsxs("div", { className: "space-y-4 border-t border-gray-200 pt-4", children: [jsxs("div", { className: "space-y-1", children: [jsx("h3", { className: "text-sm font-semibold text-gray-900", children: t('componentsPolicyAssignmentSection.sectionTitle') }), jsx("p", { className: "text-xs text-gray-500", children: t('componentsPolicyAssignmentSection.sectionDescription') })] }), jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [jsxs("div", { className: "flex items-center space-x-2", children: [jsx(Checkbox, { id: "policy-notify-assignment", checked: notifyOnAssignment, onCheckedChange: (checked) => onNotifyOnAssignmentChange(checked === true), disabled: isSaving }), jsx(Label$2, { htmlFor: "policy-notify-assignment", className: "text-sm font-medium text-gray-700 cursor-pointer", children: t('componentsPolicyAssignmentSection.notifyOnAssignment') })] }), jsxs("div", { className: "flex items-center space-x-2", children: [jsx(Checkbox, { id: "policy-notify-removal", checked: notifyOnRemoval, onCheckedChange: (checked) => onNotifyOnRemovalChange(checked === true), disabled: isSaving }), jsx(Label$2, { htmlFor: "policy-notify-removal", className: "text-sm font-medium text-gray-700 cursor-pointer", children: t('componentsPolicyAssignmentSection.notifyOnRemoval') })] })] }), jsxs("div", { className: "space-y-2", children: [jsx(Label$2, { className: "text-sm font-medium text-gray-700", htmlFor: "enabled-policies", children: t('componentsPolicyAssignmentSection.enabledPoliciesLabel') }), jsx(SearchableMultiSelect, { items: policyOptions, selectedItems: selectedPolicies, onSelectionChange: handlePolicySelectionChange, searchQuery: policySearch, onSearchChange: setPolicySearch, isLoading: isPoliciesLoading, placeholder: t('componentsPolicyAssignmentSection.searchPlaceholder'), getItemValue: (policy) => String(policy.id), getItemLabel: (policy) => { var _a; return (((_a = policy.role) === null || _a === void 0 ? void 0 : _a.name) ? `${policy.name}` : policy.name); }, onSelectedItemAction: handleEditPolicyConfig, selectedItemActionIcon: jsx(SquarePen, { className: "h-3 w-3", "aria-hidden": "true" }), selectedItemActionAriaLabel: t('componentsPolicyAssignmentSection.editPolicyAriaLabel'), inputId: "enabled-policies", ariaDescribedBy: "enabled-policies-help", className: "max-w-full" }), jsx("p", { id: "enabled-policies-help", className: "text-xs text-gray-500", children: t('componentsPolicyAssignmentSection.enabledPoliciesHelp') })] })] }), jsx(PolicyConfigDialog, { open: isPolicyConfigDialogOpen, onOpenChange: setIsPolicyConfigDialogOpen, config: activePolicyConfig, onSave: handlePolicyConfigSave })] }));
|
|
186096
186135
|
}
|
|
186097
186136
|
|
|
186098
|
-
function useDebouncedValue$
|
|
186137
|
+
function useDebouncedValue$2(value, delay) {
|
|
186099
186138
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
186100
186139
|
useEffect(() => {
|
|
186101
186140
|
const timer = window.setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -186164,9 +186203,9 @@ function HumanSupportSection({ platformKey, isSaving, recipientMode, onRecipient
|
|
|
186164
186203
|
// Track the last initialized data to detect when new data arrives
|
|
186165
186204
|
const lastInitializedRef = useRef('');
|
|
186166
186205
|
// Debounced search values
|
|
186167
|
-
const debouncedUserSearch = useDebouncedValue$
|
|
186168
|
-
const debouncedGroupSearch = useDebouncedValue$
|
|
186169
|
-
const debouncedPolicySearch = useDebouncedValue$
|
|
186206
|
+
const debouncedUserSearch = useDebouncedValue$2(userSearch, 300);
|
|
186207
|
+
const debouncedGroupSearch = useDebouncedValue$2(groupSearch, 300);
|
|
186208
|
+
const debouncedPolicySearch = useDebouncedValue$2(policySearch, 300);
|
|
186170
186209
|
const shouldFetch = Boolean(platformKey);
|
|
186171
186210
|
// Fetch users
|
|
186172
186211
|
const { data: usersResponse, isLoading: isUsersLoading } = usePlatformUsersQuery({
|
|
@@ -187804,10 +187843,41 @@ const formatDateToShortFormat$2 = (dateString, isToday = false) => {
|
|
|
187804
187843
|
return date.toLocaleDateString([], { month: 'short', day: 'numeric', timeZone: 'UTC' });
|
|
187805
187844
|
};
|
|
187806
187845
|
|
|
187846
|
+
const AnalyticsScopeContext = createContext({ scopedMentor: null });
|
|
187847
|
+
const AnalyticsScopeProvider = AnalyticsScopeContext.Provider;
|
|
187848
|
+
/** Read the analytics agent scope. `scopedMentor` is `null` outside a provider. */
|
|
187849
|
+
function useAnalyticsScope() {
|
|
187850
|
+
return useContext(AnalyticsScopeContext);
|
|
187851
|
+
}
|
|
187852
|
+
/**
|
|
187853
|
+
* The agent a container should report on, in precedence order:
|
|
187854
|
+
*
|
|
187855
|
+
* 1. `selectedMentorId` — an agent the host explicitly switched to.
|
|
187856
|
+
* 2. `mentorId` — the agent in the route, on a per-agent analytics page.
|
|
187857
|
+
* 3. The picker's scope, which only exists on tenant-wide pages.
|
|
187858
|
+
*
|
|
187859
|
+
* The picker comes last so it can never override a host that already knows
|
|
187860
|
+
* which agent the page is about; on those pages `AnalyticsLayout` doesn't
|
|
187861
|
+
* render the picker at all. An empty string is the tenant-wide mode every
|
|
187862
|
+
* analytics hook already understands.
|
|
187863
|
+
*/
|
|
187864
|
+
function useScopedMentorId(selectedMentorId, mentorId) {
|
|
187865
|
+
const { scopedMentor } = useAnalyticsScope();
|
|
187866
|
+
return selectedMentorId || mentorId || (scopedMentor === null || scopedMentor === void 0 ? void 0 : scopedMentor.uniqueId) || '';
|
|
187867
|
+
}
|
|
187868
|
+
/**
|
|
187869
|
+
* The database id matching {@link useScopedMentorId}, for the endpoints that
|
|
187870
|
+
* key off the primary key instead of `unique_id`.
|
|
187871
|
+
*/
|
|
187872
|
+
function useScopedMentorDbId(selectedMentorDbId) {
|
|
187873
|
+
const { scopedMentor } = useAnalyticsScope();
|
|
187874
|
+
return selectedMentorDbId || (scopedMentor === null || scopedMentor === void 0 ? void 0 : scopedMentor.dbId) || undefined;
|
|
187875
|
+
}
|
|
187876
|
+
|
|
187807
187877
|
function AnalyticsOverview({ tenantKey, mentorId, selectedMentorId, usergroupIds, }) {
|
|
187808
187878
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
187809
187879
|
const t = useT();
|
|
187810
|
-
const currentMentorId = selectedMentorId
|
|
187880
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
187811
187881
|
const { messageStat, topicStat, conversationStat, sessionStats, isLoadingAllStats, isLoadingUsersStats, isLoadingSessionStats, isLoadingTopicsDetailsStats, isLoadingActiveUsersStats, setSessionStatsDateFilter, usersStats, sessionStatsDateFilter, topicsDetailsStats, setTopicsDetailsStatsDateFilter, topicsDetailsStatsDateFilter, activeUsersStats, setUsersStatsDateFilter, usersStatsDateFilter, } = useOverview({ tenantKey, mentorId: currentMentorId, usergroupIds });
|
|
187812
187882
|
return (jsxs("div", { className: "space-y-8", children: [jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6", children: [jsx(StatCard, { loading: isLoadingAllStats, title: t('analyticsAnalyticsOverview.messages'), value: messageStat.stat, percentage: messageStat.percentage, description: t('analyticsAnalyticsOverview.messagesDescription') }), jsx(StatCard, { loading: isLoadingUsersStats, title: t('analyticsAnalyticsOverview.activeUsers'), value: (usersStats === null || usersStats === void 0 ? void 0 : usersStats.count) || 0, percentage: (usersStats === null || usersStats === void 0 ? void 0 : usersStats.percentage_change) || 0, description: t('analyticsAnalyticsOverview.activeUsersDescription') }), jsx(StatCard, { loading: isLoadingAllStats, title: t('analyticsAnalyticsOverview.topics'), value: topicStat.stat, percentage: topicStat.percentage, description: t('analyticsAnalyticsOverview.topicsDescription') }), jsx(StatCard, { loading: isLoadingAllStats, title: t('analyticsAnalyticsOverview.conversations'), value: conversationStat.stat, percentage: conversationStat.percentage, description: t('analyticsAnalyticsOverview.conversationsDescription') })] }), jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [jsx(ChartCardWrapper, { title: t('analyticsAnalyticsOverview.sessions'), label: t('analyticsAnalyticsOverview.sessions'), setOutsideFilters: setSessionStatsDateFilter, filters: sessionStatsDateFilter, description: t('analyticsAnalyticsOverview.sessionsChartDescription'), children: isLoadingSessionStats ? (jsx(ChartLoading, {})) : ((_a = sessionStats === null || sessionStats === void 0 ? void 0 : sessionStats.points) === null || _a === void 0 ? void 0 : _a.length) && ((_b = sessionStats === null || sessionStats === void 0 ? void 0 : sessionStats.points) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (jsxs(LineChart, { data: ((_c = sessionStats === null || sessionStats === void 0 ? void 0 : sessionStats.points) === null || _c === void 0 ? void 0 : _c.map((point) => ({
|
|
187813
187883
|
date: formatDateToShortFormat$2(point.date, sessionStatsDateFilter.activeFilter === 'today'),
|
|
@@ -187844,6 +187914,157 @@ function AnalyticsOverview({ tenantKey, mentorId, selectedMentorId, usergroupIds
|
|
|
187844
187914
|
}, cursor: { fill: 'rgba(0, 0, 0, 0.05)' }, wrapperStyle: { outline: 'none' } }), jsx(Bar, { dataKey: "value", fill: "#38A1E5", radius: [4, 4, 0, 0] })] })) : (jsx(EmptyStats, {})) }) })] }));
|
|
187845
187915
|
}
|
|
187846
187916
|
|
|
187917
|
+
/**
|
|
187918
|
+
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
187919
|
+
*
|
|
187920
|
+
* This is the low-level building block. For a higher-level hook that manages
|
|
187921
|
+
* search state, debounce, and pagination controls, use
|
|
187922
|
+
* `useAgentSearchWithPagination`.
|
|
187923
|
+
*/
|
|
187924
|
+
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
187925
|
+
var _a, _b, _c;
|
|
187926
|
+
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
187927
|
+
platform_key: tenantKey,
|
|
187928
|
+
query: query || undefined,
|
|
187929
|
+
limit,
|
|
187930
|
+
...(offset !== undefined && { offset }),
|
|
187931
|
+
...(starred !== undefined && { starred }),
|
|
187932
|
+
...(featured !== undefined && { featured }),
|
|
187933
|
+
...(category && { category }),
|
|
187934
|
+
...(subjects && { subjects }),
|
|
187935
|
+
...(llm && { llm }),
|
|
187936
|
+
...(types && { types }),
|
|
187937
|
+
...(includeMainPublicMentors !== undefined && {
|
|
187938
|
+
include_main_public_mentors: includeMainPublicMentors,
|
|
187939
|
+
}),
|
|
187940
|
+
...(orderDirection && { order_direction: orderDirection }),
|
|
187941
|
+
}, { skip: skip || !tenantKey });
|
|
187942
|
+
return {
|
|
187943
|
+
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
187944
|
+
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
187945
|
+
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
187946
|
+
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
187947
|
+
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
187948
|
+
isLoading,
|
|
187949
|
+
isFetching,
|
|
187950
|
+
refetch,
|
|
187951
|
+
};
|
|
187952
|
+
}
|
|
187953
|
+
|
|
187954
|
+
function c(e,u,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),v=useRef(),m=useRef(),d=useRef(e),g=useRef(true);d.current=e;var p="undefined"!=typeof window,w=!u&&0!==u&&p;if("function"!=typeof e)throw new TypeError("Expected a function");u=+u||0;var s=!!(c=c||{}).leading,x=!("trailing"in c)||!!c.trailing,h="maxWait"in c,y="debounceOnServer"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;useEffect(function(){return g.current=true,function(){g.current=false;}},[]);var A=useMemo(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!g.current)return false;var n=r-a.current;return !a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f);}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null;},A.isPending=function(){return !!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(n,t,a){var o=i,f=useRef(n),l=useState({})[1],v=c(useCallback(function(r){f.current=r,l({});},[l]),t,a),m=useRef(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}
|
|
187955
|
+
|
|
187956
|
+
/**
|
|
187957
|
+
* Higher-level agent search hook that manages search state, debounce, and
|
|
187958
|
+
* pagination controls on top of `useAgentSearch`.
|
|
187959
|
+
*
|
|
187960
|
+
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
187961
|
+
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
187962
|
+
*/
|
|
187963
|
+
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
187964
|
+
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
187965
|
+
const [debouncedQuery] = a(searchQuery, debounceMs);
|
|
187966
|
+
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
187967
|
+
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
187968
|
+
// Reset pagination when search changes
|
|
187969
|
+
React__default.useEffect(() => {
|
|
187970
|
+
setCurrentPage(1);
|
|
187971
|
+
setInfiniteLimit(itemsPerPage);
|
|
187972
|
+
}, [debouncedQuery, itemsPerPage]);
|
|
187973
|
+
const isPaginated = paginationMode === 'paginated';
|
|
187974
|
+
const result = useAgentSearch({
|
|
187975
|
+
...queryConfig,
|
|
187976
|
+
query: debouncedQuery,
|
|
187977
|
+
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
187978
|
+
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
187979
|
+
});
|
|
187980
|
+
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
187981
|
+
const handlePageChange = React__default.useCallback((page) => {
|
|
187982
|
+
setCurrentPage(page);
|
|
187983
|
+
}, []);
|
|
187984
|
+
const loadMore = React__default.useCallback(() => {
|
|
187985
|
+
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
187986
|
+
}, [itemsPerPage]);
|
|
187987
|
+
return {
|
|
187988
|
+
...result,
|
|
187989
|
+
searchQuery,
|
|
187990
|
+
setSearchQuery,
|
|
187991
|
+
debouncedQuery,
|
|
187992
|
+
currentPage,
|
|
187993
|
+
totalPages,
|
|
187994
|
+
handlePageChange,
|
|
187995
|
+
loadMore,
|
|
187996
|
+
};
|
|
187997
|
+
}
|
|
187998
|
+
|
|
187999
|
+
const AGENTS_PAGE_SIZE = 20;
|
|
188000
|
+
const SEARCH_DEBOUNCE_MS$1 = 300;
|
|
188001
|
+
/** cmdk needs a non-empty value; the handler treats this one as "clear". */
|
|
188002
|
+
const ALL_AGENTS_VALUE = '__all_agents__';
|
|
188003
|
+
function useDebouncedValue$1(value, delay) {
|
|
188004
|
+
const [debounced, setDebounced] = useState(value);
|
|
188005
|
+
useEffect(() => {
|
|
188006
|
+
const timer = setTimeout(() => setDebounced(value), delay);
|
|
188007
|
+
return () => clearTimeout(timer);
|
|
188008
|
+
}, [value, delay]);
|
|
188009
|
+
return debounced;
|
|
188010
|
+
}
|
|
188011
|
+
/**
|
|
188012
|
+
* Scope selector for tenant-wide analytics: either the whole platform, or a
|
|
188013
|
+
* single agent found by typing. Tenant-wide analytics has no agent in the
|
|
188014
|
+
* route, so this is the only way to drill into one without changing pages.
|
|
188015
|
+
*
|
|
188016
|
+
* The list is served by the agent-search endpoint and is not filtered again
|
|
188017
|
+
* client-side — searching is how you reach anything past the first
|
|
188018
|
+
* {@link AGENTS_PAGE_SIZE} results.
|
|
188019
|
+
*/
|
|
188020
|
+
function AnalyticsAgentPicker({ tenantKey, value, onChange, className, }) {
|
|
188021
|
+
const t = useT();
|
|
188022
|
+
const [open, setOpen] = useState(false);
|
|
188023
|
+
const [search, setSearch] = useState('');
|
|
188024
|
+
const debouncedSearch = useDebouncedValue$1(search, SEARCH_DEBOUNCE_MS$1);
|
|
188025
|
+
// Skipped until the popover opens, so merely landing on an analytics page
|
|
188026
|
+
// doesn't fire an agent search nobody asked for.
|
|
188027
|
+
const { agents, isFetching } = useAgentSearch({
|
|
188028
|
+
tenantKey,
|
|
188029
|
+
query: debouncedSearch,
|
|
188030
|
+
limit: AGENTS_PAGE_SIZE,
|
|
188031
|
+
skip: !open,
|
|
188032
|
+
});
|
|
188033
|
+
const results = useMemo(
|
|
188034
|
+
// `unique_id` is what the analytics endpoints filter on. A result without
|
|
188035
|
+
// one would produce a selection that silently reports on everything.
|
|
188036
|
+
() => agents.filter((agent) => !!agent.unique_id), [agents]);
|
|
188037
|
+
const handleSelect = (mentor) => {
|
|
188038
|
+
onChange(mentor);
|
|
188039
|
+
setOpen(false);
|
|
188040
|
+
// Re-opening starts from the unfiltered list rather than a stale query.
|
|
188041
|
+
setSearch('');
|
|
188042
|
+
};
|
|
188043
|
+
return (jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1
|
|
188044
|
+
// Ghost rather than outline: the picker sits in the tab strip's own
|
|
188045
|
+
// background, so it carries no chrome of its own until hovered.
|
|
188046
|
+
, {
|
|
188047
|
+
// Ghost rather than outline: the picker sits in the tab strip's own
|
|
188048
|
+
// background, so it carries no chrome of its own until hovered.
|
|
188049
|
+
variant: "ghost", role: "combobox", "aria-expanded": open, "aria-label": t('analyticsAnalyticsAgentPicker.analyticsScope'), className: cn(
|
|
188050
|
+
// Capped so a long agent name ellipsizes instead of pushing the tab
|
|
188051
|
+
// strip along; the label below is what actually truncates.
|
|
188052
|
+
'h-9 max-w-[220px] justify-between bg-transparent pl-2 font-normal', className), children: [jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [value ? (jsxs(Avatar, { className: "h-5 w-5 shrink-0", children: [jsx(AvatarImage, { src: value.profileImage, alt: "" }), jsx(AvatarFallback, { className: "text-[10px]", children: value.name.charAt(0).toUpperCase() })] })) : (jsx(Globe, { className: "h-4 w-4 shrink-0 opacity-70", "aria-hidden": "true" })), jsx("span", { className: "min-w-0 truncate", children: value ? value.name : t('analyticsAnalyticsAgentPicker.allAgents') })] }), jsx(ChevronDown, { className: "h-4 w-4 shrink-0 opacity-50", "aria-hidden": "true" })] }) }), jsx(PopoverContent, { "data-iblai-dialog-interaction-layer": true, className: "z-[60] w-[280px] p-0", align: "start", children: jsxs(Command, { shouldFilter: false, children: [jsx(CommandInput, { value: search, onValueChange: setSearch, placeholder: t('analyticsAnalyticsAgentPicker.searchAgents') }), jsxs(CommandList, { children: [jsx(CommandGroup, { children: jsxs(CommandItem, { value: ALL_AGENTS_VALUE, onSelect: () => handleSelect(null), children: [jsx(Check, { className: cn('mr-2 h-4 w-4', value ? 'opacity-0' : 'opacity-100') }), jsx(Globe, { className: "mr-2 h-4 w-4 opacity-70", "aria-hidden": "true" }), t('analyticsAnalyticsAgentPicker.allAgents')] }) }), results.length > 0 && (jsx(CommandGroup, { heading: t('analyticsAnalyticsAgentPicker.agents'), children: results.map((agent) => {
|
|
188053
|
+
var _a;
|
|
188054
|
+
const uniqueId = agent.unique_id;
|
|
188055
|
+
return (jsxs(CommandItem, {
|
|
188056
|
+
// cmdk keys items by value; the search itself is server-side.
|
|
188057
|
+
value: uniqueId, onSelect: () => handleSelect({
|
|
188058
|
+
uniqueId,
|
|
188059
|
+
// Search returns the DB id as a number, but every
|
|
188060
|
+
// consumer downstream types it as a string.
|
|
188061
|
+
dbId: String(agent.id),
|
|
188062
|
+
name: agent.name,
|
|
188063
|
+
profileImage: agent.profile_image,
|
|
188064
|
+
}), children: [jsx(Check, { className: cn('mr-2 h-4 w-4', (value === null || value === void 0 ? void 0 : value.uniqueId) === uniqueId ? 'opacity-100' : 'opacity-0') }), jsxs(Avatar, { className: "mr-2 h-5 w-5 shrink-0", children: [jsx(AvatarImage, { src: agent.profile_image, alt: "" }), jsx(AvatarFallback, { className: "text-[10px]", children: (_a = agent.name) === null || _a === void 0 ? void 0 : _a.charAt(0).toUpperCase() })] }), jsx("span", { className: "truncate", children: agent.name })] }, uniqueId));
|
|
188065
|
+
}) })), isFetching && results.length === 0 && (jsx("div", { className: "px-3 py-4 text-center text-sm text-gray-500", children: t('analyticsAnalyticsAgentPicker.loading') })), !isFetching && results.length === 0 && (jsx("div", { className: "px-3 py-4 text-center text-sm text-gray-500", children: t('analyticsAnalyticsAgentPicker.noAgentsFound') }))] })] }) })] }));
|
|
188066
|
+
}
|
|
188067
|
+
|
|
187847
188068
|
const defaultTabs = [
|
|
187848
188069
|
{
|
|
187849
188070
|
label: 'Overview',
|
|
@@ -187887,9 +188108,29 @@ const defaultTabs = [
|
|
|
187887
188108
|
},*/
|
|
187888
188109
|
];
|
|
187889
188110
|
const className = 'inline-flex items-center justify-center whitespace-nowrap rounded-[5px] px-2 sm:px-2.5 pt-1 pb-0.5 sm:text-sm text-gray-500 ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-blue-600 data-[state=active]:font-semibold text-sm font-medium data-[state=active]:bg-[#f5f7fb] data-[state=active]:shadow-none cursor-pointer';
|
|
187890
|
-
function AnalyticsLayout({ children, currentPath, basePath, onTabChange, tabs = defaultTabs, activeTabClassName = '', beforeDataReports, excludeTabs = [], }) {
|
|
188111
|
+
function AnalyticsLayout({ children, currentPath, basePath, onTabChange, tabs = defaultTabs, activeTabClassName = '', beforeDataReports, excludeTabs = [], showPicker = false, tenantKey, scopedMentor, onScopedMentorChange, }) {
|
|
188112
|
+
var _a, _b;
|
|
187891
188113
|
const { currentTenant } = useCurrentTenant();
|
|
187892
188114
|
const rbacPermissions = useSelector(selectRbacPermissions);
|
|
188115
|
+
// Deliberately its own state rather than whatever the host already tracks as
|
|
188116
|
+
// "the agent in context": reusing that would silently scope every chart to
|
|
188117
|
+
// the last agent the user chatted with, with nothing on screen saying why.
|
|
188118
|
+
// The trade-off is that it resets on reload — a host that needs it shareable
|
|
188119
|
+
// controls the value instead.
|
|
188120
|
+
const [internalScopedMentor, setInternalScopedMentor] = useState(null);
|
|
188121
|
+
const isScopeControlled = onScopedMentorChange !== undefined;
|
|
188122
|
+
const activeScopedMentor = (_a = (isScopeControlled ? scopedMentor : internalScopedMentor)) !== null && _a !== void 0 ? _a : null;
|
|
188123
|
+
const handleScopedMentorChange = useCallback((mentor) => {
|
|
188124
|
+
if (isScopeControlled) {
|
|
188125
|
+
onScopedMentorChange === null || onScopedMentorChange === void 0 ? void 0 : onScopedMentorChange(mentor);
|
|
188126
|
+
return;
|
|
188127
|
+
}
|
|
188128
|
+
setInternalScopedMentor(mentor);
|
|
188129
|
+
}, [isScopeControlled, onScopedMentorChange]);
|
|
188130
|
+
const scopeValue = useMemo(
|
|
188131
|
+
// Only a rendered picker may scope the page — otherwise a host that stops
|
|
188132
|
+
// showing it would leave a stale agent filtering every chart.
|
|
188133
|
+
() => ({ scopedMentor: showPicker ? activeScopedMentor : null }), [showPicker, activeScopedMentor]);
|
|
187893
188134
|
// Only a pure watcher narrows the tab strip — everyone else keeps whatever
|
|
187894
188135
|
// the caller passed, custom tabs included.
|
|
187895
188136
|
const isRestricted = isPureWatcher(rbacPermissions, currentTenant);
|
|
@@ -187959,12 +188200,12 @@ function AnalyticsLayout({ children, currentPath, basePath, onTabChange, tabs =
|
|
|
187959
188200
|
return;
|
|
187960
188201
|
onTabChange(tabValue);
|
|
187961
188202
|
};
|
|
187962
|
-
return (jsxs("div", { className: "flex flex-col flex-1 min-h-0 h-full overflow-hidden overscroll-none bg-[#f5f7fb]", children: [jsx("div", { className: "p-6 pb-0 pt-4 xs:pt-0", children: jsx("div", { className: "flex items-center justify-between mb-4 xs:mb-2", children: jsxs("div", { className: "flex items-center justify-between w-full overflow-x-auto", children: [jsx(Tabs, { className: "bg-[#f5f7fb]", value: activeTab, children: jsx(TabsList, { className: "bg-[#f5f7fb]", children: tabs
|
|
187963
|
-
|
|
187964
|
-
|
|
187965
|
-
|
|
187966
|
-
|
|
187967
|
-
|
|
188203
|
+
return (jsx(AnalyticsScopeProvider, { value: scopeValue, children: jsxs("div", { className: "flex flex-col flex-1 min-h-0 h-full overflow-hidden overscroll-none bg-[#f5f7fb]", children: [jsx("div", { className: "p-6 pb-0 pt-4 xs:pt-0", children: jsx("div", { className: "flex items-center justify-between mb-4 xs:mb-2", children: jsxs("div", { className: "flex items-center justify-between w-full overflow-x-auto", children: [jsxs("div", { className: "flex items-center gap-3", children: [showPicker && (jsx("div", { className: "shrink-0", children: jsx(AnalyticsAgentPicker, { tenantKey: (_b = tenantKey !== null && tenantKey !== void 0 ? tenantKey : currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.key) !== null && _b !== void 0 ? _b : '', value: activeScopedMentor, onChange: handleScopedMentorChange }) })), jsx(Tabs, { className: "bg-[#f5f7fb]", value: activeTab, children: jsx(TabsList, { className: "bg-[#f5f7fb]", children: tabs
|
|
188204
|
+
.filter((tab) => !excludeTabs.includes(tab.value) && canAccessTab(tab.value))
|
|
188205
|
+
.map((tab) => {
|
|
188206
|
+
const isActive = activeTab === tab.value;
|
|
188207
|
+
return (jsx(TabsTrigger, { value: tab.value, className: cn(className, isActive && activeTabClassName), onClick: () => handleTabClick(tab.value), children: tab.label }, tab.value));
|
|
188208
|
+
}) }) })] }), jsxs("div", { className: "flex items-center gap-4", children: [beforeDataReports, canAccessTab('reports') && (jsx(Tabs, { className: "bg-[#f5f7fb]", value: activeTab, children: jsx(TabsList, { className: "bg-[#f5f7fb]", children: jsx(TabsTrigger, { value: "reports", className: cn(className, activeTab === 'reports' && activeTabClassName), onClick: () => handleTabClick('reports'), children: "Data Reports" }) }) }))] })] }) }) }), jsx("div", { className: "flex-1 overflow-auto overscroll-contain scrollbar-none px-6 pb-6 pt-0", children: isActiveTabAllowed ? children : null })] }) }));
|
|
187968
188209
|
}
|
|
187969
188210
|
|
|
187970
188211
|
const accessTimeData = [
|
|
@@ -188186,7 +188427,7 @@ const formatRelativeTime$1 = (dateString, t) => {
|
|
|
188186
188427
|
function AnalyticsUsersStats({ tenantKey, mentorId, selectedMentorId, usergroupIds, }) {
|
|
188187
188428
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
188188
188429
|
const t = useT();
|
|
188189
|
-
const currentMentorId = selectedMentorId
|
|
188430
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
188190
188431
|
const { registeredUsers, isLoadingRegisteredUsers, activeUsers, isLoadingActiveUsers, setActiveUsersStatsDateFilter, activeUsersStatsDateFilter, accessTimeHeatmap, isLoadingAccessTimeHeatmap, setAccessTimeHeatmapDateFilter, accessTimeHeatmapDateFilter, userDetailsStats, isLoadingUserDetailsStats, setUserDetailsStatsDateFilter, userDetailsStatsDateFilter, setUserDetailsStatsPage, userDetailsStatsSearch, handleSearchInputChange, currentlyActiveUsers, isLoadingCurrentlyActiveUsers, activeUsers30D, isLoadingActiveUsers30D, } = useUsers({ tenantKey, mentorId: currentMentorId, usergroupIds });
|
|
188191
188432
|
return (jsxs("div", { className: "space-y-8", children: [jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-6", children: [jsx(StatCard, { title: t('analyticsAnalyticsUsersStats.usersLoggedInNow'), value: (currentlyActiveUsers === null || currentlyActiveUsers === void 0 ? void 0 : currentlyActiveUsers.count) || 0, loading: isLoadingCurrentlyActiveUsers, description: t('analyticsAnalyticsUsersStats.usersLoggedInNowDescription') }), jsx(StatCard, { title: t('analyticsAnalyticsUsersStats.usersLoggedInPast30Days'), value: (activeUsers30D === null || activeUsers30D === void 0 ? void 0 : activeUsers30D.count) || 0, loading: isLoadingActiveUsers30D, description: t('analyticsAnalyticsUsersStats.usersLoggedInPast30DaysDescription') }), jsx(StatCard, { title: t('analyticsAnalyticsUsersStats.totalRegisteredUsers'), value: (registeredUsers === null || registeredUsers === void 0 ? void 0 : registeredUsers.count) || 0, loading: isLoadingRegisteredUsers, description: t('analyticsAnalyticsUsersStats.totalRegisteredUsersDescription') })] }), jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [jsx(ChartCardWrapper, { title: t('analyticsAnalyticsUsersStats.activeUsersTitle'), label: t('analyticsAnalyticsUsersStats.activeUsersLabel'), filters: activeUsersStatsDateFilter, setOutsideFilters: setActiveUsersStatsDateFilter, description: t('analyticsAnalyticsUsersStats.activeUsersChartDescription'), children: isLoadingActiveUsers ? (jsx(ChartLoading, {})) : ((_a = activeUsers === null || activeUsers === void 0 ? void 0 : activeUsers.points) === null || _a === void 0 ? void 0 : _a.length) && ((_b = activeUsers === null || activeUsers === void 0 ? void 0 : activeUsers.points) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (jsxs(BarChart, { data: (_c = activeUsers === null || activeUsers === void 0 ? void 0 : activeUsers.points) === null || _c === void 0 ? void 0 : _c.map((point) => ({
|
|
188192
188433
|
date: formatDateToShortFormat$2(point.date, activeUsersStatsDateFilter.activeFilter === 'today'),
|
|
@@ -188292,7 +188533,7 @@ const useTopics = ({ tenantKey, mentorId, usergroupIds, }) => {
|
|
|
188292
188533
|
function AnalyticsTopicsStats({ tenantKey, mentorId, selectedMentorId, usergroupIds, }) {
|
|
188293
188534
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
188294
188535
|
const t = useT();
|
|
188295
|
-
const currentMentorId = selectedMentorId
|
|
188536
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
188296
188537
|
const { topicsStats, isLoadingTopicsStats, conversationsStats, isLoadingConversationsStats, conversationsStatsDateFilter, setConversationsStatsDateFilter, averageRatingStats, averageRatingDateFilter, setAverageRatingDateFilter, topicsDetailsStats, isLoadingTopicsDetailsStats, topicsDetailsDateFilter, setTopicsDetailsDateFilter, } = useTopics({ tenantKey, mentorId: currentMentorId, usergroupIds });
|
|
188297
188538
|
const averageRatingDisplayed = ((_a = averageRatingStats === null || averageRatingStats === void 0 ? void 0 : averageRatingStats.points) === null || _a === void 0 ? void 0 : _a.length) && ((_b = averageRatingStats === null || averageRatingStats === void 0 ? void 0 : averageRatingStats.points) === null || _b === void 0 ? void 0 : _b.length) > 0;
|
|
188298
188539
|
return (jsxs("div", { className: "space-y-8", children: [jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-6", children: [jsx(StatCard, { title: t('analyticsAnalyticsTopicsStats.topics'), value: ((_c = topicsStats === null || topicsStats === void 0 ? void 0 : topicsStats.topics) === null || _c === void 0 ? void 0 : _c.this_month) || 0, loading: isLoadingTopicsStats, percentage: ((_d = topicsStats === null || topicsStats === void 0 ? void 0 : topicsStats.topics) === null || _d === void 0 ? void 0 : _d.percentage_change) || 0, description: t('analyticsAnalyticsTopicsStats.topicsDescription') }), jsx(StatCard, { title: t('analyticsAnalyticsTopicsStats.conversations'), value: ((_e = topicsStats === null || topicsStats === void 0 ? void 0 : topicsStats.conversations) === null || _e === void 0 ? void 0 : _e.this_month) || 0, loading: isLoadingTopicsStats, percentage: ((_f = topicsStats === null || topicsStats === void 0 ? void 0 : topicsStats.conversations) === null || _f === void 0 ? void 0 : _f.percentage_change) || 0, description: t('analyticsAnalyticsTopicsStats.conversationsDescription') }), jsx(StatCard, { title: t('analyticsAnalyticsTopicsStats.messages'), value: ((_g = topicsStats === null || topicsStats === void 0 ? void 0 : topicsStats.messages) === null || _g === void 0 ? void 0 : _g.this_month) || 0, loading: isLoadingTopicsStats, percentage: ((_h = topicsStats === null || topicsStats === void 0 ? void 0 : topicsStats.messages) === null || _h === void 0 ? void 0 : _h.percentage_change) || 0, description: t('analyticsAnalyticsTopicsStats.messagesDescription') })] }), jsxs("div", { className: cn('grid grid-cols-1 lg:grid-cols-2 gap-5', !averageRatingDisplayed ? 'lg:grid-cols-1' : ''), children: [jsx(ChartCardWrapper, { title: t('analyticsAnalyticsTopicsStats.conversations'), label: t('analyticsAnalyticsTopicsStats.conversations'), filters: conversationsStatsDateFilter, setOutsideFilters: setConversationsStatsDateFilter, description: t('analyticsAnalyticsTopicsStats.conversationsChartDescription'), children: isLoadingConversationsStats ? (jsx(ChartLoading, {})) : ((_j = conversationsStats === null || conversationsStats === void 0 ? void 0 : conversationsStats.points) === null || _j === void 0 ? void 0 : _j.length) && ((_k = conversationsStats === null || conversationsStats === void 0 ? void 0 : conversationsStats.points) === null || _k === void 0 ? void 0 : _k.length) > 0 ? (jsxs(LineChart, { data: (_l = conversationsStats === null || conversationsStats === void 0 ? void 0 : conversationsStats.points) === null || _l === void 0 ? void 0 : _l.map((point) => ({
|
|
@@ -188508,7 +188749,7 @@ const useFinancial = ({ tenantKey, mentorId, usergroupIds, }) => {
|
|
|
188508
188749
|
function AnalyticsFinancialStats({ tenantKey, mentorId, selectedMentorId, usergroupIds, }) {
|
|
188509
188750
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
188510
188751
|
const t = useT();
|
|
188511
|
-
const currentMentorId = selectedMentorId
|
|
188752
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
188512
188753
|
const { weeklyCostData, isLoadingWeeklyCostData, monthlyCostData, isLoadingMonthlyCostData, totalCostData, isLoadingTotalCostData, detailedCostPerDayData, isLoadingDetailedCostPerDayData, detailedCostPerDayFilters, setDetailedCostPerDayFilters, detailedCostPerProviderData, isLoadingDetailedCostPerProviderData, detailedCostPerProviderFilters, setDetailedCostPerProviderFilters, detailedCostPerUserData, isLoadingDetailedCostPerUserData, detailedCostPerUserFilters, setDetailedCostPerUserFilters, costPerUserPage, setCostPerUserPage, costPerUserLimit, providerColors, detailedLLMCostData, isLoadingDetailedLLMCostData, detailedLLMCostFilters, setDetailedLLMCostFilters, } = useFinancial({ tenantKey, mentorId: currentMentorId, usergroupIds });
|
|
188513
188754
|
// Pagination handlers
|
|
188514
188755
|
const handleFirstPage = () => {
|
|
@@ -223207,7 +223448,7 @@ const getMessageContent = (content) => {
|
|
|
223207
223448
|
function AnalyticsTranscriptsStats({ tenantKey, mentorId, selectedMentorId, usergroupIds, }) {
|
|
223208
223449
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
223209
223450
|
const t = useT();
|
|
223210
|
-
const currentMentorId = selectedMentorId
|
|
223451
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
223211
223452
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
223212
223453
|
const searchParams = useSearchParams();
|
|
223213
223454
|
const router = useRouter();
|
|
@@ -223820,6 +224061,8 @@ function AnalyticsReports({ tenantKey, selectedMentorId, disabledReports = [], u
|
|
|
223820
224061
|
const t = useT();
|
|
223821
224062
|
const { currentTenant } = useCurrentTenant();
|
|
223822
224063
|
const rbacPermissions = useSelector(selectRbacPermissions);
|
|
224064
|
+
const scopedMentorId = useScopedMentorId(selectedMentorId);
|
|
224065
|
+
const scopedMentorDbId = useScopedMentorDbId(selectedMentorDbId);
|
|
223823
224066
|
const { metadata } = useTenantMetadata({ org: tenantKey });
|
|
223824
224067
|
//we using metadata to get the combined recommendation reports
|
|
223825
224068
|
//"combined_recommendation_reports": "Recommendation History Report,Course Grade Report,User Group Member List Report",
|
|
@@ -223831,9 +224074,11 @@ function AnalyticsReports({ tenantKey, selectedMentorId, disabledReports = [], u
|
|
|
223831
224074
|
}, [metadata === null || metadata === void 0 ? void 0 : metadata.combined_recommendation_reports, metadata === null || metadata === void 0 ? void 0 : metadata.enable_combined_recommendation_report]);
|
|
223832
224075
|
const { reports, isLoading, initializeReportDownload, activeReportName, isGenerating } = useReports({
|
|
223833
224076
|
tenantKey,
|
|
223834
|
-
|
|
224077
|
+
// Reports keys off both ids: `unique_id` for the agent's public settings,
|
|
224078
|
+
// and the database id for the `mentor_id` filter on the report list.
|
|
224079
|
+
selectedMentorId: scopedMentorId,
|
|
223835
224080
|
usergroupIds,
|
|
223836
|
-
selectedMentorDbId,
|
|
224081
|
+
selectedMentorDbId: scopedMentorDbId,
|
|
223837
224082
|
});
|
|
223838
224083
|
const [fetchReportBlob] = useLazyGetDownloadReportFromURLQuery();
|
|
223839
224084
|
const fetchAuthenticatedContent = useCallback(async (url) => {
|
|
@@ -224579,7 +224824,7 @@ function AnalyticsCourses({ tenantKey, mentorId, selectedMentorId, basePath = ''
|
|
|
224579
224824
|
var _a, _b, _c, _d;
|
|
224580
224825
|
const t = useT();
|
|
224581
224826
|
const router = useRouter();
|
|
224582
|
-
const currentMentorId = selectedMentorId
|
|
224827
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
224583
224828
|
const { courseStats, isLoading, enrollmentStats, enrollmentStatsDateFilter, setEnrollmentStatsDateFilter, coursesList, setCoursesListPage, coursesListSearch, handleSearchInputChange, coursesPagination, } = useCourses({ tenantKey, mentorId: currentMentorId });
|
|
224584
224829
|
const handleCourseClick = (courseId) => {
|
|
224585
224830
|
router.push(`${basePath}/courses/${courseId}`);
|
|
@@ -224631,7 +224876,7 @@ function AnalyticsCourses({ tenantKey, mentorId, selectedMentorId, basePath = ''
|
|
|
224631
224876
|
function AnalyticsCourseDetail({ tenantKey, mentorId, selectedMentorId, courseId, courseName, showCourseTitle = true, onBack, }) {
|
|
224632
224877
|
var _a, _b;
|
|
224633
224878
|
const t = useT();
|
|
224634
|
-
const currentMentorId = selectedMentorId
|
|
224879
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
224635
224880
|
const { courseDetailStats, isLoading, courseEnrollments, courseEnrollmentsSearch, handleCourseEnrollmentsSearchInputChange, setCourseEnrollmentsPage, courseEnrollmentsPagination, courseInfo, } = useCourses({
|
|
224636
224881
|
tenantKey,
|
|
224637
224882
|
mentorId: currentMentorId,
|
|
@@ -224938,7 +225183,7 @@ function AnalyticsPrograms({ tenantKey, mentorId, selectedMentorId, basePath = '
|
|
|
224938
225183
|
var _a, _b, _c, _d;
|
|
224939
225184
|
const t = useT();
|
|
224940
225185
|
const router = useRouter();
|
|
224941
|
-
const currentMentorId = selectedMentorId
|
|
225186
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
224942
225187
|
const { programStats, isLoading, enrollmentStats, enrollmentStatsDateFilter, setEnrollmentStatsDateFilter, programsList, setProgramsListPage, programsListSearch, handleSearchInputChange, programsPagination, } = usePrograms({ tenantKey, mentorId: currentMentorId });
|
|
224943
225188
|
const handleProgramClick = (programId) => {
|
|
224944
225189
|
router.push(`${basePath}/programs/${programId}`);
|
|
@@ -224990,7 +225235,7 @@ function AnalyticsPrograms({ tenantKey, mentorId, selectedMentorId, basePath = '
|
|
|
224990
225235
|
function AnalyticsProgramDetail({ tenantKey, mentorId, selectedMentorId, programId, programName, onBack, }) {
|
|
224991
225236
|
var _a, _b;
|
|
224992
225237
|
const t = useT();
|
|
224993
|
-
const currentMentorId = selectedMentorId
|
|
225238
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
224994
225239
|
const { programDetailStats, isLoading, programEnrollments, programEnrollmentsSearch, handleProgramEnrollmentsSearchInputChange, setProgramEnrollmentsPage, programEnrollmentsPagination, programInfo, } = usePrograms({
|
|
224995
225240
|
tenantKey,
|
|
224996
225241
|
mentorId: currentMentorId,
|
|
@@ -225930,7 +226175,7 @@ function summarizeChanges(entry) {
|
|
|
225930
226175
|
function AgentAuditLogView({ tenantKey, mentorId, userId, selectedMentorId, }) {
|
|
225931
226176
|
var _a;
|
|
225932
226177
|
const t = useT();
|
|
225933
|
-
const currentMentorId = selectedMentorId
|
|
226178
|
+
const currentMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
225934
226179
|
const [actorOpen, setActorOpen] = useState(false);
|
|
225935
226180
|
const { data, isLoading, error, page, setPage, totalPages, actionFilter, setActionFilter, actorFilter, setActorFilter, dateRange, setDateRange, } = useAuditLog({
|
|
225936
226181
|
tenantKey,
|
|
@@ -225984,88 +226229,6 @@ function AnalyticsAuditLogStats({ tenantKey, mentorId, userId, selectedMentorId,
|
|
|
225984
226229
|
: t('analyticsAnalyticsAuditLogStats.scopePlatformHint') })] })), activeScope === 'platform' ? (jsx(AnalyticsPlatformAuditLog, { platformKey: tenantKey, timezone: timezone })) : (jsx(AgentAuditLogView, { tenantKey: tenantKey, mentorId: mentorId, userId: userId, selectedMentorId: selectedMentorId }))] }));
|
|
225985
226230
|
}
|
|
225986
226231
|
|
|
225987
|
-
/**
|
|
225988
|
-
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
225989
|
-
*
|
|
225990
|
-
* This is the low-level building block. For a higher-level hook that manages
|
|
225991
|
-
* search state, debounce, and pagination controls, use
|
|
225992
|
-
* `useAgentSearchWithPagination`.
|
|
225993
|
-
*/
|
|
225994
|
-
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
225995
|
-
var _a, _b, _c;
|
|
225996
|
-
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
225997
|
-
platform_key: tenantKey,
|
|
225998
|
-
query: query || undefined,
|
|
225999
|
-
limit,
|
|
226000
|
-
...(offset !== undefined && { offset }),
|
|
226001
|
-
...(starred !== undefined && { starred }),
|
|
226002
|
-
...(featured !== undefined && { featured }),
|
|
226003
|
-
...(category && { category }),
|
|
226004
|
-
...(subjects && { subjects }),
|
|
226005
|
-
...(llm && { llm }),
|
|
226006
|
-
...(types && { types }),
|
|
226007
|
-
...(includeMainPublicMentors !== undefined && {
|
|
226008
|
-
include_main_public_mentors: includeMainPublicMentors,
|
|
226009
|
-
}),
|
|
226010
|
-
...(orderDirection && { order_direction: orderDirection }),
|
|
226011
|
-
}, { skip: skip || !tenantKey });
|
|
226012
|
-
return {
|
|
226013
|
-
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
226014
|
-
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
226015
|
-
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
226016
|
-
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
226017
|
-
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
226018
|
-
isLoading,
|
|
226019
|
-
isFetching,
|
|
226020
|
-
refetch,
|
|
226021
|
-
};
|
|
226022
|
-
}
|
|
226023
|
-
|
|
226024
|
-
function c(e,u,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),v=useRef(),m=useRef(),d=useRef(e),g=useRef(true);d.current=e;var p="undefined"!=typeof window,w=!u&&0!==u&&p;if("function"!=typeof e)throw new TypeError("Expected a function");u=+u||0;var s=!!(c=c||{}).leading,x=!("trailing"in c)||!!c.trailing,h="maxWait"in c,y="debounceOnServer"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;useEffect(function(){return g.current=true,function(){g.current=false;}},[]);var A=useMemo(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!g.current)return false;var n=r-a.current;return !a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f);}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null;},A.isPending=function(){return !!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(n,t,a){var o=i,f=useRef(n),l=useState({})[1],v=c(useCallback(function(r){f.current=r,l({});},[l]),t,a),m=useRef(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}
|
|
226025
|
-
|
|
226026
|
-
/**
|
|
226027
|
-
* Higher-level agent search hook that manages search state, debounce, and
|
|
226028
|
-
* pagination controls on top of `useAgentSearch`.
|
|
226029
|
-
*
|
|
226030
|
-
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
226031
|
-
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
226032
|
-
*/
|
|
226033
|
-
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
226034
|
-
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
226035
|
-
const [debouncedQuery] = a(searchQuery, debounceMs);
|
|
226036
|
-
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
226037
|
-
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
226038
|
-
// Reset pagination when search changes
|
|
226039
|
-
React__default.useEffect(() => {
|
|
226040
|
-
setCurrentPage(1);
|
|
226041
|
-
setInfiniteLimit(itemsPerPage);
|
|
226042
|
-
}, [debouncedQuery, itemsPerPage]);
|
|
226043
|
-
const isPaginated = paginationMode === 'paginated';
|
|
226044
|
-
const result = useAgentSearch({
|
|
226045
|
-
...queryConfig,
|
|
226046
|
-
query: debouncedQuery,
|
|
226047
|
-
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
226048
|
-
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
226049
|
-
});
|
|
226050
|
-
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
226051
|
-
const handlePageChange = React__default.useCallback((page) => {
|
|
226052
|
-
setCurrentPage(page);
|
|
226053
|
-
}, []);
|
|
226054
|
-
const loadMore = React__default.useCallback(() => {
|
|
226055
|
-
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
226056
|
-
}, [itemsPerPage]);
|
|
226057
|
-
return {
|
|
226058
|
-
...result,
|
|
226059
|
-
searchQuery,
|
|
226060
|
-
setSearchQuery,
|
|
226061
|
-
debouncedQuery,
|
|
226062
|
-
currentPage,
|
|
226063
|
-
totalPages,
|
|
226064
|
-
handlePageChange,
|
|
226065
|
-
loadMore,
|
|
226066
|
-
};
|
|
226067
|
-
}
|
|
226068
|
-
|
|
226069
226232
|
function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
|
|
226070
226233
|
const t = useT();
|
|
226071
226234
|
const { agents: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } = useAgentSearchWithPagination({ tenantKey, itemsPerPage });
|
|
@@ -226464,6 +226627,7 @@ function AgentSearchDialog({ tenantKey, open, onClose, selectedMentorId, onSelec
|
|
|
226464
226627
|
*/
|
|
226465
226628
|
function AnalyticsMemoryStats({ tenantKey, mentorId, userId, selectedMentorId, myMemory = false, }) {
|
|
226466
226629
|
const t = useT();
|
|
226630
|
+
const scopedMentorId = useScopedMentorId(selectedMentorId, mentorId);
|
|
226467
226631
|
const [selectedMemory, setSelectedMemory] = useState(null);
|
|
226468
226632
|
const [agentSearchOpen, setAgentSearchOpen] = useState(false);
|
|
226469
226633
|
// The content search is committed on Enter/blur rather than per-keystroke so
|
|
@@ -226472,7 +226636,10 @@ function AnalyticsMemoryStats({ tenantKey, mentorId, userId, selectedMentorId, m
|
|
|
226472
226636
|
const { scope, setScope, availableScopes, searchedMentor, selectSearchedMentor, rows, aggregates, categories, isLoading, error, isForbidden, page, setPage, totalPages, learnerFilter, setLearnerFilter, categoryFilter, setCategoryFilter, setContentFilter, dateRange, setDateRange, } = useMemory({
|
|
226473
226637
|
tenantKey,
|
|
226474
226638
|
userId,
|
|
226475
|
-
|
|
226639
|
+
// The agent scope picker feeds the same slot the route agent would, so the
|
|
226640
|
+
// tab's own agent search still overrides it (`searchedMentor || mentorId`)
|
|
226641
|
+
// rather than the two controls fighting over the scope.
|
|
226642
|
+
mentorId: scopedMentorId,
|
|
226476
226643
|
myMemory,
|
|
226477
226644
|
});
|
|
226478
226645
|
const scopeLabels = {
|
|
@@ -237305,5 +237472,5 @@ var trainOrDeleteModal = /*#__PURE__*/Object.freeze({
|
|
|
237305
237472
|
TrainOrDeleteModal: TrainOrDeleteModal
|
|
237306
237473
|
});
|
|
237307
237474
|
|
|
237308
|
-
export { ACCESS_COURSE_LABEL, ALL_CATEGORIES, AccessTimeHeatmap, AccessiblePaginate, AddMentorToProjectModal, AddSkillDialog, Admin, AdvancedTab, AgentConfigPrompts, AgentSkills, AlertsTab, AnalyticsAuditLogStats, AnalyticsCourseDetail, AnalyticsCourses, AnalyticsFinancialStats, AnalyticsLayout, AnalyticsMemoryStats, AnalyticsMonetizationStats, AnalyticsOverview, AnalyticsPlatformAuditLog, AnalyticsProgramDetail, AnalyticsPrograms, AnalyticsReportDownload, AnalyticsReports, AnalyticsSettingsProvider, AnalyticsTopicsStats, AnalyticsTranscriptsStats, AnalyticsUsersStats, AppleRestrictionModal, ApplyWizard, AuditLogChangesView, AuditLogJsonView, BUY_NOW_LABEL, BillingTab, CATALOGS, CREATE_AGENT_LABELS, CUA_DRIVER_REPO_URL, CUA_DRIVER_TAURI_COMMANDS, CUA_DRIVER_TAURI_EVENTS, CardInfoIcon, CategorizedDropdownMenu, ChartCardWrapper, ChartFiltersProvider, ChartLoading, ChatContext, ChatPrivacyToggle, ChatProvider, CompanyDialog, ConnectorManagementDialog, CopyButtonIcon, CourseAccessGuard, CourseCardSkeleton, CourseContentLoading, CourseOutline, CourseOutlineContext, CourseOutlineDrawer, CreateAgentForm, CreateAgentModal, CreateProjectModal, CreateWorkflowModal, CredentialBox, CredentialMiniBoxSkeleton, CredentialsList, CreditBalance, CustomDateRangePicker, CustomTooltip, DEFAULT_COWORK_REQUIRED_SIZE_GB, DEFAULT_LOCALE, DefaultEmptyBox, DeleteProjectModal, DeleteWorkflowModal, DiscoverContentCard, DiscoverFacetsFilter, DiscoverFilterDrawer, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENROLL_NOW_COURSE_STARTING_SOON_LABEL, ENROLL_NOW_LABEL, EditAlertDialog, EducationBox, EducationDialog, EducationTab, EdxIframeContext, EmptyStats, ExperienceBox, ExperienceDialog, ExperienceTab, FacetFilterContext, Footer, GradebookTab, GroupsFilterDropdown, INVITATION_ONLY_LABEL, InstitutionDialog, IntegrationsTab, InviteUserContent, InviteUserDialog, InvitedUsersDialog, LOCAL_MODELS, Loader, LocalLLMTab, LocalModelsContent, LoginButton, MACOS_PERMISSIONS_COMMANDS, MEMORY_PAGE_SIZE, Markdown, MinimumMentorAlert, MonetizationTab, NotificationDisplay, NotificationDropdown, ONBOARDING_SECTORS, OnboardingShell, OnboardingWizard, PLATFORM_AUDIT_DEEP_PAGING_THRESHOLD, PLATFORM_AUDIT_PAGE_SIZE, PaywallModal, PlacementExam, PlacementExamsDropdown, PlatformAuditLogDetailSheet, PlatformNavbar, PlatformNavbarSearch, Profile, ProfileTimeChart, ProgressDots, ProjectActionButtons, ProjectFilesModal, ProjectInstructionsModal, ProjectLandingPage, ProjectMentorsList, ProjectsPage, REQUEST_ACCESS_COURSE_STARTING_SOON_LABEL, REQUEST_ACCESS_LABEL, RenameProjectModal, ResumeBox, ResumeTab, RichTextEditor, SUPPORTED_LOCALES, SandboxConfig, SearchableMultiSelect, SendNotificationDialog, SignupButton, SkeletonActivityStatBox, SkeletonAddSkillsLoading, SkeletonCreatePathwaySearchList, SkeletonDiscoverFilterBox, SkeletonEducationBox, SkeletonMultiplier, SkeletonPathwayBox, SkeletonProfileInfoCard, SkeletonSkillBox, SkillBox, SkillDetailModal, SkillLeaderboardChart, SkillsBox, SkillsList, SlashSkillPicker, Spinner, StatCard, StepHeader, TAURI_COMMANDS, TAURI_EVENTS, TenantSwitcher, TimeFilter, TimeTrackingProvider, TimedExam, ToolDialogs, TopBanner, UpgradePackageModal, UserAvatar, Version, WebContainersI18nProvider, WorkflowSidebar, addBookmarksTab, availablePlacementExams, findLastResumeBlock, findSequentialParent, flattenVerticalBlocks, formatAuditTimestamp, formatTimeZoneLabel, getCatalog, getFirstAvailableUnit, getLocalLLMModel, getLocalLLMToolSupport, getNextUnitIframe, getOrg, getParentBlockById, getParentsInfosFromSublessonId, getPreviousUnitIframe, getRandomCourseImage, getSectorById, getTenant, getUnitToIframe, getUserId, getUserName, humanizeAuditToken, inBrowserPrint, inIframe, initialCuaDriverInstallState, initialModelDownloadState, isCoworkEnabled, isLocalLLMEnabled, isPlatformNavbarCreditBalanceVisible, isSlashCommandToken, isTauriApp, isValidLocale, isValidTimeZone, components as markdownComponents, modelSupportsCowork, onboardingPrimaryButtonClass, onboardingSecondaryButtonClass, resolveAuditTimeZone, resolveCreateAgentLabels, sanitizeCss, setCoworkEnabled, setLocalLLMEnabled, setLocalLLMModel, setLocalLLMToolSupport, smallestCoworkModel, useAnalyticsSettings, useAuditLog, useCatalogSearch, useChartFilters, useChatPrivacy, useChatState, useCourseDetail, useCourseMetadata, useCourses, useCuaDriver, useDiscover, useEdxIframe, useFinancial, useIframeMessageHandler, useLocalStorage, useMemory, useModelDownload, useMonetization, useOverview, usePlatformAuditLabels, usePlatformAuditLog, useProfileActivityStats, useProfileCredentials, useProfilePathways, useProfilePrograms, useProfileSkills, useProfileTimeSpent, usePrograms, useReports, useSlashSkillPicker, useSlashSkills, useT, useTauri, useTimeTracking, useTopics, useTranscripts, useUserCourses, useUserMetadata, useUsers, useWebContainersI18n, useWebContainersLocale };
|
|
237475
|
+
export { ACCESS_COURSE_LABEL, ALL_CATEGORIES, AccessTimeHeatmap, AccessiblePaginate, AddMentorToProjectModal, AddSkillDialog, Admin, AdvancedTab, AgentConfigPrompts, AgentSkills, AlertsTab, AnalyticsAgentPicker, AnalyticsAuditLogStats, AnalyticsCourseDetail, AnalyticsCourses, AnalyticsFinancialStats, AnalyticsLayout, AnalyticsMemoryStats, AnalyticsMonetizationStats, AnalyticsOverview, AnalyticsPlatformAuditLog, AnalyticsProgramDetail, AnalyticsPrograms, AnalyticsReportDownload, AnalyticsReports, AnalyticsScopeProvider, AnalyticsSettingsProvider, AnalyticsTopicsStats, AnalyticsTranscriptsStats, AnalyticsUsersStats, AppleRestrictionModal, ApplyWizard, AuditLogChangesView, AuditLogJsonView, BUY_NOW_LABEL, BillingTab, CATALOGS, CREATE_AGENT_LABELS, CUA_DRIVER_REPO_URL, CUA_DRIVER_TAURI_COMMANDS, CUA_DRIVER_TAURI_EVENTS, CardInfoIcon, CategorizedDropdownMenu, ChartCardWrapper, ChartFiltersProvider, ChartLoading, ChatContext, ChatPrivacyToggle, ChatProvider, CompanyDialog, ConnectorManagementDialog, CopyButtonIcon, CourseAccessGuard, CourseCardSkeleton, CourseContentLoading, CourseOutline, CourseOutlineContext, CourseOutlineDrawer, CreateAgentForm, CreateAgentModal, CreateProjectModal, CreateWorkflowModal, CredentialBox, CredentialMiniBoxSkeleton, CredentialsList, CreditBalance, CustomDateRangePicker, CustomTooltip, DEFAULT_COWORK_REQUIRED_SIZE_GB, DEFAULT_LOCALE, DefaultEmptyBox, DeleteProjectModal, DeleteWorkflowModal, DiscoverContentCard, DiscoverFacetsFilter, DiscoverFilterDrawer, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENROLL_NOW_COURSE_STARTING_SOON_LABEL, ENROLL_NOW_LABEL, EditAlertDialog, EducationBox, EducationDialog, EducationTab, EdxIframeContext, EmptyStats, ExperienceBox, ExperienceDialog, ExperienceTab, FacetFilterContext, Footer, GradebookTab, GroupsFilterDropdown, INVITATION_ONLY_LABEL, InstitutionDialog, IntegrationsTab, InviteUserContent, InviteUserDialog, InvitedUsersDialog, LOCAL_MODELS, Loader, LocalLLMTab, LocalModelsContent, LoginButton, MACOS_PERMISSIONS_COMMANDS, MEMORY_PAGE_SIZE, Markdown, MinimumMentorAlert, MonetizationTab, NotificationDisplay, NotificationDropdown, ONBOARDING_SECTORS, OnboardingShell, OnboardingWizard, PLATFORM_AUDIT_DEEP_PAGING_THRESHOLD, PLATFORM_AUDIT_PAGE_SIZE, PaywallModal, PlacementExam, PlacementExamsDropdown, PlatformAuditLogDetailSheet, PlatformNavbar, PlatformNavbarSearch, Profile, ProfileTimeChart, ProgressDots, ProjectActionButtons, ProjectFilesModal, ProjectInstructionsModal, ProjectLandingPage, ProjectMentorsList, ProjectsPage, REQUEST_ACCESS_COURSE_STARTING_SOON_LABEL, REQUEST_ACCESS_LABEL, RenameProjectModal, ResumeBox, ResumeTab, RichTextEditor, SUPPORTED_LOCALES, SandboxConfig, SearchableMultiSelect, SendNotificationDialog, SignupButton, SkeletonActivityStatBox, SkeletonAddSkillsLoading, SkeletonCreatePathwaySearchList, SkeletonDiscoverFilterBox, SkeletonEducationBox, SkeletonMultiplier, SkeletonPathwayBox, SkeletonProfileInfoCard, SkeletonSkillBox, SkillBox, SkillDetailModal, SkillLeaderboardChart, SkillsBox, SkillsList, SlashSkillPicker, Spinner, StatCard, StepHeader, TAURI_COMMANDS, TAURI_EVENTS, TenantSwitcher, TimeFilter, TimeTrackingProvider, TimedExam, ToolDialogs, TopBanner, UpgradePackageModal, UserAvatar, Version, WebContainersI18nProvider, WorkflowSidebar, addBookmarksTab, availablePlacementExams, findLastResumeBlock, findSequentialParent, flattenVerticalBlocks, formatAuditTimestamp, formatTimeZoneLabel, getCatalog, getFirstAvailableUnit, getLocalLLMModel, getLocalLLMToolSupport, getNextUnitIframe, getOrg, getParentBlockById, getParentsInfosFromSublessonId, getPreviousUnitIframe, getRandomCourseImage, getSectorById, getTenant, getUnitToIframe, getUserId, getUserName, humanizeAuditToken, inBrowserPrint, inIframe, initialCuaDriverInstallState, initialModelDownloadState, isCoworkEnabled, isLocalLLMEnabled, isPlatformNavbarCreditBalanceVisible, isSlashCommandToken, isTauriApp, isValidLocale, isValidTimeZone, components as markdownComponents, modelSupportsCowork, onboardingPrimaryButtonClass, onboardingSecondaryButtonClass, resolveAuditTimeZone, resolveCreateAgentLabels, sanitizeCss, setCoworkEnabled, setLocalLLMEnabled, setLocalLLMModel, setLocalLLMToolSupport, smallestCoworkModel, useAnalyticsScope, useAnalyticsSettings, useAuditLog, useCatalogSearch, useChartFilters, useChatPrivacy, useChatState, useCourseDetail, useCourseMetadata, useCourses, useCuaDriver, useDiscover, useEdxIframe, useFinancial, useIframeMessageHandler, useLocalStorage, useMemory, useModelDownload, useMonetization, useOverview, usePlatformAuditLabels, usePlatformAuditLog, useProfileActivityStats, useProfileCredentials, useProfilePathways, useProfilePrograms, useProfileSkills, useProfileTimeSpent, usePrograms, useReports, useScopedMentorDbId, useScopedMentorId, useSlashSkillPicker, useSlashSkills, useT, useTauri, useTimeTracking, useTopics, useTranscripts, useUserCourses, useUserMetadata, useUsers, useWebContainersI18n, useWebContainersLocale };
|
|
237309
237476
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -97462,6 +97462,14 @@ var analyticsAnalyticsAuditLogStats$3 = {
|
|
|
97462
97462
|
colAction: "ACTION",
|
|
97463
97463
|
colTime: "TIME"
|
|
97464
97464
|
};
|
|
97465
|
+
var analyticsAnalyticsAgentPicker$3 = {
|
|
97466
|
+
analyticsScope: "Analytics scope",
|
|
97467
|
+
allAgents: "All Agents",
|
|
97468
|
+
agents: "Agents",
|
|
97469
|
+
searchAgents: "Search agents…",
|
|
97470
|
+
noAgentsFound: "No agents found",
|
|
97471
|
+
loading: "Loading…"
|
|
97472
|
+
};
|
|
97465
97473
|
var analyticsAnalyticsCourseDetail$3 = {
|
|
97466
97474
|
goBackAriaLabel: "Go back to courses list",
|
|
97467
97475
|
activeEnrollments: "Active Enrollments",
|
|
@@ -103050,6 +103058,7 @@ var en = {
|
|
|
103050
103058
|
agentSearchLabels: agentSearchLabels$3,
|
|
103051
103059
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap$3,
|
|
103052
103060
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats$3,
|
|
103061
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker$3,
|
|
103053
103062
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail$3,
|
|
103054
103063
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses$3,
|
|
103055
103064
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats$3,
|
|
@@ -103926,6 +103935,14 @@ var analyticsAnalyticsAuditLogStats$2 = {
|
|
|
103926
103935
|
colAction: "ACTION",
|
|
103927
103936
|
colTime: "HEURE"
|
|
103928
103937
|
};
|
|
103938
|
+
var analyticsAnalyticsAgentPicker$2 = {
|
|
103939
|
+
analyticsScope: "Portée des analyses",
|
|
103940
|
+
allAgents: "Tous les agents",
|
|
103941
|
+
agents: "Agents",
|
|
103942
|
+
searchAgents: "Rechercher des agents…",
|
|
103943
|
+
noAgentsFound: "Aucun agent trouvé",
|
|
103944
|
+
loading: "Chargement…"
|
|
103945
|
+
};
|
|
103929
103946
|
var analyticsAnalyticsCourseDetail$2 = {
|
|
103930
103947
|
goBackAriaLabel: "Retour à la liste des cours",
|
|
103931
103948
|
activeEnrollments: "Inscriptions actives",
|
|
@@ -109514,6 +109531,7 @@ var fr = {
|
|
|
109514
109531
|
agentSearchLabels: agentSearchLabels$2,
|
|
109515
109532
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap$2,
|
|
109516
109533
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats$2,
|
|
109534
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker$2,
|
|
109517
109535
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail$2,
|
|
109518
109536
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses$2,
|
|
109519
109537
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats$2,
|
|
@@ -110390,6 +110408,14 @@ var analyticsAnalyticsAuditLogStats$1 = {
|
|
|
110390
110408
|
colAction: "ACCIÓN",
|
|
110391
110409
|
colTime: "HORA"
|
|
110392
110410
|
};
|
|
110411
|
+
var analyticsAnalyticsAgentPicker$1 = {
|
|
110412
|
+
analyticsScope: "Alcance de analíticas",
|
|
110413
|
+
allAgents: "Todos los agentes",
|
|
110414
|
+
agents: "Agentes",
|
|
110415
|
+
searchAgents: "Buscar agentes…",
|
|
110416
|
+
noAgentsFound: "No se encontraron agentes",
|
|
110417
|
+
loading: "Cargando…"
|
|
110418
|
+
};
|
|
110393
110419
|
var analyticsAnalyticsCourseDetail$1 = {
|
|
110394
110420
|
goBackAriaLabel: "Volver a la lista de cursos",
|
|
110395
110421
|
activeEnrollments: "Inscripciones activas",
|
|
@@ -115978,6 +116004,7 @@ var es = {
|
|
|
115978
116004
|
agentSearchLabels: agentSearchLabels$1,
|
|
115979
116005
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap$1,
|
|
115980
116006
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats$1,
|
|
116007
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker$1,
|
|
115981
116008
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail$1,
|
|
115982
116009
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses$1,
|
|
115983
116010
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats$1,
|
|
@@ -116854,6 +116881,14 @@ var analyticsAnalyticsAuditLogStats = {
|
|
|
116854
116881
|
colAction: "操作",
|
|
116855
116882
|
colTime: "时间"
|
|
116856
116883
|
};
|
|
116884
|
+
var analyticsAnalyticsAgentPicker = {
|
|
116885
|
+
analyticsScope: "分析范围",
|
|
116886
|
+
allAgents: "所有智能体",
|
|
116887
|
+
agents: "智能体",
|
|
116888
|
+
searchAgents: "搜索智能体…",
|
|
116889
|
+
noAgentsFound: "未找到智能体",
|
|
116890
|
+
loading: "加载中…"
|
|
116891
|
+
};
|
|
116857
116892
|
var analyticsAnalyticsCourseDetail = {
|
|
116858
116893
|
goBackAriaLabel: "返回课程列表",
|
|
116859
116894
|
activeEnrollments: "活跃注册",
|
|
@@ -122442,6 +122477,7 @@ var zh = {
|
|
|
122442
122477
|
agentSearchLabels: agentSearchLabels,
|
|
122443
122478
|
analyticsAccessTimeHeatmap: analyticsAccessTimeHeatmap,
|
|
122444
122479
|
analyticsAnalyticsAuditLogStats: analyticsAnalyticsAuditLogStats,
|
|
122480
|
+
analyticsAnalyticsAgentPicker: analyticsAnalyticsAgentPicker,
|
|
122445
122481
|
analyticsAnalyticsCourseDetail: analyticsAnalyticsCourseDetail,
|
|
122446
122482
|
analyticsAnalyticsCourses: analyticsAnalyticsCourses,
|
|
122447
122483
|
analyticsAnalyticsFinancialStats: analyticsAnalyticsFinancialStats,
|
|
@@ -181810,9 +181846,12 @@ function SubmissionDetail({ platformKey, submissionId, onBack, }) {
|
|
|
181810
181846
|
: [((_b = answers) !== null && _b !== void 0 ? _b : {})];
|
|
181811
181847
|
return (jsxs("div", { className: "rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900", children: [jsx("p", { className: "border-b border-gray-100 px-4 py-2 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:border-gray-800", children: section.title || section.key }), jsx("div", { className: "divide-y divide-gray-50 dark:divide-gray-800", children: entries.map((entry, index) => {
|
|
181812
181848
|
var _a, _b;
|
|
181813
|
-
return (jsxs("div", { className: "px-4 py-2.5", children: [section.repeatable && (jsx("p", { className: "mb-1 text-xs font-medium text-gray-400", children: t('profileApplicationsTab.entryN', { n: index + 1 }) })), jsx("dl", { className: "grid gap-x-6 gap-y-
|
|
181849
|
+
return (jsxs("div", { className: "px-4 py-2.5", children: [section.repeatable && (jsx("p", { className: "mb-1 text-xs font-medium text-gray-400", children: t('profileApplicationsTab.entryN', { n: index + 1 }) })), jsx("dl", { className: "grid gap-x-6 gap-y-3 sm:grid-cols-2", children: ((_a = section.fields) !== null && _a !== void 0 ? _a : [])
|
|
181814
181850
|
.filter((field) => field.type !== 'info')
|
|
181815
|
-
.map((field) => (jsxs("div", {
|
|
181851
|
+
.map((field) => (jsxs("div", {
|
|
181852
|
+
/* Free-text answers get the full width — they are the
|
|
181853
|
+
ones long enough to need it. */
|
|
181854
|
+
className: `min-w-0 ${field.type === 'textarea' ? 'sm:col-span-2' : ''}`, children: [jsx("dt", { className: "break-words text-xs leading-snug text-gray-500", children: field.label || field.key }), jsx("dd", { className: "mt-0.5 whitespace-pre-wrap break-words text-sm text-gray-800 dark:text-gray-200", children: masked.has(`${section.key}.${field.key}`) ? (jsxs("span", { className: "inline-flex items-center gap-1 text-gray-400", children: [jsx(EyeOff, { className: "h-3 w-3" }), t('profileApplicationsTab.maskedValue')] })) : (displayValue(field, entry[field.key], t)) })] }, field.key))) })] }, (_b = entry._id) !== null && _b !== void 0 ? _b : index));
|
|
181816
181855
|
}) })] }, section.key));
|
|
181817
181856
|
})] }), ((_l = detail.attachments) !== null && _l !== void 0 ? _l : []).length > 0 && (jsxs("section", { className: "space-y-3", children: [jsxs("h5", { className: "flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-gray-100", children: [jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-400", children: jsx(Paperclip, { className: "h-3.5 w-3.5" }) }), t('profileApplicationsTab.attachmentsHeading')] }), jsx("div", { className: "flex flex-wrap gap-2", children: ((_m = detail.attachments) !== null && _m !== void 0 ? _m : []).map((attachment) => (jsxs("button", { type: "button", onClick: () => handleDownload(attachment.id, attachment.filename), className: "inline-flex items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2.5 py-1.5 text-xs text-gray-700 shadow-sm hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800", children: [jsx(Download, { className: "h-3.5 w-3.5" }), attachment.filename || `#${attachment.id}`] }, attachment.id))) })] })), acceptedCandidates.length > 0 && (jsxs(Fragment$1, { children: [jsx(PlacementsSection, { platformKey: platformKey, submissionId: submissionId, detail: detail, candidateLabel: candidateLabel, onAdd: () => setPlacementDialogOpen(true) }), jsx(AssignmentsSection, { platformKey: platformKey, submissionId: submissionId, detail: detail, candidateLabel: candidateLabel, onAdd: () => setAssignmentDialogOpen(true), onChanged: refetch })] })), jsx(NotesSection, { platformKey: platformKey, submissionId: submissionId, detail: detail }), jsxs("section", { className: "space-y-3", children: [jsxs("h5", { className: "flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-gray-100", children: [jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-blue-100 text-blue-600 dark:bg-blue-900/40 dark:text-blue-400", children: jsx(History, { className: "h-3.5 w-3.5" }) }), t('profileApplicationsTab.auditHeading')] }), ((_o = detail.status_events) !== null && _o !== void 0 ? _o : []).length === 0 ? (jsx("p", { className: "text-sm text-gray-400", children: t('profileApplicationsTab.noEvents') })) : (jsx("ul", { className: "space-y-1.5", children: ((_p = detail.status_events) !== null && _p !== void 0 ? _p : []).map((event) => {
|
|
181818
181857
|
var _a;
|
|
@@ -218650,6 +218689,129 @@ function getPayloadConfigFromPayload(config, payload, key) {
|
|
|
218650
218689
|
|
|
218651
218690
|
React__default.createContext(undefined);
|
|
218652
218691
|
|
|
218692
|
+
const AnalyticsScopeContext = createContext({ scopedMentor: null });
|
|
218693
|
+
AnalyticsScopeContext.Provider;
|
|
218694
|
+
|
|
218695
|
+
/**
|
|
218696
|
+
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
218697
|
+
*
|
|
218698
|
+
* This is the low-level building block. For a higher-level hook that manages
|
|
218699
|
+
* search state, debounce, and pagination controls, use
|
|
218700
|
+
* `useAgentSearchWithPagination`.
|
|
218701
|
+
*/
|
|
218702
|
+
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
218703
|
+
var _a, _b, _c;
|
|
218704
|
+
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
218705
|
+
platform_key: tenantKey,
|
|
218706
|
+
query: query || undefined,
|
|
218707
|
+
limit,
|
|
218708
|
+
...(offset !== undefined && { offset }),
|
|
218709
|
+
...(starred !== undefined && { starred }),
|
|
218710
|
+
...(featured !== undefined && { featured }),
|
|
218711
|
+
...(category && { category }),
|
|
218712
|
+
...(subjects && { subjects }),
|
|
218713
|
+
...(llm && { llm }),
|
|
218714
|
+
...(types && { types }),
|
|
218715
|
+
...(includeMainPublicMentors !== undefined && {
|
|
218716
|
+
include_main_public_mentors: includeMainPublicMentors,
|
|
218717
|
+
}),
|
|
218718
|
+
...(orderDirection && { order_direction: orderDirection }),
|
|
218719
|
+
}, { skip: skip || !tenantKey });
|
|
218720
|
+
return {
|
|
218721
|
+
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
218722
|
+
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
218723
|
+
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
218724
|
+
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
218725
|
+
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
218726
|
+
isLoading,
|
|
218727
|
+
isFetching,
|
|
218728
|
+
refetch,
|
|
218729
|
+
};
|
|
218730
|
+
}
|
|
218731
|
+
|
|
218732
|
+
function c$3(e,u,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),v=useRef(),m=useRef(),d=useRef(e),g=useRef(true);d.current=e;var p="undefined"!=typeof window,w=!u&&0!==u&&p;if("function"!=typeof e)throw new TypeError("Expected a function");u=+u||0;var s=!!(c=c||{}).leading,x=!("trailing"in c)||!!c.trailing,h="maxWait"in c,y="debounceOnServer"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;useEffect(function(){return g.current=true,function(){g.current=false;}},[]);var A=useMemo(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!g.current)return false;var n=r-a.current;return !a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f);}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null;},A.isPending=function(){return !!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i$8(r,n){return r===n}function a$3(n,t,a){var o=i$8,f=useRef(n),l=useState({})[1],v=c$3(useCallback(function(r){f.current=r,l({});},[l]),t,a),m=useRef(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}
|
|
218733
|
+
|
|
218734
|
+
/**
|
|
218735
|
+
* Higher-level agent search hook that manages search state, debounce, and
|
|
218736
|
+
* pagination controls on top of `useAgentSearch`.
|
|
218737
|
+
*
|
|
218738
|
+
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
218739
|
+
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
218740
|
+
*/
|
|
218741
|
+
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
218742
|
+
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
218743
|
+
const [debouncedQuery] = a$3(searchQuery, debounceMs);
|
|
218744
|
+
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
218745
|
+
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
218746
|
+
// Reset pagination when search changes
|
|
218747
|
+
React__default.useEffect(() => {
|
|
218748
|
+
setCurrentPage(1);
|
|
218749
|
+
setInfiniteLimit(itemsPerPage);
|
|
218750
|
+
}, [debouncedQuery, itemsPerPage]);
|
|
218751
|
+
const isPaginated = paginationMode === 'paginated';
|
|
218752
|
+
const result = useAgentSearch({
|
|
218753
|
+
...queryConfig,
|
|
218754
|
+
query: debouncedQuery,
|
|
218755
|
+
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
218756
|
+
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
218757
|
+
});
|
|
218758
|
+
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
218759
|
+
const handlePageChange = React__default.useCallback((page) => {
|
|
218760
|
+
setCurrentPage(page);
|
|
218761
|
+
}, []);
|
|
218762
|
+
const loadMore = React__default.useCallback(() => {
|
|
218763
|
+
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
218764
|
+
}, [itemsPerPage]);
|
|
218765
|
+
return {
|
|
218766
|
+
...result,
|
|
218767
|
+
searchQuery,
|
|
218768
|
+
setSearchQuery,
|
|
218769
|
+
debouncedQuery,
|
|
218770
|
+
currentPage,
|
|
218771
|
+
totalPages,
|
|
218772
|
+
handlePageChange,
|
|
218773
|
+
loadMore,
|
|
218774
|
+
};
|
|
218775
|
+
}
|
|
218776
|
+
|
|
218777
|
+
/**
|
|
218778
|
+
* Hook for starring / un-starring agents.
|
|
218779
|
+
*
|
|
218780
|
+
* Extracted so the star logic can be shared by any component that renders
|
|
218781
|
+
* agent cards with a favorite toggle.
|
|
218782
|
+
*/
|
|
218783
|
+
function useAgentStar({ tenantKey, username, onUnauthenticatedAction, }) {
|
|
218784
|
+
const [starAgent] = useStarMentorMutation();
|
|
218785
|
+
const [unstarAgent] = useUnstarMentorMutation();
|
|
218786
|
+
const [togglingAgentId, setTogglingAgentId] = React__default.useState(null);
|
|
218787
|
+
const toggleFavorite = React__default.useCallback(async (agent, event) => {
|
|
218788
|
+
event.stopPropagation();
|
|
218789
|
+
if (!username) {
|
|
218790
|
+
onUnauthenticatedAction === null || onUnauthenticatedAction === void 0 ? void 0 : onUnauthenticatedAction();
|
|
218791
|
+
return;
|
|
218792
|
+
}
|
|
218793
|
+
if (!tenantKey)
|
|
218794
|
+
return;
|
|
218795
|
+
setTogglingAgentId(String(agent.id));
|
|
218796
|
+
try {
|
|
218797
|
+
const mutation = agent.starred ? unstarAgent : starAgent;
|
|
218798
|
+
await mutation({
|
|
218799
|
+
org: tenantKey,
|
|
218800
|
+
// @ts-expect-error userId param type mismatch in data-layer
|
|
218801
|
+
userId: username,
|
|
218802
|
+
mentor: agent.unique_id || '',
|
|
218803
|
+
}).unwrap();
|
|
218804
|
+
}
|
|
218805
|
+
catch (error) {
|
|
218806
|
+
console.error('Error toggling favorite:', error);
|
|
218807
|
+
}
|
|
218808
|
+
finally {
|
|
218809
|
+
setTogglingAgentId(null);
|
|
218810
|
+
}
|
|
218811
|
+
}, [username, tenantKey, starAgent, unstarAgent, onUnauthenticatedAction]);
|
|
218812
|
+
return { toggleFavorite, togglingAgentId };
|
|
218813
|
+
}
|
|
218814
|
+
|
|
218653
218815
|
Array.from({ length: 24 }, (_, i) => i);
|
|
218654
218816
|
|
|
218655
218817
|
/**
|
|
@@ -253186,126 +253348,6 @@ function SheetDescription({ className, ...props }) {
|
|
|
253186
253348
|
return (jsx(DialogPrimitive.Description, { "data-slot": "sheet-description", className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
253187
253349
|
}
|
|
253188
253350
|
|
|
253189
|
-
/**
|
|
253190
|
-
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
253191
|
-
*
|
|
253192
|
-
* This is the low-level building block. For a higher-level hook that manages
|
|
253193
|
-
* search state, debounce, and pagination controls, use
|
|
253194
|
-
* `useAgentSearchWithPagination`.
|
|
253195
|
-
*/
|
|
253196
|
-
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
253197
|
-
var _a, _b, _c;
|
|
253198
|
-
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
253199
|
-
platform_key: tenantKey,
|
|
253200
|
-
query: query || undefined,
|
|
253201
|
-
limit,
|
|
253202
|
-
...(offset !== undefined && { offset }),
|
|
253203
|
-
...(starred !== undefined && { starred }),
|
|
253204
|
-
...(featured !== undefined && { featured }),
|
|
253205
|
-
...(category && { category }),
|
|
253206
|
-
...(subjects && { subjects }),
|
|
253207
|
-
...(llm && { llm }),
|
|
253208
|
-
...(types && { types }),
|
|
253209
|
-
...(includeMainPublicMentors !== undefined && {
|
|
253210
|
-
include_main_public_mentors: includeMainPublicMentors,
|
|
253211
|
-
}),
|
|
253212
|
-
...(orderDirection && { order_direction: orderDirection }),
|
|
253213
|
-
}, { skip: skip || !tenantKey });
|
|
253214
|
-
return {
|
|
253215
|
-
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
253216
|
-
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
253217
|
-
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
253218
|
-
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
253219
|
-
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
253220
|
-
isLoading,
|
|
253221
|
-
isFetching,
|
|
253222
|
-
refetch,
|
|
253223
|
-
};
|
|
253224
|
-
}
|
|
253225
|
-
|
|
253226
|
-
function c$3(e,u,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),v=useRef(),m=useRef(),d=useRef(e),g=useRef(true);d.current=e;var p="undefined"!=typeof window,w=!u&&0!==u&&p;if("function"!=typeof e)throw new TypeError("Expected a function");u=+u||0;var s=!!(c=c||{}).leading,x=!("trailing"in c)||!!c.trailing,h="maxWait"in c,y="debounceOnServer"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;useEffect(function(){return g.current=true,function(){g.current=false;}},[]);var A=useMemo(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!g.current)return false;var n=r-a.current;return !a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f);}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null;},A.isPending=function(){return !!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i$8(r,n){return r===n}function a$3(n,t,a){var o=i$8,f=useRef(n),l=useState({})[1],v=c$3(useCallback(function(r){f.current=r,l({});},[l]),t,a),m=useRef(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}
|
|
253227
|
-
|
|
253228
|
-
/**
|
|
253229
|
-
* Higher-level agent search hook that manages search state, debounce, and
|
|
253230
|
-
* pagination controls on top of `useAgentSearch`.
|
|
253231
|
-
*
|
|
253232
|
-
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
253233
|
-
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
253234
|
-
*/
|
|
253235
|
-
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
253236
|
-
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
253237
|
-
const [debouncedQuery] = a$3(searchQuery, debounceMs);
|
|
253238
|
-
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
253239
|
-
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
253240
|
-
// Reset pagination when search changes
|
|
253241
|
-
React__default.useEffect(() => {
|
|
253242
|
-
setCurrentPage(1);
|
|
253243
|
-
setInfiniteLimit(itemsPerPage);
|
|
253244
|
-
}, [debouncedQuery, itemsPerPage]);
|
|
253245
|
-
const isPaginated = paginationMode === 'paginated';
|
|
253246
|
-
const result = useAgentSearch({
|
|
253247
|
-
...queryConfig,
|
|
253248
|
-
query: debouncedQuery,
|
|
253249
|
-
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
253250
|
-
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
253251
|
-
});
|
|
253252
|
-
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
253253
|
-
const handlePageChange = React__default.useCallback((page) => {
|
|
253254
|
-
setCurrentPage(page);
|
|
253255
|
-
}, []);
|
|
253256
|
-
const loadMore = React__default.useCallback(() => {
|
|
253257
|
-
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
253258
|
-
}, [itemsPerPage]);
|
|
253259
|
-
return {
|
|
253260
|
-
...result,
|
|
253261
|
-
searchQuery,
|
|
253262
|
-
setSearchQuery,
|
|
253263
|
-
debouncedQuery,
|
|
253264
|
-
currentPage,
|
|
253265
|
-
totalPages,
|
|
253266
|
-
handlePageChange,
|
|
253267
|
-
loadMore,
|
|
253268
|
-
};
|
|
253269
|
-
}
|
|
253270
|
-
|
|
253271
|
-
/**
|
|
253272
|
-
* Hook for starring / un-starring agents.
|
|
253273
|
-
*
|
|
253274
|
-
* Extracted so the star logic can be shared by any component that renders
|
|
253275
|
-
* agent cards with a favorite toggle.
|
|
253276
|
-
*/
|
|
253277
|
-
function useAgentStar({ tenantKey, username, onUnauthenticatedAction, }) {
|
|
253278
|
-
const [starAgent] = useStarMentorMutation();
|
|
253279
|
-
const [unstarAgent] = useUnstarMentorMutation();
|
|
253280
|
-
const [togglingAgentId, setTogglingAgentId] = React__default.useState(null);
|
|
253281
|
-
const toggleFavorite = React__default.useCallback(async (agent, event) => {
|
|
253282
|
-
event.stopPropagation();
|
|
253283
|
-
if (!username) {
|
|
253284
|
-
onUnauthenticatedAction === null || onUnauthenticatedAction === void 0 ? void 0 : onUnauthenticatedAction();
|
|
253285
|
-
return;
|
|
253286
|
-
}
|
|
253287
|
-
if (!tenantKey)
|
|
253288
|
-
return;
|
|
253289
|
-
setTogglingAgentId(String(agent.id));
|
|
253290
|
-
try {
|
|
253291
|
-
const mutation = agent.starred ? unstarAgent : starAgent;
|
|
253292
|
-
await mutation({
|
|
253293
|
-
org: tenantKey,
|
|
253294
|
-
// @ts-expect-error userId param type mismatch in data-layer
|
|
253295
|
-
userId: username,
|
|
253296
|
-
mentor: agent.unique_id || '',
|
|
253297
|
-
}).unwrap();
|
|
253298
|
-
}
|
|
253299
|
-
catch (error) {
|
|
253300
|
-
console.error('Error toggling favorite:', error);
|
|
253301
|
-
}
|
|
253302
|
-
finally {
|
|
253303
|
-
setTogglingAgentId(null);
|
|
253304
|
-
}
|
|
253305
|
-
}, [username, tenantKey, starAgent, unstarAgent, onUnauthenticatedAction]);
|
|
253306
|
-
return { toggleFavorite, togglingAgentId };
|
|
253307
|
-
}
|
|
253308
|
-
|
|
253309
253351
|
function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
|
|
253310
253352
|
const t = useT();
|
|
253311
253353
|
const { agents: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } = useAgentSearchWithPagination({ tenantKey, itemsPerPage });
|
|
@@ -267938,6 +267980,13 @@ function ConnectorManagementContent({ tenantKey, username, mentorId, rbacPermiss
|
|
|
267938
267980
|
}).unwrap();
|
|
267939
267981
|
if (!result.auth_url)
|
|
267940
267982
|
throw new Error('No authorization URL returned');
|
|
267983
|
+
// Bail if the flow was already torn down while we awaited the auth URL
|
|
267984
|
+
// (e.g. the component unmounted). `cleanup` has run and been dropped
|
|
267985
|
+
// from `oauthCleanupsRef`, so anything registered past this point —
|
|
267986
|
+
// listeners, intervals, timers — would leak with nothing left to
|
|
267987
|
+
// remove it.
|
|
267988
|
+
if (cleanedUp)
|
|
267989
|
+
return;
|
|
267941
267990
|
const popup = window.open(result.auth_url, '_blank');
|
|
267942
267991
|
// Create connection using helper function
|
|
267943
267992
|
const doCreateConnection = async (connectedServiceId) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iblai/iblai-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Unified JavaScript SDK for IBL.ai — re-exports data-layer, web-containers, and web-utils under a single package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"axios": "1.13.6",
|
|
77
77
|
"dotenv": "16.6.1",
|
|
78
78
|
"winston": "3.19.0",
|
|
79
|
+
"@iblai/web-containers": "1.17.1",
|
|
80
|
+
"@iblai/mcp": "1.9.0",
|
|
79
81
|
"@iblai/data-layer": "1.12.5",
|
|
80
|
-
"@iblai/mcp": "1.8.13",
|
|
81
|
-
"@iblai/web-containers": "1.16.12",
|
|
82
82
|
"@iblai/web-utils": "2.1.13"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|