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