@burdenoff/microfe-workspaces 2026.1130.1 → 2026.1130.3

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,55 @@ 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,
24
+ suppressGlobalErrorEvent: !0
23
25
  });
24
- if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL error");
26
+ if (i.errors?.length) throw new a(i.errors[0]);
25
27
  return i.data.createProject;
26
28
  },
27
29
  onSuccess: (e) => {
28
- h(p), m("project.created", {
30
+ g(m), h("project.created", {
29
31
  projectId: e.id,
30
32
  workspaceId: e.workspaceId,
31
33
  source: "microfe-workspaces"
32
- }), d && d(e);
34
+ }), f && f(e);
33
35
  },
34
36
  onError: (e) => {
35
- m("project.create_failed", {
36
- workspaceId: g || void 0,
37
+ h("project.create_failed", {
38
+ workspaceId: _ || void 0,
37
39
  source: "microfe-workspaces",
38
40
  errorMessage: i(e)
39
41
  });
40
42
  }
41
43
  });
42
- }, _ = (s) => {
43
- let { authToken: l, currentUser: u, workspaceId: d } = n(), f = o(), { emit: p } = r(), m = s || d;
44
- return a({
44
+ }, v = (a) => {
45
+ let { authToken: c, currentUser: u, workspaceId: d } = n(), f = s(), { emit: p } = r(), m = a || d;
46
+ return o({
45
47
  mutationFn: async ({ id: n, input: r }) => {
46
48
  let i = e({
47
- authToken: l,
49
+ authToken: c,
48
50
  currentUser: u
49
51
  }), a = await t(i, {
50
52
  gateway: "workspace",
51
- query: c,
53
+ query: l,
52
54
  variables: {
53
55
  id: n,
54
56
  input: r
@@ -59,7 +61,7 @@ var g = (c) => {
59
61
  return a.data.updateProject;
60
62
  },
61
63
  onSuccess: (e) => {
62
- h(f), p("project.updated", {
64
+ g(f), p("project.updated", {
63
65
  projectId: e.id,
64
66
  workspaceId: e.workspaceId,
65
67
  source: "microfe-workspaces"
@@ -74,16 +76,16 @@ var g = (c) => {
74
76
  });
75
77
  }
76
78
  });
77
- }, v = (s) => {
78
- let { authToken: c, currentUser: l, workspaceId: u } = n(), d = o(), { emit: p } = r(), m = s || u;
79
- return a({
79
+ }, y = (a) => {
80
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: f } = r(), m = a || u;
81
+ return o({
80
82
  mutationFn: async (n) => {
81
83
  let r = e({
82
84
  authToken: c,
83
85
  currentUser: l
84
86
  }), i = await t(r, {
85
87
  gateway: "workspace",
86
- query: f,
88
+ query: p,
87
89
  variables: { input: {
88
90
  tagId: n.tagId,
89
91
  entityType: "WORKSPACE_PROJECT",
@@ -113,14 +115,14 @@ var g = (c) => {
113
115
  };
114
116
  },
115
117
  onSuccess: (e, t) => {
116
- h(d), p("project.updated", {
118
+ g(d), f("project.updated", {
117
119
  projectId: t.entityId,
118
120
  workspaceId: m || void 0,
119
121
  source: "microfe-workspaces"
120
122
  });
121
123
  },
122
124
  onError: (e, t) => {
123
- p("project.update_failed", {
125
+ f("project.update_failed", {
124
126
  projectId: t.entityId,
125
127
  workspaceId: m || void 0,
126
128
  source: "microfe-workspaces",
@@ -128,9 +130,9 @@ var g = (c) => {
128
130
  });
129
131
  }
130
132
  });
131
- }, y = (s) => {
132
- let { authToken: c, currentUser: l, workspaceId: u } = n(), d = o(), { emit: f } = r(), g = s || u;
133
- return a({
133
+ }, b = (a) => {
134
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: f } = r(), p = a || u;
135
+ return o({
134
136
  mutationFn: async (n) => {
135
137
  let r = e({
136
138
  authToken: c,
@@ -139,12 +141,12 @@ var g = (c) => {
139
141
  if (!i) {
140
142
  let e = await t(r, {
141
143
  gateway: "workspace",
142
- query: p,
144
+ query: m,
143
145
  variables: {
144
146
  entityType: "WORKSPACE_PROJECT",
145
147
  entityId: n.entityId
146
148
  },
147
- workspaceId: g || void 0
149
+ workspaceId: p || void 0
148
150
  });
149
151
  if (e.errors?.length) throw Error(e.errors[0]?.message || "GraphQL error");
150
152
  i = e.data?.getEntityTags.find((e) => e.tagId === n.tagId)?.id;
@@ -152,39 +154,39 @@ var g = (c) => {
152
154
  if (!i) return !1;
153
155
  let a = await t(r, {
154
156
  gateway: "workspace",
155
- query: m,
157
+ query: h,
156
158
  variables: { id: i },
157
- workspaceId: g || void 0
159
+ workspaceId: p || void 0
158
160
  });
159
161
  if (a.errors?.length) throw Error(a.errors[0]?.message || "GraphQL error");
160
162
  return a.data?.removeTagAssignment ?? !1;
161
163
  },
162
164
  onSuccess: (e, t) => {
163
- h(d), f("project.updated", {
165
+ g(d), f("project.updated", {
164
166
  projectId: t.entityId,
165
- workspaceId: g || void 0,
167
+ workspaceId: p || void 0,
166
168
  source: "microfe-workspaces"
167
169
  });
168
170
  },
169
171
  onError: (e, t) => {
170
172
  f("project.update_failed", {
171
173
  projectId: t.entityId,
172
- workspaceId: g || void 0,
174
+ workspaceId: p || void 0,
173
175
  source: "microfe-workspaces",
174
176
  errorMessage: i(e)
175
177
  });
176
178
  }
177
179
  });
178
- }, b = (s) => {
179
- let { authToken: c, currentUser: u, workspaceId: d } = n(), f = o(), { emit: p } = r(), m = s || d;
180
- return a({
180
+ }, x = (a) => {
181
+ let { authToken: c, currentUser: l, workspaceId: d } = n(), f = s(), { emit: p } = r(), m = a || d;
182
+ return o({
181
183
  mutationFn: async (n) => {
182
184
  let r = e({
183
185
  authToken: c,
184
- currentUser: u
186
+ currentUser: l
185
187
  }), i = await t(r, {
186
188
  gateway: "workspace",
187
- query: l,
189
+ query: u,
188
190
  variables: { id: n },
189
191
  workspaceId: m || void 0
190
192
  });
@@ -192,7 +194,7 @@ var g = (c) => {
192
194
  return i.data.deleteProject;
193
195
  },
194
196
  onSuccess: (e, t) => {
195
- h(f), p("project.deleted", {
197
+ g(f), p("project.deleted", {
196
198
  projectId: t,
197
199
  source: "microfe-workspaces"
198
200
  });
@@ -206,16 +208,16 @@ var g = (c) => {
206
208
  });
207
209
  }
208
210
  });
209
- }, x = (s) => {
210
- let { authToken: c, currentUser: l, workspaceId: d } = n(), f = o(), { emit: p } = r(), m = s || d;
211
- return a({
211
+ }, S = (a) => {
212
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), f = s(), { emit: p } = r(), m = a || u;
213
+ return o({
212
214
  mutationFn: async (n) => {
213
215
  let r = e({
214
216
  authToken: c,
215
217
  currentUser: l
216
218
  }), i = await t(r, {
217
219
  gateway: "workspace",
218
- query: u,
220
+ query: d,
219
221
  variables: { id: n },
220
222
  workspaceId: m || void 0
221
223
  });
@@ -223,7 +225,7 @@ var g = (c) => {
223
225
  return i.data.archiveProject;
224
226
  },
225
227
  onSuccess: (e) => {
226
- h(f), p("project.archived", {
228
+ g(f), p("project.archived", {
227
229
  projectId: e.id,
228
230
  workspaceId: e.workspaceId,
229
231
  source: "microfe-workspaces"
@@ -238,16 +240,16 @@ var g = (c) => {
238
240
  });
239
241
  }
240
242
  });
241
- }, S = (s) => {
242
- let { authToken: c, currentUser: l, workspaceId: u } = n(), f = o(), { emit: p } = r(), m = s || u;
243
- return a({
243
+ }, C = (a) => {
244
+ let { authToken: c, currentUser: l, workspaceId: u } = n(), d = s(), { emit: p } = r(), m = a || u;
245
+ return o({
244
246
  mutationFn: async (n) => {
245
247
  let r = e({
246
248
  authToken: c,
247
249
  currentUser: l
248
250
  }), i = await t(r, {
249
251
  gateway: "workspace",
250
- query: d,
252
+ query: f,
251
253
  variables: { id: n },
252
254
  workspaceId: m || void 0
253
255
  });
@@ -255,7 +257,7 @@ var g = (c) => {
255
257
  return i.data.unarchiveProject;
256
258
  },
257
259
  onSuccess: (e) => {
258
- h(f), p("project.unarchived", {
260
+ g(d), p("project.unarchived", {
259
261
  projectId: e.id,
260
262
  workspaceId: e.workspaceId,
261
263
  source: "microfe-workspaces"
@@ -271,4 +273,4 @@ var g = (c) => {
271
273
  }
272
274
  });
273
275
  };
274
- export { x as useArchiveProject, g as useCreateProject, b as useDeleteProject, v as useTagProject, S as useUnarchiveProject, y as useUntagProject, _ as useUpdateProject };
276
+ 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 };
@@ -22,6 +22,12 @@ export interface PinnedFetchOptions {
22
22
  * runs in. Defaults to the active workspace, as `graphqlFetch` does.
23
23
  */
24
24
  workspaceId?: string;
25
+ /**
26
+ * Skip the shell's global backend-error toast for this call, for a caller
27
+ * that shows the failure itself (the Create Project dialog, BOFF-17412).
28
+ * The returned `errors` are unchanged.
29
+ */
30
+ suppressGlobalErrorEvent?: boolean;
25
31
  }
26
32
  /**
27
33
  * Record the acting user when an action starts. Call it synchronously at the
@@ -21,9 +21,9 @@ function f(e) {
21
21
  return /^\s*mutation\b/.test(e);
22
22
  }
23
23
  async function p(e, n) {
24
- let { gateway: c, query: l, variables: u, workspaceId: p } = n;
24
+ let { gateway: c, query: l, variables: u, workspaceId: p, suppressGlobalErrorEvent: m } = n;
25
25
  d(e);
26
- let m;
26
+ let h;
27
27
  if (c === "workspace") {
28
28
  let t = r(), n = p || t;
29
29
  if (n && n === t) {
@@ -35,18 +35,19 @@ async function p(e, n) {
35
35
  tenantId: s() ?? void 0,
36
36
  currentQuery: l
37
37
  });
38
- t.assertCurrent(), m = t.workspaceToken;
39
- } else m = !0;
38
+ t.assertCurrent(), h = t.workspaceToken;
39
+ } else h = !0;
40
40
  }
41
41
  d(e);
42
- let h = await i({
42
+ let g = await i({
43
43
  gateway: c,
44
44
  query: l,
45
45
  variables: u,
46
46
  authToken: e.authToken,
47
47
  ...p ? { workspaceId: p } : {},
48
- ...m === void 0 ? {} : { workspaceToken: m }
48
+ ...h === void 0 ? {} : { workspaceToken: h },
49
+ ...m ? { suppressGlobalErrorEvent: !0 } : {}
49
50
  });
50
- return f(l) && !h.errors?.length && t(), h;
51
+ return f(l) && !g.errors?.length && t(), g;
51
52
  }
52
53
  export { l as ACTOR_CHANGED_MESSAGE, c as SIGN_IN_REQUIRED_MESSAGE, u as captureRequestActor, p as pinnedFetch };
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.3",
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
  }