@athenaintel/react 0.10.38 → 0.10.39
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/README.md +44 -5
- package/dist/assets/AthenaAssetEmbed.d.ts +1 -1
- package/dist/assets/use-asset-embed.d.ts +3 -1
- package/dist/chat/athena-citation-links.d.ts +3 -0
- package/dist/index.cjs +53 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47482,6 +47482,51 @@ const ASSET_TYPE_ALIASES = {
|
|
|
47482
47482
|
word_document: "document"
|
|
47483
47483
|
};
|
|
47484
47484
|
const isAthenaSpacesPath = (url) => url.pathname.replace(/\/+$/, "") === "/dashboard/spaces";
|
|
47485
|
+
const getFiniteNumber = (url, key) => {
|
|
47486
|
+
const value = url.searchParams.get(key);
|
|
47487
|
+
if (value === null || value.trim() === "") return null;
|
|
47488
|
+
const parsed = Number(value);
|
|
47489
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
47490
|
+
};
|
|
47491
|
+
const parseCitationReference = ({
|
|
47492
|
+
url,
|
|
47493
|
+
assetId
|
|
47494
|
+
}) => {
|
|
47495
|
+
const reference2 = { id: assetId };
|
|
47496
|
+
const anchorType = url.searchParams.get("anchor");
|
|
47497
|
+
const page = getFiniteNumber(url, "page");
|
|
47498
|
+
switch (anchorType) {
|
|
47499
|
+
case "page":
|
|
47500
|
+
if (page !== null) reference2.anchor = { type: anchorType, page };
|
|
47501
|
+
break;
|
|
47502
|
+
case "page_range": {
|
|
47503
|
+
const startPage = getFiniteNumber(url, "start_page");
|
|
47504
|
+
const endPage = getFiniteNumber(url, "end_page");
|
|
47505
|
+
if (startPage !== null && endPage !== null) {
|
|
47506
|
+
reference2.anchor = { type: anchorType, startPage, endPage };
|
|
47507
|
+
}
|
|
47508
|
+
break;
|
|
47509
|
+
}
|
|
47510
|
+
case "page_rect": {
|
|
47511
|
+
const x = getFiniteNumber(url, "x");
|
|
47512
|
+
const y = getFiniteNumber(url, "y");
|
|
47513
|
+
const width = getFiniteNumber(url, "width");
|
|
47514
|
+
const height = getFiniteNumber(url, "height");
|
|
47515
|
+
if (page !== null && x !== null && y !== null && width !== null && height !== null) {
|
|
47516
|
+
reference2.anchor = { type: anchorType, page, x, y, width, height };
|
|
47517
|
+
}
|
|
47518
|
+
break;
|
|
47519
|
+
}
|
|
47520
|
+
case "page_text": {
|
|
47521
|
+
const text2 = url.searchParams.get("text");
|
|
47522
|
+
if (page !== null && text2) reference2.anchor = { type: anchorType, page, text: text2 };
|
|
47523
|
+
break;
|
|
47524
|
+
}
|
|
47525
|
+
}
|
|
47526
|
+
const excerpt = url.searchParams.get("excerpt");
|
|
47527
|
+
if (excerpt) reference2.meta = { excerpt };
|
|
47528
|
+
return reference2;
|
|
47529
|
+
};
|
|
47485
47530
|
const normalizeAssetType = (value) => {
|
|
47486
47531
|
if (!value) {
|
|
47487
47532
|
return null;
|
|
@@ -47570,7 +47615,8 @@ const parseAthenaCitationLink = ({
|
|
|
47570
47615
|
url,
|
|
47571
47616
|
assetId,
|
|
47572
47617
|
assetIds,
|
|
47573
|
-
assetType: normalizeAssetType(url.searchParams.get("asset_type") ?? url.searchParams.get("type"))
|
|
47618
|
+
assetType: normalizeAssetType(url.searchParams.get("asset_type") ?? url.searchParams.get("type")),
|
|
47619
|
+
reference: parseCitationReference({ url, assetId })
|
|
47574
47620
|
};
|
|
47575
47621
|
};
|
|
47576
47622
|
const isAthenaCitationUrl = ({
|
|
@@ -56239,6 +56285,8 @@ function isAthenaAssetCitationClickEvent(value) {
|
|
|
56239
56285
|
function isAthenaAssetCitationActionEvent(value) {
|
|
56240
56286
|
return typeof value === "object" && value !== null && "type" in value && value.type === ATHENA_ASSET_CITATION_ACTION_MESSAGE && "version" in value && value.version === 1 && "action" in value && value.action === "open-in-spaces" && "reference" in value && typeof value.reference === "object" && value.reference !== null && "id" in value.reference && typeof value.reference.id === "string";
|
|
56241
56287
|
}
|
|
56288
|
+
const DEFAULT_ASSET_EMBED_READ_ONLY = false;
|
|
56289
|
+
const DEFAULT_ASSET_EMBED_DISPLAY_MODE = "full";
|
|
56242
56290
|
function buildAssetEmbedRequestBody({
|
|
56243
56291
|
assetId,
|
|
56244
56292
|
readOnly,
|
|
@@ -56472,9 +56520,9 @@ function useAssetEmbed(assetId, options = {
|
|
|
56472
56520
|
backendUrl: ""
|
|
56473
56521
|
}) {
|
|
56474
56522
|
const {
|
|
56475
|
-
readOnly =
|
|
56523
|
+
readOnly = DEFAULT_ASSET_EMBED_READ_ONLY,
|
|
56476
56524
|
expiresInSeconds = 60 * 60 * 24 * 30,
|
|
56477
|
-
displayMode =
|
|
56525
|
+
displayMode = DEFAULT_ASSET_EMBED_DISPLAY_MODE,
|
|
56478
56526
|
backendUrl,
|
|
56479
56527
|
appUrl,
|
|
56480
56528
|
apiKey,
|
|
@@ -56567,8 +56615,8 @@ const AUTH_SYNC_INTERVAL_MS = 6e4;
|
|
|
56567
56615
|
const AthenaAssetEmbed = ({
|
|
56568
56616
|
assetId,
|
|
56569
56617
|
reference: reference2,
|
|
56570
|
-
displayMode =
|
|
56571
|
-
readOnly =
|
|
56618
|
+
displayMode = DEFAULT_ASSET_EMBED_DISPLAY_MODE,
|
|
56619
|
+
readOnly = DEFAULT_ASSET_EMBED_READ_ONLY,
|
|
56572
56620
|
expiresInSeconds,
|
|
56573
56621
|
citationBehavior,
|
|
56574
56622
|
onCitationClick,
|