@burdenoff/website-sdk 2026.720.2 → 2026.720.4

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
package/dist/index.mjs CHANGED
@@ -107,9 +107,23 @@ var _WebSDKClient = class _WebSDKClient {
107
107
  * Execute a GraphQL mutation
108
108
  */
109
109
  async mutate(mutation, variables) {
110
- return this.request(mutation, variables);
110
+ return this.request(mutation, variables, false);
111
111
  }
112
- async request(query, variables) {
112
+ /** HTTP statuses worth another attempt — transient server/edge conditions. */
113
+ static isRetriableStatus(status) {
114
+ return status === 429 || status === 408 || status >= 500 && status < 600;
115
+ }
116
+ static sleep(ms) {
117
+ return new Promise((resolve) => setTimeout(resolve, ms));
118
+ }
119
+ /**
120
+ * Perform the HTTP call with a hard timeout. Every outcome resolves to a
121
+ * GraphQLResponse — callers never hang, so a UI's `loading` state always
122
+ * settles into data or a renderable error.
123
+ */
124
+ async attempt(query, variables, timeoutMs) {
125
+ const controller = new AbortController();
126
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
113
127
  try {
114
128
  const response = await fetch(this.config.gatewayUrl, {
115
129
  method: "POST",
@@ -118,7 +132,8 @@ var _WebSDKClient = class _WebSDKClient {
118
132
  "x-product-id": this.config.productId,
119
133
  ...this.config.headers
120
134
  },
121
- body: JSON.stringify({ query, variables })
135
+ body: JSON.stringify({ query, variables }),
136
+ signal: controller.signal
122
137
  });
123
138
  if (!response.ok) {
124
139
  console.error(
@@ -127,34 +142,67 @@ var _WebSDKClient = class _WebSDKClient {
127
142
  response.statusText
128
143
  );
129
144
  return {
130
- errors: [
131
- {
132
- message: `HTTP ${response.status}: ${response.statusText}`,
133
- extensions: { code: `HTTP_${response.status}` }
134
- }
135
- ]
145
+ res: {
146
+ errors: [
147
+ {
148
+ message: `HTTP ${response.status}: ${response.statusText}`,
149
+ extensions: { code: `HTTP_${response.status}` }
150
+ }
151
+ ]
152
+ },
153
+ retriable: _WebSDKClient.isRetriableStatus(response.status)
136
154
  };
137
155
  }
138
- return await response.json();
156
+ return {
157
+ res: await response.json(),
158
+ retriable: false
159
+ };
139
160
  } catch (error) {
140
- console.error(
141
- "[WebSDK] Network error",
142
- error instanceof Error ? error.message : "unknown error"
143
- );
161
+ const aborted = error instanceof Error && (error.name === "AbortError" || controller.signal.aborted);
162
+ const message = aborted ? `Request timed out after ${timeoutMs}ms` : error instanceof Error ? error.message : "Network error";
163
+ console.error("[WebSDK] Network error", message);
144
164
  return {
145
- errors: [
146
- {
147
- message: error instanceof Error ? error.message : "Network error",
148
- extensions: { code: "NETWORK_ERROR" }
149
- }
150
- ]
165
+ res: {
166
+ errors: [
167
+ {
168
+ message,
169
+ extensions: { code: aborted ? "TIMEOUT" : "NETWORK_ERROR" }
170
+ }
171
+ ]
172
+ },
173
+ // Transport-level failures are worth one more try; a genuine outage
174
+ // just fails twice quickly and still renders an error state.
175
+ retriable: true
151
176
  };
177
+ } finally {
178
+ clearTimeout(timer);
179
+ }
180
+ }
181
+ async request(query, variables, retry = true) {
182
+ const timeoutMs = this.config.timeoutMs ?? _WebSDKClient.DEFAULT_TIMEOUT_MS;
183
+ const maxRetries = retry ? this.config.maxRetries ?? _WebSDKClient.DEFAULT_MAX_RETRIES : 0;
184
+ let last;
185
+ for (let i = 0; i <= maxRetries; i++) {
186
+ const { res, retriable } = await this.attempt(
187
+ query,
188
+ variables,
189
+ timeoutMs
190
+ );
191
+ if (!retriable || i === maxRetries) return res;
192
+ last = res;
193
+ await _WebSDKClient.sleep(
194
+ _WebSDKClient.RETRY_BASE_DELAY_MS * (i + 1) + Math.random() * 200
195
+ );
152
196
  }
197
+ return last;
153
198
  }
154
199
  };
155
200
  __publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
156
201
  // 5 minutes
157
202
  __publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
203
+ __publicField(_WebSDKClient, "DEFAULT_TIMEOUT_MS", 12e3);
204
+ __publicField(_WebSDKClient, "DEFAULT_MAX_RETRIES", 1);
205
+ __publicField(_WebSDKClient, "RETRY_BASE_DELAY_MS", 400);
158
206
  var WebSDKClient = _WebSDKClient;
159
207
 
160
208
  // src/client/gateway-resolver.ts