@burdenoff/website-sdk 2026.1101.4 → 2026.1102.2
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 +68 -20
- package/dist/avatar-live-view/index.d.mts +7 -2
- package/dist/avatar-live-view/index.d.ts +7 -2
- package/dist/avatar-live-view/index.js +183 -59
- package/dist/avatar-live-view/index.js.map +1 -1
- package/dist/avatar-live-view/index.mjs +181 -57
- package/dist/avatar-live-view/index.mjs.map +1 -1
- package/dist/{chunk-23H4JUL4.js → chunk-FQH3AJN3.js} +20 -3
- package/dist/chunk-FQH3AJN3.js.map +1 -0
- package/dist/{chunk-BX2USEWF.mjs → chunk-SFT3WHN5.mjs} +19 -4
- package/dist/chunk-SFT3WHN5.mjs.map +1 -0
- package/dist/{explore-avatar-live-config-BGsGwbcq.d.mts → explore-avatar-live-config-Bp3kQbU2.d.mts} +21 -6
- package/dist/{explore-avatar-live-config-B171o1Yo.d.ts → explore-avatar-live-config-Cetx8-Zu.d.ts} +21 -6
- package/dist/index.d.mts +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +19 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-23H4JUL4.js.map +0 -1
- package/dist/chunk-BX2USEWF.mjs.map +0 -1
|
@@ -5,6 +5,8 @@ var AVATAR_WEB_API_PATH = "/api/web-avatar/v1";
|
|
|
5
5
|
var SITE = /^[a-z][a-z0-9-]{1,31}$/;
|
|
6
6
|
var VERSION = /^[A-Za-z0-9._-]{1,32}$/;
|
|
7
7
|
var SITE_KEY = /^[A-Za-z0-9_-]{1,128}$/;
|
|
8
|
+
var TEST_SITE_KEY = /^\dx0{16,}[A-Za-z]{2}$/;
|
|
9
|
+
var REAL_SITE_KEY = /^0x[A-Za-z0-9_-]{16,62}$/;
|
|
8
10
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
9
11
|
function isAvatarSite(value) {
|
|
10
12
|
return SITE.test(value);
|
|
@@ -24,8 +26,21 @@ function avatarApiBase(gatewayUrl) {
|
|
|
24
26
|
if (url.protocol !== "https:" && !local) return null;
|
|
25
27
|
return `${url.origin}${AVATAR_WEB_API_PATH}`;
|
|
26
28
|
}
|
|
29
|
+
function isRealTurnstileSiteKey(key) {
|
|
30
|
+
return REAL_SITE_KEY.test(key) && !TEST_SITE_KEY.test(key);
|
|
31
|
+
}
|
|
27
32
|
function liveConfigComplete(live) {
|
|
28
|
-
|
|
33
|
+
const key = live.turnstileSiteKey;
|
|
34
|
+
const allowTest = live.allowTestSiteKey;
|
|
35
|
+
return typeof live.load === "function" && typeof live.site === "string" && isAvatarSite(live.site) && typeof live.manifestVersion === "string" && isAvatarVersion(live.manifestVersion) && (key === void 0 || key === "" || typeof key === "string" && SITE_KEY.test(key)) && (allowTest === void 0 || typeof allowTest === "boolean");
|
|
36
|
+
}
|
|
37
|
+
function turnstileSiteKeyOf(live) {
|
|
38
|
+
const key = live.turnstileSiteKey;
|
|
39
|
+
if (typeof key !== "string" || !SITE_KEY.test(key)) return null;
|
|
40
|
+
if (live.allowTestSiteKey === false && !isRealTurnstileSiteKey(key)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return key;
|
|
29
44
|
}
|
|
30
45
|
var REVIEWED = /* @__PURE__ */ new Set(["en"]);
|
|
31
46
|
function isAvatarLiveLocaleReviewed(locale) {
|
|
@@ -36,6 +51,8 @@ exports.avatarApiBase = avatarApiBase;
|
|
|
36
51
|
exports.isAvatarLiveLocaleReviewed = isAvatarLiveLocaleReviewed;
|
|
37
52
|
exports.isAvatarSite = isAvatarSite;
|
|
38
53
|
exports.isAvatarVersion = isAvatarVersion;
|
|
54
|
+
exports.isRealTurnstileSiteKey = isRealTurnstileSiteKey;
|
|
39
55
|
exports.liveConfigComplete = liveConfigComplete;
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
exports.turnstileSiteKeyOf = turnstileSiteKeyOf;
|
|
57
|
+
//# sourceMappingURL=chunk-FQH3AJN3.js.map
|
|
58
|
+
//# sourceMappingURL=chunk-FQH3AJN3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/explore-avatar-live-config.ts"],"names":[],"mappings":";;;AAuDO,IAAM,mBAAA,GAAsB,oBAAA;AAEnC,IAAM,IAAA,GAAO,wBAAA;AACb,IAAM,OAAA,GAAU,wBAAA;AAChB,IAAM,QAAA,GAAW,wBAAA;AAKjB,IAAM,aAAA,GAAgB,wBAAA;AAMtB,IAAM,aAAA,GAAgB,0BAAA;AACtB,IAAM,iCAAiB,IAAI,GAAA,CAAI,CAAC,WAAA,EAAa,WAAA,EAAa,OAAO,CAAC,CAAA;AAG3D,SAAS,aAAa,KAAA,EAAwB;AACnD,EAAA,OAAO,IAAA,CAAK,KAAK,KAAK,CAAA;AACxB;AAGO,SAAS,gBAAgB,KAAA,EAAwB;AACtD,EAAA,OAAO,OAAA,CAAQ,KAAK,KAAK,CAAA;AAC3B;AAOO,SAAS,cAAc,UAAA,EAA+C;AAC3E,EAAA,IAAI,CAAC,YAAY,OAAO,IAAA;AACxB,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,IAAI,UAAU,CAAA;AAAA,EAC1B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,MAAM,KAAA,GACJ,IAAI,QAAA,KAAa,OAAA,IAAW,eAAe,GAAA,CAAI,GAAA,CAAI,QAAA,CAAS,WAAA,EAAa,CAAA;AAC3E,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,IAAY,CAAC,OAAO,OAAO,IAAA;AAChD,EAAA,OAAO,CAAA,EAAG,GAAA,CAAI,MAAM,CAAA,EAAG,mBAAmB,CAAA,CAAA;AAC5C;AAGO,SAAS,uBAAuB,GAAA,EAAsB;AAC3D,EAAA,OAAO,cAAc,IAAA,CAAK,GAAG,KAAK,CAAC,aAAA,CAAc,KAAK,GAAG,CAAA;AAC3D;AAMO,SAAS,mBAAmB,IAAA,EAAuC;AACxE,EAAA,MAAM,MAAe,IAAA,CAAK,gBAAA;AAC1B,EAAA,MAAM,YAAqB,IAAA,CAAK,gBAAA;AAChC,EAAA,OACE,OAAO,IAAA,CAAK,IAAA,KAAS,UAAA,IACrB,OAAO,IAAA,CAAK,IAAA,KAAS,QAAA,IACrB,YAAA,CAAa,KAAK,IAAI,CAAA,IACtB,OAAO,IAAA,CAAK,oBAAoB,QAAA,IAChC,eAAA,CAAgB,IAAA,CAAK,eAAe,CAAA,KACnC,GAAA,KAAQ,MAAA,IACP,GAAA,KAAQ,MACP,OAAO,GAAA,KAAQ,QAAA,IAAY,QAAA,CAAS,KAAK,GAAG,CAAA,CAAA,KAC9C,SAAA,KAAc,MAAA,IAAa,OAAO,SAAA,KAAc,SAAA,CAAA;AAErD;AAMO,SAAS,mBACd,IAAA,EACe;AACf,EAAA,MAAM,MAAM,IAAA,CAAK,gBAAA;AACjB,EAAA,IAAI,OAAO,QAAQ,QAAA,IAAY,CAAC,SAAS,IAAA,CAAK,GAAG,GAAG,OAAO,IAAA;AAC3D,EAAA,IAAI,KAAK,gBAAA,KAAqB,KAAA,IAAS,CAAC,sBAAA,CAAuB,GAAG,CAAA,EAAG;AACnE,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,GAAA;AACT;AAMA,IAAM,QAAA,mBAAuC,IAAI,GAAA,CAAmB,CAAC,IAAI,CAAC,CAAA;AAGnE,SAAS,2BAA2B,MAAA,EAAgC;AACzE,EAAA,OAAO,QAAA,CAAS,IAAI,MAAM,CAAA;AAC5B","file":"chunk-FQH3AJN3.js","sourcesContent":["/**\n * BOFF-9797. The small part of the live avatar that the panel itself needs, whether or not it is ever opened: what a\n * host's `avatar.live` is, whether the live avatar can run on this page at all, and where its requests go.\n *\n * Everything else (the view, its state machine, the requests, the words, the bot check) is a separate chunk that a\n * site only downloads when its visitor first opens the Avatar view (see `explore-avatar-live.tsx`). That is why this\n * file is separate and kept to a few lines: it is the only part of the live avatar in the package root for a site that\n * does not pass `avatar.live`, and the part of it that decides, without loading anything, whether the chunk is wanted.\n * Types only, plus plain functions: nothing here imports a component, a context or a string table.\n */\nimport type { ExploreLocale } from \"./explore-i18n\";\nimport type { AvatarLiveModule } from \"../avatar-live/types\";\nimport type { UseExploreChatResult } from \"../hooks/use-explore-chat\";\n\n/**\n * BOFF-9797. A host's opt-in to the live avatar on its panel's Avatar tab. `site`, `load` and `manifestVersion` are\n * required; a config that is incomplete, or has an optional field of the wrong shape, leaves the tab as it was (and a\n * warning in the console).\n */\nexport interface ExplorePanelAvatarLive {\n /** The site, as the live avatar service knows it: `healthybowl`. */\n site: string;\n /**\n * Loads the live avatar's room module: `() => import('@burdenoff/website-sdk/avatar-live')`. Called only after the\n * visitor presses Start on the consent card, never on page load or on opening the tab. That entry needs the\n * package's optional peer dependency for media rooms (see the README).\n */\n load: () => Promise<AvatarLiveModule>;\n /**\n * The site's Cloudflare Turnstile site key, for the bot check that runs when the visitor presses Start. Used only when\n * the server says it checks for bots (its availability's `botCheck`, contract v1.2), or says nothing of it (a server\n * older than v1.2, which always checks): such a server's live avatar then needs a key, and without one the tab stays\n * as it was. A server that runs no bot check needs none, and no Cloudflare script is loaded for it, key or not.\n */\n turnstileSiteKey?: string;\n /**\n * Whether `turnstileSiteKey` may be one of Cloudflare's test keys (`1x00000000000000000000AA` and keys of their\n * shape). `websiteAvatarLive` sets it: true on alpha only, false everywhere else, so a production page never runs a\n * test widget. Unset (a config made by hand): any key of a valid shape, as before.\n */\n allowTestSiteKey?: boolean;\n /** The version of the suggested-question list the panel shows (its `examplePrompts`), such as `hb-en-1`. */\n manifestVersion: string;\n}\n\n/**\n * What the live avatar reads of the panel's conversation: the transcript, whether it is read-only and the token, and\n * `reset` (the chat's own New chat) for its New chat button where the conversation can never be read.\n */\nexport type AvatarConversation = Pick<\n UseExploreChatResult,\n \"messages\" | \"isSharedView\" | \"getConversationToken\" | \"reset\"\n>;\n\n/** The web branch's routes, under the gateway's origin. */\nexport const AVATAR_WEB_API_PATH = \"/api/web-avatar/v1\";\n\nconst SITE = /^[a-z][a-z0-9-]{1,31}$/;\nconst VERSION = /^[A-Za-z0-9._-]{1,32}$/;\nconst SITE_KEY = /^[A-Za-z0-9_-]{1,128}$/;\n/**\n * The shape of Cloudflare's dummy site keys: a digit, `x`, a run of zeros and two letters (`1x00000000000000000000AA`,\n * `2x00000000000000000000AB`, `3x00000000000000000000FF`, …). Also catches an all-zero `0x…` placeholder.\n */\nconst TEST_SITE_KEY = /^\\dx0{16,}[A-Za-z]{2}$/;\n/**\n * A real-looking site key. Cloudflare documents no format for real keys; every key it issues starts `0x` (in practice\n * `0x4AAAAAAA…`, about 24 characters), in letters, digits, `_` and `-`. The length is kept loose (18 to 64 in all) so a\n * longer key Cloudflare might issue later still passes, and the charset matches what the panel accepts.\n */\nconst REAL_SITE_KEY = /^0x[A-Za-z0-9_-]{16,62}$/;\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\"]);\n\n/** A site slug the contract accepts (`healthybowl`). */\nexport function isAvatarSite(value: string): boolean {\n return SITE.test(value);\n}\n\n/** A consent or manifest version the contract accepts (`hb-en-1`). */\nexport function isAvatarVersion(value: string): boolean {\n return VERSION.test(value);\n}\n\n/**\n * The web branch's base URL on the SDK's configured gateway: the gateway URL's origin, plus\n * {@link AVATAR_WEB_API_PATH}. Null for anything that is not an `https:` URL (or `http:` on this machine, for local\n * development).\n */\nexport function avatarApiBase(gatewayUrl: string | undefined): string | null {\n if (!gatewayUrl) return null;\n let url: URL;\n try {\n url = new URL(gatewayUrl);\n } catch {\n return null;\n }\n const local =\n url.protocol === \"http:\" && LOOPBACK_HOSTS.has(url.hostname.toLowerCase());\n if (url.protocol !== \"https:\" && !local) return null;\n return `${url.origin}${AVATAR_WEB_API_PATH}`;\n}\n\n/** A real-looking Turnstile site key: `0x…`, and not of the shape of Cloudflare's test keys. */\nexport function isRealTurnstileSiteKey(key: string): boolean {\n return REAL_SITE_KEY.test(key) && !TEST_SITE_KEY.test(key);\n}\n\n/**\n * Whether a host's `avatar.live` has everything the live avatar needs, in the shapes the contract accepts. The site\n * key is optional (an empty one is none), and checked only when it is there.\n */\nexport function liveConfigComplete(live: ExplorePanelAvatarLive): boolean {\n const key: unknown = live.turnstileSiteKey;\n const allowTest: unknown = live.allowTestSiteKey;\n return (\n typeof live.load === \"function\" &&\n typeof live.site === \"string\" &&\n isAvatarSite(live.site) &&\n typeof live.manifestVersion === \"string\" &&\n isAvatarVersion(live.manifestVersion) &&\n (key === undefined ||\n key === \"\" ||\n (typeof key === \"string\" && SITE_KEY.test(key))) &&\n (allowTest === undefined || typeof allowTest === \"boolean\")\n );\n}\n\n/**\n * The site key a bot check at Start may use, or null when there is none: no key, one of no valid shape, or one of\n * Cloudflare's test keys where `allowTestSiteKey` is false.\n */\nexport function turnstileSiteKeyOf(\n live: ExplorePanelAvatarLive,\n): string | null {\n const key = live.turnstileSiteKey;\n if (typeof key !== \"string\" || !SITE_KEY.test(key)) return null;\n if (live.allowTestSiteKey === false && !isRealTurnstileSiteKey(key)) {\n return null;\n }\n return key;\n}\n\n/**\n * The locales whose live-avatar strings have been reviewed. The live avatar runs only in these; see\n * `explore-avatar-i18n.ts`. English only, until a named reviewer signs off on another.\n */\nconst REVIEWED: ReadonlySet<ExploreLocale> = new Set<ExploreLocale>([\"en\"]);\n\n/** Whether the live avatar may run in `locale`: its strings have been reviewed. */\nexport function isAvatarLiveLocaleReviewed(locale: ExploreLocale): boolean {\n return REVIEWED.has(locale);\n}\n"]}
|
|
@@ -3,6 +3,8 @@ var AVATAR_WEB_API_PATH = "/api/web-avatar/v1";
|
|
|
3
3
|
var SITE = /^[a-z][a-z0-9-]{1,31}$/;
|
|
4
4
|
var VERSION = /^[A-Za-z0-9._-]{1,32}$/;
|
|
5
5
|
var SITE_KEY = /^[A-Za-z0-9_-]{1,128}$/;
|
|
6
|
+
var TEST_SITE_KEY = /^\dx0{16,}[A-Za-z]{2}$/;
|
|
7
|
+
var REAL_SITE_KEY = /^0x[A-Za-z0-9_-]{16,62}$/;
|
|
6
8
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
7
9
|
function isAvatarSite(value) {
|
|
8
10
|
return SITE.test(value);
|
|
@@ -22,14 +24,27 @@ function avatarApiBase(gatewayUrl) {
|
|
|
22
24
|
if (url.protocol !== "https:" && !local) return null;
|
|
23
25
|
return `${url.origin}${AVATAR_WEB_API_PATH}`;
|
|
24
26
|
}
|
|
27
|
+
function isRealTurnstileSiteKey(key) {
|
|
28
|
+
return REAL_SITE_KEY.test(key) && !TEST_SITE_KEY.test(key);
|
|
29
|
+
}
|
|
25
30
|
function liveConfigComplete(live) {
|
|
26
|
-
|
|
31
|
+
const key = live.turnstileSiteKey;
|
|
32
|
+
const allowTest = live.allowTestSiteKey;
|
|
33
|
+
return typeof live.load === "function" && typeof live.site === "string" && isAvatarSite(live.site) && typeof live.manifestVersion === "string" && isAvatarVersion(live.manifestVersion) && (key === void 0 || key === "" || typeof key === "string" && SITE_KEY.test(key)) && (allowTest === void 0 || typeof allowTest === "boolean");
|
|
34
|
+
}
|
|
35
|
+
function turnstileSiteKeyOf(live) {
|
|
36
|
+
const key = live.turnstileSiteKey;
|
|
37
|
+
if (typeof key !== "string" || !SITE_KEY.test(key)) return null;
|
|
38
|
+
if (live.allowTestSiteKey === false && !isRealTurnstileSiteKey(key)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return key;
|
|
27
42
|
}
|
|
28
43
|
var REVIEWED = /* @__PURE__ */ new Set(["en"]);
|
|
29
44
|
function isAvatarLiveLocaleReviewed(locale) {
|
|
30
45
|
return REVIEWED.has(locale);
|
|
31
46
|
}
|
|
32
47
|
|
|
33
|
-
export { avatarApiBase, isAvatarLiveLocaleReviewed, isAvatarSite, isAvatarVersion, liveConfigComplete };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
export { avatarApiBase, isAvatarLiveLocaleReviewed, isAvatarSite, isAvatarVersion, isRealTurnstileSiteKey, liveConfigComplete, turnstileSiteKeyOf };
|
|
49
|
+
//# sourceMappingURL=chunk-SFT3WHN5.mjs.map
|
|
50
|
+
//# sourceMappingURL=chunk-SFT3WHN5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/explore-avatar-live-config.ts"],"names":[],"mappings":";AAuDO,IAAM,mBAAA,GAAsB,oBAAA;AAEnC,IAAM,IAAA,GAAO,wBAAA;AACb,IAAM,OAAA,GAAU,wBAAA;AAChB,IAAM,QAAA,GAAW,wBAAA;AAKjB,IAAM,aAAA,GAAgB,wBAAA;AAMtB,IAAM,aAAA,GAAgB,0BAAA;AACtB,IAAM,iCAAiB,IAAI,GAAA,CAAI,CAAC,WAAA,EAAa,WAAA,EAAa,OAAO,CAAC,CAAA;AAG3D,SAAS,aAAa,KAAA,EAAwB;AACnD,EAAA,OAAO,IAAA,CAAK,KAAK,KAAK,CAAA;AACxB;AAGO,SAAS,gBAAgB,KAAA,EAAwB;AACtD,EAAA,OAAO,OAAA,CAAQ,KAAK,KAAK,CAAA;AAC3B;AAOO,SAAS,cAAc,UAAA,EAA+C;AAC3E,EAAA,IAAI,CAAC,YAAY,OAAO,IAAA;AACxB,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,IAAI,UAAU,CAAA;AAAA,EAC1B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,MAAM,KAAA,GACJ,IAAI,QAAA,KAAa,OAAA,IAAW,eAAe,GAAA,CAAI,GAAA,CAAI,QAAA,CAAS,WAAA,EAAa,CAAA;AAC3E,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,IAAY,CAAC,OAAO,OAAO,IAAA;AAChD,EAAA,OAAO,CAAA,EAAG,GAAA,CAAI,MAAM,CAAA,EAAG,mBAAmB,CAAA,CAAA;AAC5C;AAGO,SAAS,uBAAuB,GAAA,EAAsB;AAC3D,EAAA,OAAO,cAAc,IAAA,CAAK,GAAG,KAAK,CAAC,aAAA,CAAc,KAAK,GAAG,CAAA;AAC3D;AAMO,SAAS,mBAAmB,IAAA,EAAuC;AACxE,EAAA,MAAM,MAAe,IAAA,CAAK,gBAAA;AAC1B,EAAA,MAAM,YAAqB,IAAA,CAAK,gBAAA;AAChC,EAAA,OACE,OAAO,IAAA,CAAK,IAAA,KAAS,UAAA,IACrB,OAAO,IAAA,CAAK,IAAA,KAAS,QAAA,IACrB,YAAA,CAAa,KAAK,IAAI,CAAA,IACtB,OAAO,IAAA,CAAK,oBAAoB,QAAA,IAChC,eAAA,CAAgB,IAAA,CAAK,eAAe,CAAA,KACnC,GAAA,KAAQ,MAAA,IACP,GAAA,KAAQ,MACP,OAAO,GAAA,KAAQ,QAAA,IAAY,QAAA,CAAS,KAAK,GAAG,CAAA,CAAA,KAC9C,SAAA,KAAc,MAAA,IAAa,OAAO,SAAA,KAAc,SAAA,CAAA;AAErD;AAMO,SAAS,mBACd,IAAA,EACe;AACf,EAAA,MAAM,MAAM,IAAA,CAAK,gBAAA;AACjB,EAAA,IAAI,OAAO,QAAQ,QAAA,IAAY,CAAC,SAAS,IAAA,CAAK,GAAG,GAAG,OAAO,IAAA;AAC3D,EAAA,IAAI,KAAK,gBAAA,KAAqB,KAAA,IAAS,CAAC,sBAAA,CAAuB,GAAG,CAAA,EAAG;AACnE,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,GAAA;AACT;AAMA,IAAM,QAAA,mBAAuC,IAAI,GAAA,CAAmB,CAAC,IAAI,CAAC,CAAA;AAGnE,SAAS,2BAA2B,MAAA,EAAgC;AACzE,EAAA,OAAO,QAAA,CAAS,IAAI,MAAM,CAAA;AAC5B","file":"chunk-SFT3WHN5.mjs","sourcesContent":["/**\n * BOFF-9797. The small part of the live avatar that the panel itself needs, whether or not it is ever opened: what a\n * host's `avatar.live` is, whether the live avatar can run on this page at all, and where its requests go.\n *\n * Everything else (the view, its state machine, the requests, the words, the bot check) is a separate chunk that a\n * site only downloads when its visitor first opens the Avatar view (see `explore-avatar-live.tsx`). That is why this\n * file is separate and kept to a few lines: it is the only part of the live avatar in the package root for a site that\n * does not pass `avatar.live`, and the part of it that decides, without loading anything, whether the chunk is wanted.\n * Types only, plus plain functions: nothing here imports a component, a context or a string table.\n */\nimport type { ExploreLocale } from \"./explore-i18n\";\nimport type { AvatarLiveModule } from \"../avatar-live/types\";\nimport type { UseExploreChatResult } from \"../hooks/use-explore-chat\";\n\n/**\n * BOFF-9797. A host's opt-in to the live avatar on its panel's Avatar tab. `site`, `load` and `manifestVersion` are\n * required; a config that is incomplete, or has an optional field of the wrong shape, leaves the tab as it was (and a\n * warning in the console).\n */\nexport interface ExplorePanelAvatarLive {\n /** The site, as the live avatar service knows it: `healthybowl`. */\n site: string;\n /**\n * Loads the live avatar's room module: `() => import('@burdenoff/website-sdk/avatar-live')`. Called only after the\n * visitor presses Start on the consent card, never on page load or on opening the tab. That entry needs the\n * package's optional peer dependency for media rooms (see the README).\n */\n load: () => Promise<AvatarLiveModule>;\n /**\n * The site's Cloudflare Turnstile site key, for the bot check that runs when the visitor presses Start. Used only when\n * the server says it checks for bots (its availability's `botCheck`, contract v1.2), or says nothing of it (a server\n * older than v1.2, which always checks): such a server's live avatar then needs a key, and without one the tab stays\n * as it was. A server that runs no bot check needs none, and no Cloudflare script is loaded for it, key or not.\n */\n turnstileSiteKey?: string;\n /**\n * Whether `turnstileSiteKey` may be one of Cloudflare's test keys (`1x00000000000000000000AA` and keys of their\n * shape). `websiteAvatarLive` sets it: true on alpha only, false everywhere else, so a production page never runs a\n * test widget. Unset (a config made by hand): any key of a valid shape, as before.\n */\n allowTestSiteKey?: boolean;\n /** The version of the suggested-question list the panel shows (its `examplePrompts`), such as `hb-en-1`. */\n manifestVersion: string;\n}\n\n/**\n * What the live avatar reads of the panel's conversation: the transcript, whether it is read-only and the token, and\n * `reset` (the chat's own New chat) for its New chat button where the conversation can never be read.\n */\nexport type AvatarConversation = Pick<\n UseExploreChatResult,\n \"messages\" | \"isSharedView\" | \"getConversationToken\" | \"reset\"\n>;\n\n/** The web branch's routes, under the gateway's origin. */\nexport const AVATAR_WEB_API_PATH = \"/api/web-avatar/v1\";\n\nconst SITE = /^[a-z][a-z0-9-]{1,31}$/;\nconst VERSION = /^[A-Za-z0-9._-]{1,32}$/;\nconst SITE_KEY = /^[A-Za-z0-9_-]{1,128}$/;\n/**\n * The shape of Cloudflare's dummy site keys: a digit, `x`, a run of zeros and two letters (`1x00000000000000000000AA`,\n * `2x00000000000000000000AB`, `3x00000000000000000000FF`, …). Also catches an all-zero `0x…` placeholder.\n */\nconst TEST_SITE_KEY = /^\\dx0{16,}[A-Za-z]{2}$/;\n/**\n * A real-looking site key. Cloudflare documents no format for real keys; every key it issues starts `0x` (in practice\n * `0x4AAAAAAA…`, about 24 characters), in letters, digits, `_` and `-`. The length is kept loose (18 to 64 in all) so a\n * longer key Cloudflare might issue later still passes, and the charset matches what the panel accepts.\n */\nconst REAL_SITE_KEY = /^0x[A-Za-z0-9_-]{16,62}$/;\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\"]);\n\n/** A site slug the contract accepts (`healthybowl`). */\nexport function isAvatarSite(value: string): boolean {\n return SITE.test(value);\n}\n\n/** A consent or manifest version the contract accepts (`hb-en-1`). */\nexport function isAvatarVersion(value: string): boolean {\n return VERSION.test(value);\n}\n\n/**\n * The web branch's base URL on the SDK's configured gateway: the gateway URL's origin, plus\n * {@link AVATAR_WEB_API_PATH}. Null for anything that is not an `https:` URL (or `http:` on this machine, for local\n * development).\n */\nexport function avatarApiBase(gatewayUrl: string | undefined): string | null {\n if (!gatewayUrl) return null;\n let url: URL;\n try {\n url = new URL(gatewayUrl);\n } catch {\n return null;\n }\n const local =\n url.protocol === \"http:\" && LOOPBACK_HOSTS.has(url.hostname.toLowerCase());\n if (url.protocol !== \"https:\" && !local) return null;\n return `${url.origin}${AVATAR_WEB_API_PATH}`;\n}\n\n/** A real-looking Turnstile site key: `0x…`, and not of the shape of Cloudflare's test keys. */\nexport function isRealTurnstileSiteKey(key: string): boolean {\n return REAL_SITE_KEY.test(key) && !TEST_SITE_KEY.test(key);\n}\n\n/**\n * Whether a host's `avatar.live` has everything the live avatar needs, in the shapes the contract accepts. The site\n * key is optional (an empty one is none), and checked only when it is there.\n */\nexport function liveConfigComplete(live: ExplorePanelAvatarLive): boolean {\n const key: unknown = live.turnstileSiteKey;\n const allowTest: unknown = live.allowTestSiteKey;\n return (\n typeof live.load === \"function\" &&\n typeof live.site === \"string\" &&\n isAvatarSite(live.site) &&\n typeof live.manifestVersion === \"string\" &&\n isAvatarVersion(live.manifestVersion) &&\n (key === undefined ||\n key === \"\" ||\n (typeof key === \"string\" && SITE_KEY.test(key))) &&\n (allowTest === undefined || typeof allowTest === \"boolean\")\n );\n}\n\n/**\n * The site key a bot check at Start may use, or null when there is none: no key, one of no valid shape, or one of\n * Cloudflare's test keys where `allowTestSiteKey` is false.\n */\nexport function turnstileSiteKeyOf(\n live: ExplorePanelAvatarLive,\n): string | null {\n const key = live.turnstileSiteKey;\n if (typeof key !== \"string\" || !SITE_KEY.test(key)) return null;\n if (live.allowTestSiteKey === false && !isRealTurnstileSiteKey(key)) {\n return null;\n }\n return key;\n}\n\n/**\n * The locales whose live-avatar strings have been reviewed. The live avatar runs only in these; see\n * `explore-avatar-i18n.ts`. English only, until a named reviewer signs off on another.\n */\nconst REVIEWED: ReadonlySet<ExploreLocale> = new Set<ExploreLocale>([\"en\"]);\n\n/** Whether the live avatar may run in `locale`: its strings have been reviewed. */\nexport function isAvatarLiveLocaleReviewed(locale: ExploreLocale): boolean {\n return REVIEWED.has(locale);\n}\n"]}
|
package/dist/{explore-avatar-live-config-BGsGwbcq.d.mts → explore-avatar-live-config-Bp3kQbU2.d.mts}
RENAMED
|
@@ -260,8 +260,9 @@ declare function speechLocaleOf(locale: ExploreLocale): string;
|
|
|
260
260
|
*/
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
* BOFF-9797. A host's opt-in to the live avatar on its panel's Avatar tab.
|
|
264
|
-
* incomplete leaves the tab as it was (and a
|
|
263
|
+
* BOFF-9797. A host's opt-in to the live avatar on its panel's Avatar tab. `site`, `load` and `manifestVersion` are
|
|
264
|
+
* required; a config that is incomplete, or has an optional field of the wrong shape, leaves the tab as it was (and a
|
|
265
|
+
* warning in the console).
|
|
265
266
|
*/
|
|
266
267
|
interface ExplorePanelAvatarLive {
|
|
267
268
|
/** The site, as the live avatar service knows it: `healthybowl`. */
|
|
@@ -272,12 +273,26 @@ interface ExplorePanelAvatarLive {
|
|
|
272
273
|
* package's optional peer dependency for media rooms (see the README).
|
|
273
274
|
*/
|
|
274
275
|
load: () => Promise<AvatarLiveModule>;
|
|
275
|
-
/**
|
|
276
|
-
|
|
276
|
+
/**
|
|
277
|
+
* The site's Cloudflare Turnstile site key, for the bot check that runs when the visitor presses Start. Used only when
|
|
278
|
+
* the server says it checks for bots (its availability's `botCheck`, contract v1.2), or says nothing of it (a server
|
|
279
|
+
* older than v1.2, which always checks): such a server's live avatar then needs a key, and without one the tab stays
|
|
280
|
+
* as it was. A server that runs no bot check needs none, and no Cloudflare script is loaded for it, key or not.
|
|
281
|
+
*/
|
|
282
|
+
turnstileSiteKey?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Whether `turnstileSiteKey` may be one of Cloudflare's test keys (`1x00000000000000000000AA` and keys of their
|
|
285
|
+
* shape). `websiteAvatarLive` sets it: true on alpha only, false everywhere else, so a production page never runs a
|
|
286
|
+
* test widget. Unset (a config made by hand): any key of a valid shape, as before.
|
|
287
|
+
*/
|
|
288
|
+
allowTestSiteKey?: boolean;
|
|
277
289
|
/** The version of the suggested-question list the panel shows (its `examplePrompts`), such as `hb-en-1`. */
|
|
278
290
|
manifestVersion: string;
|
|
279
291
|
}
|
|
280
|
-
/**
|
|
281
|
-
|
|
292
|
+
/**
|
|
293
|
+
* What the live avatar reads of the panel's conversation: the transcript, whether it is read-only and the token, and
|
|
294
|
+
* `reset` (the chat's own New chat) for its New chat button where the conversation can never be read.
|
|
295
|
+
*/
|
|
296
|
+
type AvatarConversation = Pick<UseExploreChatResult, "messages" | "isSharedView" | "getConversationToken" | "reset">;
|
|
282
297
|
|
|
283
298
|
export { type AvatarConversation as A, type ExplorePanelAvatarLive as E, type ExploreLocale as a, EXPLORE_LOCALES as b, type ExploreStrings as c, speechLocaleOf as s };
|
package/dist/{explore-avatar-live-config-B171o1Yo.d.ts → explore-avatar-live-config-Cetx8-Zu.d.ts}
RENAMED
|
@@ -260,8 +260,9 @@ declare function speechLocaleOf(locale: ExploreLocale): string;
|
|
|
260
260
|
*/
|
|
261
261
|
|
|
262
262
|
/**
|
|
263
|
-
* BOFF-9797. A host's opt-in to the live avatar on its panel's Avatar tab.
|
|
264
|
-
* incomplete leaves the tab as it was (and a
|
|
263
|
+
* BOFF-9797. A host's opt-in to the live avatar on its panel's Avatar tab. `site`, `load` and `manifestVersion` are
|
|
264
|
+
* required; a config that is incomplete, or has an optional field of the wrong shape, leaves the tab as it was (and a
|
|
265
|
+
* warning in the console).
|
|
265
266
|
*/
|
|
266
267
|
interface ExplorePanelAvatarLive {
|
|
267
268
|
/** The site, as the live avatar service knows it: `healthybowl`. */
|
|
@@ -272,12 +273,26 @@ interface ExplorePanelAvatarLive {
|
|
|
272
273
|
* package's optional peer dependency for media rooms (see the README).
|
|
273
274
|
*/
|
|
274
275
|
load: () => Promise<AvatarLiveModule>;
|
|
275
|
-
/**
|
|
276
|
-
|
|
276
|
+
/**
|
|
277
|
+
* The site's Cloudflare Turnstile site key, for the bot check that runs when the visitor presses Start. Used only when
|
|
278
|
+
* the server says it checks for bots (its availability's `botCheck`, contract v1.2), or says nothing of it (a server
|
|
279
|
+
* older than v1.2, which always checks): such a server's live avatar then needs a key, and without one the tab stays
|
|
280
|
+
* as it was. A server that runs no bot check needs none, and no Cloudflare script is loaded for it, key or not.
|
|
281
|
+
*/
|
|
282
|
+
turnstileSiteKey?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Whether `turnstileSiteKey` may be one of Cloudflare's test keys (`1x00000000000000000000AA` and keys of their
|
|
285
|
+
* shape). `websiteAvatarLive` sets it: true on alpha only, false everywhere else, so a production page never runs a
|
|
286
|
+
* test widget. Unset (a config made by hand): any key of a valid shape, as before.
|
|
287
|
+
*/
|
|
288
|
+
allowTestSiteKey?: boolean;
|
|
277
289
|
/** The version of the suggested-question list the panel shows (its `examplePrompts`), such as `hb-en-1`. */
|
|
278
290
|
manifestVersion: string;
|
|
279
291
|
}
|
|
280
|
-
/**
|
|
281
|
-
|
|
292
|
+
/**
|
|
293
|
+
* What the live avatar reads of the panel's conversation: the transcript, whether it is read-only and the token, and
|
|
294
|
+
* `reset` (the chat's own New chat) for its New chat button where the conversation can never be read.
|
|
295
|
+
*/
|
|
296
|
+
type AvatarConversation = Pick<UseExploreChatResult, "messages" | "isSharedView" | "getConversationToken" | "reset">;
|
|
282
297
|
|
|
283
298
|
export { type AvatarConversation as A, type ExplorePanelAvatarLive as E, type ExploreLocale as a, EXPLORE_LOCALES as b, type ExploreStrings as c, speechLocaleOf as s };
|
package/dist/index.d.mts
CHANGED
|
@@ -18,8 +18,8 @@ export { LaunchCountdown, LaunchCountdownProps } from './components/launch-count
|
|
|
18
18
|
export { ProblemSolved, ProblemsSolvedSection, ProblemsSolvedSectionProps } from './components/problems-solved.mjs';
|
|
19
19
|
export { DetectedPlatform, ElectronDownloadLink, ElectronDownloadLinkProps, detectElectronPlatform } from './components/electron-download.mjs';
|
|
20
20
|
import { Components } from 'react-markdown';
|
|
21
|
-
import { a as ExploreLocale, E as ExplorePanelAvatarLive } from './explore-avatar-live-config-
|
|
22
|
-
export { b as EXPLORE_LOCALES, c as ExploreStrings, s as speechLocaleOf } from './explore-avatar-live-config-
|
|
21
|
+
import { a as ExploreLocale, E as ExplorePanelAvatarLive } from './explore-avatar-live-config-Bp3kQbU2.mjs';
|
|
22
|
+
export { b as EXPLORE_LOCALES, c as ExploreStrings, s as speechLocaleOf } from './explore-avatar-live-config-Bp3kQbU2.mjs';
|
|
23
23
|
import { A as AnswerRendererStrings, E as ExploreScope } from './explore-DUTNYUOm.mjs';
|
|
24
24
|
export { a as EXPLORE_PREFILL_MAX_LENGTH, b as ExploreAnswerBody, c as ExploreAnswerBodyProps, d as ExploreAnswerStyles, e as ExplorePage, f as ExplorePageProps, g as answerPlainText, h as answerSpeechText, i as exploreQuestionHref, j as inlineImageOrigins, k as isInlineImageAllowed, l as isInlineVideoAllowed, p as productSlugsByOrigin } from './explore-DUTNYUOm.mjs';
|
|
25
25
|
export { ExploreCta, ExploreCtaProps } from './components/explore-cta.mjs';
|
|
@@ -811,20 +811,28 @@ declare function SiteAssistantDock(props: SiteAssistantDockProps): react.JSX.Ele
|
|
|
811
811
|
* })
|
|
812
812
|
* ```
|
|
813
813
|
*
|
|
814
|
-
* The
|
|
815
|
-
*
|
|
814
|
+
* The server decides whether the live avatar is offered on the site (its reviewed site list, its pause and its caps),
|
|
815
|
+
* and whether it checks for bots (its availability's `botCheck`, contract v1.2). The key matters only when it does. The
|
|
816
|
+
* rule, so that a misconfigured build shows the still picture instead of a live avatar whose bot check can never pass,
|
|
817
|
+
* or always passes:
|
|
816
818
|
*
|
|
817
|
-
* -
|
|
819
|
+
* - `enabled: false`: `undefined` (the still picture, "Live avatar coming soon"), whatever else is set.
|
|
820
|
+
* - No key, or an empty one: the live config without a key. The server decides: a server that runs no bot check offers
|
|
821
|
+
* the live avatar, one that checks for bots (or a site it does not list) leaves the still picture.
|
|
818
822
|
* - Alpha (`deployEnv` `alpha`): Cloudflare's always-pass test key `1x00000000000000000000AA` (the alpha gateway runs
|
|
819
823
|
* Turnstile in dummy mode with the matching test secret), or a real-looking key.
|
|
820
824
|
* - Every other environment, production included, and an unset one: a real-looking key only. Cloudflare's test keys
|
|
821
825
|
* (`1x…AA`, `2x…AB`, `1x…BB`, `2x…BB`, `3x…FF`, and anything of their shape) are refused.
|
|
826
|
+
* - A key that is set but refused: `undefined`, the still picture, never a live avatar without the key it was given.
|
|
822
827
|
*/
|
|
823
828
|
|
|
824
829
|
interface WebsiteAvatarLiveOptions {
|
|
825
830
|
/** The environment the site is built for: `import.meta.env.VITE_DEPLOY_ENV` (`alpha`, `production`, …). */
|
|
826
831
|
deployEnv: string | null | undefined;
|
|
827
|
-
/**
|
|
832
|
+
/**
|
|
833
|
+
* The site's Turnstile site key: `import.meta.env.VITE_AVATAR_TURNSTILE_SITE_KEY`. Unset or empty: no key, and the
|
|
834
|
+
* live avatar runs only where the server runs no bot check.
|
|
835
|
+
*/
|
|
828
836
|
siteKey: string | null | undefined;
|
|
829
837
|
/** The site, as the live avatar service knows it (`healthybowl`). */
|
|
830
838
|
site: string;
|
|
@@ -832,9 +840,11 @@ interface WebsiteAvatarLiveOptions {
|
|
|
832
840
|
manifestVersion: string;
|
|
833
841
|
/** Loads the live avatar's room module: `() => import('@burdenoff/website-sdk/avatar-live')`. */
|
|
834
842
|
load: ExplorePanelAvatarLive["load"];
|
|
843
|
+
/** False keeps the still picture on this build, whatever the server offers. Default true. */
|
|
844
|
+
enabled?: boolean;
|
|
835
845
|
}
|
|
836
846
|
/** The `avatar.live` prop for this build, or `undefined` for the still picture only. */
|
|
837
|
-
declare function websiteAvatarLive({ deployEnv, siteKey, site, manifestVersion, load, }: WebsiteAvatarLiveOptions): ExplorePanelAvatarLive | undefined;
|
|
847
|
+
declare function websiteAvatarLive({ deployEnv, siteKey, site, manifestVersion, load, enabled, }: WebsiteAvatarLiveOptions): ExplorePanelAvatarLive | undefined;
|
|
838
848
|
|
|
839
849
|
declare const buttonVariants: (props?: ({
|
|
840
850
|
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export { LaunchCountdown, LaunchCountdownProps } from './components/launch-count
|
|
|
18
18
|
export { ProblemSolved, ProblemsSolvedSection, ProblemsSolvedSectionProps } from './components/problems-solved.js';
|
|
19
19
|
export { DetectedPlatform, ElectronDownloadLink, ElectronDownloadLinkProps, detectElectronPlatform } from './components/electron-download.js';
|
|
20
20
|
import { Components } from 'react-markdown';
|
|
21
|
-
import { a as ExploreLocale, E as ExplorePanelAvatarLive } from './explore-avatar-live-config-
|
|
22
|
-
export { b as EXPLORE_LOCALES, c as ExploreStrings, s as speechLocaleOf } from './explore-avatar-live-config-
|
|
21
|
+
import { a as ExploreLocale, E as ExplorePanelAvatarLive } from './explore-avatar-live-config-Cetx8-Zu.js';
|
|
22
|
+
export { b as EXPLORE_LOCALES, c as ExploreStrings, s as speechLocaleOf } from './explore-avatar-live-config-Cetx8-Zu.js';
|
|
23
23
|
import { A as AnswerRendererStrings, E as ExploreScope } from './explore-DjQE7Xia.js';
|
|
24
24
|
export { a as EXPLORE_PREFILL_MAX_LENGTH, b as ExploreAnswerBody, c as ExploreAnswerBodyProps, d as ExploreAnswerStyles, e as ExplorePage, f as ExplorePageProps, g as answerPlainText, h as answerSpeechText, i as exploreQuestionHref, j as inlineImageOrigins, k as isInlineImageAllowed, l as isInlineVideoAllowed, p as productSlugsByOrigin } from './explore-DjQE7Xia.js';
|
|
25
25
|
export { ExploreCta, ExploreCtaProps } from './components/explore-cta.js';
|
|
@@ -811,20 +811,28 @@ declare function SiteAssistantDock(props: SiteAssistantDockProps): react.JSX.Ele
|
|
|
811
811
|
* })
|
|
812
812
|
* ```
|
|
813
813
|
*
|
|
814
|
-
* The
|
|
815
|
-
*
|
|
814
|
+
* The server decides whether the live avatar is offered on the site (its reviewed site list, its pause and its caps),
|
|
815
|
+
* and whether it checks for bots (its availability's `botCheck`, contract v1.2). The key matters only when it does. The
|
|
816
|
+
* rule, so that a misconfigured build shows the still picture instead of a live avatar whose bot check can never pass,
|
|
817
|
+
* or always passes:
|
|
816
818
|
*
|
|
817
|
-
* -
|
|
819
|
+
* - `enabled: false`: `undefined` (the still picture, "Live avatar coming soon"), whatever else is set.
|
|
820
|
+
* - No key, or an empty one: the live config without a key. The server decides: a server that runs no bot check offers
|
|
821
|
+
* the live avatar, one that checks for bots (or a site it does not list) leaves the still picture.
|
|
818
822
|
* - Alpha (`deployEnv` `alpha`): Cloudflare's always-pass test key `1x00000000000000000000AA` (the alpha gateway runs
|
|
819
823
|
* Turnstile in dummy mode with the matching test secret), or a real-looking key.
|
|
820
824
|
* - Every other environment, production included, and an unset one: a real-looking key only. Cloudflare's test keys
|
|
821
825
|
* (`1x…AA`, `2x…AB`, `1x…BB`, `2x…BB`, `3x…FF`, and anything of their shape) are refused.
|
|
826
|
+
* - A key that is set but refused: `undefined`, the still picture, never a live avatar without the key it was given.
|
|
822
827
|
*/
|
|
823
828
|
|
|
824
829
|
interface WebsiteAvatarLiveOptions {
|
|
825
830
|
/** The environment the site is built for: `import.meta.env.VITE_DEPLOY_ENV` (`alpha`, `production`, …). */
|
|
826
831
|
deployEnv: string | null | undefined;
|
|
827
|
-
/**
|
|
832
|
+
/**
|
|
833
|
+
* The site's Turnstile site key: `import.meta.env.VITE_AVATAR_TURNSTILE_SITE_KEY`. Unset or empty: no key, and the
|
|
834
|
+
* live avatar runs only where the server runs no bot check.
|
|
835
|
+
*/
|
|
828
836
|
siteKey: string | null | undefined;
|
|
829
837
|
/** The site, as the live avatar service knows it (`healthybowl`). */
|
|
830
838
|
site: string;
|
|
@@ -832,9 +840,11 @@ interface WebsiteAvatarLiveOptions {
|
|
|
832
840
|
manifestVersion: string;
|
|
833
841
|
/** Loads the live avatar's room module: `() => import('@burdenoff/website-sdk/avatar-live')`. */
|
|
834
842
|
load: ExplorePanelAvatarLive["load"];
|
|
843
|
+
/** False keeps the still picture on this build, whatever the server offers. Default true. */
|
|
844
|
+
enabled?: boolean;
|
|
835
845
|
}
|
|
836
846
|
/** The `avatar.live` prop for this build, or `undefined` for the still picture only. */
|
|
837
|
-
declare function websiteAvatarLive({ deployEnv, siteKey, site, manifestVersion, load, }: WebsiteAvatarLiveOptions): ExplorePanelAvatarLive | undefined;
|
|
847
|
+
declare function websiteAvatarLive({ deployEnv, siteKey, site, manifestVersion, load, enabled, }: WebsiteAvatarLiveOptions): ExplorePanelAvatarLive | undefined;
|
|
838
848
|
|
|
839
849
|
declare const buttonVariants: (props?: ({
|
|
840
850
|
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFQH3AJN3_js = require('./chunk-FQH3AJN3.js');
|
|
4
4
|
var chunk6KY2ZRVI_js = require('./chunk-6KY2ZRVI.js');
|
|
5
5
|
require('./chunk-VRWZLGR7.js');
|
|
6
6
|
var chunkQMA6U6AU_js = require('./chunk-QMA6U6AU.js');
|
|
@@ -3345,17 +3345,17 @@ function ExploreAvatarLive({
|
|
|
3345
3345
|
const T = chunkR742FS5E_js.exploreStrings(locale);
|
|
3346
3346
|
const config = chunkJXLSTVBK_js.useWebSDKConfig();
|
|
3347
3347
|
const conversation = react.useContext(chunkR742FS5E_js.ExploreConversationContext);
|
|
3348
|
-
const base =
|
|
3348
|
+
const base = chunkFQH3AJN3_js.avatarApiBase(config.gatewayUrl);
|
|
3349
3349
|
const headers = react.useMemo(
|
|
3350
3350
|
() => chunkJXLSTVBK_js.cfAccessHeaders(config.gatewayUrl, config.cfAccess),
|
|
3351
3351
|
[config.gatewayUrl, config.cfAccess]
|
|
3352
3352
|
);
|
|
3353
|
-
const complete =
|
|
3354
|
-
const off = !complete || base === null || conversation === null || conversation.isSharedView || !
|
|
3353
|
+
const complete = chunkFQH3AJN3_js.liveConfigComplete(live);
|
|
3354
|
+
const off = !complete || base === null || conversation === null || conversation.isSharedView || !chunkFQH3AJN3_js.isAvatarLiveLocaleReviewed(locale);
|
|
3355
3355
|
react.useEffect(() => {
|
|
3356
3356
|
if (!complete) {
|
|
3357
3357
|
console.warn(
|
|
3358
|
-
"[WebSDK] ExplorePanel: avatar.live needs site, load, turnstileSiteKey and
|
|
3358
|
+
"[WebSDK] ExplorePanel: avatar.live needs site, load and manifestVersion, and turnstileSiteKey and allowTestSiteKey of a valid shape when set; the live avatar stays off."
|
|
3359
3359
|
);
|
|
3360
3360
|
}
|
|
3361
3361
|
}, [complete]);
|
|
@@ -3400,6 +3400,7 @@ function ExploreAvatarLive({
|
|
|
3400
3400
|
fallback,
|
|
3401
3401
|
onContinueInChat,
|
|
3402
3402
|
continueInChat: T.continueInChat,
|
|
3403
|
+
newChat: T.newChat,
|
|
3403
3404
|
off,
|
|
3404
3405
|
base,
|
|
3405
3406
|
headers,
|
|
@@ -4299,24 +4300,27 @@ function Dock({
|
|
|
4299
4300
|
|
|
4300
4301
|
// src/components/website-avatar-live.ts
|
|
4301
4302
|
var ALPHA_TEST_SITE_KEY = "1x00000000000000000000AA";
|
|
4302
|
-
var TEST_SITE_KEY = /^\dx0{16,}[A-Za-z]{2}$/;
|
|
4303
|
-
var REAL_SITE_KEY = /^0x[A-Za-z0-9_-]{16,62}$/;
|
|
4304
|
-
function isRealSiteKey(key) {
|
|
4305
|
-
return REAL_SITE_KEY.test(key) && !TEST_SITE_KEY.test(key);
|
|
4306
|
-
}
|
|
4307
4303
|
function websiteAvatarLive({
|
|
4308
4304
|
deployEnv,
|
|
4309
4305
|
siteKey,
|
|
4310
4306
|
site,
|
|
4311
4307
|
manifestVersion,
|
|
4312
|
-
load
|
|
4308
|
+
load,
|
|
4309
|
+
enabled
|
|
4313
4310
|
}) {
|
|
4314
|
-
|
|
4315
|
-
if (key === "") return void 0;
|
|
4311
|
+
if (enabled === false) return void 0;
|
|
4316
4312
|
const alpha = typeof deployEnv === "string" && deployEnv.trim().toLowerCase() === "alpha";
|
|
4317
|
-
const
|
|
4313
|
+
const live = {
|
|
4314
|
+
site,
|
|
4315
|
+
load,
|
|
4316
|
+
manifestVersion,
|
|
4317
|
+
allowTestSiteKey: alpha
|
|
4318
|
+
};
|
|
4319
|
+
const key = typeof siteKey === "string" ? siteKey.trim() : "";
|
|
4320
|
+
if (key === "") return live;
|
|
4321
|
+
const accepted = alpha ? key === ALPHA_TEST_SITE_KEY || chunkFQH3AJN3_js.isRealTurnstileSiteKey(key) : chunkFQH3AJN3_js.isRealTurnstileSiteKey(key);
|
|
4318
4322
|
if (!accepted) return void 0;
|
|
4319
|
-
return {
|
|
4323
|
+
return { ...live, turnstileSiteKey: key };
|
|
4320
4324
|
}
|
|
4321
4325
|
|
|
4322
4326
|
Object.defineProperty(exports, "DEFAULT_COMPARISON_MAX_AGE_DAYS", {
|