@burdenoff/website-sdk 2026.1028.1 → 2026.1031.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 (52) hide show
  1. package/README.md +159 -1
  2. package/dist/avatar-live/index.d.mts +11 -0
  3. package/dist/avatar-live/index.d.ts +11 -0
  4. package/dist/avatar-live/index.js +120 -0
  5. package/dist/avatar-live/index.js.map +1 -0
  6. package/dist/avatar-live/index.mjs +118 -0
  7. package/dist/avatar-live/index.mjs.map +1 -0
  8. package/dist/avatar-live-view/index.d.mts +42 -0
  9. package/dist/avatar-live-view/index.d.ts +42 -0
  10. package/dist/avatar-live-view/index.js +1422 -0
  11. package/dist/avatar-live-view/index.js.map +1 -0
  12. package/dist/avatar-live-view/index.mjs +1420 -0
  13. package/dist/avatar-live-view/index.mjs.map +1 -0
  14. package/dist/components/contact.js +9 -3
  15. package/dist/components/contact.js.map +1 -1
  16. package/dist/components/contact.mjs +9 -3
  17. package/dist/components/contact.mjs.map +1 -1
  18. package/dist/components/explore.d.mts +2 -2
  19. package/dist/components/explore.d.ts +2 -2
  20. package/dist/components/explore.js +11 -4
  21. package/dist/components/explore.js.map +1 -1
  22. package/dist/components/explore.mjs +11 -4
  23. package/dist/components/explore.mjs.map +1 -1
  24. package/dist/components/partners.js +9 -3
  25. package/dist/components/partners.js.map +1 -1
  26. package/dist/components/partners.mjs +9 -3
  27. package/dist/components/partners.mjs.map +1 -1
  28. package/dist/{explore-BEgq1_0O.d.mts → explore-DUTNYUOm.d.mts} +1 -1
  29. package/dist/{explore-CHiP9u-4.d.ts → explore-DjQE7Xia.d.ts} +1 -1
  30. package/dist/explore-avatar-live-config-B171o1Yo.d.ts +283 -0
  31. package/dist/explore-avatar-live-config-BGsGwbcq.d.mts +283 -0
  32. package/dist/{explore-types-_9UJu6EA.d.mts → explore-types-Bb2Ih3d8.d.mts} +1 -1
  33. package/dist/{explore-types-_9UJu6EA.d.ts → explore-types-Bb2Ih3d8.d.ts} +1 -1
  34. package/dist/hooks/index.d.mts +3 -2
  35. package/dist/hooks/index.d.ts +3 -2
  36. package/dist/hooks/index.js +6 -1
  37. package/dist/hooks/index.js.map +1 -1
  38. package/dist/hooks/index.mjs +6 -1
  39. package/dist/hooks/index.mjs.map +1 -1
  40. package/dist/index.d.mts +16 -253
  41. package/dist/index.d.ts +16 -253
  42. package/dist/index.js +225 -41
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.mjs +225 -41
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/types-CndbmBK-.d.mts +68 -0
  47. package/dist/types-CndbmBK-.d.ts +68 -0
  48. package/dist/{use-progressive-reveal-C0hkdu_i.d.ts → use-explore-chat-DunjG-3p.d.ts} +10 -36
  49. package/dist/{use-progressive-reveal-BFPWbEXy.d.mts → use-explore-chat-zRuoAin6.d.mts} +10 -36
  50. package/dist/use-progressive-reveal-ppicEgzZ.d.mts +35 -0
  51. package/dist/use-progressive-reveal-ppicEgzZ.d.ts +35 -0
  52. package/package.json +15 -3
package/dist/index.mjs CHANGED
@@ -883,6 +883,12 @@ function ContactPage({
883
883
  setIsSubmitting(false);
884
884
  }
885
885
  };
886
+ const heroDescriptionText = replacePlaceholders(
887
+ heroDescription,
888
+ displayName,
889
+ contactEmail
890
+ ).trim();
891
+ const hasHero = heroTitle.trim() !== "" || heroDescriptionText !== "";
886
892
  return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
887
893
  seo && /* @__PURE__ */ jsx(
888
894
  PageHead,
@@ -895,13 +901,13 @@ function ContactPage({
895
901
  url: seo.url
896
902
  }
897
903
  ),
898
- /* @__PURE__ */ jsx(
904
+ hasHero && /* @__PURE__ */ jsx(
899
905
  "section",
900
906
  {
901
907
  className: headingLevel === 2 ? "py-12 md:py-16" : "bg-gradient-to-b from-background to-muted/20 py-12 sm:py-16 md:py-20 lg:py-24",
902
908
  children: /* @__PURE__ */ jsx("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center max-w-3xl mx-auto", children: [
903
- headingLevel === 2 ? /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-bold mb-3", children: heroTitle }) : /* @__PURE__ */ jsx("h1", { className: "text-3xl sm:text-4xl md:text-5xl font-bold mb-4 sm:mb-6", children: heroTitle }),
904
- /* @__PURE__ */ jsx("p", { className: "text-lg sm:text-xl text-muted-foreground leading-relaxed", children: replacePlaceholders(heroDescription, displayName, contactEmail) })
909
+ !heroTitle.trim() ? null : headingLevel === 2 ? /* @__PURE__ */ jsx("h2", { className: "text-2xl md:text-3xl font-bold mb-3", children: heroTitle }) : /* @__PURE__ */ jsx("h1", { className: "text-3xl sm:text-4xl md:text-5xl font-bold mb-4 sm:mb-6", children: heroTitle }),
910
+ heroDescriptionText && /* @__PURE__ */ jsx("p", { className: "text-lg sm:text-xl text-muted-foreground leading-relaxed", children: heroDescriptionText })
905
911
  ] }) })
906
912
  }
907
913
  ),
@@ -5521,7 +5527,7 @@ function FilterChip({
5521
5527
  {
5522
5528
  className: cn(
5523
5529
  "rounded-full px-1.5 text-xs tabular-nums",
5524
- active ? "bg-primary-foreground/20 text-primary-foreground" : "bg-muted text-muted-foreground"
5530
+ active ? "bg-primary-foreground text-primary" : "bg-muted text-muted-foreground"
5525
5531
  ),
5526
5532
  children: count
5527
5533
  }
@@ -6438,6 +6444,11 @@ function ConceptDetail({
6438
6444
  );
6439
6445
  }
6440
6446
 
6447
+ // src/components/explore-fill.ts
6448
+ function fill(template, values) {
6449
+ return template.replace(/\{(\w+)\}/g, (match, key) => values[key] ?? match);
6450
+ }
6451
+
6441
6452
  // src/components/explore-i18n.ts
6442
6453
  var EXPLORE_LOCALES = ["en", "zh", "hi", "es", "ar", "ta"];
6443
6454
  var RTL_LOCALES = /* @__PURE__ */ new Set(["ar"]);
@@ -7225,9 +7236,6 @@ function resolveExploreLocale(explicit) {
7225
7236
  function exploreStrings(locale) {
7226
7237
  return STRINGS[locale] ?? EN;
7227
7238
  }
7228
- function fill(template, values) {
7229
- return template.replace(/\{(\w+)\}/g, (match, key) => values[key] ?? match);
7230
- }
7231
7239
 
7232
7240
  // src/components/answers-i18n.ts
7233
7241
  var EN2 = {
@@ -8976,7 +8984,7 @@ function FilterChip2({
8976
8984
  {
8977
8985
  className: cn(
8978
8986
  "rounded-full px-1.5 text-xs tabular-nums",
8979
- active ? "bg-primary-foreground/20 text-primary-foreground" : "bg-muted text-muted-foreground"
8987
+ active ? "bg-primary-foreground text-primary" : "bg-muted text-muted-foreground"
8980
8988
  ),
8981
8989
  children: count
8982
8990
  }
@@ -11001,6 +11009,10 @@ function useExploreChat(options = {}) {
11001
11009
  [client, productId]
11002
11010
  );
11003
11011
  const canEscalate = hasConversation && !isSharedView;
11012
+ const getConversationToken = useCallback(
11013
+ () => conversationTokenRef.current,
11014
+ []
11015
+ );
11004
11016
  return {
11005
11017
  phase,
11006
11018
  catalog,
@@ -11025,7 +11037,8 @@ function useExploreChat(options = {}) {
11025
11037
  escalate,
11026
11038
  canEscalate,
11027
11039
  createShareLink,
11028
- isSharedView
11040
+ isSharedView,
11041
+ getConversationToken
11029
11042
  };
11030
11043
  }
11031
11044
  var optimisticCounter = 0;
@@ -15132,6 +15145,164 @@ var ExploreCta = forwardRef(
15132
15145
  );
15133
15146
  }
15134
15147
  );
15148
+
15149
+ // src/components/explore-avatar-live-config.ts
15150
+ var AVATAR_WEB_API_PATH = "/api/web-avatar/v1";
15151
+ var SITE = /^[a-z][a-z0-9-]{1,31}$/;
15152
+ var VERSION = /^[A-Za-z0-9._-]{1,32}$/;
15153
+ var SITE_KEY = /^[A-Za-z0-9_-]{1,128}$/;
15154
+ var LOOPBACK_HOSTS2 = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
15155
+ function isAvatarSite(value) {
15156
+ return SITE.test(value);
15157
+ }
15158
+ function isAvatarVersion(value) {
15159
+ return VERSION.test(value);
15160
+ }
15161
+ function avatarApiBase(gatewayUrl) {
15162
+ if (!gatewayUrl) return null;
15163
+ let url;
15164
+ try {
15165
+ url = new URL(gatewayUrl);
15166
+ } catch {
15167
+ return null;
15168
+ }
15169
+ const local = url.protocol === "http:" && LOOPBACK_HOSTS2.has(url.hostname.toLowerCase());
15170
+ if (url.protocol !== "https:" && !local) return null;
15171
+ return `${url.origin}${AVATAR_WEB_API_PATH}`;
15172
+ }
15173
+ function liveConfigComplete(live) {
15174
+ return typeof live.load === "function" && typeof live.site === "string" && isAvatarSite(live.site) && typeof live.manifestVersion === "string" && isAvatarVersion(live.manifestVersion) && typeof live.turnstileSiteKey === "string" && SITE_KEY.test(live.turnstileSiteKey);
15175
+ }
15176
+ var REVIEWED = /* @__PURE__ */ new Set(["en"]);
15177
+ function isAvatarLiveLocaleReviewed(locale) {
15178
+ return REVIEWED.has(locale);
15179
+ }
15180
+ var VIEW_LOAD_TIMEOUT_MS = 8e3;
15181
+ function loadAvatarLiveView() {
15182
+ return import('./avatar-live-view/index.mjs').then(
15183
+ (loaded) => loaded.AvatarLiveView
15184
+ );
15185
+ }
15186
+ function ExploreAvatarLive({
15187
+ live,
15188
+ active,
15189
+ locale,
15190
+ productName,
15191
+ still,
15192
+ fallback,
15193
+ onContinueInChat,
15194
+ loadView = loadAvatarLiveView
15195
+ }) {
15196
+ const T = exploreStrings(locale);
15197
+ const config = useWebSDKConfig();
15198
+ const conversation = useContext(ExploreConversationContext);
15199
+ const base = avatarApiBase(config.gatewayUrl);
15200
+ const headers = useMemo(
15201
+ () => cfAccessHeaders(config.gatewayUrl, config.cfAccess),
15202
+ [config.gatewayUrl, config.cfAccess]
15203
+ );
15204
+ const complete = liveConfigComplete(live);
15205
+ const off = !complete || base === null || conversation === null || conversation.isSharedView || !isAvatarLiveLocaleReviewed(locale);
15206
+ useEffect(() => {
15207
+ if (!complete) {
15208
+ console.warn(
15209
+ "[WebSDK] ExplorePanel: avatar.live needs site, load, turnstileSiteKey and manifestVersion; the live avatar stays off."
15210
+ );
15211
+ }
15212
+ }, [complete]);
15213
+ const [View, setView] = useState(null);
15214
+ const [failed, setFailed] = useState(false);
15215
+ const wanted = active && !off;
15216
+ useEffect(() => {
15217
+ if (!wanted || View !== null) return;
15218
+ let cancelled = false;
15219
+ let loading;
15220
+ try {
15221
+ loading = loadView();
15222
+ } catch (error) {
15223
+ loading = Promise.reject(error);
15224
+ }
15225
+ const patience = setTimeout(() => {
15226
+ if (!cancelled) setFailed(true);
15227
+ }, VIEW_LOAD_TIMEOUT_MS);
15228
+ loading.then(
15229
+ (component) => {
15230
+ if (!cancelled) setView(() => component);
15231
+ },
15232
+ () => {
15233
+ clearTimeout(patience);
15234
+ if (!cancelled) setFailed(true);
15235
+ }
15236
+ );
15237
+ return () => {
15238
+ cancelled = true;
15239
+ clearTimeout(patience);
15240
+ };
15241
+ }, [wanted, View, loadView]);
15242
+ if (View !== null) {
15243
+ return /* @__PURE__ */ jsx(
15244
+ View,
15245
+ {
15246
+ live,
15247
+ active,
15248
+ locale,
15249
+ productName,
15250
+ still,
15251
+ fallback,
15252
+ onContinueInChat,
15253
+ continueInChat: T.continueInChat,
15254
+ off,
15255
+ base,
15256
+ headers,
15257
+ conversation
15258
+ }
15259
+ );
15260
+ }
15261
+ if (off || failed) {
15262
+ return (
15263
+ // `display: contents`: the earlier Avatar view's picture, line and button lay out in the pane exactly as before.
15264
+ /* @__PURE__ */ jsx(
15265
+ "div",
15266
+ {
15267
+ style: { display: "contents" },
15268
+ "data-boff-explore": "avatar-live",
15269
+ "data-phase": off ? "off" : "inert",
15270
+ children: fallback
15271
+ }
15272
+ )
15273
+ );
15274
+ }
15275
+ return /* @__PURE__ */ jsxs(
15276
+ "div",
15277
+ {
15278
+ "data-boff-explore": "avatar-live",
15279
+ "data-phase": "idle",
15280
+ className: "flex max-h-full w-full flex-col items-center gap-4 overflow-y-auto",
15281
+ children: [
15282
+ /* @__PURE__ */ jsx(
15283
+ "img",
15284
+ {
15285
+ src: still.src,
15286
+ alt: still.alt,
15287
+ decoding: "async",
15288
+ width: 128,
15289
+ height: 128,
15290
+ className: "shrink-0 rounded-full border border-border object-cover shadow-sm h-32 w-32"
15291
+ }
15292
+ ),
15293
+ /* @__PURE__ */ jsx(
15294
+ "p",
15295
+ {
15296
+ role: "status",
15297
+ "data-boff-explore": "avatar-live-status",
15298
+ className: "text-sm text-muted-foreground"
15299
+ }
15300
+ ),
15301
+ /* @__PURE__ */ jsx("div", { "data-boff-explore": "avatar-live-bot-check" })
15302
+ ]
15303
+ }
15304
+ );
15305
+ }
15135
15306
  var MARK_KEY = "boffExplorePanel";
15136
15307
  var POS_KEY = "boffExplorePanelPos";
15137
15308
  var DOC_KEY = "boffExplorePanelDoc";
@@ -15323,15 +15494,15 @@ function ExplorePanel({
15323
15494
  const rtl = isRtlLocale(resolvedLocale);
15324
15495
  const catalogProducts = useContext(ExploreCatalogProductsContext);
15325
15496
  const pinnedSlug = pinnedProductSlug(scope, productSlug);
15326
- const title = useMemo(() => {
15327
- if (pinnedSlug === null) return T.panelTitle;
15328
- const name = productNameFor(
15497
+ const pinnedName = useMemo(
15498
+ () => pinnedSlug === null ? null : productNameFor(
15329
15499
  catalogProducts ?? ECOSYSTEM_PRODUCTS,
15330
15500
  pinnedSlug,
15331
15501
  productName
15332
- );
15333
- return name === null ? T.panelTitle : fill(T.panelTitleProduct, { product: name });
15334
- }, [T, catalogProducts, pinnedSlug, productName]);
15502
+ ),
15503
+ [catalogProducts, pinnedSlug, productName]
15504
+ );
15505
+ const title = pinnedName === null ? T.panelTitle : fill(T.panelTitleProduct, { product: pinnedName });
15335
15506
  const uid = useId();
15336
15507
  const titleId = `${uid}-title`;
15337
15508
  const chatTabId = `${uid}-chat-tab`;
@@ -15652,6 +15823,32 @@ function ExplorePanel({
15652
15823
  const tabButton = "rounded-md px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
15653
15824
  const expanded = size === "expanded";
15654
15825
  const sizeLabel = expanded ? T.exitFullScreen : T.enterFullScreen;
15826
+ const avatarAlt = avatar?.name ? `${avatar.name}, ${T.liveAvatar}` : T.liveAvatar;
15827
+ const comingSoon = avatar ? /* @__PURE__ */ jsxs(Fragment, { children: [
15828
+ /* @__PURE__ */ jsx(
15829
+ "img",
15830
+ {
15831
+ src: avatar.src,
15832
+ alt: avatarAlt,
15833
+ loading: "lazy",
15834
+ decoding: "async",
15835
+ width: 128,
15836
+ height: 128,
15837
+ className: "h-32 w-32 rounded-full border border-border object-cover shadow-sm"
15838
+ }
15839
+ ),
15840
+ /* @__PURE__ */ jsx("p", { className: "text-base font-semibold", children: T.avatarComingSoon }),
15841
+ /* @__PURE__ */ jsx(
15842
+ "button",
15843
+ {
15844
+ type: "button",
15845
+ "data-boff-explore": "panel-continue-chat",
15846
+ className: "inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
15847
+ onClick: continueInChat,
15848
+ children: T.continueInChat
15849
+ }
15850
+ )
15851
+ ] }) : null;
15655
15852
  const tabs = [
15656
15853
  { key: "chat", id: chatTabId, pane: chatPaneId, label: T.tabChat },
15657
15854
  { key: "avatar", id: avatarTabId, pane: avatarPaneId, label: T.tabAvatar }
@@ -15781,7 +15978,7 @@ function ExplorePanel({
15781
15978
  )
15782
15979
  }
15783
15980
  ),
15784
- avatar ? /* @__PURE__ */ jsxs(
15981
+ avatar ? /* @__PURE__ */ jsx(
15785
15982
  "div",
15786
15983
  {
15787
15984
  id: avatarPaneId,
@@ -15792,31 +15989,18 @@ function ExplorePanel({
15792
15989
  "absolute inset-0 flex-col items-center justify-center gap-4 overflow-y-auto bg-background p-6 text-center",
15793
15990
  view === "avatar" ? "flex" : "hidden"
15794
15991
  ),
15795
- children: [
15796
- /* @__PURE__ */ jsx(
15797
- "img",
15798
- {
15799
- src: avatar.src,
15800
- alt: avatar.name ? `${avatar.name}, ${T.liveAvatar}` : T.liveAvatar,
15801
- loading: "lazy",
15802
- decoding: "async",
15803
- width: 128,
15804
- height: 128,
15805
- className: "h-32 w-32 rounded-full border border-border object-cover shadow-sm"
15806
- }
15807
- ),
15808
- /* @__PURE__ */ jsx("p", { className: "text-base font-semibold", children: T.avatarComingSoon }),
15809
- /* @__PURE__ */ jsx(
15810
- "button",
15811
- {
15812
- type: "button",
15813
- "data-boff-explore": "panel-continue-chat",
15814
- className: "inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
15815
- onClick: continueInChat,
15816
- children: T.continueInChat
15817
- }
15818
- )
15819
- ]
15992
+ children: avatar.live ? /* @__PURE__ */ jsx(
15993
+ ExploreAvatarLive,
15994
+ {
15995
+ live: avatar.live,
15996
+ active: open && view === "avatar",
15997
+ locale: resolvedLocale,
15998
+ productName: pinnedName,
15999
+ still: { src: avatar.src, alt: avatarAlt },
16000
+ fallback: comingSoon,
16001
+ onContinueInChat: continueInChat
16002
+ }
16003
+ ) : comingSoon
15820
16004
  }
15821
16005
  ) : null
15822
16006
  ] })