@burdenoff/website-sdk 2026.522.6 → 2026.524.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.
@@ -772,6 +772,42 @@ function BlogPostPage(props) {
772
772
  ] })
773
773
  ] });
774
774
  }
775
+
776
+ // src/content/utils.ts
777
+ function formatBytes(bytes) {
778
+ if (bytes == null) return "";
779
+ if (bytes < 1024) return `${bytes} B`;
780
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;
781
+ return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
782
+ }
783
+ function fileExt(file) {
784
+ const name = file.fileName || file.fileUrl.split("/").pop()?.split("?")[0] || "";
785
+ const ext = name.split(".").pop();
786
+ return ext && ext !== name ? ext.toUpperCase() : "FILE";
787
+ }
788
+ async function downloadFile(e, file) {
789
+ e.preventDefault();
790
+ const openInTab = () => window.open(file.fileUrl, "_blank", "noopener,noreferrer");
791
+ const name = file.fileName || file.fileUrl.split("/").pop()?.split("?")[0] || file.title || "download";
792
+ try {
793
+ const res = await fetch(file.fileUrl, { mode: "cors" });
794
+ if (!res.ok) {
795
+ openInTab();
796
+ return;
797
+ }
798
+ const blob = await res.blob();
799
+ const objUrl = URL.createObjectURL(blob);
800
+ const a = document.createElement("a");
801
+ a.href = objUrl;
802
+ a.download = name;
803
+ document.body.appendChild(a);
804
+ a.click();
805
+ a.remove();
806
+ URL.revokeObjectURL(objUrl);
807
+ } catch {
808
+ openInTab();
809
+ }
810
+ }
775
811
  var PRESS_KIT_QUERY = `
776
812
  query PublicPressKit($productId: String!, $limit: Int, $offset: Int) {
777
813
  publicPressKitAssets(productId: $productId, limit: $limit, offset: $offset) {
@@ -837,38 +873,9 @@ var CATEGORY_LABELS = {
837
873
  DOCUMENT: "Documents",
838
874
  PRESS_RELEASE: "Press Releases"
839
875
  };
840
- function formatBytes(bytes) {
841
- if (bytes == null) return "";
842
- if (bytes < 1024) return `${bytes} B`;
843
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;
844
- return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
845
- }
846
876
  function isImageAsset(a) {
847
877
  return (a.mimeType || "").startsWith("image/");
848
878
  }
849
- async function downloadAsset(e, asset) {
850
- e.preventDefault();
851
- const openInTab = () => window.open(asset.fileUrl, "_blank", "noopener,noreferrer");
852
- const name = asset.fileName || asset.fileUrl.split("/").pop()?.split("?")[0] || asset.title || "download";
853
- try {
854
- const res = await fetch(asset.fileUrl, { mode: "cors" });
855
- if (!res.ok) {
856
- openInTab();
857
- return;
858
- }
859
- const blob = await res.blob();
860
- const objUrl = URL.createObjectURL(blob);
861
- const a = document.createElement("a");
862
- a.href = objUrl;
863
- a.download = name;
864
- document.body.appendChild(a);
865
- a.click();
866
- a.remove();
867
- URL.revokeObjectURL(objUrl);
868
- } catch {
869
- openInTab();
870
- }
871
- }
872
879
  function PressKitLightbox({
873
880
  asset,
874
881
  onClose
@@ -955,7 +962,7 @@ function PressKitLightbox({
955
962
  rel: "noopener noreferrer",
956
963
  download: true,
957
964
  onClick: (e) => {
958
- void downloadAsset(e, asset);
965
+ void downloadFile(e, asset);
959
966
  },
960
967
  className: "inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",
961
968
  children: [
@@ -1071,7 +1078,7 @@ function AssetCard({
1071
1078
  rel: "noopener noreferrer",
1072
1079
  download: true,
1073
1080
  onClick: (e) => {
1074
- void downloadAsset(e, asset);
1081
+ void downloadFile(e, asset);
1075
1082
  },
1076
1083
  className: "inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",
1077
1084
  children: [
@@ -1201,9 +1208,10 @@ function PressKitPage(props) {
1201
1208
  setLoading(true);
1202
1209
  try {
1203
1210
  const PAGE_SIZE = 100;
1211
+ const MAX_PAGES = 10;
1204
1212
  const all = [];
1205
1213
  let offset = 0;
1206
- for (; ; ) {
1214
+ for (let pageNum = 0; pageNum < MAX_PAGES; pageNum++) {
1207
1215
  const result = await client.query(PRESS_KIT_QUERY, {
1208
1216
  productId: resolvedProductId,
1209
1217
  limit: PAGE_SIZE,
@@ -1404,7 +1412,166 @@ function PressKitPage(props) {
1404
1412
  /* @__PURE__ */ jsx(PressKitLightbox, { asset: preview, onClose: () => setPreview(null) })
1405
1413
  ] });
1406
1414
  }
1415
+ var CONTRACTS_QUERY = `
1416
+ query PublicContracts($productId: String!, $limit: Int, $offset: Int) {
1417
+ publicPressKitAssets(productId: $productId, category: CONTRACT, limit: $limit, offset: $offset) {
1418
+ items {
1419
+ id
1420
+ title
1421
+ slug
1422
+ description
1423
+ fileUrl
1424
+ fileName
1425
+ fileSize
1426
+ mimeType
1427
+ version
1428
+ tags
1429
+ sortOrder
1430
+ updatedAt
1431
+ }
1432
+ hasMore
1433
+ }
1434
+ }
1435
+ `;
1436
+ function ContractsPage(props) {
1437
+ const {
1438
+ productName,
1439
+ heroTitle = "Contracts & Legal Agreements",
1440
+ heroSubtitle = "Download our standard legal agreements and policies.",
1441
+ className = "",
1442
+ seoTitle,
1443
+ seoDescription,
1444
+ seoKeywords
1445
+ } = props;
1446
+ const client = useWebSDK();
1447
+ const config = useWebSDKConfig();
1448
+ const { product } = useProduct();
1449
+ const resolvedProductId = product?.id || config.productId;
1450
+ const displayName = productName ?? product?.name ?? config.productId;
1451
+ const [contracts, setContracts] = useState([]);
1452
+ const [loading, setLoading] = useState(true);
1453
+ const [error, setError] = useState(null);
1454
+ const fetchContracts = useCallback(async () => {
1455
+ if (!resolvedProductId) {
1456
+ setLoading(false);
1457
+ return;
1458
+ }
1459
+ setLoading(true);
1460
+ try {
1461
+ const PAGE_SIZE = 100;
1462
+ const MAX_PAGES = 10;
1463
+ const all = [];
1464
+ let offset = 0;
1465
+ for (let pageNum = 0; pageNum < MAX_PAGES; pageNum++) {
1466
+ const result = await client.query(CONTRACTS_QUERY, {
1467
+ productId: resolvedProductId,
1468
+ limit: PAGE_SIZE,
1469
+ offset
1470
+ });
1471
+ if (result.errors?.length) {
1472
+ setError(result.errors[0]?.message ?? "Failed to load contracts");
1473
+ return;
1474
+ }
1475
+ const page = result.data?.publicPressKitAssets;
1476
+ const items = page?.items || [];
1477
+ all.push(...items);
1478
+ if (!page?.hasMore || items.length === 0) break;
1479
+ offset += PAGE_SIZE;
1480
+ }
1481
+ all.sort(
1482
+ (a, b) => a.sortOrder - b.sortOrder || a.title.localeCompare(b.title)
1483
+ );
1484
+ setContracts(all);
1485
+ setError(null);
1486
+ } catch {
1487
+ setError("Failed to load contracts");
1488
+ } finally {
1489
+ setLoading(false);
1490
+ }
1491
+ }, [client, resolvedProductId]);
1492
+ useEffect(() => {
1493
+ fetchContracts();
1494
+ }, [fetchContracts]);
1495
+ return /* @__PURE__ */ jsxs("div", { className: `min-h-screen bg-background ${className}`, children: [
1496
+ /* @__PURE__ */ jsx(
1497
+ PageHead,
1498
+ {
1499
+ title: seoTitle || `Contracts \u2014 ${displayName}`,
1500
+ description: seoDescription || heroSubtitle,
1501
+ productName,
1502
+ keywords: seoKeywords
1503
+ }
1504
+ ),
1505
+ /* @__PURE__ */ jsx("section", { className: "border-b border-border bg-muted/30", children: /* @__PURE__ */ jsxs("div", { className: "max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-16 text-center", children: [
1506
+ /* @__PURE__ */ jsx("h1", { className: "text-4xl md:text-5xl font-bold text-foreground mb-4", children: heroTitle }),
1507
+ /* @__PURE__ */ jsx("p", { className: "text-lg text-muted-foreground max-w-2xl mx-auto", children: heroSubtitle })
1508
+ ] }) }),
1509
+ /* @__PURE__ */ jsx("section", { className: "max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-12", children: loading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-20", children: /* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent" }) }) : error ? /* @__PURE__ */ jsx("div", { className: "text-center py-16", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: error }) }) : contracts.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-center py-16", children: /* @__PURE__ */ jsx("p", { className: "text-base text-muted-foreground", children: "No contracts are available yet." }) }) : /* @__PURE__ */ jsx("ul", { className: "divide-y divide-border rounded-xl border border-border overflow-hidden bg-card", children: contracts.map((c) => {
1510
+ const ext = fileExt(c);
1511
+ const size = formatBytes(c.fileSize);
1512
+ return /* @__PURE__ */ jsxs(
1513
+ "li",
1514
+ {
1515
+ className: "flex items-center justify-between gap-4 p-5 hover:bg-muted/40 transition-colors",
1516
+ children: [
1517
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
1518
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
1519
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-foreground truncate", children: c.title }),
1520
+ c.version && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-primary bg-primary/10 px-2 py-0.5 rounded-full", children: c.version })
1521
+ ] }),
1522
+ c.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1 line-clamp-2", children: c.description }),
1523
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [
1524
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: ext }),
1525
+ size && /* @__PURE__ */ jsxs(Fragment, { children: [
1526
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/40", children: "\xB7" }),
1527
+ /* @__PURE__ */ jsx("span", { children: size })
1528
+ ] })
1529
+ ] })
1530
+ ] }),
1531
+ /* @__PURE__ */ jsxs(
1532
+ "a",
1533
+ {
1534
+ href: c.fileUrl,
1535
+ target: "_blank",
1536
+ rel: "noopener noreferrer",
1537
+ download: true,
1538
+ "aria-label": `Download ${c.title}`,
1539
+ onClick: (e) => {
1540
+ void downloadFile(e, c);
1541
+ },
1542
+ className: "flex-shrink-0 inline-flex items-center gap-1.5 text-sm font-medium text-primary-foreground bg-primary hover:opacity-90 px-4 py-2 rounded-lg transition-opacity",
1543
+ children: [
1544
+ /* @__PURE__ */ jsx(
1545
+ "svg",
1546
+ {
1547
+ className: "w-4 h-4",
1548
+ fill: "none",
1549
+ viewBox: "0 0 24 24",
1550
+ stroke: "currentColor",
1551
+ "aria-hidden": "true",
1552
+ children: /* @__PURE__ */ jsx(
1553
+ "path",
1554
+ {
1555
+ strokeLinecap: "round",
1556
+ strokeLinejoin: "round",
1557
+ strokeWidth: 2,
1558
+ d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
1559
+ }
1560
+ )
1561
+ }
1562
+ ),
1563
+ "Download"
1564
+ ]
1565
+ }
1566
+ )
1567
+ ]
1568
+ },
1569
+ c.id
1570
+ );
1571
+ }) }) })
1572
+ ] });
1573
+ }
1407
1574
 
1408
- export { BlogListPage, BlogPostPage, ContentRenderer, PressKitPage, useContentPage, useContentPages };
1575
+ export { BlogListPage, BlogPostPage, ContentRenderer, ContractsPage, PressKitPage, useContentPage, useContentPages };
1409
1576
  //# sourceMappingURL=index.mjs.map
1410
1577
  //# sourceMappingURL=index.mjs.map