@burdenoff/website-sdk 2026.1101.1 → 2026.1101.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +42 -8
  2. package/dist/analytics/index.js +19 -69
  3. package/dist/analytics/index.js.map +1 -1
  4. package/dist/analytics/index.mjs +3 -69
  5. package/dist/analytics/index.mjs.map +1 -1
  6. package/dist/avatar-live/index.js +1 -0
  7. package/dist/avatar-live/index.js.map +1 -1
  8. package/dist/avatar-live/index.mjs +1 -0
  9. package/dist/avatar-live/index.mjs.map +1 -1
  10. package/dist/avatar-live-view/index.js +10 -30
  11. package/dist/avatar-live-view/index.js.map +1 -1
  12. package/dist/avatar-live-view/index.mjs +4 -24
  13. package/dist/avatar-live-view/index.mjs.map +1 -1
  14. package/dist/chunk-23H4JUL4.js +41 -0
  15. package/dist/chunk-23H4JUL4.js.map +1 -0
  16. package/dist/chunk-34RX5P75.mjs +25 -0
  17. package/dist/chunk-34RX5P75.mjs.map +1 -0
  18. package/dist/chunk-3LFFY7AZ.js +184 -0
  19. package/dist/chunk-3LFFY7AZ.js.map +1 -0
  20. package/dist/chunk-3X26GE4S.js +2794 -0
  21. package/dist/chunk-3X26GE4S.js.map +1 -0
  22. package/dist/chunk-45GCA4GG.js +85 -0
  23. package/dist/chunk-45GCA4GG.js.map +1 -0
  24. package/dist/chunk-4SAGVLHN.js +876 -0
  25. package/dist/chunk-4SAGVLHN.js.map +1 -0
  26. package/dist/chunk-4U6YAII5.js +218 -0
  27. package/dist/chunk-4U6YAII5.js.map +1 -0
  28. package/dist/chunk-5GMTBOO6.js +21 -0
  29. package/dist/chunk-5GMTBOO6.js.map +1 -0
  30. package/dist/chunk-5JRJ57CL.mjs +329 -0
  31. package/dist/chunk-5JRJ57CL.mjs.map +1 -0
  32. package/dist/chunk-6C2DKIC7.js +4 -0
  33. package/dist/chunk-6C2DKIC7.js.map +1 -0
  34. package/dist/chunk-6IBFBWC5.mjs +17 -0
  35. package/dist/chunk-6IBFBWC5.mjs.map +1 -0
  36. package/dist/chunk-6KY2ZRVI.js +116 -0
  37. package/dist/chunk-6KY2ZRVI.js.map +1 -0
  38. package/dist/chunk-6VJT3SM4.mjs +182 -0
  39. package/dist/chunk-6VJT3SM4.mjs.map +1 -0
  40. package/dist/chunk-6YZUFMK2.mjs +40 -0
  41. package/dist/chunk-6YZUFMK2.mjs.map +1 -0
  42. package/dist/chunk-7A6R7CGG.js +47 -0
  43. package/dist/chunk-7A6R7CGG.js.map +1 -0
  44. package/dist/chunk-7PWL4V2R.js +4 -0
  45. package/dist/chunk-7PWL4V2R.js.map +1 -0
  46. package/dist/chunk-AA33WDYS.js +161 -0
  47. package/dist/chunk-AA33WDYS.js.map +1 -0
  48. package/dist/chunk-AHRGFXV2.js +525 -0
  49. package/dist/chunk-AHRGFXV2.js.map +1 -0
  50. package/dist/chunk-B63XLDZH.mjs +109 -0
  51. package/dist/chunk-B63XLDZH.mjs.map +1 -0
  52. package/dist/chunk-BX2USEWF.mjs +35 -0
  53. package/dist/chunk-BX2USEWF.mjs.map +1 -0
  54. package/dist/chunk-BYSZT35R.js +150 -0
  55. package/dist/chunk-BYSZT35R.js.map +1 -0
  56. package/dist/chunk-C6OJIHNO.js +12 -0
  57. package/dist/chunk-C6OJIHNO.js.map +1 -0
  58. package/dist/chunk-COOELBX7.mjs +63 -0
  59. package/dist/chunk-COOELBX7.mjs.map +1 -0
  60. package/dist/chunk-D2TW7MNC.mjs +2771 -0
  61. package/dist/chunk-D2TW7MNC.mjs.map +1 -0
  62. package/dist/chunk-D5KEZ6V6.mjs +3 -0
  63. package/dist/chunk-D5KEZ6V6.mjs.map +1 -0
  64. package/dist/chunk-E3GUGJMY.js +46 -0
  65. package/dist/chunk-E3GUGJMY.js.map +1 -0
  66. package/dist/chunk-EBZ2HGJ2.mjs +52 -0
  67. package/dist/chunk-EBZ2HGJ2.mjs.map +1 -0
  68. package/dist/chunk-EDLTUOIA.mjs +210 -0
  69. package/dist/chunk-EDLTUOIA.mjs.map +1 -0
  70. package/dist/chunk-EJQSOT4X.js +4 -0
  71. package/dist/chunk-EJQSOT4X.js.map +1 -0
  72. package/dist/chunk-EUPFS6MZ.mjs +2019 -0
  73. package/dist/chunk-EUPFS6MZ.mjs.map +1 -0
  74. package/dist/chunk-F3XWDC3B.js +77 -0
  75. package/dist/chunk-F3XWDC3B.js.map +1 -0
  76. package/dist/chunk-FFADMVIK.mjs +5127 -0
  77. package/dist/chunk-FFADMVIK.mjs.map +1 -0
  78. package/dist/chunk-FJWS7BKT.mjs +3 -0
  79. package/dist/chunk-FJWS7BKT.mjs.map +1 -0
  80. package/dist/chunk-FJZJDUOR.mjs +3 -0
  81. package/dist/chunk-FJZJDUOR.mjs.map +1 -0
  82. package/dist/chunk-GCFLCO2Z.mjs +145 -0
  83. package/dist/chunk-GCFLCO2Z.mjs.map +1 -0
  84. package/dist/chunk-GEXC4LRP.js +61 -0
  85. package/dist/chunk-GEXC4LRP.js.map +1 -0
  86. package/dist/chunk-GTRAXQGC.mjs +3 -0
  87. package/dist/chunk-GTRAXQGC.mjs.map +1 -0
  88. package/dist/chunk-IKOIRUKW.js +270 -0
  89. package/dist/chunk-IKOIRUKW.js.map +1 -0
  90. package/dist/chunk-IXTWOPRN.js +45 -0
  91. package/dist/chunk-IXTWOPRN.js.map +1 -0
  92. package/dist/chunk-JDXOXGOK.js +547 -0
  93. package/dist/chunk-JDXOXGOK.js.map +1 -0
  94. package/dist/chunk-JSLDWYV7.mjs +558 -0
  95. package/dist/chunk-JSLDWYV7.mjs.map +1 -0
  96. package/dist/chunk-JXLSTVBK.js +336 -0
  97. package/dist/chunk-JXLSTVBK.js.map +1 -0
  98. package/dist/chunk-KHYXK7FG.mjs +49 -0
  99. package/dist/chunk-KHYXK7FG.mjs.map +1 -0
  100. package/dist/chunk-KSMBOWQQ.js +2034 -0
  101. package/dist/chunk-KSMBOWQQ.js.map +1 -0
  102. package/dist/chunk-KU2PXHGB.mjs +83 -0
  103. package/dist/chunk-KU2PXHGB.mjs.map +1 -0
  104. package/dist/chunk-KZANIV3S.mjs +37 -0
  105. package/dist/chunk-KZANIV3S.mjs.map +1 -0
  106. package/dist/chunk-L4BP6YOB.js +20 -0
  107. package/dist/chunk-L4BP6YOB.js.map +1 -0
  108. package/dist/chunk-MRKA2OAF.mjs +75 -0
  109. package/dist/chunk-MRKA2OAF.mjs.map +1 -0
  110. package/dist/chunk-N5EC53MH.mjs +80 -0
  111. package/dist/chunk-N5EC53MH.mjs.map +1 -0
  112. package/dist/chunk-NZANQGDM.mjs +34 -0
  113. package/dist/chunk-NZANQGDM.mjs.map +1 -0
  114. package/dist/chunk-O4GS3XPZ.js +10 -0
  115. package/dist/chunk-O4GS3XPZ.js.map +1 -0
  116. package/dist/chunk-O76QDGRM.js +5154 -0
  117. package/dist/chunk-O76QDGRM.js.map +1 -0
  118. package/dist/chunk-OYEUNZJY.js +114 -0
  119. package/dist/chunk-OYEUNZJY.js.map +1 -0
  120. package/dist/chunk-PHXAGQNB.js +74 -0
  121. package/dist/chunk-PHXAGQNB.js.map +1 -0
  122. package/dist/chunk-PIHHPP7J.mjs +16 -0
  123. package/dist/chunk-PIHHPP7J.mjs.map +1 -0
  124. package/dist/chunk-PXRHVVOU.mjs +499 -0
  125. package/dist/chunk-PXRHVVOU.mjs.map +1 -0
  126. package/dist/chunk-QMA6U6AU.js +36 -0
  127. package/dist/chunk-QMA6U6AU.js.map +1 -0
  128. package/dist/chunk-R6J7IULF.js +44 -0
  129. package/dist/chunk-R6J7IULF.js.map +1 -0
  130. package/dist/chunk-R7G6TWIS.mjs +10 -0
  131. package/dist/chunk-R7G6TWIS.mjs.map +1 -0
  132. package/dist/chunk-RUMGFI6L.mjs +544 -0
  133. package/dist/chunk-RUMGFI6L.mjs.map +1 -0
  134. package/dist/chunk-S54JWSJF.js +565 -0
  135. package/dist/chunk-S54JWSJF.js.map +1 -0
  136. package/dist/chunk-SK5UGG6A.js +2041 -0
  137. package/dist/chunk-SK5UGG6A.js.map +1 -0
  138. package/dist/chunk-SKIYDKIS.mjs +70 -0
  139. package/dist/chunk-SKIYDKIS.mjs.map +1 -0
  140. package/dist/chunk-SZNS5IK6.mjs +322 -0
  141. package/dist/chunk-SZNS5IK6.mjs.map +1 -0
  142. package/dist/chunk-T7JIPZAC.js +66 -0
  143. package/dist/chunk-T7JIPZAC.js.map +1 -0
  144. package/dist/chunk-TGYQHO2E.mjs +864 -0
  145. package/dist/chunk-TGYQHO2E.mjs.map +1 -0
  146. package/dist/chunk-TT3MHN42.mjs +8 -0
  147. package/dist/chunk-TT3MHN42.mjs.map +1 -0
  148. package/dist/chunk-UM55U65W.mjs +268 -0
  149. package/dist/chunk-UM55U65W.mjs.map +1 -0
  150. package/dist/chunk-UQ2HALUD.js +72 -0
  151. package/dist/chunk-UQ2HALUD.js.map +1 -0
  152. package/dist/chunk-UXWT7G77.js +82 -0
  153. package/dist/chunk-UXWT7G77.js.map +1 -0
  154. package/dist/chunk-VNS5WDWO.mjs +7 -0
  155. package/dist/chunk-VNS5WDWO.mjs.map +1 -0
  156. package/dist/chunk-VRWZLGR7.js +4 -0
  157. package/dist/chunk-VRWZLGR7.js.map +1 -0
  158. package/dist/chunk-VZLDSNH4.mjs +22 -0
  159. package/dist/chunk-VZLDSNH4.mjs.map +1 -0
  160. package/dist/chunk-W6P3YETJ.js +92 -0
  161. package/dist/chunk-W6P3YETJ.js.map +1 -0
  162. package/dist/chunk-WPKFFQCR.mjs +90 -0
  163. package/dist/chunk-WPKFFQCR.mjs.map +1 -0
  164. package/dist/chunk-WTVTI5TO.mjs +22 -0
  165. package/dist/chunk-WTVTI5TO.mjs.map +1 -0
  166. package/dist/chunk-XJOBZ4RJ.js +44 -0
  167. package/dist/chunk-XJOBZ4RJ.js.map +1 -0
  168. package/dist/chunk-XP2JDNDU.js +325 -0
  169. package/dist/chunk-XP2JDNDU.js.map +1 -0
  170. package/dist/chunk-Y4V5CEWD.mjs +112 -0
  171. package/dist/chunk-Y4V5CEWD.mjs.map +1 -0
  172. package/dist/chunk-YERN2UWM.js +116 -0
  173. package/dist/chunk-YERN2UWM.js.map +1 -0
  174. package/dist/chunk-ZKJQWFAA.mjs +114 -0
  175. package/dist/chunk-ZKJQWFAA.mjs.map +1 -0
  176. package/dist/chunk-ZOON3S3Y.mjs +138 -0
  177. package/dist/chunk-ZOON3S3Y.mjs.map +1 -0
  178. package/dist/chunk-ZP6QRAYC.mjs +2024 -0
  179. package/dist/chunk-ZP6QRAYC.mjs.map +1 -0
  180. package/dist/chunk-ZSTFX7FV.js +9 -0
  181. package/dist/chunk-ZSTFX7FV.js.map +1 -0
  182. package/dist/client/index.js +23 -331
  183. package/dist/client/index.js.map +1 -1
  184. package/dist/client/index.mjs +3 -330
  185. package/dist/client/index.mjs.map +1 -1
  186. package/dist/comparison/index.js +28 -111
  187. package/dist/comparison/index.js.map +1 -1
  188. package/dist/comparison/index.mjs +2 -107
  189. package/dist/comparison/index.mjs.map +1 -1
  190. package/dist/components/contact.js +21 -931
  191. package/dist/components/contact.js.map +1 -1
  192. package/dist/components/contact.mjs +12 -909
  193. package/dist/components/contact.mjs.map +1 -1
  194. package/dist/components/electron-download.js +12 -124
  195. package/dist/components/electron-download.js.map +1 -1
  196. package/dist/components/electron-download.mjs +4 -106
  197. package/dist/components/electron-download.mjs.map +1 -1
  198. package/dist/components/explore-cta.js +8 -112
  199. package/dist/components/explore-cta.js.map +1 -1
  200. package/dist/components/explore-cta.mjs +3 -114
  201. package/dist/components/explore-cta.mjs.map +1 -1
  202. package/dist/components/explore.js +62 -7833
  203. package/dist/components/explore.js.map +1 -1
  204. package/dist/components/explore.mjs +13 -7800
  205. package/dist/components/explore.mjs.map +1 -1
  206. package/dist/components/launch-countdown.js +8 -83
  207. package/dist/components/launch-countdown.js.map +1 -1
  208. package/dist/components/launch-countdown.mjs +3 -85
  209. package/dist/components/launch-countdown.mjs.map +1 -1
  210. package/dist/components/newsletter.js +20 -993
  211. package/dist/components/newsletter.js.map +1 -1
  212. package/dist/components/newsletter.mjs +11 -971
  213. package/dist/components/newsletter.mjs.map +1 -1
  214. package/dist/components/partners.js +24 -1302
  215. package/dist/components/partners.js.map +1 -1
  216. package/dist/components/partners.mjs +15 -1276
  217. package/dist/components/partners.mjs.map +1 -1
  218. package/dist/components/pricing.js +49 -1249
  219. package/dist/components/pricing.js.map +1 -1
  220. package/dist/components/pricing.mjs +8 -1226
  221. package/dist/components/pricing.mjs.map +1 -1
  222. package/dist/components/problems-solved.js +8 -150
  223. package/dist/components/problems-solved.js.map +1 -1
  224. package/dist/components/problems-solved.mjs +4 -133
  225. package/dist/components/problems-solved.mjs.map +1 -1
  226. package/dist/components/resource-links.js +8 -304
  227. package/dist/components/resource-links.js.map +1 -1
  228. package/dist/components/resource-links.mjs +5 -308
  229. package/dist/components/resource-links.mjs.map +1 -1
  230. package/dist/components/social-links.js +8 -343
  231. package/dist/components/social-links.js.map +1 -1
  232. package/dist/components/social-links.mjs +5 -347
  233. package/dist/components/social-links.mjs.map +1 -1
  234. package/dist/components/unsubscribe.js +10 -627
  235. package/dist/components/unsubscribe.js.map +1 -1
  236. package/dist/components/unsubscribe.mjs +6 -611
  237. package/dist/components/unsubscribe.mjs.map +1 -1
  238. package/dist/components/waitlist.js +21 -1001
  239. package/dist/components/waitlist.js.map +1 -1
  240. package/dist/components/waitlist.mjs +12 -982
  241. package/dist/components/waitlist.mjs.map +1 -1
  242. package/dist/components/website-switcher.js +12 -175
  243. package/dist/components/website-switcher.js.map +1 -1
  244. package/dist/components/website-switcher.mjs +4 -157
  245. package/dist/components/website-switcher.mjs.map +1 -1
  246. package/dist/content/index.js +118 -3616
  247. package/dist/content/index.js.map +1 -1
  248. package/dist/content/index.mjs +12 -3567
  249. package/dist/content/index.mjs.map +1 -1
  250. package/dist/hooks/index.js +37 -2321
  251. package/dist/hooks/index.js.map +1 -1
  252. package/dist/hooks/index.mjs +6 -2318
  253. package/dist/hooks/index.mjs.map +1 -1
  254. package/dist/index.d.mts +1 -1
  255. package/dist/index.d.ts +1 -1
  256. package/dist/index.js +4145 -20599
  257. package/dist/index.js.map +1 -1
  258. package/dist/index.mjs +3766 -20567
  259. package/dist/index.mjs.map +1 -1
  260. package/dist/product/index.js +20 -393
  261. package/dist/product/index.js.map +1 -1
  262. package/dist/product/index.mjs +5 -394
  263. package/dist/product/index.mjs.map +1 -1
  264. package/dist/seo/index.js +8 -76
  265. package/dist/seo/index.js.map +1 -1
  266. package/dist/seo/index.mjs +3 -78
  267. package/dist/seo/index.mjs.map +1 -1
  268. package/dist/store/index.js +51 -2650
  269. package/dist/store/index.js.map +1 -1
  270. package/dist/store/index.mjs +13 -2619
  271. package/dist/store/index.mjs.map +1 -1
  272. package/dist/utils/index.js +69 -134
  273. package/dist/utils/index.js.map +1 -1
  274. package/dist/utils/index.mjs +5 -122
  275. package/dist/utils/index.mjs.map +1 -1
  276. package/package.json +2 -1
@@ -1,984 +1,14 @@
1
- import * as React from 'react';
2
- import { createContext, useState, useContext, useRef } from 'react';
3
- import { zodResolver } from '@hookform/resolvers/zod';
4
- import { useForm } from 'react-hook-form';
5
- import { toast } from 'sonner';
6
- import { z } from 'zod';
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
- import { Helmet } from 'react-helmet-async';
9
- import { Slot } from '@radix-ui/react-slot';
10
- import { cva } from 'class-variance-authority';
11
- import { clsx } from 'clsx';
12
- import { twMerge } from 'tailwind-merge';
13
- import * as LabelPrimitive from '@radix-ui/react-label';
14
-
15
- var __defProp = Object.defineProperty;
16
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
18
-
19
- // src/analytics/events.ts
20
- var MAX_PROPERTY_LENGTH = 64;
21
- var EMAIL_LIKE = /[^\s@]+@[^\s@]+/;
22
- function sanitizeWebsiteEventProperties(properties) {
23
- const safe = {};
24
- if (!properties) return safe;
25
- for (const [key, value] of Object.entries(properties)) {
26
- if (typeof value === "boolean") {
27
- safe[key] = value;
28
- } else if (typeof value === "number") {
29
- if (Number.isFinite(value)) safe[key] = value;
30
- } else if (typeof value === "string") {
31
- const trimmed = value.trim();
32
- if (trimmed.length > 0 && trimmed.length <= MAX_PROPERTY_LENGTH && !EMAIL_LIKE.test(trimmed)) {
33
- safe[key] = trimmed;
34
- }
35
- }
36
- }
37
- return safe;
38
- }
39
- function trackWebsiteEvent(name, properties) {
40
- if (typeof window === "undefined") return false;
41
- try {
42
- const rybbit = window.rybbit;
43
- if (typeof rybbit?.event !== "function") return false;
44
- const safe = sanitizeWebsiteEventProperties(properties);
45
- if (Object.keys(safe).length > 0) {
46
- rybbit.event(name, safe);
47
- } else {
48
- rybbit.event(name);
49
- }
50
- return true;
51
- } catch {
52
- return false;
53
- }
54
- }
55
-
56
- // src/client/security.ts
57
- var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
58
- var RESERVED_HEADERS = /* @__PURE__ */ new Set([
59
- "authorization",
60
- "cookie",
61
- "x-actor-id",
62
- "x-actor-type",
63
- "x-consent-granted-by",
64
- "x-consent-scope",
65
- "x-consent-granted-at",
66
- "x-consent-expires-at"
67
- ]);
68
- function validateGatewayUrl(value) {
69
- let url;
70
- try {
71
- url = new URL(value);
72
- } catch {
73
- throw new Error("Gateway URL must be a valid absolute URL");
74
- }
75
- if (url.protocol === "https:") {
76
- return url.toString();
77
- }
78
- if (url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname.toLowerCase())) {
79
- return url.toString();
80
- }
81
- throw new Error("Gateway URL must use HTTPS unless it targets localhost");
82
- }
83
- function sanitizeHeaders(headers) {
84
- if (!headers) return void 0;
85
- return Object.fromEntries(
86
- Object.entries(headers).filter(
87
- ([key]) => !RESERVED_HEADERS.has(key.toLowerCase())
88
- )
89
- );
90
- }
91
- var CF_ACCESS_GATED_HOSTS = /* @__PURE__ */ new Set([
92
- "alphagraphql.burdenoff.com",
93
- "alphagraphqlworkspaces.burdenoff.com"
94
- ]);
95
- function cfAccessHeaders(gatewayUrl, cfAccess) {
96
- const clientId = cfAccess?.clientId?.trim();
97
- const clientSecret = cfAccess?.clientSecret?.trim();
98
- if (!clientId || !clientSecret) return {};
99
- let host;
100
- try {
101
- host = new URL(gatewayUrl).hostname.toLowerCase();
102
- } catch {
103
- return {};
104
- }
105
- if (!CF_ACCESS_GATED_HOSTS.has(host)) return {};
106
- return {
107
- "CF-Access-Client-Id": clientId,
108
- "CF-Access-Client-Secret": clientSecret
109
- };
110
- }
111
-
112
- // src/client/graphql-client.ts
113
- var _WebSDKClient = class _WebSDKClient {
114
- constructor(config) {
115
- __publicField(this, "config");
116
- __publicField(this, "queryCache", /* @__PURE__ */ new Map());
117
- __publicField(this, "inflight", /* @__PURE__ */ new Map());
118
- this.config = {
119
- ...config,
120
- gatewayUrl: validateGatewayUrl(config.gatewayUrl),
121
- headers: sanitizeHeaders(config.headers)
122
- };
123
- }
124
- getConfig() {
125
- return this.config;
126
- }
127
- /**
128
- * Execute a GraphQL query (with deduplication and caching).
129
- *
130
- * Pass `{ cache: false }` to bypass the cache entirely — required for poll
131
- * loops, where every tick must reach the network.
132
- */
133
- async query(query, variables, options) {
134
- if (options?.cache === false) {
135
- return this.request(query, variables, true, options.timeoutMs);
136
- }
137
- const cacheKey = JSON.stringify({ query, variables });
138
- const cached = this.queryCache.get(cacheKey);
139
- if (cached) {
140
- if (Date.now() - cached.ts < _WebSDKClient.CACHE_TTL) {
141
- return cached.data;
142
- }
143
- this.queryCache.delete(cacheKey);
144
- }
145
- const existing = this.inflight.get(cacheKey);
146
- if (existing) {
147
- return existing;
148
- }
149
- const promise = this.request(query, variables, true, options?.timeoutMs).then((result) => {
150
- if (result.data && !result.errors?.length) {
151
- if (this.queryCache.size >= _WebSDKClient.MAX_CACHE_ENTRIES) {
152
- const oldestEntry = this.queryCache.keys().next().value;
153
- if (oldestEntry) {
154
- this.queryCache.delete(oldestEntry);
155
- }
156
- }
157
- this.queryCache.set(cacheKey, { data: result, ts: Date.now() });
158
- }
159
- return result;
160
- }).finally(() => {
161
- this.inflight.delete(cacheKey);
162
- });
163
- this.inflight.set(cacheKey, promise);
164
- return promise;
165
- }
166
- /**
167
- * Execute a GraphQL mutation
168
- */
169
- async mutate(mutation, variables, options) {
170
- return this.request(mutation, variables, false, options?.timeoutMs);
171
- }
172
- /** HTTP statuses worth another attempt — transient server/edge conditions. */
173
- static isRetriableStatus(status) {
174
- return status === 429 || status === 408 || status >= 500 && status < 600;
175
- }
176
- static sleep(ms) {
177
- return new Promise((resolve) => setTimeout(resolve, ms));
178
- }
179
- /**
180
- * Perform the HTTP call with a hard timeout. Every outcome resolves to a
181
- * GraphQLResponse — callers never hang, so a UI's `loading` state always
182
- * settles into data or a renderable error.
183
- */
184
- async attempt(query, variables, timeoutMs) {
185
- const controller = new AbortController();
186
- const timer = setTimeout(() => controller.abort(), timeoutMs);
187
- try {
188
- const response = await fetch(this.config.gatewayUrl, {
189
- method: "POST",
190
- headers: {
191
- "Content-Type": "application/json",
192
- "x-product-id": this.config.productId,
193
- ...this.config.headers,
194
- ...cfAccessHeaders(this.config.gatewayUrl, this.config.cfAccess)
195
- },
196
- body: JSON.stringify({ query, variables }),
197
- signal: controller.signal
198
- });
199
- if (!response.ok) {
200
- console.error(
201
- "[WebSDK] GraphQL request failed",
202
- response.status,
203
- response.statusText
204
- );
205
- return {
206
- res: {
207
- errors: [
208
- {
209
- message: `HTTP ${response.status}: ${response.statusText}`,
210
- extensions: { code: `HTTP_${response.status}` }
211
- }
212
- ]
213
- },
214
- retriable: _WebSDKClient.isRetriableStatus(response.status)
215
- };
216
- }
217
- return {
218
- res: await response.json(),
219
- retriable: false
220
- };
221
- } catch (error) {
222
- const aborted = error instanceof Error && (error.name === "AbortError" || controller.signal.aborted);
223
- const message = aborted ? `Request timed out after ${timeoutMs}ms` : error instanceof Error ? error.message : "Network error";
224
- console.error("[WebSDK] Network error", message);
225
- return {
226
- res: {
227
- errors: [
228
- {
229
- message,
230
- extensions: { code: aborted ? "TIMEOUT" : "NETWORK_ERROR" }
231
- }
232
- ]
233
- },
234
- // Transport-level failures are worth one more try; a genuine outage
235
- // just fails twice quickly and still renders an error state.
236
- retriable: true
237
- };
238
- } finally {
239
- clearTimeout(timer);
240
- }
241
- }
242
- async request(query, variables, retry = true, timeoutOverrideMs) {
243
- const timeoutMs = timeoutOverrideMs ?? this.config.timeoutMs ?? _WebSDKClient.DEFAULT_TIMEOUT_MS;
244
- const maxRetries = retry ? this.config.maxRetries ?? _WebSDKClient.DEFAULT_MAX_RETRIES : 0;
245
- let last;
246
- for (let i = 0; i <= maxRetries; i++) {
247
- const { res, retriable } = await this.attempt(
248
- query,
249
- variables,
250
- timeoutMs
251
- );
252
- if (!retriable || i === maxRetries) return res;
253
- last = res;
254
- await _WebSDKClient.sleep(
255
- _WebSDKClient.RETRY_BASE_DELAY_MS * (i + 1) + Math.random() * 200
256
- );
257
- }
258
- return last;
259
- }
260
- };
261
- __publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
262
- // 5 minutes
263
- __publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
264
- __publicField(_WebSDKClient, "DEFAULT_TIMEOUT_MS", 12e3);
265
- __publicField(_WebSDKClient, "DEFAULT_MAX_RETRIES", 1);
266
- __publicField(_WebSDKClient, "RETRY_BASE_DELAY_MS", 400);
267
- var WebSDKContext = createContext(null);
268
- function useWebSDK() {
269
- const client = useContext(WebSDKContext);
270
- if (!client) {
271
- throw new Error("useWebSDK must be used within a WebSDKProvider");
272
- }
273
- return client;
274
- }
275
- function useWebSDKConfig() {
276
- const client = useWebSDK();
277
- return client.getConfig();
278
- }
279
-
280
- // src/utils/product-slug.ts
281
- var PRODUCT_SLUG_RENAMES = Object.freeze(
282
- [Object.freeze({ legacy: "botlit", current: "botmanor" })]
283
- );
284
- Object.freeze(
285
- Object.fromEntries(PRODUCT_SLUG_RENAMES.map((r) => [r.legacy, r.current]))
286
- );
287
- var ProductContext = createContext({
288
- product: null,
289
- loading: true,
290
- error: null,
291
- hasProvider: false,
292
- refetch: () => {
293
- }
294
- });
295
- function useProduct() {
296
- return useContext(ProductContext);
297
- }
298
- function canonicalFromLocation() {
299
- if (typeof window === "undefined" || !window.location) return void 0;
300
- const { origin, pathname } = window.location;
301
- if (!origin || origin === "null") return void 0;
302
- const path = pathname === "/" ? "/" : pathname.replace(/\/+$/, "");
303
- return `${origin}${path}`;
304
- }
305
- function resolveImageUrl(image, base) {
306
- if (!image || /^https?:\/\//i.test(image)) return image;
307
- if (!base) return image;
308
- try {
309
- return new URL(image, base).toString();
310
- } catch {
311
- return image;
312
- }
313
- }
314
- function serializeJsonLd(data) {
315
- return JSON.stringify(data).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
316
- }
317
- function PageHead({
318
- title,
319
- description,
320
- productName,
321
- keywords,
322
- image,
323
- url,
324
- favicon,
325
- robots = "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1",
326
- locale = "en_US",
327
- twitterHandle,
328
- themeColor = "#000000",
329
- author,
330
- structuredData,
331
- additionalMeta
332
- }) {
333
- const fullTitle = productName && !title.includes(productName) ? `${title} | ${productName}` : title;
334
- const resolvedUrl = url ?? canonicalFromLocation();
335
- const fullImageUrl = resolveImageUrl(image, resolvedUrl);
336
- const structuredDataItems = structuredData ? Array.isArray(structuredData) ? structuredData : [structuredData] : [];
337
- return /* @__PURE__ */ jsxs(Helmet, { children: [
338
- /* @__PURE__ */ jsx("title", { children: fullTitle }),
339
- /* @__PURE__ */ jsx("meta", { name: "title", content: fullTitle }),
340
- description ? /* @__PURE__ */ jsx("meta", { name: "description", content: description }) : null,
341
- keywords ? /* @__PURE__ */ jsx("meta", { name: "keywords", content: keywords }) : null,
342
- author ? /* @__PURE__ */ jsx("meta", { name: "author", content: author }) : null,
343
- /* @__PURE__ */ jsx("meta", { name: "robots", content: robots }),
344
- resolvedUrl ? /* @__PURE__ */ jsx("link", { rel: "canonical", href: resolvedUrl }) : null,
345
- favicon ? /* @__PURE__ */ jsx("link", { rel: "icon", href: favicon }) : null,
346
- /* @__PURE__ */ jsx("meta", { property: "og:type", content: "website" }),
347
- /* @__PURE__ */ jsx("meta", { property: "og:title", content: fullTitle }),
348
- description ? /* @__PURE__ */ jsx("meta", { property: "og:description", content: description }) : null,
349
- fullImageUrl ? /* @__PURE__ */ jsx("meta", { property: "og:image", content: fullImageUrl }) : null,
350
- resolvedUrl ? /* @__PURE__ */ jsx("meta", { property: "og:url", content: resolvedUrl }) : null,
351
- /* @__PURE__ */ jsx("meta", { property: "og:locale", content: locale }),
352
- productName ? /* @__PURE__ */ jsx("meta", { property: "og:site_name", content: productName }) : null,
353
- /* @__PURE__ */ jsx("meta", { name: "twitter:card", content: "summary_large_image" }),
354
- /* @__PURE__ */ jsx("meta", { name: "twitter:title", content: fullTitle }),
355
- description ? /* @__PURE__ */ jsx("meta", { name: "twitter:description", content: description }) : null,
356
- fullImageUrl ? /* @__PURE__ */ jsx("meta", { name: "twitter:image", content: fullImageUrl }) : null,
357
- twitterHandle ? /* @__PURE__ */ jsx("meta", { name: "twitter:creator", content: twitterHandle }) : null,
358
- /* @__PURE__ */ jsx("meta", { name: "theme-color", content: themeColor }),
359
- structuredDataItems.map((data, index) => /* @__PURE__ */ jsx("script", { type: "application/ld+json", children: serializeJsonLd(data) }, `ld-${index}`)),
360
- additionalMeta?.map((meta, index) => /* @__PURE__ */ jsx(
361
- "meta",
362
- {
363
- ...meta.name ? { name: meta.name } : {},
364
- ...meta.property ? { property: meta.property } : {},
365
- content: meta.content
366
- },
367
- `meta-${index}`
368
- ))
369
- ] });
370
- }
371
- function cn(...inputs) {
372
- return twMerge(clsx(inputs));
373
- }
374
- var buttonVariants = cva(
375
- "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",
376
- {
377
- variants: {
378
- variant: {
379
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
380
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
381
- outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
382
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
383
- ghost: "hover:bg-accent hover:text-accent-foreground",
384
- link: "text-primary underline-offset-4 hover:underline"
385
- },
386
- size: {
387
- default: "h-9 px-4 py-2",
388
- sm: "h-8 rounded-md px-3 text-xs",
389
- lg: "h-10 rounded-md px-8",
390
- icon: "h-9 w-9"
391
- }
392
- },
393
- defaultVariants: {
394
- variant: "default",
395
- size: "default"
396
- }
397
- }
398
- );
399
- var Button = React.forwardRef(
400
- ({ className, variant, size, asChild = false, ...props }, ref) => {
401
- const Comp = asChild ? Slot : "button";
402
- return /* @__PURE__ */ jsx(
403
- Comp,
404
- {
405
- className: cn(buttonVariants({ variant, size, className })),
406
- ref,
407
- ...props
408
- }
409
- );
410
- }
411
- );
412
- Button.displayName = "Button";
413
- var Input = React.forwardRef(
414
- ({ className, type, ...props }, ref) => {
415
- return /* @__PURE__ */ jsx(
416
- "input",
417
- {
418
- type,
419
- className: cn(
420
- "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",
421
- className
422
- ),
423
- ref,
424
- ...props
425
- }
426
- );
427
- }
428
- );
429
- Input.displayName = "Input";
430
- var labelVariants = cva(
431
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
432
- );
433
- var Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
434
- LabelPrimitive.Root,
435
- {
436
- ref,
437
- className: cn(labelVariants(), className),
438
- ...props
439
- }
440
- ));
441
- Label.displayName = LabelPrimitive.Root.displayName;
442
- var Textarea = React.forwardRef(({ className, ...props }, ref) => {
443
- return /* @__PURE__ */ jsx(
444
- "textarea",
445
- {
446
- className: cn(
447
- "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",
448
- className
449
- ),
450
- ref,
451
- ...props
452
- }
453
- );
454
- });
455
- Textarea.displayName = "Textarea";
456
- var waitlistPageSchema = z.object({
457
- name: z.string().min(1, "Name is required"),
458
- email: z.string().email("Please enter a valid email address"),
459
- company: z.string().optional(),
460
- reason: z.string().optional()
461
- });
462
- var JOIN_WAITLIST_MUTATION = (
463
- /* GraphQL */
464
- `
465
- mutation JoinWaitlist($input: JoinWaitlistInput!) {
466
- joinWaitlist(input: $input) {
467
- id
468
- email
469
- name
470
- status
471
- createdAt
472
- }
473
- }
474
- `
475
- );
476
- async function joinWaitlist(client, data, productId) {
477
- try {
478
- const result = await client.mutate(JOIN_WAITLIST_MUTATION, {
479
- input: {
480
- email: data.email.trim().toLowerCase(),
481
- platformProductId: productId,
482
- name: data.name?.trim() || void 0,
483
- company: data.company?.trim() || void 0,
484
- reason: data.reason?.trim() || void 0,
485
- context: {
486
- source: "website",
487
- referrer: typeof window !== "undefined" ? window.location.href : "",
488
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
489
- }
490
- }
491
- });
492
- if (result.errors?.length) {
493
- const errorMsg = result.errors[0]?.message ?? "Failed to join waitlist";
494
- if (errorMsg.toLowerCase().includes("already")) {
495
- return {
496
- success: false,
497
- message: "You are already on the waitlist!"
498
- };
499
- }
500
- return { success: false, message: errorMsg };
501
- }
502
- return { success: true, message: "You have been added to the waitlist!" };
503
- } catch (error) {
504
- console.error("Waitlist signup error:", error);
505
- return { success: false, message: "Network error. Please try again." };
506
- }
507
- }
508
- function useRateLimit(maxAttempts, windowMinutes) {
509
- const rateLimitRef = useRef(null);
510
- const [isLimited, setIsLimited] = useState(false);
511
- const [resetTime, setResetTime] = useState(null);
512
- function recordAttempt() {
513
- const now = Date.now();
514
- const state = rateLimitRef.current;
515
- if (state && now > state.resetTime) {
516
- rateLimitRef.current = null;
517
- }
518
- const current = rateLimitRef.current;
519
- if (!current) {
520
- rateLimitRef.current = {
521
- attempts: 1,
522
- resetTime: now + windowMinutes * 60 * 1e3
523
- };
524
- return false;
525
- }
526
- current.attempts += 1;
527
- if (current.attempts >= maxAttempts) {
528
- setIsLimited(true);
529
- setResetTime(new Date(current.resetTime));
530
- return true;
531
- }
532
- return false;
533
- }
534
- function checkLimit() {
535
- const state = rateLimitRef.current;
536
- if (!state) return false;
537
- if (Date.now() > state.resetTime) {
538
- rateLimitRef.current = null;
539
- setIsLimited(false);
540
- setResetTime(null);
541
- return false;
542
- }
543
- return state.attempts >= maxAttempts;
544
- }
545
- return { isLimited, resetTime, recordAttempt, checkLimit };
546
- }
547
- function WaitlistPage({
548
- productName,
549
- heroTitle = "Join the Waitlist",
550
- heroSubtitle = "Be among the first to experience what's coming next",
551
- heroDescription,
552
- successMessage = "You have been added to the waitlist!",
553
- errorMessage = "Failed to join waitlist. Please try again.",
554
- className,
555
- seo
556
- }) {
557
- const client = useWebSDK();
558
- const config = useWebSDKConfig();
559
- const {
560
- product,
561
- loading: productLoading,
562
- error: productError,
563
- hasProvider
564
- } = useProduct();
565
- const displayName = productName ?? product?.name ?? config.productId;
566
- const productStatus = product?.status;
567
- const canCheckStatus = Boolean(config.productSlug);
568
- const [isSubmitting, setIsSubmitting] = useState(false);
569
- const { isLimited, resetTime, recordAttempt, checkLimit } = useRateLimit(
570
- 3,
571
- 15
572
- );
573
- const {
574
- register,
575
- handleSubmit,
576
- formState: { errors },
577
- reset
578
- } = useForm({
579
- resolver: zodResolver(waitlistPageSchema)
580
- });
581
- if (canCheckStatus && !hasProvider) {
582
- return /* @__PURE__ */ jsxs("div", { className, children: [
583
- seo && /* @__PURE__ */ jsx(
584
- PageHead,
585
- {
586
- title: seo.title ?? "",
587
- description: seo.description ?? "",
588
- keywords: seo.keywords,
589
- image: seo.image,
590
- url: seo.url
591
- }
592
- ),
593
- /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden py-24 lg:py-32", children: /* @__PURE__ */ jsxs("div", { className: "relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center space-y-6", children: [
594
- /* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold tracking-tight sm:text-5xl text-foreground", children: "Waitlist Unavailable" }),
595
- /* @__PURE__ */ jsxs("p", { className: "text-lg text-muted-foreground", children: [
596
- "Product status checks require ",
597
- /* @__PURE__ */ jsx("code", { children: "ProductProvider" }),
598
- " to be mounted. Please update your integration configuration."
599
- ] })
600
- ] }) })
601
- ] });
602
- }
603
- if (canCheckStatus && productLoading) {
604
- return /* @__PURE__ */ jsxs("div", { className, children: [
605
- seo && /* @__PURE__ */ jsx(
606
- PageHead,
607
- {
608
- title: seo.title ?? "",
609
- description: seo.description ?? "",
610
- keywords: seo.keywords,
611
- image: seo.image,
612
- url: seo.url
613
- }
614
- ),
615
- /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden py-24 lg:py-32", children: /* @__PURE__ */ jsxs("div", { className: "relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center space-y-6", children: [
616
- /* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold tracking-tight sm:text-5xl text-foreground", children: "Loading\u2026" }),
617
- /* @__PURE__ */ jsx("p", { className: "text-lg text-muted-foreground", children: "Fetching product status." })
618
- ] }) })
619
- ] });
620
- }
621
- if (canCheckStatus && (productError || !productStatus)) {
622
- return /* @__PURE__ */ jsxs("div", { className, children: [
623
- seo && /* @__PURE__ */ jsx(
624
- PageHead,
625
- {
626
- title: seo.title ?? "",
627
- description: seo.description ?? "",
628
- keywords: seo.keywords,
629
- image: seo.image,
630
- url: seo.url
631
- }
632
- ),
633
- /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden py-24 lg:py-32", children: /* @__PURE__ */ jsxs("div", { className: "relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center space-y-6", children: [
634
- /* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold tracking-tight sm:text-5xl text-foreground", children: "Waitlist Unavailable" }),
635
- /* @__PURE__ */ jsx("p", { className: "text-lg text-muted-foreground", children: "We can\u2019t confirm waitlist availability right now. Please try again later." })
636
- ] }) })
637
- ] });
638
- }
639
- if (canCheckStatus && (productStatus === "ACTIVE" || productStatus === "RELEASED")) {
640
- const appUrl = product?.appUrl || product?.website || "#";
641
- return /* @__PURE__ */ jsxs("div", { className, children: [
642
- seo && /* @__PURE__ */ jsx(
643
- PageHead,
644
- {
645
- title: seo.title ?? "",
646
- description: seo.description ?? "",
647
- keywords: seo.keywords,
648
- image: seo.image,
649
- url: seo.url
650
- }
651
- ),
652
- /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden py-24 lg:py-32", children: /* @__PURE__ */ jsxs("div", { className: "relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center space-y-8", children: [
653
- /* @__PURE__ */ jsxs("h1", { className: "text-4xl font-bold tracking-tight sm:text-5xl text-foreground", children: [
654
- displayName,
655
- " is now available!"
656
- ] }),
657
- /* @__PURE__ */ jsxs("p", { className: "text-lg text-muted-foreground", children: [
658
- "Great news \u2014 ",
659
- displayName,
660
- " is open to everyone. Sign up or log in to get started."
661
- ] }),
662
- /* @__PURE__ */ jsx(Button, { size: "lg", asChild: true, children: /* @__PURE__ */ jsx("a", { href: appUrl, target: "_blank", rel: "noopener noreferrer", children: "Get Started" }) })
663
- ] }) })
664
- ] });
665
- }
666
- if (canCheckStatus && (productStatus === "DRAFT" || productStatus === "COMING_SOON")) {
667
- return /* @__PURE__ */ jsxs("div", { className, children: [
668
- seo && /* @__PURE__ */ jsx(
669
- PageHead,
670
- {
671
- title: seo.title ?? "",
672
- description: seo.description ?? "",
673
- keywords: seo.keywords,
674
- image: seo.image,
675
- url: seo.url
676
- }
677
- ),
678
- /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden py-24 lg:py-32", children: /* @__PURE__ */ jsxs("div", { className: "relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center space-y-8", children: [
679
- /* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold tracking-tight sm:text-5xl text-foreground", children: "Coming Soon" }),
680
- /* @__PURE__ */ jsxs("p", { className: "text-lg text-muted-foreground", children: [
681
- displayName,
682
- " is not yet accepting waitlist signups. Check back soon!"
683
- ] })
684
- ] }) })
685
- ] });
686
- }
687
- if (canCheckStatus && productStatus !== "WAITLIST") {
688
- return /* @__PURE__ */ jsxs("div", { className, children: [
689
- seo && /* @__PURE__ */ jsx(
690
- PageHead,
691
- {
692
- title: seo.title ?? "",
693
- description: seo.description ?? "",
694
- keywords: seo.keywords,
695
- image: seo.image,
696
- url: seo.url
697
- }
698
- ),
699
- /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden py-24 lg:py-32", children: /* @__PURE__ */ jsxs("div", { className: "relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 text-center space-y-6", children: [
700
- /* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold tracking-tight sm:text-5xl text-foreground", children: "Waitlist Unavailable" }),
701
- /* @__PURE__ */ jsxs("p", { className: "text-lg text-muted-foreground", children: [
702
- displayName,
703
- " is not accepting waitlist signups right now."
704
- ] })
705
- ] }) })
706
- ] });
707
- }
708
- const onSubmit = async (data) => {
709
- if (canCheckStatus && productStatus !== "WAITLIST") {
710
- toast.error("This product is not accepting waitlist signups right now.");
711
- return;
712
- }
713
- if (checkLimit()) {
714
- toast.error(
715
- `Too many attempts. Please try again after ${resetTime?.toLocaleTimeString()}`
716
- );
717
- return;
718
- }
719
- setIsSubmitting(true);
720
- try {
721
- const result = await joinWaitlist(
722
- client,
723
- data,
724
- product?.id || config.productId
725
- );
726
- if (result.success) {
727
- trackWebsiteEvent("waitlist.signed_up", { form: "page" });
728
- toast.success(result.message ?? successMessage);
729
- reset();
730
- } else {
731
- toast.error(result.message ?? errorMessage);
732
- }
733
- recordAttempt();
734
- } catch (_error) {
735
- toast.error(errorMessage);
736
- } finally {
737
- setIsSubmitting(false);
738
- }
739
- };
740
- return /* @__PURE__ */ jsxs(Fragment, { children: [
741
- seo && /* @__PURE__ */ jsx(
742
- PageHead,
743
- {
744
- title: seo.title ?? `Join the Waitlist - ${displayName}`,
745
- description: seo.description ?? heroDescription ?? heroSubtitle,
746
- productName: displayName,
747
- keywords: seo.keywords,
748
- image: seo.image,
749
- url: seo.url
750
- }
751
- ),
752
- /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("div", { className: "min-h-screen flex items-center justify-center px-4 py-12", children: /* @__PURE__ */ jsxs("div", { className: "max-w-lg w-full space-y-8", children: [
753
- /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
754
- /* @__PURE__ */ jsx("h1", { className: "text-4xl font-bold tracking-tight", children: heroTitle }),
755
- /* @__PURE__ */ jsx("p", { className: "mt-2 text-lg text-muted-foreground", children: heroSubtitle }),
756
- heroDescription && /* @__PURE__ */ jsx("p", { className: "mt-4 text-sm text-muted-foreground", children: heroDescription })
757
- ] }),
758
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-5", children: [
759
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
760
- /* @__PURE__ */ jsx(Label, { htmlFor: "waitlist-name", children: "Name *" }),
761
- /* @__PURE__ */ jsx(
762
- Input,
763
- {
764
- id: "waitlist-name",
765
- type: "text",
766
- placeholder: "Your name",
767
- disabled: isSubmitting || isLimited,
768
- ...register("name")
769
- }
770
- ),
771
- errors.name && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: errors.name.message })
772
- ] }),
773
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
774
- /* @__PURE__ */ jsx(Label, { htmlFor: "waitlist-email", children: "Email *" }),
775
- /* @__PURE__ */ jsx(
776
- Input,
777
- {
778
- id: "waitlist-email",
779
- type: "email",
780
- placeholder: "you@example.com",
781
- disabled: isSubmitting || isLimited,
782
- ...register("email")
783
- }
784
- ),
785
- errors.email && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: errors.email.message })
786
- ] }),
787
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
788
- /* @__PURE__ */ jsx(Label, { htmlFor: "waitlist-company", children: "Company" }),
789
- /* @__PURE__ */ jsx(
790
- Input,
791
- {
792
- id: "waitlist-company",
793
- type: "text",
794
- placeholder: "Your company (optional)",
795
- disabled: isSubmitting || isLimited,
796
- ...register("company")
797
- }
798
- )
799
- ] }),
800
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
801
- /* @__PURE__ */ jsx(Label, { htmlFor: "waitlist-reason", children: "Why are you interested?" }),
802
- /* @__PURE__ */ jsx(
803
- Textarea,
804
- {
805
- id: "waitlist-reason",
806
- placeholder: "Tell us what excites you about the product (optional)",
807
- rows: 3,
808
- disabled: isSubmitting || isLimited,
809
- className: "resize-y",
810
- ...register("reason")
811
- }
812
- )
813
- ] }),
814
- /* @__PURE__ */ jsx(
815
- Button,
816
- {
817
- type: "submit",
818
- className: "w-full",
819
- disabled: isSubmitting || isLimited,
820
- children: isSubmitting ? "Joining..." : "Join Waitlist"
821
- }
822
- ),
823
- isLimited && resetTime && /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground text-center", children: [
824
- "Rate limit reached. Try again after",
825
- " ",
826
- resetTime.toLocaleTimeString()
827
- ] })
828
- ] }),
829
- /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground text-center", children: [
830
- "By joining the waitlist, you agree to receive updates from",
831
- " ",
832
- displayName,
833
- ". We respect your privacy and will never share your information."
834
- ] })
835
- ] }) }) })
836
- ] });
837
- }
838
- function WaitlistForm({
839
- variant = "inline",
840
- showLabel = false,
841
- showDescription = false,
842
- showNameField = false,
843
- description = "Join our waitlist to get early access",
844
- buttonText = "Join Waitlist",
845
- className = ""
846
- }) {
847
- const client = useWebSDK();
848
- const config = useWebSDKConfig();
849
- const {
850
- product,
851
- loading: productLoading,
852
- error: productError,
853
- hasProvider
854
- } = useProduct();
855
- const productStatus = product?.status;
856
- const canCheckStatus = Boolean(config.productSlug);
857
- const [email, setEmail] = useState("");
858
- const [name, setName] = useState("");
859
- const [isLoading, setIsLoading] = useState(false);
860
- const handleSubmit = async (e) => {
861
- e.preventDefault();
862
- if (canCheckStatus && productStatus !== "WAITLIST") {
863
- toast.error("This product is not accepting waitlist signups right now.");
864
- return;
865
- }
866
- if (!email || !email.includes("@")) {
867
- toast.error("Please enter a valid email address");
868
- return;
869
- }
870
- setIsLoading(true);
871
- try {
872
- const result = await joinWaitlist(
873
- client,
874
- { email, name: name || void 0 },
875
- product?.id || config.productId
876
- );
877
- if (result.success) {
878
- trackWebsiteEvent("waitlist.signed_up", { form: "inline" });
879
- toast.success(result.message ?? "You have been added to the waitlist!");
880
- setEmail("");
881
- setName("");
882
- } else {
883
- toast.error(result.message ?? "Failed to join waitlist");
884
- }
885
- } catch (_error) {
886
- toast.error("An error occurred. Please try again.");
887
- } finally {
888
- setIsLoading(false);
889
- }
890
- };
891
- const isInline = variant === "inline";
892
- if (canCheckStatus && !hasProvider) {
893
- return /* @__PURE__ */ jsxs("div", { className, children: [
894
- showDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-3", children: description }),
895
- /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
896
- "Product status checks require ",
897
- /* @__PURE__ */ jsx("code", { children: "ProductProvider" }),
898
- " to be mounted."
899
- ] })
900
- ] });
901
- }
902
- if (canCheckStatus && productLoading) {
903
- return /* @__PURE__ */ jsxs("div", { className, children: [
904
- showDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-3", children: description }),
905
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Loading waitlist\u2026" })
906
- ] });
907
- }
908
- if (canCheckStatus && (productError || productStatus !== "WAITLIST")) {
909
- return /* @__PURE__ */ jsxs("div", { className, children: [
910
- showDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-3", children: description }),
911
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Waitlist signups are not available right now." })
912
- ] });
913
- }
914
- return /* @__PURE__ */ jsxs("div", { className, children: [
915
- showDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-3", children: description }),
916
- /* @__PURE__ */ jsxs(
917
- "form",
918
- {
919
- onSubmit: handleSubmit,
920
- className: isInline ? "flex gap-2" : "flex flex-col gap-2",
921
- children: [
922
- showNameField && /* @__PURE__ */ jsxs("div", { className: isInline ? "flex-1" : "w-full", children: [
923
- showLabel && /* @__PURE__ */ jsx(
924
- Label,
925
- {
926
- htmlFor: "waitlist-inline-name",
927
- className: "text-sm mb-1 block",
928
- children: "Name"
929
- }
930
- ),
931
- /* @__PURE__ */ jsx(
932
- Input,
933
- {
934
- id: "waitlist-inline-name",
935
- type: "text",
936
- placeholder: "Your name",
937
- value: name,
938
- onChange: (e) => setName(e.target.value),
939
- disabled: isLoading,
940
- className: "w-full"
941
- }
942
- )
943
- ] }),
944
- /* @__PURE__ */ jsxs("div", { className: isInline ? "flex-1" : "w-full", children: [
945
- showLabel && /* @__PURE__ */ jsx(
946
- Label,
947
- {
948
- htmlFor: "waitlist-inline-email",
949
- className: "text-sm mb-1 block",
950
- children: "Email"
951
- }
952
- ),
953
- /* @__PURE__ */ jsx(
954
- Input,
955
- {
956
- id: "waitlist-inline-email",
957
- type: "email",
958
- placeholder: "Enter your email",
959
- value: email,
960
- onChange: (e) => setEmail(e.target.value),
961
- disabled: isLoading,
962
- required: true,
963
- className: "w-full"
964
- }
965
- )
966
- ] }),
967
- /* @__PURE__ */ jsx(
968
- Button,
969
- {
970
- type: "submit",
971
- disabled: isLoading,
972
- className: isInline ? "whitespace-nowrap" : "w-full",
973
- children: isLoading ? "Joining..." : buttonText
974
- }
975
- )
976
- ]
977
- }
978
- )
979
- ] });
980
- }
981
-
982
- export { WaitlistForm, WaitlistPage };
1
+ export { WaitlistForm, WaitlistPage } from '../chunk-RUMGFI6L.mjs';
2
+ import '../chunk-6YZUFMK2.mjs';
3
+ import '../chunk-VZLDSNH4.mjs';
4
+ import '../chunk-WTVTI5TO.mjs';
5
+ import '../chunk-34RX5P75.mjs';
6
+ import '../chunk-N5EC53MH.mjs';
7
+ import '../chunk-KHYXK7FG.mjs';
8
+ import '../chunk-R7G6TWIS.mjs';
9
+ import '../chunk-GCFLCO2Z.mjs';
10
+ import '../chunk-KZANIV3S.mjs';
11
+ import '../chunk-5JRJ57CL.mjs';
12
+ import '../chunk-VNS5WDWO.mjs';
983
13
  //# sourceMappingURL=waitlist.mjs.map
984
14
  //# sourceMappingURL=waitlist.mjs.map