@activecollab/components 2.0.478 → 2.0.479

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.
@@ -0,0 +1,253 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ /**
3
+ * Shared chrome for the Self-Hosted Settings presentation stories
4
+ * (`Presentation/Self-Hosted Settings`).
5
+ *
6
+ * Mirrors the app:
7
+ * - components/Settings/SelfHostedSettingsDialog.jsx — the `Dialog size="xxl"
8
+ * height="95%"` titled "Self-Hosted Settings" and the flat-card surface
9
+ * overrides (cards drop their shadow and take the body surface so they read
10
+ * as flat tiles on the dialog paper).
11
+ * - components/SelfHostedSettings/SelfHostedSettingsContent.jsx — the stack of
12
+ * expandable status rows (Version, Email, Document search, Pusher, Cron,
13
+ * Old Versions).
14
+ * - components/Settings/SettingRow.jsx + components/ExpandToggle — the row card
15
+ * (min-height 68px, pl-5 pr-4 py-3, paper-2) with a status `Dot` and a caret;
16
+ * expanding drops a bordered card below the row (top border theme-400,
17
+ * rounded-top-none, px-5 py-3).
18
+ *
19
+ * Structural colours are tokens. The status dot uses the two status tokens that
20
+ * already exist in GlobalStyle (`--color-sucess-green` = #64cd93 and
21
+ * `--red-alert` = #ed6161), which are the exact hexes the app hardcodes.
22
+ */
23
+ import React, { useState } from "react";
24
+ import styled from "styled-components";
25
+ import { MONO, SM } from "./tokens";
26
+ import { Card } from "../../components/Card";
27
+ import { Dialog } from "../../components/Dialog";
28
+ import { Dot } from "../../components/Dot";
29
+ import { CollapseExpandSingleIcon } from "../../components/Icons";
30
+ import { Link } from "../../components/Links";
31
+ import { Trigger } from "../../components/Trigger";
32
+ import { Body2 } from "../../components/Typography";
33
+
34
+ /* ------------------------------------------------------------------ */
35
+ /* The dialog */
36
+ /* ------------------------------------------------------------------ */
37
+
38
+ /**
39
+ * The scroll body inside the dialog. Cards and the dialog share
40
+ * `--page-paper-main`, so the rows would be invisible on the dialog paper; the
41
+ * app remaps the descendants' paper surface to the body surface and kills the
42
+ * card shadow, exactly like SelfHostedSettingsDialog's DIALOG_CONTENT. The rows
43
+ * then read as flat tiles separated by their rounding and the 8px gaps.
44
+ */
45
+ const Stack = styled.div.withConfig({
46
+ displayName: "selfHostedSettings__Stack",
47
+ componentId: "sc-vpkkvn-0"
48
+ })(["display:flex;flex-direction:column;width:100%;--page-paper-main:var(--body-bg-main);--shadow-tertiary:none;--shadow-tertiary-hover:none;"]);
49
+ export const SelfHostedSettingsDialog = _ref => {
50
+ let children = _ref.children,
51
+ onClose = _ref.onClose;
52
+ const close = onClose != null ? onClose : () => undefined;
53
+ return /*#__PURE__*/React.createElement(Dialog, {
54
+ open: true,
55
+ size: "xxl",
56
+ height: "95%",
57
+ onClose: close,
58
+ enableBackgroundClick: true
59
+ }, /*#__PURE__*/React.createElement(Dialog.Title, {
60
+ onClose: close
61
+ }, "Self-Hosted Settings"), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(Stack, null, children)));
62
+ };
63
+
64
+ /* ------------------------------------------------------------------ */
65
+ /* Status dot (mirrors the app `Dot color={ok ? green : red} size={12}`) */
66
+ /* ------------------------------------------------------------------ */
67
+
68
+ /**
69
+ * ok = green, info = blue (something to act on that isn't an error, e.g. an
70
+ * update is available), problem = red (errors only).
71
+ */
72
+
73
+ const STATUS_COLOR = {
74
+ ok: "var(--color-sucess-green)",
75
+ info: "var(--color-progress-blue)",
76
+ problem: "var(--red-alert)"
77
+ };
78
+ export const StatusDot = _ref2 => {
79
+ let status = _ref2.status;
80
+ return /*#__PURE__*/React.createElement(Dot, {
81
+ color: STATUS_COLOR[status],
82
+ size: 12
83
+ });
84
+ };
85
+
86
+ /* ------------------------------------------------------------------ */
87
+ /* Expandable setting row */
88
+ /* ------------------------------------------------------------------ */
89
+
90
+ /** The clickable header card. Mirrors SettingRow.jsx's ROW_CLASS. */
91
+ const HeaderCard = styled(Card).withConfig({
92
+ displayName: "selfHostedSettings__HeaderCard",
93
+ componentId: "sc-vpkkvn-1"
94
+ })(["box-sizing:border-box;display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;min-height:68px;padding:12px 16px 12px 20px;cursor:", ";@media (min-width:", "){flex-direction:row;align-items:center;}", ""], _ref3 => {
95
+ let $clickable = _ref3.$clickable;
96
+ return $clickable ? "pointer" : "default";
97
+ }, SM, _ref4 => {
98
+ let $expanded = _ref4.$expanded;
99
+ return $expanded ? "\n box-shadow: none;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n " : "";
100
+ });
101
+ const LabelCol = styled.div.withConfig({
102
+ displayName: "selfHostedSettings__LabelCol",
103
+ componentId: "sc-vpkkvn-2"
104
+ })(["display:flex;flex:1 1 0%;min-width:0;padding-right:12px;", ""], _ref5 => {
105
+ let $wraps = _ref5.$wraps;
106
+ return $wraps ? "" : "\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n ";
107
+ });
108
+ const Controls = styled.div.withConfig({
109
+ displayName: "selfHostedSettings__Controls",
110
+ componentId: "sc-vpkkvn-3"
111
+ })(["display:flex;align-items:center;gap:8px;flex-shrink:0;"]);
112
+ const Caret = styled.span.withConfig({
113
+ displayName: "selfHostedSettings__Caret",
114
+ componentId: "sc-vpkkvn-4"
115
+ })(["display:inline-flex;transition:transform 200ms ease;transform:rotate(", ");opacity:", ";"], _ref6 => {
116
+ let $expanded = _ref6.$expanded;
117
+ return $expanded ? "0deg" : "180deg";
118
+ }, _ref7 => {
119
+ let $dimmed = _ref7.$dimmed;
120
+ return $dimmed ? 0.5 : 1;
121
+ });
122
+
123
+ /** The card that drops below an expanded row. Mirrors the app expand `Card`. */
124
+ export const SettingExpandCard = styled(Card).withConfig({
125
+ displayName: "selfHostedSettings__SettingExpandCard",
126
+ componentId: "sc-vpkkvn-5"
127
+ })(["box-sizing:border-box;display:flex;flex-direction:column;min-height:48px;padding:12px 20px;border-top:1px solid var(--color-theme-400);border-top-left-radius:0;border-top-right-radius:0;box-shadow:none;"]);
128
+ const RowWrap = styled.div.withConfig({
129
+ displayName: "selfHostedSettings__RowWrap",
130
+ componentId: "sc-vpkkvn-6"
131
+ })(["display:flex;flex-direction:column;margin-bottom:8px;"]);
132
+
133
+ /** Full-width DS Trigger around the header, like the app's `tw-w-full`. */
134
+ const RowTrigger = styled(Trigger).withConfig({
135
+ displayName: "selfHostedSettings__RowTrigger",
136
+ componentId: "sc-vpkkvn-7"
137
+ })(["display:block;width:100%;text-align:left;"]);
138
+ export const ExpandableSettingRow = _ref8 => {
139
+ let label = _ref8.label,
140
+ status = _ref8.status,
141
+ right = _ref8.right,
142
+ _ref8$wraps = _ref8.wraps,
143
+ wraps = _ref8$wraps === void 0 ? false : _ref8$wraps,
144
+ _ref8$expandable = _ref8.expandable,
145
+ expandable = _ref8$expandable === void 0 ? true : _ref8$expandable,
146
+ _ref8$defaultExpanded = _ref8.defaultExpanded,
147
+ defaultExpanded = _ref8$defaultExpanded === void 0 ? false : _ref8$defaultExpanded,
148
+ children = _ref8.children;
149
+ const _useState = useState(expandable && defaultExpanded),
150
+ expanded = _useState[0],
151
+ setExpanded = _useState[1];
152
+ const open = expandable && expanded;
153
+ return /*#__PURE__*/React.createElement(RowWrap, null, /*#__PURE__*/React.createElement(RowTrigger, _extends({}, right ? {
154
+ forwardedAs: "div"
155
+ } : {}, {
156
+ disabled: !expandable,
157
+ onClick: () => setExpanded(prev => !prev)
158
+ }), /*#__PURE__*/React.createElement(HeaderCard, {
159
+ variant: "paper-2",
160
+ $expanded: open,
161
+ $clickable: expandable
162
+ }, /*#__PURE__*/React.createElement(LabelCol, {
163
+ $wraps: wraps
164
+ }, typeof label === "string" ? /*#__PURE__*/React.createElement(Body2, null, label) : label), /*#__PURE__*/React.createElement(Controls, null, right, status ? /*#__PURE__*/React.createElement(StatusDot, {
165
+ status: status
166
+ }) : null, /*#__PURE__*/React.createElement(Caret, {
167
+ $expanded: open,
168
+ $dimmed: !expandable
169
+ }, /*#__PURE__*/React.createElement(CollapseExpandSingleIcon, null))))), open ? /*#__PURE__*/React.createElement(SettingExpandCard, {
170
+ variant: "paper-2"
171
+ }, children) : null);
172
+ };
173
+
174
+ /* ------------------------------------------------------------------ */
175
+ /* Inline / block command (SSH + CLI fallback). Uses the shared MONO */
176
+ /* face; mirrors the app <pre> on --color-primary-300. */
177
+ /* ------------------------------------------------------------------ */
178
+
179
+ // ds-exception: monospace command text uses the shared MONO constant (AGENTS
180
+ // rule 4 — commands are code, not Typography prose).
181
+ export const CommandCode = styled.code.withConfig({
182
+ displayName: "selfHostedSettings__CommandCode",
183
+ componentId: "sc-vpkkvn-8"
184
+ })(["font-family:", ";font-size:13px;line-height:20px;background-color:var(--color-primary-300);color:var(--color-theme-900);padding:2px 6px;border-radius:var(--ac-br-4);white-space:pre-wrap;word-break:break-all;"], MONO);
185
+
186
+ /* ------------------------------------------------------------------ */
187
+ /* Cron jobs expand content (CronConfiguration.js: status + last runs) */
188
+ /* ------------------------------------------------------------------ */
189
+
190
+ const CronField = styled.div.withConfig({
191
+ displayName: "selfHostedSettings__CronField",
192
+ componentId: "sc-vpkkvn-9"
193
+ })(["margin-bottom:8px;"]);
194
+ export const CronJobsBody = _ref9 => {
195
+ let errors = _ref9.errors,
196
+ hourly = _ref9.hourly,
197
+ frequently = _ref9.frequently,
198
+ imap = _ref9.imap;
199
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CronField, null, /*#__PURE__*/React.createElement(Body2, null, "Status:"), /*#__PURE__*/React.createElement(Body2, {
200
+ color: errors.length > 0 ? "alert" : "tertiary"
201
+ }, errors.length > 0 ? errors.join(",\n") : "Configured and working properly")), [["Hourly Job", hourly], ["Frequently Job", frequently], ["IMAP Job", imap]].map(_ref0 => {
202
+ let label = _ref0[0],
203
+ value = _ref0[1];
204
+ return /*#__PURE__*/React.createElement(CronField, {
205
+ key: label
206
+ }, /*#__PURE__*/React.createElement(Body2, null, label, ":"), /*#__PURE__*/React.createElement(Body2, {
207
+ color: "tertiary"
208
+ }, value ? "Executed " + value : "Never executed"));
209
+ }));
210
+ };
211
+
212
+ /* ------------------------------------------------------------------ */
213
+ /* The five non-version section rows, healthy. Shared by the baseline */
214
+ /* stack and every Phase B upgrade story so the chrome around the */
215
+ /* Version row is defined once (AGENTS rule 6). */
216
+ /* ------------------------------------------------------------------ */
217
+
218
+ /** The Email Log button that sits on the "Sending and receiving email" row. */
219
+ const EmailLogLink = () => /*#__PURE__*/React.createElement(Link, {
220
+ href: "#",
221
+ target: "_blank",
222
+ rel: "noreferrer",
223
+ variant: "outlined",
224
+ onClick: event => event.stopPropagation()
225
+ }, "Email Log");
226
+
227
+ /** A row's status + optional expand content (and whether it starts open). */
228
+
229
+ export const OtherSectionRows = _ref1 => {
230
+ var _cron$status, _oldVersions$status;
231
+ let oldVersions = _ref1.oldVersions,
232
+ cron = _ref1.cron;
233
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ExpandableSettingRow, {
234
+ label: "Sending and receiving email",
235
+ status: "ok",
236
+ right: /*#__PURE__*/React.createElement(EmailLogLink, null)
237
+ }), /*#__PURE__*/React.createElement(ExpandableSettingRow, {
238
+ label: "Document search",
239
+ status: "ok"
240
+ }), /*#__PURE__*/React.createElement(ExpandableSettingRow, {
241
+ label: "Pusher configuration",
242
+ status: "ok"
243
+ }), /*#__PURE__*/React.createElement(ExpandableSettingRow, {
244
+ label: "Cron jobs",
245
+ status: (_cron$status = cron == null ? void 0 : cron.status) != null ? _cron$status : "ok",
246
+ defaultExpanded: cron == null ? void 0 : cron.defaultExpanded
247
+ }, cron == null ? void 0 : cron.content), /*#__PURE__*/React.createElement(ExpandableSettingRow, {
248
+ label: "Old Versions",
249
+ status: (_oldVersions$status = oldVersions == null ? void 0 : oldVersions.status) != null ? _oldVersions$status : "ok",
250
+ defaultExpanded: oldVersions == null ? void 0 : oldVersions.defaultExpanded
251
+ }, oldVersions == null ? void 0 : oldVersions.content));
252
+ };
253
+ //# sourceMappingURL=selfHostedSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selfHostedSettings.js","names":["React","useState","styled","MONO","SM","Card","Dialog","Dot","CollapseExpandSingleIcon","Link","Trigger","Body2","Stack","div","withConfig","displayName","componentId","SelfHostedSettingsDialog","_ref","children","onClose","close","undefined","createElement","open","size","height","enableBackgroundClick","Title","ContentDivider","Content","STATUS_COLOR","ok","info","problem","StatusDot","_ref2","status","color","HeaderCard","_ref3","$clickable","_ref4","$expanded","LabelCol","_ref5","$wraps","Controls","Caret","span","_ref6","_ref7","$dimmed","SettingExpandCard","RowWrap","RowTrigger","ExpandableSettingRow","_ref8","label","right","_ref8$wraps","wraps","_ref8$expandable","expandable","_ref8$defaultExpanded","defaultExpanded","_useState","expanded","setExpanded","_extends","forwardedAs","disabled","onClick","prev","variant","CommandCode","code","CronField","CronJobsBody","_ref9","errors","hourly","frequently","imap","Fragment","length","join","map","_ref0","value","key","EmailLogLink","href","target","rel","event","stopPropagation","OtherSectionRows","_ref1","_cron$status","_oldVersions$status","oldVersions","cron","content"],"sources":["../../../../src/presentation/shared/selfHostedSettings.tsx"],"sourcesContent":["/**\n * Shared chrome for the Self-Hosted Settings presentation stories\n * (`Presentation/Self-Hosted Settings`).\n *\n * Mirrors the app:\n * - components/Settings/SelfHostedSettingsDialog.jsx — the `Dialog size=\"xxl\"\n * height=\"95%\"` titled \"Self-Hosted Settings\" and the flat-card surface\n * overrides (cards drop their shadow and take the body surface so they read\n * as flat tiles on the dialog paper).\n * - components/SelfHostedSettings/SelfHostedSettingsContent.jsx — the stack of\n * expandable status rows (Version, Email, Document search, Pusher, Cron,\n * Old Versions).\n * - components/Settings/SettingRow.jsx + components/ExpandToggle — the row card\n * (min-height 68px, pl-5 pr-4 py-3, paper-2) with a status `Dot` and a caret;\n * expanding drops a bordered card below the row (top border theme-400,\n * rounded-top-none, px-5 py-3).\n *\n * Structural colours are tokens. The status dot uses the two status tokens that\n * already exist in GlobalStyle (`--color-sucess-green` = #64cd93 and\n * `--red-alert` = #ed6161), which are the exact hexes the app hardcodes.\n */\nimport React, { ReactElement, ReactNode, useState } from \"react\";\n\nimport styled from \"styled-components\";\n\nimport { MONO, SM } from \"./tokens\";\nimport { Card } from \"../../components/Card\";\nimport { Dialog } from \"../../components/Dialog\";\nimport { Dot } from \"../../components/Dot\";\nimport { CollapseExpandSingleIcon } from \"../../components/Icons\";\nimport { Link } from \"../../components/Links\";\nimport { Trigger } from \"../../components/Trigger\";\nimport { Body2 } from \"../../components/Typography\";\n\n/* ------------------------------------------------------------------ */\n/* The dialog */\n/* ------------------------------------------------------------------ */\n\n/**\n * The scroll body inside the dialog. Cards and the dialog share\n * `--page-paper-main`, so the rows would be invisible on the dialog paper; the\n * app remaps the descendants' paper surface to the body surface and kills the\n * card shadow, exactly like SelfHostedSettingsDialog's DIALOG_CONTENT. The rows\n * then read as flat tiles separated by their rounding and the 8px gaps.\n */\nconst Stack = styled.div`\n display: flex;\n flex-direction: column;\n width: 100%;\n\n --page-paper-main: var(--body-bg-main);\n --shadow-tertiary: none;\n --shadow-tertiary-hover: none;\n`;\n\nexport interface SelfHostedSettingsDialogProps {\n /** The rows (usually the section stack). */\n children: ReactNode;\n /** Optional close handler; defaults to a no-op for the mock. */\n onClose?: () => void;\n}\n\nexport const SelfHostedSettingsDialog = ({\n children,\n onClose,\n}: SelfHostedSettingsDialogProps): ReactElement => {\n const close = onClose ?? ((): void => undefined);\n\n return (\n <Dialog open size=\"xxl\" height=\"95%\" onClose={close} enableBackgroundClick>\n <Dialog.Title onClose={close}>Self-Hosted Settings</Dialog.Title>\n <Dialog.ContentDivider />\n <Dialog.Content>\n <Stack>{children}</Stack>\n </Dialog.Content>\n </Dialog>\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* Status dot (mirrors the app `Dot color={ok ? green : red} size={12}`) */\n/* ------------------------------------------------------------------ */\n\n/**\n * ok = green, info = blue (something to act on that isn't an error, e.g. an\n * update is available), problem = red (errors only).\n */\nexport type SettingStatus = \"ok\" | \"info\" | \"problem\";\n\nconst STATUS_COLOR: Record<SettingStatus, string> = {\n ok: \"var(--color-sucess-green)\",\n info: \"var(--color-progress-blue)\",\n problem: \"var(--red-alert)\",\n};\n\nexport const StatusDot = ({\n status,\n}: {\n status: SettingStatus;\n}): ReactElement => <Dot color={STATUS_COLOR[status]} size={12} />;\n\n/* ------------------------------------------------------------------ */\n/* Expandable setting row */\n/* ------------------------------------------------------------------ */\n\n/** The clickable header card. Mirrors SettingRow.jsx's ROW_CLASS. */\nconst HeaderCard = styled(Card)<{ $expanded: boolean; $clickable: boolean }>`\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n min-height: 68px;\n padding: 12px 16px 12px 20px;\n cursor: ${({ $clickable }) => ($clickable ? \"pointer\" : \"default\")};\n\n @media (min-width: ${SM}) {\n flex-direction: row;\n align-items: center;\n }\n\n ${({ $expanded }) =>\n $expanded\n ? `\n box-shadow: none;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n `\n : \"\"}\n`;\n\nconst LabelCol = styled.div<{ $wraps: boolean }>`\n display: flex;\n flex: 1 1 0%;\n min-width: 0;\n padding-right: 12px;\n ${({ $wraps }) =>\n $wraps\n ? \"\"\n : `\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `}\n`;\n\nconst Controls = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n flex-shrink: 0;\n`;\n\nconst Caret = styled.span<{ $expanded: boolean; $dimmed: boolean }>`\n display: inline-flex;\n transition: transform 200ms ease;\n transform: rotate(${({ $expanded }) => ($expanded ? \"0deg\" : \"180deg\")});\n opacity: ${({ $dimmed }) => ($dimmed ? 0.5 : 1)};\n`;\n\n/** The card that drops below an expanded row. Mirrors the app expand `Card`. */\nexport const SettingExpandCard = styled(Card)`\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n min-height: 48px;\n padding: 12px 20px;\n border-top: 1px solid var(--color-theme-400);\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n box-shadow: none;\n`;\n\nconst RowWrap = styled.div`\n display: flex;\n flex-direction: column;\n margin-bottom: 8px;\n`;\n\n/** Full-width DS Trigger around the header, like the app's `tw-w-full`. */\nconst RowTrigger = styled(Trigger)`\n display: block;\n width: 100%;\n text-align: left;\n`;\n\nexport interface ExpandableSettingRowProps {\n /** Row label — a section name, or the version sentence. */\n label: ReactNode;\n /** Status dot on the right; omit for a row with no status (rare). */\n status?: SettingStatus;\n /** Extra control shown left of the dot, e.g. the Email Log button. */\n right?: ReactNode;\n /** Let the label wrap onto a second line (the version sentence does). */\n wraps?: boolean;\n /** Whether the row can expand. A latest-stable version row cannot. */\n expandable?: boolean;\n /** Start expanded (each story pins the state it wants to show). */\n defaultExpanded?: boolean;\n /** The expand content (rendered in a `SettingExpandCard`). */\n children?: ReactNode;\n}\n\nexport const ExpandableSettingRow = ({\n label,\n status,\n right,\n wraps = false,\n expandable = true,\n defaultExpanded = false,\n children,\n}: ExpandableSettingRowProps): ReactElement => {\n const [expanded, setExpanded] = useState(expandable && defaultExpanded);\n const open = expandable && expanded;\n\n return (\n <RowWrap>\n {/* A row with its own control (Email Log) renders the Trigger as a div,\n like the app's `as=\"div\"`, so the link isn't nested in a button.\n Trigger's props type omits `as`, hence the cast. */}\n <RowTrigger\n {...((right ? { forwardedAs: \"div\" } : {}) as object)}\n disabled={!expandable}\n onClick={(): void => setExpanded((prev) => !prev)}\n >\n <HeaderCard variant=\"paper-2\" $expanded={open} $clickable={expandable}>\n <LabelCol $wraps={wraps}>\n {typeof label === \"string\" ? <Body2>{label}</Body2> : label}\n </LabelCol>\n <Controls>\n {right}\n {status ? <StatusDot status={status} /> : null}\n <Caret $expanded={open} $dimmed={!expandable}>\n <CollapseExpandSingleIcon />\n </Caret>\n </Controls>\n </HeaderCard>\n </RowTrigger>\n {open ? (\n <SettingExpandCard variant=\"paper-2\">{children}</SettingExpandCard>\n ) : null}\n </RowWrap>\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* Inline / block command (SSH + CLI fallback). Uses the shared MONO */\n/* face; mirrors the app <pre> on --color-primary-300. */\n/* ------------------------------------------------------------------ */\n\n// ds-exception: monospace command text uses the shared MONO constant (AGENTS\n// rule 4 — commands are code, not Typography prose).\nexport const CommandCode = styled.code`\n font-family: ${MONO};\n font-size: 13px;\n line-height: 20px;\n background-color: var(--color-primary-300);\n color: var(--color-theme-900);\n padding: 2px 6px;\n border-radius: var(--ac-br-4);\n white-space: pre-wrap;\n word-break: break-all;\n`;\n\n/* ------------------------------------------------------------------ */\n/* Cron jobs expand content (CronConfiguration.js: status + last runs) */\n/* ------------------------------------------------------------------ */\n\nconst CronField = styled.div`\n margin-bottom: 8px;\n`;\n\nexport interface CronJobsBodyProps {\n /** mirrors: GET /system-status `cron_errors`. */\n errors: string[];\n /** Formatted \"Executed …\" text per job, or null for \"Never executed\". */\n hourly: string | null;\n frequently: string | null;\n imap: string | null;\n}\n\nexport const CronJobsBody = ({\n errors,\n hourly,\n frequently,\n imap,\n}: CronJobsBodyProps): ReactElement => (\n <>\n <CronField>\n <Body2>Status:</Body2>\n <Body2 color={errors.length > 0 ? \"alert\" : \"tertiary\"}>\n {errors.length > 0\n ? errors.join(\",\\n\")\n : \"Configured and working properly\"}\n </Body2>\n </CronField>\n {(\n [\n [\"Hourly Job\", hourly],\n [\"Frequently Job\", frequently],\n [\"IMAP Job\", imap],\n ] as const\n ).map(([label, value]) => (\n <CronField key={label}>\n <Body2>{label}:</Body2>\n <Body2 color=\"tertiary\">\n {value ? `Executed ${value}` : \"Never executed\"}\n </Body2>\n </CronField>\n ))}\n </>\n);\n\n/* ------------------------------------------------------------------ */\n/* The five non-version section rows, healthy. Shared by the baseline */\n/* stack and every Phase B upgrade story so the chrome around the */\n/* Version row is defined once (AGENTS rule 6). */\n/* ------------------------------------------------------------------ */\n\n/** The Email Log button that sits on the \"Sending and receiving email\" row. */\nconst EmailLogLink = (): ReactElement => (\n <Link\n href=\"#\"\n target=\"_blank\"\n rel=\"noreferrer\"\n variant=\"outlined\"\n onClick={(event): void => event.stopPropagation()}\n >\n Email Log\n </Link>\n);\n\n/** A row's status + optional expand content (and whether it starts open). */\nexport interface SectionRowState {\n status: SettingStatus;\n content?: ReactNode;\n defaultExpanded?: boolean;\n}\n\nexport interface OtherSectionRowsProps {\n /**\n * Old Versions status + optional expand content. Defaults to a healthy,\n * collapsed row (the state every Phase B upgrade story assumes).\n */\n oldVersions?: SectionRowState;\n /** Cron jobs status + expand content; defaults to healthy and collapsed. */\n cron?: SectionRowState;\n}\n\nexport const OtherSectionRows = ({\n oldVersions,\n cron,\n}: OtherSectionRowsProps): ReactElement => (\n <>\n <ExpandableSettingRow\n label=\"Sending and receiving email\"\n status=\"ok\"\n right={<EmailLogLink />}\n />\n <ExpandableSettingRow label=\"Document search\" status=\"ok\" />\n <ExpandableSettingRow label=\"Pusher configuration\" status=\"ok\" />\n <ExpandableSettingRow\n label=\"Cron jobs\"\n status={cron?.status ?? \"ok\"}\n defaultExpanded={cron?.defaultExpanded}\n >\n {cron?.content}\n </ExpandableSettingRow>\n <ExpandableSettingRow\n label=\"Old Versions\"\n status={oldVersions?.status ?? \"ok\"}\n defaultExpanded={oldVersions?.defaultExpanded}\n >\n {oldVersions?.content}\n </ExpandableSettingRow>\n </>\n);\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAA6BC,QAAQ,QAAQ,OAAO;AAEhE,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SAASC,IAAI,EAAEC,EAAE,QAAQ,UAAU;AACnC,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,GAAG,QAAQ,sBAAsB;AAC1C,SAASC,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,IAAI,QAAQ,wBA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AAA,oBAEJtG,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAoF,QAAA,qBACEpF,KAAA,CAAAuB,aAAA,CAACiC,oBAAoB;IACnBE,KAAK,EAAC,6BAA6B;IACnCrB,MAAM,EAAC,IAAI;IACXsB,KAAK,eAAE3D,KAAA,CAAAuB,aAAA,CAACoE,YAAY,MAAE;EAAE,CACzB,CAAC,eACF3F,KAAA,CAAAuB,aAAA,CAACiC,oBAAoB;IAACE,KAAK,EAAC,iBAAiB;IAACrB,MAAM,EAAC;EAAI,CAAE,CAAC,eAC5DrC,KAAA,CAAAuB,aAAA,CAACiC,oBAAoB;IAACE,KAAK,EAAC,sBAAsB;IAACrB,MAAM,EAAC;EAAI,CAAE,CAAC,eACjErC,KAAA,CAAAuB,aAAA,CAACiC,oBAAoB;IACnBE,KAAK,EAAC,WAAW;IACjBrB,MAAM,GAAA8D,YAAA,GAAEG,IAAI,oBAAJA,IAAI,CAAEjE,MAAM,YAAA8D,YAAA,GAAI,IAAK;IAC7BlC,eAAe,EAAEqC,IAAI,oBAAJA,IAAI,CAAErC;EAAgB,GAEtCqC,IAAI,oBAAJA,IAAI,CAAEC,OACa,CAAC,eACvBvG,KAAA,CAAAuB,aAAA,CAACiC,oBAAoB;IACnBE,KAAK,EAAC,cAAc;IACpBrB,MAAM,GAAA+D,mBAAA,GAAEC,WAAW,oBAAXA,WAAW,CAAEhE,MAAM,YAAA+D,mBAAA,GAAI,IAAK;IACpCnC,eAAe,EAAEoC,WAAW,oBAAXA,WAAW,CAAEpC;EAAgB,GAE7CoC,WAAW,oBAAXA,WAAW,CAAEE,OACM,CACtB,CAAC;AAAA,CACJ","ignoreList":[]}
@@ -0,0 +1,235 @@
1
+ /**
2
+ * Phase B building blocks for the Self-Hosted Settings concept: the redesigned
3
+ * Version row as the entry point to an in-app, tokenized upgrade.
4
+ *
5
+ * These are DESIGN-CONCEPT helpers, not shipped code. They compose DS
6
+ * components (`Dialog`, `InfoBox`, `StepSequence`, `ProgressBar`, `RadioGroup`,
7
+ * `Input`, `Button`, `Link`, `Dot`, `Chip`) with a few local layout wrappers.
8
+ *
9
+ * DRAFT API: the payload types below are NOT shipped. They mirror the draft
10
+ * shapes proposed in the task (a future GET /system-status/upgrade + an
11
+ * UpgradeRun resource), so the concept can be wired without inventing fields
12
+ * ad hoc. Marked `// DRAFT API: not shipped`.
13
+ *
14
+ * Gaps recorded here (see handover):
15
+ * - `ReleaseNotesHtml` renders server HTML via dangerouslySetInnerHTML; DS
16
+ * `PortableText` takes a structured block model, not an HTML string, so it
17
+ * is not the right renderer for `release_notes[].html`.
18
+ * - `LogPanel` / `CommandBlock` stand in for a DS LogViewer / CodeBlock, which
19
+ * do not exist.
20
+ * - `PreflightGate` is built on the base `Dialog` (not DS `ConfirmDialog`)
21
+ * because ConfirmDialog cannot disable its confirm button on a blocking
22
+ * check — it only gates via a checkbox or `isLoading`.
23
+ * - Error states use `InfoBox type="warning"`; InfoBox has no error/danger
24
+ * variant.
25
+ */
26
+ import { ReactElement } from "react";
27
+ export type TokenSource = "db" | "config" | "env";
28
+ export interface TokenInfo {
29
+ present: boolean;
30
+ source: TokenSource | null;
31
+ masked: string | null;
32
+ expires_on: number | null;
33
+ }
34
+ export type CheckErrorCode = "token_expired" | "token_revoked" | "token_bound_elsewhere" | "license_inactive" | "license_compromised" | "network_error";
35
+ export interface CheckError {
36
+ code: CheckErrorCode;
37
+ message: string;
38
+ help_url?: string;
39
+ }
40
+ export interface ReleaseNote {
41
+ version: string;
42
+ html: string;
43
+ }
44
+ export interface UpgradeStatus {
45
+ current_version: string;
46
+ latest_version: string;
47
+ latest_available_version: string;
48
+ next_step_version: string | null;
49
+ steps_remaining: number;
50
+ support_expires_on: number;
51
+ support_renewal_url: string;
52
+ release_notes: ReleaseNote[];
53
+ last_checked_on: number | null;
54
+ token: TokenInfo;
55
+ check_error: CheckError | null;
56
+ }
57
+ export type PreflightStatus = "ok" | "warn" | "fail" | "info";
58
+ export interface PreflightCheck {
59
+ key: string;
60
+ status: PreflightStatus;
61
+ message: string;
62
+ help_url?: string;
63
+ }
64
+ export type UpgradeDriver = "background" | "cron" | "browser" | "cli";
65
+ export interface PreflightResult {
66
+ checks: PreflightCheck[];
67
+ can_start: boolean;
68
+ driver: UpgradeDriver;
69
+ /** Why this driver, e.g. "proc_open is disabled and cron hasn't run in 3 hours". */
70
+ driver_reason: string;
71
+ }
72
+ export type RunStepKey = "preflight" | "download" | "verify" | "unpack" | "env_check" | "backup" | "migrations" | "assets" | "switch" | "cleanup";
73
+ export type RunStatus = "queued" | "running" | "paused" | "waiting_for_action" | "failed" | "completed" | "cancelled";
74
+ export type ProgressUnit = "bytes" | "migrations" | "tables";
75
+ export interface RunError {
76
+ code: string;
77
+ message: string;
78
+ context?: Record<string, string>;
79
+ }
80
+ export type LogLevel = "info" | "warn" | "error";
81
+ export interface LogEntry {
82
+ at: number;
83
+ level: LogLevel;
84
+ message: string;
85
+ }
86
+ export interface UpgradeRun {
87
+ id: number;
88
+ from_version: string;
89
+ to_version: string;
90
+ driver: UpgradeDriver;
91
+ status: RunStatus;
92
+ current_step: RunStepKey;
93
+ step_progress: {
94
+ done: number;
95
+ total: number;
96
+ unit?: ProgressUnit;
97
+ };
98
+ total_progress: number;
99
+ started_on: number;
100
+ heartbeat_on: number;
101
+ error: RunError | null;
102
+ log: LogEntry[];
103
+ /** Relative to the install, e.g. "work/upgrade/runs/run-4187.log". */
104
+ log_path: string;
105
+ }
106
+ /** Date-only fields (expiry dates), like the app's formatDateSmart. */
107
+ export declare const formatDate: (unixSeconds: number) => string;
108
+ /** A command or config snippet with a Copy button ("Copied" for a moment). */
109
+ export declare const CommandBlock: ({ children, }: {
110
+ children: string;
111
+ }) => ReactElement;
112
+ export declare const ReleaseNotesHtml: ({ notes, }: {
113
+ notes: ReleaseNote[];
114
+ }) => ReactElement;
115
+ export declare const LogPanel: ({ log, defaultOpen, }: {
116
+ log: LogEntry[];
117
+ defaultOpen?: boolean;
118
+ }) => ReactElement;
119
+ export interface TokenVerifyError {
120
+ code: string;
121
+ message: string;
122
+ }
123
+ /** idle → verifying → (closed on success | failed); invalid = bad format. */
124
+ export type TokenVerifyState = "idle" | "verifying" | "invalid" | "failed";
125
+ export interface TokenSetupDialogProps {
126
+ open: boolean;
127
+ onClose: () => void;
128
+ /** "add" for the first token, "replace" when swapping an expired one. */
129
+ mode?: "add" | "replace";
130
+ /** What the simulated server answers to "Verify & save"; "ok" closes. */
131
+ verifyResult?: "ok" | TokenVerifyError;
132
+ /** Pin a state for a static story (with the token it was reached with). */
133
+ initialToken?: string;
134
+ initialState?: TokenVerifyState;
135
+ }
136
+ /**
137
+ * The token setup steps as a reusable dialog. It is opened from the "not set
138
+ * up yet" Version row, from the token strip's Replace AND from the token
139
+ * check-failure states (expired / revoked / bound elsewhere). Rendered through
140
+ * the DS `Dialog` portal, so it layers above the Self-Hosted Settings dialog.
141
+ */
142
+ export declare const TokenSetupDialog: ({ open, onClose, mode, verifyResult, initialToken, initialState, }: TokenSetupDialogProps) => ReactElement;
143
+ /** The "not set up yet" Version row: a short explainer + the setup dialog. */
144
+ export declare const TokenMissingPanel: () => ReactElement;
145
+ /**
146
+ * `Upgrade token · sh1_Xa…7f · Saved here · expires Dec 31, 2026 · Replace`.
147
+ * Shown in every Version-row state that has a token. Only a token saved on
148
+ * this screen can be replaced here; config/env tokens are changed at source.
149
+ */
150
+ export declare const TokenStrip: ({ token }: {
151
+ token: TokenInfo;
152
+ }) => ReactElement;
153
+ export declare const UpToDatePanel: ({ status, }: {
154
+ status: UpgradeStatus;
155
+ }) => ReactElement;
156
+ export interface UpdateAvailablePanelProps {
157
+ status: UpgradeStatus;
158
+ /**
159
+ * On a stepped path, also offer "Upgrade all the way" (the runner chains
160
+ * the steps; preflight runs once). A design variant to compare against the
161
+ * one-step-at-a-time default.
162
+ */
163
+ offerChain?: boolean;
164
+ onUpgrade?: () => void;
165
+ /**
166
+ * When this installation is a container without code on a volume, the upgrade
167
+ * is a new image, not an in-app run. Pass the image ref to swap the Upgrade
168
+ * button for pull instructions.
169
+ */
170
+ dockerImage?: string;
171
+ }
172
+ export declare const UpdateAvailablePanel: ({ status, offerChain, onUpgrade, dockerImage, }: UpdateAvailablePanelProps) => ReactElement;
173
+ export declare const SupportExpiredPanel: ({ status, }: {
174
+ status: UpgradeStatus;
175
+ }) => ReactElement;
176
+ export declare const CheckFailedPanel: ({ error, }: {
177
+ error: CheckError;
178
+ }) => ReactElement;
179
+ export interface PreflightGateProps {
180
+ open?: boolean;
181
+ result: PreflightResult;
182
+ onCancel?: () => void;
183
+ onConfirm?: () => void;
184
+ /** The browser-driver recommendation: close this and open the Cron jobs row. */
185
+ onSetUpCron?: () => void;
186
+ }
187
+ export declare const PreflightGate: ({ open, result, onCancel, onConfirm, onSetUpCron, }: PreflightGateProps) => ReactElement;
188
+ export type SendToSupportState = "form" | "sending" | "sent" | "failed";
189
+ export interface SendToSupportDialogProps {
190
+ open: boolean;
191
+ onClose: () => void;
192
+ run: UpgradeRun;
193
+ /** Prefill for the reply address. */
194
+ ownerEmail: string;
195
+ /** Pin a state for a story; defaults to the interactive form. */
196
+ initialState?: SendToSupportState;
197
+ }
198
+ export declare const SendToSupportDialog: ({ open, onClose, run, ownerEmail, initialState, }: SendToSupportDialogProps) => ReactElement;
199
+ export interface UpgradeConsoleProps {
200
+ run: UpgradeRun;
201
+ /** Release notes to show on completion. */
202
+ releaseNotes?: ReleaseNote[];
203
+ /** Whether the path has more steps after this run (offer "Continue"). */
204
+ stepsRemaining?: number;
205
+ nextStepVersion?: string | null;
206
+ /**
207
+ * "Now" in unix seconds, for Last activity / Elapsed and for spotting a
208
+ * stalled run (running, heartbeat older than 5 min). Pinned by the story so
209
+ * the render never depends on the wall clock.
210
+ */
211
+ now: number;
212
+ /** "Reload" on completion. */
213
+ onClose?: () => void;
214
+ /** Resume after a failure / stall; "Continue in this tab" when paused. */
215
+ onResume?: () => void;
216
+ /** Paused (browser driver): leave the console and open the Cron jobs row. */
217
+ onSetUpCron?: () => void;
218
+ /** Prefill for the "Send to support" reply address. */
219
+ ownerEmail?: string;
220
+ }
221
+ export declare const UpgradeConsole: ({ run, releaseNotes, stepsRemaining, nextStepVersion, now, onClose, onResume, onSetUpCron, ownerEmail, }: UpgradeConsoleProps) => ReactElement;
222
+ export interface MaintenanceScreenProps {
223
+ toVersion: string;
224
+ /**
225
+ * "member" (default): everyone who isn't the Owner. "owner": the same
226
+ * screen with a way into the running upgrade.
227
+ */
228
+ viewer?: "member" | "owner";
229
+ /** The run's driver; browser runs are paused until the Owner continues. */
230
+ driver?: UpgradeDriver;
231
+ /** Owner only: open the upgrade console. */
232
+ onViewProgress?: () => void;
233
+ }
234
+ export declare const MaintenanceScreen: ({ toVersion, viewer, driver, onViewProgress, }: MaintenanceScreenProps) => ReactElement;
235
+ //# sourceMappingURL=selfHostedUpgrade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selfHostedUpgrade.d.ts","sourceRoot":"","sources":["../../../../src/presentation/shared/selfHostedUpgrade.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAc,EACZ,YAAY,EAKb,MAAM,OAAO,CAAC;AAwCf,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;AAGlD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAGD,MAAM,MAAM,cAAc,GACtB,eAAe,GACf,eAAe,GACf,uBAAuB,GACvB,kBAAkB,GAClB,qBAAqB,GACrB,eAAe,CAAC;AAGpB,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA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