@burdenoff/microfe-timecampus 2026.1030.2 → 2026.1030.3
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/generated/wspace-operations.d.ts +299 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +1234 -1112
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +2 -63
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +15 -8
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/timecampus/TimeCampusRoot.d.ts.map +1 -1
- package/dist/timecampus/TimeCampusRoot.js +86 -78
- package/dist/timecampus/TimeCampusRoot.js.map +1 -1
- package/dist/timecampus/TimeCampusRoutes.d.ts.map +1 -1
- package/dist/timecampus/TimeCampusRoutes.js +15 -11
- package/dist/timecampus/TimeCampusRoutes.js.map +1 -1
- package/dist/timecampus/index.js +7 -7
- package/dist/timecampus/pages/channels/ChannelsPage.d.ts +2 -0
- package/dist/timecampus/pages/channels/ChannelsPage.d.ts.map +1 -0
- package/dist/timecampus/pages/channels/ChannelsPage.js +673 -0
- package/dist/timecampus/pages/channels/ChannelsPage.js.map +1 -0
- package/dist/timecampus/pages/channels/channelCatalog.d.ts +49 -0
- package/dist/timecampus/pages/channels/channelCatalog.d.ts.map +1 -0
- package/dist/timecampus/pages/channels/channelCatalog.js +125 -0
- package/dist/timecampus/pages/channels/channelCatalog.js.map +1 -0
- package/dist/types/external-enums.d.ts +17 -0
- package/dist/types/external-enums.d.ts.map +1 -0
- package/dist/types/external-enums.js +4 -0
- package/dist/types/external-enums.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
import { useTimeCampus as e } from "../../providers/TimeCampusProvider.js";
|
|
2
|
+
import { cn as t, formatRelativeTime as n } from "../../utils/helpers.js";
|
|
3
|
+
import { StatCard as r } from "../../components/StatCard.js";
|
|
4
|
+
import { LoadingSkeleton as i } from "../../components/LoadingSkeleton.js";
|
|
5
|
+
import { EmptyState as ee } from "../../components/EmptyState.js";
|
|
6
|
+
import { useConnectTimeCampusCaptureChannelMutation as a, useDeleteTimeCampusCaptureChannelMutation as o, useDisconnectTimeCampusCaptureChannelMutation as s, useMyTimeCampusCaptureChannelsQuery as te, usePurgeTimeCampusCaptureChannelEventsMutation as c, useUpdateTimeCampusCaptureChannelMutation as ne } from "../../../generated/wspace-operations.js";
|
|
7
|
+
import { PageLayout as re } from "../../components/PageLayout.js";
|
|
8
|
+
import { StatusBadge as l } from "../../components/StatusBadge.js";
|
|
9
|
+
import { Modal as u } from "../../components/Modal.js";
|
|
10
|
+
import { ToastContainer as ie, useToast as ae } from "../../components/Toast.js";
|
|
11
|
+
import "../../components/index.js";
|
|
12
|
+
import { TimeCampusCaptureChannelPrivacyMode as d, TimeCampusCaptureChannelStatus as f, TimeCampusCaptureChannelType as p } from "../../../generated/wspace-types.js";
|
|
13
|
+
import { CHANNEL_CATALOG as oe, CHANNEL_SETUP_HINT as m, PRIVACY_OPTIONS as h, catalogEntry as g, formatRetention as se, formatSyncInterval as _, isOverdue as ce, matchesChannelSearch as le, parseOptionalPositiveInt as v, privacyLabel as y, statusDisplay as ue } from "./channelCatalog.js";
|
|
14
|
+
import { useMemo as de, useState as b } from "react";
|
|
15
|
+
import { AppWindow as x, Calendar as S, Check as C, Code2 as fe, Copy as pe, Globe as w, Pause as T, Play as E, Plug as me, PlugZap as he, Plus as ge, Search as _e, Settings2 as ve, Smartphone as D, Terminal as O, Trash2 as k, Unplug as ye, Webhook as A, Workflow as j } from "lucide-react";
|
|
16
|
+
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
17
|
+
import { GlassCard as F } from "@burdenoff/fe-libs/ui";
|
|
18
|
+
//#region src/timecampus/pages/channels/ChannelsPage.tsx
|
|
19
|
+
var I = 3650, L = 10080, R = "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50", z = "inline-flex items-center justify-center gap-1.5 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50", B = "inline-flex items-center justify-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50", be = "inline-flex items-center justify-center gap-1.5 rounded-md bg-status-error-bg px-3 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg/80 disabled:opacity-50", V = {
|
|
20
|
+
[p.Browser]: /* @__PURE__ */ N(w, { className: "h-5 w-5" }),
|
|
21
|
+
[p.Desktop]: /* @__PURE__ */ N(x, { className: "h-5 w-5" }),
|
|
22
|
+
[p.Mobile]: /* @__PURE__ */ N(D, { className: "h-5 w-5" }),
|
|
23
|
+
[p.Ide]: /* @__PURE__ */ N(fe, { className: "h-5 w-5" }),
|
|
24
|
+
[p.Cli]: /* @__PURE__ */ N(O, { className: "h-5 w-5" }),
|
|
25
|
+
[p.Calendar]: /* @__PURE__ */ N(S, { className: "h-5 w-5" }),
|
|
26
|
+
[p.Api]: /* @__PURE__ */ N(A, { className: "h-5 w-5" }),
|
|
27
|
+
[p.Custom]: /* @__PURE__ */ N(j, { className: "h-5 w-5" })
|
|
28
|
+
};
|
|
29
|
+
function xe(e) {
|
|
30
|
+
let t = e.name.trim();
|
|
31
|
+
if (!t || t.length > 120) return { error: "Give the channel a name of up to 120 characters." };
|
|
32
|
+
let n = v(e.retentionDays, I);
|
|
33
|
+
if (!n.ok) return { error: `Retention must be a whole number of days between 1 and ${I}, or empty to keep data.` };
|
|
34
|
+
let r = v(e.syncIntervalMinutes, L);
|
|
35
|
+
return r.ok ? {
|
|
36
|
+
name: t,
|
|
37
|
+
privacyMode: e.privacyMode,
|
|
38
|
+
retentionDays: n.value,
|
|
39
|
+
syncIntervalMinutes: r.value
|
|
40
|
+
} : { error: `Sync interval must be a whole number of minutes between 1 and ${L}, or empty.` };
|
|
41
|
+
}
|
|
42
|
+
function Se({ form: e, onChange: n, idPrefix: r }) {
|
|
43
|
+
return /* @__PURE__ */ P("div", {
|
|
44
|
+
className: "space-y-4",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("label", {
|
|
47
|
+
htmlFor: `${r}-name`,
|
|
48
|
+
className: "block text-sm font-medium text-text-primary",
|
|
49
|
+
children: "Name"
|
|
50
|
+
}), /* @__PURE__ */ N("input", {
|
|
51
|
+
id: `${r}-name`,
|
|
52
|
+
type: "text",
|
|
53
|
+
maxLength: 120,
|
|
54
|
+
value: e.name,
|
|
55
|
+
onChange: (t) => n({
|
|
56
|
+
...e,
|
|
57
|
+
name: t.target.value
|
|
58
|
+
}),
|
|
59
|
+
className: R
|
|
60
|
+
})] }),
|
|
61
|
+
/* @__PURE__ */ P("fieldset", { children: [/* @__PURE__ */ N("legend", {
|
|
62
|
+
className: "block text-sm font-medium text-text-primary",
|
|
63
|
+
children: "Privacy"
|
|
64
|
+
}), /* @__PURE__ */ N("div", {
|
|
65
|
+
className: "mt-2 space-y-2",
|
|
66
|
+
children: h.map((i) => /* @__PURE__ */ P("label", {
|
|
67
|
+
className: t("flex cursor-pointer items-start gap-3 rounded-lg border p-3", e.privacyMode === i.value ? "border-action-primary-bg bg-action-primary-bg/5" : "border-border-subtle"),
|
|
68
|
+
children: [/* @__PURE__ */ N("input", {
|
|
69
|
+
type: "radio",
|
|
70
|
+
name: `${r}-privacy`,
|
|
71
|
+
value: i.value,
|
|
72
|
+
checked: e.privacyMode === i.value,
|
|
73
|
+
onChange: () => n({
|
|
74
|
+
...e,
|
|
75
|
+
privacyMode: i.value
|
|
76
|
+
}),
|
|
77
|
+
className: "mt-1"
|
|
78
|
+
}), /* @__PURE__ */ P("span", { children: [/* @__PURE__ */ N("span", {
|
|
79
|
+
className: "block text-sm font-medium text-text-primary",
|
|
80
|
+
children: i.label
|
|
81
|
+
}), /* @__PURE__ */ N("span", {
|
|
82
|
+
className: "block text-xs text-text-secondary",
|
|
83
|
+
children: i.description
|
|
84
|
+
})] })]
|
|
85
|
+
}, i.value))
|
|
86
|
+
})] }),
|
|
87
|
+
/* @__PURE__ */ P("div", {
|
|
88
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
89
|
+
children: [/* @__PURE__ */ P("div", { children: [
|
|
90
|
+
/* @__PURE__ */ N("label", {
|
|
91
|
+
htmlFor: `${r}-retention`,
|
|
92
|
+
className: "block text-sm font-medium text-text-primary",
|
|
93
|
+
children: "Keep captured data for (days)"
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ N("input", {
|
|
96
|
+
id: `${r}-retention`,
|
|
97
|
+
type: "text",
|
|
98
|
+
inputMode: "numeric",
|
|
99
|
+
placeholder: "Until I delete it",
|
|
100
|
+
value: e.retentionDays,
|
|
101
|
+
onChange: (t) => n({
|
|
102
|
+
...e,
|
|
103
|
+
retentionDays: t.target.value
|
|
104
|
+
}),
|
|
105
|
+
className: R
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ N("p", {
|
|
108
|
+
className: "mt-1 text-xs text-text-secondary",
|
|
109
|
+
children: "Older events from this channel are deleted automatically."
|
|
110
|
+
})
|
|
111
|
+
] }), /* @__PURE__ */ P("div", { children: [
|
|
112
|
+
/* @__PURE__ */ N("label", {
|
|
113
|
+
htmlFor: `${r}-interval`,
|
|
114
|
+
className: "block text-sm font-medium text-text-primary",
|
|
115
|
+
children: "Expected sync interval (minutes)"
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ N("input", {
|
|
118
|
+
id: `${r}-interval`,
|
|
119
|
+
type: "text",
|
|
120
|
+
inputMode: "numeric",
|
|
121
|
+
placeholder: "On demand",
|
|
122
|
+
value: e.syncIntervalMinutes,
|
|
123
|
+
onChange: (t) => n({
|
|
124
|
+
...e,
|
|
125
|
+
syncIntervalMinutes: t.target.value
|
|
126
|
+
}),
|
|
127
|
+
className: R
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ N("p", {
|
|
130
|
+
className: "mt-1 text-xs text-text-secondary",
|
|
131
|
+
children: "Used to flag a source that has gone quiet."
|
|
132
|
+
})
|
|
133
|
+
] })]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function Ce(e) {
|
|
139
|
+
return {
|
|
140
|
+
name: e.name,
|
|
141
|
+
privacyMode: e.privacyMode,
|
|
142
|
+
retentionDays: e.retentionDays == null ? "" : String(e.retentionDays),
|
|
143
|
+
syncIntervalMinutes: e.syncIntervalMinutes == null ? "" : String(e.syncIntervalMinutes)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function we({ channel: e, busy: r, onManage: i, onTogglePause: ee, onResume: a }) {
|
|
147
|
+
let o = g(e.type), s = ue(e.status), te = ce(e.status, e.lastSyncAt, e.syncIntervalMinutes), c = e.status === f.Disconnected;
|
|
148
|
+
return /* @__PURE__ */ P(F, {
|
|
149
|
+
treatment: "glass",
|
|
150
|
+
className: "flex flex-col p-4 sm:p-5",
|
|
151
|
+
"data-testid": "channel-card",
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ P("div", {
|
|
154
|
+
className: "flex items-start gap-3",
|
|
155
|
+
children: [/* @__PURE__ */ N("div", {
|
|
156
|
+
className: t("flex h-10 w-10 shrink-0 items-center justify-center rounded-lg", c ? "bg-bg-sunken text-text-secondary" : "bg-action-primary-bg/10 text-primary"),
|
|
157
|
+
children: V[e.type]
|
|
158
|
+
}), /* @__PURE__ */ P("div", {
|
|
159
|
+
className: "min-w-0 flex-1",
|
|
160
|
+
children: [/* @__PURE__ */ N("h3", {
|
|
161
|
+
className: "truncate text-base font-semibold text-text-primary",
|
|
162
|
+
children: e.name
|
|
163
|
+
}), /* @__PURE__ */ P("p", {
|
|
164
|
+
className: "truncate text-xs text-text-secondary",
|
|
165
|
+
children: [o.label, e.provider ? ` · ${e.provider}` : ""]
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
168
|
+
}),
|
|
169
|
+
/* @__PURE__ */ P("div", {
|
|
170
|
+
className: "mt-3 flex flex-wrap items-center gap-2",
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ N(l, {
|
|
173
|
+
label: s.label,
|
|
174
|
+
variant: s.tone,
|
|
175
|
+
dot: !0
|
|
176
|
+
}),
|
|
177
|
+
te && /* @__PURE__ */ N(l, {
|
|
178
|
+
label: "Sync overdue",
|
|
179
|
+
variant: "warning"
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ N(l, {
|
|
182
|
+
label: y(e.privacyMode),
|
|
183
|
+
variant: "muted"
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ P("dl", {
|
|
188
|
+
className: "mt-3 space-y-1 text-sm",
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ P("div", {
|
|
191
|
+
className: "flex justify-between gap-3",
|
|
192
|
+
children: [/* @__PURE__ */ N("dt", {
|
|
193
|
+
className: "text-text-secondary",
|
|
194
|
+
children: "Last sync"
|
|
195
|
+
}), /* @__PURE__ */ N("dd", {
|
|
196
|
+
className: "text-right text-text-primary",
|
|
197
|
+
children: e.lastSyncAt ? n(e.lastSyncAt) : "Never"
|
|
198
|
+
})]
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ P("div", {
|
|
201
|
+
className: "flex justify-between gap-3",
|
|
202
|
+
children: [/* @__PURE__ */ N("dt", {
|
|
203
|
+
className: "text-text-secondary",
|
|
204
|
+
children: "Interval"
|
|
205
|
+
}), /* @__PURE__ */ N("dd", {
|
|
206
|
+
className: "text-right text-text-primary",
|
|
207
|
+
children: _(e.syncIntervalMinutes)
|
|
208
|
+
})]
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ P("div", {
|
|
211
|
+
className: "flex justify-between gap-3",
|
|
212
|
+
children: [/* @__PURE__ */ N("dt", {
|
|
213
|
+
className: "text-text-secondary",
|
|
214
|
+
children: "Events captured"
|
|
215
|
+
}), /* @__PURE__ */ N("dd", {
|
|
216
|
+
className: "text-right text-text-primary",
|
|
217
|
+
children: e.totalEvents.toLocaleString()
|
|
218
|
+
})]
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ P("div", {
|
|
221
|
+
className: "flex justify-between gap-3",
|
|
222
|
+
children: [/* @__PURE__ */ N("dt", {
|
|
223
|
+
className: "text-text-secondary",
|
|
224
|
+
children: "Retention"
|
|
225
|
+
}), /* @__PURE__ */ N("dd", {
|
|
226
|
+
className: "text-right text-text-primary",
|
|
227
|
+
children: se(e.retentionDays)
|
|
228
|
+
})]
|
|
229
|
+
})
|
|
230
|
+
]
|
|
231
|
+
}),
|
|
232
|
+
/* @__PURE__ */ P("div", {
|
|
233
|
+
className: "mt-4 grid grid-cols-2 gap-2",
|
|
234
|
+
children: [/* @__PURE__ */ P("button", {
|
|
235
|
+
type: "button",
|
|
236
|
+
className: z,
|
|
237
|
+
onClick: i,
|
|
238
|
+
"aria-label": `Manage ${e.name}`,
|
|
239
|
+
children: [/* @__PURE__ */ N(ve, { className: "h-4 w-4" }), "Manage"]
|
|
240
|
+
}), c ? /* @__PURE__ */ P("button", {
|
|
241
|
+
type: "button",
|
|
242
|
+
className: z,
|
|
243
|
+
onClick: a,
|
|
244
|
+
disabled: r,
|
|
245
|
+
"aria-label": `Reconnect ${e.name}`,
|
|
246
|
+
children: [/* @__PURE__ */ N(he, { className: "h-4 w-4" }), "Reconnect"]
|
|
247
|
+
}) : /* @__PURE__ */ N("button", {
|
|
248
|
+
type: "button",
|
|
249
|
+
className: z,
|
|
250
|
+
onClick: ee,
|
|
251
|
+
disabled: r,
|
|
252
|
+
"aria-label": `${e.status === f.Paused ? "Resume" : "Pause"} ${e.name}`,
|
|
253
|
+
children: e.status === f.Paused ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(E, { className: "h-4 w-4" }), "Resume"] }) : /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(T, { className: "h-4 w-4" }), "Pause"] })
|
|
254
|
+
})]
|
|
255
|
+
})
|
|
256
|
+
]
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function Te({ channelId: e }) {
|
|
260
|
+
let [t, n] = b(!1);
|
|
261
|
+
return /* @__PURE__ */ P("div", { children: [
|
|
262
|
+
/* @__PURE__ */ N("p", {
|
|
263
|
+
className: "text-sm font-medium text-text-primary",
|
|
264
|
+
children: "Channel ID"
|
|
265
|
+
}),
|
|
266
|
+
/* @__PURE__ */ P("div", {
|
|
267
|
+
className: "mt-1 flex items-center gap-2",
|
|
268
|
+
children: [/* @__PURE__ */ N("code", {
|
|
269
|
+
className: "min-w-0 flex-1 truncate rounded-md border border-border-subtle bg-bg-sunken px-3 py-2 text-xs text-text-primary",
|
|
270
|
+
"data-testid": "channel-id",
|
|
271
|
+
children: e
|
|
272
|
+
}), /* @__PURE__ */ P("button", {
|
|
273
|
+
type: "button",
|
|
274
|
+
className: z,
|
|
275
|
+
onClick: async () => {
|
|
276
|
+
try {
|
|
277
|
+
await navigator.clipboard.writeText(e), n(!0), window.setTimeout(() => n(!1), 2e3);
|
|
278
|
+
} catch {
|
|
279
|
+
n(!1);
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"aria-label": "Copy channel ID",
|
|
283
|
+
children: [N(t ? C : pe, { className: "h-4 w-4" }), t ? "Copied" : "Copy"]
|
|
284
|
+
})]
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ N("p", {
|
|
287
|
+
className: "mt-2 text-xs text-text-secondary",
|
|
288
|
+
children: m
|
|
289
|
+
})
|
|
290
|
+
] });
|
|
291
|
+
}
|
|
292
|
+
function H() {
|
|
293
|
+
let { workspaceId: n = "" } = e(), { toasts: l, addToast: p, dismissToast: m } = ae(), [h, se] = b(""), { data: _, loading: ce, error: v, refetch: y } = te({
|
|
294
|
+
variables: { includeDisconnected: !0 },
|
|
295
|
+
skip: !n,
|
|
296
|
+
fetchPolicy: "cache-and-network"
|
|
297
|
+
}), [ue, { loading: x }] = a(), [S, { loading: C }] = ne(), [fe] = s(), [pe] = c(), [w] = o(), [T, E] = b(null), [ve, D] = b(!1), [O, A] = b(null), [F, I] = b({
|
|
298
|
+
name: "",
|
|
299
|
+
privacyMode: d.Full,
|
|
300
|
+
retentionDays: "",
|
|
301
|
+
syncIntervalMinutes: ""
|
|
302
|
+
}), [L, H] = b(null), [U, W] = b(null), [G, Ee] = b(null), [K, q] = b(null), [De, J] = b(null), [Y, X] = b(null), [Oe, ke] = b(!1), Z = de(() => _?.myTimeCampusCaptureChannels ?? [], [_]), Ae = de(() => Z.filter((e) => le(e, h)), [Z, h]), je = Z.filter((e) => e.status === f.Active).length, Me = Z.reduce((e, t) => e + t.totalEvents, 0), Ne = {
|
|
303
|
+
title: "Channels",
|
|
304
|
+
description: "Manage and configure your connected capture sources",
|
|
305
|
+
purpose: "Channels are the sources that feed your automatic timeline: the browser extension, desktop and mobile apps, editors, the command line, calendars and your own API clients. Connect a source here, then decide how much detail it may store, how long its data is kept, and pause or disconnect it at any time. Your channels are private to you."
|
|
306
|
+
}, Pe = () => {
|
|
307
|
+
A(null), W(null), H(null), D(!0);
|
|
308
|
+
}, Fe = (e) => {
|
|
309
|
+
A(e), I({
|
|
310
|
+
name: g(e).defaultName,
|
|
311
|
+
privacyMode: d.Full,
|
|
312
|
+
retentionDays: "",
|
|
313
|
+
syncIntervalMinutes: ""
|
|
314
|
+
}), H(null);
|
|
315
|
+
}, Q = () => {
|
|
316
|
+
D(!1), A(null), W(null);
|
|
317
|
+
}, Ie = async () => {
|
|
318
|
+
if (!O) return;
|
|
319
|
+
let e = xe(F);
|
|
320
|
+
if ("error" in e) {
|
|
321
|
+
H(e.error);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
H(null);
|
|
325
|
+
try {
|
|
326
|
+
let t = await ue({ variables: { input: {
|
|
327
|
+
type: O,
|
|
328
|
+
...e
|
|
329
|
+
} } });
|
|
330
|
+
if (t.error) throw Error(t.error.message);
|
|
331
|
+
let n = t.data?.connectTimeCampusCaptureChannel;
|
|
332
|
+
if (!n) throw Error("No channel returned");
|
|
333
|
+
W(n), await y();
|
|
334
|
+
} catch (e) {
|
|
335
|
+
H(e instanceof Error && e.message ? e.message : "Couldn't connect this channel. Please try again.");
|
|
336
|
+
}
|
|
337
|
+
}, Le = (e) => {
|
|
338
|
+
Ee(e), q(Ce(e)), J(null);
|
|
339
|
+
}, $ = () => {
|
|
340
|
+
Ee(null), q(null);
|
|
341
|
+
}, Re = async () => {
|
|
342
|
+
if (!G || !K) return;
|
|
343
|
+
let e = xe(K);
|
|
344
|
+
if ("error" in e) {
|
|
345
|
+
J(e.error);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
J(null);
|
|
349
|
+
try {
|
|
350
|
+
let t = await S({ variables: {
|
|
351
|
+
id: G.id,
|
|
352
|
+
input: e
|
|
353
|
+
} });
|
|
354
|
+
if (t.error) throw Error(t.error.message);
|
|
355
|
+
await y(), p({
|
|
356
|
+
title: `${e.name} updated`,
|
|
357
|
+
variant: "success"
|
|
358
|
+
}), $();
|
|
359
|
+
} catch (e) {
|
|
360
|
+
J(e instanceof Error && e.message ? e.message : "Couldn't save these settings. Please try again.");
|
|
361
|
+
}
|
|
362
|
+
}, ze = async (e, t) => {
|
|
363
|
+
E(e.id);
|
|
364
|
+
try {
|
|
365
|
+
let n = await S({ variables: {
|
|
366
|
+
id: e.id,
|
|
367
|
+
input: { status: t }
|
|
368
|
+
} });
|
|
369
|
+
if (n.error) throw Error(n.error.message);
|
|
370
|
+
await y(), p({
|
|
371
|
+
title: t === f.Paused ? `${e.name} paused` : `${e.name} is capturing again`,
|
|
372
|
+
description: t === f.Paused ? "Events it sends while paused are refused and never stored." : void 0,
|
|
373
|
+
variant: "success"
|
|
374
|
+
});
|
|
375
|
+
} catch {
|
|
376
|
+
p({
|
|
377
|
+
title: "Couldn't change this channel",
|
|
378
|
+
description: "Nothing was changed. Please try again.",
|
|
379
|
+
variant: "error"
|
|
380
|
+
});
|
|
381
|
+
} finally {
|
|
382
|
+
E(null);
|
|
383
|
+
}
|
|
384
|
+
}, Be = async () => {
|
|
385
|
+
if (!Y) return;
|
|
386
|
+
let { channel: e } = Y;
|
|
387
|
+
ke(!0);
|
|
388
|
+
try {
|
|
389
|
+
if (Y.kind === "disconnect") {
|
|
390
|
+
let t = await fe({ variables: { id: e.id } });
|
|
391
|
+
if (t.error) throw Error(t.error.message);
|
|
392
|
+
p({
|
|
393
|
+
title: `${e.name} disconnected`,
|
|
394
|
+
description: "Captured events are kept until you delete them.",
|
|
395
|
+
variant: "success"
|
|
396
|
+
});
|
|
397
|
+
} else if (Y.kind === "purge") {
|
|
398
|
+
let t = await pe({ variables: {
|
|
399
|
+
id: e.id,
|
|
400
|
+
confirm: !0
|
|
401
|
+
} });
|
|
402
|
+
if (t.error) throw Error(t.error.message);
|
|
403
|
+
let n = t.data?.purgeTimeCampusCaptureChannelEvents.purgedEvents ?? 0;
|
|
404
|
+
p({
|
|
405
|
+
title: `Deleted ${n.toLocaleString()} captured ${n === 1 ? "event" : "events"}`,
|
|
406
|
+
variant: "success"
|
|
407
|
+
});
|
|
408
|
+
} else {
|
|
409
|
+
let t = await w({ variables: {
|
|
410
|
+
id: e.id,
|
|
411
|
+
confirm: !0
|
|
412
|
+
} });
|
|
413
|
+
if (t.error) throw Error(t.error.message);
|
|
414
|
+
p({
|
|
415
|
+
title: `${e.name} removed`,
|
|
416
|
+
variant: "success"
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
await y(), X(null), $();
|
|
420
|
+
} catch {
|
|
421
|
+
p({
|
|
422
|
+
title: "That didn't work",
|
|
423
|
+
description: "Nothing was changed. Please try again.",
|
|
424
|
+
variant: "error"
|
|
425
|
+
});
|
|
426
|
+
} finally {
|
|
427
|
+
ke(!1);
|
|
428
|
+
}
|
|
429
|
+
}, Ve = /* @__PURE__ */ P("button", {
|
|
430
|
+
type: "button",
|
|
431
|
+
className: B,
|
|
432
|
+
onClick: Pe,
|
|
433
|
+
children: [/* @__PURE__ */ N(ge, { className: "h-4 w-4" }), "Connect channel"]
|
|
434
|
+
}), He = !n || ce && !_;
|
|
435
|
+
return /* @__PURE__ */ P(re, {
|
|
436
|
+
...Ne,
|
|
437
|
+
actions: Ve,
|
|
438
|
+
children: [
|
|
439
|
+
He ? /* @__PURE__ */ N("div", {
|
|
440
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4",
|
|
441
|
+
children: /* @__PURE__ */ N(i, {
|
|
442
|
+
variant: "card",
|
|
443
|
+
count: 4
|
|
444
|
+
})
|
|
445
|
+
}) : v && !_ ? /* @__PURE__ */ N("div", {
|
|
446
|
+
className: "rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text",
|
|
447
|
+
children: "We couldn't load your channels right now. Please try again in a moment."
|
|
448
|
+
}) : /* @__PURE__ */ P("div", {
|
|
449
|
+
className: "space-y-6",
|
|
450
|
+
children: [/* @__PURE__ */ P("div", {
|
|
451
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ N(r, {
|
|
454
|
+
title: "Channels",
|
|
455
|
+
value: Z.length,
|
|
456
|
+
icon: /* @__PURE__ */ N(me, { className: "h-5 w-5" })
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ N(r, {
|
|
459
|
+
title: "Capturing now",
|
|
460
|
+
value: je,
|
|
461
|
+
icon: /* @__PURE__ */ N(he, { className: "h-5 w-5" })
|
|
462
|
+
}),
|
|
463
|
+
/* @__PURE__ */ N(r, {
|
|
464
|
+
title: "Events captured",
|
|
465
|
+
value: Me.toLocaleString(),
|
|
466
|
+
icon: /* @__PURE__ */ N(j, { className: "h-5 w-5" })
|
|
467
|
+
})
|
|
468
|
+
]
|
|
469
|
+
}), Z.length === 0 ? /* @__PURE__ */ N(ee, {
|
|
470
|
+
illustration: "empty-data",
|
|
471
|
+
title: "No channels connected yet",
|
|
472
|
+
description: "Connect your first source — a browser, an editor, your calendar or an API client — and its activity will start assembling your timeline.",
|
|
473
|
+
action: Ve
|
|
474
|
+
}) : /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ P("div", {
|
|
475
|
+
className: "relative max-w-md",
|
|
476
|
+
children: [/* @__PURE__ */ N(_e, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ N("input", {
|
|
477
|
+
type: "search",
|
|
478
|
+
"aria-label": "Search channels",
|
|
479
|
+
placeholder: "Search channels...",
|
|
480
|
+
value: h,
|
|
481
|
+
onChange: (e) => se(e.target.value),
|
|
482
|
+
className: t(R, "mt-0 pl-9")
|
|
483
|
+
})]
|
|
484
|
+
}), Ae.length === 0 ? /* @__PURE__ */ P("p", {
|
|
485
|
+
className: "text-sm text-text-secondary",
|
|
486
|
+
children: [
|
|
487
|
+
"No channels match \"",
|
|
488
|
+
h,
|
|
489
|
+
"\"."
|
|
490
|
+
]
|
|
491
|
+
}) : /* @__PURE__ */ N("div", {
|
|
492
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4",
|
|
493
|
+
children: Ae.map((e) => /* @__PURE__ */ N(we, {
|
|
494
|
+
channel: e,
|
|
495
|
+
busy: T === e.id || C,
|
|
496
|
+
onManage: () => Le(e),
|
|
497
|
+
onTogglePause: () => ze(e, e.status === f.Paused ? f.Active : f.Paused),
|
|
498
|
+
onResume: () => ze(e, f.Active)
|
|
499
|
+
}, e.id))
|
|
500
|
+
})] })]
|
|
501
|
+
}),
|
|
502
|
+
/* @__PURE__ */ N(u, {
|
|
503
|
+
open: ve,
|
|
504
|
+
onClose: Q,
|
|
505
|
+
title: U ? "Channel connected" : O ? `Connect ${g(O).label}` : "Connect a channel",
|
|
506
|
+
description: U ? "Your source can start sending activity to this channel." : O ? "Choose how much this source may store and how long to keep it." : "Pick the kind of source you want to capture from.",
|
|
507
|
+
size: "xl",
|
|
508
|
+
footer: U ? /* @__PURE__ */ N("button", {
|
|
509
|
+
type: "button",
|
|
510
|
+
className: B,
|
|
511
|
+
onClick: Q,
|
|
512
|
+
children: "Done"
|
|
513
|
+
}) : O ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("button", {
|
|
514
|
+
type: "button",
|
|
515
|
+
className: z,
|
|
516
|
+
onClick: () => A(null),
|
|
517
|
+
children: "Back"
|
|
518
|
+
}), /* @__PURE__ */ N("button", {
|
|
519
|
+
type: "button",
|
|
520
|
+
className: B,
|
|
521
|
+
onClick: Ie,
|
|
522
|
+
disabled: x,
|
|
523
|
+
children: x ? "Connecting..." : "Connect"
|
|
524
|
+
})] }) : /* @__PURE__ */ N("button", {
|
|
525
|
+
type: "button",
|
|
526
|
+
className: z,
|
|
527
|
+
onClick: Q,
|
|
528
|
+
children: "Cancel"
|
|
529
|
+
}),
|
|
530
|
+
children: U ? /* @__PURE__ */ N(Te, { channelId: U.id }) : O ? /* @__PURE__ */ P(M, { children: [L && /* @__PURE__ */ N("div", {
|
|
531
|
+
className: "mb-4 rounded-lg border border-status-error-border/50 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
|
|
532
|
+
children: L
|
|
533
|
+
}), /* @__PURE__ */ N(Se, {
|
|
534
|
+
form: F,
|
|
535
|
+
onChange: I,
|
|
536
|
+
idPrefix: "connect"
|
|
537
|
+
})] }) : /* @__PURE__ */ N("div", {
|
|
538
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
539
|
+
children: oe.map((e) => /* @__PURE__ */ P("button", {
|
|
540
|
+
type: "button",
|
|
541
|
+
onClick: () => Fe(e.type),
|
|
542
|
+
className: "flex items-start gap-3 rounded-lg border border-border-subtle p-3 text-left hover:bg-bg-sunken/50",
|
|
543
|
+
children: [/* @__PURE__ */ N("span", {
|
|
544
|
+
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary",
|
|
545
|
+
children: V[e.type]
|
|
546
|
+
}), /* @__PURE__ */ P("span", {
|
|
547
|
+
className: "min-w-0",
|
|
548
|
+
children: [/* @__PURE__ */ N("span", {
|
|
549
|
+
className: "block text-sm font-medium text-text-primary",
|
|
550
|
+
children: e.label
|
|
551
|
+
}), /* @__PURE__ */ N("span", {
|
|
552
|
+
className: "block text-xs text-text-secondary",
|
|
553
|
+
children: e.description
|
|
554
|
+
})]
|
|
555
|
+
})]
|
|
556
|
+
}, e.type))
|
|
557
|
+
})
|
|
558
|
+
}),
|
|
559
|
+
/* @__PURE__ */ N(u, {
|
|
560
|
+
open: G !== null && Y === null,
|
|
561
|
+
onClose: $,
|
|
562
|
+
title: G ? `Manage ${G.name}` : "Manage channel",
|
|
563
|
+
description: G ? g(G.type).label : void 0,
|
|
564
|
+
size: "xl",
|
|
565
|
+
footer: /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("button", {
|
|
566
|
+
type: "button",
|
|
567
|
+
className: z,
|
|
568
|
+
onClick: $,
|
|
569
|
+
children: "Cancel"
|
|
570
|
+
}), /* @__PURE__ */ N("button", {
|
|
571
|
+
type: "button",
|
|
572
|
+
className: B,
|
|
573
|
+
onClick: Re,
|
|
574
|
+
disabled: C,
|
|
575
|
+
children: C ? "Saving..." : "Save changes"
|
|
576
|
+
})] }),
|
|
577
|
+
children: G && K && /* @__PURE__ */ P("div", {
|
|
578
|
+
className: "space-y-6",
|
|
579
|
+
children: [
|
|
580
|
+
De && /* @__PURE__ */ N("div", {
|
|
581
|
+
className: "rounded-lg border border-status-error-border/50 bg-status-error-bg/10 p-3 text-sm text-status-error-text",
|
|
582
|
+
children: De
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ N(Se, {
|
|
585
|
+
form: K,
|
|
586
|
+
onChange: q,
|
|
587
|
+
idPrefix: "manage"
|
|
588
|
+
}),
|
|
589
|
+
/* @__PURE__ */ N(Te, { channelId: G.id }),
|
|
590
|
+
/* @__PURE__ */ P("div", {
|
|
591
|
+
className: "rounded-lg border border-status-error-border/40 p-4",
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ N("p", {
|
|
594
|
+
className: "text-sm font-medium text-text-primary",
|
|
595
|
+
children: "Disconnect or delete"
|
|
596
|
+
}),
|
|
597
|
+
/* @__PURE__ */ N("p", {
|
|
598
|
+
className: "mt-1 text-xs text-text-secondary",
|
|
599
|
+
children: "Disconnecting stops capture but keeps what was captured. Deleting captured data and removing the channel cannot be undone."
|
|
600
|
+
}),
|
|
601
|
+
/* @__PURE__ */ P("div", {
|
|
602
|
+
className: "mt-3 flex flex-wrap gap-2",
|
|
603
|
+
children: [
|
|
604
|
+
G.status !== f.Disconnected && /* @__PURE__ */ P("button", {
|
|
605
|
+
type: "button",
|
|
606
|
+
className: z,
|
|
607
|
+
onClick: () => X({
|
|
608
|
+
kind: "disconnect",
|
|
609
|
+
channel: G
|
|
610
|
+
}),
|
|
611
|
+
children: [/* @__PURE__ */ N(ye, { className: "h-4 w-4" }), "Disconnect"]
|
|
612
|
+
}),
|
|
613
|
+
/* @__PURE__ */ P("button", {
|
|
614
|
+
type: "button",
|
|
615
|
+
className: z,
|
|
616
|
+
onClick: () => X({
|
|
617
|
+
kind: "purge",
|
|
618
|
+
channel: G
|
|
619
|
+
}),
|
|
620
|
+
children: [/* @__PURE__ */ N(k, { className: "h-4 w-4" }), "Delete captured data"]
|
|
621
|
+
}),
|
|
622
|
+
/* @__PURE__ */ P("button", {
|
|
623
|
+
type: "button",
|
|
624
|
+
className: be,
|
|
625
|
+
onClick: () => X({
|
|
626
|
+
kind: "remove",
|
|
627
|
+
channel: G
|
|
628
|
+
}),
|
|
629
|
+
children: [/* @__PURE__ */ N(k, { className: "h-4 w-4" }), "Remove channel"]
|
|
630
|
+
})
|
|
631
|
+
]
|
|
632
|
+
})
|
|
633
|
+
]
|
|
634
|
+
})
|
|
635
|
+
]
|
|
636
|
+
})
|
|
637
|
+
}),
|
|
638
|
+
/* @__PURE__ */ N(u, {
|
|
639
|
+
open: Y !== null,
|
|
640
|
+
onClose: () => X(null),
|
|
641
|
+
title: Y?.kind === "disconnect" ? "Disconnect channel?" : Y?.kind === "purge" ? "Delete captured data?" : "Remove channel?",
|
|
642
|
+
footer: /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("button", {
|
|
643
|
+
type: "button",
|
|
644
|
+
className: z,
|
|
645
|
+
onClick: () => X(null),
|
|
646
|
+
children: "Cancel"
|
|
647
|
+
}), /* @__PURE__ */ N("button", {
|
|
648
|
+
type: "button",
|
|
649
|
+
className: Y?.kind === "disconnect" ? B : be,
|
|
650
|
+
onClick: Be,
|
|
651
|
+
disabled: Oe,
|
|
652
|
+
children: Oe ? "Working..." : Y?.kind === "disconnect" ? "Disconnect" : Y?.kind === "purge" ? "Delete data" : "Remove"
|
|
653
|
+
})] }),
|
|
654
|
+
children: /* @__PURE__ */ P("p", {
|
|
655
|
+
className: "text-sm text-text-secondary",
|
|
656
|
+
children: [
|
|
657
|
+
Y?.kind === "disconnect" && `${Y.channel.name} will stop capturing. Anything it sends is refused until you reconnect it. Captured events are kept.`,
|
|
658
|
+
Y?.kind === "purge" && `Every event captured by ${Y.channel.name} will be permanently deleted from your timeline. This cannot be undone.`,
|
|
659
|
+
Y?.kind === "remove" && `${Y.channel.name} will be removed and its ID refused from now on. Events it already captured stay on your timeline unless you delete them first.`
|
|
660
|
+
]
|
|
661
|
+
})
|
|
662
|
+
}),
|
|
663
|
+
/* @__PURE__ */ N(ie, {
|
|
664
|
+
toasts: l,
|
|
665
|
+
onDismiss: m
|
|
666
|
+
})
|
|
667
|
+
]
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
//#endregion
|
|
671
|
+
export { H as ChannelsPage };
|
|
672
|
+
|
|
673
|
+
//# sourceMappingURL=ChannelsPage.js.map
|