@nivaro/react 0.2.54 → 0.2.56
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 +367 -2
- package/dist/index.js +645 -616
- package/dist/layout-editor.d.ts +4 -0
- 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/ItemEditForm.js +4066 -3832
- 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 +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- 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 +76 -73
- 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 +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- 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 +39 -32
- 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 +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- 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/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- 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/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -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 +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- 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/useLayoutDraft.js +25 -24
- 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/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- 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 +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- 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/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/stale-chunk.js +60 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -1,121 +1,163 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { MessageSquare as P, Share2 as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { cn as
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { SimpleSelect as
|
|
11
|
-
import { apiFailure as
|
|
12
|
-
import { ToolButton as
|
|
13
|
-
import { useLayoutCollab as
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
|
|
2
|
+
import { useQuery as D } from "@tanstack/react-query";
|
|
3
|
+
import { MessageSquare as P, Share2 as R, BellRing as W, Bell as B, Link2 as T, Copy as $, Crosshair as q, X as A } from "lucide-react";
|
|
4
|
+
import { useState as p } from "react";
|
|
5
|
+
import { toast as k } from "sonner";
|
|
6
|
+
import { useNivaroClient as j } from "../../../context.js";
|
|
7
|
+
import { get as E } from "../../../lib/commands.js";
|
|
8
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
9
|
+
import { Popover as F, PopoverContent as U } from "../../ui/popover.js";
|
|
10
|
+
import { SimpleSelect as L } from "../../ui/SimpleSelect.js";
|
|
11
|
+
import { apiFailure as K } from "../overview/overview-api.js";
|
|
12
|
+
import { ToolButton as _ } from "../toolbar-kit.js";
|
|
13
|
+
import { useLayoutCollab as S, usePreviewComments as M, useCollabActions as v, usePreviewLinks as H, previewUrl as C } from "./collab-api.js";
|
|
14
|
+
const f = "inline-flex h-7 items-center gap-1 rounded-md px-2 text-[12px] text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 disabled:opacity-40 dark:text-muted-foreground dark:hover:text-foreground", g = "text-[12px] font-semibold text-slate-700 dark:text-foreground", x = "text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", O = (o) => o ? new Date(o).toLocaleDateString(void 0, { month: "short", day: "numeric" }) : "";
|
|
15
|
+
function w(o, n) {
|
|
16
|
+
k.error(K(o, n).message);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
const { data:
|
|
18
|
+
function le({ layoutId: o }) {
|
|
19
|
+
const { data: n } = S(o), m = v(o), [d, c] = p(!1), t = !!(n != null && n.watching);
|
|
20
20
|
return /* @__PURE__ */ e(
|
|
21
|
-
|
|
21
|
+
_,
|
|
22
22
|
{
|
|
23
23
|
label: "Watch this form",
|
|
24
24
|
ariaLabel: t ? "Stop watching this form" : "Watch this form",
|
|
25
|
-
icon: t ? /* @__PURE__ */ e(
|
|
25
|
+
icon: t ? /* @__PURE__ */ e(W, { className: "h-4 w-4" }) : /* @__PURE__ */ e(B, { className: "h-4 w-4" }),
|
|
26
26
|
hint: "Hear when someone saves a change",
|
|
27
27
|
iconOnly: !0,
|
|
28
28
|
checked: t,
|
|
29
29
|
disabled: d,
|
|
30
|
-
className:
|
|
30
|
+
className: y(t && "text-[#0089ad] dark:text-nvr-cyan"),
|
|
31
31
|
tip: t ? "Watching: you hear when someone saves a change. Click to stop" : "Watch: hear when someone saves a change to this form",
|
|
32
32
|
data: { "data-form-watch": "" },
|
|
33
33
|
onClick: async () => {
|
|
34
|
-
|
|
34
|
+
c(!0);
|
|
35
35
|
try {
|
|
36
36
|
await m.setWatch(!t);
|
|
37
37
|
} catch (i) {
|
|
38
|
-
|
|
38
|
+
w(i, "Could not change the watch");
|
|
39
39
|
} finally {
|
|
40
|
-
|
|
40
|
+
c(!1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const m =
|
|
46
|
+
function Q({ layoutId: o, owner: n }) {
|
|
47
|
+
const m = j(), d = v(o), [c, t] = p(!1), [i, h] = p(""), { data: u = [] } = D({
|
|
48
48
|
queryKey: ["layout-editor", "collab", "people", i],
|
|
49
|
-
queryFn: () => m.request(
|
|
50
|
-
enabled:
|
|
51
|
-
}),
|
|
49
|
+
queryFn: () => m.request(E("/users", { search: i, limit: 6, people: "1" })).then((s) => s.data ?? []),
|
|
50
|
+
enabled: c && i.trim().length > 1
|
|
51
|
+
}), l = async (s) => {
|
|
52
52
|
try {
|
|
53
|
-
await d.setOwner(
|
|
53
|
+
await d.setOwner(s), t(!1), h("");
|
|
54
54
|
} catch (a) {
|
|
55
|
-
|
|
55
|
+
w(a, "Could not change the owner");
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
return
|
|
58
|
+
return c ? /* @__PURE__ */ r("div", { children: [
|
|
59
59
|
/* @__PURE__ */ e(
|
|
60
60
|
"input",
|
|
61
61
|
{
|
|
62
62
|
autoFocus: !0,
|
|
63
63
|
"aria-label": "Find a person",
|
|
64
64
|
value: i,
|
|
65
|
-
onChange: (
|
|
66
|
-
onKeyDown: (
|
|
65
|
+
onChange: (s) => h(s.target.value),
|
|
66
|
+
onKeyDown: (s) => s.key === "Escape" && t(!1),
|
|
67
67
|
placeholder: "Type a name or email",
|
|
68
68
|
className: "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground"
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
|
-
i.trim().length > 1 && /* @__PURE__ */ e("div", { className: "mt-1 overflow-hidden rounded-md border border-slate-200 dark:border-border", children: u.length === 0 ? /* @__PURE__ */ e("div", { className: x
|
|
72
|
-
const a = `${
|
|
71
|
+
i.trim().length > 1 && /* @__PURE__ */ e("div", { className: "mt-1 overflow-hidden rounded-md border border-slate-200 dark:border-border", children: u.length === 0 ? /* @__PURE__ */ e("div", { className: y(x, "px-2.5 py-1.5"), children: "No one matches" }) : u.map((s) => {
|
|
72
|
+
const a = `${s.first_name ?? ""} ${s.last_name ?? ""}`.trim() || s.email;
|
|
73
73
|
return /* @__PURE__ */ r(
|
|
74
74
|
"button",
|
|
75
75
|
{
|
|
76
76
|
type: "button",
|
|
77
|
-
onClick: () => void
|
|
77
|
+
onClick: () => void l(s.id),
|
|
78
78
|
className: "block w-full px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-foreground",
|
|
79
79
|
children: [
|
|
80
80
|
a,
|
|
81
|
-
/* @__PURE__ */ e("span", { className: "ml-1.5 text-[11px] text-slate-400 dark:text-muted-foreground", children:
|
|
81
|
+
/* @__PURE__ */ e("span", { className: "ml-1.5 text-[11px] text-slate-400 dark:text-muted-foreground", children: s.email })
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
-
|
|
84
|
+
s.id
|
|
85
85
|
);
|
|
86
86
|
}) }),
|
|
87
|
-
/* @__PURE__ */ e("button", { type: "button", className:
|
|
87
|
+
/* @__PURE__ */ e("button", { type: "button", className: y(f, "mt-1"), onClick: () => t(!1), children: "Cancel" })
|
|
88
88
|
] }) : /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
89
89
|
/* @__PURE__ */ e(
|
|
90
90
|
"span",
|
|
91
91
|
{
|
|
92
92
|
"data-form-owner": "",
|
|
93
|
-
className:
|
|
93
|
+
className: y(
|
|
94
94
|
"min-w-0 flex-1 truncate text-[12.5px]",
|
|
95
|
-
|
|
95
|
+
n ? "text-slate-800 dark:text-foreground" : "text-slate-400 dark:text-muted-foreground"
|
|
96
96
|
),
|
|
97
|
-
children: (
|
|
97
|
+
children: (n == null ? void 0 : n.name) ?? "No owner yet"
|
|
98
98
|
}
|
|
99
99
|
),
|
|
100
|
-
/* @__PURE__ */ e("button", { type: "button", className:
|
|
101
|
-
|
|
100
|
+
/* @__PURE__ */ e("button", { type: "button", className: f, onClick: () => t(!0), children: n ? "Change" : "Name an owner" }),
|
|
101
|
+
n && /* @__PURE__ */ e("button", { type: "button", className: f, onClick: () => void l(null), children: "Clear" })
|
|
102
102
|
] });
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const N = "default";
|
|
105
|
+
function V({
|
|
106
|
+
layoutId: o,
|
|
107
|
+
review: n,
|
|
108
|
+
hasOwner: m
|
|
109
|
+
}) {
|
|
110
|
+
const d = v(o), [c, t] = p(!1), i = (a) => a === 1 ? "1 month" : `${a} months`, h = n.months == null ? N : String(n.months), u = [
|
|
111
|
+
{
|
|
112
|
+
value: N,
|
|
113
|
+
label: n.default_months > 0 ? `After ${i(n.default_months)} (default)` : "Never (default)"
|
|
114
|
+
},
|
|
115
|
+
...[3, 6, 12].filter((a) => a !== n.default_months).map((a) => ({ value: String(a), label: `After ${i(a)}` })),
|
|
116
|
+
...n.default_months > 0 ? [{ value: "0", label: "Never" }] : []
|
|
117
|
+
], l = n.next_at ? new Date(n.next_at) : null, s = (a) => a.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
|
|
118
|
+
return /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
119
|
+
/* @__PURE__ */ e(
|
|
120
|
+
L,
|
|
121
|
+
{
|
|
122
|
+
value: h,
|
|
123
|
+
disabled: c,
|
|
124
|
+
onChange: async (a) => {
|
|
125
|
+
t(!0);
|
|
126
|
+
try {
|
|
127
|
+
await d.setReviewMonths(a === N ? null : Number(a));
|
|
128
|
+
} catch (b) {
|
|
129
|
+
w(b, "Could not change the reminder");
|
|
130
|
+
} finally {
|
|
131
|
+
t(!1);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
ariaLabel: "Remind the owner to review this form",
|
|
135
|
+
className: "h-8 w-full text-[12.5px]",
|
|
136
|
+
triggerProps: { "data-form-review": "" },
|
|
137
|
+
options: u
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ r("p", { className: x, children: [
|
|
141
|
+
m ? n.effective_months === 0 ? "The owner is never reminded." : l && l > /* @__PURE__ */ new Date() ? `If it stays unchanged, the owner is reminded on ${s(l)} with its health score and how much it was used.` : `It has been unchanged that long: the owner is reminded on a weekday morning, then every ${i(n.effective_months)} while it stays unchanged.` : "Name an owner first: the reminder goes to them, with the form’s health score and how much it was used.",
|
|
142
|
+
n.last_changed_at ? ` Last changed ${s(new Date(n.last_changed_at))}.` : ""
|
|
143
|
+
] })
|
|
144
|
+
] });
|
|
145
|
+
}
|
|
146
|
+
function X({ layoutId: o, open: n }) {
|
|
147
|
+
const { data: m = [] } = H(o, n), d = v(o), [c, t] = p("14"), [i, h] = p(!1), [u, l] = p(null), s = async (a) => {
|
|
106
148
|
try {
|
|
107
|
-
await navigator.clipboard.writeText(
|
|
149
|
+
await navigator.clipboard.writeText(C(a)), k.success("Link copied");
|
|
108
150
|
} catch {
|
|
109
|
-
|
|
151
|
+
k.error("Could not copy — select the link and copy it");
|
|
110
152
|
}
|
|
111
153
|
};
|
|
112
154
|
return /* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
113
|
-
/* @__PURE__ */ e("p", { className:
|
|
155
|
+
/* @__PURE__ */ e("p", { className: x, children: "Anyone with the link can read this form’s layout (never record data) and comment on its fields. It shows the last saved version, as you see it." }),
|
|
114
156
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
115
157
|
/* @__PURE__ */ e(
|
|
116
|
-
|
|
158
|
+
L,
|
|
117
159
|
{
|
|
118
|
-
value:
|
|
160
|
+
value: c,
|
|
119
161
|
onChange: t,
|
|
120
162
|
ariaLabel: "Link lasts",
|
|
121
163
|
className: "h-8 w-[120px] text-[12.5px]",
|
|
@@ -134,18 +176,18 @@ function Q({ layoutId: s, open: o }) {
|
|
|
134
176
|
disabled: i,
|
|
135
177
|
className: "inline-flex h-8 items-center gap-1.5 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-50",
|
|
136
178
|
onClick: async () => {
|
|
137
|
-
|
|
179
|
+
h(!0);
|
|
138
180
|
try {
|
|
139
|
-
const a = await d.createLink(Number(
|
|
140
|
-
a != null && a.path && await
|
|
181
|
+
const a = await d.createLink(Number(c));
|
|
182
|
+
a != null && a.path && await s(a.path);
|
|
141
183
|
} catch (a) {
|
|
142
|
-
|
|
184
|
+
w(a, "Could not create the link");
|
|
143
185
|
} finally {
|
|
144
|
-
|
|
186
|
+
h(!1);
|
|
145
187
|
}
|
|
146
188
|
},
|
|
147
189
|
children: [
|
|
148
|
-
/* @__PURE__ */ e(
|
|
190
|
+
/* @__PURE__ */ e(T, { className: "h-3.5 w-3.5" }),
|
|
149
191
|
"Create link"
|
|
150
192
|
]
|
|
151
193
|
}
|
|
@@ -157,11 +199,11 @@ function Q({ layoutId: s, open: o }) {
|
|
|
157
199
|
"data-preview-link": a.id,
|
|
158
200
|
className: "rounded-md border border-slate-200 px-2.5 py-1.5 dark:border-border",
|
|
159
201
|
children: [
|
|
160
|
-
/* @__PURE__ */ e("div", { className: "truncate font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children:
|
|
202
|
+
/* @__PURE__ */ e("div", { className: "truncate font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children: C(a.path) }),
|
|
161
203
|
/* @__PURE__ */ r("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
162
204
|
/* @__PURE__ */ r("span", { children: [
|
|
163
205
|
"until ",
|
|
164
|
-
|
|
206
|
+
O(a.expires_at)
|
|
165
207
|
] }),
|
|
166
208
|
/* @__PURE__ */ r("span", { children: [
|
|
167
209
|
"· ",
|
|
@@ -176,26 +218,26 @@ function Q({ layoutId: s, open: o }) {
|
|
|
176
218
|
a.comments === 1 ? "comment" : "comments"
|
|
177
219
|
] }),
|
|
178
220
|
/* @__PURE__ */ e("span", { className: "flex-1" }),
|
|
179
|
-
/* @__PURE__ */ r("button", { type: "button", className:
|
|
180
|
-
/* @__PURE__ */ e(
|
|
221
|
+
/* @__PURE__ */ r("button", { type: "button", className: f, onClick: () => void s(a.path), children: [
|
|
222
|
+
/* @__PURE__ */ e($, { className: "h-3 w-3" }),
|
|
181
223
|
"Copy"
|
|
182
224
|
] }),
|
|
183
225
|
u === a.id ? /* @__PURE__ */ e(
|
|
184
226
|
"button",
|
|
185
227
|
{
|
|
186
228
|
type: "button",
|
|
187
|
-
className:
|
|
229
|
+
className: y(f, "text-red-600 dark:text-red-400"),
|
|
188
230
|
onClick: async () => {
|
|
189
231
|
try {
|
|
190
232
|
await d.revokeLink(a.id);
|
|
191
|
-
} catch (
|
|
192
|
-
|
|
233
|
+
} catch (b) {
|
|
234
|
+
w(b, "Could not turn the link off");
|
|
193
235
|
}
|
|
194
|
-
|
|
236
|
+
l(null);
|
|
195
237
|
},
|
|
196
238
|
children: "Turn off for everyone"
|
|
197
239
|
}
|
|
198
|
-
) : /* @__PURE__ */ e("button", { type: "button", className:
|
|
240
|
+
) : /* @__PURE__ */ e("button", { type: "button", className: f, onClick: () => l(a.id), children: "Turn off" })
|
|
199
241
|
] })
|
|
200
242
|
]
|
|
201
243
|
},
|
|
@@ -203,14 +245,14 @@ function Q({ layoutId: s, open: o }) {
|
|
|
203
245
|
))
|
|
204
246
|
] });
|
|
205
247
|
}
|
|
206
|
-
function
|
|
207
|
-
layoutId:
|
|
208
|
-
comments:
|
|
248
|
+
function z({
|
|
249
|
+
layoutId: o,
|
|
250
|
+
comments: n,
|
|
209
251
|
fieldLabel: m,
|
|
210
252
|
onSelectField: d
|
|
211
253
|
}) {
|
|
212
|
-
const
|
|
213
|
-
return
|
|
254
|
+
const c = v(o);
|
|
255
|
+
return n.length === 0 ? /* @__PURE__ */ e("p", { className: x, children: "No comments yet. People with a preview link leave them here." }) : /* @__PURE__ */ e("ul", { className: "space-y-1.5", children: n.map((t) => /* @__PURE__ */ r(
|
|
214
256
|
"li",
|
|
215
257
|
{
|
|
216
258
|
"data-preview-comment": t.id,
|
|
@@ -222,7 +264,7 @@ function X({
|
|
|
222
264
|
"· ",
|
|
223
265
|
t.name,
|
|
224
266
|
" · ",
|
|
225
|
-
|
|
267
|
+
O(t.at)
|
|
226
268
|
] }),
|
|
227
269
|
/* @__PURE__ */ e("span", { className: "flex-1" }),
|
|
228
270
|
t.field && d && /* @__PURE__ */ e(
|
|
@@ -231,9 +273,9 @@ function X({
|
|
|
231
273
|
type: "button",
|
|
232
274
|
"aria-label": "Select this field",
|
|
233
275
|
"data-tip": "Select this field on the canvas",
|
|
234
|
-
className:
|
|
276
|
+
className: f,
|
|
235
277
|
onClick: () => d(t.field),
|
|
236
|
-
children: /* @__PURE__ */ e(
|
|
278
|
+
children: /* @__PURE__ */ e(q, { className: "h-3 w-3" })
|
|
237
279
|
}
|
|
238
280
|
),
|
|
239
281
|
/* @__PURE__ */ e(
|
|
@@ -242,15 +284,15 @@ function X({
|
|
|
242
284
|
type: "button",
|
|
243
285
|
"aria-label": "Resolve comment",
|
|
244
286
|
"data-tip": "Resolve: remove the comment",
|
|
245
|
-
className:
|
|
287
|
+
className: f,
|
|
246
288
|
onClick: async () => {
|
|
247
289
|
try {
|
|
248
|
-
await
|
|
290
|
+
await c.resolveComment(t.id);
|
|
249
291
|
} catch (i) {
|
|
250
|
-
|
|
292
|
+
w(i, "Could not resolve the comment");
|
|
251
293
|
}
|
|
252
294
|
},
|
|
253
|
-
children: /* @__PURE__ */ e(
|
|
295
|
+
children: /* @__PURE__ */ e(A, { className: "h-3 w-3" })
|
|
254
296
|
}
|
|
255
297
|
)
|
|
256
298
|
] }),
|
|
@@ -260,27 +302,27 @@ function X({
|
|
|
260
302
|
t.id
|
|
261
303
|
)) });
|
|
262
304
|
}
|
|
263
|
-
function
|
|
264
|
-
layoutId:
|
|
265
|
-
fields:
|
|
305
|
+
function ce({
|
|
306
|
+
layoutId: o,
|
|
307
|
+
fields: n,
|
|
266
308
|
onSelectField: m
|
|
267
309
|
}) {
|
|
268
|
-
const [d,
|
|
269
|
-
var
|
|
270
|
-
return ((
|
|
271
|
-
}, u = ((t == null ? void 0 : t.watchers) ?? []).filter((
|
|
272
|
-
var
|
|
273
|
-
return
|
|
310
|
+
const [d, c] = p(!1), { data: t } = S(o), { data: i = [] } = M(o), h = (l) => {
|
|
311
|
+
var s;
|
|
312
|
+
return ((s = n.find((a) => a.field === l)) == null ? void 0 : s.label) || l;
|
|
313
|
+
}, u = ((t == null ? void 0 : t.watchers) ?? []).filter((l) => {
|
|
314
|
+
var s;
|
|
315
|
+
return l.id !== ((s = t == null ? void 0 : t.owner) == null ? void 0 : s.id);
|
|
274
316
|
});
|
|
275
|
-
return /* @__PURE__ */ r(
|
|
317
|
+
return /* @__PURE__ */ r(F, { open: d, onOpenChange: c, children: [
|
|
276
318
|
/* @__PURE__ */ e(
|
|
277
|
-
|
|
319
|
+
_,
|
|
278
320
|
{
|
|
279
321
|
popover: !0,
|
|
280
|
-
onOpen: () =>
|
|
322
|
+
onOpen: () => c(!0),
|
|
281
323
|
label: "Share & watchers",
|
|
282
324
|
ariaLabel: "Share",
|
|
283
|
-
icon: /* @__PURE__ */ e(
|
|
325
|
+
icon: /* @__PURE__ */ e(R, { className: "h-3.5 w-3.5" }),
|
|
284
326
|
tip: "Owner, watchers, preview links and comments",
|
|
285
327
|
hint: "Owner, watchers, preview links, comments",
|
|
286
328
|
badge: i.length || void 0,
|
|
@@ -299,34 +341,38 @@ function ie({
|
|
|
299
341
|
}
|
|
300
342
|
),
|
|
301
343
|
/* @__PURE__ */ r(
|
|
302
|
-
|
|
344
|
+
U,
|
|
303
345
|
{
|
|
304
346
|
align: "end",
|
|
305
347
|
className: "max-h-[min(75vh,620px)] w-[400px] space-y-4 overflow-y-auto overscroll-contain p-3",
|
|
306
348
|
children: [
|
|
307
349
|
/* @__PURE__ */ r("section", { className: "space-y-1.5", children: [
|
|
308
350
|
/* @__PURE__ */ e("h3", { className: g, children: "Owner" }),
|
|
309
|
-
/* @__PURE__ */ e(
|
|
310
|
-
/* @__PURE__ */ e("p", { className:
|
|
351
|
+
/* @__PURE__ */ e(Q, { layoutId: o, owner: (t == null ? void 0 : t.owner) ?? null }),
|
|
352
|
+
/* @__PURE__ */ e("p", { className: x, children: "The business owner hears first about change requests and every saved change." })
|
|
353
|
+
] }),
|
|
354
|
+
(t == null ? void 0 : t.review) && /* @__PURE__ */ r("section", { className: "space-y-1.5", "data-form-review-section": "", children: [
|
|
355
|
+
/* @__PURE__ */ e("h3", { className: g, children: "Review reminder" }),
|
|
356
|
+
/* @__PURE__ */ e(V, { layoutId: o, review: t.review, hasOwner: !!t.owner })
|
|
311
357
|
] }),
|
|
312
358
|
/* @__PURE__ */ r("section", { className: "space-y-1", children: [
|
|
313
359
|
/* @__PURE__ */ e("h3", { className: g, children: "Watching" }),
|
|
314
|
-
/* @__PURE__ */ e("p", { className:
|
|
360
|
+
/* @__PURE__ */ e("p", { className: x, children: u.length === 0 ? "No one else watches this form. Use the bell to watch it yourself." : u.map((l) => l.name).join(", ") })
|
|
315
361
|
] }),
|
|
316
362
|
/* @__PURE__ */ r("section", { className: "space-y-1.5", children: [
|
|
317
363
|
/* @__PURE__ */ e("h3", { className: g, children: "Preview link" }),
|
|
318
|
-
/* @__PURE__ */ e(
|
|
364
|
+
/* @__PURE__ */ e(X, { layoutId: o, open: d })
|
|
319
365
|
] }),
|
|
320
366
|
/* @__PURE__ */ r("section", { className: "space-y-1.5", children: [
|
|
321
367
|
/* @__PURE__ */ e("h3", { className: g, children: "Comments from previews" }),
|
|
322
368
|
/* @__PURE__ */ e(
|
|
323
|
-
|
|
369
|
+
z,
|
|
324
370
|
{
|
|
325
|
-
layoutId:
|
|
371
|
+
layoutId: o,
|
|
326
372
|
comments: i,
|
|
327
|
-
fieldLabel:
|
|
328
|
-
onSelectField: m ? (
|
|
329
|
-
m(
|
|
373
|
+
fieldLabel: h,
|
|
374
|
+
onSelectField: m ? (l) => {
|
|
375
|
+
m(l), c(!1);
|
|
330
376
|
} : void 0
|
|
331
377
|
}
|
|
332
378
|
)
|
|
@@ -337,6 +383,6 @@ function ie({
|
|
|
337
383
|
] });
|
|
338
384
|
}
|
|
339
385
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
386
|
+
ce as ShareButton,
|
|
387
|
+
le as WatchButton
|
|
342
388
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useQuery as
|
|
1
|
+
import { useQuery as s, useQueryClient as m } from "@tanstack/react-query";
|
|
2
2
|
import { useCallback as b } from "react";
|
|
3
3
|
import { useNivaroClient as i } from "../../../context.js";
|
|
4
|
-
import { get as
|
|
5
|
-
const
|
|
4
|
+
import { get as c, del as w, post as q, put as l } from "../../../lib/commands.js";
|
|
5
|
+
const u = {
|
|
6
6
|
one: (e) => ["layout-editor", "collab", e],
|
|
7
7
|
owners: () => ["layout-editor", "collab", "owners"],
|
|
8
8
|
links: (e) => ["layout-editor", "collab", e, "links"],
|
|
9
9
|
comments: (e) => ["layout-editor", "collab", e, "comments"]
|
|
10
10
|
}, r = (e, t) => (e == null ? void 0 : e.data) ?? t;
|
|
11
|
-
function
|
|
11
|
+
function $(e) {
|
|
12
12
|
const t = i();
|
|
13
|
-
return
|
|
14
|
-
queryKey:
|
|
15
|
-
queryFn: async () => r(await t.request(
|
|
13
|
+
return s({
|
|
14
|
+
queryKey: u.one(e),
|
|
15
|
+
queryFn: async () => r(await t.request(c(`/layout-collab/${e}`)), {
|
|
16
16
|
owner: null,
|
|
17
17
|
watching: !1,
|
|
18
18
|
watchers: []
|
|
@@ -20,47 +20,50 @@ function d(e) {
|
|
|
20
20
|
staleTime: 3e4
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
queryKey:
|
|
27
|
-
queryFn: async () => r(await
|
|
23
|
+
function d(e, t) {
|
|
24
|
+
const o = i();
|
|
25
|
+
return s({
|
|
26
|
+
queryKey: u.links(e),
|
|
27
|
+
queryFn: async () => r(await o.request(c(`/layout-collab/${e}/preview-links`)), []),
|
|
28
28
|
enabled: t,
|
|
29
29
|
staleTime: 15e3
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
function C(e) {
|
|
33
33
|
const t = i();
|
|
34
|
-
return
|
|
35
|
-
queryKey:
|
|
36
|
-
queryFn: async () => r(await t.request(
|
|
34
|
+
return s({
|
|
35
|
+
queryKey: u.comments(e),
|
|
36
|
+
queryFn: async () => r(await t.request(c(`/layout-collab/${e}/preview-comments`)), []),
|
|
37
37
|
staleTime: 3e4,
|
|
38
38
|
refetchOnWindowFocus: !0
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
function h(e) {
|
|
42
|
-
const t = i(),
|
|
43
|
-
() =>
|
|
44
|
-
[
|
|
42
|
+
const t = i(), o = m(), a = b(
|
|
43
|
+
() => o.invalidateQueries({ queryKey: ["layout-editor", "collab"] }),
|
|
44
|
+
[o]
|
|
45
45
|
);
|
|
46
46
|
return {
|
|
47
47
|
setWatch: async (n) => {
|
|
48
|
-
await t.request(
|
|
48
|
+
await t.request(l(`/layout-collab/${e}/watch`, { on: n })), await a();
|
|
49
49
|
},
|
|
50
50
|
setOwner: async (n) => {
|
|
51
|
-
await t.request(
|
|
51
|
+
await t.request(l(`/layout-collab/${e}/owner`, { user_id: n })), await a();
|
|
52
|
+
},
|
|
53
|
+
setReviewMonths: async (n) => {
|
|
54
|
+
await t.request(l(`/layout-collab/${e}/review`, { months: n })), await a();
|
|
52
55
|
},
|
|
53
56
|
createLink: async (n) => {
|
|
54
57
|
const y = await t.request(
|
|
55
58
|
q(`/layout-collab/${e}/preview-links`, { days: n })
|
|
56
59
|
);
|
|
57
|
-
return await
|
|
60
|
+
return await a(), r(y, null);
|
|
58
61
|
},
|
|
59
62
|
revokeLink: async (n) => {
|
|
60
|
-
await t.request(
|
|
63
|
+
await t.request(w(`/layout-collab/preview-links/${n}`)), await a();
|
|
61
64
|
},
|
|
62
65
|
resolveComment: async (n) => {
|
|
63
|
-
await t.request(
|
|
66
|
+
await t.request(w(`/layout-collab/${e}/preview-comments/${n}`)), await a();
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
}
|
|
@@ -68,10 +71,10 @@ function K(e) {
|
|
|
68
71
|
return typeof window > "u" ? e : new URL(e, window.location.origin).toString();
|
|
69
72
|
}
|
|
70
73
|
export {
|
|
71
|
-
|
|
74
|
+
u as collabKeys,
|
|
72
75
|
K as previewUrl,
|
|
73
76
|
h as useCollabActions,
|
|
74
|
-
|
|
77
|
+
$ as useLayoutCollab,
|
|
75
78
|
C as usePreviewComments,
|
|
76
|
-
|
|
79
|
+
d as usePreviewLinks
|
|
77
80
|
};
|