@schemavaults/auth-ui 0.18.0 → 0.20.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 (53) hide show
  1. package/dist/components/ApiServersCard/api_servers_card.d.ts +20 -4
  2. package/dist/components/ApiServersCard/api_servers_card.js +36 -34
  3. package/dist/components/ApiServersCard/api_servers_card.js.map +1 -1
  4. package/dist/components/AppsCard/apps_card.d.ts +19 -4
  5. package/dist/components/AppsCard/apps_card.js +36 -36
  6. package/dist/components/AppsCard/apps_card.js.map +1 -1
  7. package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialog.d.ts +52 -0
  8. package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialog.js +119 -0
  9. package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialog.js.map +1 -0
  10. package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialogDispatchContext.d.ts +2 -0
  11. package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialogDispatchContext.js +8 -0
  12. package/dist/components/AssignOrganizationMemberDialog/AssignOrganizationMemberDialogDispatchContext.js.map +1 -0
  13. package/dist/components/AssignOrganizationMemberDialog/index.d.ts +3 -0
  14. package/dist/components/AssignOrganizationMemberDialog/index.js +3 -0
  15. package/dist/components/AssignOrganizationMemberDialog/index.js.map +1 -0
  16. package/dist/components/CreateApiServerDialog/CreateApiServerDialog.d.ts +5 -4
  17. package/dist/components/CreateApiServerDialog/CreateApiServerDialog.js.map +1 -1
  18. package/dist/components/CreateApiServerDialog/CreateApiServerForm.d.ts +5 -4
  19. package/dist/components/CreateApiServerDialog/CreateApiServerForm.js +27 -8
  20. package/dist/components/CreateApiServerDialog/CreateApiServerForm.js.map +1 -1
  21. package/dist/components/CreateAppDialog/CreateAppDialog.d.ts +5 -4
  22. package/dist/components/CreateAppDialog/CreateAppDialog.js.map +1 -1
  23. package/dist/components/CreateAppDialog/CreateAppForm.d.ts +5 -4
  24. package/dist/components/CreateAppDialog/CreateAppForm.js +27 -8
  25. package/dist/components/CreateAppDialog/CreateAppForm.js.map +1 -1
  26. package/dist/components/OrganizationMembersCard/OrganizationMembersCard.d.ts +12 -1
  27. package/dist/components/OrganizationMembersCard/OrganizationMembersCard.js +4 -1
  28. package/dist/components/OrganizationMembersCard/OrganizationMembersCard.js.map +1 -1
  29. package/dist/components/OrganizationMembersTable/OrganizationMembersTable.d.ts +8 -1
  30. package/dist/components/OrganizationMembersTable/OrganizationMembersTable.js +21 -4
  31. package/dist/components/OrganizationMembersTable/OrganizationMembersTable.js.map +1 -1
  32. package/dist/components/OrganizationMembersTable/index.d.ts +1 -1
  33. package/dist/components/OrganizationMembersTable/index.js +1 -1
  34. package/dist/components/OrganizationMembersTable/index.js.map +1 -1
  35. package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.d.ts +31 -0
  36. package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.js +107 -0
  37. package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.js.map +1 -0
  38. package/dist/components/ResourceOwnershipPicker/index.d.ts +8 -0
  39. package/dist/components/ResourceOwnershipPicker/index.js +5 -0
  40. package/dist/components/ResourceOwnershipPicker/index.js.map +1 -0
  41. package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.d.ts +158 -0
  42. package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.js +203 -0
  43. package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.js.map +1 -0
  44. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.d.ts +39 -0
  45. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.js +50 -0
  46. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.js.map +1 -0
  47. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.d.ts +19 -0
  48. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.js +21 -0
  49. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.js.map +1 -0
  50. package/dist/components/index.d.ts +5 -1
  51. package/dist/components/index.js +3 -1
  52. package/dist/components/index.js.map +1 -1
  53. package/package.json +7 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceOwnershipPicker.js","sourceRoot":"","sources":["../../../src/components/ResourceOwnershipPicker/ResourceOwnershipPicker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EACL,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,EAAE,GACH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,GAKhC,MAAM,8BAA8B,CAAC;AAItC,MAAM,cAAc,GAGhB;IACF,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE;IACxC,YAAY,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE;CAChE,CAAC;AAEF,SAAS,4BAA4B,CACnC,KAAa;IAEb,OAAQ,8BAAoD,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,qBAAqB,CAC5B,MAA0C,EAC1C,UAAkB;IAElB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,4BAA4B;YAC/B,OAAO,4CAA4C,UAAU,kBAAkB,CAAC;QAClF,KAAK,iBAAiB;YACpB,OAAO,uBAAuB,CAAC;QACjC,KAAK,uBAAuB;YAC1B,OAAO,6BAA6B,CAAC;QACvC,KAAK,qBAAqB;YACxB,OAAO,mCAAmC,CAAC;QAC7C,KAAK,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ker as default, } from "./ResourceOwnershipPicker";
2
+ export type * from "./ResourceOwnershipPicker";
3
+ export { useResourceOwnershipChoices } from "./useResourceOwnershipChoices";
4
+ export type * from "./useResourceOwnershipChoices";
5
+ export { useResourceOwnershipSelection } from "./useResourceOwnershipSelection";
6
+ export type * from "./useResourceOwnershipSelection";
7
+ export { CREATABLE_RESOURCE_OWNER_TYPES, computeResourceOwnershipChoices, hasAvailableResourceOwnership, isResourceOwnershipSelectionAvailable, defaultOrganizationForSelection, resolveDefaultResourceOwnershipSelection, resourceOwnershipSelectionToRequestedOwnership, describeRequestedResourceOwnership, preferredResourceOwnershipForList, } from "./resource-ownership-choices";
8
+ export type * from "./resource-ownership-choices";
@@ -0,0 +1,5 @@
1
+ export { ResourceOwnershipPicker, ResourceOwnershipPicker as default, } from "./ResourceOwnershipPicker";
2
+ export { useResourceOwnershipChoices } from "./useResourceOwnershipChoices";
3
+ export { useResourceOwnershipSelection } from "./useResourceOwnershipSelection";
4
+ export { CREATABLE_RESOURCE_OWNER_TYPES, computeResourceOwnershipChoices, hasAvailableResourceOwnership, isResourceOwnershipSelectionAvailable, defaultOrganizationForSelection, resolveDefaultResourceOwnershipSelection, resourceOwnershipSelectionToRequestedOwnership, describeRequestedResourceOwnership, preferredResourceOwnershipForList, } from "./resource-ownership-choices";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ResourceOwnershipPicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,IAAI,OAAO,GACnC,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAGhF,OAAO,EACL,8BAA8B,EAC9B,+BAA+B,EAC/B,6BAA6B,EAC7B,qCAAqC,EACrC,+BAA+B,EAC/B,wCAAwC,EACxC,8CAA8C,EAC9C,kCAAkC,EAClC,iCAAiC,GAClC,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,158 @@
1
+ import type { RequestedResourceOwnership } from "@schemavaults/app-definitions";
2
+ import type { OrganizationMembershipRoleDetails } from "@schemavaults/auth-common";
3
+ /**
4
+ * The owner types a create dialog can offer. Dynamically registered clients
5
+ * are never requested through the create dialogs (only
6
+ * `POST /api/oidc/register` creates them).
7
+ */
8
+ export type CreatableResourceOwnerType = RequestedResourceOwnership["owner_type"];
9
+ /** Display order of the owner options in the create dialogs. */
10
+ export declare const CREATABLE_RESOURCE_OWNER_TYPES: readonly ["user", "organization", "platform"];
11
+ /**
12
+ * The owner a create dialog preselects: derived from where the dialog was
13
+ * opened (the admin console → platform, an organization page → that
14
+ * organization, the `/apps` / `/apis` pages → the viewer's account). The
15
+ * viewer can pick another owner in the dialog.
16
+ */
17
+ export type PreferredResourceOwnership = {
18
+ owner_type: "user";
19
+ } | {
20
+ owner_type: "organization";
21
+ owner_organization_id?: string | null;
22
+ } | {
23
+ owner_type: "platform";
24
+ };
25
+ /** An organization the viewer can pick as the owner of a new resource. */
26
+ export interface ResourceOwnershipOrganizationChoice {
27
+ organization_id: string;
28
+ /** Display name; `null` when unknown (the id is shown instead). */
29
+ organization_name: string | null;
30
+ }
31
+ /**
32
+ * Why an owner option is offered but cannot be picked:
33
+ * - `personal-creation-disabled`: the `allow_user_owned_resource_creation`
34
+ * server setting is off (and the viewer is not a global admin).
35
+ * - `account-loading`: the viewer's user id is not known yet.
36
+ * - `organizations-loading` / `organizations-error`: the viewer's
37
+ * organization memberships are still loading / failed to load.
38
+ * - `not-organization-admin`: the viewer belongs to organizations, but is
39
+ * not an owner/admin of any of them.
40
+ * - `no-organizations`: the viewer does not belong to any organization.
41
+ */
42
+ export type ResourceOwnershipUnavailableReason = "personal-creation-disabled" | "account-loading" | "organizations-loading" | "organizations-error" | "not-organization-admin" | "no-organizations";
43
+ /**
44
+ * Whether an owner option is shown, and whether it can be picked. Options
45
+ * the viewer can never use (platform ownership for non-admins) are hidden;
46
+ * options they could use under other circumstances are shown disabled with
47
+ * the reason.
48
+ */
49
+ export type ResourceOwnershipOptionState = {
50
+ status: "available";
51
+ } | {
52
+ status: "disabled";
53
+ reason: ResourceOwnershipUnavailableReason;
54
+ } | {
55
+ status: "hidden";
56
+ };
57
+ export interface ResourceOwnershipChoices {
58
+ user: ResourceOwnershipOptionState;
59
+ organization: ResourceOwnershipOptionState;
60
+ platform: ResourceOwnershipOptionState;
61
+ /** The organizations the viewer may create resources for. */
62
+ organizations: readonly ResourceOwnershipOrganizationChoice[];
63
+ }
64
+ export interface ComputeResourceOwnershipChoicesInput {
65
+ /** Global admins may create resources for any owner. */
66
+ isGlobalAdmin: boolean;
67
+ /** The viewer's user id; `null` while unknown. */
68
+ currentUserUid: string | null;
69
+ /**
70
+ * Whether the viewer may create personal (user-owned) resources: the
71
+ * `allow_user_owned_resource_creation` server setting, which global
72
+ * admins are exempt from.
73
+ */
74
+ allowPersonal: boolean;
75
+ /** The viewer's organization memberships (`useMyOrganizations()`). */
76
+ memberships: readonly OrganizationMembershipRoleDetails[] | undefined;
77
+ membershipsLoading: boolean;
78
+ membershipsError: boolean;
79
+ /**
80
+ * The platform's virtual organization; never offered as an organization
81
+ * owner (platform ownership is its own option).
82
+ */
83
+ platformOrganizationId: string;
84
+ /**
85
+ * The organization the dialog was opened for (an organization page whose
86
+ * viewer may manage it). Offered even when the viewer is not a member of
87
+ * it (global admins).
88
+ */
89
+ contextOrganization?: ResourceOwnershipOrganizationChoice;
90
+ }
91
+ /**
92
+ * @description Works out which owners a create dialog offers the viewer,
93
+ * mirroring the server's rules (`resolveRequestedOwnershipForCreation`):
94
+ * personal ownership needs the `allow_user_owned_resource_creation`
95
+ * setting (global admins are exempt), organization ownership needs the
96
+ * owner/admin role in that organization (global admins may use any), and
97
+ * platform ownership is for global admins only.
98
+ */
99
+ export declare function computeResourceOwnershipChoices(input: ComputeResourceOwnershipChoicesInput): ResourceOwnershipChoices;
100
+ /**
101
+ * @description Whether any owner can be picked, i.e. whether a create
102
+ * dialog could submit at all.
103
+ */
104
+ export declare function hasAvailableResourceOwnership(choices: ResourceOwnershipChoices): boolean;
105
+ /**
106
+ * The owner picked in a create dialog. `owner_organization_id` is the
107
+ * chosen organization when `owner_type` is `organization` (`null` until one
108
+ * is chosen) and always `null` otherwise.
109
+ */
110
+ export interface ResourceOwnershipSelection {
111
+ owner_type: CreatableResourceOwnerType;
112
+ owner_organization_id: string | null;
113
+ }
114
+ /**
115
+ * @description Whether a selection can still be submitted as picked: its
116
+ * owner option is available and its organization (if already chosen) is
117
+ * one the viewer may create resources for.
118
+ */
119
+ export declare function isResourceOwnershipSelectionAvailable(selection: ResourceOwnershipSelection, choices: ResourceOwnershipChoices): boolean;
120
+ /**
121
+ * @description The organization preselected when the organization owner is
122
+ * picked: the preferred one when the viewer may use it, the only one when
123
+ * there is exactly one, and none (the viewer must choose) otherwise.
124
+ */
125
+ export declare function defaultOrganizationForSelection(choices: ResourceOwnershipChoices, preferred_organization_id?: string | null): string | null;
126
+ /**
127
+ * @description The owner a create dialog preselects: the preferred owner
128
+ * when the viewer may use it, otherwise the first available option (in
129
+ * {@link CREATABLE_RESOURCE_OWNER_TYPES} order). `null` when no owner is
130
+ * available at all.
131
+ */
132
+ export declare function resolveDefaultResourceOwnershipSelection(preferred: PreferredResourceOwnership, choices: ResourceOwnershipChoices): ResourceOwnershipSelection | null;
133
+ /**
134
+ * @description Turns the owner picked in a create dialog into the ownership
135
+ * of the creation request. `null` when the selection is incomplete (no
136
+ * organization chosen yet, or the viewer's user id is unknown).
137
+ */
138
+ export declare function resourceOwnershipSelectionToRequestedOwnership(selection: ResourceOwnershipSelection, currentUserUid: string | null): RequestedResourceOwnership | null;
139
+ /**
140
+ * @description One sentence naming the owner of a newly created resource,
141
+ * e.g. for the success toast of a create dialog.
142
+ */
143
+ export declare function describeRequestedResourceOwnership(ownership: RequestedResourceOwnership, choices: ResourceOwnershipChoices, friendlyName: string): string;
144
+ /**
145
+ * @description The owner a create button preselects, from the list it sits
146
+ * on: the admin console's "all" list → platform, an organization's list →
147
+ * that organization, the viewer's own ("owned" / "accessible") lists → the
148
+ * viewer's account. An owner-type filter applied to the list takes
149
+ * precedence, so e.g. `/apps` filtered to "Organization" preselects an
150
+ * organization. `null` for lists that do not offer creation.
151
+ */
152
+ export declare function preferredResourceOwnershipForList({ queryType, organization_id, platformOrganizationId, ownerTypeFilter, }: {
153
+ queryType: string;
154
+ organization_id?: string;
155
+ platformOrganizationId: string;
156
+ /** The list's owner-type filter (`OwnerTypeFilterValue`), if any. */
157
+ ownerTypeFilter?: string;
158
+ }): PreferredResourceOwnership | null;
@@ -0,0 +1,203 @@
1
+ /** Display order of the owner options in the create dialogs. */
2
+ export const CREATABLE_RESOURCE_OWNER_TYPES = [
3
+ "user",
4
+ "organization",
5
+ "platform",
6
+ ];
7
+ /**
8
+ * @description Works out which owners a create dialog offers the viewer,
9
+ * mirroring the server's rules (`resolveRequestedOwnershipForCreation`):
10
+ * personal ownership needs the `allow_user_owned_resource_creation`
11
+ * setting (global admins are exempt), organization ownership needs the
12
+ * owner/admin role in that organization (global admins may use any), and
13
+ * platform ownership is for global admins only.
14
+ */
15
+ export function computeResourceOwnershipChoices(input) {
16
+ const allowPersonal = input.isGlobalAdmin || input.allowPersonal;
17
+ let user;
18
+ if (!allowPersonal) {
19
+ user = { status: "disabled", reason: "personal-creation-disabled" };
20
+ }
21
+ else if (!input.currentUserUid) {
22
+ user = { status: "disabled", reason: "account-loading" };
23
+ }
24
+ else {
25
+ user = { status: "available" };
26
+ }
27
+ // The platform's virtual membership (global admins) is not an
28
+ // organization owner: platform ownership is its own option.
29
+ const organizationMemberships = (input.memberships ?? []).filter((m) => m.organization_id !== input.platformOrganizationId);
30
+ const organizations = [];
31
+ const seen = new Set();
32
+ if (input.contextOrganization &&
33
+ input.contextOrganization.organization_id !== input.platformOrganizationId) {
34
+ const membership = organizationMemberships.find((m) => m.organization_id === input.contextOrganization?.organization_id);
35
+ organizations.push({
36
+ organization_id: input.contextOrganization.organization_id,
37
+ organization_name: input.contextOrganization.organization_name ??
38
+ membership?.organization_name ??
39
+ null,
40
+ });
41
+ seen.add(input.contextOrganization.organization_id);
42
+ }
43
+ for (const membership of organizationMemberships) {
44
+ if (seen.has(membership.organization_id)) {
45
+ continue;
46
+ }
47
+ if (!input.isGlobalAdmin &&
48
+ membership.role !== "owner" &&
49
+ membership.role !== "admin") {
50
+ continue;
51
+ }
52
+ organizations.push({
53
+ organization_id: membership.organization_id,
54
+ organization_name: membership.organization_name,
55
+ });
56
+ seen.add(membership.organization_id);
57
+ }
58
+ let organization;
59
+ if (organizations.length > 0) {
60
+ organization = { status: "available" };
61
+ }
62
+ else if (input.membershipsLoading && !input.memberships) {
63
+ organization = { status: "disabled", reason: "organizations-loading" };
64
+ }
65
+ else if (input.membershipsError && !input.memberships) {
66
+ organization = { status: "disabled", reason: "organizations-error" };
67
+ }
68
+ else if (organizationMemberships.length > 0) {
69
+ organization = { status: "disabled", reason: "not-organization-admin" };
70
+ }
71
+ else {
72
+ organization = { status: "disabled", reason: "no-organizations" };
73
+ }
74
+ const platform = input.isGlobalAdmin
75
+ ? { status: "available" }
76
+ : { status: "hidden" };
77
+ return { user, organization, platform, organizations };
78
+ }
79
+ /**
80
+ * @description Whether any owner can be picked, i.e. whether a create
81
+ * dialog could submit at all.
82
+ */
83
+ export function hasAvailableResourceOwnership(choices) {
84
+ return CREATABLE_RESOURCE_OWNER_TYPES.some((owner_type) => choices[owner_type].status === "available");
85
+ }
86
+ /**
87
+ * @description Whether a selection can still be submitted as picked: its
88
+ * owner option is available and its organization (if already chosen) is
89
+ * one the viewer may create resources for.
90
+ */
91
+ export function isResourceOwnershipSelectionAvailable(selection, choices) {
92
+ if (choices[selection.owner_type].status !== "available") {
93
+ return false;
94
+ }
95
+ if (selection.owner_type === "organization" &&
96
+ selection.owner_organization_id !== null) {
97
+ return choices.organizations.some((o) => o.organization_id === selection.owner_organization_id);
98
+ }
99
+ return true;
100
+ }
101
+ /**
102
+ * @description The organization preselected when the organization owner is
103
+ * picked: the preferred one when the viewer may use it, the only one when
104
+ * there is exactly one, and none (the viewer must choose) otherwise.
105
+ */
106
+ export function defaultOrganizationForSelection(choices, preferred_organization_id) {
107
+ if (preferred_organization_id &&
108
+ choices.organizations.some((o) => o.organization_id === preferred_organization_id)) {
109
+ return preferred_organization_id;
110
+ }
111
+ const [only, ...rest] = choices.organizations;
112
+ return only && rest.length === 0 ? only.organization_id : null;
113
+ }
114
+ /**
115
+ * @description The owner a create dialog preselects: the preferred owner
116
+ * when the viewer may use it, otherwise the first available option (in
117
+ * {@link CREATABLE_RESOURCE_OWNER_TYPES} order). `null` when no owner is
118
+ * available at all.
119
+ */
120
+ export function resolveDefaultResourceOwnershipSelection(preferred, choices) {
121
+ const owner_type = choices[preferred.owner_type].status === "available"
122
+ ? preferred.owner_type
123
+ : CREATABLE_RESOURCE_OWNER_TYPES.find((candidate) => choices[candidate].status === "available");
124
+ if (!owner_type) {
125
+ return null;
126
+ }
127
+ if (owner_type !== "organization") {
128
+ return { owner_type, owner_organization_id: null };
129
+ }
130
+ return {
131
+ owner_type,
132
+ owner_organization_id: defaultOrganizationForSelection(choices, preferred.owner_type === "organization"
133
+ ? preferred.owner_organization_id
134
+ : null),
135
+ };
136
+ }
137
+ /**
138
+ * @description Turns the owner picked in a create dialog into the ownership
139
+ * of the creation request. `null` when the selection is incomplete (no
140
+ * organization chosen yet, or the viewer's user id is unknown).
141
+ */
142
+ export function resourceOwnershipSelectionToRequestedOwnership(selection, currentUserUid) {
143
+ switch (selection.owner_type) {
144
+ case "user":
145
+ return currentUserUid
146
+ ? { owner_type: "user", owner_uid: currentUserUid }
147
+ : null;
148
+ case "organization":
149
+ return selection.owner_organization_id
150
+ ? {
151
+ owner_type: "organization",
152
+ owner_organization_id: selection.owner_organization_id,
153
+ }
154
+ : null;
155
+ case "platform":
156
+ return { owner_type: "platform" };
157
+ }
158
+ }
159
+ /**
160
+ * @description One sentence naming the owner of a newly created resource,
161
+ * e.g. for the success toast of a create dialog.
162
+ */
163
+ export function describeRequestedResourceOwnership(ownership, choices, friendlyName) {
164
+ switch (ownership.owner_type) {
165
+ case "user":
166
+ return "Owned by your account.";
167
+ case "organization": {
168
+ const organization = choices.organizations.find((o) => o.organization_id === ownership.owner_organization_id);
169
+ return `Owned by ${organization?.organization_name ?? ownership.owner_organization_id}.`;
170
+ }
171
+ case "platform":
172
+ return `Owned by the ${friendlyName} platform.`;
173
+ }
174
+ }
175
+ /**
176
+ * @description The owner a create button preselects, from the list it sits
177
+ * on: the admin console's "all" list → platform, an organization's list →
178
+ * that organization, the viewer's own ("owned" / "accessible") lists → the
179
+ * viewer's account. An owner-type filter applied to the list takes
180
+ * precedence, so e.g. `/apps` filtered to "Organization" preselects an
181
+ * organization. `null` for lists that do not offer creation.
182
+ */
183
+ export function preferredResourceOwnershipForList({ queryType, organization_id, platformOrganizationId, ownerTypeFilter, }) {
184
+ const filtered = ownerTypeFilter === "user" ||
185
+ ownerTypeFilter === "organization" ||
186
+ ownerTypeFilter === "platform"
187
+ ? { owner_type: ownerTypeFilter }
188
+ : null;
189
+ switch (queryType) {
190
+ case "all":
191
+ return filtered ?? { owner_type: "platform" };
192
+ case "org":
193
+ return organization_id && organization_id !== platformOrganizationId
194
+ ? { owner_type: "organization", owner_organization_id: organization_id }
195
+ : { owner_type: "platform" };
196
+ case "owned":
197
+ case "accessible":
198
+ return filtered ?? { owner_type: "user" };
199
+ default:
200
+ return null;
201
+ }
202
+ }
203
+ //# sourceMappingURL=resource-ownership-choices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-ownership-choices.js","sourceRoot":"","sources":["../../../src/components/ResourceOwnershipPicker/resource-ownership-choices.ts"],"names":[],"mappings":"AAUA,gEAAgE;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,MAAM;IACN,cAAc;IACd,UAAU;CAC8C,CAAC;AAsF3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C,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QACjC,KAAK,OAAO,CAAC;QACb,KAAK,YAAY;YACf,OAAO,QAAQ,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAC5C;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { type PreferredResourceOwnership, type ResourceOwnershipChoices, type ResourceOwnershipOrganizationChoice } from "./resource-ownership-choices";
2
+ /**
3
+ * What a create dialog needs to know to offer the right owners: which owner
4
+ * to preselect, and the page-level facts the browser cannot look up on its
5
+ * own.
6
+ */
7
+ export interface CreateResourceOwnershipOptions {
8
+ /**
9
+ * The owner preselected when the dialog opens (see
10
+ * `preferredResourceOwnershipForList()`); the viewer can pick another.
11
+ */
12
+ defaultOwnership: PreferredResourceOwnership;
13
+ /**
14
+ * Whether the viewer may create personal (user-owned) resources: the
15
+ * `allow_user_owned_resource_creation` server setting (default true;
16
+ * global admins are always allowed). The server enforces it regardless.
17
+ */
18
+ allowPersonal?: boolean;
19
+ /**
20
+ * The organization the dialog was opened for, offered even when the
21
+ * viewer is not a member of it (global admins on an organization page).
22
+ * Only pass it when the viewer may manage that organization.
23
+ */
24
+ contextOrganization?: ResourceOwnershipOrganizationChoice;
25
+ }
26
+ export interface UseResourceOwnershipChoicesResult {
27
+ choices: ResourceOwnershipChoices;
28
+ /** The viewer's user id (`null` while unknown). */
29
+ currentUserUid: string | null;
30
+ }
31
+ /**
32
+ * @description The owners the current viewer may pick for a new app / API
33
+ * server: reads their admin flag, user id and organization memberships
34
+ * (`useMyOrganizations()`, fetched only while `enabled`).
35
+ */
36
+ export declare function useResourceOwnershipChoices(options: Omit<CreateResourceOwnershipOptions, "defaultOwnership">, { enabled }?: {
37
+ enabled?: boolean;
38
+ }): UseResourceOwnershipChoicesResult;
39
+ export default useResourceOwnershipChoices;
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ import { useCurrentUserWithRevalidation, useMyOrganizations, } from "@schemavaults/auth-react-provider";
4
+ import { useAuthUiOwnerOrganizationId } from "../OwnerOrganizationProvider";
5
+ import { computeResourceOwnershipChoices, } from "./resource-ownership-choices";
6
+ /**
7
+ * @description The owners the current viewer may pick for a new app / API
8
+ * server: reads their admin flag, user id and organization memberships
9
+ * (`useMyOrganizations()`, fetched only while `enabled`).
10
+ */
11
+ export function useResourceOwnershipChoices(options, { enabled = true } = {}) {
12
+ const currentUser = useCurrentUserWithRevalidation();
13
+ const platformOrganizationId = useAuthUiOwnerOrganizationId();
14
+ const memberships = useMyOrganizations({ enabled });
15
+ const currentUserUid = currentUser?.uid ?? null;
16
+ const isGlobalAdmin = currentUser?.admin === true;
17
+ const allowPersonal = options.allowPersonal ?? true;
18
+ const contextOrganizationId = options.contextOrganization?.organization_id;
19
+ const contextOrganizationName = options.contextOrganization?.organization_name;
20
+ const choices = useMemo(() => computeResourceOwnershipChoices({
21
+ isGlobalAdmin,
22
+ currentUserUid,
23
+ allowPersonal,
24
+ memberships: memberships.data,
25
+ // Until the first response (including while the auth client is not
26
+ // ready yet, when SWR has not started fetching), treat the
27
+ // memberships as loading rather than empty.
28
+ membershipsLoading: !memberships.data && !memberships.error,
29
+ membershipsError: !!memberships.error,
30
+ platformOrganizationId,
31
+ contextOrganization: contextOrganizationId
32
+ ? {
33
+ organization_id: contextOrganizationId,
34
+ organization_name: contextOrganizationName ?? null,
35
+ }
36
+ : undefined,
37
+ }), [
38
+ isGlobalAdmin,
39
+ currentUserUid,
40
+ allowPersonal,
41
+ memberships.data,
42
+ memberships.error,
43
+ platformOrganizationId,
44
+ contextOrganizationId,
45
+ contextOrganizationName,
46
+ ]);
47
+ return { choices, currentUserUid };
48
+ }
49
+ export default useResourceOwnershipChoices;
50
+ //# sourceMappingURL=useResourceOwnershipChoices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResourceOwnershipChoices.js","sourceRoot":"","sources":["../../../src/components/ResourceOwnershipPicker/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gBACE,eAAe,EAAE,qBAAqB;gBACtC,iBAAiB,EAAE,uBAAuB,IAAI,IAAI;aACnD;YACH,CAAC,CAAC,SAAS;KACd,CAAC,EACJ;QACE,aAAa;QACb,cAAc;QACd,aAAa;QACb,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,KAAK;QACjB,sBAAsB;QACtB,qBAAqB;QACrB,uBAAuB;KACxB,CACF,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;AACrC,CAAC;AAED,eAAe,2BAA2B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type PreferredResourceOwnership, type ResourceOwnershipChoices, type ResourceOwnershipSelection } from "./resource-ownership-choices";
2
+ export interface UseResourceOwnershipSelectionResult {
3
+ /**
4
+ * The owner currently picked: the viewer's own pick while it is still
5
+ * available, otherwise the default for the dialog. `null` when no owner
6
+ * is available at all.
7
+ */
8
+ selection: ResourceOwnershipSelection | null;
9
+ setSelection: (selection: ResourceOwnershipSelection) => void;
10
+ /** Forgets the viewer's pick (back to the default). */
11
+ resetSelection: () => void;
12
+ }
13
+ /**
14
+ * @description The owner picked in a create dialog. Until the viewer picks
15
+ * one, the default follows the choices as they load (e.g. the organization
16
+ * list arriving after the dialog opened).
17
+ */
18
+ export declare function useResourceOwnershipSelection(defaultOwnership: PreferredResourceOwnership, choices: ResourceOwnershipChoices): UseResourceOwnershipSelectionResult;
19
+ export default useResourceOwnershipSelection;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { useState } from "react";
3
+ import { isResourceOwnershipSelectionAvailable, resolveDefaultResourceOwnershipSelection, } from "./resource-ownership-choices";
4
+ /**
5
+ * @description The owner picked in a create dialog. Until the viewer picks
6
+ * one, the default follows the choices as they load (e.g. the organization
7
+ * list arriving after the dialog opened).
8
+ */
9
+ export function useResourceOwnershipSelection(defaultOwnership, choices) {
10
+ const [picked, setPicked] = useState(null);
11
+ const selection = picked && isResourceOwnershipSelectionAvailable(picked, choices)
12
+ ? picked
13
+ : resolveDefaultResourceOwnershipSelection(defaultOwnership, choices);
14
+ return {
15
+ selection,
16
+ setSelection: setPicked,
17
+ resetSelection: () => setPicked(null),
18
+ };
19
+ }
20
+ export default useResourceOwnershipSelection;
21
+ //# sourceMappingURL=useResourceOwnershipSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResourceOwnershipSelection.js","sourceRoot":"","sources":["../../../src/components/ResourceOwnershipPicker/useResourceOwnershipSelection.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACL,qCAAqC,EACrC,wCAAwC,GAIzC,MAAM,8BAA8B,CAAC;AActC;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAC3C,gBAA4C,EAC5C,OAAiC;IAEjC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAClC,IAAI,CACL,CAAC;IACF,MAAM,SAAS,GACb,MAAM,IAAI,qCAAqC,CAAC,MAAM,EAAE,OAAO,CAAC;QAC9D,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,wCAAwC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC1E,OAAO;QACL,SAAS;QACT,YAAY,EAAE,SAAS;QACvB,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,eAAe,6BAA6B,CAAC"}
@@ -8,6 +8,8 @@ export { ResourceOwnerLabel, useResolvedResourceOwnership, useCanManageListedRes
8
8
  export type { ResourceOwnerLabelProps, UseCanManageListedResourceOptions, } from "./ResourceOwnerLabel";
9
9
  export { OwnerTypeFilter, OWNER_TYPE_FILTER_VALUES, isOwnerTypeFilterValue, filterByOwnerType, useOwnerTypeFilteredResources, } from "./OwnerTypeFilter";
10
10
  export type { OwnerTypeFilterProps, OwnerTypeFilterValue, } from "./OwnerTypeFilter";
11
+ export { ResourceOwnershipPicker, useResourceOwnershipChoices, useResourceOwnershipSelection, CREATABLE_RESOURCE_OWNER_TYPES, computeResourceOwnershipChoices, hasAvailableResourceOwnership, isResourceOwnershipSelectionAvailable, defaultOrganizationForSelection, resolveDefaultResourceOwnershipSelection, resourceOwnershipSelectionToRequestedOwnership, describeRequestedResourceOwnership, preferredResourceOwnershipForList, } from "./ResourceOwnershipPicker";
12
+ export type * from "./ResourceOwnershipPicker";
11
13
  export * from "./SignOutButton";
12
14
  export type * from "./SignOutButton";
13
15
  export * from "./AppsCard";
@@ -46,10 +48,12 @@ export { CreateOrganizationDialog } from "./CreateOrganizationDialog";
46
48
  export type * from "./CreateOrganizationDialog";
47
49
  export { CreateOrganizationForm } from "./CreateOrganizationForm";
48
50
  export type { CreateOrganizationFormProps } from "./CreateOrganizationForm";
49
- export { OrganizationMembersTable } from "./OrganizationMembersTable";
51
+ export { OrganizationMembersTable, getOrganizationMembersEndpoint, } from "./OrganizationMembersTable";
50
52
  export type { OrganizationMembersDatatableProps, OrganizationMemberTableData, } from "./OrganizationMembersTable";
51
53
  export { OrganizationMembersCard } from "./OrganizationMembersCard";
52
54
  export type { OrganizationMembersCardProps } from "./OrganizationMembersCard";
55
+ export { AssignOrganizationMemberDialog, AssignOrganizationMemberDialogTriggerButton, AssignOrganizationMemberDialogDispatchContext, } from "./AssignOrganizationMemberDialog";
56
+ export type { AssignOrganizationMemberDialogProps, AssignOrganizationMemberDialogOpenTriggerProps, AssignOrganizationMemberDialogUser, AssignOrganizationMemberDialogOrganizationOption, AssignMemberSubmitData, } from "./AssignOrganizationMemberDialog";
53
57
  export { InviteMemberDialog } from "./InviteMemberDialog";
54
58
  export type { InviteMemberDialogProps, InviteMemberSubmitData, } from "./InviteMemberDialog";
55
59
  export { PendingInvitationsTable } from "./PendingInvitationsTable";
@@ -3,6 +3,7 @@ export { AuthUiFriendlyNameProvider, useAuthUiFriendlyName, DEFAULT_AUTH_UI_FRIE
3
3
  export { AuthUiOwnerOrganizationProvider, useAuthUiOwnerOrganizationId, } from "./OwnerOrganizationProvider";
4
4
  export { ResourceOwnerLabel, useResolvedResourceOwnership, useCanManageListedResource, } from "./ResourceOwnerLabel";
5
5
  export { OwnerTypeFilter, OWNER_TYPE_FILTER_VALUES, isOwnerTypeFilterValue, filterByOwnerType, useOwnerTypeFilteredResources, } from "./OwnerTypeFilter";
6
+ export { ResourceOwnershipPicker, useResourceOwnershipChoices, useResourceOwnershipSelection, CREATABLE_RESOURCE_OWNER_TYPES, computeResourceOwnershipChoices, hasAvailableResourceOwnership, isResourceOwnershipSelectionAvailable, defaultOrganizationForSelection, resolveDefaultResourceOwnershipSelection, resourceOwnershipSelectionToRequestedOwnership, describeRequestedResourceOwnership, preferredResourceOwnershipForList, } from "./ResourceOwnershipPicker";
6
7
  export * from "./SignOutButton";
7
8
  export * from "./AppsCard";
8
9
  export { useAppsList } from "./AppsTable";
@@ -22,8 +23,9 @@ export { MyOrganizationsCard } from "./MyOrganizationsCard";
22
23
  export { MyOrganizationsStatsRow, MyOrganizationsStatCard, } from "./MyOrganizationsStatsRow";
23
24
  export { CreateOrganizationDialog } from "./CreateOrganizationDialog";
24
25
  export { CreateOrganizationForm } from "./CreateOrganizationForm";
25
- export { OrganizationMembersTable } from "./OrganizationMembersTable";
26
+ export { OrganizationMembersTable, getOrganizationMembersEndpoint, } from "./OrganizationMembersTable";
26
27
  export { OrganizationMembersCard } from "./OrganizationMembersCard";
28
+ export { AssignOrganizationMemberDialog, AssignOrganizationMemberDialogTriggerButton, AssignOrganizationMemberDialogDispatchContext, } from "./AssignOrganizationMemberDialog";
27
29
  export { InviteMemberDialog } from "./InviteMemberDialog";
28
30
  export { PendingInvitationsTable } from "./PendingInvitationsTable";
29
31
  export { usePendingInvitations, clearPendingInvitationsCache, } from "./PendingInvitationsTable";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAG9B,OAAO,EACL,0BAA0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;AAE9D,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,OAAO,EACL,qBAAqB,EACrB,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,2BAA2B,EAC3B,sCAAsC,EACtC,8CAA8C,GAC/C,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schemavaults/auth-ui",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "description": "React.js UI components for authentication/authorization shared between different SchemaVaults apps",
@@ -17,9 +17,9 @@
17
17
  "react-dom": "^19.2.8",
18
18
  "next": "^16.3.5",
19
19
  "@schemavaults/ui": "^0.111.0",
20
- "@schemavaults/auth-react-provider": "0.16.38",
20
+ "@schemavaults/auth-react-provider": "0.16.39",
21
21
  "@schemavaults/app-definitions": "0.14.0",
22
- "@schemavaults/auth-common": "0.29.0",
22
+ "@schemavaults/auth-common": "0.30.0",
23
23
  "lucide-react": "0.575.0",
24
24
  "swr": "2.3.4",
25
25
  "postcss": "8.5.28",
@@ -42,7 +42,11 @@
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
45
+ "postbuild": "bun run cleanup",
46
+ "cleanup": "bun run cleanup:compiled-tests-output",
47
+ "cleanup:compiled-tests-output": "find ./dist -type f \\( -name \"*.test.js\" -o -name \"*.test.js.map\" -o -name \"*.test.d.ts\" \\) -delete",
45
48
  "lint": "eslint src --ext .ts,.tsx",
49
+ "test": "NODE_ENV=test bun test",
46
50
  "typecheck": "tsc --project tsconfig.json --noEmit"
47
51
  },
48
52
  "exports": {