@burdenoff/microfe-files 2026.1110.2 → 2026.1111.2

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 (69) 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 +275 -238
  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/useBrowsePage.d.ts +10 -0
  30. package/dist/files/hooks/useCopyFile.d.ts +3 -0
  31. package/dist/files/hooks/useCreateFolder.d.ts +2 -0
  32. package/dist/files/hooks/useFoldersQuery.d.ts +1 -1
  33. package/dist/files/hooks/useKeyboardNavigation.js +57 -56
  34. package/dist/files/hooks/useKeyboardNavigation.js.map +1 -1
  35. package/dist/files/hooks/useMoveFile.d.ts +3 -0
  36. package/dist/files/hooks/useMoveFolder.d.ts +2 -0
  37. package/dist/files/hooks/useRenameFile.d.ts +3 -0
  38. package/dist/files/hooks/useRenameFolder.d.ts +2 -0
  39. package/dist/files/hooks/useRestoreFile.d.ts +3 -0
  40. package/dist/files/hooks/useRestoreFolder.d.ts +2 -0
  41. package/dist/files/hooks/useShareDialogPermission.d.ts +45 -0
  42. package/dist/files/hooks/useShareDialogPermission.js +31 -0
  43. package/dist/files/hooks/useShareDialogPermission.js.map +1 -0
  44. package/dist/files/hooks/useSharePermissions.d.ts +30 -0
  45. package/dist/files/hooks/useSharePermissions.js +81 -0
  46. package/dist/files/hooks/useSharePermissions.js.map +1 -0
  47. package/dist/files/hooks/useToggleStar.d.ts +5 -0
  48. package/dist/files/hooks/useUploadFile.d.ts +3 -0
  49. package/dist/files/pages/BrowserPage.js +353 -348
  50. package/dist/files/pages/BrowserPage.js.map +1 -1
  51. package/dist/files/types.d.ts +10 -2
  52. package/dist/files/utils/fileViewModel.js +7 -2
  53. package/dist/files/utils/fileViewModel.js.map +1 -1
  54. package/dist/files/utils/itemCapabilities.d.ts +84 -0
  55. package/dist/files/utils/itemCapabilities.js +54 -0
  56. package/dist/files/utils/itemCapabilities.js.map +1 -0
  57. package/dist/files/utils/sharePermission.d.ts +144 -0
  58. package/dist/files/utils/sharePermission.js +77 -0
  59. package/dist/files/utils/sharePermission.js.map +1 -0
  60. package/dist/generated/global-types.d.ts +6615 -870
  61. package/dist/generated/wspace-operations.d.ts +104 -0
  62. package/dist/generated/wspace-operations.js +1418 -39
  63. package/dist/generated/wspace-operations.js.map +1 -1
  64. package/dist/generated/wspace-types.d.ts +94395 -11225
  65. package/dist/generated/wspace-types.js.map +1 -1
  66. package/dist/translations/en.d.ts +16 -0
  67. package/dist/translations/en.js +16 -0
  68. package/dist/translations/en.js.map +1 -1
  69. package/package.json +2 -1
@@ -10,6 +10,8 @@ export declare const useRestoreFolder: () => {
10
10
  canRead: boolean | null;
11
11
  canUpdate: boolean | null;
12
12
  canDelete: boolean | null;
13
+ canShare: boolean | null;
14
+ canMove: boolean | null;
13
15
  name: string;
14
16
  description: string | null;
15
17
  path: string;
@@ -0,0 +1,45 @@
1
+ import { ShareDenialCause, SharePermissionStatus, ShareRefusalSource, ShareTargetKind } from '../utils/sharePermission';
2
+ export interface ShareDialogPermissionInput {
3
+ itemType: ShareTargetKind;
4
+ visibility?: string | null;
5
+ /** The dialog's own SHARE lookup (`undefined` when the item is not gated). */
6
+ lookedUp: SharePermissionStatus | undefined;
7
+ /** A denial the caller recorded recently (within its TTL). */
8
+ knownPermission?: "denied";
9
+ /** Where a refusal of the share mutation came from, once one happened. */
10
+ refusal: ShareRefusalSource | null;
11
+ }
12
+ export interface ShareDialogPermissionState {
13
+ permission: SharePermissionStatus | undefined;
14
+ /** Why sharing is denied, or `null` while sharing is (still) possible. */
15
+ denialCause: ShareDenialCause | null;
16
+ }
17
+ /**
18
+ * Pure derivation behind {@link useShareDialogPermission}.
19
+ *
20
+ * A recently recorded denial is shown at once instead of the "checking"
21
+ * spinner while the dialog re-checks; once the re-check answers, its answer
22
+ * wins. A refusal of the share mutation always denies, whatever the lookup
23
+ * said, and names its own source.
24
+ */
25
+ export declare function deriveShareDialogPermission(input: ShareDialogPermissionInput): ShareDialogPermissionState;
26
+ export interface UseShareDialogPermissionResult extends ShareDialogPermissionState {
27
+ /** Record that the share mutation was refused, which shows the denial. */
28
+ recordRefusal: (source: ShareRefusalSource) => void;
29
+ }
30
+ /**
31
+ * SHARE permission and denial state for the share dialog (BOFF-10039).
32
+ *
33
+ * Re-checks SHARE when the dialog opens: the listing may be stale, and
34
+ * wspace-files-svc refuses shares from callers without it. Files are only
35
+ * gated when PRIVATE/TEAM; for WORKSPACE/PUBLIC files no lookup runs and the
36
+ * share mutation (gateway @rbac) decides, reported through `recordRefusal`.
37
+ */
38
+ export declare function useShareDialogPermission(input: {
39
+ item: {
40
+ id: string;
41
+ visibility?: string | null;
42
+ };
43
+ itemType: ShareTargetKind;
44
+ knownPermission?: "denied";
45
+ }): UseShareDialogPermissionResult;
@@ -0,0 +1,31 @@
1
+ import { useItemSharePermission as e } from "./useSharePermissions.js";
2
+ import { fileShareTarget as t, folderShareTarget as n, shareDenialCause as r } from "../utils/sharePermission.js";
3
+ import { useState as i } from "react";
4
+ // src/files/hooks/useShareDialogPermission.ts
5
+ function a(e) {
6
+ let t = e.lookedUp === "checking" && e.knownPermission === "denied" ? "denied" : e.lookedUp;
7
+ return {
8
+ permission: t,
9
+ denialCause: e.refusal !== null || t === "denied" ? r({
10
+ itemType: e.itemType,
11
+ visibility: e.visibility,
12
+ source: e.refusal ?? "permission"
13
+ }) : null
14
+ };
15
+ }
16
+ function o(r) {
17
+ let { item: o, itemType: s, knownPermission: c } = r, l = e(s === "folder" ? n(o) : t(o)), [u, d] = i(null);
18
+ return {
19
+ ...a({
20
+ itemType: s,
21
+ visibility: o.visibility,
22
+ lookedUp: l,
23
+ knownPermission: c,
24
+ refusal: u
25
+ }),
26
+ recordRefusal: d
27
+ };
28
+ }
29
+ export { a as deriveShareDialogPermission, o as useShareDialogPermission };
30
+
31
+ //# sourceMappingURL=useShareDialogPermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShareDialogPermission.js","names":["deriveShareDialogPermission","permission","input","shareDenialCause","useShareDialogPermission","lookedUp","useItemSharePermission","itemType","folderShareTarget","item","fileShareTarget","refusal","setRefusal","useState"],"sources":["../../../src/files/hooks/useShareDialogPermission.ts"],"sourcesContent":["import { useState } from \"react\";\n\nimport { useItemSharePermission } from \"./useSharePermissions\";\nimport {\n fileShareTarget,\n folderShareTarget,\n shareDenialCause,\n type ShareDenialCause,\n type SharePermissionStatus,\n type ShareRefusalSource,\n type ShareTargetKind,\n} from \"../utils/sharePermission\";\n\nexport interface ShareDialogPermissionInput {\n itemType: ShareTargetKind;\n visibility?: string | null;\n /** The dialog's own SHARE lookup (`undefined` when the item is not gated). */\n lookedUp: SharePermissionStatus | undefined;\n /** A denial the caller recorded recently (within its TTL). */\n knownPermission?: \"denied\";\n /** Where a refusal of the share mutation came from, once one happened. */\n refusal: ShareRefusalSource | null;\n}\n\nexport interface ShareDialogPermissionState {\n permission: SharePermissionStatus | undefined;\n /** Why sharing is denied, or `null` while sharing is (still) possible. */\n denialCause: ShareDenialCause | null;\n}\n\n/**\n * Pure derivation behind {@link useShareDialogPermission}.\n *\n * A recently recorded denial is shown at once instead of the \"checking\"\n * spinner while the dialog re-checks; once the re-check answers, its answer\n * wins. A refusal of the share mutation always denies, whatever the lookup\n * said, and names its own source.\n */\nexport function deriveShareDialogPermission(\n input: ShareDialogPermissionInput,\n): ShareDialogPermissionState {\n const permission =\n input.lookedUp === \"checking\" && input.knownPermission === \"denied\"\n ? \"denied\"\n : input.lookedUp;\n const denialCause =\n input.refusal !== null || permission === \"denied\"\n ? shareDenialCause({\n itemType: input.itemType,\n visibility: input.visibility,\n source: input.refusal ?? \"permission\",\n })\n : null;\n return { permission, denialCause };\n}\n\nexport interface UseShareDialogPermissionResult extends ShareDialogPermissionState {\n /** Record that the share mutation was refused, which shows the denial. */\n recordRefusal: (source: ShareRefusalSource) => void;\n}\n\n/**\n * SHARE permission and denial state for the share dialog (BOFF-10039).\n *\n * Re-checks SHARE when the dialog opens: the listing may be stale, and\n * wspace-files-svc refuses shares from callers without it. Files are only\n * gated when PRIVATE/TEAM; for WORKSPACE/PUBLIC files no lookup runs and the\n * share mutation (gateway @rbac) decides, reported through `recordRefusal`.\n */\nexport function useShareDialogPermission(input: {\n item: { id: string; visibility?: string | null };\n itemType: ShareTargetKind;\n knownPermission?: \"denied\";\n}): UseShareDialogPermissionResult {\n const { item, itemType, knownPermission } = input;\n const lookedUp = useItemSharePermission(\n itemType === \"folder\" ? folderShareTarget(item) : fileShareTarget(item),\n );\n // Where a refusal of the share mutation came from: the service (PRIVATE/TEAM\n // files, folders) or the gateway's @rbac role check.\n const [refusal, setRefusal] = useState<ShareRefusalSource | null>(null);\n const state = deriveShareDialogPermission({\n itemType,\n visibility: item.visibility,\n lookedUp,\n knownPermission,\n refusal,\n });\n return { ...state, recordRefusal: setRefusal };\n}\n"],"mappings":";;;;AAsCA,SAAgBA,EACd,GAC4B;CAC5B,IAAMC,IACJC,EAAM,aAAa,cAAcA,EAAM,oBAAoB,WACvD,WACAA,EAAM;CASZ,OAAO;EAAE;EAAY,aAPnBA,EAAM,YAAY,QAAQD,MAAe,WACrCE,EAAiB;GACf,UAAUD,EAAM;GAChB,YAAYA,EAAM;GAClB,QAAQA,EAAM,WAAW;EAC3B,CAAC,IACD;CAC2B;AACnC;AAeA,SAAgBE,EAAyB,GAIN;CACjC,IAAM,EAAE,SAAM,aAAU,uBAAoBF,GACtCG,IAAWC,EACfC,MAAa,WAAWC,EAAkBC,CAAI,IAAIC,EAAgBD,CAAI,CACxE,GAGM,CAACE,GAASC,KAAcC,EAAoC,IAAI;CAQtE,OAAO;EAAE,GAPKb,EAA4B;GACxC;GACA,YAAYS,EAAK;GACjB;GACA;GACA;EACF,CACY;EAAO,eAAeG;CAAW;AAC/C"}
@@ -0,0 +1,30 @@
1
+ import { SharePermissionStatus, ShareTarget } from '../utils/sharePermission';
2
+ /**
3
+ * Lazily resolve SHARE permission for items in a listing (BOFF-10039).
4
+ *
5
+ * Listing payloads now carry an eager `canShare` per item (BOFF-11801), and
6
+ * the browser prefers it: an item whose payload answers `canShare` is never
7
+ * looked up here (see `shareLookupTarget` in `utils/itemCapabilities.ts`).
8
+ * This hook remains the fallback for an item whose payload has no answer (a
9
+ * field error, or an older payload). Such an item is looked up once, on
10
+ * demand: when the pointer rests on it (`prefetch`), or immediately when it is
11
+ * focused, pressed or opens a menu (`ensure`). `allowed` is kept for the
12
+ * lifetime of the browser view; `denied` is re-asked on the next interaction
13
+ * once it is older than `DENIED_SHARE_PERMISSION_TTL_MS`, and a failed lookup
14
+ * (`unknown`, a FORBIDDEN refusal of the query included) is re-asked on the
15
+ * next interaction.
16
+ */
17
+ export declare function useSharePermissions(): {
18
+ statusOf: (target: ShareTarget) => SharePermissionStatus | undefined;
19
+ ensure: (target: ShareTarget) => void;
20
+ guard: (target: ShareTarget) => "denied" | undefined;
21
+ prefetch: (target: ShareTarget) => void;
22
+ cancelPrefetch: () => void;
23
+ };
24
+ /**
25
+ * SHARE permission for a single item, e.g. the item in the share dialog, or
26
+ * the file open in the preview modal when its payload has no eager
27
+ * `canShare`. Always asks the service (network-only), so a grant or
28
+ * revocation since the listing loaded is reflected.
29
+ */
30
+ export declare function useItemSharePermission(target: ShareTarget | null): SharePermissionStatus | undefined;
@@ -0,0 +1,81 @@
1
+ import { GetUserFileSharePermissionDocument as e, GetUserFolderSharePermissionDocument as t } from "../../generated/wspace-operations.js";
2
+ import { knownShareDenial as n, resolveSharePermissionStatus as r, shareTargetKey as i, shouldLookUpSharePermission as a } from "../utils/sharePermission.js";
3
+ import { useCallback as o, useEffect as s, useRef as c, useState as l } from "react";
4
+ import { useApolloClient as u, useQuery as d } from "@apollo/client/react";
5
+ // src/files/hooks/useSharePermissions.ts
6
+ var f = 120;
7
+ function p() {
8
+ let d = u(), [p, m] = l(() => /* @__PURE__ */ new Map()), h = c(/* @__PURE__ */ new Map()), g = c(null), _ = c(null), v = c(!0);
9
+ s(() => (v.current = !0, () => {
10
+ v.current = !1, g.current && clearTimeout(g.current);
11
+ }), []);
12
+ let y = o((e, t) => {
13
+ h.current.set(e, {
14
+ status: t,
15
+ at: Date.now()
16
+ }), v.current && m((n) => {
17
+ if (n.get(e) === t) return n;
18
+ let r = new Map(n);
19
+ return r.set(e, t), r;
20
+ });
21
+ }, []), b = o(async (n) => n.kind === "file" ? (await d.query({
22
+ query: e,
23
+ variables: { fileId: n.id },
24
+ fetchPolicy: "network-only"
25
+ })).data?.getUserFilePermissions.canShare ?? null : (await d.query({
26
+ query: t,
27
+ variables: { folderId: n.id },
28
+ fetchPolicy: "network-only"
29
+ })).data?.getUserFolderPermissions.canShare ?? null, [d]), x = o((e) => {
30
+ let t = i(e);
31
+ a(h.current.get(t), Date.now()) && (y(t, "checking"), b(e).then((e) => y(t, r({
32
+ loading: !1,
33
+ canShare: e
34
+ })), (e) => {
35
+ y(t, r({
36
+ loading: !1,
37
+ error: e
38
+ }));
39
+ }));
40
+ }, [b, y]), S = o(() => {
41
+ g.current &&= (clearTimeout(g.current), null), _.current = null;
42
+ }, []), C = o((e) => {
43
+ let t = i(e);
44
+ _.current !== t && a(h.current.get(t), Date.now()) && (S(), _.current = t, g.current = setTimeout(() => {
45
+ g.current = null, _.current = null, x(e);
46
+ }, f));
47
+ }, [S, x]), w = o((e) => {
48
+ let t = n(h.current.get(i(e)), Date.now());
49
+ return x(e), t;
50
+ }, [x]);
51
+ return {
52
+ statusOf: o((e) => p.get(i(e)), [p]),
53
+ ensure: x,
54
+ guard: w,
55
+ prefetch: C,
56
+ cancelPrefetch: S
57
+ };
58
+ }
59
+ function m(n) {
60
+ let i = d(e, {
61
+ variables: { fileId: n?.id ?? "" },
62
+ skip: n?.kind !== "file",
63
+ fetchPolicy: "network-only"
64
+ }), a = d(t, {
65
+ variables: { folderId: n?.id ?? "" },
66
+ skip: n?.kind !== "folder",
67
+ fetchPolicy: "network-only"
68
+ });
69
+ if (n) return n.kind === "file" ? r({
70
+ loading: i.loading,
71
+ error: i.error,
72
+ canShare: i.data?.getUserFilePermissions.canShare
73
+ }) : r({
74
+ loading: a.loading,
75
+ error: a.error,
76
+ canShare: a.data?.getUserFolderPermissions.canShare
77
+ });
78
+ }
79
+ export { m as useItemSharePermission, p as useSharePermissions };
80
+
81
+ //# sourceMappingURL=useSharePermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSharePermissions.js","names":["PREFETCH_DELAY_MS","useSharePermissions","client","useApolloClient","statuses","setStatuses","useState","entries","useRef","prefetchTimer","prefetchKey","mounted","record","useCallback","key","previous","status","next","lookup","target","GetUserFileSharePermissionDocument","GetUserFolderSharePermissionDocument","ensure","shareTargetKey","shouldLookUpSharePermission","resolveSharePermissionStatus","cancelPrefetch","prefetch","guard","known","knownShareDenial","useItemSharePermission","fileQuery","useQuery","folderQuery"],"sources":["../../../src/files/hooks/useSharePermissions.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useApolloClient, useQuery } from \"@apollo/client/react\";\n\nimport {\n GetUserFileSharePermissionDocument,\n GetUserFolderSharePermissionDocument,\n} from \"../../generated/wspace-operations\";\nimport {\n knownShareDenial,\n resolveSharePermissionStatus,\n shareTargetKey,\n shouldLookUpSharePermission,\n type SharePermissionEntry,\n type SharePermissionStatus,\n type ShareTarget,\n} from \"../utils/sharePermission\";\n\n/** Hover dwell before a permission lookup starts, so sweeping the pointer across a listing stays quiet. */\nconst PREFETCH_DELAY_MS = 120;\n\n/**\n * Lazily resolve SHARE permission for items in a listing (BOFF-10039).\n *\n * Listing payloads now carry an eager `canShare` per item (BOFF-11801), and\n * the browser prefers it: an item whose payload answers `canShare` is never\n * looked up here (see `shareLookupTarget` in `utils/itemCapabilities.ts`).\n * This hook remains the fallback for an item whose payload has no answer (a\n * field error, or an older payload). Such an item is looked up once, on\n * demand: when the pointer rests on it (`prefetch`), or immediately when it is\n * focused, pressed or opens a menu (`ensure`). `allowed` is kept for the\n * lifetime of the browser view; `denied` is re-asked on the next interaction\n * once it is older than `DENIED_SHARE_PERMISSION_TTL_MS`, and a failed lookup\n * (`unknown`, a FORBIDDEN refusal of the query included) is re-asked on the\n * next interaction.\n */\nexport function useSharePermissions() {\n const client = useApolloClient();\n const [statuses, setStatuses] = useState<\n ReadonlyMap<string, SharePermissionStatus>\n >(() => new Map());\n // Request bookkeeping, read synchronously by ensure/prefetch. `statuses`\n // mirrors it for rendering.\n const entries = useRef(new Map<string, SharePermissionEntry>());\n const prefetchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const prefetchKey = useRef<string | null>(null);\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n if (prefetchTimer.current) clearTimeout(prefetchTimer.current);\n };\n }, []);\n\n const record = useCallback((key: string, status: SharePermissionStatus) => {\n entries.current.set(key, { status, at: Date.now() });\n if (!mounted.current) return;\n setStatuses((previous) => {\n if (previous.get(key) === status) return previous;\n const next = new Map(previous);\n next.set(key, status);\n return next;\n });\n }, []);\n\n const lookup = useCallback(\n async (target: ShareTarget): Promise<boolean | null> => {\n if (target.kind === \"file\") {\n const result = await client.query({\n query: GetUserFileSharePermissionDocument,\n variables: { fileId: target.id },\n fetchPolicy: \"network-only\",\n });\n return result.data?.getUserFilePermissions.canShare ?? null;\n }\n const result = await client.query({\n query: GetUserFolderSharePermissionDocument,\n variables: { folderId: target.id },\n fetchPolicy: \"network-only\",\n });\n return result.data?.getUserFolderPermissions.canShare ?? null;\n },\n [client],\n );\n\n const ensure = useCallback(\n (target: ShareTarget) => {\n const key = shareTargetKey(target);\n if (!shouldLookUpSharePermission(entries.current.get(key), Date.now())) {\n return;\n }\n // An expired `denied` drops back to `checking`, which does not block: a\n // click that triggered this re-check reaches the share dialog, which\n // asks the service again itself.\n record(key, \"checking\");\n lookup(target).then(\n (canShare) =>\n record(\n key,\n resolveSharePermissionStatus({ loading: false, canShare }),\n ),\n (error: unknown) => {\n // `unknown` is retried on the next interaction; the share mutation\n // still enforces SHARE, so the UI falls through meanwhile.\n record(key, resolveSharePermissionStatus({ loading: false, error }));\n },\n );\n },\n [lookup, record],\n );\n\n const cancelPrefetch = useCallback(() => {\n if (prefetchTimer.current) {\n clearTimeout(prefetchTimer.current);\n prefetchTimer.current = null;\n }\n prefetchKey.current = null;\n }, []);\n\n const prefetch = useCallback(\n (target: ShareTarget) => {\n const key = shareTargetKey(target);\n // Pointer moves inside the same item must not keep restarting the dwell.\n if (\n prefetchKey.current === key ||\n !shouldLookUpSharePermission(entries.current.get(key), Date.now())\n ) {\n return;\n }\n cancelPrefetch();\n prefetchKey.current = key;\n prefetchTimer.current = setTimeout(() => {\n prefetchTimer.current = null;\n prefetchKey.current = null;\n ensure(target);\n }, PREFETCH_DELAY_MS);\n },\n [cancelPrefetch, ensure],\n );\n\n /**\n * Run when a Share entry point is activated (pointer, touch, Enter or\n * Space). The TTL check happens here, inside the activation itself, so a\n * keyboard user who activates an already-focused Share after a denial has\n * expired triggers the re-check too (focus does not fire again). Returns the\n * denial the share dialog may show at once: only a denial still within its\n * TTL. An expired denial is re-asked and the dialog checks for itself.\n */\n const guard = useCallback(\n (target: ShareTarget): \"denied\" | undefined => {\n const known = knownShareDenial(\n entries.current.get(shareTargetKey(target)),\n Date.now(),\n );\n ensure(target);\n return known;\n },\n [ensure],\n );\n\n const statusOf = useCallback(\n (target: ShareTarget): SharePermissionStatus | undefined =>\n statuses.get(shareTargetKey(target)),\n [statuses],\n );\n\n return { statusOf, ensure, guard, prefetch, cancelPrefetch };\n}\n\n/**\n * SHARE permission for a single item, e.g. the item in the share dialog, or\n * the file open in the preview modal when its payload has no eager\n * `canShare`. Always asks the service (network-only), so a grant or\n * revocation since the listing loaded is reflected.\n */\nexport function useItemSharePermission(\n target: ShareTarget | null,\n): SharePermissionStatus | undefined {\n const fileQuery = useQuery(GetUserFileSharePermissionDocument, {\n variables: { fileId: target?.id ?? \"\" },\n skip: target?.kind !== \"file\",\n fetchPolicy: \"network-only\",\n });\n const folderQuery = useQuery(GetUserFolderSharePermissionDocument, {\n variables: { folderId: target?.id ?? \"\" },\n skip: target?.kind !== \"folder\",\n fetchPolicy: \"network-only\",\n });\n\n if (!target) return undefined;\n if (target.kind === \"file\") {\n return resolveSharePermissionStatus({\n loading: fileQuery.loading,\n error: fileQuery.error,\n canShare: fileQuery.data?.getUserFilePermissions.canShare,\n });\n }\n return resolveSharePermissionStatus({\n loading: folderQuery.loading,\n error: folderQuery.error,\n canShare: folderQuery.data?.getUserFolderPermissions.canShare,\n });\n}\n"],"mappings":";;;;;AAkBA,IAAMA,IAAoB;AAiB1B,SAAgBC,IAAs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6B;EAClC,SAASO,EAAU;EACnB,OAAOA,EAAU;EACjB,UAAUA,EAAU,MAAM,uBAAuB;CACnD,CAAC,IAEIP,EAA6B;EAClC,SAASS,EAAY;EACrB,OAAOA,EAAY;EACnB,UAAUA,EAAY,MAAM,yBAAyB;CACvD,CAAC;AACH"}
@@ -11,6 +11,9 @@ export declare const useToggleStar: () => {
11
11
  canRead: boolean | null;
12
12
  canUpdate: boolean | null;
13
13
  canDelete: boolean | null;
14
+ canShare: boolean | null;
15
+ canMove: boolean | null;
16
+ canCopy: boolean | null;
14
17
  name: string;
15
18
  description: string | null;
16
19
  mimeType: string;
@@ -32,6 +35,8 @@ export declare const useToggleStar: () => {
32
35
  canRead: boolean | null;
33
36
  canUpdate: boolean | null;
34
37
  canDelete: boolean | null;
38
+ canShare: boolean | null;
39
+ canMove: boolean | null;
35
40
  name: string;
36
41
  description: string | null;
37
42
  path: string;
@@ -25,6 +25,9 @@ export declare const useUploadFile: () => {
25
25
  canRead: boolean | null;
26
26
  canUpdate: boolean | null;
27
27
  canDelete: boolean | null;
28
+ canShare: boolean | null;
29
+ canMove: boolean | null;
30
+ canCopy: boolean | null;
28
31
  name: string;
29
32
  description: string | null;
30
33
  mimeType: string;