@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.
package/dist/index.mjs CHANGED
@@ -4258,6 +4258,42 @@ function BlogPostPage(props) {
4258
4258
  ] })
4259
4259
  ] });
4260
4260
  }
4261
+
4262
+ // src/content/utils.ts
4263
+ function formatBytes(bytes) {
4264
+ if (bytes == null) return "";
4265
+ if (bytes < 1024) return `${bytes} B`;
4266
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;
4267
+ return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
4268
+ }
4269
+ function fileExt(file) {
4270
+ const name = file.fileName || file.fileUrl.split("/").pop()?.split("?")[0] || "";
4271
+ const ext = name.split(".").pop();
4272
+ return ext && ext !== name ? ext.toUpperCase() : "FILE";
4273
+ }
4274
+ async function downloadFile(e, file) {
4275
+ e.preventDefault();
4276
+ const openInTab = () => window.open(file.fileUrl, "_blank", "noopener,noreferrer");
4277
+ const name = file.fileName || file.fileUrl.split("/").pop()?.split("?")[0] || file.title || "download";
4278
+ try {
4279
+ const res = await fetch(file.fileUrl, { mode: "cors" });
4280
+ if (!res.ok) {
4281
+ openInTab();
4282
+ return;
4283
+ }
4284
+ const blob = await res.blob();
4285
+ const objUrl = URL.createObjectURL(blob);
4286
+ const a = document.createElement("a");
4287
+ a.href = objUrl;
4288
+ a.download = name;
4289
+ document.body.appendChild(a);
4290
+ a.click();
4291
+ a.remove();
4292
+ URL.revokeObjectURL(objUrl);
4293
+ } catch {
4294
+ openInTab();
4295
+ }
4296
+ }
4261
4297
  var PRESS_KIT_QUERY = `
4262
4298
  query PublicPressKit($productId: String!, $limit: Int, $offset: Int) {
4263
4299
  publicPressKitAssets(productId: $productId, limit: $limit, offset: $offset) {
@@ -4323,38 +4359,9 @@ var CATEGORY_LABELS = {
4323
4359
  DOCUMENT: "Documents",
4324
4360
  PRESS_RELEASE: "Press Releases"
4325
4361
  };
4326
- function formatBytes(bytes) {
4327
- if (bytes == null) return "";
4328
- if (bytes < 1024) return `${bytes} B`;
4329
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;
4330
- return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
4331
- }
4332
4362
  function isImageAsset(a) {
4333
4363
  return (a.mimeType || "").startsWith("image/");
4334
4364
  }
4335
- async function downloadAsset(e, asset) {
4336
- e.preventDefault();
4337
- const openInTab = () => window.open(asset.fileUrl, "_blank", "noopener,noreferrer");
4338
- const name = asset.fileName || asset.fileUrl.split("/").pop()?.split("?")[0] || asset.title || "download";
4339
- try {
4340
- const res = await fetch(asset.fileUrl, { mode: "cors" });
4341
- if (!res.ok) {
4342
- openInTab();
4343
- return;
4344
- }
4345
- const blob = await res.blob();
4346
- const objUrl = URL.createObjectURL(blob);
4347
- const a = document.createElement("a");
4348
- a.href = objUrl;
4349
- a.download = name;
4350
- document.body.appendChild(a);
4351
- a.click();
4352
- a.remove();
4353
- URL.revokeObjectURL(objUrl);
4354
- } catch {
4355
- openInTab();
4356
- }
4357
- }
4358
4365
  function PressKitLightbox({
4359
4366
  asset,
4360
4367
  onClose
@@ -4441,7 +4448,7 @@ function PressKitLightbox({
4441
4448
  rel: "noopener noreferrer",
4442
4449
  download: true,
4443
4450
  onClick: (e) => {
4444
- void downloadAsset(e, asset);
4451
+ void downloadFile(e, asset);
4445
4452
  },
4446
4453
  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",
4447
4454
  children: [
@@ -4557,7 +4564,7 @@ function AssetCard({
4557
4564
  rel: "noopener noreferrer",
4558
4565
  download: true,
4559
4566
  onClick: (e) => {
4560
- void downloadAsset(e, asset);
4567
+ void downloadFile(e, asset);
4561
4568
  },
4562
4569
  className: "inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",
4563
4570
  children: [
@@ -4687,9 +4694,10 @@ function PressKitPage(props) {
4687
4694
  setLoading(true);
4688
4695
  try {
4689
4696
  const PAGE_SIZE = 100;
4697
+ const MAX_PAGES = 10;
4690
4698
  const all = [];
4691
4699
  let offset = 0;
4692
- for (; ; ) {
4700
+ for (let pageNum = 0; pageNum < MAX_PAGES; pageNum++) {
4693
4701
  const result = await client.query(PRESS_KIT_QUERY, {
4694
4702
  productId: resolvedProductId,
4695
4703
  limit: PAGE_SIZE,
@@ -4890,7 +4898,166 @@ function PressKitPage(props) {
4890
4898
  /* @__PURE__ */ jsx(PressKitLightbox, { asset: preview, onClose: () => setPreview(null) })
4891
4899
  ] });
4892
4900
  }
4901
+ var CONTRACTS_QUERY = `
4902
+ query PublicContracts($productId: String!, $limit: Int, $offset: Int) {
4903
+ publicPressKitAssets(productId: $productId, category: CONTRACT, limit: $limit, offset: $offset) {
4904
+ items {
4905
+ id
4906
+ title
4907
+ slug
4908
+ description
4909
+ fileUrl
4910
+ fileName
4911
+ fileSize
4912
+ mimeType
4913
+ version
4914
+ tags
4915
+ sortOrder
4916
+ updatedAt
4917
+ }
4918
+ hasMore
4919
+ }
4920
+ }
4921
+ `;
4922
+ function ContractsPage(props) {
4923
+ const {
4924
+ productName,
4925
+ heroTitle = "Contracts & Legal Agreements",
4926
+ heroSubtitle = "Download our standard legal agreements and policies.",
4927
+ className = "",
4928
+ seoTitle,
4929
+ seoDescription,
4930
+ seoKeywords
4931
+ } = props;
4932
+ const client = useWebSDK();
4933
+ const config = useWebSDKConfig();
4934
+ const { product } = useProduct();
4935
+ const resolvedProductId = product?.id || config.productId;
4936
+ const displayName = productName ?? product?.name ?? config.productId;
4937
+ const [contracts, setContracts] = useState([]);
4938
+ const [loading, setLoading] = useState(true);
4939
+ const [error, setError] = useState(null);
4940
+ const fetchContracts = useCallback(async () => {
4941
+ if (!resolvedProductId) {
4942
+ setLoading(false);
4943
+ return;
4944
+ }
4945
+ setLoading(true);
4946
+ try {
4947
+ const PAGE_SIZE = 100;
4948
+ const MAX_PAGES = 10;
4949
+ const all = [];
4950
+ let offset = 0;
4951
+ for (let pageNum = 0; pageNum < MAX_PAGES; pageNum++) {
4952
+ const result = await client.query(CONTRACTS_QUERY, {
4953
+ productId: resolvedProductId,
4954
+ limit: PAGE_SIZE,
4955
+ offset
4956
+ });
4957
+ if (result.errors?.length) {
4958
+ setError(result.errors[0]?.message ?? "Failed to load contracts");
4959
+ return;
4960
+ }
4961
+ const page = result.data?.publicPressKitAssets;
4962
+ const items = page?.items || [];
4963
+ all.push(...items);
4964
+ if (!page?.hasMore || items.length === 0) break;
4965
+ offset += PAGE_SIZE;
4966
+ }
4967
+ all.sort(
4968
+ (a, b) => a.sortOrder - b.sortOrder || a.title.localeCompare(b.title)
4969
+ );
4970
+ setContracts(all);
4971
+ setError(null);
4972
+ } catch {
4973
+ setError("Failed to load contracts");
4974
+ } finally {
4975
+ setLoading(false);
4976
+ }
4977
+ }, [client, resolvedProductId]);
4978
+ useEffect(() => {
4979
+ fetchContracts();
4980
+ }, [fetchContracts]);
4981
+ return /* @__PURE__ */ jsxs("div", { className: `min-h-screen bg-background ${className}`, children: [
4982
+ /* @__PURE__ */ jsx(
4983
+ PageHead,
4984
+ {
4985
+ title: seoTitle || `Contracts \u2014 ${displayName}`,
4986
+ description: seoDescription || heroSubtitle,
4987
+ productName,
4988
+ keywords: seoKeywords
4989
+ }
4990
+ ),
4991
+ /* @__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: [
4992
+ /* @__PURE__ */ jsx("h1", { className: "text-4xl md:text-5xl font-bold text-foreground mb-4", children: heroTitle }),
4993
+ /* @__PURE__ */ jsx("p", { className: "text-lg text-muted-foreground max-w-2xl mx-auto", children: heroSubtitle })
4994
+ ] }) }),
4995
+ /* @__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) => {
4996
+ const ext = fileExt(c);
4997
+ const size = formatBytes(c.fileSize);
4998
+ return /* @__PURE__ */ jsxs(
4999
+ "li",
5000
+ {
5001
+ className: "flex items-center justify-between gap-4 p-5 hover:bg-muted/40 transition-colors",
5002
+ children: [
5003
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
5004
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
5005
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-foreground truncate", children: c.title }),
5006
+ 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 })
5007
+ ] }),
5008
+ c.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1 line-clamp-2", children: c.description }),
5009
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [
5010
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: ext }),
5011
+ size && /* @__PURE__ */ jsxs(Fragment, { children: [
5012
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/40", children: "\xB7" }),
5013
+ /* @__PURE__ */ jsx("span", { children: size })
5014
+ ] })
5015
+ ] })
5016
+ ] }),
5017
+ /* @__PURE__ */ jsxs(
5018
+ "a",
5019
+ {
5020
+ href: c.fileUrl,
5021
+ target: "_blank",
5022
+ rel: "noopener noreferrer",
5023
+ download: true,
5024
+ "aria-label": `Download ${c.title}`,
5025
+ onClick: (e) => {
5026
+ void downloadFile(e, c);
5027
+ },
5028
+ 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",
5029
+ children: [
5030
+ /* @__PURE__ */ jsx(
5031
+ "svg",
5032
+ {
5033
+ className: "w-4 h-4",
5034
+ fill: "none",
5035
+ viewBox: "0 0 24 24",
5036
+ stroke: "currentColor",
5037
+ "aria-hidden": "true",
5038
+ children: /* @__PURE__ */ jsx(
5039
+ "path",
5040
+ {
5041
+ strokeLinecap: "round",
5042
+ strokeLinejoin: "round",
5043
+ strokeWidth: 2,
5044
+ d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
5045
+ }
5046
+ )
5047
+ }
5048
+ ),
5049
+ "Download"
5050
+ ]
5051
+ }
5052
+ )
5053
+ ]
5054
+ },
5055
+ c.id
5056
+ );
5057
+ }) }) })
5058
+ ] });
5059
+ }
4893
5060
 
4894
- export { BlogListPage, BlogPostPage, Button, CareersApplyForm, ContactPage, ContentRenderer, DEFAULT_CONTACT_CATEGORIES, Input, Label, NewsletterForm, NewsletterPage, PageHead, PartnersPage, PressKitPage, PricingPage, PricingSection, ProductProvider, ResourceLinks, RybbitAnalytics, Select, SocialLinks, Textarea, UnsubscribePage, WaitlistForm, WaitlistPage, WebSDKClient, WebSDKProvider, buttonVariants, cn, useContentPage, useContentPages, useProduct, useProductConfig, useWebSDK, useWebSDKConfig };
5061
+ export { BlogListPage, BlogPostPage, Button, CareersApplyForm, ContactPage, ContentRenderer, ContractsPage, DEFAULT_CONTACT_CATEGORIES, Input, Label, NewsletterForm, NewsletterPage, PageHead, PartnersPage, PressKitPage, PricingPage, PricingSection, ProductProvider, ResourceLinks, RybbitAnalytics, Select, SocialLinks, Textarea, UnsubscribePage, WaitlistForm, WaitlistPage, WebSDKClient, WebSDKProvider, buttonVariants, cn, useContentPage, useContentPages, useProduct, useProductConfig, useWebSDK, useWebSDKConfig };
4895
5062
  //# sourceMappingURL=index.mjs.map
4896
5063
  //# sourceMappingURL=index.mjs.map