@burdenoff/website-sdk 2026.1101.3 → 2026.1102.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.
Files changed (40) hide show
  1. package/README.md +234 -14
  2. package/dist/avatar-live-view/index.d.mts +1 -1
  3. package/dist/avatar-live-view/index.d.ts +1 -1
  4. package/dist/avatar-live-view/index.js +71 -24
  5. package/dist/avatar-live-view/index.js.map +1 -1
  6. package/dist/avatar-live-view/index.mjs +69 -22
  7. package/dist/avatar-live-view/index.mjs.map +1 -1
  8. package/dist/{chunk-Y4V5CEWD.mjs → chunk-2LPDCXQH.mjs} +7 -4
  9. package/dist/chunk-2LPDCXQH.mjs.map +1 -0
  10. package/dist/{chunk-FFADMVIK.mjs → chunk-ETI2HQEC.mjs} +7 -5
  11. package/dist/chunk-ETI2HQEC.mjs.map +1 -0
  12. package/dist/{chunk-23H4JUL4.js → chunk-OIQHIGGU.js} +20 -3
  13. package/dist/chunk-OIQHIGGU.js.map +1 -0
  14. package/dist/{chunk-OYEUNZJY.js → chunk-PIXTBL63.js} +7 -3
  15. package/dist/chunk-PIXTBL63.js.map +1 -0
  16. package/dist/{chunk-BX2USEWF.mjs → chunk-QOHPLTGT.mjs} +19 -4
  17. package/dist/chunk-QOHPLTGT.mjs.map +1 -0
  18. package/dist/{chunk-O76QDGRM.js → chunk-R742FS5E.js} +8 -4
  19. package/dist/chunk-R742FS5E.js.map +1 -0
  20. package/dist/components/explore-cta.d.mts +7 -0
  21. package/dist/components/explore-cta.d.ts +7 -0
  22. package/dist/components/explore-cta.js +2 -2
  23. package/dist/components/explore-cta.mjs +1 -1
  24. package/dist/components/explore.js +13 -13
  25. package/dist/components/explore.mjs +1 -1
  26. package/dist/{explore-avatar-live-config-B171o1Yo.d.ts → explore-avatar-live-config-C1ILEcY8.d.ts} +16 -4
  27. package/dist/{explore-avatar-live-config-BGsGwbcq.d.mts → explore-avatar-live-config-D-hO90-A.d.mts} +16 -4
  28. package/dist/index.d.mts +107 -4
  29. package/dist/index.d.ts +107 -4
  30. package/dist/index.js +209 -43
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +173 -7
  33. package/dist/index.mjs.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/chunk-23H4JUL4.js.map +0 -1
  36. package/dist/chunk-BX2USEWF.mjs.map +0 -1
  37. package/dist/chunk-FFADMVIK.mjs.map +0 -1
  38. package/dist/chunk-O76QDGRM.js.map +0 -1
  39. package/dist/chunk-OYEUNZJY.js.map +0 -1
  40. package/dist/chunk-Y4V5CEWD.mjs.map +0 -1
@@ -18,6 +18,7 @@ function useCurrentPath(explicit) {
18
18
  }, [explicit]);
19
19
  return path;
20
20
  }
21
+ var FLOATING_BOTTOM = "1.25rem";
21
22
  function samePath(a, b) {
22
23
  if (!a) return false;
23
24
  const norm = (v) => v.length > 1 ? v.replace(/\/+$/, "") : v;
@@ -33,7 +34,8 @@ var ExploreCta = forwardRef(
33
34
  onClick,
34
35
  currentPath,
35
36
  expanded,
36
- controls
37
+ controls,
38
+ bottomOffset
37
39
  }, ref) {
38
40
  const path = useCurrentPath(currentPath);
39
41
  const isActive = samePath(path, href);
@@ -74,6 +76,7 @@ var ExploreCta = forwardRef(
74
76
  "aria-expanded": expanded,
75
77
  "aria-haspopup": expanded === void 0 ? void 0 : "dialog",
76
78
  "aria-controls": expanded === void 0 ? void 0 : controls,
79
+ style: variant === "floating" && bottomOffset ? { bottom: `calc(${FLOATING_BOTTOM} + ${bottomOffset})` } : void 0,
77
80
  className: cn(
78
81
  classes[variant],
79
82
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
@@ -107,6 +110,6 @@ var ExploreCta = forwardRef(
107
110
  }
108
111
  );
109
112
 
110
- export { ExploreCta };
111
- //# sourceMappingURL=chunk-Y4V5CEWD.mjs.map
112
- //# sourceMappingURL=chunk-Y4V5CEWD.mjs.map
113
+ export { ExploreCta, useCurrentPath };
114
+ //# sourceMappingURL=chunk-2LPDCXQH.mjs.map
115
+ //# sourceMappingURL=chunk-2LPDCXQH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/explore-route.ts","../src/components/explore-cta.tsx"],"names":["ExploreCta"],"mappings":";;;;;AAcO,SAAS,eAAe,QAAA,EAAkC;AAC/D,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,QAAA,CAAwB,YAAY,IAAI,CAAA;AAEhE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,MAAA,OAAA,CAAQ,QAAQ,CAAA;AAChB,MAAA;AAAA,IACF;AACA,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,IAAA,MAAM,IAAA,GAAO,MAAM,OAAA,CAAQ,MAAA,CAAO,SAAS,QAAQ,CAAA;AACnD,IAAA,IAAA,EAAK;AACL,IAAA,MAAA,CAAO,gBAAA,CAAiB,YAAY,IAAI,CAAA;AACxC,IAAA,OAAO,MAAM,MAAA,CAAO,mBAAA,CAAoB,UAAA,EAAY,IAAI,CAAA;AAAA,EAC1D,CAAA,EAAG,CAAC,QAAQ,CAAC,CAAA;AAEb,EAAA,OAAO,IAAA;AACT;AC2CA,IAAM,eAAA,GAAkB,SAAA;AAGxB,SAAS,QAAA,CAAS,GAAkB,CAAA,EAAoB;AACtD,EAAA,IAAI,CAAC,GAAG,OAAO,KAAA;AACf,EAAA,MAAM,IAAA,GAAO,CAAC,CAAA,KAAe,CAAA,CAAE,MAAA,GAAS,IAAI,CAAA,CAAE,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA,GAAI,CAAA;AACpE,EAAA,OAAO,IAAA,CAAK,CAAC,CAAA,KAAM,IAAA,CAAK,CAAC,CAAA;AAC3B;AAGO,IAAM,UAAA,GAAa,UAAA;AAAA,EACxB,SAASA,WAAAA,CACP;AAAA,IACE,OAAA;AAAA,IACA,IAAA,GAAO,UAAA;AAAA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,MAAA,GAAS,MAAA;AAAA,QAClC,eAAA,EAAe,QAAA;AAAA,QACf,eAAA,EAAe,QAAA,KAAa,MAAA,GAAY,MAAA,GAAY,QAAA;AAAA,QACpD,eAAA,EAAe,QAAA,KAAa,MAAA,GAAY,MAAA,GAAY,QAAA;AAAA,QACpD,KAAA,EACE,OAAA,KAAY,UAAA,IAAc,YAAA,GACtB,EAAE,MAAA,EAAQ,CAAA,KAAA,EAAQ,eAAe,CAAA,GAAA,EAAM,YAAY,CAAA,CAAA,CAAA,EAAI,GACvD,MAAA;AAAA,QAEN,SAAA,EAAW,EAAA;AAAA,UACT,QAAQ,OAAO,CAAA;AAAA,UACf,0IAAA;AAAA,UACA;AAAA,SACF;AAAA,QAEA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,EAAA;AAAA,gBACT,UAAA;AAAA,gBACA,OAAA,KAAY,UAAA,GACR,SAAA,GACA,OAAA,KAAY,WACV,SAAA,GACA;AAAA,eACR;AAAA,cACA,aAAA,EAAY;AAAA;AAAA,WACd;AAAA,0BAIA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,EAAA;AAAA,gBACT,YAAY,UAAA,IAAc,kBAAA;AAAA;AAAA,gBAE1B,YAAY,QAAA,IAAY;AAAA,eAC1B;AAAA,cAEC,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA,KACF;AAAA,EAEJ;AACF","file":"chunk-2LPDCXQH.mjs","sourcesContent":["/**\n * The route the page is on, for the SDK's own entry points to `/explore` (`ExploreCta`, `SiteAssistantDock`).\n * Internal: not exported from any entry.\n */\n\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Resolve the active path without breaking SSR/prerender: the first render\n * always returns `null` (matching the server output), and the real value lands\n * in an effect. `popstate` covers back/forward; hosts that navigate with\n * `pushState` should pass `currentPath` from their router.\n */\nexport function useCurrentPath(explicit?: string): string | null {\n const [path, setPath] = useState<string | null>(explicit ?? null);\n\n useEffect(() => {\n if (explicit !== undefined) {\n setPath(explicit);\n return;\n }\n if (typeof window === \"undefined\") return;\n const read = () => setPath(window.location.pathname);\n read();\n window.addEventListener(\"popstate\", read);\n return () => window.removeEventListener(\"popstate\", read);\n }, [explicit]);\n\n return path;\n}\n","/**\n * ExploreCta — the entry point to `/explore` from a site's navigation.\n *\n * Three shapes of the same link, so a product site can place it once in the\n * desktop header, once in the mobile menu, and optionally as a floating bubble\n * on content pages, without any of them re-implementing the styling:\n *\n * - `header` — a gradient sparkle pill for the desktop nav.\n * - `mobile` — a compact full-width row for a mobile menu list.\n * - `floating` — a fixed bottom-right bubble; hides itself on `/explore`\n * so it never covers the page it links to.\n *\n * Import from the package ROOT (`@burdenoff/website-sdk`) for consistency with\n * `ExplorePage`, which must be root-imported because of tsup's\n * `splitting: false`. This component holds no context of its own, so a\n * sub-path import also works — but keeping both on the root import is one less\n * footgun for the 38 sites that ship them together.\n *\n * @example\n * ```tsx\n * import { ExploreCta } from '@burdenoff/website-sdk'\n *\n * <ExploreCta variant=\"header\" onNavigate={(href) => navigate(href)} />\n * <ExploreCta variant=\"floating\" currentPath={location.pathname} />\n * ```\n */\n\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { Sparkles } from \"lucide-react\";\n\nimport { useCurrentPath } from \"./explore-route\";\nimport { cn } from \"../utils/cn\";\n\nexport interface ExploreCtaProps {\n /** Which of the three presentations to render. */\n variant: \"header\" | \"mobile\" | \"floating\";\n /** Target route. Default `/explore`. */\n href?: string;\n /** Visible label / accessible name. Default `Ask AI`. */\n label?: string;\n /** Extra classes for the rendered element. */\n className?: string;\n /** SPA navigation. When omitted the component renders a plain `<a href>`. */\n onNavigate?: (href: string) => void;\n /** Extra click handler (analytics, closing a mobile menu, …). */\n onClick?: () => void;\n /**\n * Current route, when the host knows it (`useLocation().pathname`).\n * Used to mark the link as `aria-current=\"page\"` and to hide the floating\n * bubble on the Explore page itself. Falls back to `window.location.pathname`,\n * which cannot observe SPA `pushState` navigations on its own.\n */\n currentPath?: string;\n /**\n * BOFF-9697. For a host whose floating button opens the site-wide assistant panel (`ExplorePanel`) instead of\n * navigating: whether that panel is open. When set, the link also says it opens a dialog (`aria-haspopup`) and\n * which one (`controls`). Unset (every other site): the link renders exactly as before.\n */\n expanded?: boolean;\n /** BOFF-9697. The id of the panel the button opens; used only together with `expanded`. */\n controls?: string;\n /**\n * BOFF-9797. `floating` only: a CSS length to lift the bubble by, the site's cookie banner's height (say\n * `var(--hb-cookie-banner-height, 0px)`), so a banner on screen does not cover it. The bubble then sits at\n * `calc(1.25rem + bottomOffset)` from the bottom, set inline, so it wins over a `bottom-*` class in `className`.\n * Unset: the bubble's usual place (`bottom-5`), exactly as before.\n */\n bottomOffset?: string;\n}\n\n/** The floating bubble's own distance from the bottom of the window: `bottom-5`. */\nconst FLOATING_BOTTOM = \"1.25rem\";\n\n/** `/explore` and `/explore/` are the same page. */\nfunction samePath(a: string | null, b: string): boolean {\n if (!a) return false;\n const norm = (v: string) => (v.length > 1 ? v.replace(/\\/+$/, \"\") : v);\n return norm(a) === norm(b);\n}\n\n/** The rendered `<a>` is forwarded, so a panel can return focus to the button that opened it (BOFF-9697). */\nexport const ExploreCta = forwardRef<HTMLAnchorElement, ExploreCtaProps>(\n function ExploreCta(\n {\n variant,\n href = \"/explore\",\n label = \"Ask AI\",\n className,\n onNavigate,\n onClick,\n currentPath,\n expanded,\n controls,\n bottomOffset,\n },\n ref,\n ) {\n const path = useCurrentPath(currentPath);\n const isActive = samePath(path, href);\n\n // The floating bubble exists to get visitors TO /explore. On /explore it is\n // pure obstruction, so it removes itself.\n if (variant === \"floating\" && isActive) return null;\n\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n onClick?.();\n if (!onNavigate) return;\n // Let the browser handle modified clicks (new tab, download, …).\n if (\n event.defaultPrevented ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey ||\n event.button !== 0\n ) {\n return;\n }\n event.preventDefault();\n onNavigate(href);\n };\n\n const classes: Record<ExploreCtaProps[\"variant\"], string> = {\n // A quiet icon control, deliberately NOT a second gradient pill: a header should carry one\n // primary CTA (\"Get started\"), and a competing coloured button next to it reads as clutter.\n // This matches the theme toggle's visual weight, so the row scans as [utilities] [CTA].\n // The prominent, labelled entry point to /explore is the floating bubble, which is visible\n // on every page without scrolling. `shrink-0` keeps it from squeezing the nav.\n header:\n \"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground\",\n mobile:\n \"inline-flex w-full items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-sm font-medium text-card-foreground transition-colors hover:bg-accent hover:text-accent-foreground\",\n floating:\n \"fixed bottom-5 right-5 z-40 inline-flex items-center gap-2 rounded-full bg-gradient-to-r from-primary to-primary/70 px-4 py-3 text-sm font-medium text-primary-foreground shadow-lg transition-opacity hover:opacity-90\",\n };\n\n const hooks: Record<ExploreCtaProps[\"variant\"], string> = {\n header: \"cta-header\",\n mobile: \"cta-mobile\",\n floating: \"cta-floating\",\n };\n\n return (\n <a\n ref={ref}\n data-boff-explore={hooks[variant]}\n href={href}\n onClick={handleClick}\n aria-label={label}\n aria-current={isActive ? \"page\" : undefined}\n aria-expanded={expanded}\n aria-haspopup={expanded === undefined ? undefined : \"dialog\"}\n aria-controls={expanded === undefined ? undefined : controls}\n style={\n variant === \"floating\" && bottomOffset\n ? { bottom: `calc(${FLOATING_BOTTOM} + ${bottomOffset})` }\n : undefined\n }\n className={cn(\n classes[variant],\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n >\n <Sparkles\n className={cn(\n \"shrink-0\",\n variant === \"floating\"\n ? \"h-4 w-4\"\n : variant === \"header\"\n ? \"h-5 w-5\"\n : \"h-3.5 w-3.5\",\n )}\n aria-hidden=\"true\"\n />\n {/* The icon alone carries the affordance where space is tight; `aria-label` carries\n the accessible name at every width, so hiding the text costs nothing to a\n screen reader. Floating shows its label from `sm` up, header from `2xl`. */}\n <span\n className={cn(\n variant === \"floating\" && \"hidden sm:inline\",\n // Never labelled in the header — see the class comment above.\n variant === \"header\" && \"hidden\",\n )}\n >\n {label}\n </span>\n </a>\n );\n },\n);\n"]}
@@ -1707,6 +1707,7 @@ function ExploreAnswerBody({
1707
1707
  }
1708
1708
  var ExploreConversationContext = createContext(null);
1709
1709
  var ExploreCatalogProductsContext = createContext(null);
1710
+ var ExploreConversationStartContext = createContext(null);
1710
1711
  function useExploreConversation(options = {}) {
1711
1712
  const {
1712
1713
  productSlug,
@@ -1754,13 +1755,14 @@ function ExploreChatProvider({
1754
1755
  // `enabled` as well as `started`: on the render that first sees `enabled`, the latch above has only been queued.
1755
1756
  enabled: enabled || started
1756
1757
  });
1757
- return /* @__PURE__ */ jsx(ExploreConversationContext.Provider, { value: conversation, children: /* @__PURE__ */ jsx(
1758
+ const start = useCallback(() => setStarted(true), []);
1759
+ return /* @__PURE__ */ jsx(ExploreConversationStartContext.Provider, { value: start, children: /* @__PURE__ */ jsx(ExploreConversationContext.Provider, { value: conversation, children: /* @__PURE__ */ jsx(
1758
1760
  ExploreCatalogProductsContext.Provider,
1759
1761
  {
1760
1762
  value: conversation.catalog.products,
1761
1763
  children
1762
1764
  }
1763
- ) });
1765
+ ) }) });
1764
1766
  }
1765
1767
 
1766
1768
  // src/components/explore-scope.ts
@@ -5122,6 +5124,6 @@ function ExploreView({
5122
5124
  );
5123
5125
  }
5124
5126
 
5125
- export { EXPLORE_LOCALES, EXPLORE_PREFILL_MAX_LENGTH, ExploreAnswerBody, ExploreAnswerStyles, ExploreCatalogProductsContext, ExploreChatProvider, ExploreConversationContext, ExplorePage, answerPlainText, answerSpeechText, exploreQuestionHref, exploreStrings, inlineImageOrigins, isInlineImageAllowed, isInlineVideoAllowed, isRtlLocale, logoUrlOf, pinnedProductSlug, productNameFor, productNamesByOrigin, productSlugsByOrigin, referenceKindOf, resolveExploreLocale, speechLocaleOf, summariseReferences, useExploreConversation };
5126
- //# sourceMappingURL=chunk-FFADMVIK.mjs.map
5127
- //# sourceMappingURL=chunk-FFADMVIK.mjs.map
5127
+ export { EXPLORE_LOCALES, EXPLORE_PREFILL_MAX_LENGTH, ExploreAnswerBody, ExploreAnswerStyles, ExploreCatalogProductsContext, ExploreChatProvider, ExploreConversationContext, ExploreConversationStartContext, ExplorePage, answerPlainText, answerSpeechText, exploreQuestionHref, exploreStrings, inlineImageOrigins, isDevelopmentBuild, isInlineImageAllowed, isInlineVideoAllowed, isRtlLocale, logoUrlOf, pinnedProductSlug, productNameFor, productNamesByOrigin, productSlugsByOrigin, referenceKindOf, resolveExploreLocale, speechLocaleOf, summariseReferences, useExploreConversation };
5128
+ //# sourceMappingURL=chunk-ETI2HQEC.mjs.map
5129
+ //# sourceMappingURL=chunk-ETI2HQEC.mjs.map