@burdenoff/website-sdk 2026.922.3 → 2026.922.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/components/explore.d.mts +70 -2
- package/dist/components/explore.d.ts +70 -2
- package/dist/components/explore.js +492 -8
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +490 -10
- package/dist/components/explore.mjs.map +1 -1
- package/dist/{explore-types-CPF1QoMn.d.mts → explore-types-DvQPiL1t.d.mts} +58 -2
- package/dist/{explore-types-CPF1QoMn.d.ts → explore-types-DvQPiL1t.d.ts} +58 -2
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +61 -8
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +61 -8
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +489 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +490 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{use-explore-chat--CxNtkrJ.d.ts → use-explore-chat-CNEdKBc1.d.ts} +1 -1
- package/dist/{use-explore-chat-C6Y8JQMj.d.mts → use-explore-chat-Dgm-jf96.d.mts} +1 -1
- package/package.json +1 -1
package/dist/hooks/index.mjs
CHANGED
|
@@ -275,11 +275,9 @@ var EXPLORE_OWN_MESSAGE_FIELDS = (
|
|
|
275
275
|
}
|
|
276
276
|
`
|
|
277
277
|
);
|
|
278
|
-
var
|
|
278
|
+
var EXPLORE_CATALOG_ESTABLISHED_FIELDS = (
|
|
279
279
|
/* GraphQL */
|
|
280
280
|
`
|
|
281
|
-
query ExploreCatalog($productSlug: String) {
|
|
282
|
-
exploreCatalog(productSlug: $productSlug) {
|
|
283
281
|
enabled
|
|
284
282
|
products {
|
|
285
283
|
slug
|
|
@@ -297,11 +295,35 @@ var EXPLORE_CATALOG_QUERY = (
|
|
|
297
295
|
historyTurns
|
|
298
296
|
}
|
|
299
297
|
captchaRequired
|
|
300
|
-
recaptchaSiteKey
|
|
298
|
+
recaptchaSiteKey`
|
|
299
|
+
);
|
|
300
|
+
var EXPLORE_CATALOG_HIGHLIGHT_FIELD = (
|
|
301
|
+
/* GraphQL */
|
|
302
|
+
`
|
|
303
|
+
conceptHighlights {
|
|
304
|
+
product
|
|
305
|
+
productName
|
|
306
|
+
title
|
|
307
|
+
url
|
|
308
|
+
imageUrl
|
|
309
|
+
alt
|
|
310
|
+
}`
|
|
311
|
+
);
|
|
312
|
+
function exploreCatalogDocument(extraFields) {
|
|
313
|
+
return (
|
|
314
|
+
/* GraphQL */
|
|
315
|
+
`
|
|
316
|
+
query ExploreCatalog($productSlug: String) {
|
|
317
|
+
exploreCatalog(productSlug: $productSlug) {${EXPLORE_CATALOG_ESTABLISHED_FIELDS}${extraFields}
|
|
301
318
|
}
|
|
302
319
|
}
|
|
303
320
|
`
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
var EXPLORE_CATALOG_QUERY = exploreCatalogDocument(
|
|
324
|
+
EXPLORE_CATALOG_HIGHLIGHT_FIELD
|
|
304
325
|
);
|
|
326
|
+
var EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS = exploreCatalogDocument("");
|
|
305
327
|
var EXPLORE_MESSAGE_QUERY = (
|
|
306
328
|
/* GraphQL */
|
|
307
329
|
`
|
|
@@ -665,7 +687,12 @@ function buildFallbackCatalog(examplePrompts, welcome) {
|
|
|
665
687
|
welcomeBody: welcome?.body ?? FALLBACK_WELCOME_BODY,
|
|
666
688
|
limits: FALLBACK_EXPLORE_LIMITS,
|
|
667
689
|
captchaRequired: false,
|
|
668
|
-
recaptchaSiteKey: null
|
|
690
|
+
recaptchaSiteKey: null,
|
|
691
|
+
// Empty, and deliberately not synthesised from `ECOSYSTEM_PRODUCTS`: a concept highlight
|
|
692
|
+
// needs a real published illustration URL, and this SDK has no registry of them. An
|
|
693
|
+
// invented path would render 38 broken frames on the one screen every prerender captures.
|
|
694
|
+
// The strip renders nothing at all when the list is empty, which is the honest fallback.
|
|
695
|
+
conceptHighlights: []
|
|
669
696
|
};
|
|
670
697
|
}
|
|
671
698
|
function normalizeCatalog(raw, fallback) {
|
|
@@ -682,9 +709,27 @@ function normalizeCatalog(raw, fallback) {
|
|
|
682
709
|
historyTurns: raw.limits?.historyTurns || fallback.limits.historyTurns
|
|
683
710
|
},
|
|
684
711
|
captchaRequired: raw.captchaRequired === true,
|
|
685
|
-
recaptchaSiteKey: raw.recaptchaSiteKey ?? null
|
|
712
|
+
recaptchaSiteKey: raw.recaptchaSiteKey ?? null,
|
|
713
|
+
// `[ExploreConceptHighlight!]!` on the wire, so a gateway that KNOWS the field always
|
|
714
|
+
// sends an array. The one response that arrives without it is the retry against an older
|
|
715
|
+
// supergraph (`EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS`) — that gateway does not answer
|
|
716
|
+
// the full document at all, it refuses it. Either way
|
|
717
|
+
// `catalog.conceptHighlights.filter(...)` on `undefined` would throw inside render,
|
|
718
|
+
// blanking the welcome screen over a decorative strip.
|
|
719
|
+
conceptHighlights: raw.conceptHighlights?.length ? raw.conceptHighlights : fallback.conceptHighlights
|
|
686
720
|
};
|
|
687
721
|
}
|
|
722
|
+
var CATALOG_DOCUMENT_REJECTED_CODES = /* @__PURE__ */ new Set([
|
|
723
|
+
"GRAPHQL_VALIDATION_FAILED",
|
|
724
|
+
"HTTP_400"
|
|
725
|
+
]);
|
|
726
|
+
function catalogRejectedTheHighlightField(res) {
|
|
727
|
+
if (res.data?.exploreCatalog) return false;
|
|
728
|
+
return (res.errors ?? []).some((error) => {
|
|
729
|
+
const code = error.extensions?.code;
|
|
730
|
+
return typeof code === "string" && CATALOG_DOCUMENT_REJECTED_CODES.has(code) || error.message.includes("conceptHighlights");
|
|
731
|
+
});
|
|
732
|
+
}
|
|
688
733
|
var RATE_LIMIT_CODES = /* @__PURE__ */ new Set([
|
|
689
734
|
"RATE_LIMITED",
|
|
690
735
|
"HTTP_429",
|
|
@@ -1024,11 +1069,19 @@ function useExploreChat(options = {}) {
|
|
|
1024
1069
|
useEffect(() => {
|
|
1025
1070
|
let cancelled = false;
|
|
1026
1071
|
const load = async () => {
|
|
1027
|
-
const
|
|
1072
|
+
const variables = { productSlug: productSlug ?? null };
|
|
1073
|
+
let res = await client.query(
|
|
1028
1074
|
EXPLORE_CATALOG_QUERY,
|
|
1029
|
-
|
|
1075
|
+
variables
|
|
1030
1076
|
);
|
|
1031
1077
|
if (cancelled || !mountedRef.current) return;
|
|
1078
|
+
if (catalogRejectedTheHighlightField(res)) {
|
|
1079
|
+
res = await client.query(
|
|
1080
|
+
EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS,
|
|
1081
|
+
variables
|
|
1082
|
+
);
|
|
1083
|
+
if (cancelled || !mountedRef.current) return;
|
|
1084
|
+
}
|
|
1032
1085
|
const raw = res.data?.exploreCatalog;
|
|
1033
1086
|
if (res.errors?.length || !raw) {
|
|
1034
1087
|
console.warn(
|