@nivaro/react 0.2.54 → 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.
Files changed (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/worker-socket.js +200 -0
  150. 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 O } from "@tanstack/react-query";
3
- import { MessageSquare as P, Share2 as W, BellRing as B, Bell as T, Link2 as q, Copy as D, Crosshair as _, X as j } from "lucide-react";
4
- import { useState as f } from "react";
5
- import { toast as b } from "sonner";
6
- import { useNivaroClient as F } from "../../../context.js";
7
- import { get as R } from "../../../lib/commands.js";
8
- import { cn as x } from "../../../lib/utils.js";
9
- import { Popover as A, PopoverContent as K } from "../../ui/popover.js";
10
- import { SimpleSelect as U } from "../../ui/SimpleSelect.js";
11
- import { apiFailure as $ } from "../overview/overview-api.js";
12
- import { ToolButton as N } from "../toolbar-kit.js";
13
- import { useLayoutCollab as C, usePreviewComments as E, useCollabActions as w, usePreviewLinks as H, previewUrl as k } from "./collab-api.js";
14
- const h = "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", v = "text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", L = (s) => s ? new Date(s).toLocaleDateString(void 0, { month: "short", day: "numeric" }) : "";
15
- function y(s, o) {
16
- b.error($(s, o).message);
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 oe({ layoutId: s }) {
19
- const { data: o } = C(s), m = w(s), [d, l] = f(!1), t = !!(o != null && o.watching);
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
- N,
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(B, { className: "h-4 w-4" }) : /* @__PURE__ */ e(T, { className: "h-4 w-4" }),
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: x(t && "text-[#0089ad] dark:text-nvr-cyan"),
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
- l(!0);
34
+ c(!0);
35
35
  try {
36
36
  await m.setWatch(!t);
37
37
  } catch (i) {
38
- y(i, "Could not change the watch");
38
+ w(i, "Could not change the watch");
39
39
  } finally {
40
- l(!1);
40
+ c(!1);
41
41
  }
42
42
  }
43
43
  }
44
44
  );
45
45
  }
46
- function M({ layoutId: s, owner: o }) {
47
- const m = F(), d = w(s), [l, t] = f(!1), [i, p] = f(""), { data: u = [] } = O({
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(R("/users", { search: i, limit: 6, people: "1" })).then((n) => n.data ?? []),
50
- enabled: l && i.trim().length > 1
51
- }), c = async (n) => {
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(n), t(!1), p("");
53
+ await d.setOwner(s), t(!1), h("");
54
54
  } catch (a) {
55
- y(a, "Could not change the owner");
55
+ w(a, "Could not change the owner");
56
56
  }
57
57
  };
58
- return l ? /* @__PURE__ */ r("div", { children: [
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: (n) => p(n.target.value),
66
- onKeyDown: (n) => n.key === "Escape" && t(!1),
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(v, "px-2.5 py-1.5"), children: "No one matches" }) : u.map((n) => {
72
- const a = `${n.first_name ?? ""} ${n.last_name ?? ""}`.trim() || n.email;
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 c(n.id),
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: n.email })
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
- n.id
84
+ s.id
85
85
  );
86
86
  }) }),
87
- /* @__PURE__ */ e("button", { type: "button", className: x(h, "mt-1"), onClick: () => t(!1), children: "Cancel" })
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: x(
93
+ className: y(
94
94
  "min-w-0 flex-1 truncate text-[12.5px]",
95
- o ? "text-slate-800 dark:text-foreground" : "text-slate-400 dark:text-muted-foreground"
95
+ n ? "text-slate-800 dark:text-foreground" : "text-slate-400 dark:text-muted-foreground"
96
96
  ),
97
- children: (o == null ? void 0 : o.name) ?? "No owner yet"
97
+ children: (n == null ? void 0 : n.name) ?? "No owner yet"
98
98
  }
99
99
  ),
100
- /* @__PURE__ */ e("button", { type: "button", className: h, onClick: () => t(!0), children: o ? "Change" : "Name an owner" }),
101
- o && /* @__PURE__ */ e("button", { type: "button", className: h, onClick: () => void c(null), children: "Clear" })
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
- function Q({ layoutId: s, open: o }) {
105
- const { data: m = [] } = H(s, o), d = w(s), [l, t] = f("14"), [i, p] = f(!1), [u, c] = f(null), n = async (a) => {
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(k(a)), b.success("Link copied");
149
+ await navigator.clipboard.writeText(C(a)), k.success("Link copied");
108
150
  } catch {
109
- b.error("Could not copy — select the link and copy it");
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: v, 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." }),
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
- U,
158
+ L,
117
159
  {
118
- value: l,
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
- p(!0);
179
+ h(!0);
138
180
  try {
139
- const a = await d.createLink(Number(l));
140
- a != null && a.path && await n(a.path);
181
+ const a = await d.createLink(Number(c));
182
+ a != null && a.path && await s(a.path);
141
183
  } catch (a) {
142
- y(a, "Could not create the link");
184
+ w(a, "Could not create the link");
143
185
  } finally {
144
- p(!1);
186
+ h(!1);
145
187
  }
146
188
  },
147
189
  children: [
148
- /* @__PURE__ */ e(q, { className: "h-3.5 w-3.5" }),
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: k(a.path) }),
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
- L(a.expires_at)
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: h, onClick: () => void n(a.path), children: [
180
- /* @__PURE__ */ e(D, { className: "h-3 w-3" }),
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: x(h, "text-red-600 dark:text-red-400"),
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 (S) {
192
- y(S, "Could not turn the link off");
233
+ } catch (b) {
234
+ w(b, "Could not turn the link off");
193
235
  }
194
- c(null);
236
+ l(null);
195
237
  },
196
238
  children: "Turn off for everyone"
197
239
  }
198
- ) : /* @__PURE__ */ e("button", { type: "button", className: h, onClick: () => c(a.id), children: "Turn off" })
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 X({
207
- layoutId: s,
208
- comments: o,
248
+ function z({
249
+ layoutId: o,
250
+ comments: n,
209
251
  fieldLabel: m,
210
252
  onSelectField: d
211
253
  }) {
212
- const l = w(s);
213
- return o.length === 0 ? /* @__PURE__ */ e("p", { className: v, children: "No comments yet. People with a preview link leave them here." }) : /* @__PURE__ */ e("ul", { className: "space-y-1.5", children: o.map((t) => /* @__PURE__ */ r(
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
- L(t.at)
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: h,
276
+ className: f,
235
277
  onClick: () => d(t.field),
236
- children: /* @__PURE__ */ e(_, { className: "h-3 w-3" })
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: h,
287
+ className: f,
246
288
  onClick: async () => {
247
289
  try {
248
- await l.resolveComment(t.id);
290
+ await c.resolveComment(t.id);
249
291
  } catch (i) {
250
- y(i, "Could not resolve the comment");
292
+ w(i, "Could not resolve the comment");
251
293
  }
252
294
  },
253
- children: /* @__PURE__ */ e(j, { className: "h-3 w-3" })
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 ie({
264
- layoutId: s,
265
- fields: o,
305
+ function ce({
306
+ layoutId: o,
307
+ fields: n,
266
308
  onSelectField: m
267
309
  }) {
268
- const [d, l] = f(!1), { data: t } = C(s), { data: i = [] } = E(s), p = (c) => {
269
- var n;
270
- return ((n = o.find((a) => a.field === c)) == null ? void 0 : n.label) || c;
271
- }, u = ((t == null ? void 0 : t.watchers) ?? []).filter((c) => {
272
- var n;
273
- return c.id !== ((n = t == null ? void 0 : t.owner) == null ? void 0 : n.id);
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(A, { open: d, onOpenChange: l, children: [
317
+ return /* @__PURE__ */ r(F, { open: d, onOpenChange: c, children: [
276
318
  /* @__PURE__ */ e(
277
- N,
319
+ _,
278
320
  {
279
321
  popover: !0,
280
- onOpen: () => l(!0),
322
+ onOpen: () => c(!0),
281
323
  label: "Share & watchers",
282
324
  ariaLabel: "Share",
283
- icon: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5" }),
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
- K,
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(M, { layoutId: s, owner: (t == null ? void 0 : t.owner) ?? null }),
310
- /* @__PURE__ */ e("p", { className: v, children: "The business owner hears first about change requests and every saved change." })
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: v, children: u.length === 0 ? "No one else watches this form. Use the bell to watch it yourself." : u.map((c) => c.name).join(", ") })
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(Q, { layoutId: s, open: d })
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
- X,
369
+ z,
324
370
  {
325
- layoutId: s,
371
+ layoutId: o,
326
372
  comments: i,
327
- fieldLabel: p,
328
- onSelectField: m ? (c) => {
329
- m(c), l(!1);
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
- ie as ShareButton,
341
- oe as WatchButton
386
+ ce as ShareButton,
387
+ le as WatchButton
342
388
  };
@@ -1,18 +1,18 @@
1
- import { useQuery as l, useQueryClient as m } from "@tanstack/react-query";
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 s, del as u, post as q, put as w } from "../../../lib/commands.js";
5
- const c = {
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 d(e) {
11
+ function $(e) {
12
12
  const t = i();
13
- return l({
14
- queryKey: c.one(e),
15
- queryFn: async () => r(await t.request(s(`/layout-collab/${e}`)), {
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 $(e, t) {
24
- const a = i();
25
- return l({
26
- queryKey: c.links(e),
27
- queryFn: async () => r(await a.request(s(`/layout-collab/${e}/preview-links`)), []),
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 l({
35
- queryKey: c.comments(e),
36
- queryFn: async () => r(await t.request(s(`/layout-collab/${e}/preview-comments`)), []),
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(), a = m(), o = b(
43
- () => a.invalidateQueries({ queryKey: ["layout-editor", "collab"] }),
44
- [a]
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(w(`/layout-collab/${e}/watch`, { on: n })), await o();
48
+ await t.request(l(`/layout-collab/${e}/watch`, { on: n })), await a();
49
49
  },
50
50
  setOwner: async (n) => {
51
- await t.request(w(`/layout-collab/${e}/owner`, { user_id: n })), await o();
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 o(), r(y, null);
60
+ return await a(), r(y, null);
58
61
  },
59
62
  revokeLink: async (n) => {
60
- await t.request(u(`/layout-collab/preview-links/${n}`)), await o();
63
+ await t.request(w(`/layout-collab/preview-links/${n}`)), await a();
61
64
  },
62
65
  resolveComment: async (n) => {
63
- await t.request(u(`/layout-collab/${e}/preview-comments/${n}`)), await o();
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
- c as collabKeys,
74
+ u as collabKeys,
72
75
  K as previewUrl,
73
76
  h as useCollabActions,
74
- d as useLayoutCollab,
77
+ $ as useLayoutCollab,
75
78
  C as usePreviewComments,
76
- $ as usePreviewLinks
79
+ d as usePreviewLinks
77
80
  };