@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.
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +68 -20
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +68 -20
- package/dist/client/index.mjs.map +1 -1
- package/dist/components/contact.js +68 -20
- package/dist/components/contact.js.map +1 -1
- package/dist/components/contact.mjs +68 -20
- package/dist/components/contact.mjs.map +1 -1
- package/dist/components/newsletter.js +68 -20
- package/dist/components/newsletter.js.map +1 -1
- package/dist/components/newsletter.mjs +68 -20
- package/dist/components/newsletter.mjs.map +1 -1
- package/dist/components/partners.js +68 -20
- package/dist/components/partners.js.map +1 -1
- package/dist/components/partners.mjs +68 -20
- package/dist/components/partners.mjs.map +1 -1
- package/dist/components/pricing.js +68 -20
- package/dist/components/pricing.js.map +1 -1
- package/dist/components/pricing.mjs +68 -20
- package/dist/components/pricing.mjs.map +1 -1
- package/dist/components/resource-links.js +68 -20
- package/dist/components/resource-links.js.map +1 -1
- package/dist/components/resource-links.mjs +68 -20
- package/dist/components/resource-links.mjs.map +1 -1
- package/dist/components/social-links.js +68 -20
- package/dist/components/social-links.js.map +1 -1
- package/dist/components/social-links.mjs +68 -20
- package/dist/components/social-links.mjs.map +1 -1
- package/dist/components/unsubscribe.js +68 -20
- package/dist/components/unsubscribe.js.map +1 -1
- package/dist/components/unsubscribe.mjs +68 -20
- package/dist/components/unsubscribe.mjs.map +1 -1
- package/dist/components/waitlist.js +68 -20
- package/dist/components/waitlist.js.map +1 -1
- package/dist/components/waitlist.mjs +68 -20
- package/dist/components/waitlist.mjs.map +1 -1
- package/dist/content/index.js +68 -20
- package/dist/content/index.js.map +1 -1
- package/dist/content/index.mjs +68 -20
- package/dist/content/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +68 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -20
- package/dist/index.mjs.map +1 -1
- package/dist/product/index.js +68 -20
- package/dist/product/index.js.map +1 -1
- package/dist/product/index.mjs +68 -20
- package/dist/product/index.mjs.map +1 -1
- package/dist/{provider-D7Rij9UM.d.mts → provider-DBAnqeTv.d.mts} +24 -0
- package/dist/{provider-D7Rij9UM.d.ts → provider-DBAnqeTv.d.ts} +24 -0
- package/dist/store/index.js +68 -20
- package/dist/store/index.js.map +1 -1
- package/dist/store/index.mjs +68 -20
- package/dist/store/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/store/index.mjs
CHANGED
|
@@ -284,9 +284,23 @@ var _WebSDKClient = class _WebSDKClient {
|
|
|
284
284
|
* Execute a GraphQL mutation
|
|
285
285
|
*/
|
|
286
286
|
async mutate(mutation, variables) {
|
|
287
|
-
return this.request(mutation, variables);
|
|
287
|
+
return this.request(mutation, variables, false);
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
/** HTTP statuses worth another attempt — transient server/edge conditions. */
|
|
290
|
+
static isRetriableStatus(status) {
|
|
291
|
+
return status === 429 || status === 408 || status >= 500 && status < 600;
|
|
292
|
+
}
|
|
293
|
+
static sleep(ms) {
|
|
294
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Perform the HTTP call with a hard timeout. Every outcome resolves to a
|
|
298
|
+
* GraphQLResponse — callers never hang, so a UI's `loading` state always
|
|
299
|
+
* settles into data or a renderable error.
|
|
300
|
+
*/
|
|
301
|
+
async attempt(query, variables, timeoutMs) {
|
|
302
|
+
const controller = new AbortController();
|
|
303
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
290
304
|
try {
|
|
291
305
|
const response = await fetch(this.config.gatewayUrl, {
|
|
292
306
|
method: "POST",
|
|
@@ -295,7 +309,8 @@ var _WebSDKClient = class _WebSDKClient {
|
|
|
295
309
|
"x-product-id": this.config.productId,
|
|
296
310
|
...this.config.headers
|
|
297
311
|
},
|
|
298
|
-
body: JSON.stringify({ query, variables })
|
|
312
|
+
body: JSON.stringify({ query, variables }),
|
|
313
|
+
signal: controller.signal
|
|
299
314
|
});
|
|
300
315
|
if (!response.ok) {
|
|
301
316
|
console.error(
|
|
@@ -304,34 +319,67 @@ var _WebSDKClient = class _WebSDKClient {
|
|
|
304
319
|
response.statusText
|
|
305
320
|
);
|
|
306
321
|
return {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
322
|
+
res: {
|
|
323
|
+
errors: [
|
|
324
|
+
{
|
|
325
|
+
message: `HTTP ${response.status}: ${response.statusText}`,
|
|
326
|
+
extensions: { code: `HTTP_${response.status}` }
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
retriable: _WebSDKClient.isRetriableStatus(response.status)
|
|
313
331
|
};
|
|
314
332
|
}
|
|
315
|
-
return
|
|
333
|
+
return {
|
|
334
|
+
res: await response.json(),
|
|
335
|
+
retriable: false
|
|
336
|
+
};
|
|
316
337
|
} catch (error) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
);
|
|
338
|
+
const aborted = error instanceof Error && (error.name === "AbortError" || controller.signal.aborted);
|
|
339
|
+
const message = aborted ? `Request timed out after ${timeoutMs}ms` : error instanceof Error ? error.message : "Network error";
|
|
340
|
+
console.error("[WebSDK] Network error", message);
|
|
321
341
|
return {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
342
|
+
res: {
|
|
343
|
+
errors: [
|
|
344
|
+
{
|
|
345
|
+
message,
|
|
346
|
+
extensions: { code: aborted ? "TIMEOUT" : "NETWORK_ERROR" }
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
// Transport-level failures are worth one more try; a genuine outage
|
|
351
|
+
// just fails twice quickly and still renders an error state.
|
|
352
|
+
retriable: true
|
|
328
353
|
};
|
|
354
|
+
} finally {
|
|
355
|
+
clearTimeout(timer);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
async request(query, variables, retry = true) {
|
|
359
|
+
const timeoutMs = this.config.timeoutMs ?? _WebSDKClient.DEFAULT_TIMEOUT_MS;
|
|
360
|
+
const maxRetries = retry ? this.config.maxRetries ?? _WebSDKClient.DEFAULT_MAX_RETRIES : 0;
|
|
361
|
+
let last;
|
|
362
|
+
for (let i = 0; i <= maxRetries; i++) {
|
|
363
|
+
const { res, retriable } = await this.attempt(
|
|
364
|
+
query,
|
|
365
|
+
variables,
|
|
366
|
+
timeoutMs
|
|
367
|
+
);
|
|
368
|
+
if (!retriable || i === maxRetries) return res;
|
|
369
|
+
last = res;
|
|
370
|
+
await _WebSDKClient.sleep(
|
|
371
|
+
_WebSDKClient.RETRY_BASE_DELAY_MS * (i + 1) + Math.random() * 200
|
|
372
|
+
);
|
|
329
373
|
}
|
|
374
|
+
return last;
|
|
330
375
|
}
|
|
331
376
|
};
|
|
332
377
|
__publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
|
|
333
378
|
// 5 minutes
|
|
334
379
|
__publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
|
|
380
|
+
__publicField(_WebSDKClient, "DEFAULT_TIMEOUT_MS", 12e3);
|
|
381
|
+
__publicField(_WebSDKClient, "DEFAULT_MAX_RETRIES", 1);
|
|
382
|
+
__publicField(_WebSDKClient, "RETRY_BASE_DELAY_MS", 400);
|
|
335
383
|
var WebSDKContext = createContext(null);
|
|
336
384
|
function useWebSDK() {
|
|
337
385
|
const client = useContext(WebSDKContext);
|