@burdenoff/website-sdk 2026.1102.1 → 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 +9 -0
- 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 +118 -41
- package/dist/avatar-live-view/index.js.map +1 -1
- package/dist/avatar-live-view/index.mjs +113 -36
- package/dist/avatar-live-view/index.mjs.map +1 -1
- package/dist/{chunk-OIQHIGGU.js → chunk-FQH3AJN3.js} +2 -2
- package/dist/{chunk-OIQHIGGU.js.map → chunk-FQH3AJN3.js.map} +1 -1
- package/dist/{chunk-QOHPLTGT.mjs → chunk-SFT3WHN5.mjs} +2 -2
- package/dist/{chunk-QOHPLTGT.mjs.map → chunk-SFT3WHN5.mjs.map} +1 -1
- package/dist/{explore-avatar-live-config-D-hO90-A.d.mts → explore-avatar-live-config-Bp3kQbU2.d.mts} +5 -2
- package/dist/{explore-avatar-live-config-C1ILEcY8.d.ts → explore-avatar-live-config-Cetx8-Zu.d.ts} +5 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -368,6 +368,15 @@ publishes audio, video or data, and it sends the avatar nothing to say.
|
|
|
368
368
|
asked again without Retry), it asks the visitor to start a new chat and choose
|
|
369
369
|
a suggested question. Whether the first question really is one of the
|
|
370
370
|
suggested ones is the service's to judge (`not_eligible`).
|
|
371
|
+
- **A fresh answer only.** The service also refuses an answer more than fifteen
|
|
372
|
+
minutes old (from the answer's `createdAt`): a conversation restored from the
|
|
373
|
+
browser's history, say. The view stops offering an answer fourteen minutes
|
|
374
|
+
after its `createdAt` (a minute's margin; a missing or unreadable time counts
|
|
375
|
+
as too old), also while the visitor is on the consent card: one timer moves
|
|
376
|
+
the card to the start-over step at that moment. The start-over step and the
|
|
377
|
+
`not_eligible` refusal both have a **New chat** button, which is the chat's
|
|
378
|
+
own New chat (the shared conversation's `reset`) followed by the Chat tab; no
|
|
379
|
+
host prop is needed for it.
|
|
371
380
|
- **What the visitor sees.** Opening the Avatar view asks the gateway (the
|
|
372
381
|
origin of your configured `gatewayUrl`, at `/api/web-avatar/v1/availability`)
|
|
373
382
|
whether the live avatar is offered for this site and locale. When it is and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { E as ExplorePanelAvatarLive, a as ExploreLocale, A as AvatarConversation } from '../explore-avatar-live-config-
|
|
3
|
+
import { E as ExplorePanelAvatarLive, a as ExploreLocale, A as AvatarConversation } from '../explore-avatar-live-config-Bp3kQbU2.mjs';
|
|
4
4
|
import '../types-CndbmBK-.mjs';
|
|
5
5
|
import '../use-explore-chat-zRuoAin6.mjs';
|
|
6
6
|
import '../explore-types-Bb2Ih3d8.mjs';
|
|
@@ -23,6 +23,11 @@ interface AvatarLiveViewProps {
|
|
|
23
23
|
onContinueInChat: () => void;
|
|
24
24
|
/** "Continue in Chat" in the panel's language: the panel's own word for it, so this chunk carries none of the panel's. */
|
|
25
25
|
continueInChat: string;
|
|
26
|
+
/**
|
|
27
|
+
* "New chat" in the panel's language, the panel's own word for it: the button that starts over (the conversation's
|
|
28
|
+
* `reset`, as the chat's own New chat button does, then the Chat tab) where this conversation can never be read.
|
|
29
|
+
*/
|
|
30
|
+
newChat: string;
|
|
26
31
|
/**
|
|
27
32
|
* Nothing to ask the server about: an incomplete config, no gateway, no shared conversation to read (no provider, or a
|
|
28
33
|
* read-only shared one), or a locale whose strings have not been reviewed. The tab stays as it was. Decided by
|
|
@@ -37,6 +42,6 @@ interface AvatarLiveViewProps {
|
|
|
37
42
|
/** The panel's conversation, null when there is no provider. */
|
|
38
43
|
conversation: AvatarConversation | null;
|
|
39
44
|
}
|
|
40
|
-
declare function AvatarLiveView({ live, active, locale, productName, still, fallback, onContinueInChat, continueInChat, off, base, headers, conversation, }: AvatarLiveViewProps): react.JSX.Element;
|
|
45
|
+
declare function AvatarLiveView({ live, active, locale, productName, still, fallback, onContinueInChat, continueInChat, newChat, off, base, headers, conversation, }: AvatarLiveViewProps): react.JSX.Element;
|
|
41
46
|
|
|
42
47
|
export { AvatarLiveView, type AvatarLiveViewProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { E as ExplorePanelAvatarLive, a as ExploreLocale, A as AvatarConversation } from '../explore-avatar-live-config-
|
|
3
|
+
import { E as ExplorePanelAvatarLive, a as ExploreLocale, A as AvatarConversation } from '../explore-avatar-live-config-Cetx8-Zu.js';
|
|
4
4
|
import '../types-CndbmBK-.js';
|
|
5
5
|
import '../use-explore-chat-DunjG-3p.js';
|
|
6
6
|
import '../explore-types-Bb2Ih3d8.js';
|
|
@@ -23,6 +23,11 @@ interface AvatarLiveViewProps {
|
|
|
23
23
|
onContinueInChat: () => void;
|
|
24
24
|
/** "Continue in Chat" in the panel's language: the panel's own word for it, so this chunk carries none of the panel's. */
|
|
25
25
|
continueInChat: string;
|
|
26
|
+
/**
|
|
27
|
+
* "New chat" in the panel's language, the panel's own word for it: the button that starts over (the conversation's
|
|
28
|
+
* `reset`, as the chat's own New chat button does, then the Chat tab) where this conversation can never be read.
|
|
29
|
+
*/
|
|
30
|
+
newChat: string;
|
|
26
31
|
/**
|
|
27
32
|
* Nothing to ask the server about: an incomplete config, no gateway, no shared conversation to read (no provider, or a
|
|
28
33
|
* read-only shared one), or a locale whose strings have not been reviewed. The tab stays as it was. Decided by
|
|
@@ -37,6 +42,6 @@ interface AvatarLiveViewProps {
|
|
|
37
42
|
/** The panel's conversation, null when there is no provider. */
|
|
38
43
|
conversation: AvatarConversation | null;
|
|
39
44
|
}
|
|
40
|
-
declare function AvatarLiveView({ live, active, locale, productName, still, fallback, onContinueInChat, continueInChat, off, base, headers, conversation, }: AvatarLiveViewProps): react.JSX.Element;
|
|
45
|
+
declare function AvatarLiveView({ live, active, locale, productName, still, fallback, onContinueInChat, continueInChat, newChat, off, base, headers, conversation, }: AvatarLiveViewProps): react.JSX.Element;
|
|
41
46
|
|
|
42
47
|
export { AvatarLiveView, type AvatarLiveViewProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFQH3AJN3_js = require('../chunk-FQH3AJN3.js');
|
|
4
4
|
var chunkO4GS3XPZ_js = require('../chunk-O4GS3XPZ.js');
|
|
5
5
|
var chunkC6OJIHNO_js = require('../chunk-C6OJIHNO.js');
|
|
6
6
|
require('../chunk-ZSTFX7FV.js');
|
|
@@ -58,7 +58,7 @@ function readAvailability(status, body) {
|
|
|
58
58
|
if (reason === "ok") {
|
|
59
59
|
const { consentVersion, maxSessionSeconds } = body;
|
|
60
60
|
const botCheck = readBotCheck(body.botCheck);
|
|
61
|
-
if (available !== true || typeof consentVersion !== "string" || !
|
|
61
|
+
if (available !== true || typeof consentVersion !== "string" || !chunkFQH3AJN3_js.isAvatarVersion(consentVersion) || typeof maxSessionSeconds !== "number" || !Number.isInteger(maxSessionSeconds) || maxSessionSeconds < 1 || botCheck === null) {
|
|
62
62
|
return INERT;
|
|
63
63
|
}
|
|
64
64
|
return {
|
|
@@ -146,7 +146,7 @@ function deadline(timeoutMs, outer) {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
async function requestAvailability(target) {
|
|
149
|
-
if (!
|
|
149
|
+
if (!chunkFQH3AJN3_js.isAvatarSite(target.site) || !LOCALE.test(target.locale)) return INERT;
|
|
150
150
|
const query = new URLSearchParams({
|
|
151
151
|
site: target.site,
|
|
152
152
|
locale: target.locale
|
|
@@ -262,7 +262,7 @@ var EN = {
|
|
|
262
262
|
needsAnswer: "Choose a suggested question in Chat first.",
|
|
263
263
|
needsAnswerDetail: "The avatar can read only the first answer aloud.",
|
|
264
264
|
startNewChat: "Start a new chat to use the avatar.",
|
|
265
|
-
startNewChatDetail: "The avatar reads aloud only the first answer in a chat,
|
|
265
|
+
startNewChatDetail: "The avatar reads aloud only the first answer in a chat, to a suggested question, within fifteen minutes. Start a new chat and choose a suggested question.",
|
|
266
266
|
start: "Start live avatar",
|
|
267
267
|
notNow: "Not now",
|
|
268
268
|
opensInNewTab: "(opens in a new tab)",
|
|
@@ -286,7 +286,7 @@ var EN = {
|
|
|
286
286
|
region: "The live avatar isn't offered in your region yet.",
|
|
287
287
|
locale: "The live avatar isn't offered in this language yet.",
|
|
288
288
|
paused: "The live avatar is paused right now.",
|
|
289
|
-
notEligible: "The avatar
|
|
289
|
+
notEligible: "The avatar reads the first answer to a suggested question, within fifteen minutes. Start a new chat and choose a suggested question.",
|
|
290
290
|
answerClaimed: "The avatar has already read this answer."
|
|
291
291
|
};
|
|
292
292
|
var ZH = {
|
|
@@ -295,7 +295,7 @@ var ZH = {
|
|
|
295
295
|
needsAnswerDetail: "\u865A\u62DF\u5F62\u8C61\u53EA\u80FD\u6717\u8BFB\u7B2C\u4E00\u4E2A\u56DE\u7B54\u3002",
|
|
296
296
|
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
297
297
|
startNewChat: "\u8BF7\u5F00\u59CB\u65B0\u7684\u804A\u5929\uFF0C\u518D\u4F7F\u7528\u865A\u62DF\u5F62\u8C61\u3002",
|
|
298
|
-
startNewChatDetail: "\u865A\u62DF\u5F62\u8C61\u53EA\u6717\u8BFB\u4E00\u6B21\u804A\u5929\u4E2D\u7684\u7B2C\u4E00\u4E2A\u56DE\u7B54\uFF0C\u4E14\u4EC5\u9650\
|
|
298
|
+
startNewChatDetail: "\u865A\u62DF\u5F62\u8C61\u53EA\u6717\u8BFB\u4E00\u6B21\u804A\u5929\u4E2D\u7684\u7B2C\u4E00\u4E2A\u56DE\u7B54\uFF0C\u4E14\u4EC5\u9650\u63A8\u8350\u95EE\u9898\u7684\u56DE\u7B54\u3001\u5728\u5341\u4E94\u5206\u949F\u5185\u3002\u8BF7\u5F00\u59CB\u65B0\u7684\u804A\u5929\uFF0C\u5E76\u9009\u62E9\u4E00\u4E2A\u63A8\u8350\u95EE\u9898\u3002",
|
|
299
299
|
start: "\u542F\u52A8\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61",
|
|
300
300
|
notNow: "\u6682\u4E0D",
|
|
301
301
|
opensInNewTab: "\uFF08\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00\uFF09",
|
|
@@ -319,7 +319,8 @@ var ZH = {
|
|
|
319
319
|
region: "\u60A8\u6240\u5728\u7684\u5730\u533A\u6682\u4E0D\u63D0\u4F9B\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61\u3002",
|
|
320
320
|
locale: "\u6B64\u8BED\u8A00\u6682\u4E0D\u63D0\u4F9B\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61\u3002",
|
|
321
321
|
paused: "\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61\u76EE\u524D\u5DF2\u6682\u505C\u3002",
|
|
322
|
-
|
|
322
|
+
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
323
|
+
notEligible: "\u865A\u62DF\u5F62\u8C61\u53EA\u6717\u8BFB\u63A8\u8350\u95EE\u9898\u7684\u7B2C\u4E00\u4E2A\u56DE\u7B54\uFF0C\u4E14\u987B\u5728\u5341\u4E94\u5206\u949F\u5185\u3002\u8BF7\u5F00\u59CB\u65B0\u7684\u804A\u5929\uFF0C\u5E76\u9009\u62E9\u4E00\u4E2A\u63A8\u8350\u95EE\u9898\u3002",
|
|
323
324
|
answerClaimed: "\u865A\u62DF\u5F62\u8C61\u5DF2\u7ECF\u6717\u8BFB\u8FC7\u8FD9\u4E2A\u56DE\u7B54\u3002"
|
|
324
325
|
};
|
|
325
326
|
var HI = {
|
|
@@ -328,7 +329,7 @@ var HI = {
|
|
|
328
329
|
needsAnswerDetail: "\u0905\u0935\u0924\u093E\u0930 \u0915\u0947\u0935\u0932 \u092A\u0939\u0932\u093E \u0909\u0924\u094D\u0924\u0930 \u091C\u093C\u094B\u0930 \u0938\u0947 \u092A\u0922\u093C \u0938\u0915\u0924\u093E \u0939\u0948\u0964",
|
|
329
330
|
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
330
331
|
startNewChat: "\u0905\u0935\u0924\u093E\u0930 \u0915\u093E \u0909\u092A\u092F\u094B\u0917 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u0928\u0908 \u091A\u0948\u091F \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902\u0964",
|
|
331
|
-
startNewChatDetail: "\u0905\u0935\u0924\u093E\u0930 \u0915\u093F\u0938\u0940 \u091A\u0948\u091F \u0915\u093E \u0915\u0947\u0935\u0932 \u092A\u0939\u0932\u093E \u0909\u0924\u094D\u0924\u0930 \u091C\u093C\u094B\u0930 \u0938\u0947 \u092A\u0922\u093C\u0924\u093E \u0939\u0948, \
|
|
332
|
+
startNewChatDetail: "\u0905\u0935\u0924\u093E\u0930 \u0915\u093F\u0938\u0940 \u091A\u0948\u091F \u0915\u093E \u0915\u0947\u0935\u0932 \u092A\u0939\u0932\u093E \u0909\u0924\u094D\u0924\u0930 \u091C\u093C\u094B\u0930 \u0938\u0947 \u092A\u0922\u093C\u0924\u093E \u0939\u0948, \u0935\u0939 \u092D\u0940 \u0938\u0941\u091D\u093E\u090F \u0917\u090F \u092A\u094D\u0930\u0936\u094D\u0928 \u0915\u093E \u0914\u0930 \u092A\u0902\u0926\u094D\u0930\u0939 \u092E\u093F\u0928\u091F \u0915\u0947 \u092D\u0940\u0924\u0930\u0964 \u0928\u0908 \u091A\u0948\u091F \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902 \u0914\u0930 \u0915\u094B\u0908 \u0938\u0941\u091D\u093E\u092F\u093E \u0917\u092F\u093E \u092A\u094D\u0930\u0936\u094D\u0928 \u091A\u0941\u0928\u0947\u0902\u0964",
|
|
332
333
|
start: "\u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930 \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902",
|
|
333
334
|
notNow: "\u0905\u092D\u0940 \u0928\u0939\u0940\u0902",
|
|
334
335
|
opensInNewTab: "(\u0928\u090F \u091F\u0948\u092C \u092E\u0947\u0902 \u0916\u0941\u0932\u0924\u093E \u0939\u0948)",
|
|
@@ -352,7 +353,8 @@ var HI = {
|
|
|
352
353
|
region: "\u0906\u092A\u0915\u0947 \u0915\u094D\u0937\u0947\u0924\u094D\u0930 \u092E\u0947\u0902 \u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930 \u0905\u092D\u0940 \u0909\u092A\u0932\u092C\u094D\u0927 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",
|
|
353
354
|
locale: "\u0907\u0938 \u092D\u093E\u0937\u093E \u092E\u0947\u0902 \u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930 \u0905\u092D\u0940 \u0909\u092A\u0932\u092C\u094D\u0927 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",
|
|
354
355
|
paused: "\u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930 \u0905\u092D\u0940 \u0930\u0941\u0915\u093E \u0939\u0941\u0906 \u0939\u0948\u0964",
|
|
355
|
-
|
|
356
|
+
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
357
|
+
notEligible: "\u0905\u0935\u0924\u093E\u0930 \u0938\u0941\u091D\u093E\u090F \u0917\u090F \u092A\u094D\u0930\u0936\u094D\u0928 \u0915\u093E \u092A\u0939\u0932\u093E \u0909\u0924\u094D\u0924\u0930 \u0939\u0940 \u092A\u0922\u093C\u0924\u093E \u0939\u0948, \u092A\u0902\u0926\u094D\u0930\u0939 \u092E\u093F\u0928\u091F \u0915\u0947 \u092D\u0940\u0924\u0930\u0964 \u0928\u0908 \u091A\u0948\u091F \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902 \u0914\u0930 \u0915\u094B\u0908 \u0938\u0941\u091D\u093E\u092F\u093E \u0917\u092F\u093E \u092A\u094D\u0930\u0936\u094D\u0928 \u091A\u0941\u0928\u0947\u0902\u0964",
|
|
356
358
|
answerClaimed: "\u0905\u0935\u0924\u093E\u0930 \u092F\u0939 \u0909\u0924\u094D\u0924\u0930 \u092A\u0939\u0932\u0947 \u0939\u0940 \u092A\u0922\u093C \u091A\u0941\u0915\u093E \u0939\u0948\u0964"
|
|
357
359
|
};
|
|
358
360
|
var ES = {
|
|
@@ -361,7 +363,7 @@ var ES = {
|
|
|
361
363
|
needsAnswerDetail: "El avatar solo puede leer en voz alta la primera respuesta.",
|
|
362
364
|
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
363
365
|
startNewChat: "Inicia un chat nuevo para usar el avatar.",
|
|
364
|
-
startNewChatDetail: "El avatar solo lee en voz alta la primera respuesta de un chat,
|
|
366
|
+
startNewChatDetail: "El avatar solo lee en voz alta la primera respuesta de un chat, si es la de una pregunta sugerida y en un plazo de quince minutos. Inicia un chat nuevo y elige una pregunta sugerida.",
|
|
365
367
|
start: "Iniciar el avatar en vivo",
|
|
366
368
|
notNow: "Ahora no",
|
|
367
369
|
opensInNewTab: "(se abre en una pesta\xF1a nueva)",
|
|
@@ -385,7 +387,8 @@ var ES = {
|
|
|
385
387
|
region: "El avatar en vivo a\xFAn no est\xE1 disponible en tu regi\xF3n.",
|
|
386
388
|
locale: "El avatar en vivo a\xFAn no est\xE1 disponible en este idioma.",
|
|
387
389
|
paused: "El avatar en vivo est\xE1 en pausa en este momento.",
|
|
388
|
-
|
|
390
|
+
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
391
|
+
notEligible: "El avatar lee la primera respuesta a una pregunta sugerida, en un plazo de quince minutos. Inicia un chat nuevo y elige una pregunta sugerida.",
|
|
389
392
|
answerClaimed: "El avatar ya ha le\xEDdo esta respuesta."
|
|
390
393
|
};
|
|
391
394
|
var AR = {
|
|
@@ -394,7 +397,7 @@ var AR = {
|
|
|
394
397
|
needsAnswerDetail: "\u064A\u0645\u0643\u0646 \u0644\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0623\u0648\u0644\u0649 \u0641\u0642\u0637 \u0628\u0635\u0648\u062A \u0639\u0627\u0644\u064D.",
|
|
395
398
|
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
396
399
|
startNewChat: "\u0627\u0628\u062F\u0623 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629 \u0644\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631.",
|
|
397
|
-
startNewChatDetail: "\u064A\u0642\u0631\u0623 \u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0628\u0635\u0648\u062A \u0639\u0627\u0644\u064D \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0623\u0648\u0644\u0649 \u0641\u064A \u0627\u0644\u062F\u0631\u062F\u0634\u0629 \u0641\u0642\u0637\u060C \
|
|
400
|
+
startNewChatDetail: "\u064A\u0642\u0631\u0623 \u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0628\u0635\u0648\u062A \u0639\u0627\u0644\u064D \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0623\u0648\u0644\u0649 \u0641\u064A \u0627\u0644\u062F\u0631\u062F\u0634\u0629 \u0641\u0642\u0637\u060C \u0625\u0630\u0627 \u0643\u0627\u0646\u062A \u0625\u062C\u0627\u0628\u0629 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0645\u0642\u062A\u0631\u062D \u0648\u062E\u0644\u0627\u0644 \u062E\u0645\u0633 \u0639\u0634\u0631\u0629 \u062F\u0642\u064A\u0642\u0629. \u0627\u0628\u062F\u0623 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629 \u0648\u0627\u062E\u062A\u0631 \u0633\u0624\u0627\u0644\u064B\u0627 \u0645\u0642\u062A\u0631\u062D\u064B\u0627.",
|
|
398
401
|
start: "\u0628\u062F\u0621 \u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631",
|
|
399
402
|
notNow: "\u0644\u064A\u0633 \u0627\u0644\u0622\u0646",
|
|
400
403
|
opensInNewTab: "(\u064A\u064F\u0641\u062A\u062D \u0641\u064A \u0639\u0644\u0627\u0645\u0629 \u062A\u0628\u0648\u064A\u0628 \u062C\u062F\u064A\u062F\u0629)",
|
|
@@ -418,7 +421,8 @@ var AR = {
|
|
|
418
421
|
region: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D \u0641\u064A \u0645\u0646\u0637\u0642\u062A\u0643 \u0628\u0639\u062F.",
|
|
419
422
|
locale: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D \u0628\u0647\u0630\u0647 \u0627\u0644\u0644\u063A\u0629 \u0628\u0639\u062F.",
|
|
420
423
|
paused: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631 \u0645\u062A\u0648\u0642\u0641 \u0645\u0624\u0642\u062A\u064B\u0627 \u0627\u0644\u0622\u0646.",
|
|
421
|
-
|
|
424
|
+
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
425
|
+
notEligible: "\u064A\u0642\u0631\u0623 \u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0623\u0648\u0644\u0649 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0645\u0642\u062A\u0631\u062D\u060C \u062E\u0644\u0627\u0644 \u062E\u0645\u0633 \u0639\u0634\u0631\u0629 \u062F\u0642\u064A\u0642\u0629. \u0627\u0628\u062F\u0623 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629 \u0648\u0627\u062E\u062A\u0631 \u0633\u0624\u0627\u0644\u064B\u0627 \u0645\u0642\u062A\u0631\u062D\u064B\u0627.",
|
|
422
426
|
answerClaimed: "\u0642\u0631\u0623 \u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0645\u0646 \u0642\u0628\u0644."
|
|
423
427
|
};
|
|
424
428
|
var TA = {
|
|
@@ -427,7 +431,7 @@ var TA = {
|
|
|
427
431
|
needsAnswerDetail: "\u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD \u0BAE\u0BC1\u0BA4\u0BB2\u0BCD \u0BAA\u0BA4\u0BBF\u0BB2\u0BC8 \u0BAE\u0B9F\u0BCD\u0B9F\u0BC1\u0BAE\u0BC7 \u0B89\u0BB0\u0B95\u0BCD\u0B95\u0BAA\u0BCD \u0BAA\u0B9F\u0BBF\u0B95\u0BCD\u0B95 \u0BAE\u0BC1\u0B9F\u0BBF\u0BAF\u0BC1\u0BAE\u0BCD.",
|
|
428
432
|
// TRANSLATION REVIEW PENDING (BOFF-9797): draft.
|
|
429
433
|
startNewChat: "\u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BC8\u0BAA\u0BCD \u0BAA\u0BAF\u0BA9\u0BCD\u0BAA\u0B9F\u0BC1\u0BA4\u0BCD\u0BA4 \u0BAA\u0BC1\u0BA4\u0BBF\u0BAF \u0B85\u0BB0\u0B9F\u0BCD\u0B9F\u0BC8\u0BAF\u0BC8\u0BA4\u0BCD \u0BA4\u0BCA\u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B9F\u0BCD\u0B9F\u0BC8\u0BAF\u0BC8\u0BA4\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95\u0BBF, \u0BAA\u0BB0\u0BBF\u0BA8\u0BCD\u0BA4\u0BC1\u0BB0\u0BC8\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F \u0B92\u0BB0\u0BC1 \u0B95\u0BC7\u0BB3\u0BCD\u0BB5\u0BBF\u0BAF\u0BC8\u0BA4\u0BCD \u0BA4\u0BC7\u0BB0\u0BCD\u0BA8\u0BCD\u0BA4\u0BC6\u0B9F\u0BC1\u0B95\u0BCD\u0B95\u0BB5\u0BC1\u0BAE\u0BCD.",
|
|
455
460
|
answerClaimed: "\u0B87\u0BA8\u0BCD\u0BA4\u0BAA\u0BCD \u0BAA\u0BA4\u0BBF\u0BB2\u0BC8 \u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD \u0B8F\u0BB1\u0BCD\u0B95\u0BC6\u0BA9\u0BB5\u0BC7 \u0BAA\u0B9F\u0BBF\u0BA4\u0BCD\u0BA4\u0BC1\u0BB5\u0BBF\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1."
|
|
456
461
|
};
|
|
457
462
|
var STRINGS = {
|
|
@@ -529,7 +534,7 @@ var CONSENT = /* @__PURE__ */ new Map([
|
|
|
529
534
|
]
|
|
530
535
|
]);
|
|
531
536
|
function avatarConsentCopy(version, locale) {
|
|
532
|
-
if (!
|
|
537
|
+
if (!chunkFQH3AJN3_js.isAvatarLiveLocaleReviewed(locale)) return null;
|
|
533
538
|
return CONSENT.get(version)?.[locale] ?? null;
|
|
534
539
|
}
|
|
535
540
|
|
|
@@ -651,6 +656,9 @@ var PRIVACY_HREF = "/privacy#live-avatar";
|
|
|
651
656
|
var SPEAKER_WAIT_MS = 3e4;
|
|
652
657
|
var END_GRACE_MS = 1e4;
|
|
653
658
|
var CLOCK_TOLERANCE_MS = 5e3;
|
|
659
|
+
var SERVICE_MAX_AGE_MS = 15 * 6e4;
|
|
660
|
+
var ANSWER_OFFER_MS = SERVICE_MAX_AGE_MS - 6e4;
|
|
661
|
+
var MAX_TIMER_MS = 2147483647;
|
|
654
662
|
var PRIMARY = '[data-avatar-primary], [data-boff-explore="panel-continue-chat"]';
|
|
655
663
|
var IDLE = { name: "idle" };
|
|
656
664
|
var INERT2 = { name: "inert" };
|
|
@@ -663,8 +671,19 @@ var REFUSAL_TEXT = {
|
|
|
663
671
|
not_eligible: "notEligible",
|
|
664
672
|
answer_claimed: "answerClaimed"
|
|
665
673
|
};
|
|
666
|
-
var WAITING = { answerId: null, startOver: false };
|
|
667
|
-
var START_OVER = {
|
|
674
|
+
var WAITING = { answerId: null, startOver: false, offerUntil: NaN };
|
|
675
|
+
var START_OVER = {
|
|
676
|
+
answerId: null,
|
|
677
|
+
startOver: true,
|
|
678
|
+
offerUntil: NaN
|
|
679
|
+
};
|
|
680
|
+
function createdAtOf(message) {
|
|
681
|
+
const raw = message.createdAt;
|
|
682
|
+
return typeof raw === "string" && raw !== "" ? Date.parse(raw) : NaN;
|
|
683
|
+
}
|
|
684
|
+
function offeredAt(exchange, now) {
|
|
685
|
+
return exchange.answerId !== null && !(now < exchange.offerUntil) ? START_OVER : exchange;
|
|
686
|
+
}
|
|
668
687
|
function firstExchange(messages) {
|
|
669
688
|
if (!messages || messages.length === 0) return WAITING;
|
|
670
689
|
if (messages.length > 2) return START_OVER;
|
|
@@ -678,7 +697,11 @@ function firstExchange(messages) {
|
|
|
678
697
|
if (answer.status !== "COMPLETED" || answer.content.trim() === "" || !isAvatarMessageId(answer.id)) {
|
|
679
698
|
return START_OVER;
|
|
680
699
|
}
|
|
681
|
-
return {
|
|
700
|
+
return {
|
|
701
|
+
answerId: answer.id,
|
|
702
|
+
startOver: false,
|
|
703
|
+
offerUntil: createdAtOf(answer) + ANSWER_OFFER_MS
|
|
704
|
+
};
|
|
682
705
|
}
|
|
683
706
|
function offering(offer, messageId, claimed) {
|
|
684
707
|
return claimed.has(messageId) ? { name: "refused", reason: "answer_claimed" } : { name: "consent", offer, messageId };
|
|
@@ -704,6 +727,7 @@ function AvatarLiveView({
|
|
|
704
727
|
fallback,
|
|
705
728
|
onContinueInChat,
|
|
706
729
|
continueInChat,
|
|
730
|
+
newChat,
|
|
707
731
|
off,
|
|
708
732
|
base,
|
|
709
733
|
headers,
|
|
@@ -712,13 +736,16 @@ function AvatarLiveView({
|
|
|
712
736
|
const S = avatarLiveStrings(locale);
|
|
713
737
|
const uid = react.useId();
|
|
714
738
|
const consentTitleId = `${uid}-consent`;
|
|
715
|
-
const
|
|
739
|
+
const exchange = firstExchange(conversation?.messages);
|
|
740
|
+
const [ageTick, setAgeTick] = react.useState(0);
|
|
741
|
+
const { answerId, startOver } = offeredAt(exchange, Date.now());
|
|
742
|
+
const offerUntil = answerId === null ? null : exchange.offerUntil;
|
|
716
743
|
const [phase, setPhase] = react.useState(IDLE);
|
|
717
744
|
const [blocked, setBlocked] = react.useState(false);
|
|
718
745
|
const [now, setNow] = react.useState(() => Date.now());
|
|
719
746
|
const phaseRef = react.useRef(IDLE);
|
|
720
|
-
const latest = react.useRef({ live, locale, base, headers,
|
|
721
|
-
latest.current = { live, locale, base, headers,
|
|
747
|
+
const latest = react.useRef({ live, locale, base, headers, exchange, off });
|
|
748
|
+
latest.current = { live, locale, base, headers, exchange, off };
|
|
722
749
|
const conversationRef = react.useRef(conversation);
|
|
723
750
|
conversationRef.current = conversation;
|
|
724
751
|
const checkRef = react.useRef(null);
|
|
@@ -734,6 +761,17 @@ function AvatarLiveView({
|
|
|
734
761
|
phaseRef.current = next;
|
|
735
762
|
setPhase(next);
|
|
736
763
|
}, []);
|
|
764
|
+
const offeredNow = react.useCallback(
|
|
765
|
+
() => offeredAt(latest.current.exchange, Date.now()).answerId,
|
|
766
|
+
[]
|
|
767
|
+
);
|
|
768
|
+
const reoffer = react.useCallback(
|
|
769
|
+
(offer) => {
|
|
770
|
+
const messageId = offeredNow();
|
|
771
|
+
return messageId === null ? { name: "needs-answer", offer } : offering(offer, messageId, claimedRef.current);
|
|
772
|
+
},
|
|
773
|
+
[offeredNow]
|
|
774
|
+
);
|
|
737
775
|
const finish = react.useCallback(
|
|
738
776
|
(how, reason) => {
|
|
739
777
|
const handle = sessionRef.current;
|
|
@@ -798,17 +836,13 @@ function AvatarLiveView({
|
|
|
798
836
|
go(INERT2);
|
|
799
837
|
return;
|
|
800
838
|
}
|
|
801
|
-
if (result.offer.botCheck === "turnstile" &&
|
|
839
|
+
if (result.offer.botCheck === "turnstile" && chunkFQH3AJN3_js.turnstileSiteKeyOf(live2) === null) {
|
|
802
840
|
go(INERT2);
|
|
803
841
|
return;
|
|
804
842
|
}
|
|
805
|
-
|
|
806
|
-
const messageId = latest.current.answerId;
|
|
807
|
-
go(
|
|
808
|
-
messageId === null ? { name: "needs-answer", offer } : offering(offer, messageId, claimedRef.current)
|
|
809
|
-
);
|
|
843
|
+
go(reoffer({ ...result.offer, locale: locale2, copy }));
|
|
810
844
|
});
|
|
811
|
-
}, [go]);
|
|
845
|
+
}, [go, reoffer]);
|
|
812
846
|
const begin = react.useCallback(
|
|
813
847
|
(session, module, offer, target) => {
|
|
814
848
|
const received = Date.now();
|
|
@@ -895,7 +929,12 @@ function AvatarLiveView({
|
|
|
895
929
|
const { live: live2, base: base2, headers: headers2 } = latest.current;
|
|
896
930
|
if (base2 === null) return;
|
|
897
931
|
const { offer, messageId } = current;
|
|
898
|
-
|
|
932
|
+
if (offeredNow() !== messageId) {
|
|
933
|
+
go(reoffer(offer));
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
const refusedFrom = latest.current.exchange.offerUntil - ANSWER_OFFER_MS + SERVICE_MAX_AGE_MS;
|
|
937
|
+
const siteKey = offer.botCheck === "turnstile" ? chunkFQH3AJN3_js.turnstileSiteKeyOf(live2) : null;
|
|
899
938
|
if (offer.botCheck === "turnstile" && (siteKey === null || !canBindBotCheck())) {
|
|
900
939
|
go(INERT2);
|
|
901
940
|
return;
|
|
@@ -945,6 +984,11 @@ function AvatarLiveView({
|
|
|
945
984
|
}
|
|
946
985
|
turnstile?.cancel();
|
|
947
986
|
if (run.cancelled !== null) return;
|
|
987
|
+
if (!(Date.now() < refusedFrom)) {
|
|
988
|
+
startRef.current = null;
|
|
989
|
+
go({ name: "needs-answer", offer });
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
948
992
|
if (turnstile !== null) go({ name: "creating" });
|
|
949
993
|
const result = await requestCreate({
|
|
950
994
|
base: base2,
|
|
@@ -956,12 +1000,12 @@ function AvatarLiveView({
|
|
|
956
1000
|
if (startRef.current === run) startRef.current = null;
|
|
957
1001
|
settle(result, run, { module: loaded, offer, messageId, base: base2, headers: headers2 });
|
|
958
1002
|
})();
|
|
959
|
-
}, [go, settle]);
|
|
1003
|
+
}, [go, offeredNow, reoffer, settle]);
|
|
960
1004
|
const stop = react.useCallback(() => {
|
|
961
1005
|
const current = phaseRef.current;
|
|
962
1006
|
if (current.name === "bot-check") {
|
|
963
1007
|
cancelStart("user");
|
|
964
|
-
go(
|
|
1008
|
+
go(reoffer(current.offer));
|
|
965
1009
|
return;
|
|
966
1010
|
}
|
|
967
1011
|
if (current.name === "creating") {
|
|
@@ -972,7 +1016,7 @@ function AvatarLiveView({
|
|
|
972
1016
|
if (current.name === "pending" || current.name === "live") {
|
|
973
1017
|
finish("stopped", "user");
|
|
974
1018
|
}
|
|
975
|
-
}, [cancelStart, finish, go]);
|
|
1019
|
+
}, [cancelStart, finish, go, reoffer]);
|
|
976
1020
|
const leave = react.useCallback(
|
|
977
1021
|
(reason) => {
|
|
978
1022
|
const current = phaseRef.current;
|
|
@@ -988,9 +1032,7 @@ function AvatarLiveView({
|
|
|
988
1032
|
}
|
|
989
1033
|
case "bot-check":
|
|
990
1034
|
cancelStart(reason);
|
|
991
|
-
go(
|
|
992
|
-
reason === "user" ? IDLE : offering(current.offer, current.messageId, claimedRef.current)
|
|
993
|
-
);
|
|
1035
|
+
go(reason === "user" ? IDLE : reoffer(current.offer));
|
|
994
1036
|
return;
|
|
995
1037
|
case "creating":
|
|
996
1038
|
cancelStart(reason);
|
|
@@ -1004,7 +1046,7 @@ function AvatarLiveView({
|
|
|
1004
1046
|
return;
|
|
1005
1047
|
}
|
|
1006
1048
|
},
|
|
1007
|
-
[cancelStart, finish, go]
|
|
1049
|
+
[cancelStart, finish, go, reoffer]
|
|
1008
1050
|
);
|
|
1009
1051
|
const showing = active && !off;
|
|
1010
1052
|
react.useEffect(() => {
|
|
@@ -1013,7 +1055,7 @@ function AvatarLiveView({
|
|
|
1013
1055
|
return;
|
|
1014
1056
|
}
|
|
1015
1057
|
const current = phaseRef.current;
|
|
1016
|
-
const
|
|
1058
|
+
const offered = offeredNow();
|
|
1017
1059
|
const used = offered !== null && claimedRef.current.has(offered);
|
|
1018
1060
|
if (current.name === "ended" && used) return;
|
|
1019
1061
|
if (current.name === "refused" && current.reason === "answer_claimed" && used) {
|
|
@@ -1025,7 +1067,7 @@ function AvatarLiveView({
|
|
|
1025
1067
|
current.name === "checking" && checkRef.current === null) {
|
|
1026
1068
|
check();
|
|
1027
1069
|
}
|
|
1028
|
-
}, [showing, check, leave]);
|
|
1070
|
+
}, [showing, check, leave, offeredNow]);
|
|
1029
1071
|
react.useEffect(() => {
|
|
1030
1072
|
if (askedLocale.current === locale) return;
|
|
1031
1073
|
askedLocale.current = locale;
|
|
@@ -1051,6 +1093,18 @@ function AvatarLiveView({
|
|
|
1051
1093
|
);
|
|
1052
1094
|
}
|
|
1053
1095
|
}, [answerId, go]);
|
|
1096
|
+
react.useEffect(() => {
|
|
1097
|
+
if (offerUntil === null) return;
|
|
1098
|
+
const timer = setTimeout(
|
|
1099
|
+
() => setAgeTick((tick) => tick + 1),
|
|
1100
|
+
Math.min(MAX_TIMER_MS, Math.max(0, offerUntil - Date.now()))
|
|
1101
|
+
);
|
|
1102
|
+
return () => clearTimeout(timer);
|
|
1103
|
+
}, [offerUntil, ageTick]);
|
|
1104
|
+
const startNewChat = react.useCallback(() => {
|
|
1105
|
+
conversationRef.current?.reset();
|
|
1106
|
+
onContinueInChat();
|
|
1107
|
+
}, [onContinueInChat]);
|
|
1054
1108
|
const onRoomEvent = react.useCallback(
|
|
1055
1109
|
(handle, event) => {
|
|
1056
1110
|
if (handle.done || sessionRef.current !== handle) return;
|
|
@@ -1246,6 +1300,29 @@ function AvatarLiveView({
|
|
|
1246
1300
|
children: continueInChat
|
|
1247
1301
|
}
|
|
1248
1302
|
);
|
|
1303
|
+
const startOverActions = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
|
|
1304
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1305
|
+
"button",
|
|
1306
|
+
{
|
|
1307
|
+
type: "button",
|
|
1308
|
+
"data-avatar-primary": "",
|
|
1309
|
+
"data-boff-explore": "avatar-live-new-chat",
|
|
1310
|
+
className: primaryButton,
|
|
1311
|
+
onClick: startNewChat,
|
|
1312
|
+
children: newChat
|
|
1313
|
+
}
|
|
1314
|
+
),
|
|
1315
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1316
|
+
"button",
|
|
1317
|
+
{
|
|
1318
|
+
type: "button",
|
|
1319
|
+
"data-boff-explore": "avatar-live-continue",
|
|
1320
|
+
className: secondaryButton,
|
|
1321
|
+
onClick: onContinueInChat,
|
|
1322
|
+
children: continueInChat
|
|
1323
|
+
}
|
|
1324
|
+
)
|
|
1325
|
+
] });
|
|
1249
1326
|
const stopButton = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1250
1327
|
"button",
|
|
1251
1328
|
{
|
|
@@ -1278,7 +1355,7 @@ function AvatarLiveView({
|
|
|
1278
1355
|
switch (phase.name) {
|
|
1279
1356
|
case "needs-answer":
|
|
1280
1357
|
body = /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: startOver ? S.startNewChatDetail : S.needsAnswerDetail });
|
|
1281
|
-
actions = continueButton;
|
|
1358
|
+
actions = startOver ? startOverActions : continueButton;
|
|
1282
1359
|
break;
|
|
1283
1360
|
case "consent": {
|
|
1284
1361
|
const { copy } = phase.offer;
|
|
@@ -1340,7 +1417,7 @@ function AvatarLiveView({
|
|
|
1340
1417
|
break;
|
|
1341
1418
|
}
|
|
1342
1419
|
case "refused":
|
|
1343
|
-
actions = continueButton;
|
|
1420
|
+
actions = phase.reason === "not_eligible" ? startOverActions : continueButton;
|
|
1344
1421
|
break;
|
|
1345
1422
|
case "bot-check":
|
|
1346
1423
|
case "creating":
|