@burdenoff/microfe-files 2026.1113.2 → 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.
- package/dist/files/components/CopyDialog.d.ts +6 -0
- package/dist/files/components/CopyDialog.js +112 -101
- package/dist/files/components/CopyDialog.js.map +1 -1
- package/dist/files/components/FileBrowser.js +175 -165
- package/dist/files/components/FileBrowser.js.map +1 -1
- package/dist/files/components/FileInfoPanel.d.ts +7 -1
- package/dist/files/components/FileInfoPanel.js +225 -184
- package/dist/files/components/FileInfoPanel.js.map +1 -1
- package/dist/files/components/SearchBar.d.ts +7 -1
- package/dist/files/components/SearchBar.js +166 -159
- package/dist/files/components/SearchBar.js.map +1 -1
- package/dist/files/components/ShareAccessParts.d.ts +65 -0
- package/dist/files/components/ShareAccessParts.js +149 -0
- package/dist/files/components/ShareAccessParts.js.map +1 -0
- package/dist/files/components/ShareDialog.d.ts +5 -4
- package/dist/files/components/ShareDialog.js +31 -27
- package/dist/files/components/ShareDialog.js.map +1 -1
- package/dist/files/components/SharedFolderView.d.ts +18 -0
- package/dist/files/components/SharedFolderView.js +80 -0
- package/dist/files/components/SharedFolderView.js.map +1 -0
- package/dist/files/hooks/usePublicShare.d.ts +21 -0
- package/dist/files/hooks/usePublicShare.js +45 -0
- package/dist/files/hooks/usePublicShare.js.map +1 -0
- package/dist/files/hooks/useSharedFolderFileUrl.d.ts +20 -0
- package/dist/files/hooks/useSharedFolderFileUrl.js +32 -0
- package/dist/files/hooks/useSharedFolderFileUrl.js.map +1 -0
- package/dist/files/pages/BrowserPage.js +274 -271
- package/dist/files/pages/BrowserPage.js.map +1 -1
- package/dist/files/pages/ShareAccessPage.js +129 -160
- package/dist/files/pages/ShareAccessPage.js.map +1 -1
- package/dist/files/utils/fileKind.d.ts +16 -0
- package/dist/files/utils/fileKind.js +120 -0
- package/dist/files/utils/fileKind.js.map +1 -0
- package/dist/files/utils/infoTechnicalDetails.d.ts +12 -0
- package/dist/files/utils/infoTechnicalDetails.js +16 -0
- package/dist/files/utils/infoTechnicalDetails.js.map +1 -0
- package/dist/files/utils/publicShare.d.ts +62 -0
- package/dist/files/utils/publicShare.js +44 -0
- package/dist/files/utils/publicShare.js.map +1 -0
- package/dist/files/utils/shareAccess.d.ts +6 -0
- package/dist/files/utils/shareAccess.js +6 -1
- package/dist/files/utils/shareAccess.js.map +1 -1
- package/dist/generated/global-types.d.ts +294 -123
- package/dist/generated/wspace-operations.d.ts +48 -0
- package/dist/generated/wspace-operations.js +372 -36
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +6493 -695
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/translations/en.d.ts +40 -0
- package/dist/translations/en.js +43 -1
- package/dist/translations/en.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Runs one public GraphQL operation and returns its `data`, or throws. */
|
|
2
|
+
export type PublicShareRequest = <TData, TVariables>(query: string, variables: TVariables) => Promise<TData>;
|
|
3
|
+
/** The GraphQL documents the loader sends, as printed strings. */
|
|
4
|
+
export type PublicShareDocuments = {
|
|
5
|
+
grantPreview: string;
|
|
6
|
+
accessFile: string;
|
|
7
|
+
accessFolder: string;
|
|
8
|
+
};
|
|
9
|
+
/** A file as `accessShare` returns it. */
|
|
10
|
+
export type SharedFilePayload = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
workspaceId: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
size: string;
|
|
16
|
+
s3Key: string;
|
|
17
|
+
downloadUrl?: string | null;
|
|
18
|
+
};
|
|
19
|
+
/** A file inside a shared folder, as `accessFolderShare` lists it. */
|
|
20
|
+
export type SharedFolderFile = {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
extension: string;
|
|
24
|
+
mimeType: string;
|
|
25
|
+
size: string | number;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
};
|
|
28
|
+
export type PublicShareResult = {
|
|
29
|
+
kind: "file";
|
|
30
|
+
file: SharedFilePayload;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "folder";
|
|
33
|
+
folder: {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
files: SharedFolderFile[];
|
|
38
|
+
/** True when the folder holds more files than the link lists. */
|
|
39
|
+
truncated: boolean;
|
|
40
|
+
};
|
|
41
|
+
export type ShareResourceKind = "file" | "folder";
|
|
42
|
+
/** Whether a share grant's resource type names a folder. */
|
|
43
|
+
export declare function isFolderResource(resourceType: string | null | undefined): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Find out whether the token points at a file or a folder.
|
|
46
|
+
*
|
|
47
|
+
* Any failure here (unknown token, network) falls back to "file": the file
|
|
48
|
+
* operation then reports the real problem in the page's usual plain words,
|
|
49
|
+
* exactly as the page behaved before folder links existed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveShareResourceKind(request: PublicShareRequest, documents: Pick<PublicShareDocuments, "grantPreview">, token: string): Promise<ShareResourceKind>;
|
|
52
|
+
/**
|
|
53
|
+
* Open a share link. Pass `kind` once it is known so a password retry does
|
|
54
|
+
* not look the token up again.
|
|
55
|
+
*/
|
|
56
|
+
export declare function loadPublicShare(request: PublicShareRequest, documents: PublicShareDocuments, options: {
|
|
57
|
+
token: string;
|
|
58
|
+
password?: string;
|
|
59
|
+
kind?: ShareResourceKind;
|
|
60
|
+
/** Called once the link's kind is known, before it is opened. */
|
|
61
|
+
onKind?: (kind: ShareResourceKind) => void;
|
|
62
|
+
}): Promise<PublicShareResult>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ShareAccessError as e } from "./shareAccess.js";
|
|
2
|
+
// src/files/utils/publicShare.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e?.trim().toLowerCase() === "folder";
|
|
5
|
+
}
|
|
6
|
+
async function n(e, n, r) {
|
|
7
|
+
try {
|
|
8
|
+
return t((await e(n.grantPreview, { token: r })).fileShareGrantByToken?.resourceType) ? "folder" : "file";
|
|
9
|
+
} catch {
|
|
10
|
+
return "file";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
async function r(t, r, i) {
|
|
14
|
+
let { token: a } = i;
|
|
15
|
+
if (!a) throw new e("Share token is missing");
|
|
16
|
+
let o = i.kind ?? await n(t, r, a);
|
|
17
|
+
i.onKind?.(o);
|
|
18
|
+
let s = {
|
|
19
|
+
token: a,
|
|
20
|
+
password: i.password || void 0
|
|
21
|
+
};
|
|
22
|
+
if (o === "folder") {
|
|
23
|
+
let n = (await t(r.accessFolder, { input: s })).accessFolderShare;
|
|
24
|
+
if (!n?.folder) throw new e("Shared folder is unavailable");
|
|
25
|
+
return {
|
|
26
|
+
kind: "folder",
|
|
27
|
+
folder: n.folder,
|
|
28
|
+
files: n.files ?? [],
|
|
29
|
+
truncated: !!n.truncated
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
let c = (await t(r.accessFile, { input: s })).accessShare;
|
|
33
|
+
if (!c?.file || !c.share) throw new e(c?.message || "Shared file is unavailable");
|
|
34
|
+
return {
|
|
35
|
+
kind: "file",
|
|
36
|
+
file: {
|
|
37
|
+
...c.file,
|
|
38
|
+
downloadUrl: c.file.downloadUrl ?? c.downloadUrl
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export { t as isFolderResource, r as loadPublicShare, n as resolveShareResourceKind };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=publicShare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicShare.js","names":["isFolderResource","resourceType","resolveShareResourceKind","request","documents","loadPublicShare","options","token","ShareAccessError","kind","input","payload"],"sources":["../../../src/files/utils/publicShare.ts"],"sourcesContent":["/**\n * Loading logic for the public share page (`/files/share/:token`).\n *\n * One link route serves both file and folder share links (BOFF-11865). The\n * page first asks which kind of resource the token points at, then opens it\n * with the matching public operation:\n * - file links: `accessShare`\n * - folder links: `accessFolderShare`, then `downloadFolderShareFile` per file\n *\n * The request function is injected so the flow can be tested without a\n * network, and so the page keeps sending the requests without credentials.\n */\nimport { ShareAccessError } from \"./shareAccess\";\n\n/** Runs one public GraphQL operation and returns its `data`, or throws. */\nexport type PublicShareRequest = <TData, TVariables>(\n query: string,\n variables: TVariables,\n) => Promise<TData>;\n\n/** The GraphQL documents the loader sends, as printed strings. */\nexport type PublicShareDocuments = {\n grantPreview: string;\n accessFile: string;\n accessFolder: string;\n};\n\n/** A file as `accessShare` returns it. */\nexport type SharedFilePayload = {\n id: string;\n name: string;\n workspaceId: string;\n mimeType: string;\n size: string;\n s3Key: string;\n downloadUrl?: string | null;\n};\n\n/** A file inside a shared folder, as `accessFolderShare` lists it. */\nexport type SharedFolderFile = {\n id: string;\n name: string;\n extension: string;\n mimeType: string;\n size: string | number;\n updatedAt: string;\n};\n\nexport type PublicShareResult =\n | { kind: \"file\"; file: SharedFilePayload }\n | {\n kind: \"folder\";\n folder: { id: string; name: string };\n files: SharedFolderFile[];\n /** True when the folder holds more files than the link lists. */\n truncated: boolean;\n };\n\nexport type ShareResourceKind = \"file\" | \"folder\";\n\ntype GrantPreviewData = {\n fileShareGrantByToken?: { resourceType?: string | null } | null;\n};\n\ntype AccessFileData = {\n accessShare?: {\n message?: string | null;\n share?: unknown;\n file?: SharedFilePayload | null;\n downloadUrl?: string | null;\n } | null;\n};\n\ntype AccessFolderData = {\n accessFolderShare?: {\n folder?: { id: string; name: string } | null;\n files?: SharedFolderFile[] | null;\n truncated?: boolean | null;\n } | null;\n};\n\n/** Whether a share grant's resource type names a folder. */\nexport function isFolderResource(resourceType: string | null | undefined) {\n return resourceType?.trim().toLowerCase() === \"folder\";\n}\n\n/**\n * Find out whether the token points at a file or a folder.\n *\n * Any failure here (unknown token, network) falls back to \"file\": the file\n * operation then reports the real problem in the page's usual plain words,\n * exactly as the page behaved before folder links existed.\n */\nexport async function resolveShareResourceKind(\n request: PublicShareRequest,\n documents: Pick<PublicShareDocuments, \"grantPreview\">,\n token: string,\n): Promise<ShareResourceKind> {\n try {\n const data = await request<GrantPreviewData, { token: string }>(\n documents.grantPreview,\n { token },\n );\n return isFolderResource(data.fileShareGrantByToken?.resourceType)\n ? \"folder\"\n : \"file\";\n } catch {\n return \"file\";\n }\n}\n\n/**\n * Open a share link. Pass `kind` once it is known so a password retry does\n * not look the token up again.\n */\nexport async function loadPublicShare(\n request: PublicShareRequest,\n documents: PublicShareDocuments,\n options: {\n token: string;\n password?: string;\n kind?: ShareResourceKind;\n /** Called once the link's kind is known, before it is opened. */\n onKind?: (kind: ShareResourceKind) => void;\n },\n): Promise<PublicShareResult> {\n const { token } = options;\n if (!token) {\n throw new ShareAccessError(\"Share token is missing\");\n }\n\n const kind =\n options.kind ?? (await resolveShareResourceKind(request, documents, token));\n options.onKind?.(kind);\n const input = { token, password: options.password || undefined };\n\n if (kind === \"folder\") {\n const data = await request<AccessFolderData, { input: typeof input }>(\n documents.accessFolder,\n { input },\n );\n const payload = data.accessFolderShare;\n if (!payload?.folder) {\n throw new ShareAccessError(\"Shared folder is unavailable\");\n }\n return {\n kind: \"folder\",\n folder: payload.folder,\n files: payload.files ?? [],\n truncated: Boolean(payload.truncated),\n };\n }\n\n const data = await request<AccessFileData, { input: typeof input }>(\n documents.accessFile,\n { input },\n );\n const payload = data.accessShare;\n if (!payload?.file || !payload.share) {\n throw new ShareAccessError(\n payload?.message || \"Shared file is unavailable\",\n );\n }\n return {\n kind: \"file\",\n file: {\n ...payload.file,\n downloadUrl: payload.file.downloadUrl ?? payload.downloadUrl,\n },\n };\n}\n"],"mappings":";;AAkFA,SAAgBA,EAAiB,GAAyC;CACxE,OAAOC,GAAc,KAAK,CAAC,CAAC,YAAY,MAAM;AAChD;AASA,eAAsBC,EACpB,GACA,GACA,GAC4B;CAC5B,IAAI;EAKF,OAAOF,GAAiB,MAJLG,EACjBC,EAAU,cACV,EAAE,SAAM,CACV,EAAA,CAC6B,uBAAuB,YAAY,IAC5D,WACA;CACN,QAAQ;EACN,OAAO;CACT;AACF;AAMA,eAAsBC,EACpB,GACA,GACA,GAO4B;CAC5B,IAAM,EAAE,aAAUC;CAClB,IAAI,CAACC,GACH,MAAM,IAAIC,EAAiB,wBAAwB;CAGrD,IAAMC,IACJH,EAAQ,QAAS,MAAMJ,EAAyBC,GAASC,GAAWG,CAAK;CAC3E,EAAQ,SAASE,CAAI;CACrB,IAAMC,IAAQ;EAAE;EAAO,UAAUJ,EAAQ,YAAY,KAAA;CAAU;CAE/D,IAAIG,MAAS,UAAU;EAKrB,IAAME,KAAU,MAJGR,EACjBC,EAAU,cACV,EAAE,SAAM,CACV,EAAA,CACqB;EACrB,IAAI,CAACO,GAAS,QACZ,MAAM,IAAIH,EAAiB,8BAA8B;EAE3D,OAAO;GACL,MAAM;GACN,QAAQG,EAAQ;GAChB,OAAOA,EAAQ,SAAS,CAAC;GACzB,WAAW,EAAQA,EAAQ;EAC7B;CACF;CAMA,IAAMA,KAAU,MAJGR,EACjBC,EAAU,YACV,EAAE,SAAM,CACV,EAAA,CACqB;CACrB,IAAI,CAACO,GAAS,QAAQ,CAACA,EAAQ,OAC7B,MAAM,IAAIH,EACRG,GAAS,WAAW,4BACtB;CAEF,OAAO;EACL,MAAM;EACN,MAAM;GACJ,GAAGA,EAAQ;GACX,aAAaA,EAAQ,KAAK,eAAeA,EAAQ;EACnD;CACF;AACF"}
|
|
@@ -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
|
-
|
|
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"}
|