@burdenoff/website-sdk 2026.1028.1 → 2026.1029.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/README.md +159 -1
- package/dist/avatar-live/index.d.mts +11 -0
- package/dist/avatar-live/index.d.ts +11 -0
- package/dist/avatar-live/index.js +120 -0
- package/dist/avatar-live/index.js.map +1 -0
- package/dist/avatar-live/index.mjs +118 -0
- package/dist/avatar-live/index.mjs.map +1 -0
- package/dist/avatar-live-view/index.d.mts +42 -0
- package/dist/avatar-live-view/index.d.ts +42 -0
- package/dist/avatar-live-view/index.js +1422 -0
- package/dist/avatar-live-view/index.js.map +1 -0
- package/dist/avatar-live-view/index.mjs +1420 -0
- package/dist/avatar-live-view/index.mjs.map +1 -0
- package/dist/components/explore.d.mts +2 -2
- package/dist/components/explore.d.ts +2 -2
- package/dist/components/explore.js +11 -4
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +11 -4
- package/dist/components/explore.mjs.map +1 -1
- package/dist/{explore-BEgq1_0O.d.mts → explore-DUTNYUOm.d.mts} +1 -1
- package/dist/{explore-CHiP9u-4.d.ts → explore-DjQE7Xia.d.ts} +1 -1
- package/dist/explore-avatar-live-config-B171o1Yo.d.ts +283 -0
- package/dist/explore-avatar-live-config-BGsGwbcq.d.mts +283 -0
- package/dist/{explore-types-_9UJu6EA.d.mts → explore-types-Bb2Ih3d8.d.mts} +1 -1
- package/dist/{explore-types-_9UJu6EA.d.ts → explore-types-Bb2Ih3d8.d.ts} +1 -1
- package/dist/hooks/index.d.mts +3 -2
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +6 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +6 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +16 -253
- package/dist/index.d.ts +16 -253
- package/dist/index.js +214 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -36
- package/dist/index.mjs.map +1 -1
- package/dist/types-CndbmBK-.d.mts +68 -0
- package/dist/types-CndbmBK-.d.ts +68 -0
- package/dist/{use-progressive-reveal-C0hkdu_i.d.ts → use-explore-chat-DunjG-3p.d.ts} +10 -36
- package/dist/{use-progressive-reveal-BFPWbEXy.d.mts → use-explore-chat-zRuoAin6.d.mts} +10 -36
- package/dist/use-progressive-reveal-ppicEgzZ.d.mts +35 -0
- package/dist/use-progressive-reveal-ppicEgzZ.d.ts +35 -0
- package/package.json +15 -3
package/dist/index.js
CHANGED
|
@@ -6468,6 +6468,11 @@ function ConceptDetail({
|
|
|
6468
6468
|
);
|
|
6469
6469
|
}
|
|
6470
6470
|
|
|
6471
|
+
// src/components/explore-fill.ts
|
|
6472
|
+
function fill(template, values) {
|
|
6473
|
+
return template.replace(/\{(\w+)\}/g, (match, key) => values[key] ?? match);
|
|
6474
|
+
}
|
|
6475
|
+
|
|
6471
6476
|
// src/components/explore-i18n.ts
|
|
6472
6477
|
var EXPLORE_LOCALES = ["en", "zh", "hi", "es", "ar", "ta"];
|
|
6473
6478
|
var RTL_LOCALES = /* @__PURE__ */ new Set(["ar"]);
|
|
@@ -7255,9 +7260,6 @@ function resolveExploreLocale(explicit) {
|
|
|
7255
7260
|
function exploreStrings(locale) {
|
|
7256
7261
|
return STRINGS[locale] ?? EN;
|
|
7257
7262
|
}
|
|
7258
|
-
function fill(template, values) {
|
|
7259
|
-
return template.replace(/\{(\w+)\}/g, (match, key) => values[key] ?? match);
|
|
7260
|
-
}
|
|
7261
7263
|
|
|
7262
7264
|
// src/components/answers-i18n.ts
|
|
7263
7265
|
var EN2 = {
|
|
@@ -11031,6 +11033,10 @@ function useExploreChat(options = {}) {
|
|
|
11031
11033
|
[client, productId]
|
|
11032
11034
|
);
|
|
11033
11035
|
const canEscalate = hasConversation && !isSharedView;
|
|
11036
|
+
const getConversationToken = React.useCallback(
|
|
11037
|
+
() => conversationTokenRef.current,
|
|
11038
|
+
[]
|
|
11039
|
+
);
|
|
11034
11040
|
return {
|
|
11035
11041
|
phase,
|
|
11036
11042
|
catalog,
|
|
@@ -11055,7 +11061,8 @@ function useExploreChat(options = {}) {
|
|
|
11055
11061
|
escalate,
|
|
11056
11062
|
canEscalate,
|
|
11057
11063
|
createShareLink,
|
|
11058
|
-
isSharedView
|
|
11064
|
+
isSharedView,
|
|
11065
|
+
getConversationToken
|
|
11059
11066
|
};
|
|
11060
11067
|
}
|
|
11061
11068
|
var optimisticCounter = 0;
|
|
@@ -15162,6 +15169,164 @@ var ExploreCta = React.forwardRef(
|
|
|
15162
15169
|
);
|
|
15163
15170
|
}
|
|
15164
15171
|
);
|
|
15172
|
+
|
|
15173
|
+
// src/components/explore-avatar-live-config.ts
|
|
15174
|
+
var AVATAR_WEB_API_PATH = "/api/web-avatar/v1";
|
|
15175
|
+
var SITE = /^[a-z][a-z0-9-]{1,31}$/;
|
|
15176
|
+
var VERSION = /^[A-Za-z0-9._-]{1,32}$/;
|
|
15177
|
+
var SITE_KEY = /^[A-Za-z0-9_-]{1,128}$/;
|
|
15178
|
+
var LOOPBACK_HOSTS2 = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
15179
|
+
function isAvatarSite(value) {
|
|
15180
|
+
return SITE.test(value);
|
|
15181
|
+
}
|
|
15182
|
+
function isAvatarVersion(value) {
|
|
15183
|
+
return VERSION.test(value);
|
|
15184
|
+
}
|
|
15185
|
+
function avatarApiBase(gatewayUrl) {
|
|
15186
|
+
if (!gatewayUrl) return null;
|
|
15187
|
+
let url;
|
|
15188
|
+
try {
|
|
15189
|
+
url = new URL(gatewayUrl);
|
|
15190
|
+
} catch {
|
|
15191
|
+
return null;
|
|
15192
|
+
}
|
|
15193
|
+
const local = url.protocol === "http:" && LOOPBACK_HOSTS2.has(url.hostname.toLowerCase());
|
|
15194
|
+
if (url.protocol !== "https:" && !local) return null;
|
|
15195
|
+
return `${url.origin}${AVATAR_WEB_API_PATH}`;
|
|
15196
|
+
}
|
|
15197
|
+
function liveConfigComplete(live) {
|
|
15198
|
+
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);
|
|
15199
|
+
}
|
|
15200
|
+
var REVIEWED = /* @__PURE__ */ new Set(["en"]);
|
|
15201
|
+
function isAvatarLiveLocaleReviewed(locale) {
|
|
15202
|
+
return REVIEWED.has(locale);
|
|
15203
|
+
}
|
|
15204
|
+
var VIEW_LOAD_TIMEOUT_MS = 8e3;
|
|
15205
|
+
function loadAvatarLiveView() {
|
|
15206
|
+
return import('./avatar-live-view/index.js').then(
|
|
15207
|
+
(loaded) => loaded.AvatarLiveView
|
|
15208
|
+
);
|
|
15209
|
+
}
|
|
15210
|
+
function ExploreAvatarLive({
|
|
15211
|
+
live,
|
|
15212
|
+
active,
|
|
15213
|
+
locale,
|
|
15214
|
+
productName,
|
|
15215
|
+
still,
|
|
15216
|
+
fallback,
|
|
15217
|
+
onContinueInChat,
|
|
15218
|
+
loadView = loadAvatarLiveView
|
|
15219
|
+
}) {
|
|
15220
|
+
const T = exploreStrings(locale);
|
|
15221
|
+
const config = useWebSDKConfig();
|
|
15222
|
+
const conversation = React.useContext(ExploreConversationContext);
|
|
15223
|
+
const base = avatarApiBase(config.gatewayUrl);
|
|
15224
|
+
const headers = React.useMemo(
|
|
15225
|
+
() => cfAccessHeaders(config.gatewayUrl, config.cfAccess),
|
|
15226
|
+
[config.gatewayUrl, config.cfAccess]
|
|
15227
|
+
);
|
|
15228
|
+
const complete = liveConfigComplete(live);
|
|
15229
|
+
const off = !complete || base === null || conversation === null || conversation.isSharedView || !isAvatarLiveLocaleReviewed(locale);
|
|
15230
|
+
React.useEffect(() => {
|
|
15231
|
+
if (!complete) {
|
|
15232
|
+
console.warn(
|
|
15233
|
+
"[WebSDK] ExplorePanel: avatar.live needs site, load, turnstileSiteKey and manifestVersion; the live avatar stays off."
|
|
15234
|
+
);
|
|
15235
|
+
}
|
|
15236
|
+
}, [complete]);
|
|
15237
|
+
const [View, setView] = React.useState(null);
|
|
15238
|
+
const [failed, setFailed] = React.useState(false);
|
|
15239
|
+
const wanted = active && !off;
|
|
15240
|
+
React.useEffect(() => {
|
|
15241
|
+
if (!wanted || View !== null) return;
|
|
15242
|
+
let cancelled = false;
|
|
15243
|
+
let loading;
|
|
15244
|
+
try {
|
|
15245
|
+
loading = loadView();
|
|
15246
|
+
} catch (error) {
|
|
15247
|
+
loading = Promise.reject(error);
|
|
15248
|
+
}
|
|
15249
|
+
const patience = setTimeout(() => {
|
|
15250
|
+
if (!cancelled) setFailed(true);
|
|
15251
|
+
}, VIEW_LOAD_TIMEOUT_MS);
|
|
15252
|
+
loading.then(
|
|
15253
|
+
(component) => {
|
|
15254
|
+
if (!cancelled) setView(() => component);
|
|
15255
|
+
},
|
|
15256
|
+
() => {
|
|
15257
|
+
clearTimeout(patience);
|
|
15258
|
+
if (!cancelled) setFailed(true);
|
|
15259
|
+
}
|
|
15260
|
+
);
|
|
15261
|
+
return () => {
|
|
15262
|
+
cancelled = true;
|
|
15263
|
+
clearTimeout(patience);
|
|
15264
|
+
};
|
|
15265
|
+
}, [wanted, View, loadView]);
|
|
15266
|
+
if (View !== null) {
|
|
15267
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15268
|
+
View,
|
|
15269
|
+
{
|
|
15270
|
+
live,
|
|
15271
|
+
active,
|
|
15272
|
+
locale,
|
|
15273
|
+
productName,
|
|
15274
|
+
still,
|
|
15275
|
+
fallback,
|
|
15276
|
+
onContinueInChat,
|
|
15277
|
+
continueInChat: T.continueInChat,
|
|
15278
|
+
off,
|
|
15279
|
+
base,
|
|
15280
|
+
headers,
|
|
15281
|
+
conversation
|
|
15282
|
+
}
|
|
15283
|
+
);
|
|
15284
|
+
}
|
|
15285
|
+
if (off || failed) {
|
|
15286
|
+
return (
|
|
15287
|
+
// `display: contents`: the earlier Avatar view's picture, line and button lay out in the pane exactly as before.
|
|
15288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15289
|
+
"div",
|
|
15290
|
+
{
|
|
15291
|
+
style: { display: "contents" },
|
|
15292
|
+
"data-boff-explore": "avatar-live",
|
|
15293
|
+
"data-phase": off ? "off" : "inert",
|
|
15294
|
+
children: fallback
|
|
15295
|
+
}
|
|
15296
|
+
)
|
|
15297
|
+
);
|
|
15298
|
+
}
|
|
15299
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15300
|
+
"div",
|
|
15301
|
+
{
|
|
15302
|
+
"data-boff-explore": "avatar-live",
|
|
15303
|
+
"data-phase": "idle",
|
|
15304
|
+
className: "flex max-h-full w-full flex-col items-center gap-4 overflow-y-auto",
|
|
15305
|
+
children: [
|
|
15306
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15307
|
+
"img",
|
|
15308
|
+
{
|
|
15309
|
+
src: still.src,
|
|
15310
|
+
alt: still.alt,
|
|
15311
|
+
decoding: "async",
|
|
15312
|
+
width: 128,
|
|
15313
|
+
height: 128,
|
|
15314
|
+
className: "shrink-0 rounded-full border border-border object-cover shadow-sm h-32 w-32"
|
|
15315
|
+
}
|
|
15316
|
+
),
|
|
15317
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15318
|
+
"p",
|
|
15319
|
+
{
|
|
15320
|
+
role: "status",
|
|
15321
|
+
"data-boff-explore": "avatar-live-status",
|
|
15322
|
+
className: "text-sm text-muted-foreground"
|
|
15323
|
+
}
|
|
15324
|
+
),
|
|
15325
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-boff-explore": "avatar-live-bot-check" })
|
|
15326
|
+
]
|
|
15327
|
+
}
|
|
15328
|
+
);
|
|
15329
|
+
}
|
|
15165
15330
|
var MARK_KEY = "boffExplorePanel";
|
|
15166
15331
|
var POS_KEY = "boffExplorePanelPos";
|
|
15167
15332
|
var DOC_KEY = "boffExplorePanelDoc";
|
|
@@ -15353,15 +15518,15 @@ function ExplorePanel({
|
|
|
15353
15518
|
const rtl = isRtlLocale(resolvedLocale);
|
|
15354
15519
|
const catalogProducts = React.useContext(ExploreCatalogProductsContext);
|
|
15355
15520
|
const pinnedSlug = pinnedProductSlug(scope, productSlug);
|
|
15356
|
-
const
|
|
15357
|
-
|
|
15358
|
-
const name = productNameFor(
|
|
15521
|
+
const pinnedName = React.useMemo(
|
|
15522
|
+
() => pinnedSlug === null ? null : productNameFor(
|
|
15359
15523
|
catalogProducts ?? ECOSYSTEM_PRODUCTS,
|
|
15360
15524
|
pinnedSlug,
|
|
15361
15525
|
productName
|
|
15362
|
-
)
|
|
15363
|
-
|
|
15364
|
-
|
|
15526
|
+
),
|
|
15527
|
+
[catalogProducts, pinnedSlug, productName]
|
|
15528
|
+
);
|
|
15529
|
+
const title = pinnedName === null ? T.panelTitle : fill(T.panelTitleProduct, { product: pinnedName });
|
|
15365
15530
|
const uid = React.useId();
|
|
15366
15531
|
const titleId = `${uid}-title`;
|
|
15367
15532
|
const chatTabId = `${uid}-chat-tab`;
|
|
@@ -15682,6 +15847,32 @@ function ExplorePanel({
|
|
|
15682
15847
|
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";
|
|
15683
15848
|
const expanded = size === "expanded";
|
|
15684
15849
|
const sizeLabel = expanded ? T.exitFullScreen : T.enterFullScreen;
|
|
15850
|
+
const avatarAlt = avatar?.name ? `${avatar.name}, ${T.liveAvatar}` : T.liveAvatar;
|
|
15851
|
+
const comingSoon = avatar ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15852
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15853
|
+
"img",
|
|
15854
|
+
{
|
|
15855
|
+
src: avatar.src,
|
|
15856
|
+
alt: avatarAlt,
|
|
15857
|
+
loading: "lazy",
|
|
15858
|
+
decoding: "async",
|
|
15859
|
+
width: 128,
|
|
15860
|
+
height: 128,
|
|
15861
|
+
className: "h-32 w-32 rounded-full border border-border object-cover shadow-sm"
|
|
15862
|
+
}
|
|
15863
|
+
),
|
|
15864
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-semibold", children: T.avatarComingSoon }),
|
|
15865
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15866
|
+
"button",
|
|
15867
|
+
{
|
|
15868
|
+
type: "button",
|
|
15869
|
+
"data-boff-explore": "panel-continue-chat",
|
|
15870
|
+
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",
|
|
15871
|
+
onClick: continueInChat,
|
|
15872
|
+
children: T.continueInChat
|
|
15873
|
+
}
|
|
15874
|
+
)
|
|
15875
|
+
] }) : null;
|
|
15685
15876
|
const tabs = [
|
|
15686
15877
|
{ key: "chat", id: chatTabId, pane: chatPaneId, label: T.tabChat },
|
|
15687
15878
|
{ key: "avatar", id: avatarTabId, pane: avatarPaneId, label: T.tabAvatar }
|
|
@@ -15811,7 +16002,7 @@ function ExplorePanel({
|
|
|
15811
16002
|
)
|
|
15812
16003
|
}
|
|
15813
16004
|
),
|
|
15814
|
-
avatar ? /* @__PURE__ */ jsxRuntime.
|
|
16005
|
+
avatar ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
15815
16006
|
"div",
|
|
15816
16007
|
{
|
|
15817
16008
|
id: avatarPaneId,
|
|
@@ -15822,31 +16013,18 @@ function ExplorePanel({
|
|
|
15822
16013
|
"absolute inset-0 flex-col items-center justify-center gap-4 overflow-y-auto bg-background p-6 text-center",
|
|
15823
16014
|
view === "avatar" ? "flex" : "hidden"
|
|
15824
16015
|
),
|
|
15825
|
-
children:
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
),
|
|
15838
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-semibold", children: T.avatarComingSoon }),
|
|
15839
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15840
|
-
"button",
|
|
15841
|
-
{
|
|
15842
|
-
type: "button",
|
|
15843
|
-
"data-boff-explore": "panel-continue-chat",
|
|
15844
|
-
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",
|
|
15845
|
-
onClick: continueInChat,
|
|
15846
|
-
children: T.continueInChat
|
|
15847
|
-
}
|
|
15848
|
-
)
|
|
15849
|
-
]
|
|
16016
|
+
children: avatar.live ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16017
|
+
ExploreAvatarLive,
|
|
16018
|
+
{
|
|
16019
|
+
live: avatar.live,
|
|
16020
|
+
active: open && view === "avatar",
|
|
16021
|
+
locale: resolvedLocale,
|
|
16022
|
+
productName: pinnedName,
|
|
16023
|
+
still: { src: avatar.src, alt: avatarAlt },
|
|
16024
|
+
fallback: comingSoon,
|
|
16025
|
+
onContinueInChat: continueInChat
|
|
16026
|
+
}
|
|
16027
|
+
) : comingSoon
|
|
15850
16028
|
}
|
|
15851
16029
|
) : null
|
|
15852
16030
|
] })
|