@burdenoff/microfe-files 2026.1110.1 → 2026.1111.1

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/dist/files/components/ActionMenu.d.ts +6 -0
  2. package/dist/files/components/ActionMenu.js +2 -1
  3. package/dist/files/components/ActionMenu.js.map +1 -1
  4. package/dist/files/components/ContextMenu.d.ts +6 -0
  5. package/dist/files/components/ContextMenu.js +2 -0
  6. package/dist/files/components/ContextMenu.js.map +1 -1
  7. package/dist/files/components/FileBrowser.d.ts +8 -2
  8. package/dist/files/components/FileBrowser.js +214 -180
  9. package/dist/files/components/FileBrowser.js.map +1 -1
  10. package/dist/files/components/FileCard.d.ts +5 -0
  11. package/dist/files/components/FileCard.js +98 -94
  12. package/dist/files/components/FileCard.js.map +1 -1
  13. package/dist/files/components/FileListItem.d.ts +5 -0
  14. package/dist/files/components/FileListItem.js +88 -87
  15. package/dist/files/components/FileListItem.js.map +1 -1
  16. package/dist/files/components/FilePreviewModal.d.ts +6 -1
  17. package/dist/files/components/FilePreviewModal.js +30 -29
  18. package/dist/files/components/FilePreviewModal.js.map +1 -1
  19. package/dist/files/components/FolderCard.d.ts +5 -0
  20. package/dist/files/components/FolderCard.js +108 -104
  21. package/dist/files/components/FolderCard.js.map +1 -1
  22. package/dist/files/components/ShareDialog.d.ts +12 -5
  23. package/dist/files/components/ShareDialog.js +348 -188
  24. package/dist/files/components/ShareDialog.js.map +1 -1
  25. package/dist/files/components/UploadQueue.js +1 -1
  26. package/dist/files/components/contextMenuItems.d.ts +32 -0
  27. package/dist/files/components/contextMenuItems.js +6 -2
  28. package/dist/files/components/contextMenuItems.js.map +1 -1
  29. package/dist/files/hooks/useShareDialogPermission.d.ts +45 -0
  30. package/dist/files/hooks/useShareDialogPermission.js +31 -0
  31. package/dist/files/hooks/useShareDialogPermission.js.map +1 -0
  32. package/dist/files/hooks/useSharePermissions.d.ts +26 -0
  33. package/dist/files/hooks/useSharePermissions.js +81 -0
  34. package/dist/files/hooks/useSharePermissions.js.map +1 -0
  35. package/dist/files/pages/BrowserPage.js +340 -336
  36. package/dist/files/pages/BrowserPage.js.map +1 -1
  37. package/dist/files/utils/sharePermission.d.ts +140 -0
  38. package/dist/files/utils/sharePermission.js +77 -0
  39. package/dist/files/utils/sharePermission.js.map +1 -0
  40. package/dist/generated/wspace-operations.d.ts +20 -0
  41. package/dist/generated/wspace-operations.js +141 -1
  42. package/dist/generated/wspace-operations.js.map +1 -1
  43. package/dist/translations/en.d.ts +16 -0
  44. package/dist/translations/en.js +16 -0
  45. package/dist/translations/en.js.map +1 -1
  46. package/package.json +1 -1
@@ -0,0 +1,140 @@
1
+ import { I18nContextValue } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';
2
+ /**
3
+ * Whether the current user may share a file or folder (BOFF-10039).
4
+ *
5
+ * What wspace-files-svc enforces:
6
+ *
7
+ * - Files: SHARE is checked only for PRIVATE and TEAM files (the uploader, a
8
+ * SHARE or MANAGE grant, or a MANAGER share). Sharing a WORKSPACE or PUBLIC
9
+ * file is governed by the gateway's `@rbac(share, file)` alone, and
10
+ * `getUserFilePermissions.canShare` only reflects explicit grants there, so
11
+ * it must not be used to block those files.
12
+ * - Folders: every folder share needs folder SHARE (the creator, a SHARE or
13
+ * MANAGE folder grant, or a MANAGER folder share), so
14
+ * `getUserFolderPermissions.canShare` is authoritative for all folders.
15
+ *
16
+ * Listing payloads do not carry that bit, so the browser resolves it lazily
17
+ * through `getUserFilePermissions` / `getUserFolderPermissions` for the one item
18
+ * the user is about to act on.
19
+ *
20
+ * - `checking`: the permission query is in flight.
21
+ * - `allowed`: the service reported `canShare: true`.
22
+ * - `denied`: the service reported `canShare: false`.
23
+ * - `unknown`: the query failed, including a FORBIDDEN refusal of the query
24
+ * itself (it needs `@rbac(read, file-permission)`, which some
25
+ * product roles lack). The UI falls through here: the share
26
+ * mutation still enforces the rule, and its FORBIDDEN is the
27
+ * authoritative denial, which the share dialog explains.
28
+ *
29
+ * Only `denied` marks a Share entry point as denied. Every entry point, denied
30
+ * or not, opens the share dialog, which re-checks and shows the denied state.
31
+ */
32
+ export type SharePermissionStatus = "checking" | "allowed" | "denied" | "unknown";
33
+ export type ShareTargetKind = "file" | "folder";
34
+ export interface ShareTarget {
35
+ kind: ShareTargetKind;
36
+ id: string;
37
+ }
38
+ /**
39
+ * True when wspace-files-svc enforces SHARE for a file with this visibility.
40
+ * An unknown or missing visibility is not gated: the share mutation still
41
+ * decides, so the UI never blocks on a guess.
42
+ */
43
+ export declare function fileShareRequiresPermission(visibility: string | null | undefined): boolean;
44
+ /**
45
+ * The permission lookup target for sharing a file, or `null` when the file's
46
+ * visibility means `canShare` must not gate it (WORKSPACE/PUBLIC).
47
+ */
48
+ export declare function fileShareTarget(file: {
49
+ id: string;
50
+ visibility?: string | null;
51
+ }): ShareTarget | null;
52
+ /** The permission lookup target for sharing a folder (always gated). */
53
+ export declare function folderShareTarget(folder: {
54
+ id: string;
55
+ }): ShareTarget;
56
+ export declare function shareTargetKey(target: ShareTarget): string;
57
+ /**
58
+ * Map a permission query outcome onto a share status. A failed query, a
59
+ * FORBIDDEN refusal of the query included, is `unknown`, never `denied`.
60
+ */
61
+ export declare function resolveSharePermissionStatus(input: {
62
+ loading: boolean;
63
+ error?: unknown;
64
+ canShare?: boolean | null;
65
+ }): SharePermissionStatus;
66
+ /**
67
+ * The explanation a Share entry point carries for a given status. Only a
68
+ * confirmed `denied` is marked (with an explanation); the entry point still
69
+ * opens the share dialog, which re-checks and shows the denied state, so a
70
+ * click is never swallowed (touch devices have no tooltip to explain it).
71
+ */
72
+ export declare function shareEntryDeniedReason(status: SharePermissionStatus | undefined, messages: SharePermissionMessages): string | undefined;
73
+ /** How long a `denied` answer is trusted before the next interaction re-asks. */
74
+ export declare const DENIED_SHARE_PERMISSION_TTL_MS = 30000;
75
+ export interface SharePermissionEntry {
76
+ status: SharePermissionStatus;
77
+ /** When the status was recorded (ms since epoch). */
78
+ at: number;
79
+ }
80
+ /**
81
+ * Whether an interaction should (re)query SHARE for an item, given what the
82
+ * listing already knows about it.
83
+ *
84
+ * - never asked, or the last attempt failed (`unknown`): ask.
85
+ * - in flight (`checking`) or `allowed`: do not ask again.
86
+ * - `denied`: ask again once the answer is older than `deniedTtlMs`, so a
87
+ * grant made since then is picked up without reloading the view.
88
+ */
89
+ export declare function shouldLookUpSharePermission(entry: SharePermissionEntry | undefined, now: number, deniedTtlMs?: number): boolean;
90
+ /**
91
+ * The status a share dialog may show before its own re-check answers: a
92
+ * denial the listing recorded within the TTL is shown at once, anything else
93
+ * (including an expired denial) waits for the dialog's own lookup.
94
+ */
95
+ export declare function knownShareDenial(entry: SharePermissionEntry | undefined, now: number, deniedTtlMs?: number): "denied" | undefined;
96
+ /**
97
+ * Where an authorization refusal of a share came from.
98
+ *
99
+ * - `service`: wspace-files-svc refused the share (PRIVATE/TEAM files, all
100
+ * folders). It arrives as HTTP 200 with `errors[].extensions.code`
101
+ * FORBIDDEN, which Apollo 4 surfaces as `CombinedGraphQLErrors`.
102
+ * - `gateway`: the gateway's `@rbac` rule refused the caller's role. It
103
+ * arrives as HTTP 403 with a JSON body, which Apollo 4 surfaces as a
104
+ * `ServerError` carrying `statusCode` and `bodyText` and no errors array.
105
+ *
106
+ * Anything else, a 503 RBAC_SERVICE_UNAVAILABLE included, is not a denial.
107
+ */
108
+ export type ShareRefusalSource = "service" | "gateway";
109
+ export declare function classifyShareRefusal(error: unknown): ShareRefusalSource | null;
110
+ /** True when an Apollo error is an authorization refusal (service or gateway). */
111
+ export declare function isForbiddenError(error: unknown): boolean;
112
+ /**
113
+ * Which explanation a denied share dialog shows.
114
+ *
115
+ * - `restricted`: a PRIVATE/TEAM file the service refused (or reported
116
+ * `canShare: false` for); only its owner, a Share/Manage grant or a manager
117
+ * can share it.
118
+ * - `folder`: a folder the service refused; folder shares need folder SHARE.
119
+ * - `role`: the gateway refused the caller's workspace role, or the file is
120
+ * WORKSPACE/PUBLIC, where only the gateway's `@rbac` rule applies.
121
+ */
122
+ export type ShareDenialCause = "restricted" | "folder" | "role";
123
+ export declare function shareDenialCause(input: {
124
+ itemType: ShareTargetKind;
125
+ visibility?: string | null;
126
+ /** `permission`: the dialog's own SHARE lookup reported `canShare: false`. */
127
+ source: ShareRefusalSource | "permission";
128
+ }): ShareDenialCause;
129
+ export interface ShareDenialCopy {
130
+ title: string;
131
+ description: string;
132
+ }
133
+ /** Copy for a denied share dialog, matched to the cause of the denial. */
134
+ export declare function shareDenialCopy(t: I18nContextValue["t"], cause: ShareDenialCause, itemTypeLabel: string): ShareDenialCopy;
135
+ export interface SharePermissionMessages {
136
+ checking: string;
137
+ denied: string;
138
+ }
139
+ /** Copy shown on a Share entry point that is not (yet) usable. */
140
+ export declare function sharePermissionMessages(t: I18nContextValue["t"]): SharePermissionMessages;
@@ -0,0 +1,77 @@
1
+ import { tWithFallback as e } from "./i18n.js";
2
+ import { CombinedGraphQLErrors as t, ServerError as n } from "@apollo/client";
3
+ // src/files/utils/sharePermission.ts
4
+ var r = /* @__PURE__ */ new Set(["PRIVATE", "TEAM"]);
5
+ function i(e) {
6
+ return typeof e == "string" && r.has(e.toUpperCase());
7
+ }
8
+ function a(e) {
9
+ return i(e.visibility) ? {
10
+ kind: "file",
11
+ id: e.id
12
+ } : null;
13
+ }
14
+ function o(e) {
15
+ return {
16
+ kind: "folder",
17
+ id: e.id
18
+ };
19
+ }
20
+ function s(e) {
21
+ return `${e.kind}:${e.id}`;
22
+ }
23
+ function c(e) {
24
+ return e.error ? "unknown" : typeof e.canShare == "boolean" ? e.canShare ? "allowed" : "denied" : e.loading ? "checking" : "unknown";
25
+ }
26
+ function l(e, t) {
27
+ return e === "denied" ? t.denied : void 0;
28
+ }
29
+ var u = 3e4;
30
+ function d(e, t, n = u) {
31
+ if (!e) return !0;
32
+ switch (e.status) {
33
+ case "checking":
34
+ case "allowed": return !1;
35
+ case "denied": return t - e.at >= n;
36
+ default: return !0;
37
+ }
38
+ }
39
+ function f(e, t, n = u) {
40
+ return e?.status === "denied" && t - e.at < n ? "denied" : void 0;
41
+ }
42
+ var p = /* @__PURE__ */ new Set(["FORBIDDEN", "PERMISSION_DENIED"]);
43
+ function m(e) {
44
+ return t.is(e) ? e.errors.some((e) => {
45
+ let t = e.extensions?.code;
46
+ return typeof t == "string" && p.has(t);
47
+ }) ? "service" : null : n.is(e) && e.statusCode === 403 ? "gateway" : null;
48
+ }
49
+ function h(e) {
50
+ return e.source === "gateway" ? "role" : e.itemType === "folder" ? "folder" : i(e.visibility) ? "restricted" : "role";
51
+ }
52
+ function g(t, n, r) {
53
+ let i = e(t, "files.shareDialog.forbidden.title", "You can't share this {{itemType}}", { itemType: r });
54
+ switch (n) {
55
+ case "restricted": return {
56
+ title: i,
57
+ description: e(t, "files.shareDialog.forbidden.restricted", "Only its owner, people with Share or Manage access, or a manager can share a private or team file. Ask one of them to share it or to give you Share access.")
58
+ };
59
+ case "folder": return {
60
+ title: i,
61
+ description: e(t, "files.shareDialog.forbidden.folder", "Only the folder's creator, people with Share or Manage access to it, or a folder manager can share a folder. Ask one of them to share it or to give you Share access.")
62
+ };
63
+ default: return {
64
+ title: i,
65
+ description: e(t, "files.shareDialog.forbidden.role", "Your workspace role doesn't allow sharing. Ask a workspace admin.")
66
+ };
67
+ }
68
+ }
69
+ function _(t) {
70
+ return {
71
+ checking: e(t, "files.share.permission.checking", "Checking whether you can share this…"),
72
+ denied: e(t, "files.share.permission.denied", "You don't have permission to share this. Ask its owner or a manager for Share access.")
73
+ };
74
+ }
75
+ export { u as DENIED_SHARE_PERMISSION_TTL_MS, m as classifyShareRefusal, i as fileShareRequiresPermission, a as fileShareTarget, o as folderShareTarget, f as knownShareDenial, c as resolveSharePermissionStatus, h as shareDenialCause, g as shareDenialCopy, l as shareEntryDeniedReason, _ as sharePermissionMessages, s as shareTargetKey, d as shouldLookUpSharePermission };
76
+
77
+ //# sourceMappingURL=sharePermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharePermission.js","names":["SHARE_ENFORCED_FILE_VISIBILITIES","fileShareRequiresPermission","visibility","fileShareTarget","file","folderShareTarget","folder","shareTargetKey","target","resolveSharePermissionStatus","input","shareEntryDeniedReason","status","messages","DENIED_SHARE_PERMISSION_TTL_MS","shouldLookUpSharePermission","entry","now","deniedTtlMs","knownShareDenial","FORBIDDEN_CODES","classifyShareRefusal","CombinedGraphQLErrors","error","code","graphQLError","ServerError","shareDenialCause","shareDenialCopy","title","tWithFallback","itemTypeLabel","cause","sharePermissionMessages"],"sources":["../../../src/files/utils/sharePermission.ts"],"sourcesContent":["import { CombinedGraphQLErrors, ServerError } from \"@apollo/client\";\nimport type { I18nContextValue } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\n\nimport { tWithFallback } from \"./i18n\";\n\n/**\n * Whether the current user may share a file or folder (BOFF-10039).\n *\n * What wspace-files-svc enforces:\n *\n * - Files: SHARE is checked only for PRIVATE and TEAM files (the uploader, a\n * SHARE or MANAGE grant, or a MANAGER share). Sharing a WORKSPACE or PUBLIC\n * file is governed by the gateway's `@rbac(share, file)` alone, and\n * `getUserFilePermissions.canShare` only reflects explicit grants there, so\n * it must not be used to block those files.\n * - Folders: every folder share needs folder SHARE (the creator, a SHARE or\n * MANAGE folder grant, or a MANAGER folder share), so\n * `getUserFolderPermissions.canShare` is authoritative for all folders.\n *\n * Listing payloads do not carry that bit, so the browser resolves it lazily\n * through `getUserFilePermissions` / `getUserFolderPermissions` for the one item\n * the user is about to act on.\n *\n * - `checking`: the permission query is in flight.\n * - `allowed`: the service reported `canShare: true`.\n * - `denied`: the service reported `canShare: false`.\n * - `unknown`: the query failed, including a FORBIDDEN refusal of the query\n * itself (it needs `@rbac(read, file-permission)`, which some\n * product roles lack). The UI falls through here: the share\n * mutation still enforces the rule, and its FORBIDDEN is the\n * authoritative denial, which the share dialog explains.\n *\n * Only `denied` marks a Share entry point as denied. Every entry point, denied\n * or not, opens the share dialog, which re-checks and shows the denied state.\n */\nexport type SharePermissionStatus =\n \"checking\" | \"allowed\" | \"denied\" | \"unknown\";\n\nexport type ShareTargetKind = \"file\" | \"folder\";\n\nexport interface ShareTarget {\n kind: ShareTargetKind;\n id: string;\n}\n\n/** File visibilities for which the service enforces SHARE on the file itself. */\nconst SHARE_ENFORCED_FILE_VISIBILITIES = new Set([\"PRIVATE\", \"TEAM\"]);\n\n/**\n * True when wspace-files-svc enforces SHARE for a file with this visibility.\n * An unknown or missing visibility is not gated: the share mutation still\n * decides, so the UI never blocks on a guess.\n */\nexport function fileShareRequiresPermission(\n visibility: string | null | undefined,\n): boolean {\n return (\n typeof visibility === \"string\" &&\n SHARE_ENFORCED_FILE_VISIBILITIES.has(visibility.toUpperCase())\n );\n}\n\n/**\n * The permission lookup target for sharing a file, or `null` when the file's\n * visibility means `canShare` must not gate it (WORKSPACE/PUBLIC).\n */\nexport function fileShareTarget(file: {\n id: string;\n visibility?: string | null;\n}): ShareTarget | null {\n return fileShareRequiresPermission(file.visibility)\n ? { kind: \"file\", id: file.id }\n : null;\n}\n\n/** The permission lookup target for sharing a folder (always gated). */\nexport function folderShareTarget(folder: { id: string }): ShareTarget {\n return { kind: \"folder\", id: folder.id };\n}\n\nexport function shareTargetKey(target: ShareTarget): string {\n return `${target.kind}:${target.id}`;\n}\n\n/**\n * Map a permission query outcome onto a share status. A failed query, a\n * FORBIDDEN refusal of the query included, is `unknown`, never `denied`.\n */\nexport function resolveSharePermissionStatus(input: {\n loading: boolean;\n error?: unknown;\n canShare?: boolean | null;\n}): SharePermissionStatus {\n if (input.error) return \"unknown\";\n if (typeof input.canShare === \"boolean\") {\n return input.canShare ? \"allowed\" : \"denied\";\n }\n return input.loading ? \"checking\" : \"unknown\";\n}\n\n/**\n * The explanation a Share entry point carries for a given status. Only a\n * confirmed `denied` is marked (with an explanation); the entry point still\n * opens the share dialog, which re-checks and shows the denied state, so a\n * click is never swallowed (touch devices have no tooltip to explain it).\n */\nexport function shareEntryDeniedReason(\n status: SharePermissionStatus | undefined,\n messages: SharePermissionMessages,\n): string | undefined {\n return status === \"denied\" ? messages.denied : undefined;\n}\n\n/** How long a `denied` answer is trusted before the next interaction re-asks. */\nexport const DENIED_SHARE_PERMISSION_TTL_MS = 30_000;\n\nexport interface SharePermissionEntry {\n status: SharePermissionStatus;\n /** When the status was recorded (ms since epoch). */\n at: number;\n}\n\n/**\n * Whether an interaction should (re)query SHARE for an item, given what the\n * listing already knows about it.\n *\n * - never asked, or the last attempt failed (`unknown`): ask.\n * - in flight (`checking`) or `allowed`: do not ask again.\n * - `denied`: ask again once the answer is older than `deniedTtlMs`, so a\n * grant made since then is picked up without reloading the view.\n */\nexport function shouldLookUpSharePermission(\n entry: SharePermissionEntry | undefined,\n now: number,\n deniedTtlMs: number = DENIED_SHARE_PERMISSION_TTL_MS,\n): boolean {\n if (!entry) return true;\n switch (entry.status) {\n case \"checking\":\n case \"allowed\":\n return false;\n case \"denied\":\n return now - entry.at >= deniedTtlMs;\n default:\n return true;\n }\n}\n\n/**\n * The status a share dialog may show before its own re-check answers: a\n * denial the listing recorded within the TTL is shown at once, anything else\n * (including an expired denial) waits for the dialog's own lookup.\n */\nexport function knownShareDenial(\n entry: SharePermissionEntry | undefined,\n now: number,\n deniedTtlMs: number = DENIED_SHARE_PERMISSION_TTL_MS,\n): \"denied\" | undefined {\n return entry?.status === \"denied\" && now - entry.at < deniedTtlMs\n ? \"denied\"\n : undefined;\n}\n\nconst FORBIDDEN_CODES = new Set([\"FORBIDDEN\", \"PERMISSION_DENIED\"]);\n\n/**\n * Where an authorization refusal of a share came from.\n *\n * - `service`: wspace-files-svc refused the share (PRIVATE/TEAM files, all\n * folders). It arrives as HTTP 200 with `errors[].extensions.code`\n * FORBIDDEN, which Apollo 4 surfaces as `CombinedGraphQLErrors`.\n * - `gateway`: the gateway's `@rbac` rule refused the caller's role. It\n * arrives as HTTP 403 with a JSON body, which Apollo 4 surfaces as a\n * `ServerError` carrying `statusCode` and `bodyText` and no errors array.\n *\n * Anything else, a 503 RBAC_SERVICE_UNAVAILABLE included, is not a denial.\n */\nexport type ShareRefusalSource = \"service\" | \"gateway\";\n\nexport function classifyShareRefusal(\n error: unknown,\n): ShareRefusalSource | null {\n if (CombinedGraphQLErrors.is(error)) {\n const refused = error.errors.some((graphQLError) => {\n const code = graphQLError.extensions?.code;\n return typeof code === \"string\" && FORBIDDEN_CODES.has(code);\n });\n return refused ? \"service\" : null;\n }\n if (ServerError.is(error)) {\n return error.statusCode === 403 ? \"gateway\" : null;\n }\n return null;\n}\n\n/** True when an Apollo error is an authorization refusal (service or gateway). */\nexport function isForbiddenError(error: unknown): boolean {\n return classifyShareRefusal(error) !== null;\n}\n\n/**\n * Which explanation a denied share dialog shows.\n *\n * - `restricted`: a PRIVATE/TEAM file the service refused (or reported\n * `canShare: false` for); only its owner, a Share/Manage grant or a manager\n * can share it.\n * - `folder`: a folder the service refused; folder shares need folder SHARE.\n * - `role`: the gateway refused the caller's workspace role, or the file is\n * WORKSPACE/PUBLIC, where only the gateway's `@rbac` rule applies.\n */\nexport type ShareDenialCause = \"restricted\" | \"folder\" | \"role\";\n\nexport function shareDenialCause(input: {\n itemType: ShareTargetKind;\n visibility?: string | null;\n /** `permission`: the dialog's own SHARE lookup reported `canShare: false`. */\n source: ShareRefusalSource | \"permission\";\n}): ShareDenialCause {\n if (input.source === \"gateway\") return \"role\";\n if (input.itemType === \"folder\") return \"folder\";\n return fileShareRequiresPermission(input.visibility) ? \"restricted\" : \"role\";\n}\n\nexport interface ShareDenialCopy {\n title: string;\n description: string;\n}\n\n/** Copy for a denied share dialog, matched to the cause of the denial. */\nexport function shareDenialCopy(\n t: I18nContextValue[\"t\"],\n cause: ShareDenialCause,\n itemTypeLabel: string,\n): ShareDenialCopy {\n const title = tWithFallback(\n t,\n \"files.shareDialog.forbidden.title\",\n \"You can't share this {{itemType}}\",\n { itemType: itemTypeLabel },\n );\n switch (cause) {\n case \"restricted\":\n return {\n title,\n description: tWithFallback(\n t,\n \"files.shareDialog.forbidden.restricted\",\n \"Only its owner, people with Share or Manage access, or a manager can share a private or team file. Ask one of them to share it or to give you Share access.\",\n ),\n };\n case \"folder\":\n return {\n title,\n description: tWithFallback(\n t,\n \"files.shareDialog.forbidden.folder\",\n \"Only the folder's creator, people with Share or Manage access to it, or a folder manager can share a folder. Ask one of them to share it or to give you Share access.\",\n ),\n };\n default:\n return {\n title,\n description: tWithFallback(\n t,\n \"files.shareDialog.forbidden.role\",\n \"Your workspace role doesn't allow sharing. Ask a workspace admin.\",\n ),\n };\n }\n}\n\nexport interface SharePermissionMessages {\n checking: string;\n denied: string;\n}\n\n/** Copy shown on a Share entry point that is not (yet) usable. */\nexport function sharePermissionMessages(\n t: I18nContextValue[\"t\"],\n): SharePermissionMessages {\n return {\n checking: tWithFallback(\n t,\n \"files.share.permission.checking\",\n \"Checking whether you can share this…\",\n ),\n denied: tWithFallback(\n t,\n \"files.share.permission.denied\",\n \"You don't have permission to share this. Ask its owner or a manager for Share access.\",\n ),\n };\n}\n"],"mappings":";;;AA8CA,IAAMA,oBAAmC,IAAI,IAAI,CAAC,WAAW,MAAM,CAAC;AAOpE,SAAgBC,EACd,GACS;CACT,OACE,OAAOC,KAAe,YACtBF,EAAiC,IAAIE,EAAW,YAAY,CAAC;AAEjE;AAMA,SAAgBC,EAAgB,GAGT;CACrB,OAAOF,EAA4BG,EAAK,UAAU,IAC9C;EAAE,MAAM;EAAQ,IAAIA,EAAK;CAAG,IAC5B;AACN;AAGA,SAAgBC,EAAkB,GAAqC;CACrE,OAAO;EAAE,MAAM;EAAU,IAAIC,EAAO;CAAG;AACzC;AAEA,SAAgBC,EAAe,GAA6B;CAC1D,OAAO,GAAGC,EAAO,KAAK,GAAGA,EAAO;AAClC;AAMA,SAAgBC,EAA6B,GAInB;CAKxB,OAJIC,EAAM,QAAc,YACpB,OAAOA,EAAM,YAAa,YACrBA,EAAM,WAAW,YAAY,WAE/BA,EAAM,UAAU,aAAa;AACtC;AAQA,SAAgBC,EACd,GACA,GACoB;CACpB,OAAOC,MAAW,WAAWC,EAAS,SAAS,KAAA;AACjD;AAGA,IAAaC,IAAiC;AAiB9C,SAAgBC,EACd,GACA,GACA,IAAsBD,GACb;CACT,IAAI,CAACE,GAAO,OAAO;CACnB,QAAQA,EAAM,QAAd;EACE,KAAK;EACL,KAAK,WACH,OAAO;EACT,KAAK,UACH,OAAOC,IAAMD,EAAM,MAAME;EAC3B,SACE,OAAO;CACX;AACF;AAOA,SAAgBC,EACd,GACA,GACA,IAAsBL,GACA;CACtB,OAAOE,GAAO,WAAW,YAAYC,IAAMD,EAAM,KAAKE,IAClD,WACA,KAAA;AACN;AAEA,IAAME,oBAAkB,IAAI,IAAI,CAAC,aAAa,mBAAmB,CAAC;AAgBlE,SAAgBC,EACd,GAC2B;CAW3B,OAVIC,EAAsB,GAAGC,CAAK,IAChBA,EAAM,OAAO,MAAM,MAAiB;EAClD,IAAMC,IAAOC,EAAa,YAAY;EACtC,OAAO,OAAOD,KAAS,YAAYJ,EAAgB,IAAII,CAAI;CAC7D,CACO,IAAU,YAAY,OAE3BE,EAAY,GAAGH,CAAK,KACfA,EAAM,eAAe,MAAM,YAE7B;AACT;AAmBA,SAAgBI,EAAiB,GAKZ;CAGnB,OAFIjB,EAAM,WAAW,YAAkB,SACnCA,EAAM,aAAa,WAAiB,WACjCT,EAA4BS,EAAM,UAAU,IAAI,eAAe;AACxE;AAQA,SAAgBkB,EACd,GACA,GACA,GACiB;CACjB,IAAMC,IAAQC,EACZ,GACA,qCACA,qCACA,EAAE,UAAUC,EAAc,CAC5B;CACA,QAAQC,GAAR;EACE,KAAK,cACH,OAAO;GACL;GACA,aAAaF,EACX,GACA,0CACA,6JACF;EACF;EACF,KAAK,UACH,OAAO;GACL;GACA,aAAaA,EACX,GACA,sCACA,uKACF;EACF;EACF,SACE,OAAO;GACL;GACA,aAAaA,EACX,GACA,oCACA,mEACF;EACF;CACJ;AACF;AAQA,SAAgBG,EACd,GACyB;CACzB,OAAO;EACL,UAAUH,EACR,GACA,mCACA,sCACF;EACA,QAAQA,EACN,GACA,iCACA,uFACF;CACF;AACF"}
@@ -1274,6 +1274,24 @@ export type GetFoldersQuery = {
1274
1274
  }>;
1275
1275
  };
1276
1276
  };
1277
+ export type GetUserFileSharePermissionQueryVariables = Exact<{
1278
+ fileId: string;
1279
+ }>;
1280
+ export type GetUserFileSharePermissionQuery = {
1281
+ getUserFilePermissions: {
1282
+ fileId: string;
1283
+ canShare: boolean;
1284
+ };
1285
+ };
1286
+ export type GetUserFolderSharePermissionQueryVariables = Exact<{
1287
+ folderId: string;
1288
+ }>;
1289
+ export type GetUserFolderSharePermissionQuery = {
1290
+ getUserFolderPermissions: {
1291
+ folderId: string;
1292
+ canShare: boolean;
1293
+ };
1294
+ };
1277
1295
  export type GetUserStorageUsageQueryVariables = Exact<{
1278
1296
  [key: string]: never;
1279
1297
  }>;
@@ -1353,6 +1371,8 @@ export declare const GetFilesDocument: DocumentNode<GetFilesQuery, GetFilesQuery
1353
1371
  export declare const GetFolderDocument: DocumentNode<GetFolderQuery, GetFolderQueryVariables>;
1354
1372
  export declare const GetFolderPathDocument: DocumentNode<GetFolderPathQuery, GetFolderPathQueryVariables>;
1355
1373
  export declare const GetFoldersDocument: DocumentNode<GetFoldersQuery, GetFoldersQueryVariables>;
1374
+ export declare const GetUserFileSharePermissionDocument: DocumentNode<GetUserFileSharePermissionQuery, GetUserFileSharePermissionQueryVariables>;
1375
+ export declare const GetUserFolderSharePermissionDocument: DocumentNode<GetUserFolderSharePermissionQuery, GetUserFolderSharePermissionQueryVariables>;
1356
1376
  export declare const GetUserStorageUsageDocument: DocumentNode<GetUserStorageUsageQuery, GetUserStorageUsageQueryVariables>;
1357
1377
  export declare const GetWorkspaceStorageStatusDocument: DocumentNode<GetWorkspaceStorageStatusQuery, GetWorkspaceStorageStatusQueryVariables>;
1358
1378
  export {};
@@ -15455,6 +15455,146 @@ var e = {
15455
15455
  }
15456
15456
  ]
15457
15457
  }, N = {
15458
+ kind: "Document",
15459
+ definitions: [{
15460
+ kind: "OperationDefinition",
15461
+ operation: "query",
15462
+ name: {
15463
+ kind: "Name",
15464
+ value: "GetUserFileSharePermission"
15465
+ },
15466
+ variableDefinitions: [{
15467
+ kind: "VariableDefinition",
15468
+ variable: {
15469
+ kind: "Variable",
15470
+ name: {
15471
+ kind: "Name",
15472
+ value: "fileId"
15473
+ }
15474
+ },
15475
+ type: {
15476
+ kind: "NonNullType",
15477
+ type: {
15478
+ kind: "NamedType",
15479
+ name: {
15480
+ kind: "Name",
15481
+ value: "ID"
15482
+ }
15483
+ }
15484
+ }
15485
+ }],
15486
+ selectionSet: {
15487
+ kind: "SelectionSet",
15488
+ selections: [{
15489
+ kind: "Field",
15490
+ name: {
15491
+ kind: "Name",
15492
+ value: "getUserFilePermissions"
15493
+ },
15494
+ arguments: [{
15495
+ kind: "Argument",
15496
+ name: {
15497
+ kind: "Name",
15498
+ value: "fileId"
15499
+ },
15500
+ value: {
15501
+ kind: "Variable",
15502
+ name: {
15503
+ kind: "Name",
15504
+ value: "fileId"
15505
+ }
15506
+ }
15507
+ }],
15508
+ selectionSet: {
15509
+ kind: "SelectionSet",
15510
+ selections: [{
15511
+ kind: "Field",
15512
+ name: {
15513
+ kind: "Name",
15514
+ value: "fileId"
15515
+ }
15516
+ }, {
15517
+ kind: "Field",
15518
+ name: {
15519
+ kind: "Name",
15520
+ value: "canShare"
15521
+ }
15522
+ }]
15523
+ }
15524
+ }]
15525
+ }
15526
+ }]
15527
+ }, P = {
15528
+ kind: "Document",
15529
+ definitions: [{
15530
+ kind: "OperationDefinition",
15531
+ operation: "query",
15532
+ name: {
15533
+ kind: "Name",
15534
+ value: "GetUserFolderSharePermission"
15535
+ },
15536
+ variableDefinitions: [{
15537
+ kind: "VariableDefinition",
15538
+ variable: {
15539
+ kind: "Variable",
15540
+ name: {
15541
+ kind: "Name",
15542
+ value: "folderId"
15543
+ }
15544
+ },
15545
+ type: {
15546
+ kind: "NonNullType",
15547
+ type: {
15548
+ kind: "NamedType",
15549
+ name: {
15550
+ kind: "Name",
15551
+ value: "ID"
15552
+ }
15553
+ }
15554
+ }
15555
+ }],
15556
+ selectionSet: {
15557
+ kind: "SelectionSet",
15558
+ selections: [{
15559
+ kind: "Field",
15560
+ name: {
15561
+ kind: "Name",
15562
+ value: "getUserFolderPermissions"
15563
+ },
15564
+ arguments: [{
15565
+ kind: "Argument",
15566
+ name: {
15567
+ kind: "Name",
15568
+ value: "folderId"
15569
+ },
15570
+ value: {
15571
+ kind: "Variable",
15572
+ name: {
15573
+ kind: "Name",
15574
+ value: "folderId"
15575
+ }
15576
+ }
15577
+ }],
15578
+ selectionSet: {
15579
+ kind: "SelectionSet",
15580
+ selections: [{
15581
+ kind: "Field",
15582
+ name: {
15583
+ kind: "Name",
15584
+ value: "folderId"
15585
+ }
15586
+ }, {
15587
+ kind: "Field",
15588
+ name: {
15589
+ kind: "Name",
15590
+ value: "canShare"
15591
+ }
15592
+ }]
15593
+ }
15594
+ }]
15595
+ }
15596
+ }]
15597
+ }, F = {
15458
15598
  kind: "Document",
15459
15599
  definitions: [{
15460
15600
  kind: "OperationDefinition",
@@ -15549,6 +15689,6 @@ var e = {
15549
15689
  }
15550
15690
  }]
15551
15691
  };
15552
- export { e as AccessShareDocument, t as BulkDeleteFilesDocument, n as CompleteUploadDocument, r as CopyFileDocument, i as CreateFileShareLinkDocument, a as CreateFolderDocument, o as CreateFolderShareLinkDocument, s as DeleteFileDocument, c as DeleteFileVersionDocument, l as DeleteFolderDocument, A as GetFileVersionDownloadUrlDocument, j as GetFileVersionsDocument, w as GetFilesBinPageDocument, T as GetFilesFolderBrowsePageDocument, E as GetFilesRecentPageDocument, D as GetFilesRootBrowsePageDocument, O as GetFilesStarredPageDocument, M as GetFoldersDocument, N as GetWorkspaceStorageStatusDocument, u as InitiateUploadDocument, d as MoveFileDocument, f as MoveFolderDocument, p as PermanentlyDeleteFileDocument, m as PermanentlyDeleteFolderDocument, h as RestoreFileDocument, g as RestoreFileVersionDocument, _ as RestoreFolderDocument, k as SearchFilesPageDocument, v as ShareFileDocument, y as ShareFolderDocument, b as ToggleFileStarredDocument, x as ToggleFolderStarredDocument, S as UpdateFileDocument, C as UpdateFolderDocument };
15692
+ export { e as AccessShareDocument, t as BulkDeleteFilesDocument, n as CompleteUploadDocument, r as CopyFileDocument, i as CreateFileShareLinkDocument, a as CreateFolderDocument, o as CreateFolderShareLinkDocument, s as DeleteFileDocument, c as DeleteFileVersionDocument, l as DeleteFolderDocument, A as GetFileVersionDownloadUrlDocument, j as GetFileVersionsDocument, w as GetFilesBinPageDocument, T as GetFilesFolderBrowsePageDocument, E as GetFilesRecentPageDocument, D as GetFilesRootBrowsePageDocument, O as GetFilesStarredPageDocument, M as GetFoldersDocument, N as GetUserFileSharePermissionDocument, P as GetUserFolderSharePermissionDocument, F as GetWorkspaceStorageStatusDocument, u as InitiateUploadDocument, d as MoveFileDocument, f as MoveFolderDocument, p as PermanentlyDeleteFileDocument, m as PermanentlyDeleteFolderDocument, h as RestoreFileDocument, g as RestoreFileVersionDocument, _ as RestoreFolderDocument, k as SearchFilesPageDocument, v as ShareFileDocument, y as ShareFolderDocument, b as ToggleFileStarredDocument, x as ToggleFolderStarredDocument, S as UpdateFileDocument, C as UpdateFolderDocument };
15553
15693
 
15554
15694
  //# sourceMappingURL=wspace-operations.js.map