@burdenoff/microfe-workspaces 2026.1130.1 → 2026.1130.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.
@@ -3,112 +3,125 @@ import { useCreateProject as t } from "../hooks/useProjectMutations.js";
3
3
  import { useTr as n } from "../hooks/useTr.js";
4
4
  import { useIsFluidGridsVariant as r } from "../providers/WorkspacesProvider.js";
5
5
  import { buildCreateProjectInput as i, generateProjectKey as a } from "../utils/createForms.js";
6
- import { useMemo as o } from "react";
7
- import { Button as s, OptionalFields as c, ResponsiveDialog as l, ResponsiveDialogContent as u, ResponsiveDialogDescription as d, ResponsiveDialogHeader as f, ResponsiveDialogTitle as p } from "@burdenoff/fe-libs/ui";
8
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
9
- import { FormControl as _, FormDescription as v, FormField as y, FormItem as b, FormLabel as x, FormMessage as S, FormProvider as C, Input as w, Textarea as T, useForm as E, z as D } from "@burdenoff/fe-libs/form";
6
+ import { describeCreateProjectError as o } from "../utils/createProjectError.js";
7
+ import { useMemo as s } from "react";
8
+ import { Button as c, OptionalFields as l, ResponsiveDialog as u, ResponsiveDialogContent as d, ResponsiveDialogDescription as f, ResponsiveDialogHeader as p, ResponsiveDialogTitle as m } from "@burdenoff/fe-libs/ui";
9
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
10
+ import { FormControl as v, FormDescription as y, FormField as b, FormItem as x, FormLabel as S, FormMessage as C, FormProvider as w, Input as T, Textarea as E, useForm as D, z as O } from "@burdenoff/fe-libs/form";
10
11
  // src/components/CreateProjectDialog.tsx
11
- function O(e) {
12
- return D.object({
13
- name: D.string().min(2, e("createProjectDialog.validation.nameMin", "Name must be at least 2 characters")).max(100, e("createProjectDialog.validation.nameMax", "Name must be less than 100 characters")),
14
- key: D.string().min(2, e("createProjectDialog.validation.keyMin", "Key must be at least 2 characters")).max(10, e("createProjectDialog.validation.keyMax", "Key must be less than 10 characters")).regex(/^[A-Z0-9_-]+$/, e("createProjectDialog.validation.keyFormat", "Key must be uppercase letters, numbers, underscores, or hyphens")),
15
- description: D.string().optional()
12
+ function k(e) {
13
+ return O.object({
14
+ name: O.string().min(2, e("createProjectDialog.validation.nameMin", "Name must be at least 2 characters")).max(100, e("createProjectDialog.validation.nameMax", "Name must be less than 100 characters")),
15
+ key: O.string().min(2, e("createProjectDialog.validation.keyMin", "Key must be at least 2 characters")).max(10, e("createProjectDialog.validation.keyMax", "Key must be less than 10 characters")).regex(/^[A-Z0-9_-]+$/, e("createProjectDialog.validation.keyFormat", "Key must be uppercase letters, numbers, underscores, or hyphens")),
16
+ description: O.string().optional()
16
17
  });
17
18
  }
18
- function k({ workspaceId: D }) {
19
- let k = n(), A = r(), { isCreateProjectDialogOpen: j, closeCreateProjectDialog: M } = e(), { mutate: N, isPending: P } = t(D), F = o(() => O(k), [k]), I = E({
20
- schema: F,
19
+ function A({ workspaceId: O }) {
20
+ let A = n(), j = r(), { isCreateProjectDialogOpen: M, closeCreateProjectDialog: N } = e(), { mutate: P, isPending: F } = t(O), I = s(() => k(A), [A]), L = D({
21
+ schema: I,
21
22
  defaultValues: {
22
23
  name: "",
23
24
  key: "",
24
25
  description: ""
25
26
  }
26
- }), L = (e) => {
27
+ }), R = (e) => {
27
28
  let t = i(e);
28
- N(t, {
29
+ P(t, {
29
30
  onSuccess: () => {
30
- M(), I.reset();
31
+ N(), L.reset();
31
32
  },
32
- onError: (e) => {
33
- console.error("Failed to create project:", e);
33
+ onError: (t) => {
34
+ let n = o(t, e.key, A);
35
+ n.field ? L.setError(n.field, {
36
+ type: "server",
37
+ message: n.message
38
+ }, { shouldFocus: !0 }) : L.setError("root.server", {
39
+ type: "server",
40
+ message: n.message
41
+ });
34
42
  }
35
43
  });
36
- }, R = (e) => {
37
- e || (M(), I.reset());
38
- }, z = !!I.formState.dirtyFields.key, B = (e) => {
39
- z || I.setValue("key", a(e), { shouldValidate: I.formState.isSubmitted });
40
- }, V = /* @__PURE__ */ h(y, {
41
- control: I.control,
44
+ }, z = (e) => {
45
+ e || (N(), L.reset());
46
+ }, B = !!L.formState.dirtyFields.key, V = (e) => {
47
+ B || L.setValue("key", a(e), { shouldValidate: L.formState.isSubmitted });
48
+ }, H = /* @__PURE__ */ g(b, {
49
+ control: L.control,
42
50
  name: "key",
43
- render: ({ field: e }) => /* @__PURE__ */ g(b, { children: [
44
- /* @__PURE__ */ h(x, { children: k("createProjectDialog.keyLabel", "Project Key") }),
45
- /* @__PURE__ */ h(_, { children: /* @__PURE__ */ h(w, {
51
+ render: ({ field: e }) => /* @__PURE__ */ _(x, { children: [
52
+ /* @__PURE__ */ g(S, { children: A("createProjectDialog.keyLabel", "Project Key") }),
53
+ /* @__PURE__ */ g(v, { children: /* @__PURE__ */ g(T, {
46
54
  ...e,
47
- placeholder: k("createProjectDialog.keyPlaceholder", "MYPROJ")
55
+ placeholder: A("createProjectDialog.keyPlaceholder", "MYPROJ")
48
56
  }) }),
49
- /* @__PURE__ */ h(v, { children: k("createProjectDialog.keyHint", "Short identifier (uppercase letters, numbers, underscores)") }),
50
- /* @__PURE__ */ h(S, {})
57
+ /* @__PURE__ */ g(y, { children: A("createProjectDialog.keyHint", "Short identifier (uppercase letters, numbers, underscores)") }),
58
+ /* @__PURE__ */ g(C, {})
51
59
  ] })
52
- }), H = /* @__PURE__ */ h(y, {
53
- control: I.control,
60
+ }), U = /* @__PURE__ */ g(b, {
61
+ control: L.control,
54
62
  name: "description",
55
- render: ({ field: e }) => /* @__PURE__ */ g(b, { children: [
56
- /* @__PURE__ */ h(x, { children: k("createProjectDialog.descriptionLabel", "Description (Optional)") }),
57
- /* @__PURE__ */ h(_, { children: /* @__PURE__ */ h(T, {
63
+ render: ({ field: e }) => /* @__PURE__ */ _(x, { children: [
64
+ /* @__PURE__ */ g(S, { children: A("createProjectDialog.descriptionLabel", "Description (Optional)") }),
65
+ /* @__PURE__ */ g(v, { children: /* @__PURE__ */ g(E, {
58
66
  ...e,
59
- placeholder: k("createProjectDialog.descriptionPlaceholder", "Brief description of the project"),
67
+ placeholder: A("createProjectDialog.descriptionPlaceholder", "Brief description of the project"),
60
68
  rows: 3
61
69
  }) }),
62
- /* @__PURE__ */ h(S, {})
70
+ /* @__PURE__ */ g(C, {})
63
71
  ] })
64
72
  });
65
- return /* @__PURE__ */ h(l, {
66
- open: j,
67
- onOpenChange: R,
68
- children: /* @__PURE__ */ g(u, {
73
+ return /* @__PURE__ */ g(u, {
74
+ open: M,
75
+ onOpenChange: z,
76
+ children: /* @__PURE__ */ _(d, {
69
77
  className: "sm:max-w-[500px]",
70
- children: [/* @__PURE__ */ g(f, { children: [/* @__PURE__ */ h(p, { children: k("createProjectDialog.title", "Create Project") }), /* @__PURE__ */ h(d, { children: k("createProjectDialog.description", "Create a new project in your workspace. Projects help organize your work.") })] }), /* @__PURE__ */ h(C, {
71
- ...I,
72
- children: /* @__PURE__ */ g("form", {
73
- onSubmit: I.handleSubmit(L),
78
+ children: [/* @__PURE__ */ _(p, { children: [/* @__PURE__ */ g(m, { children: A("createProjectDialog.title", "Create Project") }), /* @__PURE__ */ g(f, { children: A("createProjectDialog.description", "Create a new project in your workspace. Projects help organize your work.") })] }), /* @__PURE__ */ g(w, {
79
+ ...L,
80
+ children: /* @__PURE__ */ _("form", {
81
+ onSubmit: L.handleSubmit(R),
74
82
  className: "space-y-4",
75
83
  children: [
76
- /* @__PURE__ */ h(y, {
77
- control: I.control,
84
+ /* @__PURE__ */ g(b, {
85
+ control: L.control,
78
86
  name: "name",
79
- render: ({ field: e }) => /* @__PURE__ */ g(b, { children: [
80
- /* @__PURE__ */ h(x, { children: k("createProjectDialog.nameLabel", "Project Name") }),
81
- /* @__PURE__ */ h(_, { children: /* @__PURE__ */ h(w, {
87
+ render: ({ field: e }) => /* @__PURE__ */ _(x, { children: [
88
+ /* @__PURE__ */ g(S, { children: A("createProjectDialog.nameLabel", "Project Name") }),
89
+ /* @__PURE__ */ g(v, { children: /* @__PURE__ */ g(T, {
82
90
  ...e,
83
- placeholder: k("createProjectDialog.namePlaceholder", "My Project"),
91
+ placeholder: A("createProjectDialog.namePlaceholder", "My Project"),
84
92
  onChange: (t) => {
85
- e.onChange(t), B(t.target.value);
93
+ e.onChange(t), V(t.target.value);
86
94
  }
87
95
  }) }),
88
- /* @__PURE__ */ h(v, { children: k("createProjectDialog.nameHint", "A descriptive name for your project") }),
89
- /* @__PURE__ */ h(S, {})
96
+ /* @__PURE__ */ g(y, { children: A("createProjectDialog.nameHint", "A descriptive name for your project") }),
97
+ /* @__PURE__ */ g(C, {})
90
98
  ] })
91
99
  }),
92
- A ? /* @__PURE__ */ g(m, { children: [I.formState.errors.key?.message ? /* @__PURE__ */ h("p", {
100
+ j ? /* @__PURE__ */ _(h, { children: [L.formState.errors.key?.message ? /* @__PURE__ */ g("p", {
93
101
  role: "alert",
94
102
  className: "text-sm text-status-error-text",
95
- children: I.formState.errors.key.message
96
- }) : null, /* @__PURE__ */ g(c, {
103
+ children: L.formState.errors.key.message
104
+ }) : null, /* @__PURE__ */ _(l, {
97
105
  storageKey: "workspaces.createProject",
98
- children: [V, H]
99
- })] }) : /* @__PURE__ */ g(m, { children: [V, H] }),
100
- /* @__PURE__ */ g("div", {
106
+ children: [H, U]
107
+ })] }) : /* @__PURE__ */ _(h, { children: [H, U] }),
108
+ L.formState.errors.root?.server?.message ? /* @__PURE__ */ g("p", {
109
+ role: "alert",
110
+ className: "text-sm text-status-error-text",
111
+ children: L.formState.errors.root.server.message
112
+ }) : null,
113
+ /* @__PURE__ */ _("div", {
101
114
  className: "flex justify-end gap-3 pt-4",
102
- children: [/* @__PURE__ */ h(s, {
115
+ children: [/* @__PURE__ */ g(c, {
103
116
  type: "button",
104
117
  variant: "outline",
105
- onClick: () => R(!1),
106
- disabled: P,
107
- children: k("common.cancel", "Cancel")
108
- }), /* @__PURE__ */ h(s, {
118
+ onClick: () => z(!1),
119
+ disabled: F,
120
+ children: A("common.cancel", "Cancel")
121
+ }), /* @__PURE__ */ g(c, {
109
122
  type: "submit",
110
- disabled: P,
111
- children: P ? k("createProjectDialog.creating", "Creating...") : k("createProjectDialog.submit", "Create Project")
123
+ disabled: F,
124
+ children: F ? A("createProjectDialog.creating", "Creating...") : A("createProjectDialog.submit", "Create Project")
112
125
  })]
113
126
  })
114
127
  ]
@@ -117,4 +130,4 @@ function k({ workspaceId: D }) {
117
130
  })
118
131
  });
119
132
  }
120
- export { k as CreateProjectDialog };
133
+ export { A as CreateProjectDialog };
@@ -2,53 +2,54 @@ import { captureRequestActor as e, pinnedFetch as t } from "../utils/pinnedReque
2
2
  import { useWorkspacesContext as n } from "../providers/WorkspacesProvider.js";
3
3
  import { useWorkspacesEventEmitter as r } from "./useWorkspacesEventEmitter.js";
4
4
  import { safeTelemetryError as i } from "../utils/telemetryError.js";
5
- import { useMutation as a, useQueryClient as o } from "@tanstack/react-query";
5
+ import { GraphQLOperationError as a } from "../utils/createProjectError.js";
6
+ import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
6
7
  // src/hooks/useProjectMutations.ts
7
- var s = "\n mutation CreateProject($input: CreateProjectInput!) {\n createProject(input: $input) {\n id\n name\n key\n workspaceId\n creatorId\n status\n tags\n createdAt\n }\n }\n", c = "\n mutation UpdateProject($id: ID!, $input: UpdateProjectInput!) {\n updateProject(id: $id, input: $input) {\n id\n name\n key\n status\n config\n tags\n archived\n updatedAt\n }\n }\n", l = "\n mutation DeleteProject($id: ID!) {\n deleteProject(id: $id)\n }\n", u = "\n mutation ArchiveProject($id: ID!) {\n archiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", d = "\n mutation UnarchiveProject($id: ID!) {\n unarchiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", f = "\n mutation AssignProjectTag($input: AssignTagInput!) {\n assignTag(input: $input) {\n id\n tagId\n entityType\n entityId\n source\n assignedById\n createdAt\n validFrom\n validTo\n metadata\n }\n }\n", p = "\n query GetProjectTagAssignments($entityType: String!, $entityId: ID!) {\n getEntityTags(entityType: $entityType, entityId: $entityId) {\n id\n tagId\n }\n }\n", m = "\n mutation RemoveTagAssignment($id: ID!) {\n removeTagAssignment(id: $id)\n }\n";
8
- function h(e) {
8
+ var c = "\n mutation CreateProject($input: CreateProjectInput!) {\n createProject(input: $input) {\n id\n name\n key\n workspaceId\n creatorId\n status\n tags\n createdAt\n }\n }\n", l = "\n mutation UpdateProject($id: ID!, $input: UpdateProjectInput!) {\n updateProject(id: $id, input: $input) {\n id\n name\n key\n status\n config\n tags\n archived\n updatedAt\n }\n }\n", u = "\n mutation DeleteProject($id: ID!) {\n deleteProject(id: $id)\n }\n", d = "\n mutation ArchiveProject($id: ID!) {\n archiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", f = "\n mutation UnarchiveProject($id: ID!) {\n unarchiveProject(id: $id) {\n id\n archived\n updatedAt\n }\n }\n", p = "\n mutation AssignProjectTag($input: AssignTagInput!) {\n assignTag(input: $input) {\n id\n tagId\n entityType\n entityId\n source\n assignedById\n createdAt\n validFrom\n validTo\n metadata\n }\n }\n", m = "\n query GetProjectTagAssignments($entityType: String!, $entityId: ID!) {\n getEntityTags(entityType: $entityType, entityId: $entityId) {\n id\n tagId\n }\n }\n", h = "\n mutation RemoveTagAssignment($id: ID!) {\n removeTagAssignment(id: $id)\n }\n";
9
+ function g(e) {
9
10
  e.invalidateQueries({ queryKey: ["projects"] }), e.invalidateQueries({ queryKey: ["project"] }), e.invalidateQueries({ queryKey: ["myProjects"] }), e.invalidateQueries({ queryKey: ["dashboard", "projects"] });
10
11
  }
11
- var g = (c) => {
12
- let { authToken: l, currentUser: u, onProjectCreate: d, workspaceId: f } = n(), p = o(), { emit: m } = r(), g = c || f;
13
- return a({
12
+ var _ = (l) => {
13
+ let { authToken: u, currentUser: d, onProjectCreate: f, workspaceId: p } = n(), m = s(), { emit: h } = r(), _ = l || p;
14
+ return o({
14
15
  mutationFn: async (n) => {
15
16
  let r = e({
16
- authToken: l,
17
- currentUser: u
17
+ authToken: u,
18
+ currentUser: d
18
19
  }), i = await t(r, {
19
20
  gateway: "workspace",
20
- query: s,
21
+ query: c,
21
22
  variables: { input: n },
22
- workspaceId: g || void 0
23
+ workspaceId: _ || void 0
23
24
  });
24
- if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
25
+ if (i.errors?.length) throw new a(i.errors[0]);
25
26
  return i.data.createProject;
26
27
  },
27
28
  onSuccess: (e) => {
28
- h(p), m("project.created", {
29
+ g(m), h("project.created", {
29
30
  projectId: e.id,
30
31
  workspaceId: e.workspaceId,
31
32
  source: "microfe-workspaces"
32
- }), d && d(e);
33
+ }), f && f(e);
33
34
  },
34
35
  onError: (e) => {
35
- m("project.create_failed", {
36
- workspaceId: g || void 0,
36
+ h("project.create_failed", {
37
+ workspaceId: _ || void 0,
37
38
  source: "microfe-workspaces",
38
39
  errorMessage: i(e)
39
40
  });
40
41
  }
41
42
  });
42
- }, _ = (s) => {
43
- let { authToken: l, currentUser: u, workspaceId: d } = n(), f = o(), { emit: p } = r(), m = s || d;
44
- return a({
43
+ }, v = (a) => {
44
+ let { authToken: c, currentUser: u, workspaceId: d } = n(), f = s(), { emit: p } = r(), m = a || d;
45
+ return o({
45
46
  mutationFn: async ({ id: n, input: r }) => {
46
47
  let i = e({
47
- authToken: l,
48
+ authToken: c,
48
49
  currentUser: u
49
50
  }), a = await t(i, {
50
51
  gateway: "workspace",
51
- query: c,
52
+ query: l,
52
53
  variables: {
53
54
  id: n,
54
55
  input: r
@@ -59,7 +60,7 @@ var g = (c) => {
59
60
  return a.data.updateProject;
60
61
  },
61
62
  onSuccess: (e) => {
62
- h(f), p("project.updated", {
63
+ g(f), p("project.updated", {
63
64
  projectId: e.id,
64
65
  workspaceId: e.workspaceId,
65
66
  source: "microfe-workspaces"
@@ -74,16 +75,16 @@ var g = (c) => {
74
75
  });
75
76
  }
76
77
  });
77
- }, v = (s) => {
78
- let { authToken: c, currentUser: l, workspaceId: u } = n(), d = o(), { emit: p } = r(), m = s || u;
79
- return a({
78
+ }, y = (a) => {
79
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: f } = r(), m = a || u;
80
+ return o({
80
81
  mutationFn: async (n) => {
81
82
  let r = e({
82
83
  authToken: c,
83
84
  currentUser: l
84
85
  }), i = await t(r, {
85
86
  gateway: "workspace",
86
- query: f,
87
+ query: p,
87
88
  variables: { input: {
88
89
  tagId: n.tagId,
89
90
  entityType: "WORKSPACE_PROJECT",
@@ -113,14 +114,14 @@ var g = (c) => {
113
114
  };
114
115
  },
115
116
  onSuccess: (e, t) => {
116
- h(d), p("project.updated", {
117
+ g(d), f("project.updated", {
117
118
  projectId: t.entityId,
118
119
  workspaceId: m || void 0,
119
120
  source: "microfe-workspaces"
120
121
  });
121
122
  },
122
123
  onError: (e, t) => {
123
- p("project.update_failed", {
124
+ f("project.update_failed", {
124
125
  projectId: t.entityId,
125
126
  workspaceId: m || void 0,
126
127
  source: "microfe-workspaces",
@@ -128,9 +129,9 @@ var g = (c) => {
128
129
  });
129
130
  }
130
131
  });
131
- }, y = (s) => {
132
- let { authToken: c, currentUser: l, workspaceId: u } = n(), d = o(), { emit: f } = r(), g = s || u;
133
- return a({
132
+ }, b = (a) => {
133
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: f } = r(), p = a || u;
134
+ return o({
134
135
  mutationFn: async (n) => {
135
136
  let r = e({
136
137
  authToken: c,
@@ -139,12 +140,12 @@ var g = (c) => {
139
140
  if (!i) {
140
141
  let e = await t(r, {
141
142
  gateway: "workspace",
142
- query: p,
143
+ query: m,
143
144
  variables: {
144
145
  entityType: "WORKSPACE_PROJECT",
145
146
  entityId: n.entityId
146
147
  },
147
- workspaceId: g || void 0
148
+ workspaceId: p || void 0
148
149
  });
149
150
  if (e.errors?.length) throw Error(e.errors[0]?.message || "GraphQL error");
150
151
  i = e.data?.getEntityTags.find((e) => e.tagId === n.tagId)?.id;
@@ -152,39 +153,39 @@ var g = (c) => {
152
153
  if (!i) return !1;
153
154
  let a = await t(r, {
154
155
  gateway: "workspace",
155
- query: m,
156
+ query: h,
156
157
  variables: { id: i },
157
- workspaceId: g || void 0
158
+ workspaceId: p || void 0
158
159
  });
159
160
  if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
160
161
  return a.data?.removeTagAssignment ?? !1;
161
162
  },
162
163
  onSuccess: (e, t) => {
163
- h(d), f("project.updated", {
164
+ g(d), f("project.updated", {
164
165
  projectId: t.entityId,
165
- workspaceId: g || void 0,
166
+ workspaceId: p || void 0,
166
167
  source: "microfe-workspaces"
167
168
  });
168
169
  },
169
170
  onError: (e, t) => {
170
171
  f("project.update_failed", {
171
172
  projectId: t.entityId,
172
- workspaceId: g || void 0,
173
+ workspaceId: p || void 0,
173
174
  source: "microfe-workspaces",
174
175
  errorMessage: i(e)
175
176
  });
176
177
  }
177
178
  });
178
- }, b = (s) => {
179
- let { authToken: c, currentUser: u, workspaceId: d } = n(), f = o(), { emit: p } = r(), m = s || d;
180
- return a({
179
+ }, x = (a) => {
180
+ let { authToken: c, currentUser: l, workspaceId: d } = n(), f = s(), { emit: p } = r(), m = a || d;
181
+ return o({
181
182
  mutationFn: async (n) => {
182
183
  let r = e({
183
184
  authToken: c,
184
- currentUser: u
185
+ currentUser: l
185
186
  }), i = await t(r, {
186
187
  gateway: "workspace",
187
- query: l,
188
+ query: u,
188
189
  variables: { id: n },
189
190
  workspaceId: m || void 0
190
191
  });
@@ -192,7 +193,7 @@ var g = (c) => {
192
193
  return i.data.deleteProject;
193
194
  },
194
195
  onSuccess: (e, t) => {
195
- h(f), p("project.deleted", {
196
+ g(f), p("project.deleted", {
196
197
  projectId: t,
197
198
  source: "microfe-workspaces"
198
199
  });
@@ -206,16 +207,16 @@ var g = (c) => {
206
207
  });
207
208
  }
208
209
  });
209
- }, x = (s) => {
210
- let { authToken: c, currentUser: l, workspaceId: d } = n(), f = o(), { emit: p } = r(), m = s || d;
211
- return a({
210
+ }, S = (a) => {
211
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), f = s(), { emit: p } = r(), m = a || u;
212
+ return o({
212
213
  mutationFn: async (n) => {
213
214
  let r = e({
214
215
  authToken: c,
215
216
  currentUser: l
216
217
  }), i = await t(r, {
217
218
  gateway: "workspace",
218
- query: u,
219
+ query: d,
219
220
  variables: { id: n },
220
221
  workspaceId: m || void 0
221
222
  });
@@ -223,7 +224,7 @@ var g = (c) => {
223
224
  return i.data.archiveProject;
224
225
  },
225
226
  onSuccess: (e) => {
226
- h(f), p("project.archived", {
227
+ g(f), p("project.archived", {
227
228
  projectId: e.id,
228
229
  workspaceId: e.workspaceId,
229
230
  source: "microfe-workspaces"
@@ -238,16 +239,16 @@ var g = (c) => {
238
239
  });
239
240
  }
240
241
  });
241
- }, S = (s) => {
242
- let { authToken: c, currentUser: l, workspaceId: u } = n(), f = o(), { emit: p } = r(), m = s || u;
243
- return a({
242
+ }, C = (a) => {
243
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: p } = r(), m = a || u;
244
+ return o({
244
245
  mutationFn: async (n) => {
245
246
  let r = e({
246
247
  authToken: c,
247
248
  currentUser: l
248
249
  }), i = await t(r, {
249
250
  gateway: "workspace",
250
- query: d,
251
+ query: f,
251
252
  variables: { id: n },
252
253
  workspaceId: m || void 0
253
254
  });
@@ -255,7 +256,7 @@ var g = (c) => {
255
256
  return i.data.unarchiveProject;
256
257
  },
257
258
  onSuccess: (e) => {
258
- h(f), p("project.unarchived", {
259
+ g(d), p("project.unarchived", {
259
260
  projectId: e.id,
260
261
  workspaceId: e.workspaceId,
261
262
  source: "microfe-workspaces"
@@ -271,4 +272,4 @@ var g = (c) => {
271
272
  }
272
273
  });
273
274
  };
274
- export { x as useArchiveProject, g as useCreateProject, b as useDeleteProject, v as useTagProject, S as useUnarchiveProject, y as useUntagProject, _ as useUpdateProject };
275
+ export { S as useArchiveProject, _ as useCreateProject, x as useDeleteProject, y as useTagProject, C as useUnarchiveProject, b as useUntagProject, v as useUpdateProject };
@@ -86,6 +86,15 @@ export declare const enTranslations: {
86
86
  description: string;
87
87
  descriptionLabel: string;
88
88
  descriptionPlaceholder: string;
89
+ errors: {
90
+ actorChanged: string;
91
+ forbidden: string;
92
+ generic: string;
93
+ invalid: string;
94
+ keyTaken: string;
95
+ network: string;
96
+ signIn: string;
97
+ };
89
98
  keyHint: string;
90
99
  keyLabel: string;
91
100
  keyPlaceholder: string;
@@ -77,6 +77,15 @@ var e = {
77
77
  description: "Create a new project in your workspace. Projects help organize your work.",
78
78
  descriptionLabel: "Description (Optional)",
79
79
  descriptionPlaceholder: "Brief description of the project",
80
+ errors: {
81
+ actorChanged: "The active account changed before the project was created. Review it and try again.",
82
+ forbidden: "You do not have permission to create projects in this workspace.",
83
+ generic: "The project could not be created. Try again in a moment.",
84
+ invalid: "The project details were not accepted. Check them and try again.",
85
+ keyTaken: "A project with the key \"{{key}}\" already exists in this workspace. Choose another key.",
86
+ network: "Could not reach the server. Check your connection and try again.",
87
+ signIn: "Your session has ended. Sign in again, then create the project."
88
+ },
80
89
  keyHint: "Short identifier (uppercase letters, numbers, underscores)",
81
90
  keyLabel: "Project Key",
82
91
  keyPlaceholder: "MYPROJ",
@@ -0,0 +1,25 @@
1
+ import { TrFunction } from '../hooks/useTr';
2
+ /** The server's i18n key for a key another live project already uses (wspace-workspace-svc, BOFF-17404). */
3
+ export declare const PROJECT_KEY_TAKEN_I18N_KEY = "project.errors.keyTaken";
4
+ interface GraphQLErrorEntry {
5
+ message: string;
6
+ extensions?: Record<string, unknown>;
7
+ }
8
+ /** A GraphQL error response, with the first error's code and i18n key kept. */
9
+ export declare class GraphQLOperationError extends Error {
10
+ readonly code: string | undefined;
11
+ readonly i18nKey: string | undefined;
12
+ readonly field: string | undefined;
13
+ constructor(error: GraphQLErrorEntry | undefined);
14
+ }
15
+ export interface CreateProjectErrorDisplay {
16
+ /** The form field the message belongs to; absent for a form-level message. */
17
+ field?: 'key';
18
+ message: string;
19
+ }
20
+ /**
21
+ * Map a failed create to what the dialog shows. `key` is the key the user
22
+ * submitted; the key-taken message names it.
23
+ */
24
+ export declare function describeCreateProjectError(error: unknown, key: string, tr: TrFunction): CreateProjectErrorDisplay;
25
+ export {};
@@ -0,0 +1,31 @@
1
+ import "./pinnedRequest.js";
2
+ // src/utils/createProjectError.ts
3
+ var e = "project.errors.keyTaken", t = class extends Error {
4
+ code;
5
+ i18nKey;
6
+ field;
7
+ constructor(e) {
8
+ super(e?.message || "GraphQL error"), this.name = "GraphQLOperationError";
9
+ let t = e?.extensions ?? {};
10
+ this.code = typeof t.code == "string" ? t.code : void 0, this.i18nKey = typeof t.i18nKey == "string" ? t.i18nKey : void 0, this.field = typeof t.field == "string" ? t.field : void 0;
11
+ }
12
+ };
13
+ function n(e, n, a) {
14
+ if (e instanceof t) return e.i18nKey === "project.errors.keyTaken" || e.code === "CONFLICT" ? {
15
+ field: "key",
16
+ message: a("createProjectDialog.errors.keyTaken", "A project with the key \"{{key}}\" already exists in this workspace. Choose another key.", { key: n })
17
+ } : e.code === "FORBIDDEN" ? { message: a("createProjectDialog.errors.forbidden", "You do not have permission to create projects in this workspace.") } : e.code === "UNAUTHENTICATED" ? { message: r(a) } : e.code === "BAD_USER_INPUT" || e.code === "VALIDATION_ERROR" ? { message: a("createProjectDialog.errors.invalid", "The project details were not accepted. Check them and try again.") } : { message: i(a) };
18
+ if (e instanceof Error) {
19
+ if (e.message === "Your session has ended. Sign in again, then retry this action.") return { message: r(a) };
20
+ if (e.message === "The active account changed before this action was sent. Review it and try again.") return { message: a("createProjectDialog.errors.actorChanged", "The active account changed before the project was created. Review it and try again.") };
21
+ if (e instanceof TypeError) return { message: a("createProjectDialog.errors.network", "Could not reach the server. Check your connection and try again.") };
22
+ }
23
+ return { message: i(a) };
24
+ }
25
+ function r(e) {
26
+ return e("createProjectDialog.errors.signIn", "Your session has ended. Sign in again, then create the project.");
27
+ }
28
+ function i(e) {
29
+ return e("createProjectDialog.errors.generic", "The project could not be created. Try again in a moment.");
30
+ }
31
+ export { t as GraphQLOperationError, e as PROJECT_KEY_TAKEN_I18N_KEY, n as describeCreateProjectError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-workspaces",
3
- "version": "2026.1130.1",
3
+ "version": "2026.1130.2",
4
4
  "description": "Workspaces microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [
@@ -37,7 +37,7 @@
37
37
  "format": "bun fmt src",
38
38
  "format:check": "bun fmt --check src",
39
39
  "type:check": "boff gate -- bun check --no-pretty -b",
40
- "test": "bun test",
40
+ "test": "bun test --isolate",
41
41
  "test:watch": "bun test --watch",
42
42
  "test:coverage": "bun test --coverage",
43
43
  "sanity": "boff sanity",
@@ -151,6 +151,11 @@
151
151
  "test:codegen",
152
152
  "check:verify-package-contents"
153
153
  ]
154
+ },
155
+ "scripts": {
156
+ "unmanaged": [
157
+ "test"
158
+ ]
154
159
  }
155
160
  }
156
161
  }