@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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as o } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as A } from "@tanstack/react-query";
|
|
3
|
+
import { useState as d } from "react";
|
|
4
|
+
import { toast as _ } from "sonner";
|
|
5
|
+
import { useNivaroClient as S } from "../../../context.js";
|
|
6
|
+
import { post as y } from "../../../lib/commands.js";
|
|
7
|
+
import { useLayoutEditorHost as j } from "../host.js";
|
|
8
|
+
import { AiAskPopover as q, aiQuiet as u, aiGhostBtn as x, aiPrimaryBtn as N, aiFailure as R } from "./AiAskPopover.js";
|
|
9
|
+
function c({ v: l }) {
|
|
10
|
+
return l == null ? /* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-muted-foreground", children: "empty" }) : /* @__PURE__ */ e("span", { className: "break-words", children: l });
|
|
11
|
+
}
|
|
12
|
+
function B({ rows: l }) {
|
|
13
|
+
return l.length ? /* @__PURE__ */ a("table", { className: "w-full table-fixed text-left text-[12px]", "data-ai-field-rule-dry-run": "", children: [
|
|
14
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
15
|
+
/* @__PURE__ */ e("th", { className: "w-[34%] pb-1 font-medium", children: "Record" }),
|
|
16
|
+
/* @__PURE__ */ e("th", { className: "pb-1 font-medium", children: "Now" }),
|
|
17
|
+
/* @__PURE__ */ e("th", { className: "pb-1 font-medium", children: "After" }),
|
|
18
|
+
/* @__PURE__ */ e("th", { className: "pb-1 font-medium", children: "New record" })
|
|
19
|
+
] }) }),
|
|
20
|
+
/* @__PURE__ */ e("tbody", { className: "text-slate-700 dark:text-foreground", children: l.map((t) => {
|
|
21
|
+
const s = t.after_label !== t.before_label;
|
|
22
|
+
return /* @__PURE__ */ a("tr", { className: "border-t border-slate-100 align-top dark:border-border", children: [
|
|
23
|
+
/* @__PURE__ */ e("td", { className: "truncate py-1 pr-2", children: t.label }),
|
|
24
|
+
/* @__PURE__ */ e("td", { className: "py-1 pr-2", children: /* @__PURE__ */ e(c, { v: t.before_label }) }),
|
|
25
|
+
/* @__PURE__ */ e("td", { className: s ? "py-1 pr-2 font-medium" : "py-1 pr-2", children: /* @__PURE__ */ e(c, { v: t.after_label }) }),
|
|
26
|
+
/* @__PURE__ */ e("td", { className: "py-1", children: /* @__PURE__ */ e(c, { v: t.new_record_label }) })
|
|
27
|
+
] }, t.id);
|
|
28
|
+
}) })
|
|
29
|
+
] }) : /* @__PURE__ */ e("p", { className: u, children: "No records to try it on yet." });
|
|
30
|
+
}
|
|
31
|
+
function $({
|
|
32
|
+
layoutId: l,
|
|
33
|
+
field: t,
|
|
34
|
+
disabled: s
|
|
35
|
+
}) {
|
|
36
|
+
const m = S(), g = A(), v = j(), [k, n] = d(!1), [f, p] = d(!1), [h, i] = d(null);
|
|
37
|
+
return v.isAdmin ? /* @__PURE__ */ e(
|
|
38
|
+
q,
|
|
39
|
+
{
|
|
40
|
+
testId: "field-rule",
|
|
41
|
+
label: "Write a rule with AI",
|
|
42
|
+
title: "Describe where this value comes from",
|
|
43
|
+
placeholder: "default from the project's zone",
|
|
44
|
+
disabled: s,
|
|
45
|
+
ask: async (r) => (n(!1), i(null), (await m.request(
|
|
46
|
+
y(`/ai-design/layouts/${l}/field-rule`, { text: r, field: t })
|
|
47
|
+
)).data),
|
|
48
|
+
children: (r, b, w) => /* @__PURE__ */ a(o, { children: [
|
|
49
|
+
/* @__PURE__ */ e("p", { className: "text-[12.5px] font-medium leading-snug text-slate-800 dark:text-foreground", children: r.sentence }),
|
|
50
|
+
r.explanation && /* @__PURE__ */ e("p", { className: u, children: r.explanation }),
|
|
51
|
+
/* @__PURE__ */ e(B, { rows: r.dry_run }),
|
|
52
|
+
/* @__PURE__ */ e("p", { className: u, children: "A field rule runs on every form and every API write of these records, not only this layout." }),
|
|
53
|
+
h && /* @__PURE__ */ e("p", { className: "text-[12px] text-red-700 dark:text-red-300", children: h }),
|
|
54
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-end gap-1.5 pt-1", children: k ? /* @__PURE__ */ a(o, { children: [
|
|
55
|
+
/* @__PURE__ */ e("span", { className: "mr-auto text-[12px] text-slate-700 dark:text-foreground", children: "Save this rule now?" }),
|
|
56
|
+
/* @__PURE__ */ e("button", { type: "button", className: x, onClick: () => n(!1), children: "Not yet" }),
|
|
57
|
+
/* @__PURE__ */ e(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
className: N,
|
|
62
|
+
disabled: f,
|
|
63
|
+
"data-ai-field-rule-confirm": "",
|
|
64
|
+
onClick: async () => {
|
|
65
|
+
p(!0), i(null);
|
|
66
|
+
try {
|
|
67
|
+
await m.request(y("/field-rules", r.rule)), await g.invalidateQueries({ queryKey: ["field-rules"] }), _.success(`Rule saved: ${r.sentence}`), n(!1), b();
|
|
68
|
+
} catch (C) {
|
|
69
|
+
i(R(C, "The rule could not be saved"));
|
|
70
|
+
} finally {
|
|
71
|
+
p(!1);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
children: f ? "Saving…" : "Save rule"
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] }) : /* @__PURE__ */ a(o, { children: [
|
|
78
|
+
/* @__PURE__ */ e("button", { type: "button", className: x, onClick: w, children: "Back" }),
|
|
79
|
+
/* @__PURE__ */ e(
|
|
80
|
+
"button",
|
|
81
|
+
{
|
|
82
|
+
type: "button",
|
|
83
|
+
className: N,
|
|
84
|
+
"data-ai-field-rule-save": "",
|
|
85
|
+
onClick: () => n(!0),
|
|
86
|
+
children: "Save rule…"
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }) })
|
|
90
|
+
] })
|
|
91
|
+
}
|
|
92
|
+
) : null;
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
B as DryRunTable,
|
|
96
|
+
$ as FieldRuleWriter
|
|
97
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as r, jsxs as o, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k } from "react";
|
|
3
|
+
import { useNivaroClient as N } from "../../../context.js";
|
|
4
|
+
import { post as g } from "../../../lib/commands.js";
|
|
5
|
+
import { applyLayoutOps as b } from "../../../lib/layout-ops.js";
|
|
6
|
+
import { useLayoutEditorHost as A } from "../host.js";
|
|
7
|
+
import { humanizeOpError as v } from "../useLayoutDraft.js";
|
|
8
|
+
import { AiAskPopover as L, aiQuiet as s, aiWarn as S, DroppedList as C, aiGhostBtn as j, aiPrimaryBtn as E } from "./AiAskPopover.js";
|
|
9
|
+
import { ofChecked as P } from "./api.js";
|
|
10
|
+
const W = 500;
|
|
11
|
+
function B({ answer: c }) {
|
|
12
|
+
const { test: e, proposal: a } = c, n = a.kind === "step", p = n ? "Shows on" : "Locks on", i = e.checked - e.matched;
|
|
13
|
+
return /* @__PURE__ */ o("div", { className: "space-y-1", "data-ai-rule-test": "", children: [
|
|
14
|
+
e.checked === 0 && !e.roles.length ? /* @__PURE__ */ r("p", { className: s, children: "No records to test it on yet." }) : e.checked > 0 ? /* @__PURE__ */ o("p", { className: "text-[12.5px] text-slate-700 dark:text-foreground", children: [
|
|
15
|
+
p,
|
|
16
|
+
" ",
|
|
17
|
+
/* @__PURE__ */ r("strong", { children: P(e.matched, e.checked, W) }),
|
|
18
|
+
" records",
|
|
19
|
+
n && i > 0 ? `; hidden on ${i.toLocaleString()}` : "",
|
|
20
|
+
".",
|
|
21
|
+
e.current != null && /* @__PURE__ */ o("span", { className: s, children: [
|
|
22
|
+
" Today: ",
|
|
23
|
+
e.current.toLocaleString(),
|
|
24
|
+
"."
|
|
25
|
+
] })
|
|
26
|
+
] }) : null,
|
|
27
|
+
e.roles.length > 0 && /* @__PURE__ */ o("p", { className: s, children: [
|
|
28
|
+
"Also read-only for everyone in ",
|
|
29
|
+
e.roles.join(", "),
|
|
30
|
+
", on every record."
|
|
31
|
+
] })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
function G({
|
|
35
|
+
layoutId: c,
|
|
36
|
+
target: e,
|
|
37
|
+
bundle: a,
|
|
38
|
+
apply: n,
|
|
39
|
+
disabled: p
|
|
40
|
+
}) {
|
|
41
|
+
const i = N(), f = A(), [h, m] = k(null);
|
|
42
|
+
if (!f.isAdmin) return null;
|
|
43
|
+
const d = e.kind === "step";
|
|
44
|
+
return /* @__PURE__ */ r(
|
|
45
|
+
L,
|
|
46
|
+
{
|
|
47
|
+
testId: d ? "step" : "lock",
|
|
48
|
+
label: "Write with AI",
|
|
49
|
+
title: d ? "Describe when this step shows" : "Describe when this field is read-only",
|
|
50
|
+
placeholder: d ? "hide this step when Is Sparing is yes or Warehouse is 3" : "read-only once the record is Approved, or for Finance",
|
|
51
|
+
disabled: p,
|
|
52
|
+
ask: async (t) => (m(null), (await i.request(
|
|
53
|
+
g(`/ai-design/layouts/${c}/rule`, { text: t, target: e })
|
|
54
|
+
)).data),
|
|
55
|
+
children: (t, u, y) => /* @__PURE__ */ o(x, { children: [
|
|
56
|
+
/* @__PURE__ */ r("p", { className: "text-[12.5px] font-medium leading-snug text-slate-800 dark:text-foreground", children: t.sentence }),
|
|
57
|
+
t.replaces && /* @__PURE__ */ o("p", { className: s, children: [
|
|
58
|
+
"Replaces: ",
|
|
59
|
+
t.replaces
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ r(B, { answer: t }),
|
|
62
|
+
t.explanation && /* @__PURE__ */ r("p", { className: s, children: t.explanation }),
|
|
63
|
+
t.notes.map((l) => /* @__PURE__ */ r("p", { className: S, children: l }, l)),
|
|
64
|
+
/* @__PURE__ */ r(C, { items: t.dropped }),
|
|
65
|
+
h && /* @__PURE__ */ r("p", { className: "text-[12px] text-red-700 dark:text-red-300", children: h }),
|
|
66
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-end gap-1.5 pt-1", children: [
|
|
67
|
+
/* @__PURE__ */ r("button", { type: "button", className: j, onClick: y, children: "Back" }),
|
|
68
|
+
/* @__PURE__ */ r(
|
|
69
|
+
"button",
|
|
70
|
+
{
|
|
71
|
+
type: "button",
|
|
72
|
+
className: E,
|
|
73
|
+
"data-ai-rule-apply": "",
|
|
74
|
+
onClick: () => {
|
|
75
|
+
try {
|
|
76
|
+
b(a, t.ops);
|
|
77
|
+
} catch (l) {
|
|
78
|
+
m(v(l.message));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
n(t.ops, { label: t.sentence }), u();
|
|
82
|
+
},
|
|
83
|
+
children: "Apply"
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] })
|
|
87
|
+
] })
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
B as RuleTestLine,
|
|
93
|
+
G as RuleWriter
|
|
94
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useMutation as C } from "@tanstack/react-query";
|
|
3
|
+
import { ShieldCheck as f, Sparkles as A } from "lucide-react";
|
|
4
|
+
import { useState as x } from "react";
|
|
5
|
+
import { useNivaroClient as L } from "../../../context.js";
|
|
6
|
+
import { post as P } from "../../../lib/commands.js";
|
|
7
|
+
import { cn as m } from "../../../lib/utils.js";
|
|
8
|
+
import { Popover as _, PopoverTrigger as F, PopoverContent as j } from "../../ui/popover.js";
|
|
9
|
+
import { useLayoutEditorHost as B } from "../host.js";
|
|
10
|
+
import { aiTriggerBtn as E, aiQuiet as l, aiFailure as I, aiGhostBtn as O, aiPrimaryBtn as T } from "./AiAskPopover.js";
|
|
11
|
+
function q(c, d, p) {
|
|
12
|
+
return c === 0 ? `Every one of ${p ? "the newest " : ""}${d.toLocaleString()} values passes` : `${c.toLocaleString()} of ${p ? "the newest " : ""}${d.toLocaleString()} values would fail`;
|
|
13
|
+
}
|
|
14
|
+
function K({
|
|
15
|
+
layoutId: c,
|
|
16
|
+
field: d,
|
|
17
|
+
onApply: p,
|
|
18
|
+
disabled: v
|
|
19
|
+
}) {
|
|
20
|
+
const y = L(), N = B(), [b, k] = x(!1), [o, h] = x(/* @__PURE__ */ new Set()), n = C({
|
|
21
|
+
mutationFn: () => y.request(
|
|
22
|
+
P(`/ai-design/layouts/${c}/validation`, { field: d })
|
|
23
|
+
).then((t) => t.data)
|
|
24
|
+
});
|
|
25
|
+
if (!N.isAdmin) return null;
|
|
26
|
+
const e = n.data, w = e ? e.checked - e.empty : 0, u = e ? e.suggestions.filter((t, s) => !o.has(s)) : [], g = (t) => {
|
|
27
|
+
if (!e || !t.length) return;
|
|
28
|
+
const s = t.map((i) => e.suggestions[i].rule), S = t.length === 1 ? `Check ${e.label}: ${e.suggestions[t[0]].sentence}` : `Add ${t.length} checks to ${e.label}`, $ = [...e.current, ...[...o].map((i) => e.suggestions[i].rule)];
|
|
29
|
+
p(s, $, S), h((i) => /* @__PURE__ */ new Set([...i, ...t]));
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ r(
|
|
32
|
+
_,
|
|
33
|
+
{
|
|
34
|
+
open: b,
|
|
35
|
+
onOpenChange: (t) => {
|
|
36
|
+
k(t), t && !n.data && !n.isPending && n.mutate(), t || h(/* @__PURE__ */ new Set());
|
|
37
|
+
},
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ a(F, { asChild: !0, children: /* @__PURE__ */ r(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
className: E,
|
|
44
|
+
disabled: v,
|
|
45
|
+
"data-tip": "Checks learned from the values stored today",
|
|
46
|
+
"data-ai-validation-trigger": "",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ a(f, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
49
|
+
"Suggest checks"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
) }),
|
|
53
|
+
/* @__PURE__ */ r(
|
|
54
|
+
j,
|
|
55
|
+
{
|
|
56
|
+
align: "start",
|
|
57
|
+
className: "w-[420px] max-w-[calc(100vw-32px)] overflow-hidden p-0",
|
|
58
|
+
"data-ai-validation-popover": "",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ r("div", { className: "border-b border-slate-200 px-3 py-2.5 dark:border-border", children: [
|
|
61
|
+
/* @__PURE__ */ r("p", { className: "flex items-center gap-1.5 text-[12px] font-semibold text-slate-700 dark:text-foreground", children: [
|
|
62
|
+
/* @__PURE__ */ a(f, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
63
|
+
"Checks learned from stored values"
|
|
64
|
+
] }),
|
|
65
|
+
e && /* @__PURE__ */ r("p", { className: m(l, "mt-0.5"), children: [
|
|
66
|
+
"From ",
|
|
67
|
+
e.capped ? "the newest " : "",
|
|
68
|
+
e.checked.toLocaleString(),
|
|
69
|
+
" records (",
|
|
70
|
+
e.empty.toLocaleString(),
|
|
71
|
+
" empty).",
|
|
72
|
+
e.current.length > 0 && ` ${e.current.length} check${e.current.length === 1 ? "" : "s"} already set.`
|
|
73
|
+
] })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ r("div", { className: "max-h-[min(60vh,460px)] space-y-2 overflow-y-auto overscroll-contain px-3 py-3", children: [
|
|
76
|
+
n.isPending && /* @__PURE__ */ a("p", { className: l, children: "Reading the stored values…" }),
|
|
77
|
+
n.isError && /* @__PURE__ */ a("p", { className: "text-[12.5px] text-red-700 dark:text-red-300", children: I(n.error, "Could not read the values") }),
|
|
78
|
+
e && !e.ai_configured && !e.ai_error && /* @__PURE__ */ a("p", { className: l, children: "AI is not set up here: these come from the patterns alone." }),
|
|
79
|
+
(e == null ? void 0 : e.ai_error) && /* @__PURE__ */ a("p", { className: l, children: e.ai_error }),
|
|
80
|
+
e && e.suggestions.length === 0 && /* @__PURE__ */ a("p", { className: l, children: "No check fits these values well enough to suggest." }),
|
|
81
|
+
e && e.suggestions.length > 0 && /* @__PURE__ */ a("ul", { className: "space-y-1.5", "data-ai-validation-list": "", children: e.suggestions.map((t, s) => /* @__PURE__ */ a(
|
|
82
|
+
"li",
|
|
83
|
+
{
|
|
84
|
+
className: "rounded-md border border-slate-200 px-2.5 py-2 dark:border-border",
|
|
85
|
+
children: /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
|
|
86
|
+
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1 space-y-0.5", children: [
|
|
87
|
+
/* @__PURE__ */ r("p", { className: "flex items-center gap-1 break-words text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: [
|
|
88
|
+
t.source === "ai" && /* @__PURE__ */ a(
|
|
89
|
+
A,
|
|
90
|
+
{
|
|
91
|
+
className: "h-3 w-3 shrink-0 text-nvr-cyan",
|
|
92
|
+
"aria-label": "From AI"
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
t.sentence
|
|
96
|
+
] }),
|
|
97
|
+
t.rule.message && /* @__PURE__ */ r("p", { className: l, children: [
|
|
98
|
+
"Says: “",
|
|
99
|
+
t.rule.message,
|
|
100
|
+
"”"
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ a(
|
|
103
|
+
"p",
|
|
104
|
+
{
|
|
105
|
+
className: m(
|
|
106
|
+
"text-[12px]",
|
|
107
|
+
t.fails > 0 ? "text-amber-700 dark:text-amber-300" : "text-slate-500 dark:text-muted-foreground"
|
|
108
|
+
),
|
|
109
|
+
"data-ai-validation-fails": t.fails,
|
|
110
|
+
children: q(t.fails, w, e.capped)
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }),
|
|
114
|
+
o.has(s) ? /* @__PURE__ */ a("span", { className: "shrink-0 pt-1 text-[12px] text-slate-500 dark:text-muted-foreground", children: "Added" }) : /* @__PURE__ */ a(
|
|
115
|
+
"button",
|
|
116
|
+
{
|
|
117
|
+
type: "button",
|
|
118
|
+
className: m(O, "shrink-0"),
|
|
119
|
+
onClick: () => g([s]),
|
|
120
|
+
"data-ai-validation-apply": s,
|
|
121
|
+
children: "Apply"
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] })
|
|
125
|
+
},
|
|
126
|
+
`${t.rule.type}:${String(t.rule.value ?? "")}`
|
|
127
|
+
)) }),
|
|
128
|
+
e && u.length > 1 && /* @__PURE__ */ a("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ r(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
className: T,
|
|
133
|
+
"data-ai-validation-apply-all": "",
|
|
134
|
+
onClick: () => g(e.suggestions.map((t, s) => s).filter((t) => !o.has(t))),
|
|
135
|
+
children: [
|
|
136
|
+
"Apply all ",
|
|
137
|
+
u.length
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
) }),
|
|
141
|
+
o.size > 0 && /* @__PURE__ */ a("p", { className: l, children: "Added to the field’s pending change: confirm it below to save." })
|
|
142
|
+
] })
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
export {
|
|
151
|
+
K as ValidationSuggest,
|
|
152
|
+
q as failWords
|
|
153
|
+
};
|