@burdenoff/website-sdk 2026.720.6 → 2026.720.7

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
@@ -10,6 +10,10 @@ import { cva } from 'class-variance-authority';
10
10
  import { clsx } from 'clsx';
11
11
  import { twMerge } from 'tailwind-merge';
12
12
  import * as LabelPrimitive from '@radix-ui/react-label';
13
+ import DOMPurify from 'isomorphic-dompurify';
14
+ import ReactMarkdown from 'react-markdown';
15
+ import rehypeSanitize from 'rehype-sanitize';
16
+ import remarkGfm from 'remark-gfm';
13
17
  import { zodResolver } from '@hookform/resolvers/zod';
14
18
  import { useForm } from 'react-hook-form';
15
19
  import { z } from 'zod';
@@ -1030,6 +1034,41 @@ function ContactPage({
1030
1034
  ] }) })
1031
1035
  ] });
1032
1036
  }
1037
+ var defaultComponents = {
1038
+ a: ({ href, children, ...props }) => {
1039
+ const isExternal = typeof href === "string" && (href.startsWith("http://") || href.startsWith("https://"));
1040
+ return /* @__PURE__ */ jsx(
1041
+ "a",
1042
+ {
1043
+ href,
1044
+ ...props,
1045
+ ...isExternal ? { target: "_blank", rel: "noopener noreferrer" } : { rel: "noopener noreferrer" },
1046
+ children
1047
+ }
1048
+ );
1049
+ }
1050
+ };
1051
+ function Markdown({
1052
+ children,
1053
+ className,
1054
+ inline,
1055
+ components
1056
+ }) {
1057
+ const content = /* @__PURE__ */ jsx(
1058
+ ReactMarkdown,
1059
+ {
1060
+ remarkPlugins: [remarkGfm],
1061
+ rehypePlugins: [rehypeSanitize],
1062
+ components: { ...defaultComponents, ...components },
1063
+ ...inline ? { disallowedElements: ["p"], unwrapDisallowed: true } : {},
1064
+ children
1065
+ }
1066
+ );
1067
+ if (inline) {
1068
+ return /* @__PURE__ */ jsx("span", { className, children: content });
1069
+ }
1070
+ return /* @__PURE__ */ jsx("div", { className, children: content });
1071
+ }
1033
1072
  var PUBLIC_CONTENT_PAGE_QUERY = `
1034
1073
  query PublicContentPage($slug: String!, $productId: String) {
1035
1074
  publicContentPage(slug: $slug, productId: $productId) {
@@ -1174,64 +1213,21 @@ function useContentPages(options) {
1174
1213
  }, [fetchPages]);
1175
1214
  return { data, loading, error, refetch: fetchPages };
1176
1215
  }
1177
- function renderMarkdown(md) {
1178
- let html = md;
1179
- html = html.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1180
- html = html.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, _lang, code) => {
1181
- return `<pre><code>${code.trim()}</code></pre>`;
1182
- });
1183
- html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
1184
- html = html.replace(/^###### (.+)$/gm, "<h6>$1</h6>");
1185
- html = html.replace(/^##### (.+)$/gm, "<h5>$1</h5>");
1186
- html = html.replace(/^#### (.+)$/gm, "<h4>$1</h4>");
1187
- html = html.replace(/^### (.+)$/gm, "<h3>$1</h3>");
1188
- html = html.replace(/^## (.+)$/gm, "<h2>$1</h2>");
1189
- html = html.replace(/^# (.+)$/gm, "<h1>$1</h1>");
1190
- html = html.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>");
1191
- html = html.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
1192
- html = html.replace(/\*(.+?)\*/g, "<em>$1</em>");
1193
- html = html.replace(
1194
- /\[([^\]]+)\]\(([^)]+)\)/g,
1195
- '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
1196
- );
1197
- html = html.replace(/^&gt; (.+)$/gm, "<blockquote>$1</blockquote>");
1198
- html = html.replace(/(^- .+$(\n^- .+$)*)/gm, (block) => {
1199
- const items = block.split("\n").map((line) => `<li>${line.replace(/^- /, "")}</li>`).join("");
1200
- return `<ul>${items}</ul>`;
1201
- });
1202
- html = html.replace(/(^\d+\. .+$(\n^\d+\. .+$)*)/gm, (block) => {
1203
- const items = block.split("\n").map((line) => `<li>${line.replace(/^\d+\. /, "")}</li>`).join("");
1204
- return `<ol>${items}</ol>`;
1205
- });
1206
- html = html.replace(/^---$/gm, "<hr />");
1207
- html = html.split(/\n\n+/).map((block) => {
1208
- const trimmed = block.trim();
1209
- if (!trimmed) return "";
1210
- if (/^<(h[1-6]|ul|ol|pre|blockquote|hr)/.test(trimmed)) return trimmed;
1211
- return `<p>${trimmed.replace(/\n/g, "<br />")}</p>`;
1212
- }).join("\n");
1213
- return html;
1214
- }
1215
1216
  function ContentRenderer({
1216
1217
  content,
1217
1218
  format = "markdown",
1218
1219
  className
1219
1220
  }) {
1220
1221
  if (format === "markdown") {
1221
- return /* @__PURE__ */ jsx(
1222
- "div",
1223
- {
1224
- className,
1225
- dangerouslySetInnerHTML: { __html: renderMarkdown(content) }
1226
- }
1227
- );
1222
+ return /* @__PURE__ */ jsx(Markdown, { className, children: content });
1228
1223
  }
1229
1224
  if (format === "html") {
1225
+ const sanitized = DOMPurify.sanitize(content);
1230
1226
  return /* @__PURE__ */ jsx(
1231
1227
  "div",
1232
1228
  {
1233
1229
  className,
1234
- dangerouslySetInnerHTML: { __html: content }
1230
+ dangerouslySetInnerHTML: { __html: sanitized }
1235
1231
  }
1236
1232
  );
1237
1233
  }
@@ -8799,6 +8795,6 @@ var ECOSYSTEM_PRODUCTS = [
8799
8795
  }
8800
8796
  ];
8801
8797
 
8802
- export { BlogListPage, BlogPostPage, Button, CareersApplyForm, CaseStudiesListPage, CaseStudyPage, ChangelogPage, ContactPage, ContentRenderer, ContractsPage, DEFAULT_CONTACT_CATEGORIES, ECOSYSTEM_PRODUCTS, ElectronDownloadLink, Input, Label, LaunchCountdown, NewsletterForm, NewsletterPage, PageHead, PartnersPage, PressKitPage, PricingPage, PricingSection, ProblemsSolvedSection, ProductCard, ProductProvider, ResourceLinks, RybbitAnalytics, Select, SocialLinks, StarRating, StoreBrowsePage, StoreHomePage, StoreProductDetailPage, Textarea, TypeBadge, UnsubscribePage, WaitlistForm, WaitlistPage, WebSDKClient, WebSDKProvider, WebsiteSwitcher, buttonVariants, cn, detectElectronPlatform, formatDownloads, formatPrice2 as formatPrice, useContentPage, useContentPages, useProduct, useProductConfig, useWebSDK, useWebSDKConfig };
8798
+ export { BlogListPage, BlogPostPage, Button, CareersApplyForm, CaseStudiesListPage, CaseStudyPage, ChangelogPage, ContactPage, ContentRenderer, ContractsPage, DEFAULT_CONTACT_CATEGORIES, ECOSYSTEM_PRODUCTS, ElectronDownloadLink, Input, Label, LaunchCountdown, Markdown, NewsletterForm, NewsletterPage, PageHead, PartnersPage, PressKitPage, PricingPage, PricingSection, ProblemsSolvedSection, ProductCard, ProductProvider, ResourceLinks, RybbitAnalytics, Select, SocialLinks, StarRating, StoreBrowsePage, StoreHomePage, StoreProductDetailPage, Textarea, TypeBadge, UnsubscribePage, WaitlistForm, WaitlistPage, WebSDKClient, WebSDKProvider, WebsiteSwitcher, buttonVariants, cn, detectElectronPlatform, formatDownloads, formatPrice2 as formatPrice, useContentPage, useContentPages, useProduct, useProductConfig, useWebSDK, useWebSDKConfig };
8803
8799
  //# sourceMappingURL=index.mjs.map
8804
8800
  //# sourceMappingURL=index.mjs.map