@gentiq/ui 1.0.0-alpha.11 → 1.0.0-alpha.12

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,574 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as n, Fragment as ne } from "react/jsx-runtime";
3
+ import { useId as qe, useState as m, useMemo as $e } from "react";
4
+ import { ExternalLink as de, Plus as Te, Clock as De, Zap as Fe, Pause as Oe, Play as Ae, Pencil as Ie, History as Me, Trash2 as Le } from "lucide-react";
5
+ import { toast as g } from "sonner";
6
+ import { detectLocalTimezone as Pe, weekStart as We, createDateFormatter as X, describeSchedule as me, cronToPreset as Ee, presetToCron as ae, toLocalInput as ue } from "@gentiq/core";
7
+ import { useGentiqTranslation as G, useGentiqLanguage as Y, useScheduleActions as he, getLocalizedErrorMessage as W, useThreadSelection as pe, useScheduleRuns as je, useSchedules as Re, Schedules as B } from "@gentiq/react";
8
+ import { D as fe, e as ge, f as ye, g as ve, J as f, Q as P, K as se, M as ie, N as le, O as oe, P as S, c as xe, X as Ve, B as v, h as Q } from "./shared-C6NokIol.js";
9
+ import { S as U } from "./shared-opU08IAK.js";
10
+ import { u as be } from "./shared-HOMT87-R.js";
11
+ import { D as Be, C as Ue } from "./shared-C0zGnIf8.js";
12
+ import { T as Ge } from "./shared-BqghN38E.js";
13
+ function ce(i) {
14
+ return String(i).padStart(2, "0");
15
+ }
16
+ function F() {
17
+ return ue(new Date(Date.now() + 3600 * 1e3));
18
+ }
19
+ function He(i) {
20
+ if (!i) return "";
21
+ const t = new Date(i);
22
+ return Number.isNaN(t.getTime()) ? "" : ue(t);
23
+ }
24
+ function Ze(i) {
25
+ if (!i)
26
+ return {
27
+ frequency: "daily",
28
+ time: "09:00",
29
+ daysOfWeek: [1, 2, 3, 4, 5],
30
+ intervalMinutes: "60",
31
+ runAt: F(),
32
+ cron: "0 9 * * *"
33
+ };
34
+ if (i.kind === "once")
35
+ return {
36
+ frequency: "once",
37
+ time: "09:00",
38
+ daysOfWeek: [1, 2, 3, 4, 5],
39
+ intervalMinutes: "60",
40
+ runAt: He(i.run_at) || F(),
41
+ cron: i.cron ?? "0 9 * * *"
42
+ };
43
+ if (i.kind === "interval")
44
+ return {
45
+ frequency: "interval",
46
+ time: "09:00",
47
+ daysOfWeek: [1, 2, 3, 4, 5],
48
+ intervalMinutes: String(i.interval_minutes ?? 60),
49
+ runAt: F(),
50
+ cron: i.cron ?? "0 9 * * *"
51
+ };
52
+ const t = Ee(i.cron);
53
+ return t ? {
54
+ frequency: t.frequency,
55
+ time: `${ce(t.hour)}:${ce(t.minute)}`,
56
+ daysOfWeek: t.frequency === "weekly" ? t.daysOfWeek : [1, 2, 3, 4, 5],
57
+ intervalMinutes: "60",
58
+ runAt: F(),
59
+ cron: i.cron ?? "0 9 * * *"
60
+ } : {
61
+ frequency: "cron",
62
+ time: "09:00",
63
+ daysOfWeek: [1, 2, 3, 4, 5],
64
+ intervalMinutes: "60",
65
+ runAt: F(),
66
+ cron: i.cron ?? "0 9 * * *"
67
+ };
68
+ }
69
+ function Je({
70
+ schedule: i,
71
+ onClose: t
72
+ }) {
73
+ const l = qe(), { t: r, i18n: y } = G(["schedules", "errors"]), { dir: C } = Y(), { create: _, update: z } = he(), p = Ze(i), [w, O] = m(i?.name ?? ""), [q, o] = m(i?.prompt ?? ""), [u, E] = m(p.frequency), [A, j] = m(p.time), [x, $] = m(p.daysOfWeek), [b, H] = m(p.intervalMinutes), [T, Z] = m(p.runAt), [R, J] = m(p.cron), [V, s] = m(i?.timezone || Pe()), [k, I] = m(
74
+ i?.thread_mode ?? "shared"
75
+ ), [N, Ne] = m(i?.silent_if_empty ?? !1), c = _.isPending || z.isPending, [_e, we] = A.split(":"), ee = Number(_e ?? "9"), te = Number(we ?? "0"), ke = $e(() => {
76
+ const a = We(y.language), d = X(y.language, { weekday: "narrow", timeZone: "UTC" });
77
+ return Array.from({ length: 7 }, (h, D) => {
78
+ const L = (a + D) % 7;
79
+ let K = String(L);
80
+ try {
81
+ K = d.format(new Date(Date.UTC(2024, 0, 7 + L)));
82
+ } catch {
83
+ K = r(`days.${L}`).slice(0, 1);
84
+ }
85
+ return { dow: L, shortLabel: K, fullLabel: r(`days.${L}`) };
86
+ });
87
+ }, [y.language, r]), Se = (a) => {
88
+ $((d) => d.includes(a) ? d.length > 1 ? d.filter((h) => h !== a) : d : [...d, a].sort((h, D) => h - D));
89
+ }, re = () => {
90
+ const a = {
91
+ name: w.trim(),
92
+ prompt: q.trim(),
93
+ timezone: V.trim() || "UTC",
94
+ thread_mode: k,
95
+ silent_if_empty: N
96
+ };
97
+ if (u === "once") {
98
+ const h = T ? new Date(T).toISOString() : F();
99
+ return { ...a, kind: "once", run_at: h };
100
+ }
101
+ if (u === "interval") {
102
+ const h = Math.max(1, Number.parseInt(b || "60", 10) || 60);
103
+ return { ...a, kind: "interval", interval_minutes: h };
104
+ }
105
+ const d = u === "cron" ? R.trim() : u === "weekly" ? ae({ frequency: "weekly", hour: ee, minute: te, daysOfWeek: x }) : ae({ frequency: "daily", hour: ee, minute: te });
106
+ return { ...a, kind: "cron", cron: d };
107
+ }, M = re(), Ce = me(
108
+ {
109
+ kind: M.kind,
110
+ cron: M.cron ?? null,
111
+ interval_minutes: M.interval_minutes ?? null,
112
+ run_at: M.run_at ?? null,
113
+ timezone: M.timezone ?? "UTC"
114
+ },
115
+ r,
116
+ y.language
117
+ ), ze = async (a) => {
118
+ if (a.preventDefault(), c) return;
119
+ const d = re();
120
+ try {
121
+ i ? (await z.mutateAsync({ id: i.id, data: d }), g.success(r("updated"))) : (await _.mutateAsync(d), g.success(r("created"))), t();
122
+ } catch (h) {
123
+ g.error(W(h, r));
124
+ }
125
+ };
126
+ return /* @__PURE__ */ n("form", { onSubmit: (a) => {
127
+ ze(a);
128
+ }, className: "space-y-4", children: [
129
+ /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
130
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-name`, children: r("form.name") }),
131
+ /* @__PURE__ */ e(
132
+ P,
133
+ {
134
+ id: `${l}-name`,
135
+ value: w,
136
+ onChange: (a) => O(a.target.value),
137
+ placeholder: r("form.name_placeholder"),
138
+ required: !0,
139
+ disabled: c
140
+ }
141
+ )
142
+ ] }),
143
+ /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
144
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-prompt`, children: r("form.prompt") }),
145
+ /* @__PURE__ */ e(
146
+ Ge,
147
+ {
148
+ id: `${l}-prompt`,
149
+ value: q,
150
+ onChange: (a) => o(a.target.value),
151
+ placeholder: r("form.prompt_placeholder"),
152
+ rows: 3,
153
+ required: !0,
154
+ disabled: c
155
+ }
156
+ )
157
+ ] }),
158
+ /* @__PURE__ */ n("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
159
+ /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
160
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-freq`, children: r("form.frequency") }),
161
+ /* @__PURE__ */ n(
162
+ se,
163
+ {
164
+ dir: C,
165
+ value: u,
166
+ onValueChange: (a) => E(a),
167
+ disabled: c,
168
+ children: [
169
+ /* @__PURE__ */ e(ie, { id: `${l}-freq`, className: "w-full", children: /* @__PURE__ */ e(le, {}) }),
170
+ /* @__PURE__ */ n(oe, { children: [
171
+ /* @__PURE__ */ e(S, { value: "daily", children: r("form.freq_daily") }),
172
+ /* @__PURE__ */ e(S, { value: "weekly", children: r("form.freq_weekly") }),
173
+ /* @__PURE__ */ e(S, { value: "interval", children: r("form.freq_interval") }),
174
+ /* @__PURE__ */ e(S, { value: "once", children: r("form.freq_once") }),
175
+ /* @__PURE__ */ e(S, { value: "cron", children: r("form.freq_cron") })
176
+ ] })
177
+ ]
178
+ }
179
+ )
180
+ ] }),
181
+ (u === "daily" || u === "weekly") && /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
182
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-time`, children: r("form.time") }),
183
+ /* @__PURE__ */ e(
184
+ P,
185
+ {
186
+ id: `${l}-time`,
187
+ type: "time",
188
+ value: A,
189
+ onChange: (a) => j(a.target.value),
190
+ required: !0,
191
+ disabled: c
192
+ }
193
+ )
194
+ ] }),
195
+ u === "weekly" && /* @__PURE__ */ n("div", { className: "space-y-1.5 sm:col-span-2", children: [
196
+ /* @__PURE__ */ e(f, { children: r("form.days_of_week") }),
197
+ /* @__PURE__ */ e("div", { className: "flex items-center justify-between gap-1.5 pt-0.5", role: "group", children: ke.map(({ dow: a, shortLabel: d, fullLabel: h }) => {
198
+ const D = x.includes(a);
199
+ return /* @__PURE__ */ e(
200
+ "button",
201
+ {
202
+ type: "button",
203
+ disabled: c,
204
+ "aria-pressed": D,
205
+ "aria-label": h,
206
+ title: h,
207
+ onClick: () => Se(a),
208
+ className: xe(
209
+ "flex size-9 items-center justify-center rounded-full text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
210
+ D ? "bg-primary text-primary-foreground shadow-sm" : "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground"
211
+ ),
212
+ children: d
213
+ },
214
+ a
215
+ );
216
+ }) })
217
+ ] }),
218
+ u === "interval" && /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
219
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-interval`, children: r("form.interval_minutes") }),
220
+ /* @__PURE__ */ e(
221
+ P,
222
+ {
223
+ id: `${l}-interval`,
224
+ type: "number",
225
+ min: 1,
226
+ value: b,
227
+ onChange: (a) => H(a.target.value),
228
+ required: !0,
229
+ disabled: c
230
+ }
231
+ )
232
+ ] }),
233
+ u === "once" && /* @__PURE__ */ n("div", { className: "space-y-1.5 sm:col-span-2", children: [
234
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-run-at`, children: r("form.run_at") }),
235
+ /* @__PURE__ */ e(
236
+ Be,
237
+ {
238
+ id: `${l}-run-at`,
239
+ value: T,
240
+ onChange: Z,
241
+ disabled: c,
242
+ clearable: !1
243
+ }
244
+ )
245
+ ] }),
246
+ u === "cron" && /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
247
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-cron`, children: r("form.cron") }),
248
+ /* @__PURE__ */ e(
249
+ P,
250
+ {
251
+ id: `${l}-cron`,
252
+ dir: "ltr",
253
+ value: R,
254
+ onChange: (a) => J(a.target.value),
255
+ placeholder: r("form.cron_placeholder"),
256
+ required: !0,
257
+ disabled: c
258
+ }
259
+ )
260
+ ] })
261
+ ] }),
262
+ /* @__PURE__ */ n("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
263
+ /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
264
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-tz`, children: r("form.timezone") }),
265
+ /* @__PURE__ */ e(
266
+ P,
267
+ {
268
+ id: `${l}-tz`,
269
+ dir: "ltr",
270
+ value: V,
271
+ onChange: (a) => s(a.target.value),
272
+ placeholder: r("form.timezone_placeholder"),
273
+ required: !0,
274
+ disabled: c
275
+ }
276
+ )
277
+ ] }),
278
+ /* @__PURE__ */ n("div", { className: "space-y-1.5", children: [
279
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-thread-mode`, children: r("form.thread_mode") }),
280
+ /* @__PURE__ */ n(
281
+ se,
282
+ {
283
+ dir: C,
284
+ value: k,
285
+ onValueChange: (a) => I(a),
286
+ disabled: c,
287
+ children: [
288
+ /* @__PURE__ */ e(ie, { id: `${l}-thread-mode`, className: "w-full", children: /* @__PURE__ */ e(le, {}) }),
289
+ /* @__PURE__ */ n(oe, { children: [
290
+ /* @__PURE__ */ e(S, { value: "shared", children: r("form.thread_shared") }),
291
+ /* @__PURE__ */ e(S, { value: "new", children: r("form.thread_new") })
292
+ ] })
293
+ ]
294
+ }
295
+ )
296
+ ] })
297
+ ] }),
298
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2.5 pt-1", children: [
299
+ /* @__PURE__ */ e(
300
+ Ue,
301
+ {
302
+ id: `${l}-silent`,
303
+ checked: N,
304
+ onCheckedChange: (a) => Ne(a === !0),
305
+ disabled: c
306
+ }
307
+ ),
308
+ /* @__PURE__ */ e(f, { htmlFor: `${l}-silent`, className: "text-sm font-normal cursor-pointer", children: r("form.silent_if_empty") })
309
+ ] }),
310
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground rounded-lg bg-muted/40 px-3 py-2", children: Ce }),
311
+ /* @__PURE__ */ n(Ve, { children: [
312
+ /* @__PURE__ */ e(v, { type: "button", variant: "outline", onClick: t, disabled: c, children: r("form.cancel") }),
313
+ /* @__PURE__ */ e(v, { type: "submit", disabled: c, children: r(c ? "form.saving" : "form.save") })
314
+ ] })
315
+ ] });
316
+ }
317
+ function Ke({ open: i, onOpenChange: t, schedule: l }) {
318
+ const { t: r } = G("schedules"), { dir: y } = Y();
319
+ return /* @__PURE__ */ e(fe, { open: i, onOpenChange: t, children: /* @__PURE__ */ n(ge, { dir: y, className: "sm:max-w-[520px] max-h-[90dvh] overflow-y-auto", children: [
320
+ /* @__PURE__ */ e(ye, { children: /* @__PURE__ */ e(ve, { children: r(l ? "edit_schedule" : "new_schedule") }) }),
321
+ /* @__PURE__ */ e(
322
+ Je,
323
+ {
324
+ schedule: l,
325
+ onClose: () => t(!1)
326
+ },
327
+ `${i ? "open" : "closed"}-${l?.id ?? "new"}`
328
+ )
329
+ ] }) });
330
+ }
331
+ function Qe({ open: i, onOpenChange: t, schedule: l }) {
332
+ const { t: r, i18n: y } = G("schedules"), { dir: C } = Y(), _ = pe(), z = be(), { data: p, isLoading: w } = je(l?.id ?? "", {
333
+ enabled: i && !!l?.id
334
+ }), O = X(y.language, {
335
+ dateStyle: "medium",
336
+ timeStyle: "short"
337
+ }), q = (o) => {
338
+ _?.selectThread(o), t(!1), z?.close();
339
+ };
340
+ return /* @__PURE__ */ e(fe, { open: i, onOpenChange: t, children: /* @__PURE__ */ n(ge, { dir: C, className: "sm:max-w-[560px]", children: [
341
+ /* @__PURE__ */ e(ye, { children: /* @__PURE__ */ e(ve, { children: r("runs_dialog.title", { name: l?.name ?? "" }) }) }),
342
+ /* @__PURE__ */ e("div", { className: "max-h-[60vh] overflow-y-auto space-y-2.5 pe-1", children: w ? /* @__PURE__ */ n("div", { className: "space-y-2", children: [
343
+ /* @__PURE__ */ e(U, { className: "h-16 w-full rounded-xl" }),
344
+ /* @__PURE__ */ e(U, { className: "h-16 w-full rounded-xl" })
345
+ ] }) : p?.runs.length ? p.runs.map((o) => /* @__PURE__ */ n(
346
+ "div",
347
+ {
348
+ className: "rounded-xl border border-border/50 bg-muted/20 p-3 space-y-1.5",
349
+ children: [
350
+ /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
351
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
352
+ /* @__PURE__ */ e(
353
+ Q,
354
+ {
355
+ variant: o.status === "failed" || o.status === "timeout" ? "destructive" : o.status === "completed" ? "secondary" : "outline",
356
+ children: r(`runs_dialog.status_${o.status}`)
357
+ }
358
+ ),
359
+ /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: r(`runs_dialog.trigger_${o.trigger}`) })
360
+ ] }),
361
+ /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground tabular-nums", children: O.format(new Date(o.started_at)) })
362
+ ] }),
363
+ o.summary && /* @__PURE__ */ e("p", { className: "text-xs text-foreground line-clamp-2", children: o.summary }),
364
+ o.error && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: o.error }),
365
+ o.thread_id && _ && /* @__PURE__ */ e("div", { className: "pt-1", children: /* @__PURE__ */ n(
366
+ v,
367
+ {
368
+ type: "button",
369
+ size: "sm",
370
+ variant: "ghost",
371
+ className: "h-7 px-2 text-xs gap-1.5",
372
+ onClick: () => q(o.thread_id),
373
+ children: [
374
+ /* @__PURE__ */ e(de, { className: "size-3.5" }),
375
+ r("open_thread")
376
+ ]
377
+ }
378
+ ) })
379
+ ]
380
+ },
381
+ o.id
382
+ )) : /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground py-6 text-center", children: r("runs_dialog.empty") }) })
383
+ ] }) });
384
+ }
385
+ function ct({ sectionMode: i = "editable" } = {}) {
386
+ const { t, i18n: l } = G(["schedules", "errors"]), { data: r, isLoading: y } = Re(), { pause: C, resume: _, runNow: z, remove: p } = he(), w = pe(), O = be(), [q, o] = m(!1), [u, E] = m(null), [A, j] = m(null), x = i === "faded", $ = r?.schedules ?? [], b = r?.max_schedules, H = typeof b == "number" && b > 0 && $.length >= b, T = X(l.language, {
387
+ dateStyle: "medium",
388
+ timeStyle: "short"
389
+ }), Z = () => {
390
+ E(null), o(!0);
391
+ }, R = (s) => {
392
+ E(s), o(!0);
393
+ }, J = async (s) => {
394
+ if (window.confirm(t("delete_confirm")))
395
+ try {
396
+ await p.mutateAsync(s.id), g.success(t("deleted"));
397
+ } catch (k) {
398
+ g.error(W(k, t));
399
+ }
400
+ }, V = (s) => {
401
+ w?.selectThread(s), O?.close();
402
+ };
403
+ return /* @__PURE__ */ n("div", { className: xe("space-y-5", x && "opacity-50 pointer-events-none"), children: [
404
+ /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-3 flex-wrap", children: [
405
+ typeof b == "number" && b > 0 && /* @__PURE__ */ e(Q, { variant: "outline", className: "tabular-nums", children: t("limit_badge", { count: $.length, max: b }) }),
406
+ /* @__PURE__ */ n(
407
+ v,
408
+ {
409
+ type: "button",
410
+ size: "sm",
411
+ onClick: Z,
412
+ disabled: x || H,
413
+ className: "ms-auto rounded-full gap-1.5",
414
+ children: [
415
+ /* @__PURE__ */ e(Te, { className: "size-4" }),
416
+ t("new_schedule")
417
+ ]
418
+ }
419
+ )
420
+ ] }),
421
+ y ? /* @__PURE__ */ n("div", { className: "space-y-3", children: [
422
+ /* @__PURE__ */ e(U, { className: "h-24 w-full rounded-2xl" }),
423
+ /* @__PURE__ */ e(U, { className: "h-24 w-full rounded-2xl" })
424
+ ] }) : $.length ? /* @__PURE__ */ e(B.Root, { className: "space-y-3", children: $.map((s) => {
425
+ const k = s.last_run_thread_id || s.thread_id;
426
+ return /* @__PURE__ */ n(
427
+ B.Item,
428
+ {
429
+ schedule: s,
430
+ className: "rounded-2xl border border-border/50 bg-muted/20 p-4 space-y-3",
431
+ children: [
432
+ /* @__PURE__ */ e("div", { className: "flex items-start justify-between gap-3", children: /* @__PURE__ */ n("div", { className: "min-w-0 space-y-1", children: [
433
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2 flex-wrap", children: [
434
+ /* @__PURE__ */ e("span", { className: "font-medium text-sm text-foreground", children: s.name }),
435
+ /* @__PURE__ */ e(Q, { variant: s.enabled ? "secondary" : "outline", children: s.enabled ? t("status_active") : s.pause_reason ? t(`pause_reason_${s.pause_reason}`) : t("status_paused") })
436
+ ] }),
437
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground line-clamp-2", children: s.prompt })
438
+ ] }) }),
439
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground", children: [
440
+ /* @__PURE__ */ e("span", { children: me(s, t, l.language) }),
441
+ s.next_run_at && s.enabled && /* @__PURE__ */ e("span", { children: t("next_run", { datetime: T.format(new Date(s.next_run_at)) }) }),
442
+ s.last_run_at && /* @__PURE__ */ e("span", { children: t("last_run", { datetime: T.format(new Date(s.last_run_at)) }) })
443
+ ] }),
444
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5 pt-1 border-t border-border/30", children: [
445
+ /* @__PURE__ */ e(B.RunNow, { asChild: !0, children: /* @__PURE__ */ n(
446
+ v,
447
+ {
448
+ type: "button",
449
+ size: "sm",
450
+ variant: "outline",
451
+ className: "h-8 gap-1.5 text-xs",
452
+ disabled: x,
453
+ onClick: (I) => {
454
+ I.preventDefault(), z.mutate(s.id, {
455
+ onSuccess: () => g.success(t("triggered")),
456
+ onError: (N) => g.error(W(N, t))
457
+ });
458
+ },
459
+ children: [
460
+ /* @__PURE__ */ e(Fe, { className: "size-3.5" }),
461
+ t("run_now")
462
+ ]
463
+ }
464
+ ) }),
465
+ /* @__PURE__ */ e(B.Toggle, { asChild: !0, children: /* @__PURE__ */ e(
466
+ v,
467
+ {
468
+ type: "button",
469
+ size: "sm",
470
+ variant: "outline",
471
+ className: "h-8 gap-1.5 text-xs",
472
+ disabled: x,
473
+ onClick: (I) => {
474
+ I.preventDefault(), s.enabled ? C.mutate(s.id, {
475
+ onSuccess: () => g.success(t("paused_toast")),
476
+ onError: (N) => g.error(W(N, t))
477
+ }) : _.mutate(s.id, {
478
+ onSuccess: () => g.success(t("resumed_toast")),
479
+ onError: (N) => g.error(W(N, t))
480
+ });
481
+ },
482
+ children: s.enabled ? /* @__PURE__ */ n(ne, { children: [
483
+ /* @__PURE__ */ e(Oe, { className: "size-3.5" }),
484
+ t("pause")
485
+ ] }) : /* @__PURE__ */ n(ne, { children: [
486
+ /* @__PURE__ */ e(Ae, { className: "size-3.5" }),
487
+ t("resume")
488
+ ] })
489
+ }
490
+ ) }),
491
+ /* @__PURE__ */ n(
492
+ v,
493
+ {
494
+ type: "button",
495
+ size: "sm",
496
+ variant: "ghost",
497
+ className: "h-8 gap-1.5 text-xs",
498
+ disabled: x,
499
+ onClick: () => R(s),
500
+ children: [
501
+ /* @__PURE__ */ e(Ie, { className: "size-3.5" }),
502
+ t("edit")
503
+ ]
504
+ }
505
+ ),
506
+ /* @__PURE__ */ n(
507
+ v,
508
+ {
509
+ type: "button",
510
+ size: "sm",
511
+ variant: "ghost",
512
+ className: "h-8 gap-1.5 text-xs",
513
+ onClick: () => j(s),
514
+ children: [
515
+ /* @__PURE__ */ e(Me, { className: "size-3.5" }),
516
+ t("runs")
517
+ ]
518
+ }
519
+ ),
520
+ k && w && /* @__PURE__ */ n(
521
+ v,
522
+ {
523
+ type: "button",
524
+ size: "sm",
525
+ variant: "ghost",
526
+ className: "h-8 gap-1.5 text-xs",
527
+ onClick: () => V(k),
528
+ children: [
529
+ /* @__PURE__ */ e(de, { className: "size-3.5" }),
530
+ t("open_thread")
531
+ ]
532
+ }
533
+ ),
534
+ /* @__PURE__ */ e(
535
+ v,
536
+ {
537
+ type: "button",
538
+ size: "sm",
539
+ variant: "ghost",
540
+ className: "h-8 gap-1.5 text-xs text-destructive hover:text-destructive ms-auto",
541
+ disabled: x || p.isPending,
542
+ onClick: () => {
543
+ J(s);
544
+ },
545
+ "aria-label": t("delete"),
546
+ children: /* @__PURE__ */ e(Le, { className: "size-3.5" })
547
+ }
548
+ )
549
+ ] })
550
+ ]
551
+ },
552
+ s.id
553
+ );
554
+ }) }) : /* @__PURE__ */ n("div", { className: "rounded-2xl border border-dashed border-border/60 p-8 text-center space-y-2", children: [
555
+ /* @__PURE__ */ e(De, { className: "size-8 mx-auto text-muted-foreground/60", "aria-hidden": !0 }),
556
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: t("empty") }),
557
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t("empty_help") })
558
+ ] }),
559
+ /* @__PURE__ */ e(Ke, { open: q, onOpenChange: o, schedule: u }),
560
+ /* @__PURE__ */ e(
561
+ Qe,
562
+ {
563
+ open: !!A,
564
+ onOpenChange: (s) => {
565
+ s || j(null);
566
+ },
567
+ schedule: A
568
+ }
569
+ )
570
+ ] });
571
+ }
572
+ export {
573
+ ct as SchedulesSettings
574
+ };
@@ -3,8 +3,8 @@ import { jsxs as z, jsx as e, Fragment as k } from "react/jsx-runtime";
3
3
  import { useState as L, useRef as P, useEffect as U } from "react";
4
4
  import { XIcon as X, Loader2Icon as V, SquareIcon as J } from "lucide-react";
5
5
  import { useGentiqTranslation as q, useComposerVoice as y, Composer as S, useComposer as K } from "@gentiq/react";
6
- import { P as H, a as O } from "./shared-B11Re3ZY.js";
7
- import { c as Q } from "./shared-Cqv1mrcZ.js";
6
+ import { P as H, a as O } from "./shared-HOMT87-R.js";
7
+ import { c as Q } from "./shared-C6NokIol.js";
8
8
  function ce() {
9
9
  const { t: n } = q("chat"), i = y(), c = i.status === "transcribing";
10
10
  return /* @__PURE__ */ z("div", { className: "flex min-h-[40px] min-w-0 flex-1 items-center gap-2 md:min-h-[44px]", children: [
package/dist/index.d.ts CHANGED
@@ -114,7 +114,7 @@ export declare interface AppSidebarProps {
114
114
  */
115
115
  export declare function AssistantMessage(): JSX.Element;
116
116
 
117
- export declare type BuiltinSettingsSection = 'profile' | 'general' | 'account' | 'feedback';
117
+ export declare type BuiltinSettingsSection = 'profile' | 'general' | 'account' | 'feedback' | 'schedules' | 'connectors';
118
118
 
119
119
  declare function Button({ className, variant, size, asChild, ...props }: React_2.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
120
120
  asChild?: boolean;
@@ -765,6 +765,10 @@ export declare interface GentiqComponents {
765
765
  * `fullscreen`. `null` falls back to the banner.
766
766
  */
767
767
  MaintenanceScreen?: ComponentType<MaintenanceNoticeProps> | null;
768
+ /** Replaces the built-in Scheduled Tasks settings section. */
769
+ SchedulesPanel?: ComponentType;
770
+ /** Replaces the built-in Connectors settings section. */
771
+ ConnectorsPanel?: ComponentType;
768
772
  /**
769
773
  * Per-tool/card reference display adapters.
770
774
  * Return label/excerpt/data overrides used in composer chips, sent context,
@@ -858,6 +862,7 @@ export declare function GentiqUI({ components, children, history, welcome, threa
858
862
  */
859
863
  export declare interface GentiqUIOptions {
860
864
  history: Required<HistoryConfig>;
865
+ sidebar: Required<SidebarConfig>;
861
866
  welcome: WelcomeScreenConfig;
862
867
  threadActions: Required<ThreadItemActionsConfig>;
863
868
  /**
@@ -880,6 +885,8 @@ export declare interface GentiqUIOptions {
880
885
  export declare interface GentiqUIOptionsInput {
881
886
  /** The sidebar's thread history. */
882
887
  history?: HistoryConfig;
888
+ /** Plugin shortcuts shown in the chat sidebar. */
889
+ sidebar?: SidebarConfig;
883
890
  /** The welcome screen. */
884
891
  welcome?: WelcomeScreenConfig;
885
892
  /** The actions under each answer. */
@@ -1242,6 +1249,10 @@ export declare interface SettingsConfig {
1242
1249
  account?: SettingsSectionConfig<AccountSettingsFields>;
1243
1250
  /** Feedback settings section (Bug reports, Feature requests, etc.) */
1244
1251
  feedback?: SettingsSectionConfig<FeedbackSettingsFields>;
1252
+ /** Scheduled tasks settings section. */
1253
+ schedules?: SettingsSectionConfig;
1254
+ /** External connectors settings section. */
1255
+ connectors?: SettingsSectionConfig;
1245
1256
  };
1246
1257
  /** Which shortcuts and quick actions appear in the floating settings popover menu. */
1247
1258
  menu?: SettingsMenuConfig;
@@ -1335,6 +1346,16 @@ export declare interface SharedChatViewProps {
1335
1346
 
1336
1347
  export declare function Sidebar({ side, variant, collapsible, className, children, ...props }: SidebarProps): JSX.Element;
1337
1348
 
1349
+ /**
1350
+ * Configuration for plugin shortcuts shown in the chat sidebar.
1351
+ */
1352
+ export declare interface SidebarConfig {
1353
+ /** Whether to show the Scheduled Tasks shortcut in the sidebar when the plugin is active. */
1354
+ showSchedules?: boolean;
1355
+ /** Whether to show the Connectors shortcut in the sidebar when the plugin is active. */
1356
+ showConnectors?: boolean;
1357
+ }
1358
+
1338
1359
  export declare function SidebarContent({ className, ...props }: SidebarContentProps): JSX.Element;
1339
1360
 
1340
1361
  export declare type SidebarContentProps = React_2.ComponentProps<'div'>;