@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,806 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var lucideReact = require('lucide-react');
5
+ var ReCAPTCHA = require('react-google-recaptcha');
6
+ var sonner = require('sonner');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var reactHelmetAsync = require('react-helmet-async');
9
+ var reactSlot = require('@radix-ui/react-slot');
10
+ var classVarianceAuthority = require('class-variance-authority');
11
+ var clsx = require('clsx');
12
+ var tailwindMerge = require('tailwind-merge');
13
+ var LabelPrimitive = require('@radix-ui/react-label');
14
+
15
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
+
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n.default = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
+ var ReCAPTCHA__default = /*#__PURE__*/_interopDefault(ReCAPTCHA);
37
+ var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
38
+
39
+ var __defProp = Object.defineProperty;
40
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
41
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
42
+
43
+ // src/client/security.ts
44
+ var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
45
+ var RESERVED_HEADERS = /* @__PURE__ */ new Set([
46
+ "authorization",
47
+ "cookie",
48
+ "x-actor-id",
49
+ "x-actor-type",
50
+ "x-consent-granted-by",
51
+ "x-consent-scope",
52
+ "x-consent-granted-at",
53
+ "x-consent-expires-at"
54
+ ]);
55
+ function validateGatewayUrl(value) {
56
+ let url;
57
+ try {
58
+ url = new URL(value);
59
+ } catch {
60
+ throw new Error("Gateway URL must be a valid absolute URL");
61
+ }
62
+ if (url.protocol === "https:") {
63
+ return url.toString();
64
+ }
65
+ if (url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname.toLowerCase())) {
66
+ return url.toString();
67
+ }
68
+ throw new Error("Gateway URL must use HTTPS unless it targets localhost");
69
+ }
70
+ function sanitizeHeaders(headers) {
71
+ if (!headers) return void 0;
72
+ return Object.fromEntries(
73
+ Object.entries(headers).filter(
74
+ ([key]) => !RESERVED_HEADERS.has(key.toLowerCase())
75
+ )
76
+ );
77
+ }
78
+
79
+ // src/client/graphql-client.ts
80
+ var _WebSDKClient = class _WebSDKClient {
81
+ constructor(config) {
82
+ __publicField(this, "config");
83
+ __publicField(this, "queryCache", /* @__PURE__ */ new Map());
84
+ __publicField(this, "inflight", /* @__PURE__ */ new Map());
85
+ this.config = {
86
+ ...config,
87
+ gatewayUrl: validateGatewayUrl(config.gatewayUrl),
88
+ headers: sanitizeHeaders(config.headers)
89
+ };
90
+ }
91
+ getConfig() {
92
+ return this.config;
93
+ }
94
+ /**
95
+ * Execute a GraphQL query (with deduplication and caching)
96
+ */
97
+ async query(query, variables) {
98
+ const cacheKey = JSON.stringify({ query, variables });
99
+ const cached = this.queryCache.get(cacheKey);
100
+ if (cached) {
101
+ if (Date.now() - cached.ts < _WebSDKClient.CACHE_TTL) {
102
+ return cached.data;
103
+ }
104
+ this.queryCache.delete(cacheKey);
105
+ }
106
+ const existing = this.inflight.get(cacheKey);
107
+ if (existing) {
108
+ return existing;
109
+ }
110
+ const promise = this.request(query, variables).then((result) => {
111
+ if (result.data && !result.errors?.length) {
112
+ if (this.queryCache.size >= _WebSDKClient.MAX_CACHE_ENTRIES) {
113
+ const oldestEntry = this.queryCache.keys().next().value;
114
+ if (oldestEntry) {
115
+ this.queryCache.delete(oldestEntry);
116
+ }
117
+ }
118
+ this.queryCache.set(cacheKey, { data: result, ts: Date.now() });
119
+ }
120
+ return result;
121
+ }).finally(() => {
122
+ this.inflight.delete(cacheKey);
123
+ });
124
+ this.inflight.set(cacheKey, promise);
125
+ return promise;
126
+ }
127
+ /**
128
+ * Execute a GraphQL mutation
129
+ */
130
+ async mutate(mutation, variables) {
131
+ return this.request(mutation, variables);
132
+ }
133
+ async request(query, variables) {
134
+ try {
135
+ const response = await fetch(this.config.gatewayUrl, {
136
+ method: "POST",
137
+ headers: {
138
+ "Content-Type": "application/json",
139
+ "x-product-id": this.config.productId,
140
+ ...this.config.headers
141
+ },
142
+ body: JSON.stringify({ query, variables })
143
+ });
144
+ if (!response.ok) {
145
+ console.error(
146
+ "[WebSDK] GraphQL request failed",
147
+ response.status,
148
+ response.statusText
149
+ );
150
+ return {
151
+ errors: [
152
+ {
153
+ message: `HTTP ${response.status}: ${response.statusText}`,
154
+ extensions: { code: `HTTP_${response.status}` }
155
+ }
156
+ ]
157
+ };
158
+ }
159
+ return await response.json();
160
+ } catch (error) {
161
+ console.error(
162
+ "[WebSDK] Network error",
163
+ error instanceof Error ? error.message : "unknown error"
164
+ );
165
+ return {
166
+ errors: [
167
+ {
168
+ message: error instanceof Error ? error.message : "Network error",
169
+ extensions: { code: "NETWORK_ERROR" }
170
+ }
171
+ ]
172
+ };
173
+ }
174
+ }
175
+ };
176
+ __publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
177
+ // 5 minutes
178
+ __publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
179
+ var WebSDKContext = React.createContext(null);
180
+ function useWebSDK() {
181
+ const client = React.useContext(WebSDKContext);
182
+ if (!client) {
183
+ throw new Error("useWebSDK must be used within a WebSDKProvider");
184
+ }
185
+ return client;
186
+ }
187
+ function useWebSDKConfig() {
188
+ const client = useWebSDK();
189
+ return client.getConfig();
190
+ }
191
+ var ProductContext = React.createContext({
192
+ product: null,
193
+ loading: true,
194
+ error: null,
195
+ hasProvider: false,
196
+ refetch: () => {
197
+ }
198
+ });
199
+ function useProduct() {
200
+ return React.useContext(ProductContext);
201
+ }
202
+ function PageHead({
203
+ title,
204
+ description,
205
+ productName,
206
+ keywords,
207
+ image,
208
+ url,
209
+ favicon,
210
+ robots = "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1",
211
+ locale = "en_US",
212
+ twitterHandle,
213
+ themeColor = "#000000",
214
+ structuredData,
215
+ additionalMeta
216
+ }) {
217
+ const fullTitle = productName && !title.includes(productName) ? `${title} | ${productName}` : title;
218
+ const fullImageUrl = image && !image.startsWith("http") && url ? `${url.replace(/\/$/, "")}${image}` : image;
219
+ const structuredDataItems = structuredData ? Array.isArray(structuredData) ? structuredData : [structuredData] : [];
220
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [
221
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: fullTitle }),
222
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "title", content: fullTitle }),
223
+ description && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "description", content: description }),
224
+ keywords && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "keywords", content: keywords }),
225
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "author", content: "Burdenoff Consultancy Services Pvt Ltd" }),
226
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "robots", content: robots }),
227
+ url && /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "canonical", href: url }),
228
+ favicon && /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "icon", href: favicon }),
229
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:type", content: "website" }),
230
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:title", content: fullTitle }),
231
+ description && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:description", content: description }),
232
+ fullImageUrl && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:image", content: fullImageUrl }),
233
+ url && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:url", content: url }),
234
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:locale", content: locale }),
235
+ productName && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:site_name", content: productName }),
236
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:card", content: "summary_large_image" }),
237
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:title", content: fullTitle }),
238
+ description && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:description", content: description }),
239
+ fullImageUrl && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:image", content: fullImageUrl }),
240
+ twitterHandle && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:creator", content: twitterHandle }),
241
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "theme-color", content: themeColor }),
242
+ structuredDataItems.map((data, index) => /* @__PURE__ */ jsxRuntime.jsx("script", { type: "application/ld+json", children: JSON.stringify(data) }, `ld-${index}`)),
243
+ additionalMeta?.map((meta, index) => /* @__PURE__ */ jsxRuntime.jsx(
244
+ "meta",
245
+ {
246
+ ...meta.name ? { name: meta.name } : {},
247
+ ...meta.property ? { property: meta.property } : {},
248
+ content: meta.content
249
+ },
250
+ `meta-${index}`
251
+ ))
252
+ ] });
253
+ }
254
+ function cn(...inputs) {
255
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
256
+ }
257
+ var buttonVariants = classVarianceAuthority.cva(
258
+ "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",
259
+ {
260
+ variants: {
261
+ variant: {
262
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
263
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
264
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
265
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
266
+ ghost: "hover:bg-accent hover:text-accent-foreground",
267
+ link: "text-primary underline-offset-4 hover:underline"
268
+ },
269
+ size: {
270
+ default: "h-9 px-4 py-2",
271
+ sm: "h-8 rounded-md px-3 text-xs",
272
+ lg: "h-10 rounded-md px-8",
273
+ icon: "h-9 w-9"
274
+ }
275
+ },
276
+ defaultVariants: {
277
+ variant: "default",
278
+ size: "default"
279
+ }
280
+ }
281
+ );
282
+ var Button = React__namespace.forwardRef(
283
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
284
+ const Comp = asChild ? reactSlot.Slot : "button";
285
+ return /* @__PURE__ */ jsxRuntime.jsx(
286
+ Comp,
287
+ {
288
+ className: cn(buttonVariants({ variant, size, className })),
289
+ ref,
290
+ ...props
291
+ }
292
+ );
293
+ }
294
+ );
295
+ Button.displayName = "Button";
296
+ var Input = React__namespace.forwardRef(
297
+ ({ className, type, ...props }, ref) => {
298
+ return /* @__PURE__ */ jsxRuntime.jsx(
299
+ "input",
300
+ {
301
+ type,
302
+ className: cn(
303
+ "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",
304
+ className
305
+ ),
306
+ ref,
307
+ ...props
308
+ }
309
+ );
310
+ }
311
+ );
312
+ Input.displayName = "Input";
313
+ var labelVariants = classVarianceAuthority.cva(
314
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
315
+ );
316
+ var Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
317
+ LabelPrimitive__namespace.Root,
318
+ {
319
+ ref,
320
+ className: cn(labelVariants(), className),
321
+ ...props
322
+ }
323
+ ));
324
+ Label.displayName = LabelPrimitive__namespace.Root.displayName;
325
+ var Select = React__namespace.forwardRef(({ className, children, ...props }, ref) => {
326
+ return /* @__PURE__ */ jsxRuntime.jsx(
327
+ "select",
328
+ {
329
+ className: cn(
330
+ "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",
331
+ // Inline SVG chevron: SVG inside a `background-image: url(data:…)`
332
+ // does NOT inherit `currentColor` from the host element (the SVG is
333
+ // its own document with no parent CSS context), so the stroke is
334
+ // hardcoded to a muted slate-400 (#94a3b8). Matches the muted
335
+ // foreground token visually in both light and dark themes well
336
+ // enough for a passive chevron — addresses #9 review feedback.
337
+ `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>")]`,
338
+ className
339
+ ),
340
+ ref,
341
+ ...props,
342
+ children
343
+ }
344
+ );
345
+ });
346
+ Select.displayName = "Select";
347
+ var Textarea = React__namespace.forwardRef(({ className, ...props }, ref) => {
348
+ return /* @__PURE__ */ jsxRuntime.jsx(
349
+ "textarea",
350
+ {
351
+ className: cn(
352
+ "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",
353
+ className
354
+ ),
355
+ ref,
356
+ ...props
357
+ }
358
+ );
359
+ });
360
+ Textarea.displayName = "Textarea";
361
+ var DEFAULT_CONTACT_CATEGORIES = [
362
+ { value: "general", label: "General enquiry" },
363
+ { value: "sales", label: "Sales" },
364
+ { value: "support", label: "Support" },
365
+ { value: "partnership", label: "Partnership" },
366
+ { value: "press", label: "Press / media" },
367
+ { value: "careers", label: "Careers" },
368
+ { value: "security", label: "Security disclosure" }
369
+ ];
370
+ var SUBMIT_CONTACT_INQUIRY_MUTATION = (
371
+ /* GraphQL */
372
+ `
373
+ mutation SubmitContactInquiry($input: SubmitContactInquiryInput!) {
374
+ submitContactInquiry(input: $input) {
375
+ success
376
+ message
377
+ }
378
+ }
379
+ `
380
+ );
381
+ async function submitContactForm(client, data, productId) {
382
+ try {
383
+ const result = await client.mutate(SUBMIT_CONTACT_INQUIRY_MUTATION, {
384
+ input: {
385
+ name: `${data.firstName} ${data.lastName}`,
386
+ email: data.email.trim().toLowerCase(),
387
+ company: data.company || void 0,
388
+ subject: data.subject,
389
+ message: data.message,
390
+ productId,
391
+ // Send `category` only when the user actually picked one. Older
392
+ // backend deployments without the `category` field in the
393
+ // `SubmitContactInquiryInput` schema would reject any unknown
394
+ // field; spreading conditionally keeps the SDK forward-
395
+ // compatible.
396
+ ...data.category ? { category: data.category } : {},
397
+ ...data.recaptchaToken ? { recaptchaToken: data.recaptchaToken } : {}
398
+ }
399
+ });
400
+ if (result.errors?.length) {
401
+ const errorMsg = result.errors[0]?.message ?? "Failed to send message";
402
+ return { success: false, message: errorMsg };
403
+ }
404
+ const response = result.data?.submitContactInquiry;
405
+ if (response?.success) {
406
+ return {
407
+ success: true,
408
+ message: response.message || "Message sent successfully!"
409
+ };
410
+ }
411
+ return {
412
+ success: false,
413
+ message: response?.message || "Failed to send message"
414
+ };
415
+ } catch (error) {
416
+ console.error("Contact form submission error:", error);
417
+ return {
418
+ success: false,
419
+ message: "Network error. Please try again."
420
+ };
421
+ }
422
+ }
423
+ function replacePlaceholders(text, productName, email) {
424
+ return text.replace(/{productName}/g, productName).replace(/{email}/g, email);
425
+ }
426
+ function ContactPage({
427
+ productName,
428
+ recaptchaSiteKey,
429
+ contactEmail,
430
+ contactPhone,
431
+ officeAddress,
432
+ responseTime = "We typically respond within 24 hours",
433
+ heroTitle = "Get in Touch",
434
+ 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.",
435
+ headingLevel = 1,
436
+ // Backward-compatibility: default to `[]` so existing consumers
437
+ // (fluidgrids/burdenoff/algoshred websites) that don't pass
438
+ // `categories` continue to render with NO dropdown — same behavior
439
+ // they had before this SDK version. To opt in, pass an explicit
440
+ // `categories={…}` array (or the exported `DEFAULT_CONTACT_CATEGORIES`
441
+ // constant for the sane Burdenoff-generic vocabulary).
442
+ categories = [],
443
+ categoryLabel = "Category",
444
+ categoryPlaceholder = "Select a category",
445
+ categoryRequired = true,
446
+ additionalOptions = [
447
+ {
448
+ title: "Sales Inquiries",
449
+ description: "Ready to see {productName} in action? Our sales team is here to help.",
450
+ buttonText: "Contact Sales",
451
+ buttonLink: `mailto:${contactEmail}`
452
+ },
453
+ {
454
+ title: "Technical Support",
455
+ description: "Need help with your {productName} setup? Our support team is ready.",
456
+ buttonText: "Get Support",
457
+ buttonLink: `mailto:${contactEmail}`
458
+ },
459
+ {
460
+ title: "Partnership",
461
+ description: "Interested in partnering with {productName}? Let's explore opportunities.",
462
+ buttonText: "Partner With Us",
463
+ buttonLink: `mailto:${contactEmail}`
464
+ }
465
+ ],
466
+ seo
467
+ }) {
468
+ const client = useWebSDK();
469
+ const config = useWebSDKConfig();
470
+ const { product } = useProduct();
471
+ const resolvedProductId = product?.id || config.productId;
472
+ const displayName = productName ?? product?.name ?? config.productId;
473
+ const effectiveRecaptchaSiteKey = recaptchaSiteKey ?? product?.recaptchaSiteKey ?? config.recaptchaSiteKey ?? "";
474
+ const recaptchaRef = React.useRef(null);
475
+ const [isSubmitting, setIsSubmitting] = React.useState(false);
476
+ const [submitStatus, setSubmitStatus] = React.useState("idle");
477
+ const handleSubmit = async (e) => {
478
+ e.preventDefault();
479
+ const recaptchaToken = recaptchaRef.current?.getValue() ?? "";
480
+ if (effectiveRecaptchaSiteKey && !recaptchaToken) {
481
+ sonner.toast.error("Please complete the reCAPTCHA verification");
482
+ return;
483
+ }
484
+ setIsSubmitting(true);
485
+ setSubmitStatus("idle");
486
+ const form = e.currentTarget;
487
+ try {
488
+ const formData = new FormData(form);
489
+ const showCategory = categories.length > 0;
490
+ const rawCategory = showCategory ? (formData.get("category") ?? "").trim() : "";
491
+ if (showCategory && categoryRequired && !rawCategory) {
492
+ sonner.toast.error("Please select a category");
493
+ setIsSubmitting(false);
494
+ return;
495
+ }
496
+ const contactData = {
497
+ firstName: formData.get("firstName"),
498
+ lastName: formData.get("lastName"),
499
+ email: formData.get("email"),
500
+ company: formData.get("company"),
501
+ category: rawCategory || void 0,
502
+ subject: formData.get("subject"),
503
+ message: formData.get("message"),
504
+ recaptchaToken
505
+ };
506
+ const result = await submitContactForm(
507
+ client,
508
+ contactData,
509
+ resolvedProductId
510
+ );
511
+ if (result.success) {
512
+ setSubmitStatus("success");
513
+ sonner.toast.success(
514
+ result.message ?? `Thank you for contacting ${displayName}. We'll get back to you within 24 hours.`
515
+ );
516
+ if (form) {
517
+ form.reset();
518
+ }
519
+ recaptchaRef.current?.reset();
520
+ } else {
521
+ setSubmitStatus("error");
522
+ sonner.toast.error(
523
+ result.message ?? "Failed to send message. Please try again."
524
+ );
525
+ recaptchaRef.current?.reset();
526
+ }
527
+ } catch (error) {
528
+ console.error("Error submitting form:", error);
529
+ setSubmitStatus("error");
530
+ sonner.toast.error("Failed to send message. Please try again later.");
531
+ recaptchaRef.current?.reset();
532
+ } finally {
533
+ setIsSubmitting(false);
534
+ }
535
+ };
536
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
537
+ seo && /* @__PURE__ */ jsxRuntime.jsx(
538
+ PageHead,
539
+ {
540
+ title: seo.title ?? `Contact ${displayName} - Get in Touch With Our Team`,
541
+ 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.`,
542
+ productName: displayName,
543
+ keywords: seo.keywords ?? `contact ${displayName.toLowerCase()}, sales inquiries, customer support, technical support, partnership opportunities, get in touch`,
544
+ image: seo.image ?? "/og-image-contact.png",
545
+ url: seo.url
546
+ }
547
+ ),
548
+ /* @__PURE__ */ jsxRuntime.jsx(
549
+ "section",
550
+ {
551
+ 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",
552
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center max-w-3xl mx-auto", children: [
553
+ headingLevel === 2 ? /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl md:text-3xl font-bold mb-3", children: heroTitle }) : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl sm:text-4xl md:text-5xl font-bold mb-4 sm:mb-6", children: heroTitle }),
554
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg sm:text-xl text-muted-foreground leading-relaxed", children: replacePlaceholders(heroDescription, displayName, contactEmail) })
555
+ ] }) })
556
+ }
557
+ ),
558
+ /* @__PURE__ */ jsxRuntime.jsx("section", { className: "py-12 sm:py-16 md:py-20 lg:py-24", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid sm:grid-cols-1 lg:grid-cols-3 gap-8 sm:gap-10 lg:gap-12", children: [
559
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lg:col-span-1 order-2 lg:order-1", children: [
560
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl sm:text-2xl font-bold mb-4 sm:mb-6", children: "Contact Information" }),
561
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 sm:space-y-6", children: [
562
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
563
+ /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(lucideReact.Mail, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
564
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
565
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Email" }),
566
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm sm:text-base break-all", children: contactEmail })
567
+ ] })
568
+ ] }),
569
+ contactPhone && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
570
+ /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(lucideReact.Phone, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
571
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
572
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Phone" }),
573
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm sm:text-base", children: contactPhone })
574
+ ] })
575
+ ] }),
576
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
577
+ /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(lucideReact.MapPin, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
578
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
579
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Office" }),
580
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm sm:text-base leading-relaxed", children: [
581
+ officeAddress.line1,
582
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
583
+ officeAddress.line2,
584
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
585
+ officeAddress.line3,
586
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
587
+ officeAddress.country
588
+ ] })
589
+ ] })
590
+ ] }),
591
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start space-x-3 sm:space-x-4", children: [
592
+ /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-4 w-4 sm:h-5 sm:w-5 text-primary" }) }),
593
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
594
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold mb-1 text-sm sm:text-base", children: "Response Time" }),
595
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm sm:text-base", children: responseTime })
596
+ ] })
597
+ ] })
598
+ ] })
599
+ ] }),
600
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:col-span-2 order-1 lg:order-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-card border rounded-lg p-4 sm:p-6 md:p-8", children: [
601
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl sm:text-2xl font-bold mb-4 sm:mb-6", children: "Send us a Message" }),
602
+ /* @__PURE__ */ jsxRuntime.jsxs(
603
+ "form",
604
+ {
605
+ onSubmit: handleSubmit,
606
+ className: "space-y-4 sm:space-y-6",
607
+ children: [
608
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid sm:grid-cols-2 gap-4 sm:gap-6", children: [
609
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
610
+ /* @__PURE__ */ jsxRuntime.jsx(
611
+ Label,
612
+ {
613
+ htmlFor: "firstName",
614
+ className: "text-sm sm:text-base",
615
+ children: "First Name *"
616
+ }
617
+ ),
618
+ /* @__PURE__ */ jsxRuntime.jsx(
619
+ Input,
620
+ {
621
+ id: "firstName",
622
+ name: "firstName",
623
+ required: true,
624
+ placeholder: "John",
625
+ className: "text-sm sm:text-base"
626
+ }
627
+ )
628
+ ] }),
629
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
630
+ /* @__PURE__ */ jsxRuntime.jsx(
631
+ Label,
632
+ {
633
+ htmlFor: "lastName",
634
+ className: "text-sm sm:text-base",
635
+ children: "Last Name *"
636
+ }
637
+ ),
638
+ /* @__PURE__ */ jsxRuntime.jsx(
639
+ Input,
640
+ {
641
+ id: "lastName",
642
+ name: "lastName",
643
+ required: true,
644
+ placeholder: "Doe",
645
+ className: "text-sm sm:text-base"
646
+ }
647
+ )
648
+ ] })
649
+ ] }),
650
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
651
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "email", className: "text-sm sm:text-base", children: "Email *" }),
652
+ /* @__PURE__ */ jsxRuntime.jsx(
653
+ Input,
654
+ {
655
+ id: "email",
656
+ name: "email",
657
+ type: "email",
658
+ required: true,
659
+ placeholder: "john@company.com",
660
+ className: "text-sm sm:text-base"
661
+ }
662
+ )
663
+ ] }),
664
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
665
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "company", className: "text-sm sm:text-base", children: "Company" }),
666
+ /* @__PURE__ */ jsxRuntime.jsx(
667
+ Input,
668
+ {
669
+ id: "company",
670
+ name: "company",
671
+ placeholder: "Acme Inc.",
672
+ className: "text-sm sm:text-base"
673
+ }
674
+ )
675
+ ] }),
676
+ categories.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
677
+ /* @__PURE__ */ jsxRuntime.jsxs(
678
+ Label,
679
+ {
680
+ htmlFor: "category",
681
+ className: "text-sm sm:text-base",
682
+ children: [
683
+ categoryLabel,
684
+ categoryRequired ? " *" : ""
685
+ ]
686
+ }
687
+ ),
688
+ /* @__PURE__ */ jsxRuntime.jsxs(
689
+ Select,
690
+ {
691
+ id: "category",
692
+ name: "category",
693
+ required: categoryRequired,
694
+ defaultValue: "",
695
+ className: "text-sm sm:text-base",
696
+ children: [
697
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: categoryRequired, children: categoryPlaceholder }),
698
+ categories.map((c) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: c.value, children: c.label }, c.value))
699
+ ]
700
+ }
701
+ )
702
+ ] }),
703
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
704
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "subject", className: "text-sm sm:text-base", children: "Subject *" }),
705
+ /* @__PURE__ */ jsxRuntime.jsx(
706
+ Input,
707
+ {
708
+ id: "subject",
709
+ name: "subject",
710
+ required: true,
711
+ placeholder: "How can we help you?",
712
+ className: "text-sm sm:text-base"
713
+ }
714
+ )
715
+ ] }),
716
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
717
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "message", className: "text-sm sm:text-base", children: "Message *" }),
718
+ /* @__PURE__ */ jsxRuntime.jsx(
719
+ Textarea,
720
+ {
721
+ id: "message",
722
+ name: "message",
723
+ required: true,
724
+ placeholder: "Tell us more about your needs...",
725
+ rows: 5,
726
+ className: "text-sm sm:text-base min-h-[120px] sm:min-h-[150px] resize-y"
727
+ }
728
+ )
729
+ ] }),
730
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
731
+ effectiveRecaptchaSiteKey && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center sm:justify-start", children: /* @__PURE__ */ jsxRuntime.jsx(
732
+ ReCAPTCHA__default.default,
733
+ {
734
+ ref: recaptchaRef,
735
+ sitekey: effectiveRecaptchaSiteKey
736
+ }
737
+ ) }),
738
+ /* @__PURE__ */ jsxRuntime.jsx(
739
+ Button,
740
+ {
741
+ type: "submit",
742
+ size: "lg",
743
+ disabled: isSubmitting,
744
+ className: "w-full sm:w-auto min-w-[200px]",
745
+ children: isSubmitting ? "Sending..." : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
746
+ "Send Message ",
747
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "ml-2 h-4 w-4" })
748
+ ] })
749
+ }
750
+ )
751
+ ] }),
752
+ submitStatus === "success" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 sm:p-4 bg-green-50 border border-green-200 rounded-lg text-green-800 mt-4", children: [
753
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-sm sm:text-base", children: "Message sent successfully!" }),
754
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs sm:text-sm mt-1", children: [
755
+ "Thank you for contacting ",
756
+ displayName,
757
+ ". We'll get back to you within 24 hours."
758
+ ] })
759
+ ] }),
760
+ submitStatus === "error" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 sm:p-4 bg-red-50 border border-red-200 rounded-lg text-red-800 mt-4", children: [
761
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-sm sm:text-base", children: "Failed to send message" }),
762
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs sm:text-sm mt-1", children: [
763
+ "Please try again later or contact us directly at",
764
+ " ",
765
+ contactEmail
766
+ ] })
767
+ ] })
768
+ ]
769
+ }
770
+ )
771
+ ] }) })
772
+ ] }) }) }),
773
+ additionalOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("section", { className: "py-12 sm:py-16 md:py-20 lg:py-24 bg-muted/30", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
774
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl sm:text-3xl font-bold text-center mb-8 sm:mb-12", children: "More Ways to Connect" }),
775
+ /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs(
776
+ "div",
777
+ {
778
+ className: "text-center p-4 sm:p-6 bg-card border rounded-lg",
779
+ children: [
780
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-base sm:text-lg mb-2", children: option.title }),
781
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm sm:text-base mb-4 leading-relaxed", children: replacePlaceholders(
782
+ option.description,
783
+ displayName,
784
+ contactEmail
785
+ ) }),
786
+ /* @__PURE__ */ jsxRuntime.jsx(
787
+ Button,
788
+ {
789
+ variant: "outline",
790
+ asChild: true,
791
+ className: "text-sm sm:text-base",
792
+ children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: option.buttonLink, children: option.buttonText })
793
+ }
794
+ )
795
+ ]
796
+ },
797
+ index
798
+ )) })
799
+ ] }) })
800
+ ] });
801
+ }
802
+
803
+ exports.ContactPage = ContactPage;
804
+ exports.DEFAULT_CONTACT_CATEGORIES = DEFAULT_CONTACT_CATEGORIES;
805
+ //# sourceMappingURL=contact.js.map
806
+ //# sourceMappingURL=contact.js.map