@nivaro/react 0.2.53 → 0.2.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +452 -4
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +252 -2
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/FormWhatsNew.js +60 -0
- package/dist/shared/components/ItemEditForm.js +3968 -3618
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +598 -543
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/TipLayer.js +27 -27
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +80 -67
- package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +382 -320
- package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
- package/dist/shared/components/item-edit/GroupSection.js +786 -639
- package/dist/shared/components/item-edit/HeaderTools.js +59 -56
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +94 -0
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
- package/dist/shared/components/layout-editor/AddPanel.js +226 -151
- package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
- package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
- package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
- package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
- package/dist/shared/components/layout-editor/CollabParts.js +175 -0
- package/dist/shared/components/layout-editor/DesignNode.js +311 -116
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
- package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
- package/dist/shared/components/layout-editor/FindReplace.js +188 -0
- package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
- package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
- package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
- package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
- package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
- package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
- package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
- package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
- package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
- package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
- package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
- package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
- package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
- package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
- package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
- package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
- package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
- package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
- package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
- package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
- package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
- package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
- package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
- package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
- package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
- package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
- package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
- package/dist/shared/components/layout-editor/assist/jump.js +142 -0
- package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
- package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
- package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
- package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
- package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
- package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
- package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
- package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
- package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
- package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
- package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
- package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
- package/dist/shared/components/layout-editor/commands/intents.js +214 -0
- package/dist/shared/components/layout-editor/commands/parse.js +242 -0
- package/dist/shared/components/layout-editor/design-context.js +26 -6
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
- package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
- package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
- package/dist/shared/components/layout-editor/editor-notes.js +78 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
- package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
- package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
- package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
- package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
- package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
- package/dist/shared/components/layout-editor/field-zones.js +116 -0
- package/dist/shared/components/layout-editor/form-map.js +138 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/history-api.js +87 -0
- package/dist/shared/components/layout-editor/inheritance.js +55 -0
- package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
- package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
- package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
- package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
- package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
- package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
- package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
- package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
- package/dist/shared/components/layout-editor/is-typing.js +9 -0
- package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
- package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
- package/dist/shared/components/layout-editor/load-error.js +37 -0
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
- package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
- package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
- package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
- package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
- package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
- package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
- package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
- package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
- package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
- package/dist/shared/components/layout-editor/nav/find.js +20 -0
- package/dist/shared/components/layout-editor/nav/tree.js +142 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
- package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
- package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
- package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
- package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
- package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
- package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
- package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/panel-style.js +8 -7
- package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
- package/dist/shared/components/layout-editor/pin.js +25 -0
- package/dist/shared/components/layout-editor/presence.js +111 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
- package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
- package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
- package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
- package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
- package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
- package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
- package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
- package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
- package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
- package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
- package/dist/shared/components/layout-editor/settings/controls.js +8 -8
- package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
- package/dist/shared/components/layout-editor/shortcuts.js +88 -0
- package/dist/shared/components/layout-editor/show-when.js +35 -0
- package/dist/shared/components/layout-editor/slot-names.js +4 -3
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +403 -0
- package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
- package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
- package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
- package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
- package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
- package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SuggestFormChange.js +143 -0
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/ai-fill.js +37 -0
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +133 -0
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-i18n.js +66 -0
- package/dist/shared/lib/layout-lint.js +490 -0
- package/dist/shared/lib/layout-ops.js +116 -110
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/screenshot.js +54 -28
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/visible-when.js +34 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -59,7 +59,7 @@ function J({ id: d }) {
|
|
|
59
59
|
}
|
|
60
60
|
function te() {
|
|
61
61
|
var L, R, B;
|
|
62
|
-
const d = C(), [s, n] = g(168), [o, i] = g(""), [l, $] = g(""), [x,
|
|
62
|
+
const d = C(), [s, n] = g(168), [o, i] = g(""), [l, $] = g(""), [x, S] = g(""), [h, b] = g(1), [v, D] = g(null), F = _({
|
|
63
63
|
queryKey: ["nvr-ai-analytics", s],
|
|
64
64
|
queryFn: () => d.request(w("/ai/analytics", { hours: s })),
|
|
65
65
|
refetchInterval: 6e4
|
|
@@ -76,7 +76,7 @@ function te() {
|
|
|
76
76
|
})
|
|
77
77
|
),
|
|
78
78
|
placeholderData: (t) => t
|
|
79
|
-
}), a = (L =
|
|
79
|
+
}), a = (L = F.data) == null ? void 0 : L.data, M = ((R = k.data) == null ? void 0 : R.data) ?? [], A = ((B = k.data) == null ? void 0 : B.total) ?? 0, I = Math.max(1, Math.ceil(A / 50));
|
|
80
80
|
return /* @__PURE__ */ r("div", { className: "flex flex-col gap-4", "data-ai-analytics": !0, children: [
|
|
81
81
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
82
82
|
/* @__PURE__ */ e("div", { className: "inline-flex rounded-md border border-border p-0.5", children: H.map((t) => /* @__PURE__ */ e(
|
|
@@ -99,7 +99,7 @@ function te() {
|
|
|
99
99
|
{
|
|
100
100
|
type: "button",
|
|
101
101
|
onClick: () => {
|
|
102
|
-
|
|
102
|
+
F.refetch(), k.refetch();
|
|
103
103
|
},
|
|
104
104
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-[12px] text-muted-foreground hover:bg-muted",
|
|
105
105
|
children: [
|
|
@@ -264,7 +264,7 @@ function te() {
|
|
|
264
264
|
"button",
|
|
265
265
|
{
|
|
266
266
|
type: "button",
|
|
267
|
-
onClick: () =>
|
|
267
|
+
onClick: () => S(""),
|
|
268
268
|
className: "rounded bg-nvr-cyan/15 px-1.5 py-0.5 text-[11px]",
|
|
269
269
|
children: [
|
|
270
270
|
"question ",
|
|
@@ -325,7 +325,7 @@ function te() {
|
|
|
325
325
|
className: "ml-1 text-[10.5px] text-muted-foreground underline-offset-2 hover:underline",
|
|
326
326
|
"data-tip": "Show every call of this question",
|
|
327
327
|
onClick: (q) => {
|
|
328
|
-
q.stopPropagation(),
|
|
328
|
+
q.stopPropagation(), S(t.request_id ?? ""), b(1);
|
|
329
329
|
},
|
|
330
330
|
children: [
|
|
331
331
|
"#",
|
|
@@ -335,7 +335,17 @@ function te() {
|
|
|
335
335
|
) : null
|
|
336
336
|
] }),
|
|
337
337
|
/* @__PURE__ */ e("td", { className: "max-w-[160px] truncate px-2 py-1.5", children: t.user_name ?? (t.user ? "…" : "System") }),
|
|
338
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ r("td", { className: "px-2 py-1.5 font-mono text-[11px]", children: [
|
|
339
|
+
t.model,
|
|
340
|
+
t.tier && /* @__PURE__ */ e(
|
|
341
|
+
"span",
|
|
342
|
+
{
|
|
343
|
+
className: "ml-1.5 rounded bg-muted px-1 py-px font-sans text-[10px] text-muted-foreground",
|
|
344
|
+
"data-tip": t.tier === "cheap" ? "Started cheap: the small model" : `Moved up to the main model${t.tier_reason ? ` (${t.tier_reason.replace(/_/g, " ")})` : ""}`,
|
|
345
|
+
children: t.tier === "cheap" ? "quick" : "moved up"
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
] }),
|
|
339
349
|
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: u(t.input_tokens) }),
|
|
340
350
|
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-muted-foreground", children: u(t.cache_read_tokens) }),
|
|
341
351
|
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: u(t.output_tokens) }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as he } from "@tanstack/react-query";
|
|
3
|
-
import { FileText as re, Rows3 as xe, ListChecks as be, LayoutDashboard as ge, Paperclip as
|
|
4
|
-
import { useState as c, useEffect as
|
|
3
|
+
import { FileText as re, Rows3 as xe, ListChecks as be, LayoutDashboard as ge, Paperclip as L, Sparkles as ye, ExternalLink as ve, Plus as ke, X as ne, Loader2 as oe, Square as Ne, Send as we } from "lucide-react";
|
|
4
|
+
import { useState as c, useEffect as y, useRef as R } from "react";
|
|
5
5
|
import { createPortal as Ae } from "react-dom";
|
|
6
6
|
import { useNivaroClient as $e, useNavigation as Ce } from "../../context.js";
|
|
7
7
|
import { get as De } from "../../lib/commands.js";
|
|
@@ -10,119 +10,127 @@ import { cn as se } from "../../lib/utils.js";
|
|
|
10
10
|
import { AiFeedbackButtons as qe } from "./AiFeedbackButtons.js";
|
|
11
11
|
import { AiMarkdown as ae } from "./AiMarkdown.js";
|
|
12
12
|
import { AiStepList as Ee } from "./AiStepList.js";
|
|
13
|
-
import { useAskHost as le, readDroppedRecord as Se, askContextBody as
|
|
14
|
-
const
|
|
13
|
+
import { useAskHost as le, readDroppedRecord as Se, askContextBody as Oe } from "./ask-context.js";
|
|
14
|
+
const Te = ".pdf,.docx,.xlsx,.xls,.xlsm,.csv,.txt,.md,.eml,.html,.htm", Ie = 20, q = 5;
|
|
15
15
|
function We({
|
|
16
|
-
subscribe:
|
|
17
|
-
connected:
|
|
18
|
-
askPath:
|
|
16
|
+
subscribe: E,
|
|
17
|
+
connected: S,
|
|
18
|
+
askPath: O = "/ask"
|
|
19
19
|
}) {
|
|
20
|
-
const s = le(), [
|
|
21
|
-
return
|
|
20
|
+
const s = le(), [p, T] = c(!1);
|
|
21
|
+
return y(() => {
|
|
22
22
|
s != null && s.open && T(!0);
|
|
23
|
-
}, [s == null ? void 0 : s.open]), !s || !
|
|
24
|
-
/* @__PURE__ */ t(je, { subscribe:
|
|
23
|
+
}, [s == null ? void 0 : s.open]), !s || !p || typeof document > "u" ? null : Ae(
|
|
24
|
+
/* @__PURE__ */ t(je, { subscribe: E, connected: S, askPath: O }),
|
|
25
25
|
document.body
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
function je({
|
|
29
|
-
subscribe:
|
|
30
|
-
connected:
|
|
31
|
-
askPath:
|
|
29
|
+
subscribe: E,
|
|
30
|
+
connected: S,
|
|
31
|
+
askPath: O
|
|
32
32
|
}) {
|
|
33
33
|
var Z, ee, te;
|
|
34
|
-
const s = le(),
|
|
34
|
+
const s = le(), p = $e(), { navigate: T } = Ce(), n = s.page, [h, v] = c([]), [k, N] = c(""), [I, M] = c(null), [x, B] = c(/* @__PURE__ */ new Set()), [Q, j] = c([]), [w, _] = c([]), [P, z] = c(0), [X, J] = c([]), [U, F] = c(!1), [W, g] = c(null), H = R(null), K = R(null), G = R(null), V = R(null);
|
|
35
35
|
V.current = I;
|
|
36
|
-
const ie = JSON.stringify(
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const ie = JSON.stringify(n ?? {});
|
|
37
|
+
y(() => {
|
|
38
|
+
B(/* @__PURE__ */ new Set()), J([]);
|
|
39
39
|
}, [ie]);
|
|
40
40
|
const ce = ((Z = s.seed) == null ? void 0 : Z.at) ?? 0;
|
|
41
|
-
|
|
41
|
+
y(() => {
|
|
42
42
|
var e;
|
|
43
|
-
(e = s.seed) != null && e.question &&
|
|
44
|
-
}, [ce]),
|
|
43
|
+
(e = s.seed) != null && e.question && N(s.seed.question);
|
|
44
|
+
}, [ce]), y(() => {
|
|
45
45
|
var e;
|
|
46
|
-
s.open && ((e =
|
|
46
|
+
s.open && ((e = H.current) == null || e.focus());
|
|
47
47
|
}, [s.open]);
|
|
48
|
-
const d =
|
|
48
|
+
const d = n != null && n.record && !x.has("record") ? n.record : null, { data: A } = he({
|
|
49
49
|
queryKey: ["ask-panel-record-files", d == null ? void 0 : d.collection, d == null ? void 0 : d.id],
|
|
50
|
-
queryFn: () =>
|
|
50
|
+
queryFn: () => p.request(
|
|
51
51
|
De("/ai/ask/record-files", { collection: d.collection, id: d.id })
|
|
52
52
|
).then((e) => e.data),
|
|
53
53
|
enabled: !!d,
|
|
54
54
|
staleTime: 6e4,
|
|
55
55
|
retry: !1
|
|
56
|
-
}), l = Re(
|
|
57
|
-
subscribe:
|
|
58
|
-
connected:
|
|
56
|
+
}), l = Re(p, {
|
|
57
|
+
subscribe: E,
|
|
58
|
+
connected: S,
|
|
59
59
|
onDone: (e) => {
|
|
60
|
-
v((
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
v((r) => {
|
|
61
|
+
var o;
|
|
62
|
+
return [
|
|
63
|
+
...r,
|
|
64
|
+
{
|
|
65
|
+
role: "assistant",
|
|
66
|
+
content: e.reply,
|
|
67
|
+
requestId: e.request_id ?? null,
|
|
68
|
+
stopped: e.stopped === !0,
|
|
69
|
+
quick: ((o = e.routing) == null ? void 0 : o.tier) === "cheap"
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
}), e.conversation_id && M(e.conversation_id);
|
|
69
73
|
},
|
|
70
74
|
onError: (e) => {
|
|
71
|
-
|
|
75
|
+
g(e || "Ask AI failed"), v((r) => r.slice(0, -1));
|
|
72
76
|
}
|
|
73
77
|
});
|
|
74
|
-
|
|
78
|
+
y(() => {
|
|
75
79
|
var e;
|
|
76
80
|
(e = K.current) == null || e.scrollTo({ top: K.current.scrollHeight });
|
|
77
|
-
}, [
|
|
78
|
-
const
|
|
79
|
-
function
|
|
80
|
-
const o = (e ??
|
|
81
|
+
}, [h.length, l.text, l.steps.length]);
|
|
82
|
+
const b = ((ee = [...h].reverse().find((e) => e.role === "user")) == null ? void 0 : ee.content) ?? "";
|
|
83
|
+
function $(e, r = {}) {
|
|
84
|
+
const o = (e ?? k).trim();
|
|
81
85
|
if (!o || l.active) return;
|
|
82
|
-
|
|
83
|
-
const a =
|
|
84
|
-
dismissed:
|
|
86
|
+
g(null), v((m) => [...m, { role: "user", content: o }]), e === void 0 && N("");
|
|
87
|
+
const a = Oe(n, {
|
|
88
|
+
dismissed: x,
|
|
85
89
|
records: Q,
|
|
86
|
-
attachments:
|
|
87
|
-
recordFiles:
|
|
88
|
-
}), u = V.current,
|
|
90
|
+
attachments: w.map((m) => m.id),
|
|
91
|
+
recordFiles: X
|
|
92
|
+
}), u = V.current, D = u ? [] : h.slice(-18).map((m) => ({ role: m.role, content: m.content.slice(0, 4e3) }));
|
|
89
93
|
l.start({
|
|
90
|
-
messages: [...
|
|
94
|
+
messages: [...D, { role: "user", content: o }],
|
|
91
95
|
...u ? { conversation_id: u } : { save: !0 },
|
|
92
|
-
...
|
|
96
|
+
...r.fresh ? { fresh: !0 } : {},
|
|
97
|
+
...r.tryHarder ? {
|
|
98
|
+
try_harder: !0,
|
|
99
|
+
...r.tryHarder.retryOf ? { retry_of: r.tryHarder.retryOf } : {}
|
|
100
|
+
} : {},
|
|
93
101
|
...a ? { context: a } : {}
|
|
94
102
|
});
|
|
95
103
|
}
|
|
96
104
|
async function Y(e) {
|
|
97
|
-
const
|
|
98
|
-
for (const o of e.slice(0, Math.max(0,
|
|
99
|
-
|
|
105
|
+
const r = q - w.length;
|
|
106
|
+
for (const o of e.slice(0, Math.max(0, r))) {
|
|
107
|
+
z((a) => a + 1);
|
|
100
108
|
try {
|
|
101
109
|
const a = new FormData();
|
|
102
110
|
a.append("file", o, o.name);
|
|
103
|
-
const u =
|
|
111
|
+
const u = p.getToken(), D = await fetch(`${p.url}/api/ai/ask/attachments`, {
|
|
104
112
|
method: "POST",
|
|
105
113
|
headers: u ? { Authorization: `Bearer ${u}` } : {},
|
|
106
114
|
credentials: u ? "omit" : "include",
|
|
107
115
|
body: a
|
|
108
|
-
}), m = await
|
|
109
|
-
if (!
|
|
110
|
-
const
|
|
111
|
-
|
|
116
|
+
}), m = await D.json().catch(() => ({}));
|
|
117
|
+
if (!D.ok || !m.data) throw new Error(m.error || `Could not read ${o.name}`);
|
|
118
|
+
const fe = m.data;
|
|
119
|
+
_((pe) => [...pe, fe]);
|
|
112
120
|
} catch (a) {
|
|
113
|
-
|
|
121
|
+
g(a instanceof Error ? a.message : `Could not read ${o.name}`);
|
|
114
122
|
} finally {
|
|
115
|
-
|
|
123
|
+
z((a) => a - 1);
|
|
116
124
|
}
|
|
117
125
|
}
|
|
118
|
-
e.length >
|
|
126
|
+
e.length > r && g(`At most ${q} files per conversation`);
|
|
119
127
|
}
|
|
120
128
|
function de(e) {
|
|
121
|
-
e.preventDefault(),
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
(a) => a.some((u) => u.collection ===
|
|
129
|
+
e.preventDefault(), F(!1);
|
|
130
|
+
const r = Se(e.dataTransfer);
|
|
131
|
+
if (r) {
|
|
132
|
+
j(
|
|
133
|
+
(a) => a.some((u) => u.collection === r.collection && u.id === r.id) || a.length >= Ie ? a : [...a, r]
|
|
126
134
|
);
|
|
127
135
|
return;
|
|
128
136
|
}
|
|
@@ -131,58 +139,58 @@ function je({
|
|
|
131
139
|
}
|
|
132
140
|
function ue(e) {
|
|
133
141
|
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
|
134
|
-
e.preventDefault(),
|
|
142
|
+
e.preventDefault(), b && $(b, { fresh: !0 });
|
|
135
143
|
return;
|
|
136
144
|
}
|
|
137
145
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
138
|
-
e.preventDefault(),
|
|
146
|
+
e.preventDefault(), $();
|
|
139
147
|
return;
|
|
140
148
|
}
|
|
141
|
-
if (e.key === "ArrowUp" && !
|
|
142
|
-
e.preventDefault(),
|
|
149
|
+
if (e.key === "ArrowUp" && !k && b) {
|
|
150
|
+
e.preventDefault(), N(b);
|
|
143
151
|
return;
|
|
144
152
|
}
|
|
145
153
|
e.key === "Escape" && (e.preventDefault(), l.active ? l.stop() : s.setOpen(!1));
|
|
146
154
|
}
|
|
147
155
|
function me() {
|
|
148
156
|
var e;
|
|
149
|
-
l.active || (v([]),
|
|
157
|
+
l.active || (v([]), M(null), j([]), _([]), g(null), (e = H.current) == null || e.focus());
|
|
150
158
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
159
|
+
const f = [], C = (e) => B((r) => new Set(r).add(e));
|
|
160
|
+
n != null && n.record && !x.has("record") && f.push({
|
|
153
161
|
key: "record",
|
|
154
162
|
icon: /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
|
|
155
|
-
label:
|
|
156
|
-
onRemove: () =>
|
|
157
|
-
}),
|
|
163
|
+
label: n.record.label || `${n.record.collection} ${n.record.id}`,
|
|
164
|
+
onRemove: () => C("record")
|
|
165
|
+
}), n != null && n.list && !x.has("list") && f.push({
|
|
158
166
|
key: "list",
|
|
159
167
|
icon: /* @__PURE__ */ t(xe, { className: "h-3 w-3" }),
|
|
160
|
-
label: `${
|
|
161
|
-
onRemove: () =>
|
|
162
|
-
}),
|
|
168
|
+
label: `${n.list.label || n.list.collection} · ${n.list.ids.length} on screen${n.list.filters.length ? ` · ${n.list.filters.length} filter(s)` : ""}`,
|
|
169
|
+
onRemove: () => C("list")
|
|
170
|
+
}), n != null && n.queue && !x.has("queue") && f.push({
|
|
163
171
|
key: "queue",
|
|
164
172
|
icon: /* @__PURE__ */ t(be, { className: "h-3 w-3" }),
|
|
165
|
-
label: `${
|
|
166
|
-
onRemove: () =>
|
|
167
|
-
}),
|
|
173
|
+
label: `${n.queue.label || "Queue"} · ${n.queue.items.length} on screen`,
|
|
174
|
+
onRemove: () => C("queue")
|
|
175
|
+
}), n != null && n.report && !x.has("report") && f.push({
|
|
168
176
|
key: "report",
|
|
169
177
|
icon: /* @__PURE__ */ t(ge, { className: "h-3 w-3" }),
|
|
170
|
-
label: `${
|
|
171
|
-
onRemove: () =>
|
|
178
|
+
label: `${n.report.label || "Report"}${(te = n.report.entity_filters) != null && te.length ? ` · ${n.report.entity_filters.length} filter(s)` : ""}`,
|
|
179
|
+
onRemove: () => C("report")
|
|
172
180
|
});
|
|
173
181
|
for (const e of Q)
|
|
174
|
-
|
|
182
|
+
f.push({
|
|
175
183
|
key: `rec:${e.collection}:${e.id}`,
|
|
176
184
|
icon: /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
|
|
177
185
|
label: e.label || `${e.collection} ${e.id}`,
|
|
178
|
-
onRemove: () =>
|
|
186
|
+
onRemove: () => j((r) => r.filter((o) => !(o.collection === e.collection && o.id === e.id)))
|
|
179
187
|
});
|
|
180
|
-
for (const e of
|
|
181
|
-
|
|
188
|
+
for (const e of w)
|
|
189
|
+
f.push({
|
|
182
190
|
key: `doc:${e.id}`,
|
|
183
|
-
icon: /* @__PURE__ */ t(
|
|
191
|
+
icon: /* @__PURE__ */ t(L, { className: "h-3 w-3" }),
|
|
184
192
|
label: `${e.name}${e.truncated ? " (long — first part)" : ""}`,
|
|
185
|
-
onRemove: () =>
|
|
193
|
+
onRemove: () => _((r) => r.filter((o) => o.id !== e.id))
|
|
186
194
|
});
|
|
187
195
|
return /* @__PURE__ */ i(
|
|
188
196
|
"aside",
|
|
@@ -196,15 +204,15 @@ function je({
|
|
|
196
204
|
U && "ring-2 ring-inset ring-nvr-cyan"
|
|
197
205
|
),
|
|
198
206
|
onDragOver: (e) => {
|
|
199
|
-
e.preventDefault(), e.dataTransfer.dropEffect = "copy", U ||
|
|
207
|
+
e.preventDefault(), e.dataTransfer.dropEffect = "copy", U || F(!0);
|
|
200
208
|
},
|
|
201
209
|
onDragLeave: (e) => {
|
|
202
|
-
e.currentTarget === e.target &&
|
|
210
|
+
e.currentTarget === e.target && F(!1);
|
|
203
211
|
},
|
|
204
212
|
onDrop: de,
|
|
205
213
|
children: [
|
|
206
214
|
/* @__PURE__ */ i("header", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2", children: [
|
|
207
|
-
/* @__PURE__ */ t(
|
|
215
|
+
/* @__PURE__ */ t(ye, { className: "h-4 w-4 text-nvr-cyan" }),
|
|
208
216
|
/* @__PURE__ */ t("span", { className: "text-[13px] font-semibold", children: "Ask AI" }),
|
|
209
217
|
/* @__PURE__ */ t("span", { className: "text-[11px] text-muted-foreground", children: "⌘J" }),
|
|
210
218
|
/* @__PURE__ */ i("div", { className: "ml-auto flex items-center gap-1", children: [
|
|
@@ -214,11 +222,11 @@ function je({
|
|
|
214
222
|
type: "button",
|
|
215
223
|
"data-ask-panel-open-full": !0,
|
|
216
224
|
onClick: () => {
|
|
217
|
-
s.setOpen(!1), T(`${
|
|
225
|
+
s.setOpen(!1), T(`${O}?conversation=${I}`);
|
|
218
226
|
},
|
|
219
227
|
className: "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
220
228
|
children: [
|
|
221
|
-
/* @__PURE__ */ t(
|
|
229
|
+
/* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
|
|
222
230
|
" Open in Ask AI"
|
|
223
231
|
]
|
|
224
232
|
}
|
|
@@ -253,23 +261,35 @@ function je({
|
|
|
253
261
|
ref: K,
|
|
254
262
|
className: "min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-3 py-3",
|
|
255
263
|
children: [
|
|
256
|
-
|
|
264
|
+
h.length === 0 && !l.active && /* @__PURE__ */ i("div", { className: "space-y-2 pt-6 text-center text-[12.5px] text-muted-foreground", children: [
|
|
257
265
|
/* @__PURE__ */ t("p", { children: "Ask about what is on this page — the chips below say what rides along." }),
|
|
258
266
|
/* @__PURE__ */ t("p", { className: "text-[11.5px]", children: "Drop records or a PDF, Word or Excel file here to ask about them too." })
|
|
259
267
|
] }),
|
|
260
|
-
|
|
261
|
-
(e,
|
|
268
|
+
h.map(
|
|
269
|
+
(e, r) => e.role === "user" ? (
|
|
262
270
|
// biome-ignore lint/suspicious/noArrayIndexKey: turns only append; the index is stable
|
|
263
|
-
/* @__PURE__ */ t("div", { className: "flex justify-end", children: /* @__PURE__ */ t("div", { className: "max-w-[85%] whitespace-pre-wrap rounded-lg bg-nvr-cyan/10 px-3 py-2 text-[13px]", children: e.content }) },
|
|
271
|
+
/* @__PURE__ */ t("div", { className: "flex justify-end", children: /* @__PURE__ */ t("div", { className: "max-w-[85%] whitespace-pre-wrap rounded-lg bg-nvr-cyan/10 px-3 py-2 text-[13px]", children: e.content }) }, r)
|
|
264
272
|
) : (
|
|
265
273
|
// biome-ignore lint/suspicious/noArrayIndexKey: turns only append; the index is stable
|
|
266
274
|
/* @__PURE__ */ i("div", { className: "space-y-1", children: [
|
|
267
275
|
/* @__PURE__ */ t(ae, { content: e.content, className: "text-[13px]" }),
|
|
268
276
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
269
277
|
e.stopped && /* @__PURE__ */ t("span", { className: "text-[11px] text-muted-foreground", children: "Stopped" }),
|
|
278
|
+
e.quick && r === h.length - 1 && b && /* @__PURE__ */ t(
|
|
279
|
+
"button",
|
|
280
|
+
{
|
|
281
|
+
type: "button",
|
|
282
|
+
"data-ask-panel-try-harder": !0,
|
|
283
|
+
"data-tip": "Quick answer from a smaller model — ask the main one",
|
|
284
|
+
className: "text-[11px] text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground disabled:opacity-40",
|
|
285
|
+
disabled: l.active,
|
|
286
|
+
onClick: () => $(b, { tryHarder: { retryOf: e.requestId ?? null } }),
|
|
287
|
+
children: "Try harder"
|
|
288
|
+
}
|
|
289
|
+
),
|
|
270
290
|
/* @__PURE__ */ t(qe, { requestId: e.requestId })
|
|
271
291
|
] })
|
|
272
|
-
] },
|
|
292
|
+
] }, r)
|
|
273
293
|
)
|
|
274
294
|
),
|
|
275
295
|
l.active && /* @__PURE__ */ i("div", { "data-ask-panel-streaming": !0, className: "space-y-1.5", children: [
|
|
@@ -285,8 +305,8 @@ function je({
|
|
|
285
305
|
}
|
|
286
306
|
),
|
|
287
307
|
/* @__PURE__ */ i("footer", { className: "shrink-0 space-y-2 border-t border-border px-3 py-2.5", children: [
|
|
288
|
-
(
|
|
289
|
-
|
|
308
|
+
(f.length > 0 || P > 0) && /* @__PURE__ */ i("div", { className: "flex flex-wrap gap-1.5", "data-ask-panel-chips": !0, children: [
|
|
309
|
+
f.map((e) => /* @__PURE__ */ i(
|
|
290
310
|
"span",
|
|
291
311
|
{
|
|
292
312
|
className: "inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[11.5px]",
|
|
@@ -312,24 +332,24 @@ function je({
|
|
|
312
332
|
" Reading file…"
|
|
313
333
|
] })
|
|
314
334
|
] }),
|
|
315
|
-
d && ((
|
|
335
|
+
d && ((A == null ? void 0 : A.length) ?? 0) > 0 && /* @__PURE__ */ i("div", { className: "space-y-1", "data-ask-panel-record-files": !0, children: [
|
|
316
336
|
/* @__PURE__ */ t("p", { className: "text-[11px] font-medium text-muted-foreground", children: "Attachments on this record — use as sources" }),
|
|
317
|
-
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1.5", children:
|
|
318
|
-
const
|
|
337
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1.5", children: A.map((e) => {
|
|
338
|
+
const r = X.includes(e.id);
|
|
319
339
|
return /* @__PURE__ */ i(
|
|
320
340
|
"button",
|
|
321
341
|
{
|
|
322
342
|
type: "button",
|
|
323
|
-
"aria-pressed":
|
|
343
|
+
"aria-pressed": r,
|
|
324
344
|
onClick: () => J(
|
|
325
|
-
(o) =>
|
|
345
|
+
(o) => r ? o.filter((a) => a !== e.id) : o.length >= q ? o : [...o, e.id]
|
|
326
346
|
),
|
|
327
347
|
className: se(
|
|
328
348
|
"inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-[11.5px]",
|
|
329
|
-
|
|
349
|
+
r ? "border-nvr-cyan bg-nvr-cyan/10 text-foreground" : "border-border text-muted-foreground hover:bg-muted"
|
|
330
350
|
),
|
|
331
351
|
children: [
|
|
332
|
-
/* @__PURE__ */ t(
|
|
352
|
+
/* @__PURE__ */ t(L, { className: "h-3 w-3" }),
|
|
333
353
|
/* @__PURE__ */ t("span", { className: "truncate", children: e.name })
|
|
334
354
|
]
|
|
335
355
|
},
|
|
@@ -346,11 +366,11 @@ function je({
|
|
|
346
366
|
var e;
|
|
347
367
|
return (e = G.current) == null ? void 0 : e.click();
|
|
348
368
|
},
|
|
349
|
-
disabled:
|
|
369
|
+
disabled: w.length >= q,
|
|
350
370
|
"aria-label": "Attach a file",
|
|
351
371
|
"data-tip": "Attach a PDF, Word or Excel file",
|
|
352
372
|
className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",
|
|
353
|
-
children: /* @__PURE__ */ t(
|
|
373
|
+
children: /* @__PURE__ */ t(L, { className: "h-4 w-4" })
|
|
354
374
|
}
|
|
355
375
|
),
|
|
356
376
|
/* @__PURE__ */ t(
|
|
@@ -358,22 +378,22 @@ function je({
|
|
|
358
378
|
{
|
|
359
379
|
ref: G,
|
|
360
380
|
type: "file",
|
|
361
|
-
accept:
|
|
381
|
+
accept: Te,
|
|
362
382
|
multiple: !0,
|
|
363
383
|
className: "hidden",
|
|
364
384
|
onChange: (e) => {
|
|
365
|
-
const
|
|
366
|
-
e.target.value = "",
|
|
385
|
+
const r = [...e.target.files ?? []];
|
|
386
|
+
e.target.value = "", r.length && Y(r);
|
|
367
387
|
}
|
|
368
388
|
}
|
|
369
389
|
),
|
|
370
390
|
/* @__PURE__ */ t(
|
|
371
391
|
"textarea",
|
|
372
392
|
{
|
|
373
|
-
ref:
|
|
393
|
+
ref: H,
|
|
374
394
|
"data-ask-panel-input": !0,
|
|
375
|
-
value:
|
|
376
|
-
onChange: (e) =>
|
|
395
|
+
value: k,
|
|
396
|
+
onChange: (e) => N(e.target.value),
|
|
377
397
|
onKeyDown: ue,
|
|
378
398
|
rows: 2,
|
|
379
399
|
placeholder: "Ask about this page…",
|
|
@@ -393,8 +413,8 @@ function je({
|
|
|
393
413
|
"button",
|
|
394
414
|
{
|
|
395
415
|
type: "button",
|
|
396
|
-
onClick: () =>
|
|
397
|
-
disabled: !
|
|
416
|
+
onClick: () => $(),
|
|
417
|
+
disabled: !k.trim() || P > 0,
|
|
398
418
|
"aria-label": "Ask",
|
|
399
419
|
className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-nvr-cyan text-white disabled:opacity-50",
|
|
400
420
|
children: /* @__PURE__ */ t(we, { className: "h-4 w-4" })
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as v, useQuery as y, useMutation as x } from "@tanstack/react-query";
|
|
3
|
+
import { X as N, Check as _ } from "lucide-react";
|
|
4
|
+
import { useApiFetchConfig as C, useNavigation as F } from "../../context.js";
|
|
5
|
+
import { cn as h } from "../../lib/utils.js";
|
|
6
|
+
function H({ onOpenPath: i }) {
|
|
7
|
+
const { apiBase: d, authHeaders: l, credentials: c } = C(), p = F(), u = v(), o = ["my-work-first-week"], b = y({
|
|
8
|
+
queryKey: o,
|
|
9
|
+
staleTime: 6e4,
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const e = await fetch(`${d}/my-work/first-week`, {
|
|
12
|
+
headers: l,
|
|
13
|
+
credentials: c
|
|
14
|
+
});
|
|
15
|
+
if (!e.ok) throw new Error("first-week failed");
|
|
16
|
+
return (await e.json()).data;
|
|
17
|
+
}
|
|
18
|
+
}), m = (e, k) => fetch(`${d}/my-work/first-week/${e}`, {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers: { ...l, "content-type": "application/json" },
|
|
21
|
+
credentials: c,
|
|
22
|
+
body: JSON.stringify(k ?? {})
|
|
23
|
+
}), g = x({
|
|
24
|
+
mutationFn: () => m("dismiss"),
|
|
25
|
+
onSuccess: () => u.setQueryData(o, { active: !1, steps: [], done_count: 0 })
|
|
26
|
+
}), t = b.data;
|
|
27
|
+
if (!(t != null && t.active) || !t.steps.length) return null;
|
|
28
|
+
const w = (e) => {
|
|
29
|
+
e.path && (e.kind === "open" && m("opened", { step_id: e.id }).then(() => u.invalidateQueries({ queryKey: o })), i ? i(e.path) : p.navigate(e.path));
|
|
30
|
+
}, s = t.ends_at ? Math.max(0, Math.ceil((new Date(t.ends_at).getTime() - Date.now()) / 864e5)) : null, r = t.steps.length, f = t.done_count >= r;
|
|
31
|
+
return /* @__PURE__ */ n(
|
|
32
|
+
"section",
|
|
33
|
+
{
|
|
34
|
+
"aria-label": "Your first week",
|
|
35
|
+
"data-first-week": !0,
|
|
36
|
+
className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
39
|
+
/* @__PURE__ */ n("h2", { className: "text-[13px] font-semibold", children: [
|
|
40
|
+
f ? "First week done" : "Your first week",
|
|
41
|
+
t.role_name && /* @__PURE__ */ n("span", { className: "font-normal text-muted-foreground", children: [
|
|
42
|
+
" · ",
|
|
43
|
+
t.role_name
|
|
44
|
+
] })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ n("span", { className: "text-[11.5px] text-muted-foreground tabular-nums", children: [
|
|
47
|
+
t.done_count,
|
|
48
|
+
" of ",
|
|
49
|
+
r,
|
|
50
|
+
s !== null && !f && ` · ${s} day${s === 1 ? "" : "s"} left`
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ a(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
onClick: () => g.mutate(),
|
|
57
|
+
"aria-label": "Hide the first-week checklist",
|
|
58
|
+
"data-tip": "Hide this for good",
|
|
59
|
+
className: "ml-auto rounded p-1 text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
60
|
+
children: /* @__PURE__ */ a(N, { className: "h-3.5 w-3.5" })
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ a(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: "mt-2 h-1 overflow-hidden rounded-full bg-slate-100 dark:bg-muted",
|
|
68
|
+
role: "progressbar",
|
|
69
|
+
"aria-label": "First-week steps done",
|
|
70
|
+
"aria-valuemin": 0,
|
|
71
|
+
"aria-valuemax": r,
|
|
72
|
+
"aria-valuenow": t.done_count,
|
|
73
|
+
children: /* @__PURE__ */ a(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: "h-full rounded-full bg-nvr-cyan transition-[width] duration-300",
|
|
77
|
+
style: { width: `${t.done_count / r * 100}%` }
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ a("ul", { className: "mt-3 grid gap-1 md:grid-cols-2", children: t.steps.map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ n(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
onClick: () => w(e),
|
|
87
|
+
disabled: !e.path,
|
|
88
|
+
className: "flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:cursor-default disabled:hover:bg-transparent",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ a(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
"aria-hidden": !0,
|
|
94
|
+
className: h(
|
|
95
|
+
"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",
|
|
96
|
+
e.done ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
|
|
97
|
+
),
|
|
98
|
+
children: e.done && /* @__PURE__ */ a(_, { className: "h-3 w-3" })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ n("span", { className: "min-w-0", children: [
|
|
102
|
+
/* @__PURE__ */ n(
|
|
103
|
+
"span",
|
|
104
|
+
{
|
|
105
|
+
className: h(
|
|
106
|
+
"block text-[12.5px]",
|
|
107
|
+
e.done && "text-muted-foreground line-through"
|
|
108
|
+
),
|
|
109
|
+
children: [
|
|
110
|
+
e.title,
|
|
111
|
+
/* @__PURE__ */ a("span", { className: "sr-only", children: e.done ? " (done)" : " (to do)" })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
e.detail && !e.done && /* @__PURE__ */ a("span", { className: "block text-[11.5px] text-muted-foreground", children: e.detail })
|
|
116
|
+
] })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
) }, e.id)) })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
H as FirstWeekCard
|
|
126
|
+
};
|