@burdenoff/website-sdk 0.0.0-dev

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.
Files changed (119) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +357 -0
  3. package/dist/analytics/index.d.mts +27 -0
  4. package/dist/analytics/index.d.ts +27 -0
  5. package/dist/analytics/index.js +36 -0
  6. package/dist/analytics/index.js.map +1 -0
  7. package/dist/analytics/index.mjs +34 -0
  8. package/dist/analytics/index.mjs.map +1 -0
  9. package/dist/client/index.d.mts +29 -0
  10. package/dist/client/index.d.ts +29 -0
  11. package/dist/client/index.js +261 -0
  12. package/dist/client/index.js.map +1 -0
  13. package/dist/client/index.mjs +255 -0
  14. package/dist/client/index.mjs.map +1 -0
  15. package/dist/components/contact.d.mts +144 -0
  16. package/dist/components/contact.d.ts +144 -0
  17. package/dist/components/contact.js +806 -0
  18. package/dist/components/contact.js.map +1 -0
  19. package/dist/components/contact.mjs +780 -0
  20. package/dist/components/contact.mjs.map +1 -0
  21. package/dist/components/electron-download.d.mts +32 -0
  22. package/dist/components/electron-download.d.ts +32 -0
  23. package/dist/components/electron-download.js +131 -0
  24. package/dist/components/electron-download.js.map +1 -0
  25. package/dist/components/electron-download.mjs +108 -0
  26. package/dist/components/electron-download.mjs.map +1 -0
  27. package/dist/components/launch-countdown.d.mts +15 -0
  28. package/dist/components/launch-countdown.d.ts +15 -0
  29. package/dist/components/launch-countdown.js +89 -0
  30. package/dist/components/launch-countdown.js.map +1 -0
  31. package/dist/components/launch-countdown.mjs +87 -0
  32. package/dist/components/launch-countdown.mjs.map +1 -0
  33. package/dist/components/newsletter.d.mts +155 -0
  34. package/dist/components/newsletter.d.ts +155 -0
  35. package/dist/components/newsletter.js +880 -0
  36. package/dist/components/newsletter.js.map +1 -0
  37. package/dist/components/newsletter.mjs +854 -0
  38. package/dist/components/newsletter.mjs.map +1 -0
  39. package/dist/components/partners.d.mts +88 -0
  40. package/dist/components/partners.d.ts +88 -0
  41. package/dist/components/partners.js +1169 -0
  42. package/dist/components/partners.js.map +1 -0
  43. package/dist/components/partners.mjs +1143 -0
  44. package/dist/components/partners.mjs.map +1 -0
  45. package/dist/components/pricing.d.mts +194 -0
  46. package/dist/components/pricing.d.ts +194 -0
  47. package/dist/components/pricing.js +813 -0
  48. package/dist/components/pricing.js.map +1 -0
  49. package/dist/components/pricing.mjs +791 -0
  50. package/dist/components/pricing.mjs.map +1 -0
  51. package/dist/components/problems-solved.d.mts +37 -0
  52. package/dist/components/problems-solved.d.ts +37 -0
  53. package/dist/components/problems-solved.js +157 -0
  54. package/dist/components/problems-solved.js.map +1 -0
  55. package/dist/components/problems-solved.mjs +135 -0
  56. package/dist/components/problems-solved.mjs.map +1 -0
  57. package/dist/components/resource-links.d.mts +28 -0
  58. package/dist/components/resource-links.d.ts +28 -0
  59. package/dist/components/resource-links.js +229 -0
  60. package/dist/components/resource-links.js.map +1 -0
  61. package/dist/components/resource-links.mjs +227 -0
  62. package/dist/components/resource-links.mjs.map +1 -0
  63. package/dist/components/social-links.d.mts +37 -0
  64. package/dist/components/social-links.d.ts +37 -0
  65. package/dist/components/social-links.js +268 -0
  66. package/dist/components/social-links.js.map +1 -0
  67. package/dist/components/social-links.mjs +266 -0
  68. package/dist/components/social-links.mjs.map +1 -0
  69. package/dist/components/unsubscribe.d.mts +14 -0
  70. package/dist/components/unsubscribe.d.ts +14 -0
  71. package/dist/components/unsubscribe.js +538 -0
  72. package/dist/components/unsubscribe.js.map +1 -0
  73. package/dist/components/unsubscribe.mjs +517 -0
  74. package/dist/components/unsubscribe.mjs.map +1 -0
  75. package/dist/components/waitlist.d.mts +70 -0
  76. package/dist/components/waitlist.d.ts +70 -0
  77. package/dist/components/waitlist.js +864 -0
  78. package/dist/components/waitlist.js.map +1 -0
  79. package/dist/components/waitlist.mjs +841 -0
  80. package/dist/components/waitlist.mjs.map +1 -0
  81. package/dist/components/website-switcher.d.mts +27 -0
  82. package/dist/components/website-switcher.d.ts +27 -0
  83. package/dist/components/website-switcher.js +168 -0
  84. package/dist/components/website-switcher.js.map +1 -0
  85. package/dist/components/website-switcher.mjs +146 -0
  86. package/dist/components/website-switcher.mjs.map +1 -0
  87. package/dist/content/index.d.mts +247 -0
  88. package/dist/content/index.d.ts +247 -0
  89. package/dist/content/index.js +2458 -0
  90. package/dist/content/index.js.map +1 -0
  91. package/dist/content/index.mjs +2428 -0
  92. package/dist/content/index.mjs.map +1 -0
  93. package/dist/index.d.mts +72 -0
  94. package/dist/index.d.ts +72 -0
  95. package/dist/index.js +6273 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/index.mjs +6204 -0
  98. package/dist/index.mjs.map +1 -0
  99. package/dist/product/index.d.mts +94 -0
  100. package/dist/product/index.d.ts +94 -0
  101. package/dist/product/index.js +282 -0
  102. package/dist/product/index.js.map +1 -0
  103. package/dist/product/index.mjs +278 -0
  104. package/dist/product/index.mjs.map +1 -0
  105. package/dist/provider-D7Rij9UM.d.mts +86 -0
  106. package/dist/provider-D7Rij9UM.d.ts +86 -0
  107. package/dist/seo/index.d.mts +64 -0
  108. package/dist/seo/index.d.ts +64 -0
  109. package/dist/seo/index.js +61 -0
  110. package/dist/seo/index.js.map +1 -0
  111. package/dist/seo/index.mjs +59 -0
  112. package/dist/seo/index.mjs.map +1 -0
  113. package/dist/utils/index.d.mts +21 -0
  114. package/dist/utils/index.d.ts +21 -0
  115. package/dist/utils/index.js +12 -0
  116. package/dist/utils/index.js.map +1 -0
  117. package/dist/utils/index.mjs +10 -0
  118. package/dist/utils/index.mjs.map +1 -0
  119. package/package.json +168 -0
@@ -0,0 +1,1143 @@
1
+ import * as React from 'react';
2
+ import { createContext, useState, useEffect, useContext, useRef } from 'react';
3
+ import { Mail, Phone, MapPin, Clock, Send, FileText, Download } from 'lucide-react';
4
+ import ReCAPTCHA from 'react-google-recaptcha';
5
+ import { toast } from 'sonner';
6
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
+ import { Helmet } from 'react-helmet-async';
8
+ import { Slot } from '@radix-ui/react-slot';
9
+ import { cva } from 'class-variance-authority';
10
+ import { clsx } from 'clsx';
11
+ import { twMerge } from 'tailwind-merge';
12
+ import * as LabelPrimitive from '@radix-ui/react-label';
13
+
14
+ var __defProp = Object.defineProperty;
15
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
17
+
18
+ // src/client/security.ts
19
+ var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
20
+ var RESERVED_HEADERS = /* @__PURE__ */ new Set([
21
+ "authorization",
22
+ "cookie",
23
+ "x-actor-id",
24
+ "x-actor-type",
25
+ "x-consent-granted-by",
26
+ "x-consent-scope",
27
+ "x-consent-granted-at",
28
+ "x-consent-expires-at"
29
+ ]);
30
+ function validateGatewayUrl(value) {
31
+ let url;
32
+ try {
33
+ url = new URL(value);
34
+ } catch {
35
+ throw new Error("Gateway URL must be a valid absolute URL");
36
+ }
37
+ if (url.protocol === "https:") {
38
+ return url.toString();
39
+ }
40
+ if (url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname.toLowerCase())) {
41
+ return url.toString();
42
+ }
43
+ throw new Error("Gateway URL must use HTTPS unless it targets localhost");
44
+ }
45
+ function sanitizeHeaders(headers) {
46
+ if (!headers) return void 0;
47
+ return Object.fromEntries(
48
+ Object.entries(headers).filter(
49
+ ([key]) => !RESERVED_HEADERS.has(key.toLowerCase())
50
+ )
51
+ );
52
+ }
53
+
54
+ // src/client/graphql-client.ts
55
+ var _WebSDKClient = class _WebSDKClient {
56
+ constructor(config) {
57
+ __publicField(this, "config");
58
+ __publicField(this, "queryCache", /* @__PURE__ */ new Map());
59
+ __publicField(this, "inflight", /* @__PURE__ */ new Map());
60
+ this.config = {
61
+ ...config,
62
+ gatewayUrl: validateGatewayUrl(config.gatewayUrl),
63
+ headers: sanitizeHeaders(config.headers)
64
+ };
65
+ }
66
+ getConfig() {
67
+ return this.config;
68
+ }
69
+ /**
70
+ * Execute a GraphQL query (with deduplication and caching)
71
+ */
72
+ async query(query, variables) {
73
+ const cacheKey = JSON.stringify({ query, variables });
74
+ const cached = this.queryCache.get(cacheKey);
75
+ if (cached) {
76
+ if (Date.now() - cached.ts < _WebSDKClient.CACHE_TTL) {
77
+ return cached.data;
78
+ }
79
+ this.queryCache.delete(cacheKey);
80
+ }
81
+ const existing = this.inflight.get(cacheKey);
82
+ if (existing) {
83
+ return existing;
84
+ }
85
+ const promise = this.request(query, variables).then((result) => {
86
+ if (result.data && !result.errors?.length) {
87
+ if (this.queryCache.size >= _WebSDKClient.MAX_CACHE_ENTRIES) {
88
+ const oldestEntry = this.queryCache.keys().next().value;
89
+ if (oldestEntry) {
90
+ this.queryCache.delete(oldestEntry);
91
+ }
92
+ }
93
+ this.queryCache.set(cacheKey, { data: result, ts: Date.now() });
94
+ }
95
+ return result;
96
+ }).finally(() => {
97
+ this.inflight.delete(cacheKey);
98
+ });
99
+ this.inflight.set(cacheKey, promise);
100
+ return promise;
101
+ }
102
+ /**
103
+ * Execute a GraphQL mutation
104
+ */
105
+ async mutate(mutation, variables) {
106
+ return this.request(mutation, variables);
107
+ }
108
+ async request(query, variables) {
109
+ try {
110
+ const response = await fetch(this.config.gatewayUrl, {
111
+ method: "POST",
112
+ headers: {
113
+ "Content-Type": "application/json",
114
+ "x-product-id": this.config.productId,
115
+ ...this.config.headers
116
+ },
117
+ body: JSON.stringify({ query, variables })
118
+ });
119
+ if (!response.ok) {
120
+ console.error(
121
+ "[WebSDK] GraphQL request failed",
122
+ response.status,
123
+ response.statusText
124
+ );
125
+ return {
126
+ errors: [
127
+ {
128
+ message: `HTTP ${response.status}: ${response.statusText}`,
129
+ extensions: { code: `HTTP_${response.status}` }
130
+ }
131
+ ]
132
+ };
133
+ }
134
+ return await response.json();
135
+ } catch (error) {
136
+ console.error(
137
+ "[WebSDK] Network error",
138
+ error instanceof Error ? error.message : "unknown error"
139
+ );
140
+ return {
141
+ errors: [
142
+ {
143
+ message: error instanceof Error ? error.message : "Network error",
144
+ extensions: { code: "NETWORK_ERROR" }
145
+ }
146
+ ]
147
+ };
148
+ }
149
+ }
150
+ };
151
+ __publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
152
+ // 5 minutes
153
+ __publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
154
+ var WebSDKContext = createContext(null);
155
+ function useWebSDK() {
156
+ const client = useContext(WebSDKContext);
157
+ if (!client) {
158
+ throw new Error("useWebSDK must be used within a WebSDKProvider");
159
+ }
160
+ return client;
161
+ }
162
+ function useWebSDKConfig() {
163
+ const client = useWebSDK();
164
+ return client.getConfig();
165
+ }
166
+ var ProductContext = createContext({
167
+ product: null,
168
+ loading: true,
169
+ error: null,
170
+ hasProvider: false,
171
+ refetch: () => {
172
+ }
173
+ });
174
+ function useProduct() {
175
+ return useContext(ProductContext);
176
+ }
177
+ function PageHead({
178
+ title,
179
+ description,
180
+ productName,
181
+ keywords,
182
+ image,
183
+ url,
184
+ favicon,
185
+ robots = "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1",
186
+ locale = "en_US",
187
+ twitterHandle,
188
+ themeColor = "#000000",
189
+ structuredData,
190
+ additionalMeta
191
+ }) {
192
+ const fullTitle = productName && !title.includes(productName) ? `${title} | ${productName}` : title;
193
+ const fullImageUrl = image && !image.startsWith("http") && url ? `${url.replace(/\/$/, "")}${image}` : image;
194
+ const structuredDataItems = structuredData ? Array.isArray(structuredData) ? structuredData : [structuredData] : [];
195
+ return /* @__PURE__ */ jsxs(Helmet, { children: [
196
+ /* @__PURE__ */ jsx("title", { children: fullTitle }),
197
+ /* @__PURE__ */ jsx("meta", { name: "title", content: fullTitle }),
198
+ description && /* @__PURE__ */ jsx("meta", { name: "description", content: description }),
199
+ keywords && /* @__PURE__ */ jsx("meta", { name: "keywords", content: keywords }),
200
+ /* @__PURE__ */ jsx("meta", { name: "author", content: "Burdenoff Consultancy Services Pvt Ltd" }),
201
+ /* @__PURE__ */ jsx("meta", { name: "robots", content: robots }),
202
+ url && /* @__PURE__ */ jsx("link", { rel: "canonical", href: url }),
203
+ favicon && /* @__PURE__ */ jsx("link", { rel: "icon", href: favicon }),
204
+ /* @__PURE__ */ jsx("meta", { property: "og:type", content: "website" }),
205
+ /* @__PURE__ */ jsx("meta", { property: "og:title", content: fullTitle }),
206
+ description && /* @__PURE__ */ jsx("meta", { property: "og:description", content: description }),
207
+ fullImageUrl && /* @__PURE__ */ jsx("meta", { property: "og:image", content: fullImageUrl }),
208
+ url && /* @__PURE__ */ jsx("meta", { property: "og:url", content: url }),
209
+ /* @__PURE__ */ jsx("meta", { property: "og:locale", content: locale }),
210
+ productName && /* @__PURE__ */ jsx("meta", { property: "og:site_name", content: productName }),
211
+ /* @__PURE__ */ jsx("meta", { name: "twitter:card", content: "summary_large_image" }),
212
+ /* @__PURE__ */ jsx("meta", { name: "twitter:title", content: fullTitle }),
213
+ description && /* @__PURE__ */ jsx("meta", { name: "twitter:description", content: description }),
214
+ fullImageUrl && /* @__PURE__ */ jsx("meta", { name: "twitter:image", content: fullImageUrl }),
215
+ twitterHandle && /* @__PURE__ */ jsx("meta", { name: "twitter:creator", content: twitterHandle }),
216
+ /* @__PURE__ */ jsx("meta", { name: "theme-color", content: themeColor }),
217
+ structuredDataItems.map((data, index) => /* @__PURE__ */ jsx("script", { type: "application/ld+json", children: JSON.stringify(data) }, `ld-${index}`)),
218
+ additionalMeta?.map((meta, index) => /* @__PURE__ */ jsx(
219
+ "meta",
220
+ {
221
+ ...meta.name ? { name: meta.name } : {},
222
+ ...meta.property ? { property: meta.property } : {},
223
+ content: meta.content
224
+ },
225
+ `meta-${index}`
226
+ ))
227
+ ] });
228
+ }
229
+ function cn(...inputs) {
230
+ return twMerge(clsx(inputs));
231
+ }
232
+ var buttonVariants = cva(
233
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
234
+ {
235
+ variants: {
236
+ variant: {
237
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
238
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
239
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
240
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
241
+ ghost: "hover:bg-accent hover:text-accent-foreground",
242
+ link: "text-primary underline-offset-4 hover:underline"
243
+ },
244
+ size: {
245
+ default: "h-9 px-4 py-2",
246
+ sm: "h-8 rounded-md px-3 text-xs",
247
+ lg: "h-10 rounded-md px-8",
248
+ icon: "h-9 w-9"
249
+ }
250
+ },
251
+ defaultVariants: {
252
+ variant: "default",
253
+ size: "default"
254
+ }
255
+ }
256
+ );
257
+ var Button = React.forwardRef(
258
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
259
+ const Comp = asChild ? Slot : "button";
260
+ return /* @__PURE__ */ jsx(
261
+ Comp,
262
+ {
263
+ className: cn(buttonVariants({ variant, size, className })),
264
+ ref,
265
+ ...props
266
+ }
267
+ );
268
+ }
269
+ );
270
+ Button.displayName = "Button";
271
+ var Input = React.forwardRef(
272
+ ({ className, type, ...props }, ref) => {
273
+ return /* @__PURE__ */ jsx(
274
+ "input",
275
+ {
276
+ type,
277
+ className: cn(
278
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
279
+ className
280
+ ),
281
+ ref,
282
+ ...props
283
+ }
284
+ );
285
+ }
286
+ );
287
+ Input.displayName = "Input";
288
+ var labelVariants = cva(
289
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
290
+ );
291
+ var Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
292
+ LabelPrimitive.Root,
293
+ {
294
+ ref,
295
+ className: cn(labelVariants(), className),
296
+ ...props
297
+ }
298
+ ));
299
+ Label.displayName = LabelPrimitive.Root.displayName;
300
+ var Select = React.forwardRef(({ className, children, ...props }, ref) => {
301
+ return /* @__PURE__ */ jsx(
302
+ "select",
303
+ {
304
+ className: cn(
305
+ "flex h-9 w-full appearance-none rounded-md border border-input bg-transparent bg-[length:1rem_1rem] bg-[right_0.75rem_center] bg-no-repeat px-3 py-1 pr-8 text-base shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
306
+ // Inline SVG chevron: SVG inside a `background-image: url(data:…)`
307
+ // does NOT inherit `currentColor` from the host element (the SVG is
308
+ // its own document with no parent CSS context), so the stroke is
309
+ // hardcoded to a muted slate-400 (#94a3b8). Matches the muted
310
+ // foreground token visually in both light and dark themes well
311
+ // enough for a passive chevron — addresses #9 review feedback.
312
+ `bg-[url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>")]`,
313
+ className
314
+ ),
315
+ ref,
316
+ ...props,
317
+ children
318
+ }
319
+ );
320
+ });
321
+ Select.displayName = "Select";
322
+ var Textarea = React.forwardRef(({ className, ...props }, ref) => {
323
+ return /* @__PURE__ */ jsx(
324
+ "textarea",
325
+ {
326
+ className: cn(
327
+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
328
+ className
329
+ ),
330
+ ref,
331
+ ...props
332
+ }
333
+ );
334
+ });
335
+ Textarea.displayName = "Textarea";
336
+ var SUBMIT_CONTACT_INQUIRY_MUTATION = (
337
+ /* GraphQL */
338
+ `
339
+ mutation SubmitContactInquiry($input: SubmitContactInquiryInput!) {
340
+ submitContactInquiry(input: $input) {
341
+ success
342
+ message
343
+ }
344
+ }
345
+ `
346
+ );
347
+ async function submitContactForm(client, data, productId) {
348
+ try {
349
+ const result = await client.mutate(SUBMIT_CONTACT_INQUIRY_MUTATION, {
350
+ input: {
351
+ name: `${data.firstName} ${data.lastName}`,
352
+ email: data.email.trim().toLowerCase(),
353
+ company: data.company || void 0,
354
+ subject: data.subject,
355
+ message: data.message,
356
+ productId,
357
+ // Send `category` only when the user actually picked one. Older
358
+ // backend deployments without the `category` field in the
359
+ // `SubmitContactInquiryInput` schema would reject any unknown
360
+ // field; spreading conditionally keeps the SDK forward-
361
+ // compatible.
362
+ ...data.category ? { category: data.category } : {},
363
+ ...data.recaptchaToken ? { recaptchaToken: data.recaptchaToken } : {}
364
+ }
365
+ });
366
+ if (result.errors?.length) {
367
+ const errorMsg = result.errors[0]?.message ?? "Failed to send message";
368
+ return { success: false, message: errorMsg };
369
+ }
370
+ const response = result.data?.submitContactInquiry;
371
+ if (response?.success) {
372
+ return {
373
+ success: true,
374
+ message: response.message || "Message sent successfully!"
375
+ };
376
+ }
377
+ return {
378
+ success: false,
379
+ message: response?.message || "Failed to send message"
380
+ };
381
+ } catch (error) {
382
+ console.error("Contact form submission error:", error);
383
+ return {
384
+ success: false,
385
+ message: "Network error. Please try again."
386
+ };
387
+ }
388
+ }
389
+ function replacePlaceholders(text, productName, email) {
390
+ return text.replace(/{productName}/g, productName).replace(/{email}/g, email);
391
+ }
392
+ function ContactPage({
393
+ productName,
394
+ recaptchaSiteKey,
395
+ contactEmail,
396
+ contactPhone,
397
+ officeAddress,
398
+ responseTime = "We typically respond within 24 hours",
399
+ heroTitle = "Get in Touch",
400
+ heroDescription = "Have questions about {productName}? We're here to help. Reach out to our team and we'll get back to you as soon as possible.",
401
+ headingLevel = 1,
402
+ // Backward-compatibility: default to `[]` so existing consumers
403
+ // (fluidgrids/burdenoff/algoshred websites) that don't pass
404
+ // `categories` continue to render with NO dropdown — same behavior
405
+ // they had before this SDK version. To opt in, pass an explicit
406
+ // `categories={…}` array (or the exported `DEFAULT_CONTACT_CATEGORIES`
407
+ // constant for the sane Burdenoff-generic vocabulary).
408
+ categories = [],
409
+ categoryLabel = "Category",
410
+ categoryPlaceholder = "Select a category",
411
+ categoryRequired = true,
412
+ additionalOptions = [
413
+ {
414
+ title: "Sales Inquiries",
415
+ description: "Ready to see {productName} in action? Our sales team is here to help.",
416
+ buttonText: "Contact Sales",
417
+ buttonLink: `mailto:${contactEmail}`
418
+ },
419
+ {
420
+ title: "Technical Support",
421
+ description: "Need help with your {productName} setup? Our support team is ready.",
422
+ buttonText: "Get Support",
423
+ buttonLink: `mailto:${contactEmail}`
424
+ },
425
+ {
426
+ title: "Partnership",
427
+ description: "Interested in partnering with {productName}? Let's explore opportunities.",
428
+ buttonText: "Partner With Us",
429
+ buttonLink: `mailto:${contactEmail}`
430
+ }
431
+ ],
432
+ seo
433
+ }) {
434
+ const client = useWebSDK();
435
+ const config = useWebSDKConfig();
436
+ const { product } = useProduct();
437
+ const resolvedProductId = product?.id || config.productId;
438
+ const displayName = productName ?? product?.name ?? config.productId;
439
+ const effectiveRecaptchaSiteKey = recaptchaSiteKey ?? product?.recaptchaSiteKey ?? config.recaptchaSiteKey ?? "";
440
+ const recaptchaRef = useRef(null);
441
+ const [isSubmitting, setIsSubmitting] = useState(false);
442
+ const [submitStatus, setSubmitStatus] = useState("idle");
443
+ const handleSubmit = async (e) => {
444
+ e.preventDefault();
445
+ const recaptchaToken = recaptchaRef.current?.getValue() ?? "";
446
+ if (effectiveRecaptchaSiteKey && !recaptchaToken) {
447
+ toast.error("Please complete the reCAPTCHA verification");
448
+ return;
449
+ }
450
+ setIsSubmitting(true);
451
+ setSubmitStatus("idle");
452
+ const form = e.currentTarget;
453
+ try {
454
+ const formData = new FormData(form);
455
+ const showCategory = categories.length > 0;
456
+ const rawCategory = showCategory ? (formData.get("category") ?? "").trim() : "";
457
+ if (showCategory && categoryRequired && !rawCategory) {
458
+ toast.error("Please select a category");
459
+ setIsSubmitting(false);
460
+ return;
461
+ }
462
+ const contactData = {
463
+ firstName: formData.get("firstName"),
464
+ lastName: formData.get("lastName"),
465
+ email: formData.get("email"),
466
+ company: formData.get("company"),
467
+ category: rawCategory || void 0,
468
+ subject: formData.get("subject"),
469
+ message: formData.get("message"),
470
+ recaptchaToken
471
+ };
472
+ const result = await submitContactForm(
473
+ client,
474
+ contactData,
475
+ resolvedProductId
476
+ );
477
+ if (result.success) {
478
+ setSubmitStatus("success");
479
+ toast.success(
480
+ result.message ?? `Thank you for contacting ${displayName}. We'll get back to you within 24 hours.`
481
+ );
482
+ if (form) {
483
+ form.reset();
484
+ }
485
+ recaptchaRef.current?.reset();
486
+ } else {
487
+ setSubmitStatus("error");
488
+ toast.error(
489
+ result.message ?? "Failed to send message. Please try again."
490
+ );
491
+ recaptchaRef.current?.reset();
492
+ }
493
+ } catch (error) {
494
+ console.error("Error submitting form:", error);
495
+ setSubmitStatus("error");
496
+ toast.error("Failed to send message. Please try again later.");
497
+ recaptchaRef.current?.reset();
498
+ } finally {
499
+ setIsSubmitting(false);
500
+ }
501
+ };
502
+ return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
503
+ seo && /* @__PURE__ */ jsx(
504
+ PageHead,
505
+ {
506
+ title: seo.title ?? `Contact ${displayName} - Get in Touch With Our Team`,
507
+ description: seo.description ?? `Ready to transform your business? Contact our team for sales inquiries, technical support, or partnership opportunities. We're here to help you succeed.`,
508
+ productName: displayName,
509
+ keywords: seo.keywords ?? `contact ${displayName.toLowerCase()}, sales inquiries, customer support, technical support, partnership opportunities, get in touch`,
510
+ image: seo.image ?? "/og-image-contact.png",
511
+ url: seo.url
512
+ }
513
+ ),
514
+ /* @__PURE__ */ jsx(
515
+ "section",
516
+ {
517
+ className: headingLevel === 2 ? "py-12 md:py-16" : "bg-gradient-to-b from-background to-muted/20 py-12 sm:py-16 md:py-20 lg:py-24",
518
+ children: /* @__PURE__ */ jsx("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center max-w-3xl mx-auto", children: [
519
+ headingLevel === 2 ? /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-bold mb-3", children: heroTitle }) : /* @__PURE__ */ jsx("h1", { className: "text-3xl sm:text-4xl md:text-5xl font-bold mb-4 sm:mb-6", children: heroTitle }),
520
+ /* @__PURE__ */ jsx("p", { className: "text-lg sm:text-xl text-muted-foreground leading-relaxed", children: replacePlaceholders(heroDescription, displayName, contactEmail) })
521
+ ] }) })
522
+ }
523
+ ),
524
+ /* @__PURE__ */ jsx("section", { className: "py-12 sm:py-16 md:py-20 lg:py-24", children: /* @__PURE__ */ jsx("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "grid sm:grid-cols-1 lg:grid-cols-3 gap-8 sm:gap-10 lg:gap-12", children: [
525
+ /* @__PURE__ */ jsxs("div", { className: "lg:col-span-1 order-2 lg:order-1", children: [
526
+ /* @__PURE__ */ jsx("h2", { className: "text-xl sm:text-2xl font-bold mb-4 sm:mb-6", children: "Contact Information" }),
527
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 sm:space-y-6", children: [
528
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
529
+ /* @__PURE__ */ jsx("div", { className: "w-8 h-8 sm:w-10 sm:h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(Mail, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
530
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
531
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Email" }),
532
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm sm:text-base break-all", children: contactEmail })
533
+ ] })
534
+ ] }),
535
+ contactPhone && /* @__PURE__ */ jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
536
+ /* @__PURE__ */ jsx("div", { className: "w-8 h-8 sm:w-10 sm:h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(Phone, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
537
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
538
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Phone" }),
539
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm sm:text-base", children: contactPhone })
540
+ ] })
541
+ ] }),
542
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
543
+ /* @__PURE__ */ jsx("div", { className: "w-8 h-8 sm:w-10 sm:h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(MapPin, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
544
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
545
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Office" }),
546
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm sm:text-base leading-relaxed", children: [
547
+ officeAddress.line1,
548
+ /* @__PURE__ */ jsx("br", {}),
549
+ officeAddress.line2,
550
+ /* @__PURE__ */ jsx("br", {}),
551
+ officeAddress.line3,
552
+ /* @__PURE__ */ jsx("br", {}),
553
+ officeAddress.country
554
+ ] })
555
+ ] })
556
+ ] }),
557
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
558
+ /* @__PURE__ */ jsx("div", { className: "w-8 h-8 sm:w-10 sm:h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
559
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
560
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Response Time" }),
561
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm sm:text-base", children: responseTime })
562
+ ] })
563
+ ] })
564
+ ] })
565
+ ] }),
566
+ /* @__PURE__ */ jsx("div", { className: "lg:col-span-2 order-1 lg:order-2", children: /* @__PURE__ */ jsxs("div", { className: "bg-card border rounded-lg p-4 sm:p-6 md:p-8", children: [
567
+ /* @__PURE__ */ jsx("h2", { className: "text-xl sm:text-2xl font-bold mb-4 sm:mb-6", children: "Send us a Message" }),
568
+ /* @__PURE__ */ jsxs(
569
+ "form",
570
+ {
571
+ onSubmit: handleSubmit,
572
+ className: "space-y-4 sm:space-y-6",
573
+ children: [
574
+ /* @__PURE__ */ jsxs("div", { className: "grid sm:grid-cols-2 gap-4 sm:gap-6", children: [
575
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
576
+ /* @__PURE__ */ jsx(
577
+ Label,
578
+ {
579
+ htmlFor: "firstName",
580
+ className: "text-sm sm:text-base",
581
+ children: "First Name *"
582
+ }
583
+ ),
584
+ /* @__PURE__ */ jsx(
585
+ Input,
586
+ {
587
+ id: "firstName",
588
+ name: "firstName",
589
+ required: true,
590
+ placeholder: "John",
591
+ className: "text-sm sm:text-base"
592
+ }
593
+ )
594
+ ] }),
595
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
596
+ /* @__PURE__ */ jsx(
597
+ Label,
598
+ {
599
+ htmlFor: "lastName",
600
+ className: "text-sm sm:text-base",
601
+ children: "Last Name *"
602
+ }
603
+ ),
604
+ /* @__PURE__ */ jsx(
605
+ Input,
606
+ {
607
+ id: "lastName",
608
+ name: "lastName",
609
+ required: true,
610
+ placeholder: "Doe",
611
+ className: "text-sm sm:text-base"
612
+ }
613
+ )
614
+ ] })
615
+ ] }),
616
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
617
+ /* @__PURE__ */ jsx(Label, { htmlFor: "email", className: "text-sm sm:text-base", children: "Email *" }),
618
+ /* @__PURE__ */ jsx(
619
+ Input,
620
+ {
621
+ id: "email",
622
+ name: "email",
623
+ type: "email",
624
+ required: true,
625
+ placeholder: "john@company.com",
626
+ className: "text-sm sm:text-base"
627
+ }
628
+ )
629
+ ] }),
630
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
631
+ /* @__PURE__ */ jsx(Label, { htmlFor: "company", className: "text-sm sm:text-base", children: "Company" }),
632
+ /* @__PURE__ */ jsx(
633
+ Input,
634
+ {
635
+ id: "company",
636
+ name: "company",
637
+ placeholder: "Acme Inc.",
638
+ className: "text-sm sm:text-base"
639
+ }
640
+ )
641
+ ] }),
642
+ categories.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
643
+ /* @__PURE__ */ jsxs(
644
+ Label,
645
+ {
646
+ htmlFor: "category",
647
+ className: "text-sm sm:text-base",
648
+ children: [
649
+ categoryLabel,
650
+ categoryRequired ? " *" : ""
651
+ ]
652
+ }
653
+ ),
654
+ /* @__PURE__ */ jsxs(
655
+ Select,
656
+ {
657
+ id: "category",
658
+ name: "category",
659
+ required: categoryRequired,
660
+ defaultValue: "",
661
+ className: "text-sm sm:text-base",
662
+ children: [
663
+ /* @__PURE__ */ jsx("option", { value: "", disabled: categoryRequired, children: categoryPlaceholder }),
664
+ categories.map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.label }, c.value))
665
+ ]
666
+ }
667
+ )
668
+ ] }),
669
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
670
+ /* @__PURE__ */ jsx(Label, { htmlFor: "subject", className: "text-sm sm:text-base", children: "Subject *" }),
671
+ /* @__PURE__ */ jsx(
672
+ Input,
673
+ {
674
+ id: "subject",
675
+ name: "subject",
676
+ required: true,
677
+ placeholder: "How can we help you?",
678
+ className: "text-sm sm:text-base"
679
+ }
680
+ )
681
+ ] }),
682
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
683
+ /* @__PURE__ */ jsx(Label, { htmlFor: "message", className: "text-sm sm:text-base", children: "Message *" }),
684
+ /* @__PURE__ */ jsx(
685
+ Textarea,
686
+ {
687
+ id: "message",
688
+ name: "message",
689
+ required: true,
690
+ placeholder: "Tell us more about your needs...",
691
+ rows: 5,
692
+ className: "text-sm sm:text-base min-h-[120px] sm:min-h-[150px] resize-y"
693
+ }
694
+ )
695
+ ] }),
696
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
697
+ effectiveRecaptchaSiteKey && /* @__PURE__ */ jsx("div", { className: "flex justify-center sm:justify-start", children: /* @__PURE__ */ jsx(
698
+ ReCAPTCHA,
699
+ {
700
+ ref: recaptchaRef,
701
+ sitekey: effectiveRecaptchaSiteKey
702
+ }
703
+ ) }),
704
+ /* @__PURE__ */ jsx(
705
+ Button,
706
+ {
707
+ type: "submit",
708
+ size: "lg",
709
+ disabled: isSubmitting,
710
+ className: "w-full sm:w-auto min-w-[200px]",
711
+ children: isSubmitting ? "Sending..." : /* @__PURE__ */ jsxs(Fragment, { children: [
712
+ "Send Message ",
713
+ /* @__PURE__ */ jsx(Send, { className: "ml-2 h-4 w-4" })
714
+ ] })
715
+ }
716
+ )
717
+ ] }),
718
+ submitStatus === "success" && /* @__PURE__ */ jsxs("div", { className: "p-3 sm:p-4 bg-green-50 border border-green-200 rounded-lg text-green-800 mt-4", children: [
719
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-sm sm:text-base", children: "Message sent successfully!" }),
720
+ /* @__PURE__ */ jsxs("p", { className: "text-xs sm:text-sm mt-1", children: [
721
+ "Thank you for contacting ",
722
+ displayName,
723
+ ". We'll get back to you within 24 hours."
724
+ ] })
725
+ ] }),
726
+ submitStatus === "error" && /* @__PURE__ */ jsxs("div", { className: "p-3 sm:p-4 bg-red-50 border border-red-200 rounded-lg text-red-800 mt-4", children: [
727
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-sm sm:text-base", children: "Failed to send message" }),
728
+ /* @__PURE__ */ jsxs("p", { className: "text-xs sm:text-sm mt-1", children: [
729
+ "Please try again later or contact us directly at",
730
+ " ",
731
+ contactEmail
732
+ ] })
733
+ ] })
734
+ ]
735
+ }
736
+ )
737
+ ] }) })
738
+ ] }) }) }),
739
+ additionalOptions.length > 0 && /* @__PURE__ */ jsx("section", { className: "py-12 sm:py-16 md:py-20 lg:py-24 bg-muted/30", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
740
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl sm:text-3xl font-bold text-center mb-8 sm:mb-12", children: "More Ways to Connect" }),
741
+ /* @__PURE__ */ jsx("div", { className: "grid sm:grid-cols-2 lg:grid-cols-3 gap-6 sm:gap-8 max-w-5xl mx-auto", children: additionalOptions.map((option, index) => /* @__PURE__ */ jsxs(
742
+ "div",
743
+ {
744
+ className: "text-center p-4 sm:p-6 bg-card border rounded-lg",
745
+ children: [
746
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-base sm:text-lg mb-2", children: option.title }),
747
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm sm:text-base mb-4 leading-relaxed", children: replacePlaceholders(
748
+ option.description,
749
+ displayName,
750
+ contactEmail
751
+ ) }),
752
+ /* @__PURE__ */ jsx(
753
+ Button,
754
+ {
755
+ variant: "outline",
756
+ asChild: true,
757
+ className: "text-sm sm:text-base",
758
+ children: /* @__PURE__ */ jsx("a", { href: option.buttonLink, children: option.buttonText })
759
+ }
760
+ )
761
+ ]
762
+ },
763
+ index
764
+ )) })
765
+ ] }) })
766
+ ] });
767
+ }
768
+ function renderMarkdown(md) {
769
+ let html = md;
770
+ html = html.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
771
+ html = html.replace(/```(\w*)\n([\s\S]*?)```/g, (_m, _lang, code) => {
772
+ return `<pre><code>${code.trim()}</code></pre>`;
773
+ });
774
+ html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
775
+ html = html.replace(/^###### (.+)$/gm, "<h6>$1</h6>");
776
+ html = html.replace(/^##### (.+)$/gm, "<h5>$1</h5>");
777
+ html = html.replace(/^#### (.+)$/gm, "<h4>$1</h4>");
778
+ html = html.replace(/^### (.+)$/gm, "<h3>$1</h3>");
779
+ html = html.replace(/^## (.+)$/gm, "<h2>$1</h2>");
780
+ html = html.replace(/^# (.+)$/gm, "<h1>$1</h1>");
781
+ html = html.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>");
782
+ html = html.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
783
+ html = html.replace(/\*(.+?)\*/g, "<em>$1</em>");
784
+ html = html.replace(
785
+ /\[([^\]]+)\]\(([^)]+)\)/g,
786
+ '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
787
+ );
788
+ html = html.replace(/^&gt; (.+)$/gm, "<blockquote>$1</blockquote>");
789
+ html = html.replace(/(^- .+$(\n^- .+$)*)/gm, (block) => {
790
+ const items = block.split("\n").map((line) => `<li>${line.replace(/^- /, "")}</li>`).join("");
791
+ return `<ul>${items}</ul>`;
792
+ });
793
+ html = html.replace(/(^\d+\. .+$(\n^\d+\. .+$)*)/gm, (block) => {
794
+ const items = block.split("\n").map((line) => `<li>${line.replace(/^\d+\. /, "")}</li>`).join("");
795
+ return `<ol>${items}</ol>`;
796
+ });
797
+ html = html.replace(/^---$/gm, "<hr />");
798
+ html = html.split(/\n\n+/).map((block) => {
799
+ const trimmed = block.trim();
800
+ if (!trimmed) return "";
801
+ if (/^<(h[1-6]|ul|ol|pre|blockquote|hr)/.test(trimmed)) return trimmed;
802
+ return `<p>${trimmed.replace(/\n/g, "<br />")}</p>`;
803
+ }).join("\n");
804
+ return html;
805
+ }
806
+ function ContentRenderer({
807
+ content,
808
+ format = "markdown",
809
+ className
810
+ }) {
811
+ if (format === "markdown") {
812
+ return /* @__PURE__ */ jsx(
813
+ "div",
814
+ {
815
+ className,
816
+ dangerouslySetInnerHTML: { __html: renderMarkdown(content) }
817
+ }
818
+ );
819
+ }
820
+ if (format === "html") {
821
+ return /* @__PURE__ */ jsx(
822
+ "div",
823
+ {
824
+ className,
825
+ dangerouslySetInnerHTML: { __html: content }
826
+ }
827
+ );
828
+ }
829
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("pre", { style: { whiteSpace: "pre-wrap", fontFamily: "inherit" }, children: content }) });
830
+ }
831
+ var PARTNER_CONTENT_QUERY = `
832
+ query PartnerContent($productId: String!, $limit: Int) {
833
+ publicContentPages(productId: $productId, limit: $limit, offset: 0) {
834
+ items {
835
+ id
836
+ title
837
+ slug
838
+ excerpt
839
+ content
840
+ contentFormat
841
+ thumbnail
842
+ tags
843
+ publishedAt
844
+ lastUpdated
845
+ }
846
+ }
847
+ }
848
+ `;
849
+ var PARTNER_DOCUMENTS_QUERY = `
850
+ query PartnerDocuments($productId: String!, $limit: Int) {
851
+ publicPressKitAssets(productId: $productId, limit: $limit, offset: 0) {
852
+ items {
853
+ id
854
+ category
855
+ title
856
+ description
857
+ fileUrl
858
+ fileName
859
+ fileSize
860
+ mimeType
861
+ version
862
+ tags
863
+ sortOrder
864
+ updatedAt
865
+ }
866
+ }
867
+ }
868
+ `;
869
+ function formatFileSize(bytes) {
870
+ if (!bytes || bytes <= 0) return "";
871
+ const units = ["B", "KB", "MB", "GB"];
872
+ let i = 0;
873
+ let n = bytes;
874
+ while (n >= 1024 && i < units.length - 1) {
875
+ n /= 1024;
876
+ i++;
877
+ }
878
+ return `${n.toFixed(n >= 10 || i === 0 ? 0 : 1)} ${units[i]}`;
879
+ }
880
+ async function downloadDocument(e, doc) {
881
+ e.preventDefault();
882
+ const name = doc.fileName || doc.fileUrl.split("/").pop()?.split("?")[0] || doc.title || "partner-document";
883
+ const openInTab = () => window.open(doc.fileUrl, "_blank", "noopener,noreferrer");
884
+ try {
885
+ const res = await fetch(doc.fileUrl, { mode: "cors" });
886
+ if (!res.ok) {
887
+ openInTab();
888
+ return;
889
+ }
890
+ const blob = await res.blob();
891
+ const objUrl = URL.createObjectURL(blob);
892
+ const a = document.createElement("a");
893
+ a.href = objUrl;
894
+ a.download = name;
895
+ document.body.appendChild(a);
896
+ a.click();
897
+ a.remove();
898
+ URL.revokeObjectURL(objUrl);
899
+ } catch {
900
+ openInTab();
901
+ }
902
+ }
903
+ function PartnerHero({
904
+ title,
905
+ subtitle
906
+ }) {
907
+ 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: [
908
+ /* @__PURE__ */ jsx("h1", { className: "text-4xl md:text-5xl font-bold tracking-tight text-foreground mb-4", children: title }),
909
+ subtitle && /* @__PURE__ */ jsx("p", { className: "text-lg md:text-xl text-muted-foreground max-w-2xl mx-auto", children: subtitle })
910
+ ] }) });
911
+ }
912
+ function stripLeadingHeading(content, format) {
913
+ if (format === "html") {
914
+ return content.replace(/^\s*<h1\b[^>]*>[\s\S]*?<\/h1>\s*/i, "");
915
+ }
916
+ return content.replace(/^\s*#\s+.*(?:\r?\n)*/, "");
917
+ }
918
+ function PartnerContentSection({
919
+ page
920
+ }) {
921
+ return /* @__PURE__ */ jsx("section", { className: "py-12 md:py-16", children: /* @__PURE__ */ jsx(
922
+ "div",
923
+ {
924
+ className: [
925
+ "mx-auto max-w-3xl px-4",
926
+ // Headings
927
+ "[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:tracking-tight [&_h1]:mt-0 [&_h1]:mb-6",
928
+ "[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:tracking-tight [&_h2]:mt-10 [&_h2]:mb-4",
929
+ "[&_h3]:text-xl [&_h3]:font-semibold [&_h3]:mt-7 [&_h3]:mb-3",
930
+ "[&_h4]:text-lg [&_h4]:font-semibold [&_h4]:mt-6 [&_h4]:mb-2",
931
+ // Block elements
932
+ "[&_p]:my-4 [&_p]:leading-relaxed [&_p]:text-base",
933
+ "[&_ul]:my-4 [&_ul]:pl-6 [&_ul]:list-disc [&_ul]:space-y-1",
934
+ "[&_ol]:my-4 [&_ol]:pl-6 [&_ol]:list-decimal [&_ol]:space-y-1",
935
+ "[&_li]:leading-relaxed",
936
+ "[&_li>p]:my-1",
937
+ "[&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:my-4 [&_blockquote]:text-muted-foreground",
938
+ "[&_hr]:my-8 [&_hr]:border-border",
939
+ // Inline elements
940
+ "[&_strong]:font-semibold [&_strong]:text-foreground",
941
+ "[&_em]:italic",
942
+ "[&_a]:underline [&_a]:underline-offset-2 [&_a]:text-accent hover:[&_a]:text-accent/80 [&_a]:transition-colors",
943
+ "[&_code]:rounded [&_code]:bg-muted [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-sm [&_code]:font-mono",
944
+ "[&_pre]:my-4 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-4 [&_pre]:text-sm",
945
+ "[&_pre>code]:bg-transparent [&_pre>code]:p-0"
946
+ ].join(" "),
947
+ children: page.content && /* @__PURE__ */ jsx(
948
+ ContentRenderer,
949
+ {
950
+ content: stripLeadingHeading(page.content, page.contentFormat),
951
+ format: (
952
+ // Validate before passing; unknown formats fall through to
953
+ // ContentRenderer's default behavior (markdown rendering)
954
+ // rather than getting silently force-cast to an
955
+ // unsupported variant.
956
+ page.contentFormat === "markdown" || page.contentFormat === "html" ? page.contentFormat : void 0
957
+ )
958
+ }
959
+ )
960
+ }
961
+ ) });
962
+ }
963
+ function PartnerDocumentCard({ doc }) {
964
+ const sizeLabel = formatFileSize(doc.fileSize);
965
+ const ext = doc.fileName?.split(".").pop()?.toUpperCase();
966
+ 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: [
967
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
968
+ /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted p-2.5 shrink-0", children: /* @__PURE__ */ jsx(FileText, { size: 20, className: "text-muted-foreground" }) }),
969
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
970
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold text-foreground truncate", children: doc.title }),
971
+ doc.version && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground mt-0.5", children: [
972
+ "Version ",
973
+ doc.version
974
+ ] })
975
+ ] })
976
+ ] }),
977
+ doc.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground line-clamp-3", children: doc.description }),
978
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 mt-auto pt-2 border-t border-border/60", children: [
979
+ /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground flex items-center gap-2", children: [
980
+ ext && /* @__PURE__ */ jsx("span", { children: ext }),
981
+ sizeLabel && /* @__PURE__ */ jsxs(Fragment, { children: [
982
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }),
983
+ /* @__PURE__ */ jsx("span", { children: sizeLabel })
984
+ ] })
985
+ ] }),
986
+ /* @__PURE__ */ jsxs(
987
+ "a",
988
+ {
989
+ href: doc.fileUrl,
990
+ download: doc.fileName ?? void 0,
991
+ onClick: (e) => void downloadDocument(e, doc),
992
+ 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",
993
+ children: [
994
+ /* @__PURE__ */ jsx(Download, { size: 14 }),
995
+ "Download"
996
+ ]
997
+ }
998
+ )
999
+ ] })
1000
+ ] });
1001
+ }
1002
+ function PartnerDocumentsSection({
1003
+ title,
1004
+ subtitle,
1005
+ docs
1006
+ }) {
1007
+ 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: [
1008
+ /* @__PURE__ */ jsxs("header", { className: "mb-8 md:mb-10 text-center", children: [
1009
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-bold text-foreground mb-2", children: title }),
1010
+ subtitle && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground max-w-2xl mx-auto", children: subtitle })
1011
+ ] }),
1012
+ /* @__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)) })
1013
+ ] }) });
1014
+ }
1015
+ var DEFAULT_PARTNER_CATEGORY = {
1016
+ value: "partnership",
1017
+ label: "Partner program"
1018
+ };
1019
+ function PartnersPage(props) {
1020
+ const {
1021
+ productName: productNameProp,
1022
+ heroTitle = "Partner with us",
1023
+ heroSubtitle,
1024
+ contentTag = "partner",
1025
+ contentSlug,
1026
+ documentsTag = "partner",
1027
+ documentsTitle = "Partner Documents",
1028
+ documentsSubtitle,
1029
+ showContactForm = true,
1030
+ contactCategory,
1031
+ formTitle = "Become a partner",
1032
+ formSubtitle,
1033
+ contactEmail,
1034
+ contactPhone,
1035
+ officeAddress,
1036
+ responseTime,
1037
+ recaptchaSiteKey,
1038
+ additionalOptions,
1039
+ seoTitle,
1040
+ seoDescription,
1041
+ seoKeywords,
1042
+ className
1043
+ } = props;
1044
+ const client = useWebSDK();
1045
+ const config = useWebSDKConfig();
1046
+ const { product } = useProduct();
1047
+ const resolvedProductId = product?.id ?? config?.productId ?? productNameProp ?? "";
1048
+ const resolvedProductName = productNameProp ?? product?.name ?? config?.productId ?? "our team";
1049
+ const [contentPage, setContentPage] = useState(null);
1050
+ const [docs, setDocs] = useState([]);
1051
+ const [loading, setLoading] = useState(true);
1052
+ useEffect(() => {
1053
+ if (!client || !resolvedProductId) {
1054
+ setContentPage(null);
1055
+ setDocs([]);
1056
+ setLoading(false);
1057
+ return;
1058
+ }
1059
+ let cancelled = false;
1060
+ setLoading(true);
1061
+ void Promise.allSettled([
1062
+ client.query(PARTNER_CONTENT_QUERY, { productId: resolvedProductId, limit: 50 }),
1063
+ client.query(
1064
+ PARTNER_DOCUMENTS_QUERY,
1065
+ { productId: resolvedProductId, limit: 50 }
1066
+ )
1067
+ ]).then(([contentResult, docsResult]) => {
1068
+ if (cancelled) return;
1069
+ if (contentResult.status === "rejected") {
1070
+ setContentPage(null);
1071
+ } else if (contentResult.status === "fulfilled") {
1072
+ const items = contentResult.value.data?.publicContentPages?.items ?? [];
1073
+ const match = contentSlug ? items.find((p) => p.slug === contentSlug) : items.find((p) => p.tags?.includes(contentTag));
1074
+ setContentPage(match ?? null);
1075
+ }
1076
+ if (docsResult.status === "rejected") {
1077
+ setDocs([]);
1078
+ } else if (docsResult.status === "fulfilled") {
1079
+ const items = docsResult.value.data?.publicPressKitAssets?.items ?? [];
1080
+ const filtered = items.filter(
1081
+ (d) => d.category === "DOCUMENT" && d.tags?.includes(documentsTag) && !!d.fileUrl
1082
+ ).sort(
1083
+ (a, b) => a.sortOrder - b.sortOrder
1084
+ );
1085
+ setDocs(filtered);
1086
+ }
1087
+ setLoading(false);
1088
+ });
1089
+ return () => {
1090
+ cancelled = true;
1091
+ };
1092
+ }, [client, resolvedProductId, contentSlug, contentTag, documentsTag]);
1093
+ let partnerCategories;
1094
+ if (contactCategory === false) {
1095
+ partnerCategories = [];
1096
+ } else if (Array.isArray(contactCategory)) {
1097
+ partnerCategories = contactCategory.length > 0 ? contactCategory : [DEFAULT_PARTNER_CATEGORY];
1098
+ } else {
1099
+ partnerCategories = [contactCategory ?? DEFAULT_PARTNER_CATEGORY];
1100
+ }
1101
+ return /* @__PURE__ */ jsxs("div", { className, children: [
1102
+ /* @__PURE__ */ jsx(
1103
+ PageHead,
1104
+ {
1105
+ title: seoTitle ?? `${heroTitle} \u2014 ${resolvedProductName}`,
1106
+ description: seoDescription ?? heroSubtitle ?? `Join the ${resolvedProductName} partner programme.`,
1107
+ keywords: seoKeywords
1108
+ }
1109
+ ),
1110
+ /* @__PURE__ */ jsx(PartnerHero, { title: heroTitle, subtitle: heroSubtitle }),
1111
+ !loading && contentPage && /* @__PURE__ */ jsx(PartnerContentSection, { page: contentPage }),
1112
+ !loading && docs.length > 0 && /* @__PURE__ */ jsx(
1113
+ PartnerDocumentsSection,
1114
+ {
1115
+ title: documentsTitle,
1116
+ subtitle: documentsSubtitle,
1117
+ docs
1118
+ }
1119
+ ),
1120
+ showContactForm && /* @__PURE__ */ jsx(
1121
+ ContactPage,
1122
+ {
1123
+ productName: resolvedProductName,
1124
+ heroTitle: formTitle,
1125
+ headingLevel: 2,
1126
+ heroDescription: formSubtitle ?? `Tell us about your organisation and a partner manager from ${resolvedProductName} will be in touch.`,
1127
+ contactEmail,
1128
+ contactPhone,
1129
+ officeAddress,
1130
+ responseTime,
1131
+ recaptchaSiteKey,
1132
+ additionalOptions,
1133
+ categories: partnerCategories,
1134
+ categoryLabel: "Partnership type",
1135
+ categoryRequired: partnerCategories.length > 0
1136
+ }
1137
+ )
1138
+ ] });
1139
+ }
1140
+
1141
+ export { PartnersPage, stripLeadingHeading };
1142
+ //# sourceMappingURL=partners.mjs.map
1143
+ //# sourceMappingURL=partners.mjs.map