@burdenoff/website-sdk 2026.720.2 → 2026.720.3

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 (59) hide show
  1. package/dist/client/index.d.mts +1 -1
  2. package/dist/client/index.d.ts +1 -1
  3. package/dist/client/index.js +68 -20
  4. package/dist/client/index.js.map +1 -1
  5. package/dist/client/index.mjs +68 -20
  6. package/dist/client/index.mjs.map +1 -1
  7. package/dist/components/contact.js +68 -20
  8. package/dist/components/contact.js.map +1 -1
  9. package/dist/components/contact.mjs +68 -20
  10. package/dist/components/contact.mjs.map +1 -1
  11. package/dist/components/newsletter.js +68 -20
  12. package/dist/components/newsletter.js.map +1 -1
  13. package/dist/components/newsletter.mjs +68 -20
  14. package/dist/components/newsletter.mjs.map +1 -1
  15. package/dist/components/partners.js +68 -20
  16. package/dist/components/partners.js.map +1 -1
  17. package/dist/components/partners.mjs +68 -20
  18. package/dist/components/partners.mjs.map +1 -1
  19. package/dist/components/pricing.js +68 -20
  20. package/dist/components/pricing.js.map +1 -1
  21. package/dist/components/pricing.mjs +68 -20
  22. package/dist/components/pricing.mjs.map +1 -1
  23. package/dist/components/resource-links.js +68 -20
  24. package/dist/components/resource-links.js.map +1 -1
  25. package/dist/components/resource-links.mjs +68 -20
  26. package/dist/components/resource-links.mjs.map +1 -1
  27. package/dist/components/social-links.js +68 -20
  28. package/dist/components/social-links.js.map +1 -1
  29. package/dist/components/social-links.mjs +68 -20
  30. package/dist/components/social-links.mjs.map +1 -1
  31. package/dist/components/unsubscribe.js +68 -20
  32. package/dist/components/unsubscribe.js.map +1 -1
  33. package/dist/components/unsubscribe.mjs +68 -20
  34. package/dist/components/unsubscribe.mjs.map +1 -1
  35. package/dist/components/waitlist.js +68 -20
  36. package/dist/components/waitlist.js.map +1 -1
  37. package/dist/components/waitlist.mjs +68 -20
  38. package/dist/components/waitlist.mjs.map +1 -1
  39. package/dist/content/index.js +68 -20
  40. package/dist/content/index.js.map +1 -1
  41. package/dist/content/index.mjs +68 -20
  42. package/dist/content/index.mjs.map +1 -1
  43. package/dist/index.d.mts +1 -1
  44. package/dist/index.d.ts +1 -1
  45. package/dist/index.js +68 -20
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +68 -20
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/product/index.js +68 -20
  50. package/dist/product/index.js.map +1 -1
  51. package/dist/product/index.mjs +68 -20
  52. package/dist/product/index.mjs.map +1 -1
  53. package/dist/{provider-D7Rij9UM.d.mts → provider-DBAnqeTv.d.mts} +24 -0
  54. package/dist/{provider-D7Rij9UM.d.ts → provider-DBAnqeTv.d.ts} +24 -0
  55. package/dist/store/index.js +68 -20
  56. package/dist/store/index.js.map +1 -1
  57. package/dist/store/index.mjs +68 -20
  58. package/dist/store/index.mjs.map +1 -1
  59. package/package.json +1 -1
@@ -100,9 +100,23 @@ var _WebSDKClient = class _WebSDKClient {
100
100
  * Execute a GraphQL mutation
101
101
  */
102
102
  async mutate(mutation, variables) {
103
- return this.request(mutation, variables);
103
+ return this.request(mutation, variables, false);
104
104
  }
105
- async request(query, variables) {
105
+ /** HTTP statuses worth another attempt — transient server/edge conditions. */
106
+ static isRetriableStatus(status) {
107
+ return status === 429 || status === 408 || status >= 500 && status < 600;
108
+ }
109
+ static sleep(ms) {
110
+ return new Promise((resolve) => setTimeout(resolve, ms));
111
+ }
112
+ /**
113
+ * Perform the HTTP call with a hard timeout. Every outcome resolves to a
114
+ * GraphQLResponse — callers never hang, so a UI's `loading` state always
115
+ * settles into data or a renderable error.
116
+ */
117
+ async attempt(query, variables, timeoutMs) {
118
+ const controller = new AbortController();
119
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
106
120
  try {
107
121
  const response = await fetch(this.config.gatewayUrl, {
108
122
  method: "POST",
@@ -111,7 +125,8 @@ var _WebSDKClient = class _WebSDKClient {
111
125
  "x-product-id": this.config.productId,
112
126
  ...this.config.headers
113
127
  },
114
- body: JSON.stringify({ query, variables })
128
+ body: JSON.stringify({ query, variables }),
129
+ signal: controller.signal
115
130
  });
116
131
  if (!response.ok) {
117
132
  console.error(
@@ -120,34 +135,67 @@ var _WebSDKClient = class _WebSDKClient {
120
135
  response.statusText
121
136
  );
122
137
  return {
123
- errors: [
124
- {
125
- message: `HTTP ${response.status}: ${response.statusText}`,
126
- extensions: { code: `HTTP_${response.status}` }
127
- }
128
- ]
138
+ res: {
139
+ errors: [
140
+ {
141
+ message: `HTTP ${response.status}: ${response.statusText}`,
142
+ extensions: { code: `HTTP_${response.status}` }
143
+ }
144
+ ]
145
+ },
146
+ retriable: _WebSDKClient.isRetriableStatus(response.status)
129
147
  };
130
148
  }
131
- return await response.json();
149
+ return {
150
+ res: await response.json(),
151
+ retriable: false
152
+ };
132
153
  } catch (error) {
133
- console.error(
134
- "[WebSDK] Network error",
135
- error instanceof Error ? error.message : "unknown error"
136
- );
154
+ const aborted = error instanceof Error && (error.name === "AbortError" || controller.signal.aborted);
155
+ const message = aborted ? `Request timed out after ${timeoutMs}ms` : error instanceof Error ? error.message : "Network error";
156
+ console.error("[WebSDK] Network error", message);
137
157
  return {
138
- errors: [
139
- {
140
- message: error instanceof Error ? error.message : "Network error",
141
- extensions: { code: "NETWORK_ERROR" }
142
- }
143
- ]
158
+ res: {
159
+ errors: [
160
+ {
161
+ message,
162
+ extensions: { code: aborted ? "TIMEOUT" : "NETWORK_ERROR" }
163
+ }
164
+ ]
165
+ },
166
+ // Transport-level failures are worth one more try; a genuine outage
167
+ // just fails twice quickly and still renders an error state.
168
+ retriable: true
144
169
  };
170
+ } finally {
171
+ clearTimeout(timer);
172
+ }
173
+ }
174
+ async request(query, variables, retry = true) {
175
+ const timeoutMs = this.config.timeoutMs ?? _WebSDKClient.DEFAULT_TIMEOUT_MS;
176
+ const maxRetries = retry ? this.config.maxRetries ?? _WebSDKClient.DEFAULT_MAX_RETRIES : 0;
177
+ let last;
178
+ for (let i = 0; i <= maxRetries; i++) {
179
+ const { res, retriable } = await this.attempt(
180
+ query,
181
+ variables,
182
+ timeoutMs
183
+ );
184
+ if (!retriable || i === maxRetries) return res;
185
+ last = res;
186
+ await _WebSDKClient.sleep(
187
+ _WebSDKClient.RETRY_BASE_DELAY_MS * (i + 1) + Math.random() * 200
188
+ );
145
189
  }
190
+ return last;
146
191
  }
147
192
  };
148
193
  __publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
149
194
  // 5 minutes
150
195
  __publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
196
+ __publicField(_WebSDKClient, "DEFAULT_TIMEOUT_MS", 12e3);
197
+ __publicField(_WebSDKClient, "DEFAULT_MAX_RETRIES", 1);
198
+ __publicField(_WebSDKClient, "RETRY_BASE_DELAY_MS", 400);
151
199
  var WebSDKContext = createContext(null);
152
200
  function useWebSDK() {
153
201
  const client = useContext(WebSDKContext);