@burdenoff/microfe-timecampus 2026.1031.14 → 2026.1102.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 (54) hide show
  1. package/dist/generated/wspace-operations.d.ts +71 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +861 -817
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/index.js +7 -7
  6. package/dist/timecampus/TimeCampusRoot.d.ts.map +1 -1
  7. package/dist/timecampus/TimeCampusRoot.js +116 -96
  8. package/dist/timecampus/TimeCampusRoot.js.map +1 -1
  9. package/dist/timecampus/TimeCampusRoutes.d.ts.map +1 -1
  10. package/dist/timecampus/TimeCampusRoutes.js +22 -14
  11. package/dist/timecampus/TimeCampusRoutes.js.map +1 -1
  12. package/dist/timecampus/components/ToggleSwitch.d.ts +12 -0
  13. package/dist/timecampus/components/ToggleSwitch.d.ts.map +1 -0
  14. package/dist/timecampus/components/ToggleSwitch.js +19 -0
  15. package/dist/timecampus/components/ToggleSwitch.js.map +1 -0
  16. package/dist/timecampus/components/index.d.ts +1 -0
  17. package/dist/timecampus/components/index.d.ts.map +1 -1
  18. package/dist/timecampus/components/index.js +11 -10
  19. package/dist/timecampus/index.js +7 -7
  20. package/dist/timecampus/pages/dashboard/ServerReportExports.d.ts.map +1 -1
  21. package/dist/timecampus/pages/dashboard/ServerReportExports.js +99 -99
  22. package/dist/timecampus/pages/dashboard/ServerReportExports.js.map +1 -1
  23. package/dist/timecampus/pages/dashboard/reportTemplates.d.ts +8 -0
  24. package/dist/timecampus/pages/dashboard/reportTemplates.d.ts.map +1 -1
  25. package/dist/timecampus/pages/dashboard/reportTemplates.js +29 -19
  26. package/dist/timecampus/pages/dashboard/reportTemplates.js.map +1 -1
  27. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.d.ts.map +1 -1
  28. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js +147 -162
  29. package/dist/timecampus/pages/lifetime/PersonalCorporatePage.js.map +1 -1
  30. package/dist/timecampus/pages/settings/PrivacySettingsPage.d.ts +2 -0
  31. package/dist/timecampus/pages/settings/PrivacySettingsPage.d.ts.map +1 -0
  32. package/dist/timecampus/pages/settings/PrivacySettingsPage.js +268 -0
  33. package/dist/timecampus/pages/settings/PrivacySettingsPage.js.map +1 -0
  34. package/dist/timecampus/pages/settings/SettingsPage.d.ts +2 -0
  35. package/dist/timecampus/pages/settings/SettingsPage.d.ts.map +1 -0
  36. package/dist/timecampus/pages/settings/SettingsPage.js +175 -0
  37. package/dist/timecampus/pages/settings/SettingsPage.js.map +1 -0
  38. package/dist/timecampus/pages/settings/ThemePreferenceSync.d.ts +15 -0
  39. package/dist/timecampus/pages/settings/ThemePreferenceSync.d.ts.map +1 -0
  40. package/dist/timecampus/pages/settings/ThemePreferenceSync.js +80 -0
  41. package/dist/timecampus/pages/settings/ThemePreferenceSync.js.map +1 -0
  42. package/dist/timecampus/pages/settings/retention.d.ts +25 -0
  43. package/dist/timecampus/pages/settings/retention.d.ts.map +1 -0
  44. package/dist/timecampus/pages/settings/retention.js +34 -0
  45. package/dist/timecampus/pages/settings/retention.js.map +1 -0
  46. package/dist/timecampus/pages/settings/themePreference.d.ts +45 -0
  47. package/dist/timecampus/pages/settings/themePreference.d.ts.map +1 -0
  48. package/dist/timecampus/pages/settings/themePreference.js +49 -0
  49. package/dist/timecampus/pages/settings/themePreference.js.map +1 -0
  50. package/dist/timecampus/utils/helpers.d.ts +2 -0
  51. package/dist/timecampus/utils/helpers.d.ts.map +1 -1
  52. package/dist/timecampus/utils/helpers.js +5 -1
  53. package/dist/timecampus/utils/helpers.js.map +1 -1
  54. package/package.json +1 -1
@@ -0,0 +1,175 @@
1
+ import { useTimeCampus as e, useTimeCampusNavigate as t } from "../../providers/TimeCampusProvider.js";
2
+ import { cn as n } from "../../utils/helpers.js";
3
+ import { useMyThemePreferenceQuery as r } from "../../../generated/wspace-operations.js";
4
+ import { radioIndexForKey as i, tabStopIndex as a } from "./themePreference.js";
5
+ import { PageLayout as o } from "../../components/PageLayout.js";
6
+ import "../../components/index.js";
7
+ import { useRef as s } from "react";
8
+ import { ArrowUpRight as c, Check as l, Contrast as u, Monitor as d, Moon as f, Scale as p, ShieldCheck as m, Sun as h, Sunset as g, Timer as _, Trees as v, Waves as y } from "lucide-react";
9
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
10
+ import { GlassCard as S } from "@burdenoff/fe-libs/ui";
11
+ import { useThemeOrNull as C } from "@burdenoff/fe-libs/shared/providers/shell/ThemeProvider";
12
+ //#region src/timecampus/pages/settings/SettingsPage.tsx
13
+ var w = [
14
+ {
15
+ value: "system",
16
+ label: "System",
17
+ hint: "Follows your device's light or dark setting",
18
+ icon: /* @__PURE__ */ b(d, { className: "h-5 w-5" })
19
+ },
20
+ {
21
+ value: "light",
22
+ label: "Light",
23
+ hint: "Bright canvas for daytime work",
24
+ icon: /* @__PURE__ */ b(h, { className: "h-5 w-5" })
25
+ },
26
+ {
27
+ value: "dark",
28
+ label: "Dark",
29
+ hint: "Low-glare canvas for long sessions",
30
+ icon: /* @__PURE__ */ b(f, { className: "h-5 w-5" })
31
+ },
32
+ {
33
+ value: "forest",
34
+ label: "Forest",
35
+ hint: "Dark, with calm green accents",
36
+ icon: /* @__PURE__ */ b(v, { className: "h-5 w-5" })
37
+ },
38
+ {
39
+ value: "ocean",
40
+ label: "Ocean",
41
+ hint: "Dark, with cool blue accents",
42
+ icon: /* @__PURE__ */ b(y, { className: "h-5 w-5" })
43
+ },
44
+ {
45
+ value: "sunset",
46
+ label: "Sunset",
47
+ hint: "Dark, with warm amber accents",
48
+ icon: /* @__PURE__ */ b(g, { className: "h-5 w-5" })
49
+ },
50
+ {
51
+ value: "high-contrast",
52
+ label: "High contrast",
53
+ hint: "Maximum legibility",
54
+ icon: /* @__PURE__ */ b(u, { className: "h-5 w-5" })
55
+ }
56
+ ], T = [
57
+ {
58
+ path: "/settings/privacy",
59
+ label: "Privacy",
60
+ description: "Capture sources, on-device processing and how long captured activity is kept.",
61
+ icon: /* @__PURE__ */ b(m, { className: "h-5 w-5" })
62
+ },
63
+ {
64
+ path: "/personal-corporate",
65
+ label: "Personal & Corporate",
66
+ description: "Which aggregate wellbeing signals, if any, your workspace may see.",
67
+ icon: /* @__PURE__ */ b(p, { className: "h-5 w-5" })
68
+ },
69
+ {
70
+ path: "/pomodoro/settings",
71
+ label: "Pomodoro",
72
+ description: "Focus and break lengths for your Pomodoro sessions.",
73
+ icon: /* @__PURE__ */ b(_, { className: "h-5 w-5" })
74
+ }
75
+ ];
76
+ function E() {
77
+ let u = C(), { workspaceId: d } = e(), f = t(), { data: p, error: m } = r({ skip: !d }), h = u?.mode, g = s([]), _ = a(w.map((e) => e.value), h), v = (e) => {
78
+ if (!u) return;
79
+ let t = g.current.findIndex((t) => t === e.currentTarget), n = i(e.key, t, w.length);
80
+ n === null || t < 0 || (e.preventDefault(), u.setMode(w[n].value), g.current[n]?.focus());
81
+ }, y = p?.myLifeProfile.themePreference ?? null, E;
82
+ return E = u ? h === "custom" ? "A custom theme is active. Custom themes stay in the browser that made them; pick a theme below to use it on every device." : m ? "Your theme applies in this browser. We couldn't reach your profile to save it for other devices right now." : y && y === h ? "Saved to your TimeCampus profile, so it follows you to other devices." : "Your choice applies immediately and is saved to your profile." : "Theme controls are unavailable in this view.", /* @__PURE__ */ b(o, {
83
+ title: "Settings",
84
+ description: "Appearance and privacy for your TimeCampus account",
85
+ purpose: "Choose how TimeCampus looks and decide what it captures. Theme changes apply at once and follow you to any device you sign in on; privacy controls live one click away.",
86
+ children: /* @__PURE__ */ x("div", {
87
+ className: "grid grid-cols-1 gap-6 xl:grid-cols-3",
88
+ children: [/* @__PURE__ */ x(S, {
89
+ treatment: "glass",
90
+ className: "p-4 sm:p-6 xl:col-span-2",
91
+ children: [
92
+ /* @__PURE__ */ b("h2", {
93
+ className: "text-base font-semibold text-text-primary",
94
+ children: "Theme & appearance"
95
+ }),
96
+ /* @__PURE__ */ b("p", {
97
+ className: "mt-1 text-sm text-text-secondary",
98
+ children: E
99
+ }),
100
+ /* @__PURE__ */ b("div", {
101
+ role: "radiogroup",
102
+ "aria-label": "Theme",
103
+ className: "mt-4 grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",
104
+ children: w.map((e, t) => {
105
+ let r = h === e.value;
106
+ return /* @__PURE__ */ x("button", {
107
+ ref: (e) => {
108
+ g.current[t] = e;
109
+ },
110
+ type: "button",
111
+ role: "radio",
112
+ "aria-checked": r,
113
+ tabIndex: t === _ ? 0 : -1,
114
+ disabled: !u,
115
+ onClick: () => u?.setMode(e.value),
116
+ onKeyDown: v,
117
+ "data-testid": `theme-option-${e.value}`,
118
+ className: n("relative flex min-h-[96px] flex-col items-start gap-2 rounded-xl border p-3 text-left transition-colors", "focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50", r ? "border-action-primary-bg bg-action-primary-bg/10" : "border-border-subtle bg-bg-sunken/40 hover:bg-bg-sunken", !u && "cursor-not-allowed opacity-50"),
119
+ children: [
120
+ /* @__PURE__ */ b("span", {
121
+ className: n("flex h-9 w-9 items-center justify-center rounded-lg", r ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-surface text-text-secondary"),
122
+ children: e.icon
123
+ }),
124
+ /* @__PURE__ */ b("span", {
125
+ className: "text-sm font-medium text-text-primary",
126
+ children: e.label
127
+ }),
128
+ /* @__PURE__ */ b("span", {
129
+ className: "text-xs text-text-secondary",
130
+ children: e.hint
131
+ }),
132
+ r && /* @__PURE__ */ b(l, {
133
+ className: "absolute right-3 top-3 h-4 w-4 text-primary",
134
+ "aria-hidden": "true"
135
+ })
136
+ ]
137
+ }, e.value);
138
+ })
139
+ })
140
+ ]
141
+ }), /* @__PURE__ */ x(S, {
142
+ treatment: "glass",
143
+ className: "p-4 sm:p-6",
144
+ children: [/* @__PURE__ */ b("h2", {
145
+ className: "text-base font-semibold text-text-primary",
146
+ children: "More settings"
147
+ }), /* @__PURE__ */ b("ul", {
148
+ className: "mt-3 space-y-2",
149
+ children: T.map((e) => /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
150
+ type: "button",
151
+ onClick: () => f(e.path),
152
+ className: "flex w-full items-start gap-3 rounded-lg border border-border-subtle bg-bg-sunken/40 p-3 text-left transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50",
153
+ children: [/* @__PURE__ */ b("span", {
154
+ className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary",
155
+ children: e.icon
156
+ }), /* @__PURE__ */ x("span", {
157
+ className: "min-w-0 flex-1",
158
+ children: [/* @__PURE__ */ x("span", {
159
+ className: "flex items-center gap-1 text-sm font-medium text-text-primary",
160
+ children: [e.label, /* @__PURE__ */ b(c, { className: "h-3.5 w-3.5 text-text-muted" })]
161
+ }), /* @__PURE__ */ b("span", {
162
+ className: "mt-0.5 block text-xs text-text-secondary",
163
+ children: e.description
164
+ })]
165
+ })]
166
+ }) }, e.path))
167
+ })]
168
+ })]
169
+ })
170
+ });
171
+ }
172
+ //#endregion
173
+ export { E as SettingsPage };
174
+
175
+ //# sourceMappingURL=SettingsPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsPage.js","names":[],"sources":["../../../../src/timecampus/pages/settings/SettingsPage.tsx"],"sourcesContent":["import { useRef, type KeyboardEvent, type ReactNode } from \"react\";\nimport {\n ArrowUpRight,\n Check,\n Contrast,\n Monitor,\n Moon,\n ShieldCheck,\n Sun,\n Sunset,\n Timer,\n Trees,\n Waves,\n Scale,\n} from \"lucide-react\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { useThemeOrNull } from \"@burdenoff/fe-libs/shared/providers/shell/ThemeProvider\";\nimport { PageLayout } from \"../../components\";\nimport { cn } from \"../../utils/helpers\";\nimport {\n useTimeCampus,\n useTimeCampusNavigate,\n} from \"../../providers/TimeCampusProvider\";\nimport { useMyThemePreferenceQuery } from \"@/generated/wspace-operations\";\nimport {\n radioIndexForKey,\n tabStopIndex,\n type SyncableThemeMode,\n} from \"./themePreference\";\n\ninterface ThemeChoice {\n value: SyncableThemeMode;\n label: string;\n hint: string;\n icon: ReactNode;\n}\n\nconst THEME_CHOICES: ThemeChoice[] = [\n {\n value: \"system\",\n label: \"System\",\n hint: \"Follows your device's light or dark setting\",\n icon: <Monitor className=\"h-5 w-5\" />,\n },\n {\n value: \"light\",\n label: \"Light\",\n hint: \"Bright canvas for daytime work\",\n icon: <Sun className=\"h-5 w-5\" />,\n },\n {\n value: \"dark\",\n label: \"Dark\",\n hint: \"Low-glare canvas for long sessions\",\n icon: <Moon className=\"h-5 w-5\" />,\n },\n {\n value: \"forest\",\n label: \"Forest\",\n hint: \"Dark, with calm green accents\",\n icon: <Trees className=\"h-5 w-5\" />,\n },\n {\n value: \"ocean\",\n label: \"Ocean\",\n hint: \"Dark, with cool blue accents\",\n icon: <Waves className=\"h-5 w-5\" />,\n },\n {\n value: \"sunset\",\n label: \"Sunset\",\n hint: \"Dark, with warm amber accents\",\n icon: <Sunset className=\"h-5 w-5\" />,\n },\n {\n value: \"high-contrast\",\n label: \"High contrast\",\n hint: \"Maximum legibility\",\n icon: <Contrast className=\"h-5 w-5\" />,\n },\n];\n\ninterface SettingsLink {\n path: string;\n label: string;\n description: string;\n icon: ReactNode;\n}\n\nconst SETTINGS_LINKS: SettingsLink[] = [\n {\n path: \"/settings/privacy\",\n label: \"Privacy\",\n description:\n \"Capture sources, on-device processing and how long captured activity is kept.\",\n icon: <ShieldCheck className=\"h-5 w-5\" />,\n },\n {\n path: \"/personal-corporate\",\n label: \"Personal & Corporate\",\n description:\n \"Which aggregate wellbeing signals, if any, your workspace may see.\",\n icon: <Scale className=\"h-5 w-5\" />,\n },\n {\n path: \"/pomodoro/settings\",\n label: \"Pomodoro\",\n description: \"Focus and break lengths for your Pomodoro sessions.\",\n icon: <Timer className=\"h-5 w-5\" />,\n },\n];\n\nexport function SettingsPage() {\n const theme = useThemeOrNull();\n const { workspaceId } = useTimeCampus();\n const navigate = useTimeCampusNavigate();\n const { data, error } = useMyThemePreferenceQuery({ skip: !workspaceId });\n\n const activeMode = theme?.mode;\n const optionRefs = useRef<Array<HTMLButtonElement | null>>([]);\n const tabStop = tabStopIndex(\n THEME_CHOICES.map((choice) => choice.value),\n activeMode,\n );\n\n // Arrow keys move focus and the selection together, as in a native radio\n // group; only one option sits in the tab order.\n const onRadioKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (!theme) return;\n const current = optionRefs.current.findIndex(\n (el) => el === event.currentTarget,\n );\n const next = radioIndexForKey(event.key, current, THEME_CHOICES.length);\n if (next === null || current < 0) return;\n event.preventDefault();\n theme.setMode(THEME_CHOICES[next].value);\n optionRefs.current[next]?.focus();\n };\n\n const storedTheme = data?.myLifeProfile.themePreference ?? null;\n\n let syncNote: string;\n if (!theme) {\n syncNote = \"Theme controls are unavailable in this view.\";\n } else if (activeMode === \"custom\") {\n syncNote =\n \"A custom theme is active. Custom themes stay in the browser that made them; pick a theme below to use it on every device.\";\n } else if (error) {\n syncNote =\n \"Your theme applies in this browser. We couldn't reach your profile to save it for other devices right now.\";\n } else if (storedTheme && storedTheme === activeMode) {\n syncNote =\n \"Saved to your TimeCampus profile, so it follows you to other devices.\";\n } else {\n syncNote = \"Your choice applies immediately and is saved to your profile.\";\n }\n\n return (\n <PageLayout\n title=\"Settings\"\n description=\"Appearance and privacy for your TimeCampus account\"\n purpose=\"Choose how TimeCampus looks and decide what it captures. Theme changes apply at once and follow you to any device you sign in on; privacy controls live one click away.\"\n >\n <div className=\"grid grid-cols-1 gap-6 xl:grid-cols-3\">\n <GlassCard treatment=\"glass\" className=\"p-4 sm:p-6 xl:col-span-2\">\n <h2 className=\"text-base font-semibold text-text-primary\">\n Theme &amp; appearance\n </h2>\n <p className=\"mt-1 text-sm text-text-secondary\">{syncNote}</p>\n\n <div\n role=\"radiogroup\"\n aria-label=\"Theme\"\n className=\"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4\"\n >\n {THEME_CHOICES.map((choice, index) => {\n const selected = activeMode === choice.value;\n return (\n <button\n key={choice.value}\n ref={(el) => {\n optionRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n tabIndex={index === tabStop ? 0 : -1}\n disabled={!theme}\n onClick={() => theme?.setMode(choice.value)}\n onKeyDown={onRadioKeyDown}\n data-testid={`theme-option-${choice.value}`}\n className={cn(\n \"relative flex min-h-[96px] flex-col items-start gap-2 rounded-xl border p-3 text-left transition-colors\",\n \"focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50\",\n selected\n ? \"border-action-primary-bg bg-action-primary-bg/10\"\n : \"border-border-subtle bg-bg-sunken/40 hover:bg-bg-sunken\",\n !theme && \"cursor-not-allowed opacity-50\",\n )}\n >\n <span\n className={cn(\n \"flex h-9 w-9 items-center justify-center rounded-lg\",\n selected\n ? \"bg-action-primary-bg text-action-primary-text\"\n : \"bg-bg-surface text-text-secondary\",\n )}\n >\n {choice.icon}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">\n {choice.label}\n </span>\n <span className=\"text-xs text-text-secondary\">\n {choice.hint}\n </span>\n {selected && (\n <Check\n className=\"absolute right-3 top-3 h-4 w-4 text-primary\"\n aria-hidden=\"true\"\n />\n )}\n </button>\n );\n })}\n </div>\n </GlassCard>\n\n <GlassCard treatment=\"glass\" className=\"p-4 sm:p-6\">\n <h2 className=\"text-base font-semibold text-text-primary\">\n More settings\n </h2>\n <ul className=\"mt-3 space-y-2\">\n {SETTINGS_LINKS.map((link) => (\n <li key={link.path}>\n <button\n type=\"button\"\n onClick={() => navigate(link.path)}\n className=\"flex w-full items-start gap-3 rounded-lg border border-border-subtle bg-bg-sunken/40 p-3 text-left transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/50\"\n >\n <span className=\"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary\">\n {link.icon}\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"flex items-center gap-1 text-sm font-medium text-text-primary\">\n {link.label}\n <ArrowUpRight className=\"h-3.5 w-3.5 text-text-muted\" />\n </span>\n <span className=\"mt-0.5 block text-xs text-text-secondary\">\n {link.description}\n </span>\n </span>\n </button>\n </li>\n ))}\n </ul>\n </GlassCard>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAM,IAA+B;CACnC;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM,kBAAC,GAAD,EAAS,WAAU,UAAW,CAAA;CACtC;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM,kBAAC,GAAD,EAAK,WAAU,UAAW,CAAA;CAClC;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;CACnC;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CACpC;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CACpC;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA;CACrC;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;CACvC;AACF,GASM,IAAiC;CACrC;EACE,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM,kBAAC,GAAD,EAAa,WAAU,UAAW,CAAA;CAC1C;CACA;EACE,MAAM;EACN,OAAO;EACP,aACE;EACF,MAAM,kBAAC,GAAD,EAAO,WAAU,UAAW,CAAA;CACpC;CACA;EACE,MAAM;EACN,OAAO;EACP,aAAa;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
1
+ /**
2
+ * Keeps the shell theme and the theme stored on the user's TimeCampus profile
3
+ * in step (BOFF-4041). Renders nothing. Mounted once at the MFE root so the
4
+ * header's light/dark toggle is saved as well as the settings page's picker.
5
+ * See `themePreference.ts` for the rules.
6
+ *
7
+ * The sync state (whether the stored theme has been read, what was last
8
+ * saved) belongs to one profile. Each profile is per user and per workspace,
9
+ * so the synchroniser is remounted with fresh state whenever the signed-in
10
+ * user or the active workspace changes. Without that, a theme saved for one
11
+ * workspace would look "already saved" for the next one and the new
12
+ * profile's stored theme would never be applied.
13
+ */
14
+ export declare function ThemePreferenceSync(): import("react").JSX.Element;
15
+ //# sourceMappingURL=ThemePreferenceSync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemePreferenceSync.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/settings/ThemePreferenceSync.tsx"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,gCAIlC"}
@@ -0,0 +1,80 @@
1
+ import { useTimeCampus as e } from "../../providers/TimeCampusProvider.js";
2
+ import { useMyThemePreferenceQuery as t, useUpdateMyThemePreferenceMutation as n } from "../../../generated/wspace-operations.js";
3
+ import { hasLocalThemeChoice as r, isSyncableThemeMode as i, shouldSaveTheme as a, themeToApplyOnLoad as o } from "./themePreference.js";
4
+ import { useCallback as s, useEffect as c, useRef as l } from "react";
5
+ import { jsx as u } from "react/jsx-runtime";
6
+ import { useThemeOrNull as d } from "@burdenoff/fe-libs/shared/providers/shell/ThemeProvider";
7
+ //#region src/timecampus/pages/settings/ThemePreferenceSync.tsx
8
+ function f() {
9
+ try {
10
+ return typeof window > "u" ? null : window.localStorage;
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+ function p() {
16
+ let { workspaceId: t, currentUser: n } = e(), r = `${n?.id ?? ""}:${t ?? ""}`;
17
+ return /* @__PURE__ */ u(m, {}, r);
18
+ }
19
+ function m() {
20
+ let u = d(), { workspaceId: p } = e(), { data: m } = t({ skip: !p || !u }), [h] = n(), g = l(!1), _ = l(null), v = l(null), y = l(!1), b = l(null), x = m?.myLifeProfile, S = u?.mode, C = u?.setMode;
21
+ c(() => {
22
+ if (!x || g.current || !S || !C) return;
23
+ g.current = !0;
24
+ let e = x.themePreference ?? null, t = r(f()), n = o({
25
+ stored: e,
26
+ currentMode: S,
27
+ hasLocalChoice: t
28
+ });
29
+ if (n) {
30
+ _.current = n, v.current = n, C(n);
31
+ return;
32
+ }
33
+ _.current = e ?? (t || !i(S) ? null : S);
34
+ }, [
35
+ x,
36
+ S,
37
+ C
38
+ ]);
39
+ let w = s(async () => {
40
+ if (!y.current) {
41
+ y.current = !0;
42
+ try {
43
+ for (;;) {
44
+ let e = b.current;
45
+ if (!e) return;
46
+ let t = {
47
+ mode: e,
48
+ lastSaved: _.current
49
+ };
50
+ if (!a(t)) return;
51
+ try {
52
+ if ((await h({ variables: { themePreference: t.mode } })).error) return;
53
+ _.current = t.mode;
54
+ } catch {
55
+ return;
56
+ }
57
+ }
58
+ } finally {
59
+ y.current = !1;
60
+ }
61
+ }
62
+ }, [h]);
63
+ return c(() => {
64
+ if (!(!g.current || !S)) {
65
+ if (v.current) {
66
+ if (S !== v.current) return;
67
+ v.current = null;
68
+ }
69
+ i(S) && (b.current = S, w());
70
+ }
71
+ }, [
72
+ S,
73
+ x,
74
+ w
75
+ ]), null;
76
+ }
77
+ //#endregion
78
+ export { p as ThemePreferenceSync };
79
+
80
+ //# sourceMappingURL=ThemePreferenceSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemePreferenceSync.js","names":[],"sources":["../../../../src/timecampus/pages/settings/ThemePreferenceSync.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef } from \"react\";\nimport { useThemeOrNull } from \"@burdenoff/fe-libs/shared/providers/shell/ThemeProvider\";\nimport { useTimeCampus } from \"../../providers/TimeCampusProvider\";\nimport {\n useMyThemePreferenceQuery,\n useUpdateMyThemePreferenceMutation,\n} from \"@/generated/wspace-operations\";\nimport {\n hasLocalThemeChoice,\n isSyncableThemeMode,\n shouldSaveTheme,\n themeToApplyOnLoad,\n type SyncableThemeMode,\n type ThemeStorage,\n} from \"./themePreference\";\n\nfunction browserStorage(): ThemeStorage | null {\n try {\n return typeof window === \"undefined\" ? null : window.localStorage;\n } catch {\n return null;\n }\n}\n\n/**\n * Keeps the shell theme and the theme stored on the user's TimeCampus profile\n * in step (BOFF-4041). Renders nothing. Mounted once at the MFE root so the\n * header's light/dark toggle is saved as well as the settings page's picker.\n * See `themePreference.ts` for the rules.\n *\n * The sync state (whether the stored theme has been read, what was last\n * saved) belongs to one profile. Each profile is per user and per workspace,\n * so the synchroniser is remounted with fresh state whenever the signed-in\n * user or the active workspace changes. Without that, a theme saved for one\n * workspace would look \"already saved\" for the next one and the new\n * profile's stored theme would never be applied.\n */\nexport function ThemePreferenceSync() {\n const { workspaceId, currentUser } = useTimeCampus();\n const identity = `${currentUser?.id ?? \"\"}:${workspaceId ?? \"\"}`;\n return <ProfileThemeSync key={identity} />;\n}\n\nfunction ProfileThemeSync() {\n const theme = useThemeOrNull();\n const { workspaceId } = useTimeCampus();\n const { data } = useMyThemePreferenceQuery({\n skip: !workspaceId || !theme,\n });\n const [saveTheme] = useUpdateMyThemePreferenceMutation();\n\n const initialised = useRef(false);\n const lastSaved = useRef<string | null>(null);\n // A stored theme being applied: ignore the stale mode until it lands.\n const applying = useRef<string | null>(null);\n const saving = useRef(false);\n const wanted = useRef<SyncableThemeMode | null>(null);\n\n const profile = data?.myLifeProfile;\n const mode = theme?.mode;\n const setMode = theme?.setMode;\n\n useEffect(() => {\n if (!profile || initialised.current || !mode || !setMode) return;\n initialised.current = true;\n const stored = profile.themePreference ?? null;\n const hasLocalChoice = hasLocalThemeChoice(browserStorage());\n const apply = themeToApplyOnLoad({\n stored,\n currentMode: mode,\n hasLocalChoice,\n });\n if (apply) {\n lastSaved.current = apply;\n applying.current = apply;\n setMode(apply);\n return;\n }\n // No choice anywhere yet: the default theme is not a choice to save.\n lastSaved.current =\n stored ?? (hasLocalChoice || !isSyncableThemeMode(mode) ? null : mode);\n }, [profile, mode, setMode]);\n\n // Saves run one at a time: a choice made while a save is in flight is\n // written after it, so the profile always ends on the latest selection.\n const flush = useCallback(async () => {\n if (saving.current) return;\n saving.current = true;\n try {\n for (;;) {\n const target = wanted.current;\n if (!target) return;\n const next = { mode: target, lastSaved: lastSaved.current };\n if (!shouldSaveTheme(next)) return;\n try {\n const res = await saveTheme({\n variables: { themePreference: next.mode },\n });\n if (res.error) return;\n lastSaved.current = next.mode;\n } catch {\n // Not saved: the next change retries. The local theme still applies.\n return;\n }\n }\n } finally {\n saving.current = false;\n }\n }, [saveTheme]);\n\n useEffect(() => {\n if (!initialised.current || !mode) return;\n if (applying.current) {\n if (mode !== applying.current) return;\n applying.current = null;\n }\n if (!isSyncableThemeMode(mode)) return;\n wanted.current = mode;\n void flush();\n }, [mode, profile, flush]);\n\n return null;\n}\n"],"mappings":";;;;;;;AAgBA,SAAS,IAAsC;CAC7C,IAAI;EACF,OAAO,OAAO,SAAW,MAAc,OAAO,OAAO;CACvD,QAAQ;EACN,OAAO;CACT;AACF;AAeA,SAAgB,IAAsB;CACpC,IAAM,EAAE,gBAAa,mBAAgB,EAAc,GAC7C,IAAW,GAAG,GAAa,MAAM,GAAG,GAAG,KAAe;CAC5D,OAAO,kBAAC,GAAD,CAAkC,GAAX,CAAW;AAC3C;AAEA,SAAS,IAAmB;CAC1B,IAAM,IAAQ,EAAe,GACvB,EAAE,mBAAgB,EAAc,GAChC,EAAE,YAAS,EAA0B,EACzC,MAAM,CAAC,KAAe,CAAC,EACzB,CAAC,GACK,CAAC,KAAa,EAAmC,GAEjD,IAAc,EAAO,EAAK,GAC1B,IAAY,EAAsB,IAAI,GAEtC,IAAW,EAAsB,IAAI,GACrC,IAAS,EAAO,EAAK,GACrB,IAAS,EAAiC,IAAI,GAE9C,IAAU,GAAM,eAChB,IAAO,GAAO,MACd,IAAU,GAAO;CAEvB,QAAgB;EACd,IAAI,CAAC,KAAW,EAAY,WAAW,CAAC,KAAQ,CAAC,GAAS;EAC1D,EAAY,UAAU;EACtB,IAAM,IAAS,EAAQ,mBAAmB,MACpC,IAAiB,EAAoB,EAAe,CAAC,GACrD,IAAQ,EAAmB;GAC/B;GACA,aAAa;GACb;EACF,CAAC;EACD,IAAI,GAAO;GAGT,AAFA,EAAU,UAAU,GACpB,EAAS,UAAU,GACnB,EAAQ,CAAK;GACb;EACF;EAEA,EAAU,UACR,MAAW,KAAkB,CAAC,EAAoB,CAAI,IAAI,OAAO;CACrE,GAAG;EAAC;EAAS;EAAM;CAAO,CAAC;CAI3B,IAAM,IAAQ,EAAY,YAAY;EAChC,OAAO,SACX;KAAO,UAAU;GACjB,IAAI;IACF,SAAS;KACP,IAAM,IAAS,EAAO;KACtB,IAAI,CAAC,GAAQ;KACb,IAAM,IAAO;MAAE,MAAM;MAAQ,WAAW,EAAU;KAAQ;KAC1D,IAAI,CAAC,EAAgB,CAAI,GAAG;KAC5B,IAAI;MAIF,KAAI,MAHc,EAAU,EAC1B,WAAW,EAAE,iBAAiB,EAAK,KAAK,EAC1C,CAAC,EAAA,CACO,OAAO;MACf,EAAU,UAAU,EAAK;KAC3B,QAAQ;MAEN;KACF;IACF;GACF,UAAU;IACR,EAAO,UAAU;GACnB;EApBiB;CAqBnB,GAAG,CAAC,CAAS,CAAC;CAad,OAXA,QAAgB;EACV,OAAC,EAAY,WAAW,CAAC,IAC7B;OAAI,EAAS,SAAS;IACpB,IAAI,MAAS,EAAS,SAAS;IAC/B,EAAS,UAAU;GACrB;GACK,EAAoB,CAAI,MAC7B,EAAO,UAAU,GACjB,EAAW;EAHX;CAIF,GAAG;EAAC;EAAM;EAAS;CAAK,CAAC,GAElB;AACT"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Retention-window choices for the privacy settings page (BOFF-4041).
3
+ *
4
+ * A source's `retentionDays` is the user's instruction to delete captured
5
+ * activity older than that many days; the service purges past it every few
6
+ * hours. `null` means no shorter window: activity is kept for the subscription
7
+ * term, the default in the Data Processing Addendum.
8
+ */
9
+ export interface RetentionOption {
10
+ /** The `<select>` value: a day count, or "keep" for no window. */
11
+ value: string;
12
+ days: number | null;
13
+ label: string;
14
+ }
15
+ export declare const KEEP_VALUE = "keep";
16
+ export declare function retentionLabel(days: number | null): string;
17
+ /**
18
+ * The options to offer, including the current value when it is not a preset
19
+ * (a window set from the API or the CLI), so the select never misreports it.
20
+ */
21
+ export declare function retentionOptions(current: number | null): RetentionOption[];
22
+ export declare function retentionValue(days: number | null): string;
23
+ /** Parse a `<select>` value back to the `retentionDays` to send. */
24
+ export declare function parseRetentionValue(value: string): number | null;
25
+ //# sourceMappingURL=retention.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/settings/retention.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,UAAU,SAAS,CAAC;AAIjC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAK1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,EAAE,CAc1E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE1D;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIhE"}
@@ -0,0 +1,34 @@
1
+ //#region src/timecampus/pages/settings/retention.ts
2
+ var e = "keep", t = [
3
+ 30,
4
+ 90,
5
+ 180,
6
+ 365
7
+ ];
8
+ function n(e) {
9
+ return e == null ? "Until I delete it" : e === 365 ? "1 year" : e % 365 == 0 ? `${e / 365} years` : e === 1 ? "1 day" : `${e} days`;
10
+ }
11
+ function r(r) {
12
+ let i = [...t];
13
+ return r != null && r > 0 && !i.includes(r) && (i.push(r), i.sort((e, t) => e - t)), [{
14
+ value: e,
15
+ days: null,
16
+ label: n(null)
17
+ }, ...i.map((e) => ({
18
+ value: String(e),
19
+ days: e,
20
+ label: n(e)
21
+ }))];
22
+ }
23
+ function i(t) {
24
+ return t == null || t <= 0 ? e : String(t);
25
+ }
26
+ function a(e) {
27
+ if (e === "keep") return null;
28
+ let t = Number.parseInt(e, 10);
29
+ return Number.isFinite(t) && t > 0 ? t : null;
30
+ }
31
+ //#endregion
32
+ export { e as KEEP_VALUE, a as parseRetentionValue, n as retentionLabel, r as retentionOptions, i as retentionValue };
33
+
34
+ //# sourceMappingURL=retention.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retention.js","names":[],"sources":["../../../../src/timecampus/pages/settings/retention.ts"],"sourcesContent":["/**\n * Retention-window choices for the privacy settings page (BOFF-4041).\n *\n * A source's `retentionDays` is the user's instruction to delete captured\n * activity older than that many days; the service purges past it every few\n * hours. `null` means no shorter window: activity is kept for the subscription\n * term, the default in the Data Processing Addendum.\n */\n\nexport interface RetentionOption {\n /** The `<select>` value: a day count, or \"keep\" for no window. */\n value: string;\n days: number | null;\n label: string;\n}\n\nexport const KEEP_VALUE = \"keep\";\n\nconst PRESET_DAYS = [30, 90, 180, 365] as const;\n\nexport function retentionLabel(days: number | null): string {\n if (days == null) return \"Until I delete it\";\n if (days === 365) return \"1 year\";\n if (days % 365 === 0) return `${days / 365} years`;\n return days === 1 ? \"1 day\" : `${days} days`;\n}\n\n/**\n * The options to offer, including the current value when it is not a preset\n * (a window set from the API or the CLI), so the select never misreports it.\n */\nexport function retentionOptions(current: number | null): RetentionOption[] {\n const days: Array<number> = [...PRESET_DAYS];\n if (current != null && current > 0 && !days.includes(current)) {\n days.push(current);\n days.sort((a, b) => a - b);\n }\n return [\n { value: KEEP_VALUE, days: null, label: retentionLabel(null) },\n ...days.map((d) => ({\n value: String(d),\n days: d,\n label: retentionLabel(d),\n })),\n ];\n}\n\nexport function retentionValue(days: number | null): string {\n return days == null || days <= 0 ? KEEP_VALUE : String(days);\n}\n\n/** Parse a `<select>` value back to the `retentionDays` to send. */\nexport function parseRetentionValue(value: string): number | null {\n if (value === KEEP_VALUE) return null;\n const days = Number.parseInt(value, 10);\n return Number.isFinite(days) && days > 0 ? days : null;\n}\n"],"mappings":";AAgBA,IAAa,IAAa,QAEpB,IAAc;CAAC;CAAI;CAAI;CAAK;AAAG;AAErC,SAAgB,EAAe,GAA6B;CAI1D,OAHI,KAAQ,OAAa,sBACrB,MAAS,MAAY,WACrB,IAAO,OAAQ,IAAU,GAAG,IAAO,IAAI,UACpC,MAAS,IAAI,UAAU,GAAG,EAAK;AACxC;AAMA,SAAgB,EAAiB,GAA2C;CAC1E,IAAM,IAAsB,CAAC,GAAG,CAAW;CAK3C,OAJI,KAAW,QAAQ,IAAU,KAAK,CAAC,EAAK,SAAS,CAAO,MAC1D,EAAK,KAAK,CAAO,GACjB,EAAK,MAAM,GAAG,MAAM,IAAI,CAAC,IAEpB,CACL;EAAE,OAAO;EAAY,MAAM;EAAM,OAAO,EAAe,IAAI;CAAE,GAC7D,GAAG,EAAK,KAAK,OAAO;EAClB,OAAO,OAAO,CAAC;EACf,MAAM;EACN,OAAO,EAAe,CAAC;CACzB,EAAE,CACJ;AACF;AAEA,SAAgB,EAAe,GAA6B;CAC1D,OAAO,KAAQ,QAAQ,KAAQ,IAAI,IAAa,OAAO,CAAI;AAC7D;AAGA,SAAgB,EAAoB,GAA8B;CAChE,IAAI,MAAA,QAAsB,OAAO;CACjC,IAAM,IAAO,OAAO,SAAS,GAAO,EAAE;CACtC,OAAO,OAAO,SAAS,CAAI,KAAK,IAAO,IAAI,IAAO;AACpD"}
@@ -0,0 +1,45 @@
1
+ import { ThemeMode } from '@burdenoff/fe-libs/shared/providers/shell/ThemeProvider';
2
+ /** The modes the profile can hold. Mirrors the service's allow-list. */
3
+ export declare const SYNCABLE_THEME_MODES: readonly ["system", "light", "dark", "forest", "ocean", "sunset", "high-contrast"];
4
+ export type SyncableThemeMode = (typeof SYNCABLE_THEME_MODES)[number];
5
+ export declare function isSyncableThemeMode(value: string | null | undefined): value is SyncableThemeMode;
6
+ /**
7
+ * The localStorage key the shell's ThemeProvider writes the mode to. TimeCampus
8
+ * uses the provider's default storage key (`burdenoff-theme`).
9
+ */
10
+ export declare const THEME_MODE_STORAGE_KEY = "burdenoff-theme-mode";
11
+ /** Minimal storage surface, so tests can pass a fake. */
12
+ export interface ThemeStorage {
13
+ getItem: (key: string) => string | null;
14
+ }
15
+ /** True when this browser already holds an explicit theme choice. */
16
+ export declare function hasLocalThemeChoice(storage: ThemeStorage | null): boolean;
17
+ /**
18
+ * The mode to apply when the stored profile value first arrives, or null to
19
+ * leave the current theme alone.
20
+ */
21
+ export declare function themeToApplyOnLoad(input: {
22
+ stored: string | null | undefined;
23
+ currentMode: ThemeMode;
24
+ hasLocalChoice: boolean;
25
+ }): SyncableThemeMode | null;
26
+ /** True when a theme change should be written to the profile. */
27
+ export declare function shouldSaveTheme(input: {
28
+ mode: ThemeMode;
29
+ lastSaved: string | null | undefined;
30
+ }): input is {
31
+ mode: SyncableThemeMode;
32
+ lastSaved: string | null | undefined;
33
+ };
34
+ /**
35
+ * Roving focus for the theme radio group (WAI-ARIA radio group pattern).
36
+ *
37
+ * `tabStopIndex` is the one option that sits in the tab order: the selected
38
+ * option, or the first one when the active mode is not in the list (for
39
+ * example a custom theme). `radioIndexForKey` returns the option an arrow,
40
+ * Home or End key moves to (wrapping at both ends), or null for any other
41
+ * key so the browser keeps its default behaviour.
42
+ */
43
+ export declare function tabStopIndex(options: ReadonlyArray<string>, activeMode: string | null | undefined): number;
44
+ export declare function radioIndexForKey(key: string, current: number, count: number): number | null;
45
+ //# sourceMappingURL=themePreference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themePreference.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/settings/themePreference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AAEzF,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,oFAQY,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,KAAK,IAAI,iBAAiB,CAK5B;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAE7D,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACzC;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,GAAG,OAAO,CAQzE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,WAAW,EAAE,SAAS,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;CACzB,GAAG,iBAAiB,GAAG,IAAI,CAK3B;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtC,GAAG,KAAK,IAAI;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,CAE7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACpC,MAAM,CAGR;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,IAAI,CAgBf"}
@@ -0,0 +1,49 @@
1
+ //#region src/timecampus/pages/settings/themePreference.ts
2
+ var e = [
3
+ "system",
4
+ "light",
5
+ "dark",
6
+ "forest",
7
+ "ocean",
8
+ "sunset",
9
+ "high-contrast"
10
+ ];
11
+ function t(t) {
12
+ return t != null && e.includes(t);
13
+ }
14
+ var n = "burdenoff-theme-mode";
15
+ function r(e) {
16
+ if (!e) return !1;
17
+ try {
18
+ return !!e.getItem(n);
19
+ } catch {
20
+ return !1;
21
+ }
22
+ }
23
+ function i(e) {
24
+ let { stored: n, currentMode: r, hasLocalChoice: i } = e;
25
+ return i || !t(n) || n === r ? null : n;
26
+ }
27
+ function a(e) {
28
+ return t(e.mode) && e.mode !== e.lastSaved;
29
+ }
30
+ function o(e, t) {
31
+ let n = t ? e.indexOf(t) : -1;
32
+ return n >= 0 ? n : 0;
33
+ }
34
+ function s(e, t, n) {
35
+ if (n <= 0) return null;
36
+ switch (e) {
37
+ case "ArrowRight":
38
+ case "ArrowDown": return (t + 1) % n;
39
+ case "ArrowLeft":
40
+ case "ArrowUp": return (t - 1 + n) % n;
41
+ case "Home": return 0;
42
+ case "End": return n - 1;
43
+ default: return null;
44
+ }
45
+ }
46
+ //#endregion
47
+ export { e as SYNCABLE_THEME_MODES, n as THEME_MODE_STORAGE_KEY, r as hasLocalThemeChoice, t as isSyncableThemeMode, s as radioIndexForKey, a as shouldSaveTheme, o as tabStopIndex, i as themeToApplyOnLoad };
48
+
49
+ //# sourceMappingURL=themePreference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themePreference.js","names":[],"sources":["../../../../src/timecampus/pages/settings/themePreference.ts"],"sourcesContent":["/**\n * Theme preference rules for the TimeCampus settings page (BOFF-4041).\n *\n * The shell's ThemeProvider keeps the active theme in this browser's\n * localStorage. The settings page also stores it on the user's TimeCampus\n * profile, so a fresh browser (a new device, a cleared profile) picks the\n * user's theme up again. The rules:\n *\n * - A choice already made in this browser wins: the stored profile value only\n * seeds a browser that has no theme choice of its own.\n * - After that, every theme change (from the settings page or the header's\n * light/dark toggle) is saved to the profile, so the two stay in step.\n * - `custom` themes are never stored: they live only in the browser that\n * designed them and would resolve to nothing elsewhere.\n */\nimport type { ThemeMode } from \"@burdenoff/fe-libs/shared/providers/shell/ThemeProvider\";\n\n/** The modes the profile can hold. Mirrors the service's allow-list. */\nexport const SYNCABLE_THEME_MODES = [\n \"system\",\n \"light\",\n \"dark\",\n \"forest\",\n \"ocean\",\n \"sunset\",\n \"high-contrast\",\n] as const satisfies ReadonlyArray<ThemeMode>;\n\nexport type SyncableThemeMode = (typeof SYNCABLE_THEME_MODES)[number];\n\nexport function isSyncableThemeMode(\n value: string | null | undefined,\n): value is SyncableThemeMode {\n return (\n value != null &&\n (SYNCABLE_THEME_MODES as ReadonlyArray<string>).includes(value)\n );\n}\n\n/**\n * The localStorage key the shell's ThemeProvider writes the mode to. TimeCampus\n * uses the provider's default storage key (`burdenoff-theme`).\n */\nexport const THEME_MODE_STORAGE_KEY = \"burdenoff-theme-mode\";\n\n/** Minimal storage surface, so tests can pass a fake. */\nexport interface ThemeStorage {\n getItem: (key: string) => string | null;\n}\n\n/** True when this browser already holds an explicit theme choice. */\nexport function hasLocalThemeChoice(storage: ThemeStorage | null): boolean {\n if (!storage) return false;\n try {\n return Boolean(storage.getItem(THEME_MODE_STORAGE_KEY));\n } catch {\n // Storage can throw in private windows or with site data blocked.\n return false;\n }\n}\n\n/**\n * The mode to apply when the stored profile value first arrives, or null to\n * leave the current theme alone.\n */\nexport function themeToApplyOnLoad(input: {\n stored: string | null | undefined;\n currentMode: ThemeMode;\n hasLocalChoice: boolean;\n}): SyncableThemeMode | null {\n const { stored, currentMode, hasLocalChoice } = input;\n if (hasLocalChoice) return null;\n if (!isSyncableThemeMode(stored)) return null;\n return stored === currentMode ? null : stored;\n}\n\n/** True when a theme change should be written to the profile. */\nexport function shouldSaveTheme(input: {\n mode: ThemeMode;\n lastSaved: string | null | undefined;\n}): input is { mode: SyncableThemeMode; lastSaved: string | null | undefined } {\n return isSyncableThemeMode(input.mode) && input.mode !== input.lastSaved;\n}\n\n/**\n * Roving focus for the theme radio group (WAI-ARIA radio group pattern).\n *\n * `tabStopIndex` is the one option that sits in the tab order: the selected\n * option, or the first one when the active mode is not in the list (for\n * example a custom theme). `radioIndexForKey` returns the option an arrow,\n * Home or End key moves to (wrapping at both ends), or null for any other\n * key so the browser keeps its default behaviour.\n */\nexport function tabStopIndex(\n options: ReadonlyArray<string>,\n activeMode: string | null | undefined,\n): number {\n const index = activeMode ? options.indexOf(activeMode) : -1;\n return index >= 0 ? index : 0;\n}\n\nexport function radioIndexForKey(\n key: string,\n current: number,\n count: number,\n): number | null {\n if (count <= 0) return null;\n switch (key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n return (current + 1) % count;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n return (current - 1 + count) % count;\n case \"Home\":\n return 0;\n case \"End\":\n return count - 1;\n default:\n return null;\n }\n}\n"],"mappings":";AAkBA,IAAa,IAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,SAAgB,EACd,GAC4B;CAC5B,OACE,KAAS,QACR,EAA+C,SAAS,CAAK;AAElE;AAMA,IAAa,IAAyB;AAQtC,SAAgB,EAAoB,GAAuC;CACzE,IAAI,CAAC,GAAS,OAAO;CACrB,IAAI;EACF,OAAO,EAAQ,EAAQ,QAAQ,CAAsB;CACvD,QAAQ;EAEN,OAAO;CACT;AACF;AAMA,SAAgB,EAAmB,GAIN;CAC3B,IAAM,EAAE,WAAQ,gBAAa,sBAAmB;CAGhD,OAFI,KACA,CAAC,EAAoB,CAAM,KACxB,MAAW,IADuB,OACF;AACzC;AAGA,SAAgB,EAAgB,GAG+C;CAC7E,OAAO,EAAoB,EAAM,IAAI,KAAK,EAAM,SAAS,EAAM;AACjE;AAWA,SAAgB,EACd,GACA,GACQ;CACR,IAAM,IAAQ,IAAa,EAAQ,QAAQ,CAAU,IAAI;CACzD,OAAO,KAAS,IAAI,IAAQ;AAC9B;AAEA,SAAgB,EACd,GACA,GACA,GACe;CACf,IAAI,KAAS,GAAG,OAAO;CACvB,QAAQ,GAAR;EACE,KAAK;EACL,KAAK,aACH,QAAQ,IAAU,KAAK;EACzB,KAAK;EACL,KAAK,WACH,QAAQ,IAAU,IAAI,KAAS;EACjC,KAAK,QACH,OAAO;EACT,KAAK,OACH,OAAO,IAAQ;EACjB,SACE,OAAO;CACX;AACF"}
@@ -15,4 +15,6 @@ export declare function generateId(): string;
15
15
  export declare function sleep(ms: number): Promise<void>;
16
16
  export declare function getStatusColor(status: string): BadgeVariant;
17
17
  export declare function getPriorityColor(priority: string): BadgeVariant;
18
+ /** Turn a raw token like "GOOGLE_CALENDAR" or "onDevice" into prose. */
19
+ export declare function humanizeToken(raw: string): string;
18
20
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/timecampus/utils/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,MAAM,MAAM,YAAY,GACtB,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOtD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,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AAG,MAAM,CAIjD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,MAAM,CAIvE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAMtD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAKtD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAY9D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CA4B3D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAS/D;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOjD"}
@@ -82,7 +82,11 @@ function p(e) {
82
82
  critical: "error"
83
83
  }[e] || "default";
84
84
  }
85
+ function m(e) {
86
+ let t = e.replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().toLowerCase();
87
+ return t.charAt(0).toUpperCase() + t.slice(1);
88
+ }
85
89
  //#endregion
86
- export { n as cn, o as formatCurrency, c as formatDate, r as formatDuration, i as formatHours, s as formatNumber, u as formatRelativeTime, l as formatTime, a as formatTimerDuration, d as getInitials, p as getPriorityColor, f as getStatusColor };
90
+ export { n as cn, o as formatCurrency, c as formatDate, r as formatDuration, i as formatHours, s as formatNumber, u as formatRelativeTime, l as formatTime, a as formatTimerDuration, d as getInitials, p as getPriorityColor, f as getStatusColor, m as humanizeToken };
87
91
 
88
92
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":[],"sources":["../../../src/timecampus/utils/helpers.ts"],"sourcesContent":["/**\n * TimeCampus Utility Helpers\n * Common formatting, styling, and utility functions.\n * @module timecampus\n */\n\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport type BadgeVariant =\n \"success\" | \"warning\" | \"error\" | \"info\" | \"default\" | \"muted\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport function formatDuration(seconds: number): string {\n const h = Math.floor(seconds / 3600);\n const m = Math.floor((seconds % 3600) / 60);\n const s = seconds % 60;\n if (h > 0) return `${h}h ${m}m ${s}s`;\n if (m > 0) return `${m}m ${s}s`;\n return `${s}s`;\n}\n\nexport function formatHours(hours: number): string {\n const h = Math.floor(hours);\n const m = Math.round((hours - h) * 60);\n return `${h}h ${m}m`;\n}\n\nexport function formatTimerDuration(seconds: number): string {\n const h = Math.floor(seconds / 3600);\n const m = Math.floor((seconds % 3600) / 60);\n const s = seconds % 60;\n return `${String(h).padStart(2, \"0\")}:${String(m).padStart(2, \"0\")}:${String(s).padStart(2, \"0\")}`;\n}\n\nexport function formatCurrency(amount: number, currency = \"USD\"): string {\n return new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency }).format(\n amount,\n );\n}\n\nexport function formatNumber(num: number): string {\n return new Intl.NumberFormat(\"en-US\").format(num);\n}\n\nexport function formatDate(date: string | Date): string {\n return new Date(date).toLocaleDateString(\"en-US\", {\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n });\n}\n\nexport function formatTime(date: string | Date): string {\n return new Date(date).toLocaleTimeString(\"en-US\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n}\n\nexport function formatRelativeTime(date: string | Date): string {\n const now = new Date();\n const d = new Date(date);\n const diffMs = now.getTime() - d.getTime();\n const diffMins = Math.floor(diffMs / 60000);\n const diffHours = Math.floor(diffMs / 3600000);\n const diffDays = Math.floor(diffMs / 86400000);\n if (diffMins < 1) return \"Just now\";\n if (diffMins < 60) return `${diffMins}m ago`;\n if (diffHours < 24) return `${diffHours}h ago`;\n if (diffDays < 7) return `${diffDays}d ago`;\n return formatDate(date);\n}\n\nexport function getInitials(name: string): string {\n return name\n .split(\" \")\n .map((n) => n[0])\n .join(\"\")\n .toUpperCase()\n .slice(0, 2);\n}\n\nexport function truncateText(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text;\n return text.slice(0, maxLength) + \"...\";\n}\n\nexport function generateId(): string {\n return Math.random().toString(36).substring(2) + Date.now().toString(36);\n}\n\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function getStatusColor(status: string): BadgeVariant {\n const colors: Record<string, BadgeVariant> = {\n active: \"success\",\n completed: \"info\",\n \"in-progress\": \"warning\",\n pending: \"warning\",\n archived: \"muted\",\n \"on-hold\": \"warning\",\n draft: \"muted\",\n approved: \"success\",\n rejected: \"error\",\n error: \"error\",\n running: \"success\",\n paused: \"warning\",\n cancelled: \"muted\",\n online: \"success\",\n away: \"warning\",\n busy: \"error\",\n offline: \"muted\",\n inactive: \"muted\",\n submitted: \"info\",\n reimbursed: \"success\",\n \"revision-requested\": \"warning\",\n flagged: \"error\",\n sent: \"info\",\n paid: \"success\",\n };\n return colors[status] || \"default\";\n}\n\nexport function getPriorityColor(priority: string): BadgeVariant {\n const colors: Record<string, BadgeVariant> = {\n low: \"info\",\n medium: \"warning\",\n high: \"warning\",\n urgent: \"error\",\n critical: \"error\",\n };\n return colors[priority] || \"default\";\n}\n"],"mappings":";;;AAYA,SAAgB,EAA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,CAAC;AACH;AAEA,SAAgB,EAAmB,GAA6B;CAC9D,IAAM,oBAAM,IAAI,KAAK,GACf,IAAI,IAAI,KAAK,CAAI,GACjB,IAAS,EAAI,QAAQ,IAAI,EAAE,QAAQ,GACnC,IAAW,KAAK,MAAM,IAAS,GAAK,GACpC,IAAY,KAAK,MAAM,IAAS,IAAO,GACvC,IAAW,KAAK,MAAM,IAAS,KAAQ;CAK7C,OAJI,IAAW,IAAU,aACrB,IAAW,KAAW,GAAG,EAAS,SAClC,IAAY,KAAW,GAAG,EAAU,SACpC,IAAW,IAAU,GAAG,EAAS,SAC9B,EAAW,CAAI;AACxB;AAEA,SAAgB,EAAY,GAAsB;CAChD,OAAO,EACJ,MAAM,GAAG,CAAC,CACV,KAAK,MAAM,EAAE,EAAE,CAAC,CAChB,KAAK,EAAE,CAAC,CACR,YAAY,CAAC,CACb,MAAM,GAAG,CAAC;AACf;AAeA,SAAgB,EAAe,GAA8B;CA2B3D,OAAO;EAzBL,QAAQ;EACR,WAAW;EACX,eAAe;EACf,SAAS;EACT,UAAU;EACV,WAAW;EACX,OAAO;EACP,UAAU;EACV,UAAU;EACV,OAAO;EACP,SAAS;EACT,QAAQ;EACR,WAAW;EACX,QAAQ;EACR,MAAM;EACN,MAAM;EACN,SAAS;EACT,UAAU;EACV,WAAW;EACX,YAAY;EACZ,sBAAsB;EACtB,SAAS;EACT,MAAM;EACN,MAAM;CAED,EAAO,MAAW;AAC3B;AAEA,SAAgB,EAAiB,GAAgC;CAQ/D,OAAO;EANL,KAAK;EACL,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,UAAU;CAEL,EAAO,MAAa;AAC7B"}
1
+ {"version":3,"file":"helpers.js","names":[],"sources":["../../../src/timecampus/utils/helpers.ts"],"sourcesContent":["/**\n * TimeCampus Utility Helpers\n * Common formatting, styling, and utility functions.\n * @module timecampus\n */\n\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport type BadgeVariant =\n \"success\" | \"warning\" | \"error\" | \"info\" | \"default\" | \"muted\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport function formatDuration(seconds: number): string {\n const h = Math.floor(seconds / 3600);\n const m = Math.floor((seconds % 3600) / 60);\n const s = seconds % 60;\n if (h > 0) return `${h}h ${m}m ${s}s`;\n if (m > 0) return `${m}m ${s}s`;\n return `${s}s`;\n}\n\nexport function formatHours(hours: number): string {\n const h = Math.floor(hours);\n const m = Math.round((hours - h) * 60);\n return `${h}h ${m}m`;\n}\n\nexport function formatTimerDuration(seconds: number): string {\n const h = Math.floor(seconds / 3600);\n const m = Math.floor((seconds % 3600) / 60);\n const s = seconds % 60;\n return `${String(h).padStart(2, \"0\")}:${String(m).padStart(2, \"0\")}:${String(s).padStart(2, \"0\")}`;\n}\n\nexport function formatCurrency(amount: number, currency = \"USD\"): string {\n return new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency }).format(\n amount,\n );\n}\n\nexport function formatNumber(num: number): string {\n return new Intl.NumberFormat(\"en-US\").format(num);\n}\n\nexport function formatDate(date: string | Date): string {\n return new Date(date).toLocaleDateString(\"en-US\", {\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n });\n}\n\nexport function formatTime(date: string | Date): string {\n return new Date(date).toLocaleTimeString(\"en-US\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n}\n\nexport function formatRelativeTime(date: string | Date): string {\n const now = new Date();\n const d = new Date(date);\n const diffMs = now.getTime() - d.getTime();\n const diffMins = Math.floor(diffMs / 60000);\n const diffHours = Math.floor(diffMs / 3600000);\n const diffDays = Math.floor(diffMs / 86400000);\n if (diffMins < 1) return \"Just now\";\n if (diffMins < 60) return `${diffMins}m ago`;\n if (diffHours < 24) return `${diffHours}h ago`;\n if (diffDays < 7) return `${diffDays}d ago`;\n return formatDate(date);\n}\n\nexport function getInitials(name: string): string {\n return name\n .split(\" \")\n .map((n) => n[0])\n .join(\"\")\n .toUpperCase()\n .slice(0, 2);\n}\n\nexport function truncateText(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text;\n return text.slice(0, maxLength) + \"...\";\n}\n\nexport function generateId(): string {\n return Math.random().toString(36).substring(2) + Date.now().toString(36);\n}\n\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport function getStatusColor(status: string): BadgeVariant {\n const colors: Record<string, BadgeVariant> = {\n active: \"success\",\n completed: \"info\",\n \"in-progress\": \"warning\",\n pending: \"warning\",\n archived: \"muted\",\n \"on-hold\": \"warning\",\n draft: \"muted\",\n approved: \"success\",\n rejected: \"error\",\n error: \"error\",\n running: \"success\",\n paused: \"warning\",\n cancelled: \"muted\",\n online: \"success\",\n away: \"warning\",\n busy: \"error\",\n offline: \"muted\",\n inactive: \"muted\",\n submitted: \"info\",\n reimbursed: \"success\",\n \"revision-requested\": \"warning\",\n flagged: \"error\",\n sent: \"info\",\n paid: \"success\",\n };\n return colors[status] || \"default\";\n}\n\nexport function getPriorityColor(priority: string): BadgeVariant {\n const colors: Record<string, BadgeVariant> = {\n low: \"info\",\n medium: \"warning\",\n high: \"warning\",\n urgent: \"error\",\n critical: \"error\",\n };\n return colors[priority] || \"default\";\n}\n\n/** Turn a raw token like \"GOOGLE_CALENDAR\" or \"onDevice\" into prose. */\nexport function humanizeToken(raw: string): string {\n const spaced = raw\n .replace(/[_-]+/g, \" \")\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .trim()\n .toLowerCase();\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n"],"mappings":";;;AAYA,SAAgB,EAAG,GAAG,GAAsB;CAC1C,OAAO,EAAQ,EAAK,CAAM,CAAC;AAC7B;AAEA,SAAgB,EAAe,GAAyB;CACtD,IAAM,IAAI,KAAK,MAAM,IAAU,IAAI,GAC7B,IAAI,KAAK,MAAO,IAAU,OAAQ,EAAE,GACpC,IAAI,IAAU;CAGpB,OAFI,IAAI,IAAU,GAAG,E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AAW,KAAK,MAAM,IAAS,KAAQ;CAK7C,OAJI,IAAW,IAAU,aACrB,IAAW,KAAW,GAAG,EAAS,SAClC,IAAY,KAAW,GAAG,EAAU,SACpC,IAAW,IAAU,GAAG,EAAS,SAC9B,EAAW,CAAI;AACxB;AAEA,SAAgB,EAAY,GAAsB;CAChD,OAAO,EACJ,MAAM,GAAG,CAAC,CACV,KAAK,MAAM,EAAE,EAAE,CAAC,CAChB,KAAK,EAAE,CAAC,CACR,YAAY,CAAC,CACb,MAAM,GAAG,CAAC;AACf;AAeA,SAAgB,EAAe,GAA8B;CA2B3D,OAAO;EAzBL,QAAQ;EACR,WAAW;EACX,eAAe;EACf,SAAS;EACT,UAAU;EACV,WAAW;EACX,OAAO;EACP,UAAU;EACV,UAAU;EACV,OAAO;EACP,SAAS;EACT,QAAQ;EACR,WAAW;EACX,QAAQ;EACR,MAAM;EACN,MAAM;EACN,SAAS;EACT,UAAU;EACV,WAAW;EACX,YAAY;EACZ,sBAAsB;EACtB,SAAS;EACT,MAAM;EACN,MAAM;CAED,EAAO,MAAW;AAC3B;AAEA,SAAgB,EAAiB,GAAgC;CAQ/D,OAAO;EANL,KAAK;EACL,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,UAAU;CAEL,EAAO,MAAa;AAC7B;AAGA,SAAgB,EAAc,GAAqB;CACjD,IAAM,IAAS,EACZ,QAAQ,UAAU,GAAG,CAAC,CACtB,QAAQ,sBAAsB,OAAO,CAAC,CACtC,KAAK,CAAC,CACN,YAAY;CACf,OAAO,EAAO,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,EAAO,MAAM,CAAC;AACxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-timecampus",
3
- "version": "2026.1031.14",
3
+ "version": "2026.1102.2",
4
4
  "description": "Burdenoff TimeCampus Microfrontend - AI-powered time management and productivity platform",
5
5
  "type": "module",
6
6
  "files": [