@burdenoff/website-sdk 2026.521.2 → 2026.521.4

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
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { createContext, useMemo, useContext, useState, useCallback, useLayoutEffect, useRef, useEffect } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { Instagram, Youtube, Facebook, Github, Linkedin, Twitter, Mail, Phone, MapPin, Clock, Send } from 'lucide-react';
4
+ import { Instagram, Youtube, Facebook, Github, Linkedin, Twitter, Mail, Phone, MapPin, Clock, Send, FileText, Download } from 'lucide-react';
5
5
  import ReCAPTCHA2 from 'react-google-recaptcha';
6
6
  import { toast } from 'sonner';
7
7
  import { Helmet } from 'react-helmet-async';
@@ -953,6 +953,508 @@ function ContactPage({
953
953
  ] }) })
954
954
  ] });
955
955
  }
956
+ var PUBLIC_CONTENT_PAGE_QUERY = `
957
+ query PublicContentPage($slug: String!, $productId: String) {
958
+ publicContentPage(slug: $slug, productId: $productId) {
959
+ id
960
+ title
961
+ slug
962
+ content
963
+ contentFormat
964
+ seoTitle
965
+ seoDescription
966
+ seoKeywords
967
+ lastUpdated
968
+ version
969
+ excerpt
970
+ thumbnail
971
+ author
972
+ publishedAt
973
+ readingTime
974
+ featured
975
+ category
976
+ }
977
+ }
978
+ `;
979
+ var PUBLIC_RESOLVED_CONTENT_PAGE_QUERY = `
980
+ query PublicResolvedContentPage($slug: String!, $productId: String!) {
981
+ publicResolvedContentPage(slug: $slug, productId: $productId) {
982
+ id
983
+ title
984
+ slug
985
+ content
986
+ contentFormat
987
+ seoTitle
988
+ seoDescription
989
+ seoKeywords
990
+ lastUpdated
991
+ version
992
+ excerpt
993
+ thumbnail
994
+ author
995
+ publishedAt
996
+ readingTime
997
+ featured
998
+ category
999
+ }
1000
+ }
1001
+ `;
1002
+ var PUBLIC_CONTENT_PAGES_QUERY = `
1003
+ query PublicContentPages($productId: String!, $limit: Int, $offset: Int) {
1004
+ publicContentPages(productId: $productId, limit: $limit, offset: $offset) {
1005
+ items {
1006
+ id
1007
+ title
1008
+ slug
1009
+ lastUpdated
1010
+ tags
1011
+ seoDescription
1012
+ excerpt
1013
+ thumbnail
1014
+ author
1015
+ publishedAt
1016
+ readingTime
1017
+ featured
1018
+ category
1019
+ }
1020
+ total
1021
+ hasMore
1022
+ }
1023
+ }
1024
+ `;
1025
+ function useContentPage(slug, options) {
1026
+ const client = useWebSDK();
1027
+ const config = useWebSDKConfig();
1028
+ const { product } = useProduct();
1029
+ const resolvedProductId = product?.id || config.productId;
1030
+ const [data, setData] = useState(null);
1031
+ const [loading, setLoading] = useState(true);
1032
+ const [error, setError] = useState(null);
1033
+ const fetchPage = useCallback(async () => {
1034
+ if (!resolvedProductId) return;
1035
+ setLoading(true);
1036
+ setError(null);
1037
+ try {
1038
+ const query = options?.resolve ? PUBLIC_RESOLVED_CONTENT_PAGE_QUERY : PUBLIC_CONTENT_PAGE_QUERY;
1039
+ const queryName = options?.resolve ? "publicResolvedContentPage" : "publicContentPage";
1040
+ const result = await client.query(
1041
+ query,
1042
+ {
1043
+ slug,
1044
+ productId: resolvedProductId
1045
+ }
1046
+ );
1047
+ if (result.errors?.length) {
1048
+ setError(result.errors[0]?.message ?? "Unknown error");
1049
+ setData(null);
1050
+ } else {
1051
+ setData(result.data?.[queryName] ?? null);
1052
+ }
1053
+ } catch (err) {
1054
+ setError(err instanceof Error ? err.message : "Failed to fetch content");
1055
+ setData(null);
1056
+ } finally {
1057
+ setLoading(false);
1058
+ }
1059
+ }, [client, resolvedProductId, slug, options?.resolve]);
1060
+ useEffect(() => {
1061
+ fetchPage();
1062
+ }, [fetchPage]);
1063
+ return { data, loading, error, refetch: fetchPage };
1064
+ }
1065
+ function useContentPages(options) {
1066
+ const client = useWebSDK();
1067
+ const config = useWebSDKConfig();
1068
+ const [data, setData] = useState(null);
1069
+ const [loading, setLoading] = useState(true);
1070
+ const [error, setError] = useState(null);
1071
+ const fetchPages = useCallback(async () => {
1072
+ setLoading(true);
1073
+ setError(null);
1074
+ try {
1075
+ const result = await client.query(PUBLIC_CONTENT_PAGES_QUERY, {
1076
+ productId: config.productId,
1077
+ limit: options?.limit ?? 50,
1078
+ offset: options?.offset ?? 0
1079
+ });
1080
+ if (result.errors?.length) {
1081
+ setError(result.errors[0]?.message ?? "Unknown error");
1082
+ setData(null);
1083
+ } else {
1084
+ setData(result.data?.publicContentPages ?? null);
1085
+ }
1086
+ } catch (err) {
1087
+ setError(
1088
+ err instanceof Error ? err.message : "Failed to fetch content pages"
1089
+ );
1090
+ setData(null);
1091
+ } finally {
1092
+ setLoading(false);
1093
+ }
1094
+ }, [client, config.productId, options?.limit, options?.offset]);
1095
+ useEffect(() => {
1096
+ fetchPages();
1097
+ }, [fetchPages]);
1098
+ return { data, loading, error, refetch: fetchPages };
1099
+ }
1100
+ function renderMarkdown(md) {
1101
+ let html = md;
1102
+ html = html.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1103
+ html = html.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, _lang, code) => {
1104
+ return `<pre><code>${code.trim()}</code></pre>`;
1105
+ });
1106
+ html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
1107
+ html = html.replace(/^###### (.+)$/gm, "<h6>$1</h6>");
1108
+ html = html.replace(/^##### (.+)$/gm, "<h5>$1</h5>");
1109
+ html = html.replace(/^#### (.+)$/gm, "<h4>$1</h4>");
1110
+ html = html.replace(/^### (.+)$/gm, "<h3>$1</h3>");
1111
+ html = html.replace(/^## (.+)$/gm, "<h2>$1</h2>");
1112
+ html = html.replace(/^# (.+)$/gm, "<h1>$1</h1>");
1113
+ html = html.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>");
1114
+ html = html.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
1115
+ html = html.replace(/\*(.+?)\*/g, "<em>$1</em>");
1116
+ html = html.replace(
1117
+ /\[([^\]]+)\]\(([^)]+)\)/g,
1118
+ '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
1119
+ );
1120
+ html = html.replace(/^&gt; (.+)$/gm, "<blockquote>$1</blockquote>");
1121
+ html = html.replace(/(^- .+$(\n^- .+$)*)/gm, (block) => {
1122
+ const items = block.split("\n").map((line) => `<li>${line.replace(/^- /, "")}</li>`).join("");
1123
+ return `<ul>${items}</ul>`;
1124
+ });
1125
+ html = html.replace(/(^\d+\. .+$(\n^\d+\. .+$)*)/gm, (block) => {
1126
+ const items = block.split("\n").map((line) => `<li>${line.replace(/^\d+\. /, "")}</li>`).join("");
1127
+ return `<ol>${items}</ol>`;
1128
+ });
1129
+ html = html.replace(/^---$/gm, "<hr />");
1130
+ html = html.split(/\n\n+/).map((block) => {
1131
+ const trimmed = block.trim();
1132
+ if (!trimmed) return "";
1133
+ if (/^<(h[1-6]|ul|ol|pre|blockquote|hr)/.test(trimmed)) return trimmed;
1134
+ return `<p>${trimmed.replace(/\n/g, "<br />")}</p>`;
1135
+ }).join("\n");
1136
+ return html;
1137
+ }
1138
+ function ContentRenderer({
1139
+ content,
1140
+ format = "markdown",
1141
+ className
1142
+ }) {
1143
+ if (format === "markdown") {
1144
+ return /* @__PURE__ */ jsx(
1145
+ "div",
1146
+ {
1147
+ className,
1148
+ dangerouslySetInnerHTML: { __html: renderMarkdown(content) }
1149
+ }
1150
+ );
1151
+ }
1152
+ if (format === "html") {
1153
+ return /* @__PURE__ */ jsx(
1154
+ "div",
1155
+ {
1156
+ className,
1157
+ dangerouslySetInnerHTML: { __html: content }
1158
+ }
1159
+ );
1160
+ }
1161
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("pre", { style: { whiteSpace: "pre-wrap", fontFamily: "inherit" }, children: content }) });
1162
+ }
1163
+ var PARTNER_CONTENT_QUERY = `
1164
+ query PartnerContent($productId: String!, $limit: Int) {
1165
+ publicContentPages(productId: $productId, limit: $limit, offset: 0) {
1166
+ items {
1167
+ id
1168
+ title
1169
+ slug
1170
+ excerpt
1171
+ content
1172
+ contentFormat
1173
+ thumbnail
1174
+ tags
1175
+ publishedAt
1176
+ lastUpdated
1177
+ }
1178
+ }
1179
+ }
1180
+ `;
1181
+ var PARTNER_DOCUMENTS_QUERY = `
1182
+ query PartnerDocuments($productId: String!, $limit: Int) {
1183
+ publicPressKitAssets(productId: $productId, limit: $limit, offset: 0) {
1184
+ items {
1185
+ id
1186
+ category
1187
+ title
1188
+ description
1189
+ fileUrl
1190
+ fileName
1191
+ fileSize
1192
+ mimeType
1193
+ version
1194
+ tags
1195
+ sortOrder
1196
+ updatedAt
1197
+ }
1198
+ }
1199
+ }
1200
+ `;
1201
+ function formatFileSize(bytes) {
1202
+ if (!bytes || bytes <= 0) return "";
1203
+ const units = ["B", "KB", "MB", "GB"];
1204
+ let i = 0;
1205
+ let n = bytes;
1206
+ while (n >= 1024 && i < units.length - 1) {
1207
+ n /= 1024;
1208
+ i++;
1209
+ }
1210
+ return `${n.toFixed(n >= 10 || i === 0 ? 0 : 1)} ${units[i]}`;
1211
+ }
1212
+ async function downloadDocument(e, doc) {
1213
+ e.preventDefault();
1214
+ const name = doc.fileName || doc.fileUrl.split("/").pop()?.split("?")[0] || doc.title || "partner-document";
1215
+ const openInTab = () => window.open(doc.fileUrl, "_blank", "noopener,noreferrer");
1216
+ try {
1217
+ const res = await fetch(doc.fileUrl, { mode: "cors" });
1218
+ if (!res.ok) {
1219
+ openInTab();
1220
+ return;
1221
+ }
1222
+ const blob = await res.blob();
1223
+ const objUrl = URL.createObjectURL(blob);
1224
+ const a = document.createElement("a");
1225
+ a.href = objUrl;
1226
+ a.download = name;
1227
+ document.body.appendChild(a);
1228
+ a.click();
1229
+ a.remove();
1230
+ URL.revokeObjectURL(objUrl);
1231
+ } catch {
1232
+ openInTab();
1233
+ }
1234
+ }
1235
+ function PartnerHero({
1236
+ title,
1237
+ subtitle
1238
+ }) {
1239
+ return /* @__PURE__ */ jsx("section", { className: "bg-gradient-to-b from-background to-muted/20 py-16 md:py-24", children: /* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4 max-w-4xl text-center", children: [
1240
+ /* @__PURE__ */ jsx("h1", { className: "text-4xl md:text-5xl font-bold tracking-tight text-foreground mb-4", children: title }),
1241
+ subtitle && /* @__PURE__ */ jsx("p", { className: "text-lg md:text-xl text-muted-foreground max-w-2xl mx-auto", children: subtitle })
1242
+ ] }) });
1243
+ }
1244
+ function PartnerContentSection({
1245
+ page
1246
+ }) {
1247
+ return /* @__PURE__ */ jsx("section", { className: "py-12 md:py-16", children: /* @__PURE__ */ jsx(
1248
+ "div",
1249
+ {
1250
+ className: [
1251
+ "mx-auto max-w-3xl px-4",
1252
+ // Headings
1253
+ "[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:tracking-tight [&_h1]:mt-0 [&_h1]:mb-6",
1254
+ "[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:tracking-tight [&_h2]:mt-10 [&_h2]:mb-4",
1255
+ "[&_h3]:text-xl [&_h3]:font-semibold [&_h3]:mt-7 [&_h3]:mb-3",
1256
+ "[&_h4]:text-lg [&_h4]:font-semibold [&_h4]:mt-6 [&_h4]:mb-2",
1257
+ // Block elements
1258
+ "[&_p]:my-4 [&_p]:leading-relaxed [&_p]:text-base",
1259
+ "[&_ul]:my-4 [&_ul]:pl-6 [&_ul]:list-disc [&_ul]:space-y-1",
1260
+ "[&_ol]:my-4 [&_ol]:pl-6 [&_ol]:list-decimal [&_ol]:space-y-1",
1261
+ "[&_li]:leading-relaxed",
1262
+ "[&_li>p]:my-1",
1263
+ "[&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:my-4 [&_blockquote]:text-muted-foreground",
1264
+ "[&_hr]:my-8 [&_hr]:border-border",
1265
+ // Inline elements
1266
+ "[&_strong]:font-semibold [&_strong]:text-foreground",
1267
+ "[&_em]:italic",
1268
+ "[&_a]:underline [&_a]:underline-offset-2 [&_a]:text-accent hover:[&_a]:text-accent/80 [&_a]:transition-colors",
1269
+ "[&_code]:rounded [&_code]:bg-muted [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-sm [&_code]:font-mono",
1270
+ "[&_pre]:my-4 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-4 [&_pre]:text-sm",
1271
+ "[&_pre>code]:bg-transparent [&_pre>code]:p-0"
1272
+ ].join(" "),
1273
+ children: page.content && /* @__PURE__ */ jsx(
1274
+ ContentRenderer,
1275
+ {
1276
+ content: page.content,
1277
+ format: (
1278
+ // Validate before passing; unknown formats fall through to
1279
+ // ContentRenderer's default behavior (markdown rendering)
1280
+ // rather than getting silently force-cast to an
1281
+ // unsupported variant.
1282
+ page.contentFormat === "markdown" || page.contentFormat === "html" ? page.contentFormat : void 0
1283
+ )
1284
+ }
1285
+ )
1286
+ }
1287
+ ) });
1288
+ }
1289
+ function PartnerDocumentCard({ doc }) {
1290
+ const sizeLabel = formatFileSize(doc.fileSize);
1291
+ const ext = doc.fileName?.split(".").pop()?.toUpperCase();
1292
+ return /* @__PURE__ */ jsxs("article", { className: "flex flex-col gap-3 rounded-xl border border-border bg-card p-5 shadow-sm hover:shadow-md transition-shadow", children: [
1293
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
1294
+ /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted p-2.5 shrink-0", children: /* @__PURE__ */ jsx(FileText, { size: 20, className: "text-muted-foreground" }) }),
1295
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1296
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-foreground truncate", children: doc.title }),
1297
+ doc.version && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground mt-0.5", children: [
1298
+ "Version ",
1299
+ doc.version
1300
+ ] })
1301
+ ] })
1302
+ ] }),
1303
+ doc.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground line-clamp-3", children: doc.description }),
1304
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mt-auto pt-2 border-t border-border/60", children: [
1305
+ /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground flex items-center gap-2", children: [
1306
+ ext && /* @__PURE__ */ jsx("span", { children: ext }),
1307
+ sizeLabel && /* @__PURE__ */ jsxs(Fragment, { children: [
1308
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }),
1309
+ /* @__PURE__ */ jsx("span", { children: sizeLabel })
1310
+ ] })
1311
+ ] }),
1312
+ /* @__PURE__ */ jsxs(
1313
+ "a",
1314
+ {
1315
+ href: doc.fileUrl,
1316
+ download: doc.fileName ?? void 0,
1317
+ onClick: (e) => void downloadDocument(e, doc),
1318
+ className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-sm font-medium text-foreground hover:bg-muted transition-colors",
1319
+ children: [
1320
+ /* @__PURE__ */ jsx(Download, { size: 14 }),
1321
+ "Download"
1322
+ ]
1323
+ }
1324
+ )
1325
+ ] })
1326
+ ] });
1327
+ }
1328
+ function PartnerDocumentsSection({
1329
+ title,
1330
+ subtitle,
1331
+ docs
1332
+ }) {
1333
+ return /* @__PURE__ */ jsx("section", { className: "py-12 md:py-16 bg-muted/20", children: /* @__PURE__ */ jsxs("div", { className: "container mx-auto px-4 max-w-5xl", children: [
1334
+ /* @__PURE__ */ jsxs("header", { className: "mb-8 md:mb-10 text-center", children: [
1335
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-bold text-foreground mb-2", children: title }),
1336
+ subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground max-w-2xl mx-auto", children: subtitle })
1337
+ ] }),
1338
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: docs.map((doc) => /* @__PURE__ */ jsx(PartnerDocumentCard, { doc }, doc.id)) })
1339
+ ] }) });
1340
+ }
1341
+ var DEFAULT_PARTNER_CATEGORY = {
1342
+ value: "partnership",
1343
+ label: "Partner program"
1344
+ };
1345
+ function PartnersPage(props) {
1346
+ const {
1347
+ productName: productNameProp,
1348
+ heroTitle = "Partner with us",
1349
+ heroSubtitle,
1350
+ contentTag = "partner",
1351
+ contentSlug,
1352
+ documentsTag = "partner",
1353
+ documentsTitle = "Partner Documents",
1354
+ documentsSubtitle,
1355
+ showContactForm = true,
1356
+ contactCategory,
1357
+ formTitle = "Become a partner",
1358
+ formSubtitle,
1359
+ contactEmail,
1360
+ contactPhone,
1361
+ officeAddress,
1362
+ responseTime,
1363
+ recaptchaSiteKey,
1364
+ additionalOptions,
1365
+ seoTitle,
1366
+ seoDescription,
1367
+ seoKeywords,
1368
+ className
1369
+ } = props;
1370
+ const client = useWebSDK();
1371
+ const config = useWebSDKConfig();
1372
+ const { product } = useProduct();
1373
+ const resolvedProductId = product?.id ?? config?.productId ?? productNameProp ?? "";
1374
+ const resolvedProductName = productNameProp ?? product?.name ?? config?.productId ?? "our team";
1375
+ const [contentPage, setContentPage] = useState(null);
1376
+ const [docs, setDocs] = useState([]);
1377
+ const [loading, setLoading] = useState(true);
1378
+ useEffect(() => {
1379
+ if (!client || !resolvedProductId) {
1380
+ setContentPage(null);
1381
+ setDocs([]);
1382
+ setLoading(false);
1383
+ return;
1384
+ }
1385
+ let cancelled = false;
1386
+ setLoading(true);
1387
+ void Promise.allSettled([
1388
+ client.query(PARTNER_CONTENT_QUERY, { productId: resolvedProductId, limit: 50 }),
1389
+ client.query(
1390
+ PARTNER_DOCUMENTS_QUERY,
1391
+ { productId: resolvedProductId, limit: 50 }
1392
+ )
1393
+ ]).then(([contentResult, docsResult]) => {
1394
+ if (cancelled) return;
1395
+ if (contentResult.status === "rejected") {
1396
+ setContentPage(null);
1397
+ } else if (contentResult.status === "fulfilled") {
1398
+ const items = contentResult.value.data?.publicContentPages?.items ?? [];
1399
+ const match = contentSlug ? items.find((p) => p.slug === contentSlug) : items.find((p) => p.tags?.includes(contentTag));
1400
+ setContentPage(match ?? null);
1401
+ }
1402
+ if (docsResult.status === "rejected") {
1403
+ setDocs([]);
1404
+ } else if (docsResult.status === "fulfilled") {
1405
+ const items = docsResult.value.data?.publicPressKitAssets?.items ?? [];
1406
+ const filtered = items.filter(
1407
+ (d) => d.category === "DOCUMENT" && d.tags?.includes(documentsTag) && !!d.fileUrl
1408
+ ).sort(
1409
+ (a, b) => a.sortOrder - b.sortOrder
1410
+ );
1411
+ setDocs(filtered);
1412
+ }
1413
+ setLoading(false);
1414
+ });
1415
+ return () => {
1416
+ cancelled = true;
1417
+ };
1418
+ }, [client, resolvedProductId, contentSlug, contentTag, documentsTag]);
1419
+ const lockedCategory = contactCategory === false ? null : contactCategory ?? DEFAULT_PARTNER_CATEGORY;
1420
+ return /* @__PURE__ */ jsxs("div", { className, children: [
1421
+ /* @__PURE__ */ jsx(
1422
+ PageHead,
1423
+ {
1424
+ title: seoTitle ?? `${heroTitle} \u2014 ${resolvedProductName}`,
1425
+ description: seoDescription ?? heroSubtitle ?? `Join the ${resolvedProductName} partner programme.`,
1426
+ keywords: seoKeywords
1427
+ }
1428
+ ),
1429
+ /* @__PURE__ */ jsx(PartnerHero, { title: heroTitle, subtitle: heroSubtitle }),
1430
+ !loading && contentPage && /* @__PURE__ */ jsx(PartnerContentSection, { page: contentPage }),
1431
+ !loading && docs.length > 0 && /* @__PURE__ */ jsx(
1432
+ PartnerDocumentsSection,
1433
+ {
1434
+ title: documentsTitle,
1435
+ subtitle: documentsSubtitle,
1436
+ docs
1437
+ }
1438
+ ),
1439
+ showContactForm && /* @__PURE__ */ jsx(
1440
+ ContactPage,
1441
+ {
1442
+ productName: resolvedProductName,
1443
+ heroTitle: formTitle,
1444
+ heroDescription: formSubtitle ?? `Tell us about your organisation and a partner manager from ${resolvedProductName} will be in touch.`,
1445
+ contactEmail,
1446
+ contactPhone,
1447
+ officeAddress,
1448
+ responseTime,
1449
+ recaptchaSiteKey,
1450
+ additionalOptions,
1451
+ categories: lockedCategory ? [lockedCategory] : [],
1452
+ categoryLabel: "Partnership type",
1453
+ categoryRequired: !!lockedCategory
1454
+ }
1455
+ )
1456
+ ] });
1457
+ }
956
1458
  var newsletterSchema = z.object({
957
1459
  email: z.string().email("Please enter a valid email address")
958
1460
  });
@@ -2911,213 +3413,6 @@ function RybbitAnalytics({
2911
3413
  }, [siteId, scriptUrl, enabled]);
2912
3414
  return null;
2913
3415
  }
2914
- var PUBLIC_CONTENT_PAGE_QUERY = `
2915
- query PublicContentPage($slug: String!, $productId: String) {
2916
- publicContentPage(slug: $slug, productId: $productId) {
2917
- id
2918
- title
2919
- slug
2920
- content
2921
- contentFormat
2922
- seoTitle
2923
- seoDescription
2924
- seoKeywords
2925
- lastUpdated
2926
- version
2927
- excerpt
2928
- thumbnail
2929
- author
2930
- publishedAt
2931
- readingTime
2932
- featured
2933
- category
2934
- }
2935
- }
2936
- `;
2937
- var PUBLIC_RESOLVED_CONTENT_PAGE_QUERY = `
2938
- query PublicResolvedContentPage($slug: String!, $productId: String!) {
2939
- publicResolvedContentPage(slug: $slug, productId: $productId) {
2940
- id
2941
- title
2942
- slug
2943
- content
2944
- contentFormat
2945
- seoTitle
2946
- seoDescription
2947
- seoKeywords
2948
- lastUpdated
2949
- version
2950
- excerpt
2951
- thumbnail
2952
- author
2953
- publishedAt
2954
- readingTime
2955
- featured
2956
- category
2957
- }
2958
- }
2959
- `;
2960
- var PUBLIC_CONTENT_PAGES_QUERY = `
2961
- query PublicContentPages($productId: String!, $limit: Int, $offset: Int) {
2962
- publicContentPages(productId: $productId, limit: $limit, offset: $offset) {
2963
- items {
2964
- id
2965
- title
2966
- slug
2967
- lastUpdated
2968
- tags
2969
- seoDescription
2970
- excerpt
2971
- thumbnail
2972
- author
2973
- publishedAt
2974
- readingTime
2975
- featured
2976
- category
2977
- }
2978
- total
2979
- hasMore
2980
- }
2981
- }
2982
- `;
2983
- function useContentPage(slug, options) {
2984
- const client = useWebSDK();
2985
- const config = useWebSDKConfig();
2986
- const { product } = useProduct();
2987
- const resolvedProductId = product?.id || config.productId;
2988
- const [data, setData] = useState(null);
2989
- const [loading, setLoading] = useState(true);
2990
- const [error, setError] = useState(null);
2991
- const fetchPage = useCallback(async () => {
2992
- if (!resolvedProductId) return;
2993
- setLoading(true);
2994
- setError(null);
2995
- try {
2996
- const query = options?.resolve ? PUBLIC_RESOLVED_CONTENT_PAGE_QUERY : PUBLIC_CONTENT_PAGE_QUERY;
2997
- const queryName = options?.resolve ? "publicResolvedContentPage" : "publicContentPage";
2998
- const result = await client.query(
2999
- query,
3000
- {
3001
- slug,
3002
- productId: resolvedProductId
3003
- }
3004
- );
3005
- if (result.errors?.length) {
3006
- setError(result.errors[0]?.message ?? "Unknown error");
3007
- setData(null);
3008
- } else {
3009
- setData(result.data?.[queryName] ?? null);
3010
- }
3011
- } catch (err) {
3012
- setError(err instanceof Error ? err.message : "Failed to fetch content");
3013
- setData(null);
3014
- } finally {
3015
- setLoading(false);
3016
- }
3017
- }, [client, resolvedProductId, slug, options?.resolve]);
3018
- useEffect(() => {
3019
- fetchPage();
3020
- }, [fetchPage]);
3021
- return { data, loading, error, refetch: fetchPage };
3022
- }
3023
- function useContentPages(options) {
3024
- const client = useWebSDK();
3025
- const config = useWebSDKConfig();
3026
- const [data, setData] = useState(null);
3027
- const [loading, setLoading] = useState(true);
3028
- const [error, setError] = useState(null);
3029
- const fetchPages = useCallback(async () => {
3030
- setLoading(true);
3031
- setError(null);
3032
- try {
3033
- const result = await client.query(PUBLIC_CONTENT_PAGES_QUERY, {
3034
- productId: config.productId,
3035
- limit: options?.limit ?? 50,
3036
- offset: options?.offset ?? 0
3037
- });
3038
- if (result.errors?.length) {
3039
- setError(result.errors[0]?.message ?? "Unknown error");
3040
- setData(null);
3041
- } else {
3042
- setData(result.data?.publicContentPages ?? null);
3043
- }
3044
- } catch (err) {
3045
- setError(
3046
- err instanceof Error ? err.message : "Failed to fetch content pages"
3047
- );
3048
- setData(null);
3049
- } finally {
3050
- setLoading(false);
3051
- }
3052
- }, [client, config.productId, options?.limit, options?.offset]);
3053
- useEffect(() => {
3054
- fetchPages();
3055
- }, [fetchPages]);
3056
- return { data, loading, error, refetch: fetchPages };
3057
- }
3058
- function renderMarkdown(md) {
3059
- let html = md;
3060
- html = html.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3061
- html = html.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, _lang, code) => {
3062
- return `<pre><code>${code.trim()}</code></pre>`;
3063
- });
3064
- html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
3065
- html = html.replace(/^###### (.+)$/gm, "<h6>$1</h6>");
3066
- html = html.replace(/^##### (.+)$/gm, "<h5>$1</h5>");
3067
- html = html.replace(/^#### (.+)$/gm, "<h4>$1</h4>");
3068
- html = html.replace(/^### (.+)$/gm, "<h3>$1</h3>");
3069
- html = html.replace(/^## (.+)$/gm, "<h2>$1</h2>");
3070
- html = html.replace(/^# (.+)$/gm, "<h1>$1</h1>");
3071
- html = html.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>");
3072
- html = html.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
3073
- html = html.replace(/\*(.+?)\*/g, "<em>$1</em>");
3074
- html = html.replace(
3075
- /\[([^\]]+)\]\(([^)]+)\)/g,
3076
- '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
3077
- );
3078
- html = html.replace(/^&gt; (.+)$/gm, "<blockquote>$1</blockquote>");
3079
- html = html.replace(/(^- .+$(\n^- .+$)*)/gm, (block) => {
3080
- const items = block.split("\n").map((line) => `<li>${line.replace(/^- /, "")}</li>`).join("");
3081
- return `<ul>${items}</ul>`;
3082
- });
3083
- html = html.replace(/(^\d+\. .+$(\n^\d+\. .+$)*)/gm, (block) => {
3084
- const items = block.split("\n").map((line) => `<li>${line.replace(/^\d+\. /, "")}</li>`).join("");
3085
- return `<ol>${items}</ol>`;
3086
- });
3087
- html = html.replace(/^---$/gm, "<hr />");
3088
- html = html.split(/\n\n+/).map((block) => {
3089
- const trimmed = block.trim();
3090
- if (!trimmed) return "";
3091
- if (/^<(h[1-6]|ul|ol|pre|blockquote|hr)/.test(trimmed)) return trimmed;
3092
- return `<p>${trimmed.replace(/\n/g, "<br />")}</p>`;
3093
- }).join("\n");
3094
- return html;
3095
- }
3096
- function ContentRenderer({
3097
- content,
3098
- format = "markdown",
3099
- className
3100
- }) {
3101
- if (format === "markdown") {
3102
- return /* @__PURE__ */ jsx(
3103
- "div",
3104
- {
3105
- className,
3106
- dangerouslySetInnerHTML: { __html: renderMarkdown(content) }
3107
- }
3108
- );
3109
- }
3110
- if (format === "html") {
3111
- return /* @__PURE__ */ jsx(
3112
- "div",
3113
- {
3114
- className,
3115
- dangerouslySetInnerHTML: { __html: content }
3116
- }
3117
- );
3118
- }
3119
- return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("pre", { style: { whiteSpace: "pre-wrap", fontFamily: "inherit" }, children: content }) });
3120
- }
3121
3416
  var BLOG_POSTS_QUERY = `
3122
3417
  query BlogPosts($productId: String!, $limit: Int, $offset: Int) {
3123
3418
  publicContentPages(productId: $productId, limit: $limit, offset: $offset) {
@@ -4099,6 +4394,6 @@ function PressKitPage(props) {
4099
4394
  ] });
4100
4395
  }
4101
4396
 
4102
- export { BlogListPage, BlogPostPage, Button, ContactPage, ContentRenderer, DEFAULT_CONTACT_CATEGORIES, Input, Label, NewsletterForm, NewsletterPage, PageHead, PressKitPage, PricingPage, PricingSection, ProductProvider, RybbitAnalytics, Select, SocialLinks, Textarea, UnsubscribePage, WaitlistForm, WaitlistPage, WebSDKClient, WebSDKProvider, buttonVariants, cn, useContentPage, useContentPages, useProduct, useProductConfig, useWebSDK, useWebSDKConfig };
4397
+ export { BlogListPage, BlogPostPage, Button, ContactPage, ContentRenderer, DEFAULT_CONTACT_CATEGORIES, Input, Label, NewsletterForm, NewsletterPage, PageHead, PartnersPage, PressKitPage, PricingPage, PricingSection, ProductProvider, RybbitAnalytics, Select, SocialLinks, Textarea, UnsubscribePage, WaitlistForm, WaitlistPage, WebSDKClient, WebSDKProvider, buttonVariants, cn, useContentPage, useContentPages, useProduct, useProductConfig, useWebSDK, useWebSDKConfig };
4103
4398
  //# sourceMappingURL=index.mjs.map
4104
4399
  //# sourceMappingURL=index.mjs.map