@burdenoff/microfe-files 2026.1115.1 → 2026.1115.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 (34) hide show
  1. package/dist/files/components/CopyDialog.d.ts +6 -0
  2. package/dist/files/components/CopyDialog.js +112 -101
  3. package/dist/files/components/CopyDialog.js.map +1 -1
  4. package/dist/files/components/FileBrowser.js +175 -165
  5. package/dist/files/components/FileBrowser.js.map +1 -1
  6. package/dist/files/components/FileInfoPanel.d.ts +7 -1
  7. package/dist/files/components/FileInfoPanel.js +225 -184
  8. package/dist/files/components/FileInfoPanel.js.map +1 -1
  9. package/dist/files/components/SearchBar.d.ts +7 -1
  10. package/dist/files/components/SearchBar.js +166 -159
  11. package/dist/files/components/SearchBar.js.map +1 -1
  12. package/dist/files/components/ShareAccessParts.d.ts +9 -1
  13. package/dist/files/components/ShareAccessParts.js +31 -23
  14. package/dist/files/components/ShareAccessParts.js.map +1 -1
  15. package/dist/files/components/ShareDialog.d.ts +5 -4
  16. package/dist/files/components/ShareDialog.js +31 -27
  17. package/dist/files/components/ShareDialog.js.map +1 -1
  18. package/dist/files/pages/BrowserPage.js +274 -271
  19. package/dist/files/pages/BrowserPage.js.map +1 -1
  20. package/dist/files/pages/ShareAccessPage.js +52 -51
  21. package/dist/files/pages/ShareAccessPage.js.map +1 -1
  22. package/dist/files/utils/fileKind.d.ts +16 -0
  23. package/dist/files/utils/fileKind.js +120 -0
  24. package/dist/files/utils/fileKind.js.map +1 -0
  25. package/dist/files/utils/infoTechnicalDetails.d.ts +12 -0
  26. package/dist/files/utils/infoTechnicalDetails.js +16 -0
  27. package/dist/files/utils/infoTechnicalDetails.js.map +1 -0
  28. package/dist/files/utils/shareAccess.d.ts +6 -0
  29. package/dist/files/utils/shareAccess.js +6 -1
  30. package/dist/files/utils/shareAccess.js.map +1 -1
  31. package/dist/translations/en.d.ts +29 -0
  32. package/dist/translations/en.js +32 -1
  33. package/dist/translations/en.js.map +1 -1
  34. package/package.json +2 -2
@@ -1,20 +1,20 @@
1
1
  import { AccessFolderShareDocument as e, AccessShareDocument as t, DownloadFolderShareFileDocument as n, FileShareGrantByTokenDocument as r } from "../../generated/wspace-operations.js";
2
2
  import { buildGraphQLEndpoint as i, config as a } from "../../config/index.js";
3
- import { FilePreviewModal as o } from "../components/FilePreviewModal.js";
4
- import { usePublicShare as s } from "../hooks/usePublicShare.js";
5
- import { useSharedFolderFileUrl as c } from "../hooks/useSharedFolderFileUrl.js";
6
- import { ShareAccessBody as l, ShareAccessHeader as ee } from "../components/ShareAccessParts.js";
7
- import { useFilesContext as u } from "../providers/FilesProvider.js";
8
- import { emitFilesEvent as d } from "../utils/events.js";
9
- import { nativeImpact as te, nativeOpenUrl as ne } from "../../utils/nativeBridge.js";
10
- import { tWithFallback as re } from "../utils/i18n.js";
11
- import { ShareAccessError as f, isSignedInVisitor as p } from "../utils/shareAccess.js";
3
+ import { FilePreviewModal as ee } from "../components/FilePreviewModal.js";
4
+ import { usePublicShare as o } from "../hooks/usePublicShare.js";
5
+ import { useSharedFolderFileUrl as s } from "../hooks/useSharedFolderFileUrl.js";
6
+ import { ShareAccessBody as te, ShareAccessHeader as c } from "../components/ShareAccessParts.js";
7
+ import { useFilesContext as ne } from "../providers/FilesProvider.js";
8
+ import { emitFilesEvent as l } from "../utils/events.js";
9
+ import { nativeImpact as re, nativeOpenUrl as ie } from "../../utils/nativeBridge.js";
10
+ import { tWithFallback as u } from "../utils/i18n.js";
11
+ import { ShareAccessError as d, isSignedInVisitor as f, shareAccessErrorDetail as p } from "../utils/shareAccess.js";
12
12
  import { useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
13
13
  import { ArrowLeft as y } from "lucide-react";
14
14
  import { jsx as b, jsxs as x } from "react/jsx-runtime";
15
- import { useLocation as S, useNavigate as C, useParams as w } from "react-router";
16
- import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
- import { GlassCard as ae } from "@burdenoff/fe-libs/ui";
15
+ import { useLocation as S, useNavigate as ae, useParams as C } from "react-router";
16
+ import { useI18n as oe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
+ import { GlassCard as w } from "@burdenoff/fe-libs/ui";
18
18
  import { print as T } from "graphql";
19
19
  // src/files/pages/ShareAccessPage.tsx
20
20
  var E = {
@@ -37,7 +37,7 @@ async function k(e, t, n) {
37
37
  variables: n
38
38
  })
39
39
  }), i = await r.json();
40
- if (!r.ok || i.errors?.length || !i.data) throw f.fromGraphQLErrors(i.errors, "Unable to access shared file");
40
+ if (!r.ok || i.errors?.length || !i.data) throw d.fromGraphQLErrors(i.errors, "Unable to access shared file");
41
41
  return i.data;
42
42
  }
43
43
  function A(e) {
@@ -74,7 +74,7 @@ function j(e, t) {
74
74
  };
75
75
  }
76
76
  function M() {
77
- let { pathname: e } = S(), { token: t } = w();
77
+ let { pathname: e } = S(), { token: t } = C();
78
78
  return g(() => {
79
79
  if (t) return t;
80
80
  let n = e.match(/\/share\/([^/]+)/);
@@ -82,66 +82,66 @@ function M() {
82
82
  }, [e, t]);
83
83
  }
84
84
  function N() {
85
- let { t: e } = ie(), t = C(), n = M(), r = u(), { apiGatewayUrl: i, basePath: a, eventBus: f, workspaceId: S } = r, w = _({
86
- eventBus: f,
85
+ let { t: e } = oe(), t = ae(), n = M(), r = ne(), { apiGatewayUrl: i, basePath: a, eventBus: d, workspaceId: S } = r, C = _({
86
+ eventBus: d,
87
87
  workspaceId: S
88
88
  });
89
89
  h(() => {
90
- w.current = {
91
- eventBus: f,
90
+ C.current = {
91
+ eventBus: d,
92
92
  workspaceId: S
93
93
  };
94
- }, [f, S]);
95
- let T = p(r), N = `${(a || "/files").replace(/\/+$/, "")}/browse`, P = g(() => O(i), [i]), [F, I] = v(""), [L, R] = v(null), [z, B] = v(!1), V = m((e, t) => k(P, e, t), [P]), { loading: H, failure: U, share: W, kind: G, acceptedPasswordRef: K, loadShare: q } = s({
96
- request: V,
94
+ }, [d, S]);
95
+ let T = f(r), N = `${(a || "/files").replace(/\/+$/, "")}/browse`, P = g(() => O(i), [i]), [F, I] = v(""), [L, R] = v(null), [z, B] = v(!1), V = r.navigationV2 === !0, [H, U] = v(null), W = m((e, t) => k(P, e, t), [P]), { loading: G, failure: K, share: q, kind: se, acceptedPasswordRef: ce, loadShare: J } = o({
96
+ request: W,
97
97
  documents: E,
98
98
  token: n,
99
99
  onLoaded: (e) => {
100
- R(e.kind === "file" ? A(e.file) : null), B(e.kind === "file");
100
+ U(null), R(e.kind === "file" ? A(e.file) : null), B(e.kind === "file");
101
101
  },
102
102
  onError: (e, t) => {
103
- d(w.current, "files.api.failed", {
103
+ U(p(e)), l(C.current, "files.api.failed", {
104
104
  action: t === "folder" ? "accessFolderShare" : "accessShare",
105
105
  message: e instanceof Error ? e.message : void 0
106
106
  });
107
107
  }
108
- }), J = W?.kind === "file" ? L : null, Y = async (e, t) => {
109
- te("light"), await ne(t), d(r, "files.share.downloaded", {
108
+ }), le = q?.kind === "file" ? L : null, Y = async (e, t) => {
109
+ re("light"), await ie(t), l(r, "files.share.downloaded", {
110
110
  fileId: e.id,
111
111
  fileName: e.name
112
112
  });
113
113
  }, X = async () => {
114
114
  let e = L, t = e ? e.downloadUrl || e.url : "";
115
115
  e && t && await Y(e, t);
116
- }, Z = m((e) => {
117
- d(w.current, "files.api.failed", {
116
+ }, ue = m((e) => {
117
+ l(C.current, "files.api.failed", {
118
118
  action: "downloadFolderShareFile",
119
119
  message: e instanceof Error ? e.message : void 0
120
120
  });
121
- }, []), { busyFileId: oe, failedFileId: se, fetchUrl: Q } = c({
122
- request: V,
121
+ }, []), { busyFileId: de, failedFileId: Z, fetchUrl: Q } = s({
122
+ request: W,
123
123
  document: D,
124
124
  token: n,
125
- passwordRef: K,
126
- onError: Z
127
- }), ce = async (e) => {
125
+ passwordRef: ce,
126
+ onError: ue
127
+ }), fe = async (e) => {
128
128
  let t = await Q(e);
129
129
  t && (R(j(e, t)), B(!0));
130
- }, le = async (e) => {
130
+ }, pe = async (e) => {
131
131
  let t = await Q(e);
132
132
  t && await Y(e, t);
133
- }, ue = async (e) => {
134
- e.preventDefault(), await q(F);
133
+ }, me = async (e) => {
134
+ e.preventDefault(), await J(F);
135
135
  };
136
- if (L && z) return /* @__PURE__ */ b(o, {
136
+ if (L && z) return /* @__PURE__ */ b(ee, {
137
137
  file: L,
138
138
  onClose: () => B(!1),
139
139
  onDownload: X
140
140
  });
141
- let $ = G === "folder";
141
+ let $ = se === "folder";
142
142
  return /* @__PURE__ */ b("div", {
143
143
  className: "flex min-h-[70vh] items-center justify-center bg-hero-mesh px-4 py-10",
144
- children: /* @__PURE__ */ x(ae, {
144
+ children: /* @__PURE__ */ x(w, {
145
145
  treatment: "glass",
146
146
  className: "w-full max-w-md p-6",
147
147
  children: [
@@ -149,25 +149,26 @@ function N() {
149
149
  type: "button",
150
150
  onClick: () => t(N),
151
151
  className: "mb-6 inline-flex items-center gap-2 text-sm font-medium text-text-secondary transition-colors hover:text-text-primary",
152
- children: [/* @__PURE__ */ b(y, { className: "size-4" }), re(e, "files.share.back", "Back to files")]
152
+ children: [/* @__PURE__ */ b(y, { className: "size-4" }), u(e, "files.share.back", "Back to files")]
153
153
  }),
154
- /* @__PURE__ */ b(ee, { isFolder: $ }),
155
- /* @__PURE__ */ b(l, {
156
- loading: H,
157
- share: W,
158
- sharedFile: J,
159
- failure: U,
154
+ /* @__PURE__ */ b(c, { isFolder: $ }),
155
+ /* @__PURE__ */ b(te, {
156
+ loading: G,
157
+ share: q,
158
+ sharedFile: le,
159
+ failure: K,
160
+ failureDetail: V ? H : null,
160
161
  isFolder: $,
161
162
  password: F,
162
- busyFileId: oe,
163
- failedFileId: se,
163
+ busyFileId: de,
164
+ failedFileId: Z,
164
165
  onPasswordChange: I,
165
- onPasswordSubmit: (e) => void ue(e),
166
- onRetry: () => void q(),
166
+ onPasswordSubmit: (e) => void me(e),
167
+ onRetry: () => void J(),
167
168
  onOpenPreview: () => B(!0),
168
169
  onDownload: () => void X(),
169
- onFolderPreview: (e) => void ce(e),
170
- onFolderDownload: (e) => void le(e)
170
+ onFolderPreview: (e) => void fe(e),
171
+ onFolderDownload: (e) => void pe(e)
171
172
  })
172
173
  ]
173
174
  })
@@ -1 +1 @@
1
- {"version":3,"file":"ShareAccessPage.js","names":["PUBLIC_SHARE_DOCUMENTS","print","FileShareGrantByTokenDocument","AccessShareDocument","AccessFolderShareDocument","DOWNLOAD_FOLDER_FILE_DOCUMENT","DownloadFolderShareFileDocument","resolveWorkspaceGraphQLEndpoint","configuredUrl","apiGatewayUrl","config","buildGraphQLEndpoint","requestPublicGraphQL","response","endpoint","payload","ShareAccessError","buildSharedFile","extension","buildSharedFolderFile","file","downloadUrl","useShareToken","useLocation","routeToken","useParams","useMemo","match","pathname","ShareAccessPage","useI18n","navigate","useNavigate","token","filesContext","useFilesContext","eventTargetRef","useRef","eventBus","workspaceId","signedIn","isSignedInVisitor","browsePath","basePath","password","setPassword","useState","previewFile","setPreviewFile","previewOpen","setPreviewOpen","request","useCallback","query","variables","usePublicShare","result","resolvedKind","error","sharedFile","share","openUrl","nativeImpact","nativeOpenUrl","url","emitFilesEvent","handleDownload","logFolderFileError","fetchFolderFileUrl","useSharedFolderFileUrl","acceptedPasswordRef","handleFolderPreview","handleFolderDownload","handlePasswordSubmit","event","loadShare","FilePreviewModal","isFolder","kind","GlassCard","ArrowLeft","tWithFallback","t","ShareAccessHeader","ShareAccessBody"],"sources":["../../../src/files/pages/ShareAccessPage.tsx"],"sourcesContent":["import {\n type FormEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useLocation, useNavigate, useParams } from \"react-router\";\nimport { ArrowLeft } from \"lucide-react\";\nimport { print } from \"graphql\";\nimport {\n AccessFolderShareDocument,\n AccessShareDocument,\n DownloadFolderShareFileDocument,\n FileShareGrantByTokenDocument,\n} from \"../../generated/wspace-operations\";\nimport { buildGraphQLEndpoint, config } from \"../../config\";\nimport { FilePreviewModal } from \"../components/FilePreviewModal\";\nimport { usePublicShare } from \"../hooks/usePublicShare\";\nimport { useSharedFolderFileUrl } from \"../hooks/useSharedFolderFileUrl\";\nimport {\n ShareAccessBody,\n ShareAccessHeader,\n} from \"../components/ShareAccessParts\";\nimport type { FileItem } from \"../types\";\nimport { useFilesContext } from \"../providers/FilesProvider\";\nimport { emitFilesEvent } from \"../utils/events\";\nimport { nativeImpact, nativeOpenUrl } from \"../../utils/nativeBridge\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { ShareAccessError, isSignedInVisitor } from \"../utils/shareAccess\";\nimport type {\n PublicShareDocuments,\n PublicShareRequest,\n SharedFilePayload,\n SharedFolderFile,\n} from \"../utils/publicShare\";\n\nconst PUBLIC_SHARE_DOCUMENTS: PublicShareDocuments = {\n grantPreview: print(FileShareGrantByTokenDocument),\n accessFile: print(AccessShareDocument),\n accessFolder: print(AccessFolderShareDocument),\n};\nconst DOWNLOAD_FOLDER_FILE_DOCUMENT = print(DownloadFolderShareFileDocument);\n\ntype GraphQLResponse<TData> = {\n data?: TData;\n errors?: Array<{ message?: string; extensions?: { code?: unknown } }>;\n};\n\nfunction resolveWorkspaceGraphQLEndpoint(apiGatewayUrl?: string): string {\n const configuredUrl = apiGatewayUrl || config.apiGatewayUrl;\n\n if (!configuredUrl) {\n throw new Error(\"Files API gateway URL is not configured\");\n }\n\n return configuredUrl.includes(\"/graphql\")\n ? configuredUrl\n : buildGraphQLEndpoint(configuredUrl, \"workspaces\");\n}\n\nasync function requestPublicGraphQL<TData, TVariables>(\n endpoint: string,\n query: string,\n variables: TVariables,\n): Promise<TData> {\n const response = await fetch(endpoint, {\n method: \"POST\",\n credentials: \"omit\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ query, variables }),\n });\n\n const payload = (await response.json()) as GraphQLResponse<TData>;\n\n if (!response.ok || payload.errors?.length || !payload.data) {\n throw ShareAccessError.fromGraphQLErrors(\n payload.errors,\n \"Unable to access shared file\",\n );\n }\n\n return payload.data;\n}\n\nfunction buildSharedFile(payload: SharedFilePayload): FileItem {\n const extension = payload.name.includes(\".\")\n ? payload.name.split(\".\").pop() || \"\"\n : \"\";\n\n return {\n id: payload.id,\n name: payload.name,\n workspaceId: payload.workspaceId,\n mimeType: payload.mimeType,\n extension,\n size: Number(payload.size),\n s3Key: payload.s3Key,\n url: payload.downloadUrl ?? \"\",\n downloadUrl: payload.downloadUrl ?? undefined,\n starred: false,\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n };\n}\n\n/** A file from a shared folder, with the short-lived URL to open it. */\nfunction buildSharedFolderFile(\n file: SharedFolderFile,\n downloadUrl: string,\n): FileItem {\n return {\n id: file.id,\n name: file.name,\n workspaceId: \"\",\n mimeType: file.mimeType,\n extension: file.extension,\n size: Number(file.size),\n s3Key: \"\",\n url: downloadUrl,\n downloadUrl,\n starred: false,\n createdAt: file.updatedAt,\n updatedAt: file.updatedAt,\n };\n}\n\n/** The share token from the route, or from the path on shell-less mounts. */\nfunction useShareToken(): string {\n const { pathname } = useLocation();\n const { token: routeToken } = useParams<{ token: string }>();\n return useMemo(() => {\n if (routeToken) {\n return routeToken;\n }\n\n const match = pathname.match(/\\/share\\/([^/]+)/);\n return match?.[1] ? decodeURIComponent(match[1]) : \"\";\n }, [pathname, routeToken]);\n}\n\nexport function ShareAccessPage() {\n const { t } = useI18n();\n const navigate = useNavigate();\n const token = useShareToken();\n const filesContext = useFilesContext();\n const { apiGatewayUrl, basePath, eventBus, workspaceId } = filesContext;\n // Kept in a ref so a new shell event bus never re-runs the share lookup\n // (each lookup counts a view on the link).\n const eventTargetRef = useRef({ eventBus, workspaceId });\n useEffect(() => {\n eventTargetRef.current = { eventBus, workspaceId };\n }, [eventBus, workspaceId]);\n // \"Back to files\" leads into the signed-in drive, so outside visitors (the\n // shell-less public mount passes no user or token) never see it.\n const signedIn = isSignedInVisitor(filesContext);\n const browsePath = `${(basePath || \"/files\").replace(/\\/+$/, \"\")}/browse`;\n const endpoint = useMemo(\n () => resolveWorkspaceGraphQLEndpoint(apiGatewayUrl),\n [apiGatewayUrl],\n );\n const [password, setPassword] = useState(\"\");\n // The file being previewed: the shared file itself, or a file opened from a\n // shared folder.\n const [previewFile, setPreviewFile] = useState<FileItem | null>(null);\n const [previewOpen, setPreviewOpen] = useState(false);\n\n const request: PublicShareRequest = useCallback(\n (query, variables) => requestPublicGraphQL(endpoint, query, variables),\n [endpoint],\n );\n\n const { loading, failure, share, kind, acceptedPasswordRef, loadShare } =\n usePublicShare({\n request,\n documents: PUBLIC_SHARE_DOCUMENTS,\n token,\n onLoaded: (result) => {\n // A shared file opens straight into its preview; a folder shows its\n // list.\n setPreviewFile(\n result.kind === \"file\" ? buildSharedFile(result.file) : null,\n );\n setPreviewOpen(result.kind === \"file\");\n },\n onError: (error, resolvedKind) => {\n // The raw server message never reaches an outside visitor; it is only\n // logged for support. TODO(BOFF-11841): show it under\n // <ShowTechnicalDetails copyable> once fe-libs ships the piece.\n emitFilesEvent(eventTargetRef.current, \"files.api.failed\", {\n action:\n resolvedKind === \"folder\" ? \"accessFolderShare\" : \"accessShare\",\n message: error instanceof Error ? error.message : undefined,\n });\n },\n });\n\n const sharedFile = share?.kind === \"file\" ? previewFile : null;\n\n const openUrl = async (file: { id: string; name: string }, url: string) => {\n nativeImpact(\"light\");\n await nativeOpenUrl(url);\n emitFilesEvent(filesContext, \"files.share.downloaded\", {\n fileId: file.id,\n fileName: file.name,\n });\n };\n\n const handleDownload = async () => {\n const file = previewFile;\n const downloadUrl = file ? file.downloadUrl || file.url : \"\";\n if (file && downloadUrl) {\n await openUrl(file, downloadUrl);\n }\n };\n\n const logFolderFileError = useCallback((error: unknown) => {\n emitFilesEvent(eventTargetRef.current, \"files.api.failed\", {\n action: \"downloadFolderShareFile\",\n message: error instanceof Error ? error.message : undefined,\n });\n }, []);\n const {\n busyFileId,\n failedFileId,\n fetchUrl: fetchFolderFileUrl,\n } = useSharedFolderFileUrl({\n request,\n document: DOWNLOAD_FOLDER_FILE_DOCUMENT,\n token,\n passwordRef: acceptedPasswordRef,\n onError: logFolderFileError,\n });\n\n const handleFolderPreview = async (file: SharedFolderFile) => {\n const url = await fetchFolderFileUrl(file);\n if (url) {\n setPreviewFile(buildSharedFolderFile(file, url));\n setPreviewOpen(true);\n }\n };\n\n const handleFolderDownload = async (file: SharedFolderFile) => {\n const url = await fetchFolderFileUrl(file);\n if (url) await openUrl(file, url);\n };\n\n const handlePasswordSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n await loadShare(password);\n };\n\n if (previewFile && previewOpen) {\n return (\n <FilePreviewModal\n file={previewFile}\n // Closing the preview keeps the visitor on this page; it never routes\n // an outside visitor into the signed-in drive.\n onClose={() => setPreviewOpen(false)}\n onDownload={handleDownload}\n />\n );\n }\n\n const isFolder = kind === \"folder\";\n\n return (\n <div className=\"flex min-h-[70vh] items-center justify-center bg-hero-mesh px-4 py-10\">\n <GlassCard treatment=\"glass\" className=\"w-full max-w-md p-6\">\n {signedIn && (\n <button\n type=\"button\"\n onClick={() => navigate(browsePath)}\n className=\"mb-6 inline-flex items-center gap-2 text-sm font-medium text-text-secondary transition-colors hover:text-text-primary\"\n >\n <ArrowLeft className=\"size-4\" />\n {tWithFallback(t, \"files.share.back\", \"Back to files\")}\n </button>\n )}\n\n <ShareAccessHeader isFolder={isFolder} />\n\n <ShareAccessBody\n loading={loading}\n share={share}\n sharedFile={sharedFile}\n failure={failure}\n isFolder={isFolder}\n password={password}\n busyFileId={busyFileId}\n failedFileId={failedFileId}\n onPasswordChange={setPassword}\n onPasswordSubmit={(event) => void handlePasswordSubmit(event)}\n onRetry={() => void loadShare()}\n onOpenPreview={() => setPreviewOpen(true)}\n onDownload={() => void handleDownload()}\n onFolderPreview={(file) => void handleFolderPreview(file)}\n onFolderDownload={(file) => void handle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AO,MAAsC;EAExE,AADAC,EAAM,eAAe,GACrB,MAAMC,EAAU/B,CAAQ;CAC1B;CAEA,IAAIG,KAAeE,GACjB,OACE,kBAAC2B,GAAD;EACE,MAAM7B;EAGN,eAAeG,EAAe,EAAK;EACnC,YAAYgB;CACb,CAAA;CAIL,IAAMW,IAAWC,MAAS;CAE1B,OACE,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAACC,IAAD;GAAW,WAAU;GAAQ,WAAU;GAAvC,UAAA;IACGvC,KACC,kBAAC,UAAD;KACE,MAAK;KACL,eAAeT,EAASW,CAAU;KAClC,WAAU;KAHZ,UAAA,CAKE,kBAACsC,GAAD,EAAW,WAAU,SAAU,CAAA,GAC9BC,GAAcC,GAAG,oBAAoB,eAAe,CAC/C;;IAGV,kBAACC,IAAD,EAA6B,YAAW,CAAA;IAExC,kBAACC,GAAD;KACW;KACF;KACK;KACH;KACC;KACA;KACE;KACE;KACd,kBAAkBvC;KAClB,mBAAmB,MAAU,KAAK4B,GAAqBC,CAAK;KAC5D,eAAe,KAAKC,EAAU;KAC9B,qBAAqBzB,EAAe,EAAI;KACxC,kBAAkB,KAAKgB,EAAe;KACtC,kBAAkB,MAAS,KAAKK,GAAoBnD,CAAI;KACxD,mBAAmB,MAAS,KAAKoD,GAAqBpD,CAAI;IAC3D,CAAA;GACQ;;CACR,CAAA;AAET"}
1
+ {"version":3,"file":"ShareAccessPage.js","names":["PUBLIC_SHARE_DOCUMENTS","print","FileShareGrantByTokenDocument","AccessShareDocument","AccessFolderShareDocument","DOWNLOAD_FOLDER_FILE_DOCUMENT","DownloadFolderShareFileDocument","resolveWorkspaceGraphQLEndpoint","configuredUrl","apiGatewayUrl","config","buildGraphQLEndpoint","requestPublicGraphQL","response","endpoint","payload","ShareAccessError","buildSharedFile","extension","buildSharedFolderFile","file","downloadUrl","useShareToken","useLocation","routeToken","useParams","useMemo","match","pathname","ShareAccessPage","useI18n","navigate","useNavigate","token","filesContext","useFilesContext","eventTargetRef","useRef","eventBus","workspaceId","signedIn","isSignedInVisitor","browsePath","basePath","password","setPassword","useState","previewFile","setPreviewFile","previewOpen","setPreviewOpen","navigationV2","failureDetail","setFailureDetail","request","useCallback","query","variables","usePublicShare","result","shareAccessErrorDetail","error","emitFilesEvent","resolvedKind","sharedFile","share","openUrl","nativeImpact","nativeOpenUrl","url","handleDownload","logFolderFileError","fetchFolderFileUrl","useSharedFolderFileUrl","acceptedPasswordRef","handleFolderPreview","handleFolderDownload","handlePasswordSubmit","event","loadShare","FilePreviewModal","isFolder","kind","GlassCard","ArrowLeft","tWithFallback","t","ShareAccessHeader","ShareAccessBody"],"sources":["../../../src/files/pages/ShareAccessPage.tsx"],"sourcesContent":["import {\n type FormEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useLocation, useNavigate, useParams } from \"react-router\";\nimport { ArrowLeft } from \"lucide-react\";\nimport { print } from \"graphql\";\nimport {\n AccessFolderShareDocument,\n AccessShareDocument,\n DownloadFolderShareFileDocument,\n FileShareGrantByTokenDocument,\n} from \"../../generated/wspace-operations\";\nimport { buildGraphQLEndpoint, config } from \"../../config\";\nimport { FilePreviewModal } from \"../components/FilePreviewModal\";\nimport { usePublicShare } from \"../hooks/usePublicShare\";\nimport { useSharedFolderFileUrl } from \"../hooks/useSharedFolderFileUrl\";\nimport {\n ShareAccessBody,\n ShareAccessHeader,\n} from \"../components/ShareAccessParts\";\nimport type { FileItem } from \"../types\";\nimport { useFilesContext } from \"../providers/FilesProvider\";\nimport { emitFilesEvent } from \"../utils/events\";\nimport { nativeImpact, nativeOpenUrl } from \"../../utils/nativeBridge\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { GlassCard } from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport {\n ShareAccessError,\n isSignedInVisitor,\n shareAccessErrorDetail,\n} from \"../utils/shareAccess\";\nimport type {\n PublicShareDocuments,\n PublicShareRequest,\n SharedFilePayload,\n SharedFolderFile,\n} from \"../utils/publicShare\";\n\nconst PUBLIC_SHARE_DOCUMENTS: PublicShareDocuments = {\n grantPreview: print(FileShareGrantByTokenDocument),\n accessFile: print(AccessShareDocument),\n accessFolder: print(AccessFolderShareDocument),\n};\nconst DOWNLOAD_FOLDER_FILE_DOCUMENT = print(DownloadFolderShareFileDocument);\n\ntype GraphQLResponse<TData> = {\n data?: TData;\n errors?: Array<{ message?: string; extensions?: { code?: unknown } }>;\n};\n\nfunction resolveWorkspaceGraphQLEndpoint(apiGatewayUrl?: string): string {\n const configuredUrl = apiGatewayUrl || config.apiGatewayUrl;\n\n if (!configuredUrl) {\n throw new Error(\"Files API gateway URL is not configured\");\n }\n\n return configuredUrl.includes(\"/graphql\")\n ? configuredUrl\n : buildGraphQLEndpoint(configuredUrl, \"workspaces\");\n}\n\nasync function requestPublicGraphQL<TData, TVariables>(\n endpoint: string,\n query: string,\n variables: TVariables,\n): Promise<TData> {\n const response = await fetch(endpoint, {\n method: \"POST\",\n credentials: \"omit\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ query, variables }),\n });\n\n const payload = (await response.json()) as GraphQLResponse<TData>;\n\n if (!response.ok || payload.errors?.length || !payload.data) {\n throw ShareAccessError.fromGraphQLErrors(\n payload.errors,\n \"Unable to access shared file\",\n );\n }\n\n return payload.data;\n}\n\nfunction buildSharedFile(payload: SharedFilePayload): FileItem {\n const extension = payload.name.includes(\".\")\n ? payload.name.split(\".\").pop() || \"\"\n : \"\";\n\n return {\n id: payload.id,\n name: payload.name,\n workspaceId: payload.workspaceId,\n mimeType: payload.mimeType,\n extension,\n size: Number(payload.size),\n s3Key: payload.s3Key,\n url: payload.downloadUrl ?? \"\",\n downloadUrl: payload.downloadUrl ?? undefined,\n starred: false,\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n };\n}\n\n/** A file from a shared folder, with the short-lived URL to open it. */\nfunction buildSharedFolderFile(\n file: SharedFolderFile,\n downloadUrl: string,\n): FileItem {\n return {\n id: file.id,\n name: file.name,\n workspaceId: \"\",\n mimeType: file.mimeType,\n extension: file.extension,\n size: Number(file.size),\n s3Key: \"\",\n url: downloadUrl,\n downloadUrl,\n starred: false,\n createdAt: file.updatedAt,\n updatedAt: file.updatedAt,\n };\n}\n\n/** The share token from the route, or from the path on shell-less mounts. */\nfunction useShareToken(): string {\n const { pathname } = useLocation();\n const { token: routeToken } = useParams<{ token: string }>();\n return useMemo(() => {\n if (routeToken) {\n return routeToken;\n }\n\n const match = pathname.match(/\\/share\\/([^/]+)/);\n return match?.[1] ? decodeURIComponent(match[1]) : \"\";\n }, [pathname, routeToken]);\n}\n\nexport function ShareAccessPage() {\n const { t } = useI18n();\n const navigate = useNavigate();\n const token = useShareToken();\n const filesContext = useFilesContext();\n const { apiGatewayUrl, basePath, eventBus, workspaceId } = filesContext;\n // Kept in a ref so a new shell event bus never re-runs the share lookup\n // (each lookup counts a view on the link).\n const eventTargetRef = useRef({ eventBus, workspaceId });\n useEffect(() => {\n eventTargetRef.current = { eventBus, workspaceId };\n }, [eventBus, workspaceId]);\n // \"Back to files\" leads into the signed-in drive, so outside visitors (the\n // shell-less public mount passes no user or token) never see it.\n const signedIn = isSignedInVisitor(filesContext);\n const browsePath = `${(basePath || \"/files\").replace(/\\/+$/, \"\")}/browse`;\n const endpoint = useMemo(\n () => resolveWorkspaceGraphQLEndpoint(apiGatewayUrl),\n [apiGatewayUrl],\n );\n const [password, setPassword] = useState(\"\");\n // The file being previewed: the shared file itself, or a file opened from a\n // shared folder.\n const [previewFile, setPreviewFile] = useState<FileItem | null>(null);\n const [previewOpen, setPreviewOpen] = useState(false);\n // Navigation v2 (FluidGrids) shows the raw failure under \"Show technical\n // details\" below the plain sentence; other apps only log it.\n const navigationV2 = filesContext.navigationV2 === true;\n const [failureDetail, setFailureDetail] = useState<string | null>(null);\n\n const request: PublicShareRequest = useCallback(\n (query, variables) => requestPublicGraphQL(endpoint, query, variables),\n [endpoint],\n );\n\n const { loading, failure, share, kind, acceptedPasswordRef, loadShare } =\n usePublicShare({\n request,\n documents: PUBLIC_SHARE_DOCUMENTS,\n token,\n onLoaded: (result) => {\n setFailureDetail(null);\n // A shared file opens straight into its preview; a folder shows its\n // list.\n setPreviewFile(\n result.kind === \"file\" ? buildSharedFile(result.file) : null,\n );\n setPreviewOpen(result.kind === \"file\");\n },\n onError: (error, resolvedKind) => {\n // The raw server message is never the main copy. It is logged for\n // support and, in Navigation v2, kept for \"Show technical details\".\n setFailureDetail(shareAccessErrorDetail(error));\n emitFilesEvent(eventTargetRef.current, \"files.api.failed\", {\n action:\n resolvedKind === \"folder\" ? \"accessFolderShare\" : \"accessShare\",\n message: error instanceof Error ? error.message : undefined,\n });\n },\n });\n\n const sharedFile = share?.kind === \"file\" ? previewFile : null;\n\n const openUrl = async (file: { id: string; name: string }, url: string) => {\n nativeImpact(\"light\");\n await nativeOpenUrl(url);\n emitFilesEvent(filesContext, \"files.share.downloaded\", {\n fileId: file.id,\n fileName: file.name,\n });\n };\n\n const handleDownload = async () => {\n const file = previewFile;\n const downloadUrl = file ? file.downloadUrl || file.url : \"\";\n if (file && downloadUrl) {\n await openUrl(file, downloadUrl);\n }\n };\n\n const logFolderFileError = useCallback((error: unknown) => {\n emitFilesEvent(eventTargetRef.current, \"files.api.failed\", {\n action: \"downloadFolderShareFile\",\n message: error instanceof Error ? error.message : undefined,\n });\n }, []);\n const {\n busyFileId,\n failedFileId,\n fetchUrl: fetchFolderFileUrl,\n } = useSharedFolderFileUrl({\n request,\n document: DOWNLOAD_FOLDER_FILE_DOCUMENT,\n token,\n passwordRef: acceptedPasswordRef,\n onError: logFolderFileError,\n });\n\n const handleFolderPreview = async (file: SharedFolderFile) => {\n const url = await fetchFolderFileUrl(file);\n if (url) {\n setPreviewFile(buildSharedFolderFile(file, url));\n setPreviewOpen(true);\n }\n };\n\n const handleFolderDownload = async (file: SharedFolderFile) => {\n const url = await fetchFolderFileUrl(file);\n if (url) await openUrl(file, url);\n };\n\n const handlePasswordSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n await loadShare(password);\n };\n\n if (previewFile && previewOpen) {\n return (\n <FilePreviewModal\n file={previewFile}\n // Closing the preview keeps the visitor on this page; it never routes\n // an outside visitor into the signed-in drive.\n onClose={() => setPreviewOpen(false)}\n onDownload={handleDownload}\n />\n );\n }\n\n const isFolder = kind === \"folder\";\n\n return (\n <div className=\"flex min-h-[70vh] items-center justify-center bg-hero-mesh px-4 py-10\">\n <GlassCard treatment=\"glass\" className=\"w-full max-w-md p-6\">\n {signedIn && (\n <button\n type=\"button\"\n onClick={() => navigate(browsePath)}\n className=\"mb-6 inline-flex items-center gap-2 text-sm font-medium text-text-secondary transition-colors hover:text-text-primary\"\n >\n <ArrowLeft className=\"size-4\" />\n {tWithFallback(t, \"files.share.back\", \"Back to files\")}\n </button>\n )}\n\n <ShareAccessHeader isFolder={isFolder} />\n\n <ShareAccessBody\n loading={loading}\n share={share}\n sharedFile={sharedFile}\n failure={failure}\n failureDetail={navigationV2 ? failureDetail : null}\n isFolder={isFolder}\n password={password}\n busyFileId={busyFileId}\n failedFileId={failedFileId}\n onPasswordChange={setPassword}\n onPasswordSubmit={(event) => void handlePasswordSubmit(event)}\n onRetry={() => void loadShare()}\n onOpenPreview={() => setPreviewOpen(true)}\n onDownload={() => void handleDownload()}\n onFolderPreview={(file) => void handleFolderPreview(file)}\n onFolderDownload={(file) => void handleFolderDownload(file)}\n />\n </GlassCard>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,IAAMA,IAA+C;CACnD,cAAcC,EAAMC,CAA6B;CACjD,YAAYD,EAAME,CAAmB;CACrC,cAAcF,EAAMG,CAAyB;AAC/C,GACMC,IAAgCJ,EAAMK,CAA+B;AAO3E,SAASC,EAAgC,GAAgC;CACvE,IAAMC,IAAgBC,KAAiBC,EAAO;CAE9C,IAAI,CAACF,GACH,MAAU,MAAM,yCAAyC;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,CAAA;CAIL,IAAMW,IAAWC,OAAS;CAE1B,OACE,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAACC,GAAD;GAAW,WAAU;GAAQ,WAAU;GAAvC,UAAA;IACG3C,KACC,kBAAC,UAAD;KACE,MAAK;KACL,eAAeT,EAASW,CAAU;KAClC,WAAU;KAHZ,UAAA,CAKE,kBAAC0C,GAAD,EAAW,WAAU,SAAU,CAAA,GAC9BC,EAAcC,GAAG,oBAAoB,eAAe,CAC/C;;IAGV,kBAACC,GAAD,EAA6B,YAAW,CAAA;IAExC,kBAACC,IAAD;KACW;KACF;KACK;KACH;KACT,eAAerC,IAAeC,IAAgB;KACpC;KACA;KACE;KACE;KACd,kBAAkBP;KAClB,mBAAmB,MAAU,KAAKgC,GAAqBC,CAAK;KAC5D,eAAe,KAAKC,EAAU;KAC9B,qBAAqB7B,EAAe,EAAI;KACxC,kBAAkB,KAAKoB,EAAe;KACtC,kBAAkB,MAAS,KAAKK,GAAoBvD,CAAI;KACxD,mBAAmB,MAAS,KAAKwD,GAAqBxD,CAAI;IAC3D,CAAA;GACQ;;CACR,CAAA;AAET"}
@@ -0,0 +1,16 @@
1
+ import { I18nContextValue } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';
2
+ /**
3
+ * A friendly name for a file's kind ("PDF document", "Spreadsheet"), shown in
4
+ * place of the raw MIME type in Navigation v2 (BOFF-11865). The MIME type
5
+ * itself moves under "Show technical details".
6
+ */
7
+ export type FileKind = "pdf" | "word" | "spreadsheet" | "presentation" | "image" | "video" | "audio" | "archive" | "code" | "text";
8
+ /**
9
+ * Classify a file: an exact MIME type, then a media MIME family, then the
10
+ * extension (which also covers generic types such as
11
+ * `application/octet-stream` and `text/*` subtypes like `text/x-csv`), then
12
+ * any other `text/*` type; null when nothing is known.
13
+ */
14
+ export declare function classifyFileKind(mimeType: string | undefined, extension: string | undefined): FileKind | null;
15
+ /** The translated friendly kind, e.g. "PDF document", or "XYZ file" / "File". */
16
+ export declare function fileKindLabel(t: I18nContextValue["t"], mimeType: string | undefined, extension: string | undefined): string;
@@ -0,0 +1,120 @@
1
+ import { tWithFallback as e } from "./i18n.js";
2
+ // src/files/utils/fileKind.ts
3
+ var t = {
4
+ "application/pdf": "pdf",
5
+ "application/msword": "word",
6
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "word",
7
+ "application/vnd.oasis.opendocument.text": "word",
8
+ "application/rtf": "word",
9
+ "application/vnd.ms-excel": "spreadsheet",
10
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "spreadsheet",
11
+ "application/vnd.oasis.opendocument.spreadsheet": "spreadsheet",
12
+ "text/csv": "spreadsheet",
13
+ "application/vnd.ms-powerpoint": "presentation",
14
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "presentation",
15
+ "application/vnd.oasis.opendocument.presentation": "presentation",
16
+ "application/zip": "archive",
17
+ "application/x-zip-compressed": "archive",
18
+ "application/x-tar": "archive",
19
+ "application/x-7z-compressed": "archive",
20
+ "application/gzip": "archive",
21
+ "application/x-gzip": "archive",
22
+ "application/x-rar-compressed": "archive",
23
+ "application/vnd.rar": "archive",
24
+ "application/json": "code",
25
+ "application/xml": "code",
26
+ "application/javascript": "code",
27
+ "application/x-yaml": "code",
28
+ "text/plain": "text",
29
+ "text/markdown": "text"
30
+ }, n = {
31
+ pdf: "pdf",
32
+ doc: "word",
33
+ docx: "word",
34
+ odt: "word",
35
+ rtf: "word",
36
+ xls: "spreadsheet",
37
+ xlsx: "spreadsheet",
38
+ ods: "spreadsheet",
39
+ csv: "spreadsheet",
40
+ ppt: "presentation",
41
+ pptx: "presentation",
42
+ odp: "presentation",
43
+ zip: "archive",
44
+ tar: "archive",
45
+ gz: "archive",
46
+ "7z": "archive",
47
+ rar: "archive",
48
+ json: "code",
49
+ xml: "code",
50
+ yaml: "code",
51
+ yml: "code",
52
+ txt: "text",
53
+ md: "text"
54
+ }, r = [
55
+ ["image/", "image"],
56
+ ["video/", "video"],
57
+ ["audio/", "audio"]
58
+ ];
59
+ function i(e, i) {
60
+ let a = (e ?? "").trim().toLowerCase().split(";")[0] ?? "", o = a ? t[a] : void 0;
61
+ if (o) return o;
62
+ let s = r.find(([e]) => a.startsWith(e));
63
+ if (s) return s[1];
64
+ let c = (i ?? "").trim().toLowerCase().replace(/^\./, "");
65
+ return (c ? n[c] : void 0) || (a.startsWith("text/") ? "text" : null);
66
+ }
67
+ var a = {
68
+ pdf: {
69
+ key: "files.kind.pdf",
70
+ fallback: "PDF document"
71
+ },
72
+ word: {
73
+ key: "files.kind.word",
74
+ fallback: "Word document"
75
+ },
76
+ spreadsheet: {
77
+ key: "files.kind.spreadsheet",
78
+ fallback: "Spreadsheet"
79
+ },
80
+ presentation: {
81
+ key: "files.kind.presentation",
82
+ fallback: "Presentation"
83
+ },
84
+ image: {
85
+ key: "files.kind.image",
86
+ fallback: "Image"
87
+ },
88
+ video: {
89
+ key: "files.kind.video",
90
+ fallback: "Video"
91
+ },
92
+ audio: {
93
+ key: "files.kind.audio",
94
+ fallback: "Audio"
95
+ },
96
+ archive: {
97
+ key: "files.kind.archive",
98
+ fallback: "Archive"
99
+ },
100
+ code: {
101
+ key: "files.kind.code",
102
+ fallback: "Code or data file"
103
+ },
104
+ text: {
105
+ key: "files.kind.text",
106
+ fallback: "Text document"
107
+ }
108
+ };
109
+ function o(t, n, r) {
110
+ let o = i(n, r);
111
+ if (o) {
112
+ let { key: n, fallback: r } = a[o];
113
+ return e(t, n, r);
114
+ }
115
+ let s = (r ?? "").trim().replace(/^\./, "");
116
+ return s ? e(t, "files.kind.withExtension", "{{extension}} file", { extension: s.toUpperCase() }) : e(t, "files.kind.generic", "File");
117
+ }
118
+ export { i as classifyFileKind, o as fileKindLabel };
119
+
120
+ //# sourceMappingURL=fileKind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileKind.js","names":["EXACT_MIME_KINDS","EXTENSION_KINDS","MEDIA_PREFIX_KINDS","classifyFileKind","mime","mimeType","exact","media","prefix","ext","extension","KIND_LABELS","fileKindLabel","kind","tWithFallback","key","fallback"],"sources":["../../../src/files/utils/fileKind.ts"],"sourcesContent":["import type { I18nContextValue } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { tWithFallback } from \"./i18n\";\n\n/**\n * A friendly name for a file's kind (\"PDF document\", \"Spreadsheet\"), shown in\n * place of the raw MIME type in Navigation v2 (BOFF-11865). The MIME type\n * itself moves under \"Show technical details\".\n */\nexport type FileKind =\n | \"pdf\"\n | \"word\"\n | \"spreadsheet\"\n | \"presentation\"\n | \"image\"\n | \"video\"\n | \"audio\"\n | \"archive\"\n | \"code\"\n | \"text\";\n\nconst EXACT_MIME_KINDS: Record<string, FileKind> = {\n \"application/pdf\": \"pdf\",\n \"application/msword\": \"word\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\":\n \"word\",\n \"application/vnd.oasis.opendocument.text\": \"word\",\n \"application/rtf\": \"word\",\n \"application/vnd.ms-excel\": \"spreadsheet\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\":\n \"spreadsheet\",\n \"application/vnd.oasis.opendocument.spreadsheet\": \"spreadsheet\",\n \"text/csv\": \"spreadsheet\",\n \"application/vnd.ms-powerpoint\": \"presentation\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\":\n \"presentation\",\n \"application/vnd.oasis.opendocument.presentation\": \"presentation\",\n \"application/zip\": \"archive\",\n \"application/x-zip-compressed\": \"archive\",\n \"application/x-tar\": \"archive\",\n \"application/x-7z-compressed\": \"archive\",\n \"application/gzip\": \"archive\",\n \"application/x-gzip\": \"archive\",\n \"application/x-rar-compressed\": \"archive\",\n \"application/vnd.rar\": \"archive\",\n \"application/json\": \"code\",\n \"application/xml\": \"code\",\n \"application/javascript\": \"code\",\n \"application/x-yaml\": \"code\",\n \"text/plain\": \"text\",\n \"text/markdown\": \"text\",\n};\n\nconst EXTENSION_KINDS: Record<string, FileKind> = {\n pdf: \"pdf\",\n doc: \"word\",\n docx: \"word\",\n odt: \"word\",\n rtf: \"word\",\n xls: \"spreadsheet\",\n xlsx: \"spreadsheet\",\n ods: \"spreadsheet\",\n csv: \"spreadsheet\",\n ppt: \"presentation\",\n pptx: \"presentation\",\n odp: \"presentation\",\n zip: \"archive\",\n tar: \"archive\",\n gz: \"archive\",\n \"7z\": \"archive\",\n rar: \"archive\",\n json: \"code\",\n xml: \"code\",\n yaml: \"code\",\n yml: \"code\",\n txt: \"text\",\n md: \"text\",\n};\n\n// Media families are definitive, so they win over a conflicting extension\n// (a renamed photo stays an Image).\nconst MEDIA_PREFIX_KINDS: ReadonlyArray<[string, FileKind]> = [\n [\"image/\", \"image\"],\n [\"video/\", \"video\"],\n [\"audio/\", \"audio\"],\n];\n\n/**\n * Classify a file: an exact MIME type, then a media MIME family, then the\n * extension (which also covers generic types such as\n * `application/octet-stream` and `text/*` subtypes like `text/x-csv`), then\n * any other `text/*` type; null when nothing is known.\n */\nexport function classifyFileKind(\n mimeType: string | undefined,\n extension: string | undefined,\n): FileKind | null {\n const mime = (mimeType ?? \"\").trim().toLowerCase().split(\";\")[0] ?? \"\";\n const exact = mime ? EXACT_MIME_KINDS[mime] : undefined;\n if (exact) return exact;\n const media = MEDIA_PREFIX_KINDS.find(([prefix]) => mime.startsWith(prefix));\n if (media) return media[1];\n const ext = (extension ?? \"\").trim().toLowerCase().replace(/^\\./, \"\");\n const byExtension = ext ? EXTENSION_KINDS[ext] : undefined;\n if (byExtension) return byExtension;\n return mime.startsWith(\"text/\") ? \"text\" : null;\n}\n\n// Literal `{ key, fallback }` pairs so the host apps' i18n extractor finds them.\nconst KIND_LABELS: Record<FileKind, { key: string; fallback: string }> = {\n pdf: { key: \"files.kind.pdf\", fallback: \"PDF document\" },\n word: { key: \"files.kind.word\", fallback: \"Word document\" },\n spreadsheet: { key: \"files.kind.spreadsheet\", fallback: \"Spreadsheet\" },\n presentation: { key: \"files.kind.presentation\", fallback: \"Presentation\" },\n image: { key: \"files.kind.image\", fallback: \"Image\" },\n video: { key: \"files.kind.video\", fallback: \"Video\" },\n audio: { key: \"files.kind.audio\", fallback: \"Audio\" },\n archive: { key: \"files.kind.archive\", fallback: \"Archive\" },\n code: { key: \"files.kind.code\", fallback: \"Code or data file\" },\n text: { key: \"files.kind.text\", fallback: \"Text document\" },\n};\n\n/** The translated friendly kind, e.g. \"PDF document\", or \"XYZ file\" / \"File\". */\nexport function fileKindLabel(\n t: I18nContextValue[\"t\"],\n mimeType: string | undefined,\n extension: string | undefined,\n): string {\n const kind = classifyFileKind(mimeType, extension);\n if (kind) {\n const { key, fallback } = KIND_LABELS[kind];\n return tWithFallback(t, key, fallback);\n }\n const ext = (extension ?? \"\").trim().replace(/^\\./, \"\");\n if (ext) {\n return tWithFallback(t, \"files.kind.withExtension\", \"{{extension}} file\", {\n extension: ext.toUpperCase(),\n });\n }\n return tWithFallback(t, \"files.kind.generic\", \"File\");\n}\n"],"mappings":";;AAoBA,IAAMA,IAA6C;CACjD,mBAAmB;CACnB,sBAAsB;CACtB,2EACE;CACF,2CAA2C;CAC3C,mBAAmB;CACnB,4BAA4B;CAC5B,qEACE;CACF,kDAAkD;CAClD,YAAY;CACZ,iCAAiC;CACjC,6EACE;CACF,mDAAmD;CACnD,mBAAmB;CACnB,gCAAgC;CAChC,qBAAqB;CACrB,+BAA+B;CAC/B,oBAAoB;CACpB,sBAAsB;CACtB,gCAAgC;CAChC,uBAAuB;CACvB,oBAAoB;CACpB,mBAAmB;CACnB,0BAA0B;CAC1B,sBAAsB;CACtB,cAAc;CACd,iBAAiB;AACnB,GAEMC,IAA4C;CAChD,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;CACL,IAAI;CACJ,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,IAAI;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C,CAAQ;CACvC;CACA,IAAMP,KAAOC,KAAa,GAAA,CAAI,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;CAMtD,OALID,IACKK,EAAc,GAAG,4BAA4B,sBAAsB,EACxE,WAAWL,EAAI,YAAY,EAC7B,CAAC,IAEIK,EAAc,GAAG,sBAAsB,MAAM;AACtD"}
@@ -0,0 +1,12 @@
1
+ import { I18nContextValue } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';
2
+ import { FileItem, FolderItem } from '../types';
3
+ type Translate = I18nContextValue["t"];
4
+ /**
5
+ * The raw properties the info panel moves under "Show technical details" in
6
+ * Navigation v2 (BOFF-11865): IDs, MIME type, version, path, and the raw
7
+ * status, visibility and starred values. One line each, so the Copy button
8
+ * hands support a readable block. IDs, MIME type, path, status and
9
+ * visibility are shown as stored; the line labels and Yes/No are translated.
10
+ */
11
+ export declare function buildInfoTechnicalDetails(t: Translate, item: FileItem | FolderItem, type: "file" | "folder"): string;
12
+ export {};
@@ -0,0 +1,16 @@
1
+ import { tWithFallback as e } from "./i18n.js";
2
+ // src/files/utils/infoTechnicalDetails.ts
3
+ function t(t, n, r) {
4
+ let i = [];
5
+ if (r === "file") {
6
+ let r = n;
7
+ i.push(e(t, "files.info.technical.fileId", "File ID: {{value}}", { value: r.id })), r.mimeType && i.push(e(t, "files.info.technical.mimeType", "MIME type: {{value}}", { value: r.mimeType })), r.versionNumber !== void 0 && r.versionNumber !== null && i.push(e(t, "files.info.technical.version", "Version: {{value}}", { value: r.versionNumber }));
8
+ } else {
9
+ let r = n;
10
+ i.push(e(t, "files.info.technical.folderId", "Folder ID: {{value}}", { value: r.id })), r.path && i.push(e(t, "files.info.technical.path", "Path: {{value}}", { value: r.path }));
11
+ }
12
+ return n.status && i.push(e(t, "files.info.technical.status", "Status: {{value}}", { value: n.status })), n.visibility && i.push(e(t, "files.info.technical.visibility", "Visibility: {{value}}", { value: n.visibility })), i.push(e(t, "files.info.technical.starred", "Starred: {{value}}", { value: n.starred ? e(t, "files.info.yes", "Yes") : e(t, "files.info.no", "No") })), i.join("\n");
13
+ }
14
+ export { t as buildInfoTechnicalDetails };
15
+
16
+ //# sourceMappingURL=infoTechnicalDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infoTechnicalDetails.js","names":["buildInfoTechnicalDetails","lines","type","file","item","tWithFallback","folder"],"sources":["../../../src/files/utils/infoTechnicalDetails.ts"],"sourcesContent":["import type { I18nContextValue } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { tWithFallback } from \"./i18n\";\n\ntype Translate = I18nContextValue[\"t\"];\n\n/**\n * The raw properties the info panel moves under \"Show technical details\" in\n * Navigation v2 (BOFF-11865): IDs, MIME type, version, path, and the raw\n * status, visibility and starred values. One line each, so the Copy button\n * hands support a readable block. IDs, MIME type, path, status and\n * visibility are shown as stored; the line labels and Yes/No are translated.\n */\nexport function buildInfoTechnicalDetails(\n t: Translate,\n item: FileItem | FolderItem,\n type: \"file\" | \"folder\",\n): string {\n const lines: string[] = [];\n if (type === \"file\") {\n const file = item as FileItem;\n lines.push(\n tWithFallback(t, \"files.info.technical.fileId\", \"File ID: {{value}}\", {\n value: file.id,\n }),\n );\n if (file.mimeType) {\n lines.push(\n tWithFallback(\n t,\n \"files.info.technical.mimeType\",\n \"MIME type: {{value}}\",\n { value: file.mimeType },\n ),\n );\n }\n if (file.versionNumber !== undefined && file.versionNumber !== null) {\n lines.push(\n tWithFallback(t, \"files.info.technical.version\", \"Version: {{value}}\", {\n value: file.versionNumber,\n }),\n );\n }\n } else {\n const folder = item as FolderItem;\n lines.push(\n tWithFallback(\n t,\n \"files.info.technical.folderId\",\n \"Folder ID: {{value}}\",\n { value: folder.id },\n ),\n );\n if (folder.path) {\n lines.push(\n tWithFallback(t, \"files.info.technical.path\", \"Path: {{value}}\", {\n value: folder.path,\n }),\n );\n }\n }\n if (item.status) {\n lines.push(\n tWithFallback(t, \"files.info.technical.status\", \"Status: {{value}}\", {\n value: item.status,\n }),\n );\n }\n if (item.visibility) {\n lines.push(\n tWithFallback(\n t,\n \"files.info.technical.visibility\",\n \"Visibility: {{value}}\",\n { value: item.visibility },\n ),\n );\n }\n lines.push(\n tWithFallback(t, \"files.info.technical.starred\", \"Starred: {{value}}\", {\n value: item.starred\n ? tWithFallback(t, \"files.info.yes\", \"Yes\")\n : tWithFallback(t, \"files.info.no\", \"No\"),\n }),\n );\n return lines.join(\"\\n\");\n}\n"],"mappings":";;AAaA,SAAgBA,EACd,GACA,GACA,GACQ;CACR,IAAMC,IAAkB,CAAC;CACzB,IAAIC,MAAS,QAAQ;EACnB,IAAMC,IAAOC;EAgBb,AAfAH,EAAM,KACJI,EAAc,GAAG,+BAA+B,sBAAsB,EACpE,OAAOF,EAAK,GACd,CAAC,CACH,GACIA,EAAK,YACPF,EAAM,KACJI,EACE,GACA,iCACA,wBACA,EAAE,OAAOF,EAAK,SAAS,CACzB,CACF,GAEEA,EAAK,kBAAkB,KAAA,KAAaA,EAAK,kBAAkB,QAC7DF,EAAM,KACJI,EAAc,GAAG,gCAAgC,sBAAsB,EACrE,OAAOF,EAAK,cACd,CAAC,CACH;CAEJ,OAAO;EACL,IAAMG,IAASF;EASf,AARAH,EAAM,KACJI,EACE,GACA,iCACA,wBACA,EAAE,OAAOC,EAAO,GAAG,CACrB,CACF,GACIA,EAAO,QACTL,EAAM,KACJI,EAAc,GAAG,6BAA6B,mBAAmB,EAC/D,OAAOC,EAAO,KAChB,CAAC,CACH;CAEJ;CAyBA,OAxBIF,EAAK,UACPH,EAAM,KACJI,EAAc,GAAG,+BAA+B,qBAAqB,EACnE,OAAOD,EAAK,OACd,CAAC,CACH,GAEEA,EAAK,cACPH,EAAM,KACJI,EACE,GACA,mCACA,yBACA,EAAE,OAAOD,EAAK,WAAW,CAC3B,CACF,GAEFH,EAAM,KACJI,EAAc,GAAG,gCAAgC,sBAAsB,EACrE,OAAOD,EAAK,UACRC,EAAc,GAAG,kBAAkB,KAAK,IACxCA,EAAc,GAAG,iBAAiB,IAAI,EAC5C,CAAC,CACH,GACOJ,EAAM,KAAK,IAAI;AACxB"}
@@ -29,4 +29,10 @@ export declare function isSignedInVisitor(context: {
29
29
  currentUser?: unknown;
30
30
  authToken?: string;
31
31
  }): boolean;
32
+ /**
33
+ * The raw text of a share-access failure for "Show technical details"
34
+ * (BOFF-11841): the server's error code and message, or null when there is
35
+ * nothing beyond the plain sentence. Never shown as the main copy.
36
+ */
37
+ export declare function shareAccessErrorDetail(error: unknown): string | null;
32
38
  export {};
@@ -19,6 +19,11 @@ function r(r) {
19
19
  function i(e) {
20
20
  return !!e.currentUser || !!e.authToken;
21
21
  }
22
- export { e as ShareAccessError, r as classifyShareAccessError, i as isSignedInVisitor };
22
+ function a(t) {
23
+ if (!(t instanceof Error)) return null;
24
+ let n = t.message.trim(), r = t instanceof e ? t.code : null;
25
+ return r && n ? `${r}: ${n}` : r || n || null;
26
+ }
27
+ export { e as ShareAccessError, r as classifyShareAccessError, i as isSignedInVisitor, a as shareAccessErrorDetail };
23
28
 
24
29
  //# sourceMappingURL=shareAccess.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shareAccess.js","names":["ShareAccessError","message","code","first","errors","fallbackMessage","PASSWORD_REQUIRED_CODES","PASSWORD_INVALID_CODES","classifyShareAccessError","error","isSignedInVisitor","context"],"sources":["../../../src/files/utils/shareAccess.ts"],"sourcesContent":["/**\n * Helpers for the public share page (`/files/share/:token`).\n *\n * Outside visitors must never see raw server messages (BOFF-11865), so every\n * failure is reduced to one of three outcomes the page words in plain language.\n */\n\n/** Why a share link could not be opened, as far as the visitor needs to know. */\nexport type ShareAccessFailure =\n \"password-required\" | \"password-invalid\" | \"unavailable\";\n\ntype GraphQLErrorEntry = {\n message?: string;\n extensions?: { code?: unknown };\n};\n\n/** A failed share request, keeping the server's code and message for logs only. */\nexport class ShareAccessError extends Error {\n readonly code: string | null;\n\n constructor(message: string, code: string | null = null) {\n super(message);\n this.name = \"ShareAccessError\";\n this.code = code;\n }\n\n /** Build an error from the first GraphQL error of a response, if any. */\n static fromGraphQLErrors(\n errors: ReadonlyArray<GraphQLErrorEntry> | undefined,\n fallbackMessage: string,\n ): ShareAccessError {\n const first = errors?.[0];\n const code =\n typeof first?.extensions?.code === \"string\"\n ? first.extensions.code\n : null;\n return new ShareAccessError(first?.message || fallbackMessage, code);\n }\n}\n\nconst PASSWORD_REQUIRED_CODES = new Set([\"PASSWORD_REQUIRED\"]);\nconst PASSWORD_INVALID_CODES = new Set([\n \"INVALID_PASSWORD\",\n \"INVALID_SHARE_PASSWORD\",\n]);\n\n/**\n * Reduce any share-access failure to what the visitor can act on: enter a\n * password, retry a wrong password, or accept that the link no longer works.\n */\nexport function classifyShareAccessError(error: unknown): ShareAccessFailure {\n const code = error instanceof ShareAccessError ? error.code : null;\n if (code && PASSWORD_REQUIRED_CODES.has(code)) return \"password-required\";\n if (code && PASSWORD_INVALID_CODES.has(code)) return \"password-invalid\";\n\n const message = error instanceof Error ? error.message.toLowerCase() : \"\";\n if (/password (is )?required/.test(message)) return \"password-required\";\n if (/(invalid|incorrect|wrong) password/.test(message)) {\n return \"password-invalid\";\n }\n return \"unavailable\";\n}\n\n/** Whether the visitor is signed in to the app hosting the share page. */\nexport function isSignedInVisitor(context: {\n currentUser?: unknown;\n authToken?: string;\n}): boolean {\n return Boolean(context.currentUser) || Boolean(context.authToken);\n}\n"],"mappings":";AAiBA,IAAaA,IAAb,MAAaA,UAAyB,MAAM;CAC1C;CAEA,YAAY,GAAiB,IAAsB,MAAM;EAGvD,AAFA,MAAMC,CAAO,GACb,KAAK,OAAO,oBACZ,KAAK,OAAOC;CACd;CAGA,OAAO,kBACL,GACA,GACkB;EAClB,IAAMC,IAAQC,IAAS,IACjBF,IACJ,OAAOC,GAAO,YAAY,QAAS,WAC/BA,EAAM,WAAW,OACjB;EACN,OAAO,IAAIH,EAAiBG,GAAO,WAAWE,GAAiBH,CAAI;CACrE;AACF,GAEMI,oBAA0B,IAAI,IAAI,CAAC,mBAAmB,CAAC,GACvDC,oBAAyB,IAAI,IAAI,CACrC,oBACA,wBACF,CAAC;AAMD,SAAgBC,EAAyB,GAAoC;CAC3E,IAAMN,IAAOO,aAAiBT,IAAmBS,EAAM,OAAO;CAC9D,IAAIP,KAAQI,EAAwB,IAAIJ,CAAI,GAAG,OAAO;CACtD,IAAIA,KAAQK,EAAuB,IAAIL,CAAI,GAAG,OAAO;CAErD,IAAMD,IAAUQ,aAAiB,QAAQA,EAAM,QAAQ,YAAY,IAAI;CAKvE,OAJI,0BAA0B,KAAKR,CAAO,IAAU,sBAChD,qCAAqC,KAAKA,CAAO,IAC5C,qBAEF;AACT;AAGA,SAAgBS,EAAkB,GAGtB;CACV,OAAO,EAAQC,EAAQ,eAAgB,EAAQA,EAAQ;AACzD"}
1
+ {"version":3,"file":"shareAccess.js","names":["ShareAccessError","message","code","first","errors","fallbackMessage","PASSWORD_REQUIRED_CODES","PASSWORD_INVALID_CODES","classifyShareAccessError","error","isSignedInVisitor","context","shareAccessErrorDetail"],"sources":["../../../src/files/utils/shareAccess.ts"],"sourcesContent":["/**\n * Helpers for the public share page (`/files/share/:token`).\n *\n * Outside visitors must never see raw server messages (BOFF-11865), so every\n * failure is reduced to one of three outcomes the page words in plain language.\n */\n\n/** Why a share link could not be opened, as far as the visitor needs to know. */\nexport type ShareAccessFailure =\n \"password-required\" | \"password-invalid\" | \"unavailable\";\n\ntype GraphQLErrorEntry = {\n message?: string;\n extensions?: { code?: unknown };\n};\n\n/** A failed share request, keeping the server's code and message for logs only. */\nexport class ShareAccessError extends Error {\n readonly code: string | null;\n\n constructor(message: string, code: string | null = null) {\n super(message);\n this.name = \"ShareAccessError\";\n this.code = code;\n }\n\n /** Build an error from the first GraphQL error of a response, if any. */\n static fromGraphQLErrors(\n errors: ReadonlyArray<GraphQLErrorEntry> | undefined,\n fallbackMessage: string,\n ): ShareAccessError {\n const first = errors?.[0];\n const code =\n typeof first?.extensions?.code === \"string\"\n ? first.extensions.code\n : null;\n return new ShareAccessError(first?.message || fallbackMessage, code);\n }\n}\n\nconst PASSWORD_REQUIRED_CODES = new Set([\"PASSWORD_REQUIRED\"]);\nconst PASSWORD_INVALID_CODES = new Set([\n \"INVALID_PASSWORD\",\n \"INVALID_SHARE_PASSWORD\",\n]);\n\n/**\n * Reduce any share-access failure to what the visitor can act on: enter a\n * password, retry a wrong password, or accept that the link no longer works.\n */\nexport function classifyShareAccessError(error: unknown): ShareAccessFailure {\n const code = error instanceof ShareAccessError ? error.code : null;\n if (code && PASSWORD_REQUIRED_CODES.has(code)) return \"password-required\";\n if (code && PASSWORD_INVALID_CODES.has(code)) return \"password-invalid\";\n\n const message = error instanceof Error ? error.message.toLowerCase() : \"\";\n if (/password (is )?required/.test(message)) return \"password-required\";\n if (/(invalid|incorrect|wrong) password/.test(message)) {\n return \"password-invalid\";\n }\n return \"unavailable\";\n}\n\n/** Whether the visitor is signed in to the app hosting the share page. */\nexport function isSignedInVisitor(context: {\n currentUser?: unknown;\n authToken?: string;\n}): boolean {\n return Boolean(context.currentUser) || Boolean(context.authToken);\n}\n\n/**\n * The raw text of a share-access failure for \"Show technical details\"\n * (BOFF-11841): the server's error code and message, or null when there is\n * nothing beyond the plain sentence. Never shown as the main copy.\n */\nexport function shareAccessErrorDetail(error: unknown): string | null {\n if (!(error instanceof Error)) return null;\n const message = error.message.trim();\n const code = error instanceof ShareAccessError ? error.code : null;\n if (code && message) return `${code}: ${message}`;\n return code || message || null;\n}\n"],"mappings":";AAiBA,IAAaA,IAAb,MAAaA,UAAyB,MAAM;CAC1C;CAEA,YAAY,GAAiB,IAAsB,MAAM;EAGvD,AAFA,MAAMC,CAAO,GACb,KAAK,OAAO,oBACZ,KAAK,OAAOC;CACd;CAGA,OAAO,kBACL,GACA,GACkB;EAClB,IAAMC,IAAQC,IAAS,IACjBF,IACJ,OAAOC,GAAO,YAAY,QAAS,WAC/BA,EAAM,WAAW,OACjB;EACN,OAAO,IAAIH,EAAiBG,GAAO,WAAWE,GAAiBH,CAAI;CACrE;AACF,GAEMI,oBAA0B,IAAI,IAAI,CAAC,mBAAmB,CAAC,GACvDC,oBAAyB,IAAI,IAAI,CACrC,oBACA,wBACF,CAAC;AAMD,SAAgBC,EAAyB,GAAoC;CAC3E,IAAMN,IAAOO,aAAiBT,IAAmBS,EAAM,OAAO;CAC9D,IAAIP,KAAQI,EAAwB,IAAIJ,CAAI,GAAG,OAAO;CACtD,IAAIA,KAAQK,EAAuB,IAAIL,CAAI,GAAG,OAAO;CAErD,IAAMD,IAAUQ,aAAiB,QAAQA,EAAM,QAAQ,YAAY,IAAI;CAKvE,OAJI,0BAA0B,KAAKR,CAAO,IAAU,sBAChD,qCAAqC,KAAKA,CAAO,IAC5C,qBAEF;AACT;AAGA,SAAgBS,EAAkB,GAGtB;CACV,OAAO,EAAQC,EAAQ,eAAgB,EAAQA,EAAQ;AACzD;AAOA,SAAgBC,EAAuB,GAA+B;CACpE,IAAI,EAAEH,aAAiB,QAAQ,OAAO;CACtC,IAAMR,IAAUQ,EAAM,QAAQ,KAAK,GAC7BP,IAAOO,aAAiBT,IAAmBS,EAAM,OAAO;CAE9D,OADIP,KAAQD,IAAgB,GAAGC,EAAK,IAAID,MACjCC,KAAQD,KAAW;AAC5B"}
@@ -103,6 +103,7 @@ export declare const enTranslations: {
103
103
  waiting: string;
104
104
  };
105
105
  loadError: string;
106
+ loadErrorHelp: string;
106
107
  unexpectedError: string;
107
108
  };
108
109
  card: {
@@ -172,6 +173,7 @@ export declare const enTranslations: {
172
173
  copyHere: string;
173
174
  copyOf: string;
174
175
  copying: string;
176
+ destination: string;
175
177
  makeCopyOf: string;
176
178
  myDrive: string;
177
179
  name: string;
@@ -279,8 +281,33 @@ export declare const enTranslations: {
279
281
  type: string;
280
282
  unknown: string;
281
283
  visibility: string;
284
+ viewVersionHistory: string;
285
+ technical: {
286
+ fileId: string;
287
+ folderId: string;
288
+ mimeType: string;
289
+ path: string;
290
+ starred: string;
291
+ status: string;
292
+ version: string;
293
+ visibility: string;
294
+ };
282
295
  yes: string;
283
296
  };
297
+ kind: {
298
+ archive: string;
299
+ audio: string;
300
+ code: string;
301
+ generic: string;
302
+ image: string;
303
+ pdf: string;
304
+ presentation: string;
305
+ spreadsheet: string;
306
+ text: string;
307
+ video: string;
308
+ withExtension: string;
309
+ word: string;
310
+ };
284
311
  item: {
285
312
  errors: {
286
313
  moveFailed: string;
@@ -365,6 +392,8 @@ export declare const enTranslations: {
365
392
  };
366
393
  search: {
367
394
  filters: {
395
+ more: string;
396
+ moreWithCount: string;
368
397
  title: string;
369
398
  };
370
399
  input: {
@@ -85,6 +85,7 @@ var e = { files: {
85
85
  waiting: "Waiting for workspace..."
86
86
  },
87
87
  loadError: "Failed to load files",
88
+ loadErrorHelp: "Something went wrong while loading your files. Try again in a moment.",
88
89
  unexpectedError: "An unexpected error occurred"
89
90
  },
90
91
  card: {
@@ -152,6 +153,7 @@ var e = { files: {
152
153
  copyHere: "Copy here",
153
154
  copyOf: "Copy of",
154
155
  copying: "Copying...",
156
+ destination: "Copy to: {{folder}}",
155
157
  makeCopyOf: "Make a copy of \"{{name}}\"",
156
158
  myDrive: "My Drive",
157
159
  name: "Name",
@@ -235,8 +237,33 @@ var e = { files: {
235
237
  type: "Type",
236
238
  unknown: "Unknown",
237
239
  visibility: "Visibility",
240
+ viewVersionHistory: "View Version History",
241
+ technical: {
242
+ fileId: "File ID: {{value}}",
243
+ folderId: "Folder ID: {{value}}",
244
+ mimeType: "MIME type: {{value}}",
245
+ path: "Path: {{value}}",
246
+ starred: "Starred: {{value}}",
247
+ status: "Status: {{value}}",
248
+ version: "Version: {{value}}",
249
+ visibility: "Visibility: {{value}}"
250
+ },
238
251
  yes: "Yes"
239
252
  },
253
+ kind: {
254
+ archive: "Archive",
255
+ audio: "Audio",
256
+ code: "Code or data file",
257
+ generic: "File",
258
+ image: "Image",
259
+ pdf: "PDF document",
260
+ presentation: "Presentation",
261
+ spreadsheet: "Spreadsheet",
262
+ text: "Text document",
263
+ video: "Video",
264
+ withExtension: "{{extension}} file",
265
+ word: "Word document"
266
+ },
240
267
  item: { errors: {
241
268
  moveFailed: "Failed to move item",
242
269
  renameFailed: "Failed to rename item"
@@ -316,7 +343,11 @@ var e = { files: {
316
343
  }
317
344
  },
318
345
  search: {
319
- filters: { title: "Search filters" },
346
+ filters: {
347
+ more: "More filters",
348
+ moreWithCount: "More filters ({{count}})",
349
+ title: "Search filters"
350
+ },
320
351
  input: { placeholder: "Search files..." }
321
352
  },
322
353
  share: {