@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
|
@@ -4,7 +4,7 @@ import { useId as V, useEffect as W, useState as j, useMemo as R, useRef as X, u
|
|
|
4
4
|
import { createPortal as F } from "react-dom";
|
|
5
5
|
import { cn as m } from "../../lib/utils.js";
|
|
6
6
|
import { PopoverTrigger as I, Popover as $, PopoverContent as ee, PopoverAnchor as te } from "../ui/popover.js";
|
|
7
|
-
const S = "inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] font-medium text-slate-700 transition-colors hover:bg-slate-50 disabled:pointer-events-none disabled:opacity-40 dark:border-border dark:bg-card dark:text-foreground dark:hover:bg-muted", H = "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 disabled:pointer-events-none disabled:opacity-40 dark:text-muted-foreground dark:hover:text-foreground", L = "border-nvr-cyan/40 bg-nvr-cyan/10 text-slate-900 dark:text-foreground", q = "bg-accent text-slate-900 dark:text-foreground", C = "inline-flex min-w-[18px] items-center justify-center rounded-full bg-nvr-cyan/15 px-1 text-[11px] font-semibold tabular-nums text-slate-800 dark:text-foreground", re = "flex min-h-8 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-[12.5px] text-slate-700 outline-none transition-colors hover:bg-muted focus-visible:bg-muted disabled:pointer-events-none disabled:opacity-40 dark:text-foreground", K = Z(null);
|
|
7
|
+
const S = "inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] font-medium text-slate-700 transition-colors hover:bg-slate-50 disabled:pointer-events-none disabled:opacity-40 dark:border-border dark:bg-card dark:text-foreground dark:hover:bg-muted", H = "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 disabled:pointer-events-none disabled:opacity-40 dark:text-muted-foreground dark:hover:text-foreground", L = "border-nvr-cyan/40 bg-nvr-cyan/10 text-slate-900 dark:text-foreground", q = "bg-accent text-slate-900 dark:text-foreground", C = "inline-flex min-w-[18px] items-center justify-center rounded-full bg-nvr-cyan/15 px-1 text-[11px] font-semibold tabular-nums text-slate-800 dark:text-foreground", re = "flex min-h-8 w-full shrink-0 items-center gap-2 rounded-md px-2 py-1 text-left text-[12.5px] text-slate-700 outline-none transition-colors hover:bg-muted focus-visible:bg-muted disabled:pointer-events-none disabled:opacity-40 dark:text-foreground", K = Z(null);
|
|
8
8
|
function O() {
|
|
9
9
|
return Y(K);
|
|
10
10
|
}
|
|
@@ -30,22 +30,22 @@ function fe({
|
|
|
30
30
|
className: o,
|
|
31
31
|
data: N
|
|
32
32
|
}) {
|
|
33
|
-
const [c, d] = j(!1), [g, u] = j(null), [v, f] = j(null),
|
|
33
|
+
const [c, d] = j(!1), [g, u] = j(null), [v, f] = j(null), k = R(() => ({ current: v }), [v]), p = X(!1), [h, D] = j({}), B = T((a, w) => {
|
|
34
34
|
D((y) => {
|
|
35
|
-
if (
|
|
35
|
+
if (w == null) {
|
|
36
36
|
if (!(a in y)) return y;
|
|
37
37
|
const { [a]: oe, ...z } = y;
|
|
38
38
|
return z;
|
|
39
39
|
}
|
|
40
40
|
const M = y[a];
|
|
41
|
-
return M && M.badge ===
|
|
41
|
+
return M && M.badge === w.badge && M.dot === w.dot ? y : { ...y, [a]: w };
|
|
42
42
|
});
|
|
43
43
|
}, []), A = T((a) => {
|
|
44
44
|
p.current = !!a, d(!1), a == null || a();
|
|
45
45
|
}, []), U = R(
|
|
46
|
-
() => ({ open: c, list: g, anchor:
|
|
47
|
-
[c, g,
|
|
48
|
-
), E = Object.values(h), P = E.reduce((a,
|
|
46
|
+
() => ({ open: c, list: g, anchor: k, pick: A, report: B }),
|
|
47
|
+
[c, g, k, A, B]
|
|
48
|
+
), E = Object.values(h), P = E.reduce((a, w) => a + (w.badge ?? 0), 0), _ = E.some((a) => a.dot);
|
|
49
49
|
return /* @__PURE__ */ x(K.Provider, { value: U, children: [
|
|
50
50
|
s,
|
|
51
51
|
E.length > 0 && /* @__PURE__ */ x($, { open: c, onOpenChange: d, children: [
|
|
@@ -139,7 +139,7 @@ function he(e) {
|
|
|
139
139
|
checked: u,
|
|
140
140
|
active: v,
|
|
141
141
|
iconOnly: f,
|
|
142
|
-
trailing:
|
|
142
|
+
trailing: k,
|
|
143
143
|
ariaLabel: p,
|
|
144
144
|
className: h,
|
|
145
145
|
buttonRef: D,
|
|
@@ -163,7 +163,7 @@ function he(e) {
|
|
|
163
163
|
children: [
|
|
164
164
|
o,
|
|
165
165
|
!f && b,
|
|
166
|
-
|
|
166
|
+
k
|
|
167
167
|
]
|
|
168
168
|
}
|
|
169
169
|
);
|
|
@@ -185,7 +185,7 @@ function ae({
|
|
|
185
185
|
badge: u,
|
|
186
186
|
dot: v,
|
|
187
187
|
ariaLabel: f,
|
|
188
|
-
data:
|
|
188
|
+
data: k
|
|
189
189
|
}) {
|
|
190
190
|
const p = e.open && e.list ? F(
|
|
191
191
|
/* @__PURE__ */ x(
|
|
@@ -195,7 +195,7 @@ function ae({
|
|
|
195
195
|
...d === void 0 ? { role: "menuitem" } : { role: "menuitemcheckbox", "aria-checked": d },
|
|
196
196
|
"aria-label": f,
|
|
197
197
|
disabled: c,
|
|
198
|
-
...
|
|
198
|
+
...k,
|
|
199
199
|
onClick: (h) => {
|
|
200
200
|
if (i) return e.pick(b);
|
|
201
201
|
if (d !== void 0) return o == null ? void 0 : o(h);
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { jsxs as l, Fragment as k, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { FlaskConical as V } from "lucide-react";
|
|
3
|
+
import { useState as f, useMemo as H } from "react";
|
|
4
|
+
import { toast as w } from "sonner";
|
|
5
|
+
import { cn as L } from "../../../lib/utils.js";
|
|
6
|
+
import { SimpleSelect as C } from "../../ui/SimpleSelect.js";
|
|
7
|
+
import { Skeleton as S } from "../../ui/skeleton.js";
|
|
8
|
+
import { apiFailure as j, useLayoutOverview as q } from "../overview/overview-api.js";
|
|
9
|
+
import { useAbTest as U, useAbResults as K, useAbActions as B, useSplittableRoles as W } from "./ab-api.js";
|
|
10
|
+
import { formatDuration as $ } from "./usage-api.js";
|
|
11
|
+
const Y = "px-3 pb-1.5 pt-4 text-[12px] font-semibold text-slate-700 dark:text-foreground", x = "px-3 text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", R = "inline-flex h-7 items-center rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-40", z = "inline-flex h-7 items-center 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", A = "inline-flex h-7 items-center rounded-md border border-slate-200 bg-white px-2.5 text-[12px] font-medium text-slate-700 transition-colors hover:bg-muted disabled:opacity-40 dark:border-border dark:bg-card dark:text-foreground", _ = 20, p = "__copy__", I = (e) => e ? new Date(e).toLocaleDateString(void 0, { month: "short", day: "numeric" }) : "", N = (e) => e == null ? "—" : `${Math.round(e * 100)}%`, i = (e) => e.toLocaleString();
|
|
12
|
+
function E(e, o) {
|
|
13
|
+
w.error(j(e, o).message);
|
|
14
|
+
}
|
|
15
|
+
function G(e) {
|
|
16
|
+
const o = (r, n) => r == null || n == null ? null : [r, n], a = (r) => r.created > 0 ? r.edited_after_save / r.created : null;
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
label: "People in the half",
|
|
20
|
+
a: i(e.a.people),
|
|
21
|
+
b: i(e.b.people),
|
|
22
|
+
cmp: null,
|
|
23
|
+
better: null
|
|
24
|
+
},
|
|
25
|
+
{ label: "Opened", a: i(e.a.opens), b: i(e.b.opens), cmp: null, better: null },
|
|
26
|
+
{
|
|
27
|
+
label: "Saved",
|
|
28
|
+
a: N(e.a.save_rate),
|
|
29
|
+
b: N(e.b.save_rate),
|
|
30
|
+
tipA: `${i(e.a.saves)} saves in ${i(e.a.opens)} visits`,
|
|
31
|
+
tipB: `${i(e.b.saves)} saves in ${i(e.b.opens)} visits`,
|
|
32
|
+
cmp: o(e.a.save_rate, e.b.save_rate),
|
|
33
|
+
better: "higher"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Time to save",
|
|
37
|
+
a: e.a.avg_save_ms == null ? "—" : $(e.a.avg_save_ms),
|
|
38
|
+
b: e.b.avg_save_ms == null ? "—" : $(e.b.avg_save_ms),
|
|
39
|
+
cmp: o(e.a.avg_save_ms, e.b.avg_save_ms),
|
|
40
|
+
better: "lower"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Left unfinished",
|
|
44
|
+
a: i(e.a.abandons),
|
|
45
|
+
b: i(e.b.abandons),
|
|
46
|
+
cmp: e.a.opens > 0 && e.b.opens > 0 ? [e.a.abandons / e.a.opens, e.b.abandons / e.b.opens] : null,
|
|
47
|
+
better: "lower"
|
|
48
|
+
},
|
|
49
|
+
{ label: "Records created", a: i(e.a.created), b: i(e.b.created), cmp: null, better: null },
|
|
50
|
+
{
|
|
51
|
+
label: "Edited again within a day",
|
|
52
|
+
a: e.a.created ? N(a(e.a)) : "—",
|
|
53
|
+
b: e.b.created ? N(a(e.b)) : "—",
|
|
54
|
+
tipA: `${i(e.a.edited_after_save)} of ${i(e.a.created)} records`,
|
|
55
|
+
tipB: `${i(e.b.edited_after_save)} of ${i(e.b.created)} records`,
|
|
56
|
+
cmp: o(a(e.a), a(e.b)),
|
|
57
|
+
better: "lower"
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
function J(e) {
|
|
62
|
+
if (!e.cmp || !e.better) return null;
|
|
63
|
+
const [o, a] = e.cmp;
|
|
64
|
+
return o === a ? null : (e.better === "higher" ? o > a : o < a) ? "a" : "b";
|
|
65
|
+
}
|
|
66
|
+
function Q({ test: e, layoutId: o }) {
|
|
67
|
+
const { data: a, isLoading: r, isError: n } = K(o, !0);
|
|
68
|
+
if (r) return /* @__PURE__ */ t(S, { className: "mx-3 h-40 rounded-lg" });
|
|
69
|
+
if (n || !a)
|
|
70
|
+
return /* @__PURE__ */ t("p", { className: x, children: "The numbers could not be loaded. Try again in a moment." });
|
|
71
|
+
const h = G(a), d = a.a.opens < _ || a.b.opens < _, u = (s, b) => /* @__PURE__ */ t(
|
|
72
|
+
"th",
|
|
73
|
+
{
|
|
74
|
+
scope: "col",
|
|
75
|
+
className: "px-2 py-1.5 text-right text-[11.5px] font-medium text-slate-500 dark:text-muted-foreground",
|
|
76
|
+
"data-tip": b,
|
|
77
|
+
children: s
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ l(k, { children: [
|
|
81
|
+
/* @__PURE__ */ t("div", { className: "mx-3 overflow-hidden rounded-lg border border-slate-200 dark:border-border", children: /* @__PURE__ */ l("table", { "data-ab-results": "", className: "w-full table-fixed text-[12px]", children: [
|
|
82
|
+
/* @__PURE__ */ l("colgroup", { children: [
|
|
83
|
+
/* @__PURE__ */ t("col", { className: "w-[40%]" }),
|
|
84
|
+
/* @__PURE__ */ t("col", {}),
|
|
85
|
+
/* @__PURE__ */ t("col", {})
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ t("thead", { className: "bg-slate-50 dark:bg-muted/40", children: /* @__PURE__ */ l("tr", { children: [
|
|
88
|
+
/* @__PURE__ */ t("th", { scope: "col", className: "px-2 py-1.5 text-left", children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Measure" }) }),
|
|
89
|
+
u("Original", e.control.name),
|
|
90
|
+
u("New", e.variant.name)
|
|
91
|
+
] }) }),
|
|
92
|
+
/* @__PURE__ */ t("tbody", { children: h.map((s) => {
|
|
93
|
+
const b = d ? null : J(s), c = (g, v) => /* @__PURE__ */ t(
|
|
94
|
+
"td",
|
|
95
|
+
{
|
|
96
|
+
"data-tip": g === "a" ? s.tipA : s.tipB,
|
|
97
|
+
className: L(
|
|
98
|
+
"whitespace-nowrap px-2 py-1.5 text-right tabular-nums",
|
|
99
|
+
b === g ? "font-semibold text-slate-900 dark:text-foreground" : "text-slate-600 dark:text-muted-foreground"
|
|
100
|
+
),
|
|
101
|
+
children: v
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
return /* @__PURE__ */ l(
|
|
105
|
+
"tr",
|
|
106
|
+
{
|
|
107
|
+
className: "border-t border-slate-100 first:border-t-0 dark:border-border",
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
"th",
|
|
111
|
+
{
|
|
112
|
+
scope: "row",
|
|
113
|
+
className: "px-2 py-1.5 text-left font-normal text-slate-700 dark:text-foreground",
|
|
114
|
+
children: s.label
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
c("a", s.a),
|
|
118
|
+
c("b", s.b)
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
s.label
|
|
122
|
+
);
|
|
123
|
+
}) })
|
|
124
|
+
] }) }),
|
|
125
|
+
/* @__PURE__ */ l("p", { className: `${x} pt-1.5`, children: [
|
|
126
|
+
d ? `Too few visits to compare yet: the better side is marked once each half has ${_} visits.` : "The better side of each comparable line is in bold.",
|
|
127
|
+
" ",
|
|
128
|
+
"Records created and edited again count records people in each half made since",
|
|
129
|
+
" ",
|
|
130
|
+
I(a.since),
|
|
131
|
+
", on any form.",
|
|
132
|
+
!a.ready && " Visits are not being recorded on this instance yet."
|
|
133
|
+
] })
|
|
134
|
+
] });
|
|
135
|
+
}
|
|
136
|
+
function X({
|
|
137
|
+
test: e,
|
|
138
|
+
layoutId: o,
|
|
139
|
+
collection: a
|
|
140
|
+
}) {
|
|
141
|
+
const r = B(o, a), [n, h] = f(!1), [d, u] = f(!1), s = async (b) => {
|
|
142
|
+
u(!0);
|
|
143
|
+
try {
|
|
144
|
+
await r.end(b), w.success(
|
|
145
|
+
b === "variant" ? `“${e.control.name}” now has the new version’s design` : "Test ended; everyone gets the original form"
|
|
146
|
+
), h(!1);
|
|
147
|
+
} catch (c) {
|
|
148
|
+
E(c, "Could not end the test");
|
|
149
|
+
} finally {
|
|
150
|
+
u(!1);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
return n ? /* @__PURE__ */ l(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
"data-ab-end-confirm": "",
|
|
157
|
+
className: "mx-3 mt-2 flex flex-col gap-2 rounded-lg border border-slate-200 bg-white p-2.5 dark:border-border dark:bg-card",
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ t("p", { className: "m-0 text-[12px] leading-snug text-slate-700 dark:text-foreground", children: "Which version should everyone get?" }),
|
|
160
|
+
/* @__PURE__ */ l("p", { className: "m-0 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: [
|
|
161
|
+
"Using the new version copies its sections and fields onto “",
|
|
162
|
+
e.control.name,
|
|
163
|
+
"”, so its links and history stay. History can put it back."
|
|
164
|
+
] }),
|
|
165
|
+
/* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
166
|
+
/* @__PURE__ */ t(
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
type: "button",
|
|
170
|
+
className: R,
|
|
171
|
+
disabled: d,
|
|
172
|
+
onClick: () => void s("variant"),
|
|
173
|
+
children: "Use the new version"
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ l(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
className: A,
|
|
181
|
+
disabled: d,
|
|
182
|
+
onClick: () => void s("control"),
|
|
183
|
+
children: [
|
|
184
|
+
"Keep “",
|
|
185
|
+
e.control.name,
|
|
186
|
+
"”"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ t(
|
|
191
|
+
"button",
|
|
192
|
+
{
|
|
193
|
+
type: "button",
|
|
194
|
+
className: z,
|
|
195
|
+
disabled: d,
|
|
196
|
+
onClick: () => h(!1),
|
|
197
|
+
children: "Cancel"
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
] })
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
) : /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5 px-3 pt-2", children: /* @__PURE__ */ t(
|
|
204
|
+
"button",
|
|
205
|
+
{
|
|
206
|
+
type: "button",
|
|
207
|
+
className: A,
|
|
208
|
+
onClick: () => h(!0),
|
|
209
|
+
"data-ab-end": "",
|
|
210
|
+
children: "End test"
|
|
211
|
+
}
|
|
212
|
+
) });
|
|
213
|
+
}
|
|
214
|
+
function Z({
|
|
215
|
+
bundle: e,
|
|
216
|
+
collection: o,
|
|
217
|
+
onOpenLayout: a
|
|
218
|
+
}) {
|
|
219
|
+
const r = Number(e.layout.id), { data: n = [], isLoading: h } = W(!0), { data: d } = q(o), u = B(r, o), [s, b] = f(""), [c, g] = f(p), [v, T] = f(!1), F = H(
|
|
220
|
+
() => ((d == null ? void 0 : d.rows) ?? []).filter(
|
|
221
|
+
(m) => m.layout_id !== r && m.layout_type === "grouped" && !m.is_default && m.reason.kind !== "ab"
|
|
222
|
+
),
|
|
223
|
+
[d, r]
|
|
224
|
+
);
|
|
225
|
+
if (h) return /* @__PURE__ */ t(S, { className: "mx-3 h-16 rounded-lg" });
|
|
226
|
+
if (n.length === 0)
|
|
227
|
+
return /* @__PURE__ */ t("p", { className: x, children: "There is no role to split: administrators always get the original form." });
|
|
228
|
+
const P = async () => {
|
|
229
|
+
var m;
|
|
230
|
+
if (s) {
|
|
231
|
+
T(!0);
|
|
232
|
+
try {
|
|
233
|
+
const y = c === p ? await u.copy(String(e.layout.name ?? "Form")) : Number(c);
|
|
234
|
+
await u.start(y, s);
|
|
235
|
+
const D = ((m = n.find((M) => M.id === s)) == null ? void 0 : m.name) ?? "the role";
|
|
236
|
+
w.success(`Test started: half of ${D} get the new version`), c === p && (a == null || a(y));
|
|
237
|
+
} catch (y) {
|
|
238
|
+
E(y, "Could not start the test");
|
|
239
|
+
} finally {
|
|
240
|
+
T(!1);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
return /* @__PURE__ */ l("div", { "data-ab-start": "", className: "flex flex-col gap-2 px-3", children: [
|
|
245
|
+
/* @__PURE__ */ t("p", { className: "m-0 text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", children: "Show a new version of this form to half of one role, then compare how quickly each half saves and how often their records are edited again." }),
|
|
246
|
+
/* @__PURE__ */ t(
|
|
247
|
+
C,
|
|
248
|
+
{
|
|
249
|
+
value: s,
|
|
250
|
+
onChange: b,
|
|
251
|
+
ariaLabel: "Role to split",
|
|
252
|
+
className: "h-8 w-full text-[12.5px]",
|
|
253
|
+
options: [
|
|
254
|
+
{ value: "", label: "Pick a role to split" },
|
|
255
|
+
...n.map((m) => ({ value: m.id, label: m.name }))
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ t(
|
|
260
|
+
C,
|
|
261
|
+
{
|
|
262
|
+
value: c,
|
|
263
|
+
onChange: g,
|
|
264
|
+
ariaLabel: "New version",
|
|
265
|
+
className: "h-8 w-full text-[12.5px]",
|
|
266
|
+
options: [
|
|
267
|
+
{ value: p, label: "A copy of this form to change" },
|
|
268
|
+
...F.map((m) => ({ value: String(m.layout_id), label: m.name }))
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
273
|
+
"button",
|
|
274
|
+
{
|
|
275
|
+
type: "button",
|
|
276
|
+
className: R,
|
|
277
|
+
disabled: !s || v,
|
|
278
|
+
onClick: () => void P(),
|
|
279
|
+
children: v ? "Starting…" : "Start test"
|
|
280
|
+
}
|
|
281
|
+
) }),
|
|
282
|
+
c === p && /* @__PURE__ */ t("p", { className: "m-0 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: "The copy opens here so you can make your changes. People see each change as soon as it is saved." })
|
|
283
|
+
] });
|
|
284
|
+
}
|
|
285
|
+
function de({
|
|
286
|
+
bundle: e,
|
|
287
|
+
collection: o,
|
|
288
|
+
onOpenLayout: a
|
|
289
|
+
}) {
|
|
290
|
+
const r = Number(e.layout.id), { data: n, isLoading: h, isError: d } = U(r), u = e.layout.layout_type;
|
|
291
|
+
if (u != null && u !== "grouped") return null;
|
|
292
|
+
let s;
|
|
293
|
+
if (h) s = /* @__PURE__ */ t(S, { className: "mx-3 h-12 rounded-lg" });
|
|
294
|
+
else if (d) s = /* @__PURE__ */ t("p", { className: x, children: "The A/B test could not be loaded." });
|
|
295
|
+
else if (!n)
|
|
296
|
+
s = /* @__PURE__ */ t(Z, { bundle: e, collection: o, onOpenLayout: a });
|
|
297
|
+
else {
|
|
298
|
+
const b = n.side === "variant", c = b ? n.control : n.variant;
|
|
299
|
+
s = /* @__PURE__ */ l(k, { children: [
|
|
300
|
+
/* @__PURE__ */ l("p", { "data-ab-running": "", className: x, children: [
|
|
301
|
+
/* @__PURE__ */ t(V, { className: "mr-1 inline h-3.5 w-3.5 align-[-2px] text-slate-400" }),
|
|
302
|
+
/* @__PURE__ */ l("span", { children: [
|
|
303
|
+
b ? /* @__PURE__ */ l(k, { children: [
|
|
304
|
+
"This is the new version: half of",
|
|
305
|
+
" ",
|
|
306
|
+
/* @__PURE__ */ t("b", { className: "font-semibold text-slate-700 dark:text-foreground", children: n.role.name }),
|
|
307
|
+
" ",
|
|
308
|
+
"get it instead of “",
|
|
309
|
+
n.control.name,
|
|
310
|
+
"”."
|
|
311
|
+
] }) : /* @__PURE__ */ l(k, { children: [
|
|
312
|
+
"Half of",
|
|
313
|
+
" ",
|
|
314
|
+
/* @__PURE__ */ t("b", { className: "font-semibold text-slate-700 dark:text-foreground", children: n.role.name }),
|
|
315
|
+
" ",
|
|
316
|
+
"get “",
|
|
317
|
+
n.variant.name,
|
|
318
|
+
"” instead of this form."
|
|
319
|
+
] }),
|
|
320
|
+
" ",
|
|
321
|
+
"Since ",
|
|
322
|
+
I(n.started_at),
|
|
323
|
+
n.started_by ? `, started by ${n.started_by.name}` : "",
|
|
324
|
+
"."
|
|
325
|
+
] }),
|
|
326
|
+
a && " ",
|
|
327
|
+
a && /* @__PURE__ */ l(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
type: "button",
|
|
331
|
+
className: "font-medium text-[#0089ad] hover:underline dark:text-nvr-cyan",
|
|
332
|
+
onClick: () => a(c.id),
|
|
333
|
+
children: [
|
|
334
|
+
"Open “",
|
|
335
|
+
c.name,
|
|
336
|
+
"”"
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
] }),
|
|
341
|
+
/* @__PURE__ */ t("div", { className: "pt-2", children: /* @__PURE__ */ t(Q, { test: n, layoutId: r }) }),
|
|
342
|
+
/* @__PURE__ */ t(X, { test: n, layoutId: r, collection: o })
|
|
343
|
+
] });
|
|
344
|
+
}
|
|
345
|
+
return /* @__PURE__ */ l("section", { "data-ab-test": "", "aria-label": "A/B test", children: [
|
|
346
|
+
/* @__PURE__ */ t("p", { className: Y, children: "A/B test" }),
|
|
347
|
+
s
|
|
348
|
+
] });
|
|
349
|
+
}
|
|
350
|
+
export {
|
|
351
|
+
de as AbTestSection,
|
|
352
|
+
_ as MIN_VISITS_PER_HALF,
|
|
353
|
+
G as abRows,
|
|
354
|
+
J as betterSide
|
|
355
|
+
};
|