@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,613 +1,8 @@
1
- import * as React from 'react';
2
- import { createContext, useState, useEffect, useContext } from 'react';
3
- import { toast } from 'sonner';
4
- import { jsx, jsxs } from 'react/jsx-runtime';
5
- import { Helmet } from 'react-helmet-async';
6
- import { Slot } from '@radix-ui/react-slot';
7
- import { cva } from 'class-variance-authority';
8
- import { clsx } from 'clsx';
9
- import { twMerge } from 'tailwind-merge';
10
-
11
- var __defProp = Object.defineProperty;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
14
-
15
- // src/client/security.ts
16
- var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
17
- var RESERVED_HEADERS = /* @__PURE__ */ new Set([
18
- "authorization",
19
- "cookie",
20
- "x-actor-id",
21
- "x-actor-type",
22
- "x-consent-granted-by",
23
- "x-consent-scope",
24
- "x-consent-granted-at",
25
- "x-consent-expires-at"
26
- ]);
27
- function validateGatewayUrl(value) {
28
- let url;
29
- try {
30
- url = new URL(value);
31
- } catch {
32
- throw new Error("Gateway URL must be a valid absolute URL");
33
- }
34
- if (url.protocol === "https:") {
35
- return url.toString();
36
- }
37
- if (url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname.toLowerCase())) {
38
- return url.toString();
39
- }
40
- throw new Error("Gateway URL must use HTTPS unless it targets localhost");
41
- }
42
- function sanitizeHeaders(headers) {
43
- if (!headers) return void 0;
44
- return Object.fromEntries(
45
- Object.entries(headers).filter(
46
- ([key]) => !RESERVED_HEADERS.has(key.toLowerCase())
47
- )
48
- );
49
- }
50
- var CF_ACCESS_GATED_HOSTS = /* @__PURE__ */ new Set([
51
- "alphagraphql.burdenoff.com",
52
- "alphagraphqlworkspaces.burdenoff.com"
53
- ]);
54
- function cfAccessHeaders(gatewayUrl, cfAccess) {
55
- const clientId = cfAccess?.clientId?.trim();
56
- const clientSecret = cfAccess?.clientSecret?.trim();
57
- if (!clientId || !clientSecret) return {};
58
- let host;
59
- try {
60
- host = new URL(gatewayUrl).hostname.toLowerCase();
61
- } catch {
62
- return {};
63
- }
64
- if (!CF_ACCESS_GATED_HOSTS.has(host)) return {};
65
- return {
66
- "CF-Access-Client-Id": clientId,
67
- "CF-Access-Client-Secret": clientSecret
68
- };
69
- }
70
-
71
- // src/client/graphql-client.ts
72
- var _WebSDKClient = class _WebSDKClient {
73
- constructor(config) {
74
- __publicField(this, "config");
75
- __publicField(this, "queryCache", /* @__PURE__ */ new Map());
76
- __publicField(this, "inflight", /* @__PURE__ */ new Map());
77
- this.config = {
78
- ...config,
79
- gatewayUrl: validateGatewayUrl(config.gatewayUrl),
80
- headers: sanitizeHeaders(config.headers)
81
- };
82
- }
83
- getConfig() {
84
- return this.config;
85
- }
86
- /**
87
- * Execute a GraphQL query (with deduplication and caching).
88
- *
89
- * Pass `{ cache: false }` to bypass the cache entirely — required for poll
90
- * loops, where every tick must reach the network.
91
- */
92
- async query(query, variables, options) {
93
- if (options?.cache === false) {
94
- return this.request(query, variables, true, options.timeoutMs);
95
- }
96
- const cacheKey = JSON.stringify({ query, variables });
97
- const cached = this.queryCache.get(cacheKey);
98
- if (cached) {
99
- if (Date.now() - cached.ts < _WebSDKClient.CACHE_TTL) {
100
- return cached.data;
101
- }
102
- this.queryCache.delete(cacheKey);
103
- }
104
- const existing = this.inflight.get(cacheKey);
105
- if (existing) {
106
- return existing;
107
- }
108
- const promise = this.request(query, variables, true, options?.timeoutMs).then((result) => {
109
- if (result.data && !result.errors?.length) {
110
- if (this.queryCache.size >= _WebSDKClient.MAX_CACHE_ENTRIES) {
111
- const oldestEntry = this.queryCache.keys().next().value;
112
- if (oldestEntry) {
113
- this.queryCache.delete(oldestEntry);
114
- }
115
- }
116
- this.queryCache.set(cacheKey, { data: result, ts: Date.now() });
117
- }
118
- return result;
119
- }).finally(() => {
120
- this.inflight.delete(cacheKey);
121
- });
122
- this.inflight.set(cacheKey, promise);
123
- return promise;
124
- }
125
- /**
126
- * Execute a GraphQL mutation
127
- */
128
- async mutate(mutation, variables, options) {
129
- return this.request(mutation, variables, false, options?.timeoutMs);
130
- }
131
- /** HTTP statuses worth another attempt — transient server/edge conditions. */
132
- static isRetriableStatus(status) {
133
- return status === 429 || status === 408 || status >= 500 && status < 600;
134
- }
135
- static sleep(ms) {
136
- return new Promise((resolve) => setTimeout(resolve, ms));
137
- }
138
- /**
139
- * Perform the HTTP call with a hard timeout. Every outcome resolves to a
140
- * GraphQLResponse — callers never hang, so a UI's `loading` state always
141
- * settles into data or a renderable error.
142
- */
143
- async attempt(query, variables, timeoutMs) {
144
- const controller = new AbortController();
145
- const timer = setTimeout(() => controller.abort(), timeoutMs);
146
- try {
147
- const response = await fetch(this.config.gatewayUrl, {
148
- method: "POST",
149
- headers: {
150
- "Content-Type": "application/json",
151
- "x-product-id": this.config.productId,
152
- ...this.config.headers,
153
- ...cfAccessHeaders(this.config.gatewayUrl, this.config.cfAccess)
154
- },
155
- body: JSON.stringify({ query, variables }),
156
- signal: controller.signal
157
- });
158
- if (!response.ok) {
159
- console.error(
160
- "[WebSDK] GraphQL request failed",
161
- response.status,
162
- response.statusText
163
- );
164
- return {
165
- res: {
166
- errors: [
167
- {
168
- message: `HTTP ${response.status}: ${response.statusText}`,
169
- extensions: { code: `HTTP_${response.status}` }
170
- }
171
- ]
172
- },
173
- retriable: _WebSDKClient.isRetriableStatus(response.status)
174
- };
175
- }
176
- return {
177
- res: await response.json(),
178
- retriable: false
179
- };
180
- } catch (error) {
181
- const aborted = error instanceof Error && (error.name === "AbortError" || controller.signal.aborted);
182
- const message = aborted ? `Request timed out after ${timeoutMs}ms` : error instanceof Error ? error.message : "Network error";
183
- console.error("[WebSDK] Network error", message);
184
- return {
185
- res: {
186
- errors: [
187
- {
188
- message,
189
- extensions: { code: aborted ? "TIMEOUT" : "NETWORK_ERROR" }
190
- }
191
- ]
192
- },
193
- // Transport-level failures are worth one more try; a genuine outage
194
- // just fails twice quickly and still renders an error state.
195
- retriable: true
196
- };
197
- } finally {
198
- clearTimeout(timer);
199
- }
200
- }
201
- async request(query, variables, retry = true, timeoutOverrideMs) {
202
- const timeoutMs = timeoutOverrideMs ?? this.config.timeoutMs ?? _WebSDKClient.DEFAULT_TIMEOUT_MS;
203
- const maxRetries = retry ? this.config.maxRetries ?? _WebSDKClient.DEFAULT_MAX_RETRIES : 0;
204
- let last;
205
- for (let i = 0; i <= maxRetries; i++) {
206
- const { res, retriable } = await this.attempt(
207
- query,
208
- variables,
209
- timeoutMs
210
- );
211
- if (!retriable || i === maxRetries) return res;
212
- last = res;
213
- await _WebSDKClient.sleep(
214
- _WebSDKClient.RETRY_BASE_DELAY_MS * (i + 1) + Math.random() * 200
215
- );
216
- }
217
- return last;
218
- }
219
- };
220
- __publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
221
- // 5 minutes
222
- __publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
223
- __publicField(_WebSDKClient, "DEFAULT_TIMEOUT_MS", 12e3);
224
- __publicField(_WebSDKClient, "DEFAULT_MAX_RETRIES", 1);
225
- __publicField(_WebSDKClient, "RETRY_BASE_DELAY_MS", 400);
226
- var WebSDKContext = createContext(null);
227
- function useWebSDK() {
228
- const client = useContext(WebSDKContext);
229
- if (!client) {
230
- throw new Error("useWebSDK must be used within a WebSDKProvider");
231
- }
232
- return client;
233
- }
234
- function useWebSDKConfig() {
235
- const client = useWebSDK();
236
- return client.getConfig();
237
- }
238
- function canonicalFromLocation() {
239
- if (typeof window === "undefined" || !window.location) return void 0;
240
- const { origin, pathname } = window.location;
241
- if (!origin || origin === "null") return void 0;
242
- const path = pathname === "/" ? "/" : pathname.replace(/\/+$/, "");
243
- return `${origin}${path}`;
244
- }
245
- function resolveImageUrl(image, base) {
246
- if (!image || /^https?:\/\//i.test(image)) return image;
247
- if (!base) return image;
248
- try {
249
- return new URL(image, base).toString();
250
- } catch {
251
- return image;
252
- }
253
- }
254
- function serializeJsonLd(data) {
255
- return JSON.stringify(data).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
256
- }
257
- function PageHead({
258
- title,
259
- description,
260
- productName,
261
- keywords,
262
- image,
263
- url,
264
- favicon,
265
- robots = "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1",
266
- locale = "en_US",
267
- twitterHandle,
268
- themeColor = "#000000",
269
- author,
270
- structuredData,
271
- additionalMeta
272
- }) {
273
- const fullTitle = productName && !title.includes(productName) ? `${title} | ${productName}` : title;
274
- const resolvedUrl = url ?? canonicalFromLocation();
275
- const fullImageUrl = resolveImageUrl(image, resolvedUrl);
276
- const structuredDataItems = structuredData ? Array.isArray(structuredData) ? structuredData : [structuredData] : [];
277
- return /* @__PURE__ */ jsxs(Helmet, { children: [
278
- /* @__PURE__ */ jsx("title", { children: fullTitle }),
279
- /* @__PURE__ */ jsx("meta", { name: "title", content: fullTitle }),
280
- description ? /* @__PURE__ */ jsx("meta", { name: "description", content: description }) : null,
281
- keywords ? /* @__PURE__ */ jsx("meta", { name: "keywords", content: keywords }) : null,
282
- author ? /* @__PURE__ */ jsx("meta", { name: "author", content: author }) : null,
283
- /* @__PURE__ */ jsx("meta", { name: "robots", content: robots }),
284
- resolvedUrl ? /* @__PURE__ */ jsx("link", { rel: "canonical", href: resolvedUrl }) : null,
285
- favicon ? /* @__PURE__ */ jsx("link", { rel: "icon", href: favicon }) : null,
286
- /* @__PURE__ */ jsx("meta", { property: "og:type", content: "website" }),
287
- /* @__PURE__ */ jsx("meta", { property: "og:title", content: fullTitle }),
288
- description ? /* @__PURE__ */ jsx("meta", { property: "og:description", content: description }) : null,
289
- fullImageUrl ? /* @__PURE__ */ jsx("meta", { property: "og:image", content: fullImageUrl }) : null,
290
- resolvedUrl ? /* @__PURE__ */ jsx("meta", { property: "og:url", content: resolvedUrl }) : null,
291
- /* @__PURE__ */ jsx("meta", { property: "og:locale", content: locale }),
292
- productName ? /* @__PURE__ */ jsx("meta", { property: "og:site_name", content: productName }) : null,
293
- /* @__PURE__ */ jsx("meta", { name: "twitter:card", content: "summary_large_image" }),
294
- /* @__PURE__ */ jsx("meta", { name: "twitter:title", content: fullTitle }),
295
- description ? /* @__PURE__ */ jsx("meta", { name: "twitter:description", content: description }) : null,
296
- fullImageUrl ? /* @__PURE__ */ jsx("meta", { name: "twitter:image", content: fullImageUrl }) : null,
297
- twitterHandle ? /* @__PURE__ */ jsx("meta", { name: "twitter:creator", content: twitterHandle }) : null,
298
- /* @__PURE__ */ jsx("meta", { name: "theme-color", content: themeColor }),
299
- structuredDataItems.map((data, index) => /* @__PURE__ */ jsx("script", { type: "application/ld+json", children: serializeJsonLd(data) }, `ld-${index}`)),
300
- additionalMeta?.map((meta, index) => /* @__PURE__ */ jsx(
301
- "meta",
302
- {
303
- ...meta.name ? { name: meta.name } : {},
304
- ...meta.property ? { property: meta.property } : {},
305
- content: meta.content
306
- },
307
- `meta-${index}`
308
- ))
309
- ] });
310
- }
311
- function cn(...inputs) {
312
- return twMerge(clsx(inputs));
313
- }
314
- var buttonVariants = cva(
315
- "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",
316
- {
317
- variants: {
318
- variant: {
319
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
320
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
321
- outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
322
- secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
323
- ghost: "hover:bg-accent hover:text-accent-foreground",
324
- link: "text-primary underline-offset-4 hover:underline"
325
- },
326
- size: {
327
- default: "h-9 px-4 py-2",
328
- sm: "h-8 rounded-md px-3 text-xs",
329
- lg: "h-10 rounded-md px-8",
330
- icon: "h-9 w-9"
331
- }
332
- },
333
- defaultVariants: {
334
- variant: "default",
335
- size: "default"
336
- }
337
- }
338
- );
339
- var Button = React.forwardRef(
340
- ({ className, variant, size, asChild = false, ...props }, ref) => {
341
- const Comp = asChild ? Slot : "button";
342
- return /* @__PURE__ */ jsx(
343
- Comp,
344
- {
345
- className: cn(buttonVariants({ variant, size, className })),
346
- ref,
347
- ...props
348
- }
349
- );
350
- }
351
- );
352
- Button.displayName = "Button";
353
- var UNSUBSCRIBE_MUTATION = (
354
- /* GraphQL */
355
- `
356
- mutation PublicUnsubscribeByToken($token: String!) {
357
- publicUnsubscribeByToken(token: $token)
358
- }
359
- `
360
- );
361
- function UnsubscribePage({
362
- productName,
363
- className = "",
364
- seoTitle = "Unsubscribe from Newsletter",
365
- seoDescription = "Manage your newsletter subscription preferences.",
366
- resubscribeUrl,
367
- successMessage = "You have been successfully unsubscribed from our newsletter.",
368
- errorMessage = "Something went wrong. Please try again or contact support."
369
- }) {
370
- const client = useWebSDK();
371
- const config = useWebSDKConfig();
372
- const displayName = productName ?? config.productId;
373
- const [state, setState] = useState("loading");
374
- const [error, setError] = useState("");
375
- const [token, setToken] = useState("");
376
- const [successCopy, setSuccessCopy] = useState(successMessage);
377
- useEffect(() => {
378
- const params = new URLSearchParams(window.location.search);
379
- const t = params.get("token");
380
- if (t) {
381
- setToken(t);
382
- setState("confirming");
383
- } else {
384
- setState("invalid");
385
- }
386
- }, []);
387
- const handleUnsubscribe = async () => {
388
- if (!token) return;
389
- setState("processing");
390
- try {
391
- const result = await client.mutate(UNSUBSCRIBE_MUTATION, { token });
392
- if (result.errors?.length) {
393
- const errMsg = result.errors[0]?.message ?? errorMessage;
394
- const code = result.errors[0]?.extensions?.code;
395
- if (code === "ALREADY_UNSUBSCRIBED") {
396
- toast.info("You are already unsubscribed from this newsletter.");
397
- setSuccessCopy("You were already unsubscribed from this newsletter.");
398
- setState("success");
399
- return;
400
- } else if (code === "UNSUBSCRIBE_TOKEN_EXPIRED") {
401
- setError(
402
- "This unsubscribe link has expired. Please contact support."
403
- );
404
- } else if (code === "INVALID_UNSUBSCRIBE_TOKEN") {
405
- setState("invalid");
406
- return;
407
- } else {
408
- setError(errMsg);
409
- }
410
- setState("error");
411
- return;
412
- }
413
- if (result.data?.publicUnsubscribeByToken) {
414
- setSuccessCopy(successMessage);
415
- setState("success");
416
- toast.success("Successfully unsubscribed");
417
- } else {
418
- setError(errorMessage);
419
- setState("error");
420
- }
421
- } catch {
422
- setError(errorMessage);
423
- setState("error");
424
- }
425
- };
426
- return /* @__PURE__ */ jsxs(
427
- "div",
428
- {
429
- className,
430
- style: {
431
- minHeight: "60vh",
432
- display: "flex",
433
- alignItems: "center",
434
- justifyContent: "center",
435
- padding: "6rem 1rem 4rem"
436
- },
437
- children: [
438
- /* @__PURE__ */ jsx(PageHead, { title: seoTitle, description: seoDescription }),
439
- /* @__PURE__ */ jsxs("div", { className: "max-w-md w-full text-center", children: [
440
- state === "loading" && /* @__PURE__ */ jsxs("div", { className: "animate-pulse", children: [
441
- /* @__PURE__ */ jsx("div", { className: "h-8 w-48 bg-muted rounded mx-auto mb-4" }),
442
- /* @__PURE__ */ jsx("div", { className: "h-4 w-64 bg-muted rounded mx-auto" })
443
- ] }),
444
- state === "confirming" && /* @__PURE__ */ jsxs("div", { children: [
445
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-6 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center", children: /* @__PURE__ */ jsx(
446
- "svg",
447
- {
448
- className: "w-8 h-8 text-amber-600 dark:text-amber-400",
449
- fill: "none",
450
- viewBox: "0 0 24 24",
451
- stroke: "currentColor",
452
- strokeWidth: 2,
453
- children: /* @__PURE__ */ jsx(
454
- "path",
455
- {
456
- strokeLinecap: "round",
457
- strokeLinejoin: "round",
458
- d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"
459
- }
460
- )
461
- }
462
- ) }),
463
- /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-foreground mb-3", children: "Unsubscribe from Newsletter" }),
464
- /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground mb-8", children: [
465
- "Are you sure you want to unsubscribe from ",
466
- displayName,
467
- " ",
468
- "newsletter? You will no longer receive updates and news from us."
469
- ] }),
470
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row gap-3 justify-center", children: [
471
- /* @__PURE__ */ jsx(
472
- Button,
473
- {
474
- onClick: handleUnsubscribe,
475
- variant: "destructive",
476
- className: "px-8",
477
- children: "Yes, Unsubscribe"
478
- }
479
- ),
480
- resubscribeUrl && /* @__PURE__ */ jsx(
481
- Button,
482
- {
483
- variant: "outline",
484
- onClick: () => {
485
- window.location.href = resubscribeUrl;
486
- },
487
- className: "px-8",
488
- children: "Cancel"
489
- }
490
- )
491
- ] })
492
- ] }),
493
- state === "processing" && /* @__PURE__ */ jsxs("div", { children: [
494
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-6 rounded-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsxs(
495
- "svg",
496
- {
497
- className: "w-8 h-8 text-muted-foreground animate-spin",
498
- fill: "none",
499
- viewBox: "0 0 24 24",
500
- children: [
501
- /* @__PURE__ */ jsx(
502
- "circle",
503
- {
504
- className: "opacity-25",
505
- cx: "12",
506
- cy: "12",
507
- r: "10",
508
- stroke: "currentColor",
509
- strokeWidth: "4"
510
- }
511
- ),
512
- /* @__PURE__ */ jsx(
513
- "path",
514
- {
515
- className: "opacity-75",
516
- fill: "currentColor",
517
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
518
- }
519
- )
520
- ]
521
- }
522
- ) }),
523
- /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-foreground mb-3", children: "Unsubscribing..." }),
524
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "Please wait while we process your request." })
525
- ] }),
526
- state === "success" && /* @__PURE__ */ jsxs("div", { children: [
527
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-6 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center", children: /* @__PURE__ */ jsx(
528
- "svg",
529
- {
530
- className: "w-8 h-8 text-green-600 dark:text-green-400",
531
- fill: "none",
532
- viewBox: "0 0 24 24",
533
- stroke: "currentColor",
534
- strokeWidth: 2,
535
- children: /* @__PURE__ */ jsx(
536
- "path",
537
- {
538
- strokeLinecap: "round",
539
- strokeLinejoin: "round",
540
- d: "M5 13l4 4L19 7"
541
- }
542
- )
543
- }
544
- ) }),
545
- /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-foreground mb-3", children: "Successfully Unsubscribed" }),
546
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-8", children: successCopy }),
547
- resubscribeUrl && /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
548
- "Changed your mind?",
549
- " ",
550
- /* @__PURE__ */ jsx(
551
- "a",
552
- {
553
- href: resubscribeUrl,
554
- className: "text-primary underline hover:no-underline",
555
- children: "Resubscribe"
556
- }
557
- )
558
- ] })
559
- ] }),
560
- state === "error" && /* @__PURE__ */ jsxs("div", { children: [
561
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-6 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center", children: /* @__PURE__ */ jsx(
562
- "svg",
563
- {
564
- className: "w-8 h-8 text-red-600 dark:text-red-400",
565
- fill: "none",
566
- viewBox: "0 0 24 24",
567
- stroke: "currentColor",
568
- strokeWidth: 2,
569
- children: /* @__PURE__ */ jsx(
570
- "path",
571
- {
572
- strokeLinecap: "round",
573
- strokeLinejoin: "round",
574
- d: "M6 18L18 6M6 6l12 12"
575
- }
576
- )
577
- }
578
- ) }),
579
- /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-foreground mb-3", children: "Unsubscribe Failed" }),
580
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-8", children: error }),
581
- /* @__PURE__ */ jsx(Button, { onClick: () => setState("confirming"), variant: "outline", children: "Try Again" })
582
- ] }),
583
- state === "invalid" && /* @__PURE__ */ jsxs("div", { children: [
584
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-6 rounded-full bg-gray-100 dark:bg-gray-800 flex items-center justify-center", children: /* @__PURE__ */ jsx(
585
- "svg",
586
- {
587
- className: "w-8 h-8 text-gray-400",
588
- fill: "none",
589
- viewBox: "0 0 24 24",
590
- stroke: "currentColor",
591
- strokeWidth: 2,
592
- children: /* @__PURE__ */ jsx(
593
- "path",
594
- {
595
- strokeLinecap: "round",
596
- strokeLinejoin: "round",
597
- d: "M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
598
- }
599
- )
600
- }
601
- ) }),
602
- /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-foreground mb-3", children: "Invalid Unsubscribe Link" }),
603
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "This unsubscribe link is invalid or missing. If you want to unsubscribe, please use the link from your newsletter email." })
604
- ] })
605
- ] })
606
- ]
607
- }
608
- );
609
- }
610
-
611
- export { UnsubscribePage };
1
+ export { UnsubscribePage } from '../chunk-UM55U65W.mjs';
2
+ import '../chunk-N5EC53MH.mjs';
3
+ import '../chunk-KHYXK7FG.mjs';
4
+ import '../chunk-R7G6TWIS.mjs';
5
+ import '../chunk-5JRJ57CL.mjs';
6
+ import '../chunk-VNS5WDWO.mjs';
612
7
  //# sourceMappingURL=unsubscribe.mjs.map
613
8
  //# sourceMappingURL=unsubscribe.mjs.map