@schemavaults/auth-ui 0.17.2 → 0.19.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 (38) 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/CreateApiServerDialog/CreateApiServerDialog.d.ts +5 -4
  8. package/dist/components/CreateApiServerDialog/CreateApiServerDialog.js.map +1 -1
  9. package/dist/components/CreateApiServerDialog/CreateApiServerForm.d.ts +5 -4
  10. package/dist/components/CreateApiServerDialog/CreateApiServerForm.js +27 -8
  11. package/dist/components/CreateApiServerDialog/CreateApiServerForm.js.map +1 -1
  12. package/dist/components/CreateAppDialog/CreateAppDialog.d.ts +5 -4
  13. package/dist/components/CreateAppDialog/CreateAppDialog.js.map +1 -1
  14. package/dist/components/CreateAppDialog/CreateAppForm.d.ts +5 -4
  15. package/dist/components/CreateAppDialog/CreateAppForm.js +27 -8
  16. package/dist/components/CreateAppDialog/CreateAppForm.js.map +1 -1
  17. package/dist/components/MfaChallengeForm/mfa-challenge-form.d.ts +1 -0
  18. package/dist/components/MfaChallengeForm/mfa-challenge-form.js +10 -1
  19. package/dist/components/MfaChallengeForm/mfa-challenge-form.js.map +1 -1
  20. package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.d.ts +31 -0
  21. package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.js +107 -0
  22. package/dist/components/ResourceOwnershipPicker/ResourceOwnershipPicker.js.map +1 -0
  23. package/dist/components/ResourceOwnershipPicker/index.d.ts +8 -0
  24. package/dist/components/ResourceOwnershipPicker/index.js +5 -0
  25. package/dist/components/ResourceOwnershipPicker/index.js.map +1 -0
  26. package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.d.ts +158 -0
  27. package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.js +203 -0
  28. package/dist/components/ResourceOwnershipPicker/resource-ownership-choices.js.map +1 -0
  29. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.d.ts +39 -0
  30. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.js +50 -0
  31. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipChoices.js.map +1 -0
  32. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.d.ts +19 -0
  33. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.js +21 -0
  34. package/dist/components/ResourceOwnershipPicker/useResourceOwnershipSelection.js.map +1 -0
  35. package/dist/components/index.d.ts +2 -0
  36. package/dist/components/index.js +1 -0
  37. package/dist/components/index.js.map +1 -1
  38. package/package.json +7 -3
@@ -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/ResourceOwnershipP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AAK,KAAK;YACR,OAAO,eAAe,IAAI,eAAe,KAAK,sBAAsB;gBAClE,CAAC,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,eAAe,EAAE;gBACxE,CAAC,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/useResourceOwnershipChoices.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,8BAA8B,EAC9B,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EACL,+BAA+B,GAIhC,MAAM,8BAA8B,CAAC;AAiCtC;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAiE,EACjE,EAAE,OAAO,GAAG,IAAI,KAA4B,EAAE;IAE9C,MAAM,WAAW,GAAG,8BAA8B,EAAE,CAAC;IACrD,MAAM,sBAAsB,GAAW,4BAA4B,EAAE,CAAC;IACtE,MAAM,WAAW,GAAG,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACpD,MAAM,cAAc,GAAkB,WAAW,EAAE,GAAG,IAAI,IAAI,CAAC;IAC/D,MAAM,aAAa,GAAY,WAAW,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3D,MAAM,aAAa,GAAY,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC;IAC7D,MAAM,qBAAqB,GACzB,OAAO,CAAC,mBAAmB,EAAE,eAAe,CAAC;IAC/C,MAAM,uBAAuB,GAC3B,OAAO,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;IAEjD,MAAM,OAAO,GAAG,OAAO,CACrB,GAA6B,EAAE,CAC7B,+BAA+B,CAAC;QAC9B,aAAa;QACb,cAAc;QACd,aAAa;QACb,WAAW,EAAE,WAAW,CAAC,IAAI;QAC7B,mEAAmE;QACnE,2DAA2D;QAC3D,4CAA4C;QAC5C,kBAAkB,EAAE,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK;QAC3D,gBAAgB,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK;QACrC,sBAAsB;QACtB,mBAAmB,EAAE,qBAAqB;YACxC,CAAC,CAAC;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";
@@ -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";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC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wB,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.17.2",
3
+ "version": "0.19.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.37",
20
+ "@schemavaults/auth-react-provider": "0.16.38",
21
21
  "@schemavaults/app-definitions": "0.14.0",
22
- "@schemavaults/auth-common": "0.28.0",
22
+ "@schemavaults/auth-common": "0.29.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": {