@burdenoff/microfe-timecampus 2026.1108.1 → 2026.1109.2

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.
Files changed (30) hide show
  1. package/dist/index.js +5 -4
  2. package/dist/timecampus/AdminRoot.d.ts.map +1 -1
  3. package/dist/timecampus/AdminRoot.js +1 -1
  4. package/dist/timecampus/AdminRoot.js.map +1 -1
  5. package/dist/timecampus/AdminRoutes.d.ts.map +1 -1
  6. package/dist/timecampus/AdminRoutes.js +24 -4
  7. package/dist/timecampus/AdminRoutes.js.map +1 -1
  8. package/dist/timecampus/adminPaths.d.ts +7 -0
  9. package/dist/timecampus/adminPaths.d.ts.map +1 -0
  10. package/dist/timecampus/adminPaths.js +6 -0
  11. package/dist/timecampus/adminPaths.js.map +1 -0
  12. package/dist/timecampus/index.d.ts +1 -0
  13. package/dist/timecampus/index.d.ts.map +1 -1
  14. package/dist/timecampus/index.js +5 -4
  15. package/dist/timecampus/pages/admin/AdminPage.d.ts.map +1 -1
  16. package/dist/timecampus/pages/admin/AdminPage.js +263 -251
  17. package/dist/timecampus/pages/admin/AdminPage.js.map +1 -1
  18. package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js +4 -4
  19. package/dist/timecampus/pages/extend/MarketplaceCertificationPage.d.ts.map +1 -1
  20. package/dist/timecampus/pages/extend/MarketplaceCertificationPage.js +5 -1
  21. package/dist/timecampus/pages/extend/MarketplaceCertificationPage.js.map +1 -1
  22. package/dist/timecampus/pages/extend/TimeTriggersPage.d.ts.map +1 -1
  23. package/dist/timecampus/pages/extend/TimeTriggersPage.js +207 -194
  24. package/dist/timecampus/pages/extend/TimeTriggersPage.js.map +1 -1
  25. package/dist/timecampus/pages/extend/triggerHelpers.d.ts +19 -0
  26. package/dist/timecampus/pages/extend/triggerHelpers.d.ts.map +1 -1
  27. package/dist/timecampus/pages/extend/triggerHelpers.js +6 -2
  28. package/dist/timecampus/pages/extend/triggerHelpers.js.map +1 -1
  29. package/dist/timecampus/pages/time-approval/TimeApprovalPage.js +4 -4
  30. package/package.json +1 -1
@@ -6,24 +6,24 @@ import { ListMyTimeTriggersDocument as i, useCreateTimeTriggerMutation as a, use
6
6
  import { PageLayout as ne } from "../../components/PageLayout.js";
7
7
  import { StatusBadge as c } from "../../components/StatusBadge.js";
8
8
  import { Modal as l } from "../../components/Modal.js";
9
- import { ToastContainer as u, useToast as d } from "../../components/Toast.js";
10
- import { ToggleSwitch as f } from "../../components/ToggleSwitch.js";
11
- import { TimeCampusTriggerComparator as p, TimeCampusTriggerMetric as m } from "../../../generated/wspace-types.js";
12
- import { useOpenRoute as re } from "./useOpenRoute.js";
13
- import { TRIGGER_METRIC_KEYS as h, TRIGGER_PRESETS as ie, browserTimezone as g, describeRule as _, formatHour as v, formatMetric as y, isTriggerComparatorKey as b, isTriggerMetricKey as x, metricMeta as S, validateTriggerForm as ae } from "./triggerHelpers.js";
14
- import { useMemo as C, useState as w } from "react";
15
- import { BellRing as T, Pencil as E, Play as D, Plus as O, Store as oe, Trash2 as k, Workflow as se } from "lucide-react";
16
- import { jsx as A, jsxs as j } from "react/jsx-runtime";
17
- import { GlassCard as M } from "@burdenoff/fe-libs/ui";
9
+ import { ToastContainer as re, useToast as ie } from "../../components/Toast.js";
10
+ import { ToggleSwitch as u } from "../../components/ToggleSwitch.js";
11
+ import { TimeCampusTriggerComparator as d, TimeCampusTriggerMetric as f } from "../../../generated/wspace-types.js";
12
+ import { useOpenRoute as ae } from "./useOpenRoute.js";
13
+ import { TRIGGER_METRIC_KEYS as p, TRIGGER_PRESETS as oe, browserTimezone as m, describeRule as h, formatHour as g, formatMetric as _, isTriggerComparatorKey as v, isTriggerMetricKey as y, metricMeta as b, validateTriggerForm as se, workflowLinkForTrigger as ce } from "./triggerHelpers.js";
14
+ import { useMemo as x, useState as S } from "react";
15
+ import { BellRing as C, Pencil as w, Play as T, Plus as E, Store as le, Trash2 as D, Workflow as O } from "lucide-react";
16
+ import { jsx as k, jsxs as A } from "react/jsx-runtime";
17
+ import { GlassCard as j } from "@burdenoff/fe-libs/ui";
18
18
  //#region src/timecampus/pages/extend/TimeTriggersPage.tsx
19
- var N = [{ query: i }], P = "inline-flex items-center justify-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50", F = "inline-flex items-center justify-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-surface-hover disabled:opacity-50", I = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm text-text-primary", L = Array.from({ length: 24 }, (e, t) => t), ce = {
20
- TRACKED_HOURS: m.TrackedHours,
21
- FOCUS_PERCENT: m.FocusPercent,
22
- CONTEXT_SWITCHES: m.ContextSwitches,
23
- LONGEST_FOCUS_MINUTES: m.LongestFocusMinutes
24
- }, le = {
25
- BELOW: p.Below,
26
- ABOVE: p.Above
19
+ var M = [{ query: i }], N = "inline-flex items-center justify-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50", P = "inline-flex items-center justify-center gap-1.5 rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-surface-hover disabled:opacity-50", F = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-1.5 text-sm text-text-primary", I = Array.from({ length: 24 }, (e, t) => t), ue = {
20
+ TRACKED_HOURS: f.TrackedHours,
21
+ FOCUS_PERCENT: f.FocusPercent,
22
+ CONTEXT_SWITCHES: f.ContextSwitches,
23
+ LONGEST_FOCUS_MINUTES: f.LongestFocusMinutes
24
+ }, L = {
25
+ BELOW: d.Below,
26
+ ABOVE: d.Above
27
27
  }, R = {
28
28
  name: "",
29
29
  metric: "TRACKED_HOURS",
@@ -37,7 +37,7 @@ function z(e) {
37
37
  }
38
38
  function B(e) {
39
39
  let { metric: t, comparator: n } = e;
40
- return !x(t) || !b(n) ? null : {
40
+ return !y(t) || !v(n) ? null : {
41
41
  name: e.name,
42
42
  metric: t,
43
43
  comparator: n,
@@ -47,17 +47,17 @@ function B(e) {
47
47
  };
48
48
  }
49
49
  function V({ form: e, onChange: t }) {
50
- let n = S(e.metric);
51
- return /* @__PURE__ */ j("div", {
50
+ let n = b(e.metric);
51
+ return /* @__PURE__ */ A("div", {
52
52
  className: "flex flex-col gap-4",
53
53
  children: [
54
- /* @__PURE__ */ j("label", {
54
+ /* @__PURE__ */ A("label", {
55
55
  className: "flex flex-col gap-1 text-sm",
56
- children: [/* @__PURE__ */ A("span", {
56
+ children: [/* @__PURE__ */ k("span", {
57
57
  className: "font-medium text-text-primary",
58
58
  children: "Name"
59
- }), /* @__PURE__ */ A("input", {
60
- className: I,
59
+ }), /* @__PURE__ */ k("input", {
60
+ className: F,
61
61
  value: e.name,
62
62
  maxLength: 80,
63
63
  onChange: (n) => t({
@@ -68,57 +68,57 @@ function V({ form: e, onChange: t }) {
68
68
  "aria-label": "Trigger name"
69
69
  })]
70
70
  }),
71
- /* @__PURE__ */ j("div", {
71
+ /* @__PURE__ */ A("div", {
72
72
  className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
73
73
  children: [
74
- /* @__PURE__ */ j("label", {
74
+ /* @__PURE__ */ A("label", {
75
75
  className: "flex flex-col gap-1 text-sm sm:col-span-1",
76
- children: [/* @__PURE__ */ A("span", {
76
+ children: [/* @__PURE__ */ k("span", {
77
77
  className: "font-medium text-text-primary",
78
78
  children: "When"
79
- }), /* @__PURE__ */ A("select", {
80
- className: I,
79
+ }), /* @__PURE__ */ k("select", {
80
+ className: F,
81
81
  value: e.metric,
82
82
  "aria-label": "Metric",
83
83
  onChange: (n) => t({
84
84
  ...e,
85
85
  metric: n.target.value
86
86
  }),
87
- children: h.map((e) => /* @__PURE__ */ A("option", {
87
+ children: p.map((e) => /* @__PURE__ */ k("option", {
88
88
  value: e,
89
- children: S(e).label
89
+ children: b(e).label
90
90
  }, e))
91
91
  })]
92
92
  }),
93
- /* @__PURE__ */ j("label", {
93
+ /* @__PURE__ */ A("label", {
94
94
  className: "flex flex-col gap-1 text-sm",
95
- children: [/* @__PURE__ */ A("span", {
95
+ children: [/* @__PURE__ */ k("span", {
96
96
  className: "font-medium text-text-primary",
97
97
  children: "is"
98
- }), /* @__PURE__ */ j("select", {
99
- className: I,
98
+ }), /* @__PURE__ */ A("select", {
99
+ className: F,
100
100
  value: e.comparator,
101
101
  "aria-label": "Comparator",
102
102
  onChange: (n) => t({
103
103
  ...e,
104
104
  comparator: n.target.value
105
105
  }),
106
- children: [/* @__PURE__ */ A("option", {
106
+ children: [/* @__PURE__ */ k("option", {
107
107
  value: "BELOW",
108
108
  children: "below"
109
- }), /* @__PURE__ */ A("option", {
109
+ }), /* @__PURE__ */ k("option", {
110
110
  value: "ABOVE",
111
111
  children: "above"
112
112
  })]
113
113
  })]
114
114
  }),
115
- /* @__PURE__ */ j("label", {
115
+ /* @__PURE__ */ A("label", {
116
116
  className: "flex flex-col gap-1 text-sm",
117
- children: [/* @__PURE__ */ j("span", {
117
+ children: [/* @__PURE__ */ A("span", {
118
118
  className: "font-medium text-text-primary",
119
119
  children: ["Threshold", n.unit ? ` (${n.unit})` : ""]
120
- }), /* @__PURE__ */ A("input", {
121
- className: I,
120
+ }), /* @__PURE__ */ k("input", {
121
+ className: F,
122
122
  type: "number",
123
123
  min: 0,
124
124
  max: n.max,
@@ -133,47 +133,47 @@ function V({ form: e, onChange: t }) {
133
133
  })
134
134
  ]
135
135
  }),
136
- /* @__PURE__ */ A("p", {
136
+ /* @__PURE__ */ k("p", {
137
137
  className: "text-xs text-text-tertiary",
138
138
  children: n.hint
139
139
  }),
140
- /* @__PURE__ */ j("label", {
140
+ /* @__PURE__ */ A("label", {
141
141
  className: "flex flex-col gap-1 text-sm",
142
142
  children: [
143
- /* @__PURE__ */ A("span", {
143
+ /* @__PURE__ */ k("span", {
144
144
  className: "font-medium text-text-primary",
145
145
  children: "Check from"
146
146
  }),
147
- /* @__PURE__ */ A("select", {
148
- className: I,
147
+ /* @__PURE__ */ k("select", {
148
+ className: F,
149
149
  value: e.checkHour,
150
150
  "aria-label": "Check from",
151
151
  onChange: (n) => t({
152
152
  ...e,
153
153
  checkHour: Number(n.target.value)
154
154
  }),
155
- children: L.map((e) => /* @__PURE__ */ A("option", {
155
+ children: I.map((e) => /* @__PURE__ */ k("option", {
156
156
  value: e,
157
- children: e === 0 ? "Any time of day" : `${v(e)} onwards`
157
+ children: e === 0 ? "Any time of day" : `${g(e)} onwards`
158
158
  }, e))
159
159
  }),
160
- /* @__PURE__ */ j("span", {
160
+ /* @__PURE__ */ A("span", {
161
161
  className: "text-xs text-text-tertiary",
162
162
  children: [
163
163
  "Your day runs in ",
164
- g(),
164
+ m(),
165
165
  ". Rules about falling short (for example below 6 h) work best with a late check hour."
166
166
  ]
167
167
  })
168
168
  ]
169
169
  }),
170
- /* @__PURE__ */ j("label", {
170
+ /* @__PURE__ */ A("label", {
171
171
  className: "flex flex-col gap-1 text-sm",
172
- children: [/* @__PURE__ */ A("span", {
172
+ children: [/* @__PURE__ */ k("span", {
173
173
  className: "font-medium text-text-primary",
174
174
  children: "Note in the nudge (optional)"
175
- }), /* @__PURE__ */ A("textarea", {
176
- className: I,
175
+ }), /* @__PURE__ */ k("textarea", {
176
+ className: F,
177
177
  rows: 2,
178
178
  maxLength: 280,
179
179
  value: e.message,
@@ -185,9 +185,9 @@ function V({ form: e, onChange: t }) {
185
185
  placeholder: "Log anything you missed before you wrap up."
186
186
  })]
187
187
  }),
188
- /* @__PURE__ */ j("p", {
188
+ /* @__PURE__ */ A("p", {
189
189
  className: "rounded-md bg-bg-sunken px-3 py-2 text-sm text-text-secondary",
190
- children: [_({
190
+ children: [h({
191
191
  metric: e.metric,
192
192
  comparator: e.comparator,
193
193
  threshold: Number(e.threshold) || 0,
@@ -197,33 +197,33 @@ function V({ form: e, onChange: t }) {
197
197
  ]
198
198
  });
199
199
  }
200
- function H({ trigger: e, busy: n, onToggle: r, onRun: i, onEdit: a, onDelete: o }) {
201
- return /* @__PURE__ */ j(M, {
200
+ function H({ trigger: e, busy: n, onToggle: r, onRun: i, onEdit: a, onDelete: o, onUseInWorkflow: s }) {
201
+ return /* @__PURE__ */ A(j, {
202
202
  treatment: "glass",
203
203
  className: "flex h-full flex-col gap-3 p-5",
204
204
  "data-testid": `time-trigger-${e.id}`,
205
205
  children: [
206
- /* @__PURE__ */ j("div", {
206
+ /* @__PURE__ */ A("div", {
207
207
  className: "flex items-start gap-3",
208
208
  children: [
209
- /* @__PURE__ */ A("div", {
209
+ /* @__PURE__ */ k("div", {
210
210
  className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary",
211
- children: /* @__PURE__ */ A(T, {
211
+ children: /* @__PURE__ */ k(C, {
212
212
  className: "h-5 w-5",
213
213
  "aria-hidden": "true"
214
214
  })
215
215
  }),
216
- /* @__PURE__ */ j("div", {
216
+ /* @__PURE__ */ A("div", {
217
217
  className: "min-w-0 flex-1",
218
- children: [/* @__PURE__ */ A("h3", {
218
+ children: [/* @__PURE__ */ k("h3", {
219
219
  className: "truncate text-base font-semibold text-text-primary",
220
220
  children: e.name
221
- }), /* @__PURE__ */ A("p", {
221
+ }), /* @__PURE__ */ k("p", {
222
222
  className: "text-sm text-text-secondary",
223
- children: _(e)
223
+ children: h(e)
224
224
  })]
225
225
  }),
226
- /* @__PURE__ */ A(f, {
226
+ /* @__PURE__ */ k(u, {
227
227
  checked: e.enabled,
228
228
  disabled: n,
229
229
  onChange: r,
@@ -231,7 +231,7 @@ function H({ trigger: e, busy: n, onToggle: r, onRun: i, onEdit: a, onDelete: o
231
231
  })
232
232
  ]
233
233
  }),
234
- e.message && /* @__PURE__ */ j("p", {
234
+ e.message && /* @__PURE__ */ A("p", {
235
235
  className: "text-sm italic text-text-tertiary",
236
236
  children: [
237
237
  "“",
@@ -239,48 +239,60 @@ function H({ trigger: e, busy: n, onToggle: r, onRun: i, onEdit: a, onDelete: o
239
239
  "”"
240
240
  ]
241
241
  }),
242
- /* @__PURE__ */ j("dl", {
242
+ /* @__PURE__ */ A("dl", {
243
243
  className: "grid grid-cols-2 gap-2 text-xs text-text-tertiary",
244
- children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: "Today so far" }), /* @__PURE__ */ A("dd", {
244
+ children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", { children: "Today so far" }), /* @__PURE__ */ k("dd", {
245
245
  className: "text-sm font-medium text-text-primary",
246
- children: e.lastValue == null ? "Not checked yet" : y(e.metric, e.lastValue)
247
- })] }), /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("dt", { children: "Last fired" }), /* @__PURE__ */ j("dd", {
246
+ children: e.lastValue == null ? "Not checked yet" : _(e.metric, e.lastValue)
247
+ })] }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", { children: "Last fired" }), /* @__PURE__ */ A("dd", {
248
248
  className: "text-sm font-medium text-text-primary",
249
249
  children: [e.lastFiredAt ? t(e.lastFiredAt) : "Never", e.fireCount > 0 ? ` · ${e.fireCount}×` : ""]
250
250
  })] })]
251
251
  }),
252
- /* @__PURE__ */ j("div", {
252
+ /* @__PURE__ */ A("div", {
253
253
  className: "mt-auto flex flex-wrap gap-2",
254
254
  children: [
255
- /* @__PURE__ */ j("button", {
255
+ /* @__PURE__ */ A("button", {
256
256
  type: "button",
257
- className: P,
257
+ className: N,
258
258
  onClick: i,
259
259
  disabled: n,
260
260
  "aria-label": `Check ${e.name} now`,
261
- children: [/* @__PURE__ */ A(D, {
261
+ children: [/* @__PURE__ */ k(T, {
262
262
  className: "h-4 w-4",
263
263
  "aria-hidden": "true"
264
264
  }), "Check now"]
265
265
  }),
266
- /* @__PURE__ */ j("button", {
266
+ /* @__PURE__ */ A("button", {
267
267
  type: "button",
268
- className: F,
268
+ className: P,
269
269
  onClick: a,
270
270
  disabled: n,
271
271
  "aria-label": `Edit ${e.name}`,
272
- children: [/* @__PURE__ */ A(E, {
272
+ children: [/* @__PURE__ */ k(w, {
273
273
  className: "h-4 w-4",
274
274
  "aria-hidden": "true"
275
275
  }), "Edit"]
276
276
  }),
277
- /* @__PURE__ */ j("button", {
277
+ /* @__PURE__ */ A("button", {
278
278
  type: "button",
279
- className: F,
279
+ className: P,
280
+ onClick: s,
281
+ disabled: n,
282
+ "aria-label": `Use ${e.name} in a workflow`,
283
+ "data-testid": `time-trigger-use-in-workflow-${e.id}`,
284
+ children: [/* @__PURE__ */ k(O, {
285
+ className: "h-4 w-4",
286
+ "aria-hidden": "true"
287
+ }), "Use in a workflow"]
288
+ }),
289
+ /* @__PURE__ */ A("button", {
290
+ type: "button",
291
+ className: P,
280
292
  onClick: o,
281
293
  disabled: n,
282
294
  "aria-label": `Delete ${e.name}`,
283
- children: [/* @__PURE__ */ A(k, {
295
+ children: [/* @__PURE__ */ k(D, {
284
296
  className: "h-4 w-4",
285
297
  "aria-hidden": "true"
286
298
  }), "Delete"]
@@ -291,236 +303,237 @@ function H({ trigger: e, busy: n, onToggle: r, onRun: i, onEdit: a, onDelete: o
291
303
  });
292
304
  }
293
305
  function U() {
294
- let { workspaceId: t = "" } = e(), { toasts: i, addToast: f, dismissToast: p } = d(), m = re(), [h, v] = w(null), [b, x] = w(!1), [S, T] = w(R), [E, D] = w(null), [M, I] = w(/* @__PURE__ */ new Set()), [L, U] = w(null), [W, G] = w(!1), { data: K, loading: ue, error: q } = s({ skip: !t }), [de] = a({ refetchQueries: N }), [J] = te({ refetchQueries: N }), [fe] = o({ refetchQueries: N }), [pe] = ee({ refetchQueries: N }), Y = C(() => K?.timeCampusMyTimeTriggers ?? [], [K]), X = K?.timeCampusMyTimeTriggerFirings ?? [], me = C(() => new Map(Y.map((e) => [e.id, e.name])), [Y]), Z = K?.timeCampusApplet.installed ?? !1, Q = (e) => {
295
- v(null), T(e ?? R), D(null), x(!0);
296
- }, he = (e) => {
306
+ let { workspaceId: t = "" } = e(), { toasts: i, addToast: u, dismissToast: d } = ie(), f = ae(), [p, g] = S(null), [v, y] = S(!1), [b, C] = S(R), [w, T] = S(null), [j, F] = S(/* @__PURE__ */ new Set()), [I, U] = S(null), [W, G] = S(!1), { data: K, loading: de, error: q } = s({ skip: !t }), [fe] = a({ refetchQueries: M }), [J] = te({ refetchQueries: M }), [pe] = o({ refetchQueries: M }), [me] = ee({ refetchQueries: M }), Y = x(() => K?.timeCampusMyTimeTriggers ?? [], [K]), X = K?.timeCampusMyTimeTriggerFirings ?? [], he = x(() => new Map(Y.map((e) => [e.id, e.name])), [Y]), Z = K?.timeCampusApplet.installed ?? !1, Q = (e) => {
307
+ g(null), C(e ?? R), T(null), y(!0);
308
+ }, ge = (e) => {
297
309
  let t = B(e);
298
310
  if (!t) {
299
- f({
311
+ u({
300
312
  title: `${e.name} cannot be edited here`,
301
313
  description: "It uses a rule this version of TimeCampus does not support yet. Reload the page to get the latest version.",
302
314
  variant: "error"
303
315
  });
304
316
  return;
305
317
  }
306
- v(e), T(t), D(null), x(!0);
307
- }, ge = async () => {
308
- let e = ae(S);
318
+ g(e), C(t), T(null), y(!0);
319
+ }, _e = async () => {
320
+ let e = se(b);
309
321
  if (e) {
310
- D(e);
322
+ T(e);
311
323
  return;
312
324
  }
313
325
  G(!0);
314
326
  let t = {
315
- name: S.name.trim(),
316
- metric: ce[S.metric],
317
- comparator: le[S.comparator],
318
- threshold: Number(S.threshold),
319
- checkHour: S.checkHour,
320
- timezone: g(),
321
- message: S.message.trim()
327
+ name: b.name.trim(),
328
+ metric: ue[b.metric],
329
+ comparator: L[b.comparator],
330
+ threshold: Number(b.threshold),
331
+ checkHour: b.checkHour,
332
+ timezone: m(),
333
+ message: b.message.trim()
322
334
  };
323
335
  try {
324
- h ? (await J({ variables: {
325
- id: h.id,
336
+ p ? (await J({ variables: {
337
+ id: p.id,
326
338
  input: t
327
- } }), f({
339
+ } }), u({
328
340
  title: `${t.name} saved`,
329
341
  variant: "success"
330
- })) : (await de({ variables: { input: {
342
+ })) : (await fe({ variables: { input: {
331
343
  ...t,
332
344
  message: t.message || null
333
- } } }), f({
345
+ } } }), u({
334
346
  title: `${t.name} created`,
335
347
  variant: "success"
336
- })), x(!1);
348
+ })), y(!1);
337
349
  } catch (e) {
338
- D(z(e));
350
+ T(z(e));
339
351
  } finally {
340
352
  G(!1);
341
353
  }
342
354
  }, $ = async (e, t) => {
343
- if (!M.has(e)) {
344
- I((t) => new Set(t).add(e));
355
+ if (!j.has(e)) {
356
+ F((t) => new Set(t).add(e));
345
357
  try {
346
358
  await t();
347
359
  } catch (e) {
348
- f({
360
+ u({
349
361
  title: z(e),
350
362
  variant: "error"
351
363
  });
352
364
  } finally {
353
- I((t) => {
365
+ F((t) => {
354
366
  let n = new Set(t);
355
367
  return n.delete(e), n;
356
368
  });
357
369
  }
358
370
  }
359
- }, _e = (e, t) => $(e.id, async () => {
371
+ }, ve = (e, t) => $(e.id, async () => {
360
372
  await J({ variables: {
361
373
  id: e.id,
362
374
  input: { enabled: t }
363
- } }), f({
375
+ } }), u({
364
376
  title: `${e.name} ${t ? "enabled" : "paused"}`,
365
377
  variant: "success"
366
378
  });
367
- }), ve = (e) => $(e.id, async () => {
368
- let t = (await pe({ variables: { id: e.id } })).data?.runTimeCampusTimeTrigger;
379
+ }), ye = (e) => $(e.id, async () => {
380
+ let t = (await me({ variables: { id: e.id } })).data?.runTimeCampusTimeTrigger;
369
381
  if (!t) return;
370
- let n = y(e.metric, t.value);
371
- t.fired ? f({
382
+ let n = _(e.metric, t.value);
383
+ t.fired ? u({
372
384
  title: `${e.name} fired`,
373
385
  description: `Today is at ${n}. ${t.notified ? "A nudge is on its way." : "The nudge could not be delivered."}`,
374
386
  variant: "success"
375
- }) : t.alreadyFiredToday ? f({
387
+ }) : t.alreadyFiredToday ? u({
376
388
  title: `${e.name} already fired today`,
377
389
  description: `Today is at ${n}. It fires at most once a day.`,
378
390
  variant: "info"
379
- }) : t.insufficientData ? f({
391
+ }) : t.insufficientData ? u({
380
392
  title: "Not enough tracked yet",
381
393
  description: "Focus share is checked once 30 minutes are tracked today.",
382
394
  variant: "info"
383
- }) : f({
395
+ }) : u({
384
396
  title: `${e.name} did not fire`,
385
397
  description: `Today is at ${n}, so the condition does not hold.`,
386
398
  variant: "info"
387
399
  });
388
- }), ye = (e) => (U(null), $(e.id, async () => {
389
- await fe({ variables: { id: e.id } }), f({
400
+ }), be = (e) => (U(null), $(e.id, async () => {
401
+ await pe({ variables: { id: e.id } }), u({
390
402
  title: `${e.name} deleted`,
391
403
  variant: "success"
392
404
  });
393
405
  }));
394
- return /* @__PURE__ */ j(ne, {
406
+ return /* @__PURE__ */ A(ne, {
395
407
  title: "Time Triggers",
396
408
  description: "Nudges from your own time data",
397
409
  purpose: "Write a rule over today's tracked time, focus or context switches. TimeCampus checks it through the day and nudges you once when it holds. Each firing is also published to FluidGrids, so a workflow can take it further.",
398
- actions: Z ? /* @__PURE__ */ j("button", {
410
+ actions: Z ? /* @__PURE__ */ A("button", {
399
411
  type: "button",
400
- className: P,
412
+ className: N,
401
413
  onClick: () => Q(),
402
- children: [/* @__PURE__ */ A(O, {
414
+ children: [/* @__PURE__ */ k(E, {
403
415
  className: "h-4 w-4",
404
416
  "aria-hidden": "true"
405
417
  }), "New trigger"]
406
418
  }) : void 0,
407
419
  children: [
408
- /* @__PURE__ */ A(u, {
420
+ /* @__PURE__ */ k(re, {
409
421
  toasts: i,
410
- onDismiss: p
422
+ onDismiss: d
411
423
  }),
412
- ue && !K ? /* @__PURE__ */ A(n, {
424
+ de && !K ? /* @__PURE__ */ k(n, {
413
425
  variant: "card",
414
426
  count: 3
415
- }) : q ? /* @__PURE__ */ A(r, {
427
+ }) : q ? /* @__PURE__ */ k(r, {
416
428
  title: "Couldn't load your time triggers",
417
429
  description: q.message,
418
430
  illustration: "error-state"
419
- }) : Z ? Y.length === 0 ? /* @__PURE__ */ j("div", {
431
+ }) : Z ? Y.length === 0 ? /* @__PURE__ */ A("div", {
420
432
  className: "flex flex-col gap-4",
421
- children: [/* @__PURE__ */ A(r, {
433
+ children: [/* @__PURE__ */ k(r, {
422
434
  title: "No time triggers yet",
423
435
  description: "Start from one of these, or write your own.",
424
- action: /* @__PURE__ */ j("button", {
436
+ action: /* @__PURE__ */ A("button", {
425
437
  type: "button",
426
- className: P,
438
+ className: N,
427
439
  onClick: () => Q(),
428
- children: [/* @__PURE__ */ A(O, {
440
+ children: [/* @__PURE__ */ k(E, {
429
441
  className: "h-4 w-4",
430
442
  "aria-hidden": "true"
431
443
  }), "New trigger"]
432
444
  })
433
- }), /* @__PURE__ */ A("div", {
445
+ }), /* @__PURE__ */ k("div", {
434
446
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4",
435
- children: ie.map((e) => /* @__PURE__ */ j("button", {
447
+ children: oe.map((e) => /* @__PURE__ */ A("button", {
436
448
  type: "button",
437
449
  onClick: () => Q(e),
438
450
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 text-left hover:bg-bg-surface-hover",
439
- children: [/* @__PURE__ */ A("p", {
451
+ children: [/* @__PURE__ */ k("p", {
440
452
  className: "font-medium text-text-primary",
441
453
  children: e.name
442
- }), /* @__PURE__ */ A("p", {
454
+ }), /* @__PURE__ */ k("p", {
443
455
  className: "mt-1 text-sm text-text-secondary",
444
- children: _({
456
+ children: h({
445
457
  ...e,
446
458
  threshold: Number(e.threshold)
447
459
  })
448
460
  })]
449
461
  }, e.name))
450
462
  })]
451
- }) : /* @__PURE__ */ A("div", {
463
+ }) : /* @__PURE__ */ k("div", {
452
464
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3",
453
- children: Y.map((e) => /* @__PURE__ */ A(H, {
465
+ children: Y.map((e) => /* @__PURE__ */ k(H, {
454
466
  trigger: e,
455
- busy: M.has(e.id),
456
- onToggle: (t) => _e(e, t),
457
- onRun: () => ve(e),
458
- onEdit: () => he(e),
459
- onDelete: () => U(e)
467
+ busy: j.has(e.id),
468
+ onToggle: (t) => ve(e, t),
469
+ onRun: () => ye(e),
470
+ onEdit: () => ge(e),
471
+ onDelete: () => U(e),
472
+ onUseInWorkflow: () => f(ce(e))
460
473
  }, e.id))
461
- }) : /* @__PURE__ */ A(r, {
474
+ }) : /* @__PURE__ */ k(r, {
462
475
  title: "Install the Time Triggers applet",
463
476
  description: "Time triggers are an applet. A workspace admin can install it from the applet store; your triggers start running as soon as it is installed.",
464
- action: /* @__PURE__ */ j("button", {
477
+ action: /* @__PURE__ */ A("button", {
465
478
  type: "button",
466
- className: P,
467
- onClick: () => m("/timecampus/applets"),
468
- children: [/* @__PURE__ */ A(oe, {
479
+ className: N,
480
+ onClick: () => f("/timecampus/applets"),
481
+ children: [/* @__PURE__ */ k(le, {
469
482
  className: "h-4 w-4",
470
483
  "aria-hidden": "true"
471
484
  }), "Open the applet store"]
472
485
  })
473
486
  }),
474
- Z && /* @__PURE__ */ j("section", {
487
+ Z && /* @__PURE__ */ A("section", {
475
488
  className: "mt-8",
476
489
  "aria-labelledby": "trigger-history-heading",
477
- children: [/* @__PURE__ */ j("div", {
490
+ children: [/* @__PURE__ */ A("div", {
478
491
  className: "mb-3 flex flex-wrap items-center justify-between gap-2",
479
- children: [/* @__PURE__ */ A("h2", {
492
+ children: [/* @__PURE__ */ k("h2", {
480
493
  id: "trigger-history-heading",
481
494
  className: "text-base font-semibold text-text-primary",
482
495
  children: "Recent firings"
483
- }), /* @__PURE__ */ j("button", {
496
+ }), /* @__PURE__ */ A("button", {
484
497
  type: "button",
485
- className: F,
486
- onClick: () => m("/workflows/list"),
487
- children: [/* @__PURE__ */ A(se, {
498
+ className: P,
499
+ onClick: () => f("/workflows/list"),
500
+ children: [/* @__PURE__ */ k(O, {
488
501
  className: "h-4 w-4",
489
502
  "aria-hidden": "true"
490
503
  }), "Automate with FluidGrids"]
491
504
  })]
492
- }), X.length === 0 ? /* @__PURE__ */ A("p", {
505
+ }), X.length === 0 ? /* @__PURE__ */ k("p", {
493
506
  className: "text-sm text-text-tertiary",
494
507
  children: "Nothing has fired yet."
495
- }) : /* @__PURE__ */ A("ul", {
508
+ }) : /* @__PURE__ */ k("ul", {
496
509
  className: "divide-y divide-border-subtle rounded-lg border border-border-subtle bg-bg-surface",
497
- children: X.map((e) => /* @__PURE__ */ j("li", {
510
+ children: X.map((e) => /* @__PURE__ */ A("li", {
498
511
  className: "flex flex-wrap items-center justify-between gap-2 px-4 py-3 text-sm",
499
512
  children: [
500
- /* @__PURE__ */ A("span", {
513
+ /* @__PURE__ */ k("span", {
501
514
  className: "font-medium text-text-primary",
502
- children: me.get(e.triggerId) ?? "Deleted trigger"
515
+ children: he.get(e.triggerId) ?? "Deleted trigger"
503
516
  }),
504
- /* @__PURE__ */ j("span", {
517
+ /* @__PURE__ */ A("span", {
505
518
  className: "text-text-secondary",
506
519
  children: [
507
- y(e.metric, e.value),
520
+ _(e.metric, e.value),
508
521
  " (",
509
522
  e.comparator === "BELOW" ? "below" : "above",
510
523
  " ",
511
- y(e.metric, e.threshold),
524
+ _(e.metric, e.threshold),
512
525
  ")"
513
526
  ]
514
527
  }),
515
- /* @__PURE__ */ j("span", {
528
+ /* @__PURE__ */ A("span", {
516
529
  className: "flex items-center gap-2 text-text-tertiary",
517
530
  children: [
518
531
  e.day,
519
- /* @__PURE__ */ A(c, {
532
+ /* @__PURE__ */ k(c, {
520
533
  label: e.source === "MANUAL" ? "Manual" : "Scheduled",
521
534
  variant: "info"
522
535
  }),
523
- !e.notified && /* @__PURE__ */ A(c, {
536
+ !e.notified && /* @__PURE__ */ k(c, {
524
537
  label: "Not delivered",
525
538
  variant: "warning"
526
539
  })
@@ -530,68 +543,68 @@ function U() {
530
543
  }, e.id))
531
544
  })]
532
545
  }),
533
- /* @__PURE__ */ j(l, {
534
- open: b,
535
- onClose: () => x(!1),
536
- title: h ? `Edit ${h.name}` : "New time trigger",
546
+ /* @__PURE__ */ A(l, {
547
+ open: v,
548
+ onClose: () => y(!1),
549
+ title: p ? `Edit ${p.name}` : "New time trigger",
537
550
  description: "Fires at most once a day, from the hour you choose.",
538
551
  size: "lg",
539
- footer: /* @__PURE__ */ j("div", {
552
+ footer: /* @__PURE__ */ A("div", {
540
553
  className: "flex justify-end gap-2",
541
- children: [/* @__PURE__ */ A("button", {
554
+ children: [/* @__PURE__ */ k("button", {
542
555
  type: "button",
543
- className: F,
544
- onClick: () => x(!1),
556
+ className: P,
557
+ onClick: () => y(!1),
545
558
  children: "Cancel"
546
- }), /* @__PURE__ */ A("button", {
559
+ }), /* @__PURE__ */ k("button", {
547
560
  type: "button",
548
- className: P,
549
- onClick: () => void ge(),
561
+ className: N,
562
+ onClick: () => void _e(),
550
563
  disabled: W,
551
- children: W ? "Saving…" : h ? "Save" : "Create trigger"
564
+ children: W ? "Saving…" : p ? "Save" : "Create trigger"
552
565
  })]
553
566
  }),
554
- children: [/* @__PURE__ */ A(V, {
555
- form: S,
556
- onChange: T
557
- }), E && /* @__PURE__ */ A("p", {
567
+ children: [/* @__PURE__ */ k(V, {
568
+ form: b,
569
+ onChange: C
570
+ }), w && /* @__PURE__ */ k("p", {
558
571
  role: "alert",
559
572
  className: "mt-3 text-sm text-status-error-text",
560
- children: E
573
+ children: w
561
574
  })]
562
575
  }),
563
- /* @__PURE__ */ A(l, {
564
- open: L !== null,
576
+ /* @__PURE__ */ k(l, {
577
+ open: I !== null,
565
578
  onClose: () => U(null),
566
579
  title: "Delete time trigger",
567
580
  description: "This cannot be undone.",
568
- footer: /* @__PURE__ */ j("div", {
581
+ footer: /* @__PURE__ */ A("div", {
569
582
  className: "flex justify-end gap-2",
570
- children: [/* @__PURE__ */ A("button", {
583
+ children: [/* @__PURE__ */ k("button", {
571
584
  type: "button",
572
- className: F,
585
+ className: P,
573
586
  onClick: () => U(null),
574
587
  children: "Cancel"
575
- }), /* @__PURE__ */ j("button", {
588
+ }), /* @__PURE__ */ A("button", {
576
589
  type: "button",
577
590
  className: "inline-flex items-center justify-center gap-1.5 rounded-md bg-status-error-bg px-3 py-1.5 text-sm font-medium text-status-error-text hover:bg-status-error-bg/80 disabled:opacity-50",
578
591
  onClick: () => {
579
- L && ye(L);
592
+ I && be(I);
580
593
  },
581
- children: [/* @__PURE__ */ A(k, {
594
+ children: [/* @__PURE__ */ k(D, {
582
595
  className: "h-4 w-4",
583
596
  "aria-hidden": "true"
584
597
  }), "Delete"]
585
598
  })]
586
599
  }),
587
- children: /* @__PURE__ */ j("p", {
600
+ children: /* @__PURE__ */ A("p", {
588
601
  className: "text-sm text-text-secondary",
589
602
  children: [
590
603
  "Delete",
591
604
  " ",
592
- /* @__PURE__ */ A("span", {
605
+ /* @__PURE__ */ k("span", {
593
606
  className: "font-medium text-text-primary",
594
- children: L?.name
607
+ children: I?.name
595
608
  }),
596
609
  "? It stops checking your time and will no longer nudge you."
597
610
  ]