@burdenoff/website-sdk 2026.817.2 → 2026.824.1
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/components/partners.js.map +1 -1
- package/dist/components/partners.mjs.map +1 -1
- package/dist/content/index.js +25 -3
- package/dist/content/index.js.map +1 -1
- package/dist/content/index.mjs +25 -3
- package/dist/content/index.mjs.map +1 -1
- package/dist/index.js +77 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/content/index.mjs
CHANGED
|
@@ -327,16 +327,38 @@ var PUBLIC_CONTENT_PAGES_QUERY = `
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
`;
|
|
330
|
+
function resolveContentPageGate(resolvedProductId, hasProvider, productLoading) {
|
|
331
|
+
if (resolvedProductId) return "fetch";
|
|
332
|
+
return hasProvider && productLoading ? "wait" : "unavailable";
|
|
333
|
+
}
|
|
330
334
|
function useContentPage(slug, options) {
|
|
331
335
|
const client = useWebSDK();
|
|
332
336
|
const config = useWebSDKConfig();
|
|
333
|
-
const {
|
|
337
|
+
const {
|
|
338
|
+
product,
|
|
339
|
+
loading: productLoading,
|
|
340
|
+
error: productError,
|
|
341
|
+
hasProvider
|
|
342
|
+
} = useProduct();
|
|
334
343
|
const resolvedProductId = product?.id || config.productId;
|
|
344
|
+
const gate = resolveContentPageGate(
|
|
345
|
+
resolvedProductId,
|
|
346
|
+
hasProvider,
|
|
347
|
+
productLoading
|
|
348
|
+
);
|
|
335
349
|
const [data, setData] = useState(null);
|
|
336
350
|
const [loading, setLoading] = useState(true);
|
|
337
351
|
const [error, setError] = useState(null);
|
|
338
352
|
const fetchPage = useCallback(async () => {
|
|
339
|
-
if (
|
|
353
|
+
if (gate === "wait") return;
|
|
354
|
+
if (gate === "unavailable") {
|
|
355
|
+
setData(null);
|
|
356
|
+
setError(
|
|
357
|
+
productError ?? "Product unavailable \u2014 cannot load content page"
|
|
358
|
+
);
|
|
359
|
+
setLoading(false);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
340
362
|
setLoading(true);
|
|
341
363
|
setError(null);
|
|
342
364
|
try {
|
|
@@ -361,7 +383,7 @@ function useContentPage(slug, options) {
|
|
|
361
383
|
} finally {
|
|
362
384
|
setLoading(false);
|
|
363
385
|
}
|
|
364
|
-
}, [client, resolvedProductId, slug, options?.resolve]);
|
|
386
|
+
}, [client, gate, productError, resolvedProductId, slug, options?.resolve]);
|
|
365
387
|
useEffect(() => {
|
|
366
388
|
fetchPage();
|
|
367
389
|
}, [fetchPage]);
|