@burdenoff/microfe-timecampus 2026.1107.4 → 2026.1107.6
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 +1463 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +1849 -1414
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +223 -0
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +21 -17
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/timecampus/TimeCampusRoutes.d.ts.map +1 -1
- package/dist/timecampus/TimeCampusRoutes.js +132 -124
- package/dist/timecampus/TimeCampusRoutes.js.map +1 -1
- package/dist/timecampus/analytics/timecampusAnalytics.d.ts +7 -1
- package/dist/timecampus/analytics/timecampusAnalytics.d.ts.map +1 -1
- package/dist/timecampus/analytics/timecampusAnalytics.js +12 -0
- package/dist/timecampus/analytics/timecampusAnalytics.js.map +1 -1
- package/dist/timecampus/analytics/useTimeCampusAnalytics.d.ts.map +1 -1
- package/dist/timecampus/analytics/useTimeCampusAnalytics.js +1 -0
- package/dist/timecampus/analytics/useTimeCampusAnalytics.js.map +1 -1
- package/dist/timecampus/index.js +7 -7
- package/dist/timecampus/pages/extend/AppletDeveloperPage.d.ts +2 -0
- package/dist/timecampus/pages/extend/AppletDeveloperPage.d.ts.map +1 -0
- package/dist/timecampus/pages/extend/AppletDeveloperPage.js +366 -0
- package/dist/timecampus/pages/extend/AppletDeveloperPage.js.map +1 -0
- package/dist/timecampus/pages/extend/AppletReviewPage.d.ts +2 -0
- package/dist/timecampus/pages/extend/AppletReviewPage.d.ts.map +1 -0
- package/dist/timecampus/pages/extend/AppletReviewPage.js +308 -0
- package/dist/timecampus/pages/extend/AppletReviewPage.js.map +1 -0
- package/dist/timecampus/pages/extend/AppletStorePage.d.ts.map +1 -1
- package/dist/timecampus/pages/extend/AppletStorePage.js +88 -83
- package/dist/timecampus/pages/extend/AppletStorePage.js.map +1 -1
- package/dist/timecampus/pages/extend/SandboxedAppletWidget.d.ts +14 -0
- package/dist/timecampus/pages/extend/SandboxedAppletWidget.d.ts.map +1 -0
- package/dist/timecampus/pages/extend/SandboxedAppletWidget.js +86 -0
- package/dist/timecampus/pages/extend/SandboxedAppletWidget.js.map +1 -0
- package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.d.ts +11 -0
- package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.d.ts.map +1 -0
- package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.js +267 -0
- package/dist/timecampus/pages/extend/ThirdPartyAppletsSection.js.map +1 -0
- package/dist/timecampus/pages/extend/WidgetDashboardPage.d.ts.map +1 -1
- package/dist/timecampus/pages/extend/WidgetDashboardPage.js +147 -141
- package/dist/timecampus/pages/extend/WidgetDashboardPage.js.map +1 -1
- package/dist/timecampus/pages/extend/appletBridge.d.ts +70 -0
- package/dist/timecampus/pages/extend/appletBridge.d.ts.map +1 -0
- package/dist/timecampus/pages/extend/appletBridge.js +67 -0
- package/dist/timecampus/pages/extend/appletBridge.js.map +1 -0
- package/dist/timecampus/pages/extend/appletPublishingHelpers.d.ts +36 -0
- package/dist/timecampus/pages/extend/appletPublishingHelpers.d.ts.map +1 -0
- package/dist/timecampus/pages/extend/appletPublishingHelpers.js +120 -0
- package/dist/timecampus/pages/extend/appletPublishingHelpers.js.map +1 -0
- package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.d.ts +14 -0
- package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.d.ts.map +1 -0
- package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js +238 -0
- package/dist/timecampus/pages/time-approval/SubmitTimesheetModal.js.map +1 -0
- package/dist/timecampus/pages/time-approval/TimeApprovalPage.d.ts.map +1 -1
- package/dist/timecampus/pages/time-approval/TimeApprovalPage.js +122 -87
- package/dist/timecampus/pages/time-approval/TimeApprovalPage.js.map +1 -1
- package/dist/timecampus/pages/time-approval/timesheetPeriod.d.ts +80 -0
- package/dist/timecampus/pages/time-approval/timesheetPeriod.d.ts.map +1 -0
- package/dist/timecampus/pages/time-approval/timesheetPeriod.js +103 -0
- package/dist/timecampus/pages/time-approval/timesheetPeriod.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { useTimeCampusNavigate as e } from "../../providers/TimeCampusProvider.js";
|
|
2
|
+
import { formatDate as t } from "../../utils/helpers.js";
|
|
3
|
+
import { useInstallThirdPartyAppletMutation as n, useListStoreAppletsQuery as r, useUninstallThirdPartyAppletMutation as i } from "../../../generated/wspace-operations.js";
|
|
4
|
+
import { StatusBadge as a } from "../../components/StatusBadge.js";
|
|
5
|
+
import { Modal as o } from "../../components/Modal.js";
|
|
6
|
+
import { appletCategoryLabel as s, catalogueIcon as c } from "./extendHelpers.js";
|
|
7
|
+
import { errorText as l } from "./appletPublishingHelpers.js";
|
|
8
|
+
import { scopeLabel as u } from "./appletBridge.js";
|
|
9
|
+
import { useState as d } from "react";
|
|
10
|
+
import { Code as f, Download as p, ShieldCheck as m, Trash2 as h } from "lucide-react";
|
|
11
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
|
+
import { GlassCard as y } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
//#region src/timecampus/pages/extend/ThirdPartyAppletsSection.tsx
|
|
14
|
+
var b = ["ListStoreApplets", "GetWidgetDashboard"], x = "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", S = "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";
|
|
15
|
+
function C({ applet: e, busy: t, onCancel: n, onConfirm: r }) {
|
|
16
|
+
let [i, a] = d(() => e.installed ? [...e.grantedScopes] : [...e.requestedScopes]), s = (e) => a((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
17
|
+
return /* @__PURE__ */ _(o, {
|
|
18
|
+
open: !0,
|
|
19
|
+
onClose: n,
|
|
20
|
+
title: e.installed ? `Data access for ${e.name}` : `Install ${e.name}`,
|
|
21
|
+
description: "Third-party widgets run in a sandbox and only receive the data you grant here.",
|
|
22
|
+
footer: /* @__PURE__ */ v("div", {
|
|
23
|
+
className: "flex justify-end gap-2",
|
|
24
|
+
children: [/* @__PURE__ */ _("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
className: S,
|
|
27
|
+
onClick: n,
|
|
28
|
+
children: "Cancel"
|
|
29
|
+
}), /* @__PURE__ */ _("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
className: x,
|
|
32
|
+
disabled: t,
|
|
33
|
+
onClick: () => r(i),
|
|
34
|
+
children: t ? "Saving…" : e.installed ? "Save access" : "Install"
|
|
35
|
+
})]
|
|
36
|
+
}),
|
|
37
|
+
children: e.requestedScopes.length === 0 ? /* @__PURE__ */ _("p", {
|
|
38
|
+
className: "text-sm text-text-secondary",
|
|
39
|
+
children: "This applet does not ask for any TimeCampus data."
|
|
40
|
+
}) : /* @__PURE__ */ v("fieldset", {
|
|
41
|
+
className: "flex flex-col gap-2",
|
|
42
|
+
children: [/* @__PURE__ */ v("legend", {
|
|
43
|
+
className: "mb-1 text-sm font-medium text-text-primary",
|
|
44
|
+
children: [e.name, " asks to read:"]
|
|
45
|
+
}), e.requestedScopes.map((e) => /* @__PURE__ */ v("label", {
|
|
46
|
+
className: "flex items-start gap-2 text-sm text-text-secondary",
|
|
47
|
+
children: [/* @__PURE__ */ _("input", {
|
|
48
|
+
type: "checkbox",
|
|
49
|
+
className: "mt-0.5",
|
|
50
|
+
checked: i.includes(e),
|
|
51
|
+
onChange: () => s(e),
|
|
52
|
+
"aria-label": u(e)
|
|
53
|
+
}), /* @__PURE__ */ v("span", { children: [
|
|
54
|
+
u(e),
|
|
55
|
+
" ",
|
|
56
|
+
/* @__PURE__ */ _("code", {
|
|
57
|
+
className: "text-xs text-text-tertiary",
|
|
58
|
+
children: e
|
|
59
|
+
})
|
|
60
|
+
] })]
|
|
61
|
+
}, e))]
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function w({ applet: e, busy: n, onInstall: r, onUninstall: i }) {
|
|
66
|
+
let o = c(e.icon);
|
|
67
|
+
return /* @__PURE__ */ v(y, {
|
|
68
|
+
treatment: "glass",
|
|
69
|
+
className: "flex h-full flex-col gap-3 p-5",
|
|
70
|
+
"data-testid": `store-applet-card-${e.key}`,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ v("div", {
|
|
73
|
+
className: "flex items-start gap-3",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ _("div", {
|
|
76
|
+
className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary",
|
|
77
|
+
children: /* @__PURE__ */ _(o, {
|
|
78
|
+
className: "h-5 w-5",
|
|
79
|
+
"aria-hidden": "true"
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ v("div", {
|
|
83
|
+
className: "min-w-0 flex-1",
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ v("p", {
|
|
86
|
+
className: "text-xs font-medium uppercase tracking-wide text-text-tertiary",
|
|
87
|
+
children: [
|
|
88
|
+
s(e.category),
|
|
89
|
+
" · v",
|
|
90
|
+
e.version
|
|
91
|
+
]
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ _("h3", {
|
|
94
|
+
className: "truncate text-base font-semibold text-text-primary",
|
|
95
|
+
children: e.name
|
|
96
|
+
}),
|
|
97
|
+
e.developerName && /* @__PURE__ */ v("p", {
|
|
98
|
+
className: "text-xs text-text-tertiary",
|
|
99
|
+
children: ["By ", e.developerName]
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
}),
|
|
103
|
+
e.installed && /* @__PURE__ */ _(a, {
|
|
104
|
+
label: "Installed",
|
|
105
|
+
variant: "success",
|
|
106
|
+
dot: !0
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ _("p", {
|
|
111
|
+
className: "flex-1 text-sm text-text-secondary",
|
|
112
|
+
children: e.description
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ v("p", {
|
|
115
|
+
className: "text-xs text-text-tertiary",
|
|
116
|
+
children: [
|
|
117
|
+
"Adds ",
|
|
118
|
+
e.widgetKeys.length,
|
|
119
|
+
" widget",
|
|
120
|
+
e.widgetKeys.length === 1 ? "" : "s",
|
|
121
|
+
" to My Widgets",
|
|
122
|
+
e.installed && e.installedAt ? ` · installed ${t(e.installedAt)}` : ""
|
|
123
|
+
]
|
|
124
|
+
}),
|
|
125
|
+
e.installed && e.ungrantedScopes.length > 0 && /* @__PURE__ */ _("p", {
|
|
126
|
+
className: "text-xs text-status-warning-text",
|
|
127
|
+
children: "A newer version asks for more data access."
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ _("div", {
|
|
130
|
+
className: "flex flex-wrap gap-2",
|
|
131
|
+
children: e.installed ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("button", {
|
|
132
|
+
type: "button",
|
|
133
|
+
className: S,
|
|
134
|
+
onClick: r,
|
|
135
|
+
disabled: n,
|
|
136
|
+
"aria-label": `Data access for ${e.name}`,
|
|
137
|
+
children: [/* @__PURE__ */ _(m, {
|
|
138
|
+
className: "h-4 w-4",
|
|
139
|
+
"aria-hidden": "true"
|
|
140
|
+
}), "Data access"]
|
|
141
|
+
}), /* @__PURE__ */ v("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
className: S,
|
|
144
|
+
onClick: i,
|
|
145
|
+
disabled: n,
|
|
146
|
+
"aria-label": `Remove ${e.name}`,
|
|
147
|
+
children: [/* @__PURE__ */ _(h, {
|
|
148
|
+
className: "h-4 w-4",
|
|
149
|
+
"aria-hidden": "true"
|
|
150
|
+
}), "Remove"]
|
|
151
|
+
})] }) : /* @__PURE__ */ v("button", {
|
|
152
|
+
type: "button",
|
|
153
|
+
className: x,
|
|
154
|
+
onClick: r,
|
|
155
|
+
disabled: n,
|
|
156
|
+
"aria-label": `Install ${e.name}`,
|
|
157
|
+
children: [/* @__PURE__ */ _(p, {
|
|
158
|
+
className: "h-4 w-4",
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
}), "Install"]
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function T({ workspaceId: t, addToast: a }) {
|
|
167
|
+
let o = e(), [s, c] = d(null), [u, p] = d(null), { data: h, loading: g, error: y } = r({ skip: !t }), [x] = n({ refetchQueries: b }), [T] = i({ refetchQueries: b }), E = h?.timeCampusStoreApplets ?? [], D = async (e, t) => {
|
|
168
|
+
p(e.id);
|
|
169
|
+
try {
|
|
170
|
+
await x({ variables: {
|
|
171
|
+
id: e.id,
|
|
172
|
+
grantedScopes: t
|
|
173
|
+
} }), c(null), a({
|
|
174
|
+
title: e.installed ? `Data access for ${e.name} saved` : `${e.name} installed`,
|
|
175
|
+
description: "Its widgets are available in My Widgets.",
|
|
176
|
+
variant: "success"
|
|
177
|
+
});
|
|
178
|
+
} catch (e) {
|
|
179
|
+
a({
|
|
180
|
+
title: l(e),
|
|
181
|
+
variant: "error"
|
|
182
|
+
});
|
|
183
|
+
} finally {
|
|
184
|
+
p(null);
|
|
185
|
+
}
|
|
186
|
+
}, O = async (e) => {
|
|
187
|
+
p(e.id);
|
|
188
|
+
try {
|
|
189
|
+
await T({ variables: { id: e.id } }), a({
|
|
190
|
+
title: `${e.name} removed`,
|
|
191
|
+
variant: "success"
|
|
192
|
+
});
|
|
193
|
+
} catch (e) {
|
|
194
|
+
a({
|
|
195
|
+
title: l(e),
|
|
196
|
+
variant: "error"
|
|
197
|
+
});
|
|
198
|
+
} finally {
|
|
199
|
+
p(null);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
return /* @__PURE__ */ v("section", {
|
|
203
|
+
className: "mt-8",
|
|
204
|
+
"aria-labelledby": "workspace-applets-heading",
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ v("div", {
|
|
207
|
+
className: "mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",
|
|
208
|
+
children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("h2", {
|
|
209
|
+
id: "workspace-applets-heading",
|
|
210
|
+
className: "text-base font-semibold text-text-primary",
|
|
211
|
+
children: "Workspace applets"
|
|
212
|
+
}), /* @__PURE__ */ _("p", {
|
|
213
|
+
className: "text-sm text-text-secondary",
|
|
214
|
+
children: "Applets built by developers in this workspace and certified by a reviewer. They run sandboxed and only see the data you grant."
|
|
215
|
+
})] }), /* @__PURE__ */ v("div", {
|
|
216
|
+
className: "flex flex-wrap gap-2",
|
|
217
|
+
children: [/* @__PURE__ */ v("button", {
|
|
218
|
+
type: "button",
|
|
219
|
+
className: S,
|
|
220
|
+
onClick: () => o("/applets/developer"),
|
|
221
|
+
children: [/* @__PURE__ */ _(f, {
|
|
222
|
+
className: "h-4 w-4",
|
|
223
|
+
"aria-hidden": "true"
|
|
224
|
+
}), "Build an applet"]
|
|
225
|
+
}), /* @__PURE__ */ v("button", {
|
|
226
|
+
type: "button",
|
|
227
|
+
className: S,
|
|
228
|
+
onClick: () => o("/applets/review"),
|
|
229
|
+
children: [/* @__PURE__ */ _(m, {
|
|
230
|
+
className: "h-4 w-4",
|
|
231
|
+
"aria-hidden": "true"
|
|
232
|
+
}), "Review queue"]
|
|
233
|
+
})]
|
|
234
|
+
})]
|
|
235
|
+
}),
|
|
236
|
+
g && !h ? /* @__PURE__ */ _("p", {
|
|
237
|
+
className: "text-sm text-text-secondary",
|
|
238
|
+
children: "Loading…"
|
|
239
|
+
}) : y ? /* @__PURE__ */ v("p", {
|
|
240
|
+
className: "text-sm text-text-secondary",
|
|
241
|
+
children: ["Couldn't load workspace applets: ", y.message]
|
|
242
|
+
}) : E.length === 0 ? /* @__PURE__ */ _("p", {
|
|
243
|
+
className: "text-sm text-text-secondary",
|
|
244
|
+
"data-testid": "workspace-applets-empty",
|
|
245
|
+
children: "No workspace applets are published yet. Developers can build one from a manifest and submit it for review."
|
|
246
|
+
}) : /* @__PURE__ */ _("div", {
|
|
247
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",
|
|
248
|
+
children: E.map((e) => /* @__PURE__ */ _(w, {
|
|
249
|
+
applet: e,
|
|
250
|
+
busy: u === e.id,
|
|
251
|
+
onInstall: () => c(e),
|
|
252
|
+
onUninstall: () => O(e)
|
|
253
|
+
}, e.id))
|
|
254
|
+
}),
|
|
255
|
+
s && /* @__PURE__ */ _(C, {
|
|
256
|
+
applet: s,
|
|
257
|
+
busy: u === s.id,
|
|
258
|
+
onCancel: () => c(null),
|
|
259
|
+
onConfirm: (e) => D(s, e)
|
|
260
|
+
})
|
|
261
|
+
]
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
export { T as ThirdPartyAppletsSection };
|
|
266
|
+
|
|
267
|
+
//# sourceMappingURL=ThirdPartyAppletsSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPartyAppletsSection.js","names":[],"sources":["../../../../src/timecampus/pages/extend/ThirdPartyAppletsSection.tsx"],"sourcesContent":["/**\n * Workspace applets in the applet store (BOFF-10827).\n *\n * Third-party applets that a reviewer published in this workspace. Installing\n * one asks the admin which of its requested data scopes to grant; its widgets\n * then appear in My Widgets, rendered in a sandboxed iframe that only sees the\n * granted scopes.\n */\nimport { useState } from \"react\";\nimport { Code, Download, ShieldCheck, Trash2 } from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { Modal } from \"../../components/Modal\";\nimport { StatusBadge } from \"../../components/StatusBadge\";\nimport { formatDate } from \"../../utils/helpers\";\nimport { useTimeCampusNavigate } from \"../../providers/TimeCampusProvider\";\nimport {\n useInstallThirdPartyAppletMutation,\n useListStoreAppletsQuery,\n useUninstallThirdPartyAppletMutation,\n type StoreAppletFieldsFragment,\n} from \"@/generated/wspace-operations\";\nimport { appletCategoryLabel, catalogueIcon } from \"./extendHelpers\";\nimport { scopeLabel } from \"./appletBridge\";\nimport { errorText } from \"./appletPublishingHelpers\";\n\nconst REFRESH_QUERIES = [\"ListStoreApplets\", \"GetWidgetDashboard\"];\nconst primaryButton =\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\";\nconst outlineButton =\n \"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\";\n\ntype Toast = (toast: {\n title: string;\n description?: string;\n variant: \"success\" | \"error\";\n}) => void;\n\nfunction ConsentDialog({\n applet,\n busy,\n onCancel,\n onConfirm,\n}: {\n applet: StoreAppletFieldsFragment;\n busy: boolean;\n onCancel: () => void;\n onConfirm: (scopes: string[]) => void;\n}) {\n // A new install offers everything the applet asks for; changing access\n // starts from what was granted before.\n const [granted, setGranted] = useState<string[]>(() =>\n applet.installed ? [...applet.grantedScopes] : [...applet.requestedScopes],\n );\n const toggle = (scope: string) =>\n setGranted((current) =>\n current.includes(scope)\n ? current.filter((item) => item !== scope)\n : [...current, scope],\n );\n return (\n <Modal\n open\n onClose={onCancel}\n title={\n applet.installed\n ? `Data access for ${applet.name}`\n : `Install ${applet.name}`\n }\n description=\"Third-party widgets run in a sandbox and only receive the data you grant here.\"\n footer={\n <div className=\"flex justify-end gap-2\">\n <button type=\"button\" className={outlineButton} onClick={onCancel}>\n Cancel\n </button>\n <button\n type=\"button\"\n className={primaryButton}\n disabled={busy}\n onClick={() => onConfirm(granted)}\n >\n {busy ? \"Saving…\" : applet.installed ? \"Save access\" : \"Install\"}\n </button>\n </div>\n }\n >\n {applet.requestedScopes.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n This applet does not ask for any TimeCampus data.\n </p>\n ) : (\n <fieldset className=\"flex flex-col gap-2\">\n <legend className=\"mb-1 text-sm font-medium text-text-primary\">\n {applet.name} asks to read:\n </legend>\n {applet.requestedScopes.map((scope) => (\n <label\n key={scope}\n className=\"flex items-start gap-2 text-sm text-text-secondary\"\n >\n <input\n type=\"checkbox\"\n className=\"mt-0.5\"\n checked={granted.includes(scope)}\n onChange={() => toggle(scope)}\n aria-label={scopeLabel(scope)}\n />\n <span>\n {scopeLabel(scope)}{\" \"}\n <code className=\"text-xs text-text-tertiary\">{scope}</code>\n </span>\n </label>\n ))}\n </fieldset>\n )}\n </Modal>\n );\n}\n\nfunction StoreAppletCard({\n applet,\n busy,\n onInstall,\n onUninstall,\n}: {\n applet: StoreAppletFieldsFragment;\n busy: boolean;\n onInstall: () => void;\n onUninstall: () => void;\n}) {\n const Icon = catalogueIcon(applet.icon);\n return (\n <GlassCard\n treatment=\"glass\"\n className=\"flex h-full flex-col gap-3 p-5\"\n data-testid={`store-applet-card-${applet.key}`}\n >\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary\">\n <Icon className=\"h-5 w-5\" aria-hidden=\"true\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-text-tertiary\">\n {appletCategoryLabel(applet.category)} · v{applet.version}\n </p>\n <h3 className=\"truncate text-base font-semibold text-text-primary\">\n {applet.name}\n </h3>\n {applet.developerName && (\n <p className=\"text-xs text-text-tertiary\">\n By {applet.developerName}\n </p>\n )}\n </div>\n {applet.installed && (\n <StatusBadge label=\"Installed\" variant=\"success\" dot />\n )}\n </div>\n <p className=\"flex-1 text-sm text-text-secondary\">{applet.description}</p>\n <p className=\"text-xs text-text-tertiary\">\n Adds {applet.widgetKeys.length} widget\n {applet.widgetKeys.length === 1 ? \"\" : \"s\"} to My Widgets\n {applet.installed && applet.installedAt\n ? ` · installed ${formatDate(applet.installedAt)}`\n : \"\"}\n </p>\n {applet.installed && applet.ungrantedScopes.length > 0 && (\n <p className=\"text-xs text-status-warning-text\">\n A newer version asks for more data access.\n </p>\n )}\n <div className=\"flex flex-wrap gap-2\">\n {applet.installed ? (\n <>\n <button\n type=\"button\"\n className={outlineButton}\n onClick={onInstall}\n disabled={busy}\n aria-label={`Data access for ${applet.name}`}\n >\n <ShieldCheck className=\"h-4 w-4\" aria-hidden=\"true\" />\n Data access\n </button>\n <button\n type=\"button\"\n className={outlineButton}\n onClick={onUninstall}\n disabled={busy}\n aria-label={`Remove ${applet.name}`}\n >\n <Trash2 className=\"h-4 w-4\" aria-hidden=\"true\" />\n Remove\n </button>\n </>\n ) : (\n <button\n type=\"button\"\n className={primaryButton}\n onClick={onInstall}\n disabled={busy}\n aria-label={`Install ${applet.name}`}\n >\n <Download className=\"h-4 w-4\" aria-hidden=\"true\" />\n Install\n </button>\n )}\n </div>\n </GlassCard>\n );\n}\n\nexport function ThirdPartyAppletsSection({\n workspaceId,\n addToast,\n}: {\n workspaceId: string;\n addToast: Toast;\n}) {\n const navigate = useTimeCampusNavigate();\n const [consentFor, setConsentFor] =\n useState<StoreAppletFieldsFragment | null>(null);\n const [busyId, setBusyId] = useState<string | null>(null);\n const { data, loading, error } = useListStoreAppletsQuery({\n skip: !workspaceId,\n });\n const [install] = useInstallThirdPartyAppletMutation({\n refetchQueries: REFRESH_QUERIES,\n });\n const [uninstall] = useUninstallThirdPartyAppletMutation({\n refetchQueries: REFRESH_QUERIES,\n });\n const applets: StoreAppletFieldsFragment[] =\n data?.timeCampusStoreApplets ?? [];\n\n const confirmInstall = async (\n applet: StoreAppletFieldsFragment,\n scopes: string[],\n ) => {\n setBusyId(applet.id);\n try {\n await install({ variables: { id: applet.id, grantedScopes: scopes } });\n setConsentFor(null);\n addToast({\n title: applet.installed\n ? `Data access for ${applet.name} saved`\n : `${applet.name} installed`,\n description: \"Its widgets are available in My Widgets.\",\n variant: \"success\",\n });\n } catch (err) {\n addToast({ title: errorText(err), variant: \"error\" });\n } finally {\n setBusyId(null);\n }\n };\n\n const remove = async (applet: StoreAppletFieldsFragment) => {\n setBusyId(applet.id);\n try {\n await uninstall({ variables: { id: applet.id } });\n addToast({ title: `${applet.name} removed`, variant: \"success\" });\n } catch (err) {\n addToast({ title: errorText(err), variant: \"error\" });\n } finally {\n setBusyId(null);\n }\n };\n\n return (\n <section className=\"mt-8\" aria-labelledby=\"workspace-applets-heading\">\n <div className=\"mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h2\n id=\"workspace-applets-heading\"\n className=\"text-base font-semibold text-text-primary\"\n >\n Workspace applets\n </h2>\n <p className=\"text-sm text-text-secondary\">\n Applets built by developers in this workspace and certified by a\n reviewer. They run sandboxed and only see the data you grant.\n </p>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n className={outlineButton}\n onClick={() => navigate(\"/applets/developer\")}\n >\n <Code className=\"h-4 w-4\" aria-hidden=\"true\" />\n Build an applet\n </button>\n <button\n type=\"button\"\n className={outlineButton}\n onClick={() => navigate(\"/applets/review\")}\n >\n <ShieldCheck className=\"h-4 w-4\" aria-hidden=\"true\" />\n Review queue\n </button>\n </div>\n </div>\n {loading && !data ? (\n <p className=\"text-sm text-text-secondary\">Loading…</p>\n ) : error ? (\n <p className=\"text-sm text-text-secondary\">\n Couldn't load workspace applets: {error.message}\n </p>\n ) : applets.length === 0 ? (\n <p\n className=\"text-sm text-text-secondary\"\n data-testid=\"workspace-applets-empty\"\n >\n No workspace applets are published yet. Developers can build one from\n a manifest and submit it for review.\n </p>\n ) : (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4\">\n {applets.map((applet) => (\n <StoreAppletCard\n key={applet.id}\n applet={applet}\n busy={busyId === applet.id}\n onInstall={() => setConsentFor(applet)}\n onUninstall={() => remove(applet)}\n />\n ))}\n </div>\n )}\n {consentFor && (\n <ConsentDialog\n applet={consentFor}\n busy={busyId === consentFor.id}\n onCancel={() => setConsentFor(null)}\n onConfirm={(scopes) => confirmInstall(consentFor, scopes)}\n />\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAyBA,IAAM,IAAkB,CAAC,oBAAoB,oBAAoB,GAC3D,IACJ,8LACI,IACJ;AAQF,SAAS,EAAc,EACrB,WACA,SACA,aACA,gBAMC;CAGD,IAAM,CAAC,GAAS,KAAc,QAC5B,EAAO,YAAY,CAAC,GAAG,EAAO,aAAa,IAAI,CAAC,GAAG,EAAO,eAAe,CAC3E,GACM,KAAU,MACd,GAAY,MACV,EAAQ,SAAS,CAAK,IAClB,EAAQ,QAAQ,MAAS,MAAS,CAAK,IACvC,CAAC,GAAG,GAAS,CAAK,CACxB;CACF,OACE,kBAAC,GAAD;EACE,MAAA;EACA,SAAS;EACT,OACE,EAAO,YACH,mBAAmB,EAAO,SAC1B,WAAW,EAAO;EAExB,aAAY;EACZ,QACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,UAAD;IAAQ,MAAK;IAAS,WAAW;IAAe,SAAS;IAAU,UAAA;GAE3D,CAAA,GACR,kBAAC,UAAD;IACE,MAAK;IACL,WAAW;IACX,UAAU;IACV,eAAe,EAAU,CAAO;IAE/B,UAAA,IAAO,YAAY,EAAO,YAAY,gBAAgB;GACjD,CAAA,CACL;;EAGN,UAAA,EAAO,gBAAgB,WAAW,IACjC,kBAAC,KAAD;GAAG,WAAU;GAA8B,UAAA;EAExC,CAAA,IAEH,kBAAC,YAAD;GAAU,WAAU;GAApB,UAAA,CACE,kBAAC,UAAD;IAAQ,WAAU;IAAlB,UAA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;MAH3C,UAAA,CAKE,kBAAC,GAAD;OAAa,WAAU;OAAU,eAAY;MAAQ,CAAA,GAAC,cAEhD;KACL,CAAA,CAAA;IACF,CAAA,CAAA;;GACJ,KAAW,CAAC,IACX,kBAAC,KAAD;IAAG,WAAU;IAA8B,UAAA;GAAW,CAAA,IACpD,IACF,kBAAC,KAAD;IAAG,WAAU;IAAb,UAAA,CAA2C,qCACP,EAAM,OACvC;GACD,CAAA,IAAA,EAAQ,WAAW,IACrB,kBAAC,KAAD;IACE,WAAU;IACV,eAAY;IACb,UAAA;GAGE,CAAA,IAEH,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,EAAQ,KAAK,MACZ,kBAAC,GAAD;KAEU;KACR,MAAM,MAAW,EAAO;KACxB,iBAAiB,EAAc,CAAM;KACrC,mBAAmB,EAAO,CAAM;IACjC,GALM,EAAO,EAKb,CACF;GACE,CAAA;GAEN,KACC,kBAAC,GAAD;IACE,QAAQ;IACR,MAAM,MAAW,EAAW;IAC5B,gBAAgB,EAAc,IAAI;IAClC,YAAY,MAAW,EAAe,GAAY,CAAM;GACzD,CAAA;EAEI;;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetDashboardPage.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/extend/WidgetDashboardPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WidgetDashboardPage.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/extend/WidgetDashboardPage.tsx"],"names":[],"mappings":"AAwUA,wBAAgB,mBAAmB,gCA0OlC"}
|