@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.
- package/dist/index.js +5 -4
- package/dist/timecampus/AdminRoot.d.ts.map +1 -1
- package/dist/timecampus/AdminRoot.js +1 -1
- package/dist/timecampus/AdminRoot.js.map +1 -1
- package/dist/timecampus/AdminRoutes.d.ts.map +1 -1
- package/dist/timecampus/AdminRoutes.js +24 -4
- package/dist/timecampus/AdminRoutes.js.map +1 -1
- package/dist/timecampus/adminPaths.d.ts +7 -0
- package/dist/timecampus/adminPaths.d.ts.map +1 -0
- package/dist/timecampus/adminPaths.js +6 -0
- package/dist/timecampus/adminPaths.js.map +1 -0
- package/dist/timecampus/index.d.ts +1 -0
- package/dist/timecampus/index.d.ts.map +1 -1
- package/dist/timecampus/index.js +5 -4
- package/dist/timecampus/pages/admin/AdminPage.d.ts.map +1 -1
- package/dist/timecampus/pages/admin/AdminPage.js +263 -251
- package/dist/timecampus/pages/admin/AdminPage.js.map +1 -1
- package/dist/timecampus/pages/expense-tracking/ExpenseTrackingPage.js +4 -4
- package/dist/timecampus/pages/extend/MarketplaceCertificationPage.d.ts.map +1 -1
- package/dist/timecampus/pages/extend/MarketplaceCertificationPage.js +5 -1
- package/dist/timecampus/pages/extend/MarketplaceCertificationPage.js.map +1 -1
- package/dist/timecampus/pages/extend/TimeTriggersPage.d.ts.map +1 -1
- package/dist/timecampus/pages/extend/TimeTriggersPage.js +207 -194
- package/dist/timecampus/pages/extend/TimeTriggersPage.js.map +1 -1
- package/dist/timecampus/pages/extend/triggerHelpers.d.ts +19 -0
- package/dist/timecampus/pages/extend/triggerHelpers.d.ts.map +1 -1
- package/dist/timecampus/pages/extend/triggerHelpers.js +6 -2
- package/dist/timecampus/pages/extend/triggerHelpers.js.map +1 -1
- package/dist/timecampus/pages/time-approval/TimeApprovalPage.js +4 -4
- 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
|
|
10
|
-
import { ToggleSwitch as
|
|
11
|
-
import { TimeCampusTriggerComparator as
|
|
12
|
-
import { useOpenRoute as
|
|
13
|
-
import { TRIGGER_METRIC_KEYS as
|
|
14
|
-
import { useMemo as
|
|
15
|
-
import { BellRing as
|
|
16
|
-
import { jsx as
|
|
17
|
-
import { GlassCard as
|
|
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
|
|
20
|
-
TRACKED_HOURS:
|
|
21
|
-
FOCUS_PERCENT:
|
|
22
|
-
CONTEXT_SWITCHES:
|
|
23
|
-
LONGEST_FOCUS_MINUTES:
|
|
24
|
-
},
|
|
25
|
-
BELOW:
|
|
26
|
-
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 !
|
|
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 =
|
|
51
|
-
return /* @__PURE__ */
|
|
50
|
+
let n = b(e.metric);
|
|
51
|
+
return /* @__PURE__ */ A("div", {
|
|
52
52
|
className: "flex flex-col gap-4",
|
|
53
53
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ A("label", {
|
|
55
55
|
className: "flex flex-col gap-1 text-sm",
|
|
56
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ k("span", {
|
|
57
57
|
className: "font-medium text-text-primary",
|
|
58
58
|
children: "Name"
|
|
59
|
-
}), /* @__PURE__ */
|
|
60
|
-
className:
|
|
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__ */
|
|
71
|
+
/* @__PURE__ */ A("div", {
|
|
72
72
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
73
73
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ A("label", {
|
|
75
75
|
className: "flex flex-col gap-1 text-sm sm:col-span-1",
|
|
76
|
-
children: [/* @__PURE__ */
|
|
76
|
+
children: [/* @__PURE__ */ k("span", {
|
|
77
77
|
className: "font-medium text-text-primary",
|
|
78
78
|
children: "When"
|
|
79
|
-
}), /* @__PURE__ */
|
|
80
|
-
className:
|
|
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:
|
|
87
|
+
children: p.map((e) => /* @__PURE__ */ k("option", {
|
|
88
88
|
value: e,
|
|
89
|
-
children:
|
|
89
|
+
children: b(e).label
|
|
90
90
|
}, e))
|
|
91
91
|
})]
|
|
92
92
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ A("label", {
|
|
94
94
|
className: "flex flex-col gap-1 text-sm",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ k("span", {
|
|
96
96
|
className: "font-medium text-text-primary",
|
|
97
97
|
children: "is"
|
|
98
|
-
}), /* @__PURE__ */
|
|
99
|
-
className:
|
|
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__ */
|
|
106
|
+
children: [/* @__PURE__ */ k("option", {
|
|
107
107
|
value: "BELOW",
|
|
108
108
|
children: "below"
|
|
109
|
-
}), /* @__PURE__ */
|
|
109
|
+
}), /* @__PURE__ */ k("option", {
|
|
110
110
|
value: "ABOVE",
|
|
111
111
|
children: "above"
|
|
112
112
|
})]
|
|
113
113
|
})]
|
|
114
114
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ A("label", {
|
|
116
116
|
className: "flex flex-col gap-1 text-sm",
|
|
117
|
-
children: [/* @__PURE__ */
|
|
117
|
+
children: [/* @__PURE__ */ A("span", {
|
|
118
118
|
className: "font-medium text-text-primary",
|
|
119
119
|
children: ["Threshold", n.unit ? ` (${n.unit})` : ""]
|
|
120
|
-
}), /* @__PURE__ */
|
|
121
|
-
className:
|
|
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__ */
|
|
136
|
+
/* @__PURE__ */ k("p", {
|
|
137
137
|
className: "text-xs text-text-tertiary",
|
|
138
138
|
children: n.hint
|
|
139
139
|
}),
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ A("label", {
|
|
141
141
|
className: "flex flex-col gap-1 text-sm",
|
|
142
142
|
children: [
|
|
143
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ k("span", {
|
|
144
144
|
className: "font-medium text-text-primary",
|
|
145
145
|
children: "Check from"
|
|
146
146
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
className:
|
|
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:
|
|
155
|
+
children: I.map((e) => /* @__PURE__ */ k("option", {
|
|
156
156
|
value: e,
|
|
157
|
-
children: e === 0 ? "Any time of day" : `${
|
|
157
|
+
children: e === 0 ? "Any time of day" : `${g(e)} onwards`
|
|
158
158
|
}, e))
|
|
159
159
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ A("span", {
|
|
161
161
|
className: "text-xs text-text-tertiary",
|
|
162
162
|
children: [
|
|
163
163
|
"Your day runs in ",
|
|
164
|
-
|
|
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__ */
|
|
170
|
+
/* @__PURE__ */ A("label", {
|
|
171
171
|
className: "flex flex-col gap-1 text-sm",
|
|
172
|
-
children: [/* @__PURE__ */
|
|
172
|
+
children: [/* @__PURE__ */ k("span", {
|
|
173
173
|
className: "font-medium text-text-primary",
|
|
174
174
|
children: "Note in the nudge (optional)"
|
|
175
|
-
}), /* @__PURE__ */
|
|
176
|
-
className:
|
|
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__ */
|
|
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
|
|
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__ */
|
|
206
|
+
/* @__PURE__ */ A("div", {
|
|
207
207
|
className: "flex items-start gap-3",
|
|
208
208
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
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__ */
|
|
211
|
+
children: /* @__PURE__ */ k(C, {
|
|
212
212
|
className: "h-5 w-5",
|
|
213
213
|
"aria-hidden": "true"
|
|
214
214
|
})
|
|
215
215
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ A("div", {
|
|
217
217
|
className: "min-w-0 flex-1",
|
|
218
|
-
children: [/* @__PURE__ */
|
|
218
|
+
children: [/* @__PURE__ */ k("h3", {
|
|
219
219
|
className: "truncate text-base font-semibold text-text-primary",
|
|
220
220
|
children: e.name
|
|
221
|
-
}), /* @__PURE__ */
|
|
221
|
+
}), /* @__PURE__ */ k("p", {
|
|
222
222
|
className: "text-sm text-text-secondary",
|
|
223
|
-
children:
|
|
223
|
+
children: h(e)
|
|
224
224
|
})]
|
|
225
225
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
242
|
+
/* @__PURE__ */ A("dl", {
|
|
243
243
|
className: "grid grid-cols-2 gap-2 text-xs text-text-tertiary",
|
|
244
|
-
children: [/* @__PURE__ */
|
|
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" :
|
|
247
|
-
})] }), /* @__PURE__ */
|
|
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__ */
|
|
252
|
+
/* @__PURE__ */ A("div", {
|
|
253
253
|
className: "mt-auto flex flex-wrap gap-2",
|
|
254
254
|
children: [
|
|
255
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ A("button", {
|
|
256
256
|
type: "button",
|
|
257
|
-
className:
|
|
257
|
+
className: N,
|
|
258
258
|
onClick: i,
|
|
259
259
|
disabled: n,
|
|
260
260
|
"aria-label": `Check ${e.name} now`,
|
|
261
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
266
|
+
/* @__PURE__ */ A("button", {
|
|
267
267
|
type: "button",
|
|
268
|
-
className:
|
|
268
|
+
className: P,
|
|
269
269
|
onClick: a,
|
|
270
270
|
disabled: n,
|
|
271
271
|
"aria-label": `Edit ${e.name}`,
|
|
272
|
-
children: [/* @__PURE__ */
|
|
272
|
+
children: [/* @__PURE__ */ k(w, {
|
|
273
273
|
className: "h-4 w-4",
|
|
274
274
|
"aria-hidden": "true"
|
|
275
275
|
}), "Edit"]
|
|
276
276
|
}),
|
|
277
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ A("button", {
|
|
278
278
|
type: "button",
|
|
279
|
-
className:
|
|
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__ */
|
|
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:
|
|
295
|
-
|
|
296
|
-
},
|
|
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
|
-
|
|
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
|
-
|
|
307
|
-
},
|
|
308
|
-
let e =
|
|
318
|
+
g(e), C(t), T(null), y(!0);
|
|
319
|
+
}, _e = async () => {
|
|
320
|
+
let e = se(b);
|
|
309
321
|
if (e) {
|
|
310
|
-
|
|
322
|
+
T(e);
|
|
311
323
|
return;
|
|
312
324
|
}
|
|
313
325
|
G(!0);
|
|
314
326
|
let t = {
|
|
315
|
-
name:
|
|
316
|
-
metric:
|
|
317
|
-
comparator:
|
|
318
|
-
threshold: Number(
|
|
319
|
-
checkHour:
|
|
320
|
-
timezone:
|
|
321
|
-
message:
|
|
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
|
-
|
|
325
|
-
id:
|
|
336
|
+
p ? (await J({ variables: {
|
|
337
|
+
id: p.id,
|
|
326
338
|
input: t
|
|
327
|
-
} }),
|
|
339
|
+
} }), u({
|
|
328
340
|
title: `${t.name} saved`,
|
|
329
341
|
variant: "success"
|
|
330
|
-
})) : (await
|
|
342
|
+
})) : (await fe({ variables: { input: {
|
|
331
343
|
...t,
|
|
332
344
|
message: t.message || null
|
|
333
|
-
} } }),
|
|
345
|
+
} } }), u({
|
|
334
346
|
title: `${t.name} created`,
|
|
335
347
|
variant: "success"
|
|
336
|
-
})),
|
|
348
|
+
})), y(!1);
|
|
337
349
|
} catch (e) {
|
|
338
|
-
|
|
350
|
+
T(z(e));
|
|
339
351
|
} finally {
|
|
340
352
|
G(!1);
|
|
341
353
|
}
|
|
342
354
|
}, $ = async (e, t) => {
|
|
343
|
-
if (!
|
|
344
|
-
|
|
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
|
-
|
|
360
|
+
u({
|
|
349
361
|
title: z(e),
|
|
350
362
|
variant: "error"
|
|
351
363
|
});
|
|
352
364
|
} finally {
|
|
353
|
-
|
|
365
|
+
F((t) => {
|
|
354
366
|
let n = new Set(t);
|
|
355
367
|
return n.delete(e), n;
|
|
356
368
|
});
|
|
357
369
|
}
|
|
358
370
|
}
|
|
359
|
-
},
|
|
371
|
+
}, ve = (e, t) => $(e.id, async () => {
|
|
360
372
|
await J({ variables: {
|
|
361
373
|
id: e.id,
|
|
362
374
|
input: { enabled: t }
|
|
363
|
-
} }),
|
|
375
|
+
} }), u({
|
|
364
376
|
title: `${e.name} ${t ? "enabled" : "paused"}`,
|
|
365
377
|
variant: "success"
|
|
366
378
|
});
|
|
367
|
-
}),
|
|
368
|
-
let t = (await
|
|
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 =
|
|
371
|
-
t.fired ?
|
|
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 ?
|
|
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 ?
|
|
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
|
-
}) :
|
|
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
|
-
}),
|
|
389
|
-
await
|
|
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__ */
|
|
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__ */
|
|
410
|
+
actions: Z ? /* @__PURE__ */ A("button", {
|
|
399
411
|
type: "button",
|
|
400
|
-
className:
|
|
412
|
+
className: N,
|
|
401
413
|
onClick: () => Q(),
|
|
402
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
420
|
+
/* @__PURE__ */ k(re, {
|
|
409
421
|
toasts: i,
|
|
410
|
-
onDismiss:
|
|
422
|
+
onDismiss: d
|
|
411
423
|
}),
|
|
412
|
-
|
|
424
|
+
de && !K ? /* @__PURE__ */ k(n, {
|
|
413
425
|
variant: "card",
|
|
414
426
|
count: 3
|
|
415
|
-
}) : q ? /* @__PURE__ */
|
|
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__ */
|
|
431
|
+
}) : Z ? Y.length === 0 ? /* @__PURE__ */ A("div", {
|
|
420
432
|
className: "flex flex-col gap-4",
|
|
421
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
436
|
+
action: /* @__PURE__ */ A("button", {
|
|
425
437
|
type: "button",
|
|
426
|
-
className:
|
|
438
|
+
className: N,
|
|
427
439
|
onClick: () => Q(),
|
|
428
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
445
|
+
}), /* @__PURE__ */ k("div", {
|
|
434
446
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4",
|
|
435
|
-
children:
|
|
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__ */
|
|
451
|
+
children: [/* @__PURE__ */ k("p", {
|
|
440
452
|
className: "font-medium text-text-primary",
|
|
441
453
|
children: e.name
|
|
442
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
465
|
+
children: Y.map((e) => /* @__PURE__ */ k(H, {
|
|
454
466
|
trigger: e,
|
|
455
|
-
busy:
|
|
456
|
-
onToggle: (t) =>
|
|
457
|
-
onRun: () =>
|
|
458
|
-
onEdit: () =>
|
|
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__ */
|
|
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__ */
|
|
477
|
+
action: /* @__PURE__ */ A("button", {
|
|
465
478
|
type: "button",
|
|
466
|
-
className:
|
|
467
|
-
onClick: () =>
|
|
468
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
487
|
+
Z && /* @__PURE__ */ A("section", {
|
|
475
488
|
className: "mt-8",
|
|
476
489
|
"aria-labelledby": "trigger-history-heading",
|
|
477
|
-
children: [/* @__PURE__ */
|
|
490
|
+
children: [/* @__PURE__ */ A("div", {
|
|
478
491
|
className: "mb-3 flex flex-wrap items-center justify-between gap-2",
|
|
479
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
496
|
+
}), /* @__PURE__ */ A("button", {
|
|
484
497
|
type: "button",
|
|
485
|
-
className:
|
|
486
|
-
onClick: () =>
|
|
487
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
505
|
+
}), X.length === 0 ? /* @__PURE__ */ k("p", {
|
|
493
506
|
className: "text-sm text-text-tertiary",
|
|
494
507
|
children: "Nothing has fired yet."
|
|
495
|
-
}) : /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
513
|
+
/* @__PURE__ */ k("span", {
|
|
501
514
|
className: "font-medium text-text-primary",
|
|
502
|
-
children:
|
|
515
|
+
children: he.get(e.triggerId) ?? "Deleted trigger"
|
|
503
516
|
}),
|
|
504
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ A("span", {
|
|
505
518
|
className: "text-text-secondary",
|
|
506
519
|
children: [
|
|
507
|
-
|
|
520
|
+
_(e.metric, e.value),
|
|
508
521
|
" (",
|
|
509
522
|
e.comparator === "BELOW" ? "below" : "above",
|
|
510
523
|
" ",
|
|
511
|
-
|
|
524
|
+
_(e.metric, e.threshold),
|
|
512
525
|
")"
|
|
513
526
|
]
|
|
514
527
|
}),
|
|
515
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ A("span", {
|
|
516
529
|
className: "flex items-center gap-2 text-text-tertiary",
|
|
517
530
|
children: [
|
|
518
531
|
e.day,
|
|
519
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ k(c, {
|
|
520
533
|
label: e.source === "MANUAL" ? "Manual" : "Scheduled",
|
|
521
534
|
variant: "info"
|
|
522
535
|
}),
|
|
523
|
-
!e.notified && /* @__PURE__ */
|
|
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__ */
|
|
534
|
-
open:
|
|
535
|
-
onClose: () =>
|
|
536
|
-
title:
|
|
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__ */
|
|
552
|
+
footer: /* @__PURE__ */ A("div", {
|
|
540
553
|
className: "flex justify-end gap-2",
|
|
541
|
-
children: [/* @__PURE__ */
|
|
554
|
+
children: [/* @__PURE__ */ k("button", {
|
|
542
555
|
type: "button",
|
|
543
|
-
className:
|
|
544
|
-
onClick: () =>
|
|
556
|
+
className: P,
|
|
557
|
+
onClick: () => y(!1),
|
|
545
558
|
children: "Cancel"
|
|
546
|
-
}), /* @__PURE__ */
|
|
559
|
+
}), /* @__PURE__ */ k("button", {
|
|
547
560
|
type: "button",
|
|
548
|
-
className:
|
|
549
|
-
onClick: () => void
|
|
561
|
+
className: N,
|
|
562
|
+
onClick: () => void _e(),
|
|
550
563
|
disabled: W,
|
|
551
|
-
children: W ? "Saving…" :
|
|
564
|
+
children: W ? "Saving…" : p ? "Save" : "Create trigger"
|
|
552
565
|
})]
|
|
553
566
|
}),
|
|
554
|
-
children: [/* @__PURE__ */
|
|
555
|
-
form:
|
|
556
|
-
onChange:
|
|
557
|
-
}),
|
|
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:
|
|
573
|
+
children: w
|
|
561
574
|
})]
|
|
562
575
|
}),
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
open:
|
|
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__ */
|
|
581
|
+
footer: /* @__PURE__ */ A("div", {
|
|
569
582
|
className: "flex justify-end gap-2",
|
|
570
|
-
children: [/* @__PURE__ */
|
|
583
|
+
children: [/* @__PURE__ */ k("button", {
|
|
571
584
|
type: "button",
|
|
572
|
-
className:
|
|
585
|
+
className: P,
|
|
573
586
|
onClick: () => U(null),
|
|
574
587
|
children: "Cancel"
|
|
575
|
-
}), /* @__PURE__ */
|
|
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
|
-
|
|
592
|
+
I && be(I);
|
|
580
593
|
},
|
|
581
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
600
|
+
children: /* @__PURE__ */ A("p", {
|
|
588
601
|
className: "text-sm text-text-secondary",
|
|
589
602
|
children: [
|
|
590
603
|
"Delete",
|
|
591
604
|
" ",
|
|
592
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ k("span", {
|
|
593
606
|
className: "font-medium text-text-primary",
|
|
594
|
-
children:
|
|
607
|
+
children: I?.name
|
|
595
608
|
}),
|
|
596
609
|
"? It stops checking your time and will no longer nudge you."
|
|
597
610
|
]
|