@stapel/workspaces-react 0.9.0 → 0.11.0

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 (46) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/dist/api/generated/schema.d.ts +283 -17
  3. package/dist/api/generated/schema.d.ts.map +1 -1
  4. package/dist/api/types.d.ts +23 -0
  5. package/dist/api/types.d.ts.map +1 -1
  6. package/dist/api/workspacesApi.d.ts +37 -1
  7. package/dist/api/workspacesApi.d.ts.map +1 -1
  8. package/dist/api/workspacesApi.js +4 -0
  9. package/dist/api/workspacesApi.js.map +1 -1
  10. package/dist/i18n/generated/errors.gen.d.ts +30 -0
  11. package/dist/i18n/generated/errors.gen.d.ts.map +1 -1
  12. package/dist/i18n/generated/errors.gen.js +15 -0
  13. package/dist/i18n/generated/errors.gen.js.map +1 -1
  14. package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -1
  15. package/dist/i18n/generated/errors.ru.gen.js +5 -0
  16. package/dist/i18n/generated/errors.ru.gen.js.map +1 -1
  17. package/dist/index.d.ts +5 -3
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +3 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/model/mutations.d.ts +98 -1
  22. package/dist/model/mutations.d.ts.map +1 -1
  23. package/dist/model/mutations.js +132 -0
  24. package/dist/model/mutations.js.map +1 -1
  25. package/dist/model/queryKeys.d.ts +1 -0
  26. package/dist/model/queryKeys.d.ts.map +1 -1
  27. package/dist/model/queryKeys.js +7 -0
  28. package/dist/model/queryKeys.js.map +1 -1
  29. package/dist/model/selection.d.ts +146 -0
  30. package/dist/model/selection.d.ts.map +1 -0
  31. package/dist/model/selection.js +217 -0
  32. package/dist/model/selection.js.map +1 -0
  33. package/llms.txt +11 -3
  34. package/manifest.json +117 -2
  35. package/package.json +2 -2
  36. package/src/analytics/generated/events.json +1 -1
  37. package/src/api/generated/schema.ts +283 -17
  38. package/src/api/types.ts +23 -0
  39. package/src/api/workspacesApi.ts +74 -0
  40. package/src/i18n/generated/errors.gen.ts +15 -0
  41. package/src/i18n/generated/errors.json +35 -0
  42. package/src/i18n/generated/errors.ru.gen.ts +5 -0
  43. package/src/index.ts +22 -0
  44. package/src/model/mutations.ts +186 -0
  45. package/src/model/queryKeys.ts +8 -0
  46. package/src/model/selection.tsx +382 -0
@@ -116,6 +116,99 @@ export function useRemoveMember(workspaceId) {
116
116
  };
117
117
  return useMutation(options);
118
118
  }
119
+ /**
120
+ * Correct a co-member's display name (PATCH /{id}/members/{userId}/name,
121
+ * stapel-workspaces ≥0.19.0) — the roster-side fix an owner/admin applies
122
+ * without waiting for the person themselves.
123
+ *
124
+ * **Capability `members.role.change`**, not `members.invite`: ask
125
+ * {@link "./queries.js".useCapabilityGate}(workspaceId,
126
+ * "members.role.change") before offering the affordance. It is `standard`, so
127
+ * no step-up is demanded (contrast {@link useResetMemberPassword}). Anonymous
128
+ * callers are denied outright, and only an owner may rename an owner.
129
+ *
130
+ * **What the write moves, and hence what is invalidated.** The backend writes
131
+ * the CANONICAL name — stapel-profiles' `Profile.display_name` through the
132
+ * in-process profiles seam — not the membership's local
133
+ * `display_name_hint`, which goes dark the moment a real profile exists. So
134
+ * the stale set is not "the page this row was on": it is EVERY cached roster,
135
+ * in every workspace, because `MemberResponse.display_name` is a live lookup
136
+ * of that one canonical value. Hence
137
+ * {@link "./queryKeys.js".workspacesQueryKeys.membersAll}, the workspace-less
138
+ * prefix — invalidating `members(workspaceId)` would leave the same person
139
+ * showing their old name on every other roster the session has open. A
140
+ * rename can also move a row out of an active `search` filter, which the
141
+ * prefix covers too (every page, every filter).
142
+ *
143
+ * A host that ALSO renders `@stapel/profiles-react` data for this person owns
144
+ * the other half: this pair never reaches into another pair's query namespace
145
+ * (the same seam discipline as `InviteAcceptFlow`'s basic-data slot), so
146
+ * invalidate `profilesQueryKeys.profile(userId)` yourself there.
147
+ *
148
+ * **Errors** arrive in the single dialect, keyed: the four display-name rules
149
+ * borrowed verbatim from stapel-profiles
150
+ * (`error.400.display_name_too_short` / `_forbidden_chars` /
151
+ * `_invisible_chars` / `_emoji`), over-length as the fleet-standard
152
+ * `error.400.field.max_length` with `{field, max_length}` (no bespoke code),
153
+ * and `error.503.profiles_unavailable` where stapel-profiles does not run in
154
+ * the deployment's process — an honest refusal rather than a 200 over a write
155
+ * that did not happen. Render them with `explainWorkspacesError` / `t(code,
156
+ * params)` like every other key.
157
+ */
158
+ export function useRenameMember(workspaceId) {
159
+ const api = useWorkspacesApi();
160
+ const queryClient = useQueryClient();
161
+ const options = {
162
+ mutationFn: ({ userId, displayName }) => api.renameMember(workspaceId, userId, { display_name: displayName }),
163
+ onSuccess: () => {
164
+ void queryClient.invalidateQueries({
165
+ queryKey: workspacesQueryKeys.membersAll(),
166
+ });
167
+ },
168
+ };
169
+ return useMutation(options);
170
+ }
171
+ /**
172
+ * Fix a pending invitation's name hint (PATCH
173
+ * /{id}/invitations/{invitationId}/name, stapel-workspaces ≥0.19.0) — the
174
+ * same correction as {@link useRenameMember}, one step earlier. The invitee
175
+ * has not accepted, so there is no profile of theirs to write and the name
176
+ * lives on the invitation; `accept_invitation` copies it onto the membership.
177
+ * Before this endpoint the only fix for a typo in an invitee's name was
178
+ * revoke-and-re-invite, which re-mails the person.
179
+ *
180
+ * **The same capability as the member rename** (`members.role.change`, not
181
+ * the invitation surface's `members.invite`) — the hint IS the member's name
182
+ * after acceptance, so splitting them would let a role fix a name that
183
+ * reverts.
184
+ *
185
+ * Only a PENDING invitation is editable; a terminal one refuses with the
186
+ * keyed answers revoke gives (`error.400.invitation_already_used` /
187
+ * `_revoked` / `_declined` / `_expired`), and an accepted invitation's name
188
+ * is the member's name now — use {@link useRenameMember}. Validation is the
189
+ * same stapel-profiles canon, so the same four display-name keys surface
190
+ * here.
191
+ *
192
+ * Invalidation is deliberately NARROWER than the member rename's: the hint is
193
+ * a workspace-local column on one invitation, not a shared canonical name, so
194
+ * only this workspace's invitation lists (every page and the infinite walk —
195
+ * the bare 3-tuple prefix) can be showing it.
196
+ */
197
+ export function useRenameInvitation(workspaceId) {
198
+ const api = useWorkspacesApi();
199
+ const queryClient = useQueryClient();
200
+ const options = {
201
+ mutationFn: ({ invitationId, displayName }) => api.renameInvitation(workspaceId, invitationId, {
202
+ display_name: displayName,
203
+ }),
204
+ onSuccess: () => {
205
+ void queryClient.invalidateQueries({
206
+ queryKey: workspacesQueryKeys.invitations(workspaceId),
207
+ });
208
+ },
209
+ };
210
+ return useMutation(options);
211
+ }
119
212
  /**
120
213
  * Withdraw a live invitation (POST /{id}/invitations/{invitationId}/revoke,
121
214
  * #109). The variable is the invitation id; the reply is the UPDATED row, so
@@ -324,4 +417,43 @@ export function useDeclineInvitation() {
324
417
  };
325
418
  return useMutation(options);
326
419
  }
420
+ /**
421
+ * Record the caller's home workspace (PUT /me/preferred-workspace).
422
+ *
423
+ * Invalidates the workspace list, because the list response is where the
424
+ * choice is READ back from (`preferred_workspace_id`) — one round trip, and
425
+ * no window in which the list has arrived but the answer has not.
426
+ *
427
+ * Callers should treat this as fire-and-forget: {@link useWorkspaceSelection}
428
+ * switches the tab locally and never blocks on the round trip. A switch that
429
+ * hangs on a flaky network is worse than a preference that lags one click.
430
+ */
431
+ export function useSetPreferredWorkspace() {
432
+ const api = useWorkspacesApi();
433
+ const queryClient = useQueryClient();
434
+ const options = {
435
+ mutationFn: (body) => api.setPreferredWorkspace(body),
436
+ onSuccess: () => {
437
+ void queryClient.invalidateQueries({
438
+ queryKey: workspacesQueryKeys.list(),
439
+ });
440
+ },
441
+ };
442
+ return useMutation(options);
443
+ }
444
+ /** Clear the caller's home workspace (DELETE /me/preferred-workspace) — back
445
+ * to the instance default and the rest of the resolution chain. Idempotent. */
446
+ export function useClearPreferredWorkspace() {
447
+ const api = useWorkspacesApi();
448
+ const queryClient = useQueryClient();
449
+ const options = {
450
+ mutationFn: () => api.clearPreferredWorkspace(),
451
+ onSuccess: () => {
452
+ void queryClient.invalidateQueries({
453
+ queryKey: workspacesQueryKeys.list(),
454
+ });
455
+ },
456
+ };
457
+ return useMutation(options);
458
+ }
327
459
  //# sourceMappingURL=mutations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/model/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoBpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;GAWG;AAEH,wEAAwE;AACxE,MAAM,UAAU,kBAAkB;IAKhC,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GACX;QACE,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;QAC/C,SAAS,EAAE,GAAG,EAAE;YACd,KAAK,WAAW,CAAC,iBAAiB,CAAC;gBACjC,QAAQ,EAAE,mBAAmB,CAAC,IAAI,EAAE;aACrC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IACJ,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,WAAmB;IAEnB,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GACX;QACE,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC;QAC9D,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YACrB,WAAW,CAAC,YAAY,CACtB,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,EACvC,OAAO,CACR,CAAC;YACF,KAAK,WAAW,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GAAG,CAAC,uBAAuB,EAAE;QAC/C,SAAS,EAAE,GAAG,EAAE;YACd,KAAK,WAAW,CAAC,iBAAiB,CAAC;gBACjC,QAAQ,EAAE,mBAAmB,CAAC,IAAI,EAAE;aACrC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IACF,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC"}
@@ -4,6 +4,7 @@ export declare const workspacesQueryKeys: {
4
4
  list(): readonly ["workspaces", "list"];
5
5
  detail(workspaceId: string): readonly ["workspaces", "detail", string];
6
6
  members(workspaceId: string): readonly ["workspaces", "members", string];
7
+ membersAll(): readonly ["workspaces", "members"];
7
8
  membersPage(workspaceId: string, params: MembersParams): readonly ["workspaces", "members", string, MembersParams];
8
9
  invitations(workspaceId: string): readonly ["workspaces", "invitations", string];
9
10
  invitationsPage(workspaceId: string, params: InvitationsParams): readonly ["workspaces", "invitations", string, InvitationsParams];
@@ -1 +1 @@
1
- {"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../src/model/queryKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAWxE,eAAO,MAAM,mBAAmB,EAAE;IAChC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACtC,IAAI,IAAI,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACxC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvE,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACzE,WAAW,CACT,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,aAAa,GACpB,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7D,WA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SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7D,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IACjF,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,GACxB,SAAS,CAAC,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACrE,mBAAmB,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,iBAAiB,GACzB,SAAS;QACV,YAAY;QACZ,aAAa;QACb,MAAM;QACN,UAAU;QACV,iBAAiB;KAClB,CAAC;IACF,KAAK,IAAI,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,IAAI,SAAS,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAChD,iBAAiB,CACf,KAAK,EAAE,MAAM,GACZ,SAAS,CAAC,YAAY,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;CA0C1D,CAAC"}
@@ -13,6 +13,13 @@ export const workspacesQueryKeys = {
13
13
  // The bare 3-tuple is a valid prefix of membersPage's 4-tuple, so
14
14
  // invalidating `members(workspaceId)` (mutations.ts) drops every page.
15
15
  members: (workspaceId) => [ROOT, "members", workspaceId],
16
+ // EVERY workspace's roster, not one. Not a read key — nothing fetches it —
17
+ // but the invalidation scope of a write that moves a name the whole fleet
18
+ // shares: `MemberResponse.display_name` is a live lookup in
19
+ // stapel-profiles, so a rename lands on the person's CANONICAL name and
20
+ // every roster that lists them is stale at once, not just the one the
21
+ // admin happened to be looking at.
22
+ membersAll: () => [ROOT, "members"],
16
23
  membersPage: (workspaceId, params) => [ROOT, "members", workspaceId, params],
17
24
  // Same prefix trick as `members`: the bare 3-tuple invalidates every page
18
25
  // (and the infinite list, which keys on it) after a revoke / resend.
@@ -1 +1 @@
1
- {"version":3,"file":"queryKeys.js","source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,IAAI,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC;IAClC,0EAA0E;IAC1E,yEAAyE;IACzE,2EAA2E;IAC3E,gBAAgB;IAChB,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,CAAC;CAClE,CAAC"}
@@ -0,0 +1,146 @@
1
+ import type { ReactElement, ReactNode } from "react";
2
+ import type { Repository } from "@stapel/core";
3
+ import type { Workspace } from "../api/types.js";
4
+ /**
5
+ * Which workspace am I in — the resolution the whole fleet was inventing
6
+ * separately, in one place.
7
+ *
8
+ * There are three places an answer can come from, and the design IS the order
9
+ * between them:
10
+ *
11
+ * 1. **the URL** — highest. This is what makes several browser tabs each work
12
+ * in a different workspace, and it only works because it is highest: a
13
+ * tab's identity must never be stolen by another tab writing shared
14
+ * storage.
15
+ * 2. **local storage** — the returning-user default on this device.
16
+ * 3. **the backend preference** (`preferred_workspace_id`, stapel-workspaces
17
+ * 0.20) — follows the person across devices and browsers.
18
+ *
19
+ * then the instance's `default_workspace_id`, then the personal workspace,
20
+ * then, and only then, the first row.
21
+ *
22
+ * `workspaces[0]` was the rule every client invented, and it is #239: the
23
+ * owner's pending invitations sat in the org workspace while his screen showed
24
+ * his personal one, because the list is ordered by `-last_accessed_at` and the
25
+ * first row is therefore "wherever you happened to be last", not a choice. It
26
+ * survives here only as step 6 — reached by someone with no URL, no local
27
+ * history, no recorded choice, no instance default and no personal workspace —
28
+ * because for the single-workspace majority it is trivially right, and
29
+ * refusing to pick would punish them with a chooser screen listing one option.
30
+ */
31
+ /** Where {@link WorkspaceSelection.current} came from — the step of the chain
32
+ * that answered. Exposed because "why am I here" is otherwise unanswerable
33
+ * from the outside, and every previous version of this bug was invisible. */
34
+ export type WorkspaceSelectionSource = "url" | "local" | "preference" | "instance-default" | "personal" | "positional";
35
+ /**
36
+ * How a host binds the URL layer. Both halves are optional: omitted, the
37
+ * library runs on the remaining layers and multi-tab independence is simply
38
+ * not available — it is not an error, it is a host that has not wired it.
39
+ *
40
+ * Controlled props rather than the library reading `window.location` itself,
41
+ * and rather than an injected `{read, write}` adapter, for one mechanical
42
+ * reason: SPA routers navigate through `history.pushState`, which emits no
43
+ * observable event. A library reading `location` could not RE-RENDER when the
44
+ * URL changed, and a `read()` adapter has the same defect in disguise (a
45
+ * correct one would need `subscribe`, re-implementing what the host router's
46
+ * own re-render already gives us for free). Writing `history` directly would
47
+ * also desynchronise the host router's location state.
48
+ */
49
+ export interface WorkspaceSelectionUrlBinding {
50
+ /**
51
+ * The workspace id the host read out of the URL — `?workspace=<uuid>` by
52
+ * convention. `null`/`undefined` means the URL names none.
53
+ *
54
+ * A query parameter, not a path segment, deliberately: a path parameter
55
+ * would force a `/w/:workspaceId/*` prefix into every host's route table,
56
+ * which is this pair dictating routing structure — the exact thing the seam
57
+ * exists to avoid.
58
+ */
59
+ readonly urlWorkspaceId?: string | null;
60
+ /**
61
+ * The URL should now name `workspaceId`. The host navigates; this pair
62
+ * never touches history itself.
63
+ *
64
+ * `reason: "switch"` is an explicit picker action and wants a history
65
+ * PUSH — back should return the person to the workspace they came from.
66
+ * `reason: "invalid-url"` is the correction after a URL named a workspace
67
+ * the person cannot open, and wants a REPLACE — a URL that does not work
68
+ * must not stay reachable with the back button.
69
+ */
70
+ readonly onUrlWorkspaceChange?: (workspaceId: string, meta: {
71
+ reason: "switch" | "invalid-url";
72
+ history: "push" | "replace";
73
+ }) => void;
74
+ }
75
+ /** What {@link useWorkspaceSelection} hands back. */
76
+ export interface WorkspaceSelection {
77
+ /** The caller's workspaces (empty before load, and for a guest). */
78
+ readonly workspaces: readonly Workspace[];
79
+ /**
80
+ * The resolved workspace — `null` while loading, and for a person who
81
+ * belongs to none.
82
+ *
83
+ * Downstream fetching must gate on THIS, never on a raw id: an id that has
84
+ * not been checked against the fetched list is exactly how a client ends up
85
+ * briefly rendering with a workspace the person cannot open.
86
+ */
87
+ readonly current: Workspace | null;
88
+ /** Which step of the chain answered, or `null` before one has. */
89
+ readonly source: WorkspaceSelectionSource | null;
90
+ /**
91
+ * The URL named a workspace that is not in the caller's list — it does not
92
+ * exist, or they are not a member, or their membership is suspended (the
93
+ * backend deliberately does not say which). Drive a visible notice off
94
+ * this. The person has already been landed somewhere sane.
95
+ */
96
+ readonly urlWorkspaceInvalid: boolean;
97
+ /** The workspace list is still loading. */
98
+ readonly loading: boolean;
99
+ /**
100
+ * An EXPLICIT choice by the person — the only entry point that persists.
101
+ * Writes the URL (push), local storage, and the backend preference.
102
+ * Returns immediately; the backend write is fire-and-forget.
103
+ */
104
+ switchTo: (workspaceId: string) => void;
105
+ /** Refetch the workspace list. */
106
+ refetch: () => Promise<void>;
107
+ }
108
+ /** Props for {@link WorkspaceSelectionProvider}. */
109
+ export interface WorkspaceSelectionProviderProps extends WorkspaceSelectionUrlBinding {
110
+ readonly children: ReactNode;
111
+ /**
112
+ * Override the local-storage layer. Injected for tests and for a host with
113
+ * its own persistence policy; the default is core's `createRepository`
114
+ * (`scope: "user"`). Pass `null` to run with NO local layer at all.
115
+ */
116
+ readonly repository?: Repository<string> | null;
117
+ }
118
+ /**
119
+ * Resolves and holds the active workspace. Wrap the part of the app that
120
+ * needs one; read it with {@link useWorkspaceSelection}.
121
+ *
122
+ * ```tsx
123
+ * // react-router 7 host — the pair never imports the router
124
+ * const [params, setParams] = useSearchParams();
125
+ * <WorkspaceSelectionProvider
126
+ * urlWorkspaceId={params.get("workspace")}
127
+ * onUrlWorkspaceChange={(id, { history }) =>
128
+ * setParams((prev) => {
129
+ * const next = new URLSearchParams(prev);
130
+ * next.set("workspace", id);
131
+ * return next;
132
+ * }, { replace: history === "replace" })}
133
+ * >
134
+ * <App />
135
+ * </WorkspaceSelectionProvider>
136
+ * ```
137
+ */
138
+ export declare function WorkspaceSelectionProvider(props: WorkspaceSelectionProviderProps): ReactElement;
139
+ /**
140
+ * The resolved active workspace. Throws outside
141
+ * {@link WorkspaceSelectionProvider} — a silent `null` here would be read as
142
+ * "no workspace yet" and produce exactly the blank screen this pair exists to
143
+ * prevent.
144
+ */
145
+ export declare function useWorkspaceSelection(): WorkspaceSelection;
146
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../src/model/selection.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAW,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;6EAE6E;AAC7E,MAAM,MAAM,wBAAwB,GAChC,KAAK,GACL,OAAO,GACP,YAAY,GACZ,kBAAkB,GAClB,UAAU,GACV,YAAY,CAAC;AAEjB;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;;;;;;;;OASG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC9B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE;QAAE,MAAM,EAAE,QAAQ,GAAG,aAAa,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,KACpE,IAAI,CAAC;CACX;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACjD;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,kCAAkC;IAClC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAmBD,oDAAoD;AACpD,MAAM,WAAW,+BACf,SAAQ,4BAA4B;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,+BAA+B,GACrC,YAAY,CAwLd;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAQ1D"}
@@ -0,0 +1,217 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
3
+ import { createRepository } from "@stapel/core";
4
+ import { useWorkspaces } from "./queries.js";
5
+ import { useSetPreferredWorkspace } from "./mutations.js";
6
+ const SelectionContext = createContext(null);
7
+ /** The repository namespace and key holding the local-storage layer. */
8
+ const REPO_NAMESPACE = "workspaces";
9
+ const REPO_KEY = "selected";
10
+ /**
11
+ * `scope: "user"` is deliberate on both counts it implies. It is encrypted at
12
+ * rest like the rest of the session's data, and — the part that matters — it
13
+ * is wiped at logout, so the next account signed in on a shared machine
14
+ * cannot inherit the previous account's workspace pointer.
15
+ */
16
+ function defaultRepository() {
17
+ return createRepository(REPO_NAMESPACE, { scope: "user" });
18
+ }
19
+ /**
20
+ * Resolves and holds the active workspace. Wrap the part of the app that
21
+ * needs one; read it with {@link useWorkspaceSelection}.
22
+ *
23
+ * ```tsx
24
+ * // react-router 7 host — the pair never imports the router
25
+ * const [params, setParams] = useSearchParams();
26
+ * <WorkspaceSelectionProvider
27
+ * urlWorkspaceId={params.get("workspace")}
28
+ * onUrlWorkspaceChange={(id, { history }) =>
29
+ * setParams((prev) => {
30
+ * const next = new URLSearchParams(prev);
31
+ * next.set("workspace", id);
32
+ * return next;
33
+ * }, { replace: history === "replace" })}
34
+ * >
35
+ * <App />
36
+ * </WorkspaceSelectionProvider>
37
+ * ```
38
+ */
39
+ export function WorkspaceSelectionProvider(props) {
40
+ const { urlWorkspaceId, onUrlWorkspaceChange, children } = props;
41
+ const query = useWorkspaces();
42
+ const setPreferred = useSetPreferredWorkspace();
43
+ // Built once. `createRepository` registers a logout wipe hook, so calling it
44
+ // per render would register one per render.
45
+ const repoRef = useRef(undefined);
46
+ if (repoRef.current === undefined) {
47
+ repoRef.current =
48
+ props.repository === undefined ? defaultRepository() : props.repository;
49
+ }
50
+ const repo = repoRef.current;
51
+ const [localId, setLocalId] = useState(null);
52
+ const [localRead, setLocalRead] = useState(!repo);
53
+ const [chosenId, setChosenId] = useState(null);
54
+ // The local layer is read EXACTLY ONCE, at mount, and never subscribed to.
55
+ //
56
+ // That is the multi-tab requirement, stated as code. The obvious "improvement"
57
+ // is a `storage` event listener to keep tabs in sync — and it is precisely
58
+ // what breaks the feature: `storage` fires in the OTHER tabs on every write,
59
+ // so switching in tab A would drag tab B onto A's workspace, which is the
60
+ // behaviour the URL layer exists to prevent. There is no listener here, and
61
+ // there must never be one.
62
+ useEffect(() => {
63
+ if (!repo)
64
+ return;
65
+ let cancelled = false;
66
+ void repo
67
+ .get(REPO_KEY)
68
+ .then((value) => {
69
+ if (cancelled)
70
+ return;
71
+ if (typeof value === "string")
72
+ setLocalId(value);
73
+ })
74
+ .catch(() => undefined)
75
+ .finally(() => {
76
+ if (!cancelled)
77
+ setLocalRead(true);
78
+ });
79
+ return () => {
80
+ cancelled = true;
81
+ };
82
+ }, [repo]);
83
+ const workspaces = useMemo(() => query.data?.workspaces ?? [], [query.data]);
84
+ const loading = query.isLoading || !localRead;
85
+ const memberOf = useCallback((id) => id ? (workspaces.find((w) => w.id === id) ?? null) : null, [workspaces]);
86
+ // The chain. Runs against the FETCHED list only — never against an
87
+ // unresolved one, or a raw stored id would be briefly authoritative and the
88
+ // app would fetch a workspace it has not verified the person can open.
89
+ const resolved = useMemo(() => {
90
+ if (loading || workspaces.length === 0) {
91
+ return { workspace: null, source: null };
92
+ }
93
+ const explicit = memberOf(chosenId);
94
+ if (explicit)
95
+ return { workspace: explicit, source: "url" };
96
+ const fromUrl = memberOf(urlWorkspaceId);
97
+ if (fromUrl)
98
+ return { workspace: fromUrl, source: "url" };
99
+ const fromLocal = memberOf(localId);
100
+ if (fromLocal)
101
+ return { workspace: fromLocal, source: "local" };
102
+ const fromPreference = memberOf(query.data?.preferred_workspace_id);
103
+ if (fromPreference)
104
+ return { workspace: fromPreference, source: "preference" };
105
+ const fromInstance = memberOf(query.data?.default_workspace_id);
106
+ if (fromInstance)
107
+ return { workspace: fromInstance, source: "instance-default" };
108
+ const personal = workspaces.find((w) => w.type === "personal");
109
+ if (personal)
110
+ return { workspace: personal, source: "personal" };
111
+ // Last resort only — see this module's header for why it is last and why
112
+ // it is still here.
113
+ return { workspace: workspaces[0] ?? null, source: "positional" };
114
+ }, [loading, workspaces, memberOf, chosenId, urlWorkspaceId, localId, query.data]);
115
+ // The URL named something the person cannot open. Deliberately NOT an
116
+ // error state that blanks the screen, and deliberately NOT a silent
117
+ // substitution: they clicked a link expecting workspace X, and quietly
118
+ // showing workspace Y's data is the same misattribution class as #239.
119
+ // They land through the rest of the chain, and this flag drives the notice.
120
+ const urlWorkspaceInvalid = !loading &&
121
+ workspaces.length > 0 &&
122
+ chosenId === null &&
123
+ !!urlWorkspaceId &&
124
+ memberOf(urlWorkspaceId) === null;
125
+ // Correct the address bar once, with a REPLACE so the broken URL does not
126
+ // stay reachable with the back button.
127
+ const correctedFor = useRef(null);
128
+ useEffect(() => {
129
+ if (!urlWorkspaceInvalid || !resolved.workspace)
130
+ return;
131
+ if (correctedFor.current === urlWorkspaceId)
132
+ return;
133
+ correctedFor.current = urlWorkspaceId ?? null;
134
+ onUrlWorkspaceChange?.(resolved.workspace.id, {
135
+ reason: "invalid-url",
136
+ history: "replace",
137
+ });
138
+ }, [urlWorkspaceInvalid, resolved.workspace, urlWorkspaceId, onUrlWorkspaceChange]);
139
+ // A stale local pointer is DELETED rather than rewritten to the fallback.
140
+ // Writing the fallback would ossify a guess into something that outranks a
141
+ // later-corrected backend preference or instance default; deleting it just
142
+ // stops the next boot retrying a dead id.
143
+ useEffect(() => {
144
+ if (loading || !repo || localId === null)
145
+ return;
146
+ if (memberOf(localId))
147
+ return;
148
+ setLocalId(null);
149
+ void repo.del(REPO_KEY).catch(() => undefined);
150
+ }, [loading, repo, localId, memberOf]);
151
+ /**
152
+ * The only path that persists anything, and that is the whole write policy:
153
+ * a URL is per-tab CONTEXT, a picker click is a CHOICE.
154
+ *
155
+ * If resolving from a shared link wrote the preference, one link pasted into
156
+ * a chat would permanently repoint its recipient's home — so a URL-driven
157
+ * resolution writes nothing at all, on either layer. A person who is in a
158
+ * URL-driven workspace and then picks it in the switcher is making a choice,
159
+ * and that goes through here.
160
+ */
161
+ const switchTo = useCallback((workspaceId) => {
162
+ if (!workspaces.some((w) => w.id === workspaceId))
163
+ return;
164
+ setChosenId(workspaceId);
165
+ if (repo)
166
+ void repo.set(REPO_KEY, workspaceId).catch(() => undefined);
167
+ // Fire-and-forget: the tab has already switched. A switch that blocks on
168
+ // a flaky network is worse than a preference that lags one click.
169
+ setPreferred.mutate({ workspace_id: workspaceId });
170
+ onUrlWorkspaceChange?.(workspaceId, {
171
+ reason: "switch",
172
+ history: "push",
173
+ });
174
+ }, [workspaces, repo, setPreferred, onUrlWorkspaceChange]);
175
+ const refetch = useCallback(async () => {
176
+ await query.refetch();
177
+ }, [query]);
178
+ // Memoised, and that is load-bearing rather than a performance nicety
179
+ // (ironmemo #251): consumers put `current` straight into `useEffect`
180
+ // dependency arrays to refetch when the workspace changes. A fresh object
181
+ // literal here would be a new value on every render of this provider, so
182
+ // every such effect would re-run on every render — and when the effect also
183
+ // sets state, that is an unbounded render loop whose only symptom is a
184
+ // spinner that never resolves, with nothing in the console.
185
+ const value = useMemo(() => ({
186
+ workspaces,
187
+ current: resolved.workspace,
188
+ source: resolved.source,
189
+ urlWorkspaceInvalid,
190
+ loading,
191
+ switchTo,
192
+ refetch,
193
+ }), [
194
+ workspaces,
195
+ resolved.workspace,
196
+ resolved.source,
197
+ urlWorkspaceInvalid,
198
+ loading,
199
+ switchTo,
200
+ refetch,
201
+ ]);
202
+ return (_jsx(SelectionContext.Provider, { value: value, children: children }));
203
+ }
204
+ /**
205
+ * The resolved active workspace. Throws outside
206
+ * {@link WorkspaceSelectionProvider} — a silent `null` here would be read as
207
+ * "no workspace yet" and produce exactly the blank screen this pair exists to
208
+ * prevent.
209
+ */
210
+ export function useWorkspaceSelection() {
211
+ const value = useContext(SelectionContext);
212
+ if (!value) {
213
+ throw new Error("useWorkspaceSelection must be used inside <WorkspaceSelectionProvider>");
214
+ }
215
+ return value;
216
+ }
217
+ //# sourceMappingURL=selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/model/selection.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAoH1D,MAAM,gBAAgB,GACpB,aAAa,CAA4B,IAAI,CAAC,CAAC;AAEjD,wEAAwE;AACxE,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,QAAQ,GAAG,UAAU,CAAC;A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