@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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { jsx as s, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2 as y, Repeat2 as v, Sigma as b } from "lucide-react";
|
|
3
|
+
import { useContext as h, createContext as g, useState as k, useMemo as _ } from "react";
|
|
4
|
+
import { toast as u } from "sonner";
|
|
5
|
+
import { useNivaroClient as w } from "../../context.js";
|
|
6
|
+
import { get as C } from "../../lib/commands.js";
|
|
7
|
+
import { parseExpression as N, readPath as F, evaluateExpression as R } from "../../lib/expression.js";
|
|
8
|
+
import { textRulesOf as $, isRecommended as T, resolvePlacementText as j, counterError as D, confirmChangeApplies as E, isEmptyValue as f, isDisplayFormulaField as S, counterOf as A, displayFormulaOf as c, formatDisplayValue as L, countValue as P, counterState as V } from "../../lib/placement-behaviour.js";
|
|
9
|
+
import { cn as p, formatRelative as B } from "../../lib/utils.js";
|
|
10
|
+
import { useFieldAffordances as O } from "./FieldAffordances.js";
|
|
11
|
+
const q = g(null);
|
|
12
|
+
function I() {
|
|
13
|
+
const e = O(), o = h(q);
|
|
14
|
+
return (e == null ? void 0 : e.placementText) ?? o;
|
|
15
|
+
}
|
|
16
|
+
function ee(e, o) {
|
|
17
|
+
const r = { label: e.label, note: e.note };
|
|
18
|
+
if (!o || !e._overrides) return r;
|
|
19
|
+
const t = j(e._overrides, o);
|
|
20
|
+
return {
|
|
21
|
+
// A hidden label ('') stays hidden: rules change words, not the layout.
|
|
22
|
+
label: t.label !== void 0 && e.label !== "" ? t.label : r.label,
|
|
23
|
+
note: t.note ?? r.note
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function te(e) {
|
|
27
|
+
let o = !1, r = !1;
|
|
28
|
+
for (const t of e) {
|
|
29
|
+
if (!t._overrides) continue;
|
|
30
|
+
for (const l of $(t._overrides))
|
|
31
|
+
l.type === "role" ? o = !0 : r = !0;
|
|
32
|
+
const a = t._overrides.confirm_change;
|
|
33
|
+
if (a && typeof a == "object" && Array.isArray(a.state_keys) && a.state_keys.length && (r = !0), o && r) break;
|
|
34
|
+
}
|
|
35
|
+
return { role: o, state: r };
|
|
36
|
+
}
|
|
37
|
+
const M = (e) => !e.required && T(e._overrides);
|
|
38
|
+
function re(e, o, r, t) {
|
|
39
|
+
return e.filter((a) => M(a) && !a.hidden && !a.readonly && r(a)).filter((a) => f(o[a.field])).map(t);
|
|
40
|
+
}
|
|
41
|
+
function oe(e, o, r) {
|
|
42
|
+
return e.filter((t) => o.has(t.field) && E(t._overrides, r)).map((t) => t.field);
|
|
43
|
+
}
|
|
44
|
+
function ae(e, o, r) {
|
|
45
|
+
return e._overrides ? D(o, e._overrides, r) : null;
|
|
46
|
+
}
|
|
47
|
+
function ne(e) {
|
|
48
|
+
return e.interface === "display-formula" || S(e.field);
|
|
49
|
+
}
|
|
50
|
+
function le() {
|
|
51
|
+
return /* @__PURE__ */ s(
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
"data-recommended": "",
|
|
55
|
+
role: "img",
|
|
56
|
+
"aria-label": "Recommended",
|
|
57
|
+
"data-tip": "Recommended — fill it in if you can; saving still works without it",
|
|
58
|
+
className: "ml-1 inline-block h-1.5 w-1.5 translate-y-[-1px] rounded-full bg-amber-500 align-middle dark:bg-amber-400"
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
function ie({
|
|
63
|
+
collection: e,
|
|
64
|
+
itemId: o,
|
|
65
|
+
field: r,
|
|
66
|
+
label: t,
|
|
67
|
+
onFill: a
|
|
68
|
+
}) {
|
|
69
|
+
const l = w(), [i, m] = k(!1), x = async () => {
|
|
70
|
+
m(!0);
|
|
71
|
+
try {
|
|
72
|
+
const n = await l.request(
|
|
73
|
+
C("/revisions/my-last-value", {
|
|
74
|
+
collection: e,
|
|
75
|
+
field: r,
|
|
76
|
+
...o && o !== "new" ? { exclude: o } : {}
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
if (!n.data) {
|
|
80
|
+
u.info(`Nothing to repeat — you have not filled ${t} on another record yet`);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
a(n.data.value), u.success(
|
|
84
|
+
`Filled ${t} from your last record${n.data.at ? ` (${B(n.data.at)})` : ""}`
|
|
85
|
+
);
|
|
86
|
+
} catch (n) {
|
|
87
|
+
u.error((n == null ? void 0 : n.message) || "Could not read your last value");
|
|
88
|
+
} finally {
|
|
89
|
+
m(!1);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ d(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
type: "button",
|
|
96
|
+
onClick: () => void x(),
|
|
97
|
+
disabled: i,
|
|
98
|
+
"data-repeat-last": r,
|
|
99
|
+
"aria-label": `Repeat the last ${t} you entered`,
|
|
100
|
+
"data-tip": "Fill in what you entered on your previous record",
|
|
101
|
+
className: "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground",
|
|
102
|
+
children: [
|
|
103
|
+
i ? /* @__PURE__ */ s(y, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ s(v, { className: "h-3 w-3" }),
|
|
104
|
+
"Repeat last"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
function se({ value: e, config: o }) {
|
|
110
|
+
const r = P(e, o.unit), t = V(r, o.limit), a = o.unit === "words" ? r === 1 ? "word" : "words" : "characters";
|
|
111
|
+
return /* @__PURE__ */ d(
|
|
112
|
+
"p",
|
|
113
|
+
{
|
|
114
|
+
"data-field-counter": t,
|
|
115
|
+
"aria-live": "polite",
|
|
116
|
+
className: p(
|
|
117
|
+
"text-right text-[11px] tabular-nums",
|
|
118
|
+
t === "over" ? "font-medium text-red-600 dark:text-red-400" : t === "near" ? "text-amber-700 dark:text-amber-300" : "text-slate-500 dark:text-muted-foreground"
|
|
119
|
+
),
|
|
120
|
+
children: [
|
|
121
|
+
r.toLocaleString(),
|
|
122
|
+
o.limit != null ? ` / ${o.limit.toLocaleString()}` : "",
|
|
123
|
+
" ",
|
|
124
|
+
a,
|
|
125
|
+
t === "over" && " — over the limit"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function ue(e) {
|
|
131
|
+
return e._overrides ? A(e._overrides) : null;
|
|
132
|
+
}
|
|
133
|
+
function z(e, o) {
|
|
134
|
+
if (!e.trim()) return { value: null, error: "No formula yet" };
|
|
135
|
+
const r = N(e);
|
|
136
|
+
if (!r.ok) return { value: null, error: r.error };
|
|
137
|
+
if (r.tokens.length && r.tokens.every((a) => f(F(o, a))))
|
|
138
|
+
return { value: null, error: null };
|
|
139
|
+
const t = R(e, o);
|
|
140
|
+
return typeof t == "boolean" ? { value: t ? 1 : 0, error: null } : { value: typeof t == "number" && Number.isFinite(t) ? t : null, error: null };
|
|
141
|
+
}
|
|
142
|
+
function de({
|
|
143
|
+
field: e,
|
|
144
|
+
values: o
|
|
145
|
+
}) {
|
|
146
|
+
const r = _(() => {
|
|
147
|
+
const i = e.options && typeof e.options == "object" ? e.options : null;
|
|
148
|
+
return c(e._overrides) ?? c({ display_formula: i == null ? void 0 : i.display_formula });
|
|
149
|
+
}, [e._overrides, e.options]), t = (r == null ? void 0 : r.expr) ?? "", { value: a, error: l } = z(t, o);
|
|
150
|
+
return /* @__PURE__ */ d(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
"data-display-formula": e.field,
|
|
154
|
+
className: "flex h-9 items-center justify-between gap-2 rounded-md border border-slate-200 bg-slate-50 px-3 dark:border-border dark:bg-muted/40",
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ s(
|
|
157
|
+
"span",
|
|
158
|
+
{
|
|
159
|
+
className: p(
|
|
160
|
+
"min-w-0 truncate text-sm tabular-nums",
|
|
161
|
+
l ? "text-[12px] text-amber-700 dark:text-amber-300" : "font-medium text-slate-900 dark:text-foreground"
|
|
162
|
+
),
|
|
163
|
+
children: l ? t.trim() ? "This formula needs fixing" : "No formula yet" : L(a, r ?? { format: "", currency: null })
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
t.trim() && /* @__PURE__ */ s(
|
|
167
|
+
"span",
|
|
168
|
+
{
|
|
169
|
+
"data-tip": `Calculated on this page: ${t}`,
|
|
170
|
+
"aria-label": `Calculated on this page: ${t}`,
|
|
171
|
+
role: "img",
|
|
172
|
+
className: "shrink-0 text-slate-400 dark:text-muted-foreground",
|
|
173
|
+
children: /* @__PURE__ */ s(b, { className: "h-3.5 w-3.5" })
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
de as DisplayFormulaValue,
|
|
182
|
+
se as FieldCounter,
|
|
183
|
+
q as PlacementTextContext,
|
|
184
|
+
le as RecommendedMarker,
|
|
185
|
+
ie as RepeatLastButton,
|
|
186
|
+
oe as confirmChangeFields,
|
|
187
|
+
z as evaluateDisplayFormula,
|
|
188
|
+
ue as fieldCounterConfig,
|
|
189
|
+
ae as fieldCounterError,
|
|
190
|
+
M as fieldIsRecommended,
|
|
191
|
+
ne as isDisplayFormulaRow,
|
|
192
|
+
re as missingRecommended,
|
|
193
|
+
te as placementBehaviourNeeds,
|
|
194
|
+
ee as placementFieldText,
|
|
195
|
+
I as usePlacementTextContext
|
|
196
|
+
};
|
|
@@ -1,59 +1,65 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useApiFetchConfig as
|
|
3
|
-
import { StepClock as
|
|
4
|
-
function
|
|
5
|
-
enabled:
|
|
6
|
-
layoutId:
|
|
7
|
-
collection:
|
|
8
|
-
itemId:
|
|
9
|
-
step:
|
|
1
|
+
import { useRef as u, useEffect as h, useCallback as L } from "react";
|
|
2
|
+
import { useApiFetchConfig as F } from "../../context.js";
|
|
3
|
+
import { StepClock as R, onSectionUse as U, SectionTally as B, sessionEvent as H, queueFormUsage as q } from "../../lib/form-usage-beacon.js";
|
|
4
|
+
function V({
|
|
5
|
+
enabled: b,
|
|
6
|
+
layoutId: s,
|
|
7
|
+
collection: c,
|
|
8
|
+
itemId: d,
|
|
9
|
+
step: i
|
|
10
10
|
}) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
clock: new
|
|
11
|
+
const l = F(), f = u(l);
|
|
12
|
+
f.current = l;
|
|
13
|
+
const v = u(i);
|
|
14
|
+
v.current = i;
|
|
15
|
+
const o = u(null), p = b && s != null && !!c;
|
|
16
|
+
return h(() => {
|
|
17
|
+
if (!p || s == null) return;
|
|
18
|
+
const n = () => typeof document > "u" || document.visibilityState !== "hidden", e = {
|
|
19
|
+
clock: new R(v.current, Date.now(), n()),
|
|
20
20
|
openSent: !1,
|
|
21
21
|
saved: !1,
|
|
22
|
-
elapsed: 0
|
|
22
|
+
elapsed: 0,
|
|
23
|
+
saveMs: null
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
o.current = e;
|
|
26
|
+
const r = new B(), D = U((t) => {
|
|
27
|
+
t.layoutId === s && t.collection === c && r.note(t.kind, t.key);
|
|
28
|
+
}), a = (t) => {
|
|
29
|
+
const { steps: E, total: S } = e.clock.take(Date.now());
|
|
30
|
+
e.elapsed += S;
|
|
31
|
+
const g = r.pending(), w = H({
|
|
32
|
+
layoutId: s,
|
|
33
|
+
collection: c,
|
|
34
|
+
item: d,
|
|
32
35
|
openSent: e.openSent,
|
|
33
36
|
saved: e.saved,
|
|
34
37
|
step: e.clock.currentStep,
|
|
35
|
-
steps:
|
|
36
|
-
total:
|
|
38
|
+
steps: E,
|
|
39
|
+
total: S,
|
|
37
40
|
elapsed: e.elapsed,
|
|
38
|
-
final:
|
|
41
|
+
final: t,
|
|
42
|
+
sections: g,
|
|
43
|
+
saveMs: e.saveMs
|
|
39
44
|
});
|
|
40
|
-
if (!
|
|
41
|
-
e.openSent = !0, e.saved = !1;
|
|
42
|
-
const { apiBase:
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
document.visibilityState === "hidden" ? (
|
|
46
|
-
},
|
|
47
|
-
return document.addEventListener("visibilitychange",
|
|
48
|
-
document.removeEventListener("visibilitychange",
|
|
45
|
+
if (!w) return;
|
|
46
|
+
r.markSent(g), e.openSent = !0, e.saved = !1, e.saveMs = null;
|
|
47
|
+
const { apiBase: y, authHeaders: M, credentials: C } = f.current;
|
|
48
|
+
q(w, { apiBase: y, authHeaders: M, credentials: C });
|
|
49
|
+
}, m = () => {
|
|
50
|
+
document.visibilityState === "hidden" ? (a(!1), e.clock.pause(Date.now())) : e.clock.resume(Date.now());
|
|
51
|
+
}, k = () => a(!0);
|
|
52
|
+
return document.addEventListener("visibilitychange", m), window.addEventListener("pagehide", k), () => {
|
|
53
|
+
document.removeEventListener("visibilitychange", m), window.removeEventListener("pagehide", k), a(!0), D(), o.current === e && (o.current = null);
|
|
49
54
|
};
|
|
50
|
-
}, [
|
|
51
|
-
var
|
|
52
|
-
(
|
|
53
|
-
}, [
|
|
54
|
-
n
|
|
55
|
+
}, [p, s, c, d]), h(() => {
|
|
56
|
+
var n;
|
|
57
|
+
(n = o.current) == null || n.clock.step(i, Date.now());
|
|
58
|
+
}, [i]), { markSaved: L(() => {
|
|
59
|
+
const n = o.current;
|
|
60
|
+
n && (n.saved || (n.saveMs = n.elapsed + n.clock.peek(Date.now())), n.saved = !0);
|
|
55
61
|
}, []) };
|
|
56
62
|
}
|
|
57
63
|
export {
|
|
58
|
-
|
|
64
|
+
V as useFormUsageBeacon
|
|
59
65
|
};
|