@davi-ai/retorik-framework 3.2.2 → 3.2.4
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/dist/{AttachmentDetail.1e06c2a5.js → AttachmentDetail.cfd86776.js} +2 -3
- package/dist/AttachmentDetail.cfd86776.js.map +1 -0
- package/dist/{AttachmentDetail.c6c297df.js → AttachmentDetail.fdcd1737.js} +2 -3
- package/dist/AttachmentDetail.fdcd1737.js.map +1 -0
- package/dist/{CustomView.080c8028.js → CustomView.ba7af9b6.js} +2 -3
- package/dist/CustomView.ba7af9b6.js.map +1 -0
- package/dist/{CustomView.90d2a13d.js → CustomView.c24a0e74.js} +2 -3
- package/dist/CustomView.c24a0e74.js.map +1 -0
- package/dist/{Emergency.a21f837c.js → Emergency.0cf005ce.js} +2 -3
- package/dist/Emergency.0cf005ce.js.map +1 -0
- package/dist/{Emergency.423214ad.js → Emergency.897ee3c7.js} +2 -3
- package/dist/Emergency.897ee3c7.js.map +1 -0
- package/dist/{HistoryList.5fd6aa12.js → HistoryList.03a56119.js} +3 -7
- package/dist/HistoryList.03a56119.js.map +1 -0
- package/dist/{HistoryList.50ff0fd9.js → HistoryList.4c303dc6.js} +3 -7
- package/dist/HistoryList.4c303dc6.js.map +1 -0
- package/dist/{LanguageChoice.61e36c1d.js → LanguageChoice.623ee802.js} +2 -5
- package/dist/LanguageChoice.623ee802.js.map +1 -0
- package/dist/{LanguageChoice.1579b654.js → LanguageChoice.ff0cd04c.js} +2 -5
- package/dist/LanguageChoice.ff0cd04c.js.map +1 -0
- package/dist/{NewsContainer.67f04b19.js → NewsContainer.05bb1b19.js} +9 -9
- package/dist/NewsContainer.05bb1b19.js.map +1 -0
- package/dist/{NewsContainer.932174e9.js → NewsContainer.5e80336b.js} +9 -9
- package/dist/NewsContainer.5e80336b.js.map +1 -0
- package/dist/{Weather.661c2cac.js → Weather.99917b66.js} +2 -3
- package/dist/Weather.99917b66.js.map +1 -0
- package/dist/{Weather.fb22fba3.js → Weather.cf58823d.js} +2 -3
- package/dist/Weather.cf58823d.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +348 -564
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +332 -556
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
- package/dist/AttachmentDetail.1e06c2a5.js.map +0 -1
- package/dist/AttachmentDetail.c6c297df.js.map +0 -1
- package/dist/CustomView.080c8028.js.map +0 -1
- package/dist/CustomView.90d2a13d.js.map +0 -1
- package/dist/Emergency.423214ad.js.map +0 -1
- package/dist/Emergency.a21f837c.js.map +0 -1
- package/dist/HistoryList.50ff0fd9.js.map +0 -1
- package/dist/HistoryList.5fd6aa12.js.map +0 -1
- package/dist/LanguageChoice.1579b654.js.map +0 -1
- package/dist/LanguageChoice.61e36c1d.js.map +0 -1
- package/dist/NewsContainer.67f04b19.js.map +0 -1
- package/dist/NewsContainer.932174e9.js.map +0 -1
- package/dist/Weather.661c2cac.js.map +0 -1
- package/dist/Weather.fb22fba3.js.map +0 -1
package/dist/index.modern.js
CHANGED
|
@@ -10,7 +10,7 @@ import {ConnectionStatus as $bZRJW$ConnectionStatus, DirectLine as $bZRJW$Direct
|
|
|
10
10
|
import {Document as $bZRJW$Document, Page as $bZRJW$Page, pdfjs as $bZRJW$pdfjs} from "react-pdf";
|
|
11
11
|
import {animated as $bZRJW$animated, useSpring as $bZRJW$useSpring, easings as $bZRJW$easings} from "@react-spring/web";
|
|
12
12
|
import {Player as $bZRJW$Player} from "@lottiefiles/react-lottie-player";
|
|
13
|
-
import {browserName as $bZRJW$browserName, BrowserTypes as $bZRJW$BrowserTypes, osName as $bZRJW$osName, OsTypes as $bZRJW$OsTypes,
|
|
13
|
+
import {browserName as $bZRJW$browserName, BrowserTypes as $bZRJW$BrowserTypes, osName as $bZRJW$osName, OsTypes as $bZRJW$OsTypes, isMobile as $bZRJW$isMobile} from "react-device-detect";
|
|
14
14
|
import {presets as $d70757f720801c36$re_export$presets} from "@davi-ai/react-bodyengine-three";
|
|
15
15
|
import {createRoot as $bZRJW$createRoot} from "react-dom/client";
|
|
16
16
|
import $bZRJW$reactshadow from "react-shadow";
|
|
@@ -90,7 +90,6 @@ const $920719987d28bd50$var$initialState = {
|
|
|
90
90
|
retorikEvent: undefined,
|
|
91
91
|
displayAgent: true,
|
|
92
92
|
activityToSend: undefined,
|
|
93
|
-
currentNewsActivity: undefined,
|
|
94
93
|
retorikNewsEnded: false,
|
|
95
94
|
userIsTyping: false,
|
|
96
95
|
userIsSwiping: false,
|
|
@@ -176,11 +175,6 @@ const $920719987d28bd50$var$createUtilsStore = ()=>(0, $bZRJW$createStore)((set,
|
|
|
176
175
|
activityToSend: value
|
|
177
176
|
});
|
|
178
177
|
},
|
|
179
|
-
setCurrentNewsActivity: (value)=>{
|
|
180
|
-
set({
|
|
181
|
-
currentNewsActivity: value
|
|
182
|
-
});
|
|
183
|
-
},
|
|
184
178
|
setRetorikNewsEnded: (value)=>{
|
|
185
179
|
set({
|
|
186
180
|
retorikNewsEnded: value
|
|
@@ -338,6 +332,7 @@ $parcel$export(module.exports, "Source3DEngine", () => $179a76b9823b36f3$export$
|
|
|
338
332
|
$parcel$export(module.exports, "UIPart", () => $179a76b9823b36f3$export$63fc5f52b5b4da1e);
|
|
339
333
|
$parcel$export(module.exports, "TextFrom", () => $179a76b9823b36f3$export$b685c7d489184507);
|
|
340
334
|
$parcel$export(module.exports, "Theme", () => $179a76b9823b36f3$export$14faa19a0f3bbeb2);
|
|
335
|
+
$parcel$export(module.exports, "TraceType", () => $179a76b9823b36f3$export$d4b4ca0ba30ae29c);
|
|
341
336
|
var $179a76b9823b36f3$export$e4a712fff93fb00f = /*#__PURE__*/ function(ActionType) {
|
|
342
337
|
ActionType["message"] = "message";
|
|
343
338
|
ActionType["event"] = "event";
|
|
@@ -563,6 +558,12 @@ var $179a76b9823b36f3$export$14faa19a0f3bbeb2 = /*#__PURE__*/ function(Theme) {
|
|
|
563
558
|
Theme["auto"] = "auto";
|
|
564
559
|
return Theme;
|
|
565
560
|
}($179a76b9823b36f3$export$14faa19a0f3bbeb2 || {});
|
|
561
|
+
var $179a76b9823b36f3$export$d4b4ca0ba30ae29c = /*#__PURE__*/ function(TraceType) {
|
|
562
|
+
TraceType["message"] = "directlineMessage";
|
|
563
|
+
TraceType["utteranceStart"] = "utteranceStart";
|
|
564
|
+
TraceType["utteranceEnd"] = "utteranceEnd";
|
|
565
|
+
return TraceType;
|
|
566
|
+
}($179a76b9823b36f3$export$d4b4ca0ba30ae29c || {});
|
|
566
567
|
|
|
567
568
|
});
|
|
568
569
|
|
|
@@ -2061,9 +2062,6 @@ const $244e94971d503466$var$initialState = {
|
|
|
2061
2062
|
visemeData: [],
|
|
2062
2063
|
singleVisemeAdded: null,
|
|
2063
2064
|
multiVisemesAdded: [],
|
|
2064
|
-
currentReplyToId: undefined,
|
|
2065
|
-
currentPlaying: undefined,
|
|
2066
|
-
endedActivities: [],
|
|
2067
2065
|
currentOrLastPlayedActivity: undefined,
|
|
2068
2066
|
isMicrophoneAllowed: false,
|
|
2069
2067
|
showMicrophoneModal: false,
|
|
@@ -2072,9 +2070,6 @@ const $244e94971d503466$var$initialState = {
|
|
|
2072
2070
|
lastRecognitionInterim: '',
|
|
2073
2071
|
streamingReplyToId: null,
|
|
2074
2072
|
streamingQueue: [],
|
|
2075
|
-
streamingQueueForText: [],
|
|
2076
|
-
currentStreaming: null,
|
|
2077
|
-
streamingQueueFullLength: 0,
|
|
2078
2073
|
streamingReplyToIdToIgnore: null,
|
|
2079
2074
|
speechRecognitionDynamicGrammars: [],
|
|
2080
2075
|
externalTextToSpeech: undefined
|
|
@@ -2210,22 +2205,6 @@ const $244e94971d503466$var$createSpeechStore = (setRetorikEvent, getListStatus,
|
|
|
2210
2205
|
if (getListStatus() !== (0, $4ucVo.ListStatus).opened) setListStatus((0, $4ucVo.ListStatus).available);
|
|
2211
2206
|
}
|
|
2212
2207
|
},
|
|
2213
|
-
setCurrentReplyToId: (value)=>{
|
|
2214
|
-
set({
|
|
2215
|
-
currentReplyToId: value
|
|
2216
|
-
});
|
|
2217
|
-
},
|
|
2218
|
-
setCurrentPlaying: (value)=>{
|
|
2219
|
-
set({
|
|
2220
|
-
currentPlaying: value
|
|
2221
|
-
});
|
|
2222
|
-
value && get().actions.setCurrentOrLastPlayedActivity(value);
|
|
2223
|
-
},
|
|
2224
|
-
setEndedActivities: (value)=>{
|
|
2225
|
-
set({
|
|
2226
|
-
endedActivities: value
|
|
2227
|
-
});
|
|
2228
|
-
},
|
|
2229
2208
|
setIsMicrophoneAllowed: (value)=>{
|
|
2230
2209
|
set({
|
|
2231
2210
|
isMicrophoneAllowed: value
|
|
@@ -2287,72 +2266,45 @@ const $244e94971d503466$var$createSpeechStore = (setRetorikEvent, getListStatus,
|
|
|
2287
2266
|
streamingReplyToId: value
|
|
2288
2267
|
});
|
|
2289
2268
|
},
|
|
2290
|
-
setStreamingQueue: (value)=>{
|
|
2291
|
-
set({
|
|
2292
|
-
streamingQueue: value,
|
|
2293
|
-
streamingQueueForText: value
|
|
2294
|
-
});
|
|
2295
|
-
},
|
|
2296
2269
|
addToStreamingQueue: (value)=>{
|
|
2297
|
-
if (value.replyToId
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
}
|
|
2270
|
+
if (value.replyToId) {
|
|
2271
|
+
if (value.replyToId !== get().streamingReplyToIdToIgnore) {
|
|
2272
|
+
// Set replyToId and new queue if replyToId is different from the current one
|
|
2273
|
+
if (get().streamingReplyToId !== value.replyToId) set({
|
|
2274
|
+
streamingReplyToId: value.replyToId,
|
|
2275
|
+
streamingQueue: [
|
|
2276
|
+
value
|
|
2277
|
+
]
|
|
2278
|
+
});
|
|
2279
|
+
else set({
|
|
2280
|
+
streamingQueue: [
|
|
2281
|
+
...get().streamingQueue,
|
|
2282
|
+
value
|
|
2283
|
+
]
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
} else set({
|
|
2287
|
+
streamingQueue: [
|
|
2288
|
+
...get().streamingQueue,
|
|
2289
|
+
value
|
|
2290
|
+
]
|
|
2291
|
+
});
|
|
2320
2292
|
},
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
streamingQueue: tempStreamingQueue
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2293
|
+
// If "twice" parameter is true, let's remove 2 elements instead of one (used with the message at the end of a streaming that should not be spoken)
|
|
2294
|
+
removeFirstFromStreamingQueue: (twice)=>{
|
|
2295
|
+
set((state)=>({
|
|
2296
|
+
streamingQueue: state.streamingQueue.slice(twice ? 2 : 1)
|
|
2297
|
+
}));
|
|
2329
2298
|
},
|
|
2330
2299
|
killCurrentStreaming: ()=>{
|
|
2331
2300
|
set({
|
|
2332
|
-
|
|
2333
|
-
streamingQueue: []
|
|
2334
|
-
streamingQueueForText: [],
|
|
2335
|
-
currentStreaming: null,
|
|
2336
|
-
streamingQueueFullLength: 0,
|
|
2337
|
-
streamingReplyToIdToIgnore: get().streamingReplyToId
|
|
2301
|
+
streamingReplyToIdToIgnore: get().streamingReplyToId,
|
|
2302
|
+
streamingQueue: []
|
|
2338
2303
|
});
|
|
2339
2304
|
},
|
|
2340
2305
|
checkActivityReplyToId: (replyToId)=>{
|
|
2341
2306
|
get().streamingReplyToId !== replyToId && get().actions.killCurrentStreaming();
|
|
2342
2307
|
},
|
|
2343
|
-
setCurrentStreaming: (value)=>{
|
|
2344
|
-
set({
|
|
2345
|
-
currentStreaming: value
|
|
2346
|
-
});
|
|
2347
|
-
},
|
|
2348
|
-
setStreamingQueueFullLength: (value, replyToId)=>{
|
|
2349
|
-
if (replyToId) replyToId === get().streamingReplyToId && set({
|
|
2350
|
-
streamingQueueFullLength: value
|
|
2351
|
-
});
|
|
2352
|
-
else set({
|
|
2353
|
-
streamingQueueFullLength: value
|
|
2354
|
-
});
|
|
2355
|
-
},
|
|
2356
2308
|
addSpeechRecognitionDynamicGrammar: (value)=>{
|
|
2357
2309
|
const currentGrammars = get().speechRecognitionDynamicGrammars;
|
|
2358
2310
|
// For each value, verifiy if it doesn't exist in the array yet
|
|
@@ -2772,7 +2724,7 @@ const $1cd684302a8789ac$var$initialState = {
|
|
|
2772
2724
|
queueLock: false
|
|
2773
2725
|
};
|
|
2774
2726
|
const $1cd684302a8789ac$var$regexDataCommand = /(\{data-command=")[\p{L}\p{N}\p{Po}\p{Pd}\p{Pc}\s\u0027\u2019]+("\})(<br\s\/>)?/gu;
|
|
2775
|
-
const $1cd684302a8789ac$var$createActivityStore = (localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue,
|
|
2727
|
+
const $1cd684302a8789ac$var$createActivityStore = (localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue, setMode, unlockClickedButton, setSubmitDelayBeforeSendingMessage, setIsWaitingForResponse, setSendBoxPlaceHolder)=>{
|
|
2776
2728
|
return (0, $bZRJW$createStore)((set, get)=>{
|
|
2777
2729
|
return {
|
|
2778
2730
|
...$1cd684302a8789ac$var$initialState,
|
|
@@ -2837,7 +2789,7 @@ const $1cd684302a8789ac$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2837
2789
|
currentActivity.type === 'message' ? await get().actions.processAddBotMessage(currentActivity) : await get().actions.processAddBotEvent(currentActivity);
|
|
2838
2790
|
// Remove the first element from the queue (the one that got processed above) and process the queue once again
|
|
2839
2791
|
set({
|
|
2840
|
-
queue: get().queue.slice(
|
|
2792
|
+
queue: get().queue.slice(1)
|
|
2841
2793
|
});
|
|
2842
2794
|
get().actions.processQueue();
|
|
2843
2795
|
} else set({
|
|
@@ -2847,9 +2799,9 @@ const $1cd684302a8789ac$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2847
2799
|
processAddBotMessage: async (value)=>{
|
|
2848
2800
|
setCurrentId(undefined);
|
|
2849
2801
|
const processedActivity = await get().actions.processBotMessageActivity(value);
|
|
2850
|
-
// If this activity is the one concluding a streaming, let's set the amount of streams previously generated
|
|
2851
|
-
if (!get().retrievingConversation && value.value?.streamingCount) setStreamingQueueFullLength(value.value.streamingCount, value.replyToId);
|
|
2852
2802
|
const tempActivity = get().retrievingConversation ? undefined : processedActivity;
|
|
2803
|
+
// Add this activity to the streaming queue if we are not in conversation retrieval process
|
|
2804
|
+
!get().retrievingConversation && addToStreamingQueue(processedActivity);
|
|
2853
2805
|
set({
|
|
2854
2806
|
activities: [
|
|
2855
2807
|
...get().activities,
|
|
@@ -2891,6 +2843,28 @@ const $1cd684302a8789ac$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2891
2843
|
}
|
|
2892
2844
|
},
|
|
2893
2845
|
processAddBotEvent: async (value)=>{
|
|
2846
|
+
const streamingMap = new Map(get().botStreamingActivities);
|
|
2847
|
+
// Deal with streaming activities
|
|
2848
|
+
if (value.name?.toLowerCase() === 'davi.streammessageactivity') // Add this activity to the streaming queue if we are not in conversation retrieval process
|
|
2849
|
+
{
|
|
2850
|
+
if (value.text?.trim().length && !get().retrievingConversation) {
|
|
2851
|
+
// Create speak field from the text one
|
|
2852
|
+
const processedText = (0, $dklvz.processMarkdownAndSpeechMarkdown)(value.text, true);
|
|
2853
|
+
value.speak = processedText.text;
|
|
2854
|
+
value.htmlText = processedText.htmlText;
|
|
2855
|
+
addToStreamingQueue(value);
|
|
2856
|
+
// Set data in the Map for text display
|
|
2857
|
+
if (value.replyToId) {
|
|
2858
|
+
const currentStreamingData = streamingMap.get(value.replyToId);
|
|
2859
|
+
currentStreamingData ? streamingMap.set(value.replyToId, [
|
|
2860
|
+
...currentStreamingData,
|
|
2861
|
+
value
|
|
2862
|
+
]) : streamingMap.set(value.replyToId, [
|
|
2863
|
+
value
|
|
2864
|
+
]);
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2894
2868
|
set({
|
|
2895
2869
|
activities: [
|
|
2896
2870
|
...get().activities,
|
|
@@ -2908,37 +2882,15 @@ const $1cd684302a8789ac$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2908
2882
|
],
|
|
2909
2883
|
lastBotEventActivity: value,
|
|
2910
2884
|
lastEventActivity: value,
|
|
2885
|
+
botStreamingActivities: streamingMap,
|
|
2911
2886
|
watermark: get().watermark + 1
|
|
2912
2887
|
});
|
|
2913
2888
|
Promise.resolve();
|
|
2914
2889
|
},
|
|
2915
2890
|
addBotEvent: async (value)=>{
|
|
2916
2891
|
if (get().actions.checkCurrentConversationId(value.id)) {
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
setIsWaitingForResponse(false);
|
|
2920
|
-
// Create speak field from the text one
|
|
2921
|
-
const processedText = (0, $dklvz.processMarkdownAndSpeechMarkdown)(value.text, true);
|
|
2922
|
-
value.speak = processedText.text;
|
|
2923
|
-
value.htmlText = processedText.htmlText;
|
|
2924
|
-
addToStreamingQueue(value);
|
|
2925
|
-
if (value.replyToId) {
|
|
2926
|
-
const currentStreamingMap = new Map(get().botStreamingActivities);
|
|
2927
|
-
const currentStreamingData = currentStreamingMap.get(value.replyToId);
|
|
2928
|
-
currentStreamingData ? currentStreamingMap.set(value.replyToId, [
|
|
2929
|
-
...currentStreamingData,
|
|
2930
|
-
value
|
|
2931
|
-
]) : currentStreamingMap.set(value.replyToId, [
|
|
2932
|
-
value
|
|
2933
|
-
]);
|
|
2934
|
-
set({
|
|
2935
|
-
botStreamingActivities: currentStreamingMap,
|
|
2936
|
-
watermark: get().watermark + 1
|
|
2937
|
-
});
|
|
2938
|
-
}
|
|
2939
|
-
unlockClickedButton();
|
|
2940
|
-
}
|
|
2941
|
-
} else if (value.name?.toLowerCase() === 'switchtotextmode') {
|
|
2892
|
+
//
|
|
2893
|
+
if (value.name?.toLowerCase() === 'switchtotextmode') {
|
|
2942
2894
|
setMode((0, $4ucVo.Mode).text);
|
|
2943
2895
|
set({
|
|
2944
2896
|
watermark: get().watermark + 1
|
|
@@ -3203,10 +3155,10 @@ const $1cd684302a8789ac$var$ActivityProvider = ({ children: children })=>{
|
|
|
3203
3155
|
const isUsedOnBorneRef = (0, $bZRJW$useRef)(false);
|
|
3204
3156
|
const inputHintBehaviourRef = (0, $bZRJW$useRef)(undefined);
|
|
3205
3157
|
const { setCurrentId: setCurrentId, setRestoreInputsState: setRestoreInputsState } = (0, $jubFc.useAdaptiveCardStore)((state)=>state.actions);
|
|
3206
|
-
const { addToStreamingQueue: addToStreamingQueue,
|
|
3158
|
+
const { addToStreamingQueue: addToStreamingQueue, setMode: setMode } = (0, $i1rfm.useSpeechStore)((state)=>state.actions);
|
|
3207
3159
|
const unlockClickedButton = (0, $j67YK.useUtilsStore)((state)=>state.actions.unlockClickedButton);
|
|
3208
3160
|
const { setSubmitDelayBeforeSendingMessage: setSubmitDelayBeforeSendingMessage, setIsWaitingForResponse: setIsWaitingForResponse, setSendBoxPlaceHolder: setSendBoxPlaceHolder } = (0, $1x02c.useRetorikStore)((state)=>state.actions);
|
|
3209
|
-
const [store] = (0, $bZRJW$useState)(()=>$1cd684302a8789ac$var$createActivityStore(localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue,
|
|
3161
|
+
const [store] = (0, $bZRJW$useState)(()=>$1cd684302a8789ac$var$createActivityStore(localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue, setMode, unlockClickedButton, setSubmitDelayBeforeSendingMessage, setIsWaitingForResponse, setSendBoxPlaceHolder));
|
|
3210
3162
|
(0, $bZRJW$useEffect)(()=>{
|
|
3211
3163
|
localeRef.current = locale;
|
|
3212
3164
|
}, [
|
|
@@ -4127,7 +4079,7 @@ const $ca466c72d380f23a$var$createDirectlineStore = (modeRef, recognitionStateRe
|
|
|
4127
4079
|
if (get().actions.checkIfHandlerAbortsActivity((0, $1ZPEZ.LegacyDirectLineActivityType).SEND_MESSAGE, tempActivity)) return;
|
|
4128
4080
|
get().directLine?.postActivity(tempActivity).subscribe();
|
|
4129
4081
|
},
|
|
4130
|
-
sendEvent: (name, value)=>{
|
|
4082
|
+
sendEvent: (name, value, callback)=>{
|
|
4131
4083
|
if (get().conversationPaused) return;
|
|
4132
4084
|
!name.toLowerCase().includes('davi.closewindow') && !$ca466c72d380f23a$var$eventsWithoutCancel.includes(name.toLowerCase()) && get().actions.checkMicrophoneAndCancel();
|
|
4133
4085
|
const locale = checkDumpedLocaleFallback();
|
|
@@ -4146,7 +4098,10 @@ const $ca466c72d380f23a$var$createDirectlineStore = (modeRef, recognitionStateRe
|
|
|
4146
4098
|
// Check if the event should be stopped in the external activity handler if there is one
|
|
4147
4099
|
if (get().actions.checkIfHandlerAbortsActivity((0, $1ZPEZ.LegacyDirectLineActivityType).POST_ACTIVITY, tempEvent)) return;
|
|
4148
4100
|
if (get().actions.checkIfHandlerAbortsActivity((0, $1ZPEZ.LegacyDirectLineActivityType).SEND_EVENT, tempEvent)) return;
|
|
4149
|
-
get().directLine?.postActivity(tempEvent).subscribe(
|
|
4101
|
+
get().directLine?.postActivity(tempEvent).subscribe({
|
|
4102
|
+
error: (error)=>console.log('Retorik Framework > error while sending event : ', error),
|
|
4103
|
+
complete: ()=>callback?.()
|
|
4104
|
+
});
|
|
4150
4105
|
},
|
|
4151
4106
|
sendTyping: ()=>{
|
|
4152
4107
|
if (get().conversationPaused) return;
|
|
@@ -4352,7 +4307,7 @@ var $c54ebc4ba0100ff1$export$2e2bcd8739ae039 = $c54ebc4ba0100ff1$var$activityMid
|
|
|
4352
4307
|
});
|
|
4353
4308
|
|
|
4354
4309
|
parcelRegister("iT1WI", function(module, exports) {
|
|
4355
|
-
module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"3.2.
|
|
4310
|
+
module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"3.2.4\",\"description\":\"Retorik Framework package\",\"author\":\"DAVI\",\"license\":\"MIT\",\"repository\":\"none\",\"main\":\"dist/index.js\",\"module\":\"dist/index.modern.js\",\"types\":\"dist/index.d.ts\",\"source\":\"src/index.tsx\",\"standalone\":\"standalone/index.js\",\"targets\":{\"standalone\":{\"context\":\"browser\",\"outputFormat\":\"esmodule\",\"distDir\":\"standalone\"},\"module\":{\"context\":\"browser\",\"outputFormat\":\"esmodule\",\"distDir\":\"dist\"}},\"engines\":{\"node\":\">=10\"},\"scripts\":{\"build\":\"parcel build\",\"start\":\"parcel watch\",\"test\":\"jest --env=jsdom --reporters=jest-junit\",\"test-console\":\"jest --env=jsdom\",\"test-update-snapshots\":\"jest --env=jsdom --updateSnapshot\",\"test-coverage-console\":\"jest --env=jsdom --reporters=jest-junit --coverage\",\"test-coverage\":\"jest --env=jsdom --reporters=jest-junit --coverage --coverageReporters=cobertura\",\"report\":\"npx parcel build src/index.tsx --reporter @parcel/reporter-bundle-analyzer\",\"credentials\":\"vsts-npm-auth -config .npmrc\"},\"peerDependencies\":{\"react\":\"18.3.1\",\"react-dom\":\"18.3.1\"},\"devDependencies\":{\"@babel/core\":\"^7.19.1\",\"@babel/plugin-proposal-decorators\":\"^7.24.7\",\"@babel/plugin-proposal-private-property-in-object\":\"^7.21.11\",\"@babel/preset-env\":\"^7.25.4\",\"@babel/preset-react\":\"^7.24.7\",\"@babel/preset-typescript\":\"^7.24.7\",\"@babel/runtime\":\"^7.23.8\",\"@parcel/packager-ts\":\"^2.13.2\",\"@parcel/reporter-bundle-analyzer\":\"^2.13.2\",\"@parcel/reporter-sourcemap-visualiser\":\"^2.13.2\",\"@parcel/transformer-inline-string\":\"^2.13.2\",\"@parcel/transformer-typescript-types\":\"^2.13.2\",\"@parcel/validator-eslint\":\"^2.13.2\",\"@parcel/validator-typescript\":\"^2.13.2\",\"@testing-library/dom\":\"^10.4.0\",\"@testing-library/jest-dom\":\"6.5.0\",\"@testing-library/react\":\"16.0.1\",\"@testing-library/react-hooks\":\"8.0.1\",\"@testing-library/user-event\":\"14.5.2\",\"@types/jest\":\"^27.5.1\",\"@types/leaflet\":\"^1.8.0\",\"@types/node\":\"^12.12.38\",\"@types/react\":\"18.3.12\",\"@types/react-dom\":\"18.3.1\",\"@types/testing-library__jest-dom\":\"^5.14.5\",\"@types/testing-library__react\":\"latest\",\"@typescript-eslint/eslint-plugin\":\"^8.19.0\",\"@typescript-eslint/parser\":\"^8.19.0\",\"autoprefixer\":\"^10.4.7\",\"babel-eslint\":\"^10.0.3\",\"babel-jest\":\"^29.7.0\",\"babel-loader\":\"^8.2.5\",\"buffer\":\"^5.7.1\",\"canvas\":\"^2.9.0\",\"cross-env\":\"^7.0.2\",\"crypto-browserify\":\"^3.12.0\",\"eslint\":\"^9.16.0\",\"eslint-config-prettier\":\"^9.1.0\",\"eslint-config-standard\":\"^17.1.0\",\"eslint-config-standard-react\":\"^13.0.0\",\"eslint-plugin-import\":\"^2.31.0\",\"eslint-plugin-node\":\"^11.1.0\",\"eslint-plugin-prettier\":\"^5.2.1\",\"eslint-plugin-promise\":\"^7.2.1\",\"eslint-plugin-react\":\"^7.37.2\",\"https-browserify\":\"^1.0.0\",\"jest\":\"^29.7.0\",\"jest-environment-jsdom\":\"^29.7.0\",\"jest-junit\":\"16.0.0\",\"npm-run-all\":\"^4.1.5\",\"parcel\":\"^2.13.2\",\"postcss\":\"^8.4.14\",\"postcss-url\":\"^10.1.3\",\"prettier\":\"^2.0.4\",\"process\":\"^0.11.10\",\"punycode\":\"^1.4.1\",\"querystring-es3\":\"^0.2.1\",\"react\":\"^18\",\"react-docgen-typescript-plugin\":\"^1.0.5\",\"react-dom\":\"18.3.1\",\"react-test-renderer\":\"^18.3.1\",\"resize-observer-polyfill\":\"^1.5.1\",\"stream-browserify\":\"^3.0.0\",\"stream-http\":\"^3.2.0\",\"string_decoder\":\"^1.3.0\",\"tailwindcss\":\"^3.1.0\",\"typescript\":\"5.3.2\",\"url\":\"^0.11.0\",\"util\":\"^0.12.4\"},\"files\":[\"dist\"],\"dependencies\":{\"@davi-ai/body-engine-sprite\":\"3.0.0\",\"@davi-ai/react-bodyengine-three\":\"1.0.6\",\"@davi-ai/retorik-weather\":\"2.0.0\",\"@davi-ai/speechmarkdown-davi-js\":\"2.0.1\",\"@davi-ai/web-speech-cognitive-services-davi\":\"2.0.10\",\"@lottiefiles/react-lottie-player\":\"^3.4.1\",\"@opentelemetry/api\":\"^1.9.0\",\"@opentelemetry/exporter-trace-otlp-http\":\"^0.200.0\",\"@opentelemetry/instrumentation\":\"^0.200.0\",\"@opentelemetry/instrumentation-document-load\":\"^0.45.0\",\"@opentelemetry/instrumentation-fetch\":\"^0.200.0\",\"@opentelemetry/resources\":\"^2.0.0\",\"@opentelemetry/sdk-trace-web\":\"^2.0.0\",\"@opentelemetry/semantic-conventions\":\"^1.32.0\",\"@react-spring/types\":\"^9.7.3\",\"@react-spring/web\":\"^9.7.3\",\"@swc/helpers\":\"^0.5.0\",\"@types/geojson\":\"^7946.0.10\",\"@types/jsdom\":\"^16.2.14\",\"@use-gesture/react\":\"^10.2.15\",\"adaptivecards\":\"3.0.1\",\"botframework-directlinejs\":\"^0.15.5\",\"classnames\":\"^2.3.1\",\"detect-gpu\":\"^5.0.70\",\"leaflet\":\"^1.9.2\",\"markdown-it\":\"14.1.0\",\"pdfjs-dist\":\"3.11.174\",\"postcss-copy\":\"^7.1.0\",\"qrcode\":\"^1.5.1\",\"react-device-detect\":\"^2.2.3\",\"react-error-boundary\":\"^4.0.10\",\"react-leaflet\":\"^4.1.0\",\"react-pdf\":\"7.7.1\",\"react-shadow\":\"^20.5.0\",\"swiper\":\"^8.4.5\",\"zustand\":\"^5.0.3\"},\"overrides\":{\"@davi-ai/web-speech-cognitive-services-davi\":\"$@davi-ai/web-speech-cognitive-services-davi\",\"zustand\":\"$zustand\"},\"@parcel/resolver-default\":{\"packageExports\":true}}");
|
|
4356
4311
|
|
|
4357
4312
|
});
|
|
4358
4313
|
|
|
@@ -5466,23 +5421,24 @@ const $04f538c5adcaba69$var$SendActivityEventListener = ({ isRetorikNews: isReto
|
|
|
5466
5421
|
document.removeEventListener('retorikSetVisibility', handleEvents);
|
|
5467
5422
|
};
|
|
5468
5423
|
}, []);
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5424
|
+
/**
|
|
5425
|
+
* Send mandatory events : setUser to start conversation, Davi.GDPRConsent for GDPR module
|
|
5426
|
+
*/ const sendMandatoryEvents = async ()=>{
|
|
5427
|
+
sendEvent('Davi.GDPRConsent', {
|
|
5428
|
+
userConsent: userConsent
|
|
5429
|
+
}, ()=>sendEvent('setUser', {
|
|
5475
5430
|
user: {
|
|
5476
5431
|
...userData,
|
|
5477
5432
|
gdprConsent: true
|
|
5478
5433
|
},
|
|
5479
5434
|
skipWelcome: !!skipWelcome
|
|
5480
|
-
});
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5435
|
+
}));
|
|
5436
|
+
};
|
|
5437
|
+
(0, $bZRJW$useEffect)(()=>{
|
|
5438
|
+
if (isRetorikNews || hasConversationCookie) setUserAlreadySet(true);
|
|
5439
|
+
else if (!userAlreadySet && appAvailable && !displayGDPR && characterLoaded) {
|
|
5440
|
+
setUserAlreadySet(true);
|
|
5441
|
+
sendMandatoryEvents();
|
|
5486
5442
|
}
|
|
5487
5443
|
}, [
|
|
5488
5444
|
appAvailable,
|
|
@@ -7695,8 +7651,7 @@ const $2ec58e0e10234435$var$List = ({ activity: activity, onClose: onClose })=>{
|
|
|
7695
7651
|
if (timerRef) {
|
|
7696
7652
|
timerRef.current && clearTimeout(timerRef.current);
|
|
7697
7653
|
timerRef.current = setTimeout(()=>{
|
|
7698
|
-
sendEvent('Davi.CloseWindow', null);
|
|
7699
|
-
sendEvent('Davi.CloseWindowList', null);
|
|
7654
|
+
sendEvent('Davi.CloseWindow', null, ()=>sendEvent('Davi.CloseWindowList', null));
|
|
7700
7655
|
onClose?.();
|
|
7701
7656
|
setContent(undefined);
|
|
7702
7657
|
}, $2ec58e0e10234435$var$springLeaveDuration);
|
|
@@ -7756,7 +7711,6 @@ const $2ec58e0e10234435$var$List = ({ activity: activity, onClose: onClose })=>{
|
|
|
7756
7711
|
(0, $bZRJW$useEffect)(()=>{
|
|
7757
7712
|
handleOpen();
|
|
7758
7713
|
return ()=>{
|
|
7759
|
-
console.log('in return');
|
|
7760
7714
|
setListStatus((0, $4ucVo.ListStatus).closed);
|
|
7761
7715
|
timerRef?.current && clearTimeout(timerRef.current);
|
|
7762
7716
|
};
|
|
@@ -14262,7 +14216,7 @@ const $ac35eca22c14c48d$var$Attachments = ({ activity: activity, display: displa
|
|
|
14262
14216
|
return attachments.length > 1 ? (0, $4ucVo.Displays).carousel : (0, $4ucVo.Displays).normal;
|
|
14263
14217
|
case 'grid':
|
|
14264
14218
|
// Grid display is not available in mobile mode
|
|
14265
|
-
return isMobile ?
|
|
14219
|
+
return isMobile ? (0, $4ucVo.Displays).carouselgrid : (0, $4ucVo.Displays).grid;
|
|
14266
14220
|
}
|
|
14267
14221
|
// If we have no attachment layout but attachment(s), we use none display by default is there are several attachments
|
|
14268
14222
|
return attachments.length > 1 ? (0, $4ucVo.Displays).none : (0, $4ucVo.Displays).normal;
|
|
@@ -14455,7 +14409,7 @@ const $ab587b2431a9b830$var$CarouselContainer = ({ title: title, attachments: at
|
|
|
14455
14409
|
const carouselRef = (0, $bZRJW$useRef)(null);
|
|
14456
14410
|
(0, $bZRJW$useLayoutEffect)(()=>{
|
|
14457
14411
|
setHeight(0);
|
|
14458
|
-
if (attachments.length
|
|
14412
|
+
if (attachments.length) {
|
|
14459
14413
|
timerRef.current && clearTimeout(timerRef.current);
|
|
14460
14414
|
timerRef.current = setTimeout(()=>{
|
|
14461
14415
|
carouselRef.current && setHeight(carouselRef.current.clientHeight);
|
|
@@ -14623,7 +14577,7 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14623
14577
|
transform: 'translateX(100%)'
|
|
14624
14578
|
},
|
|
14625
14579
|
to: {
|
|
14626
|
-
transform:
|
|
14580
|
+
transform: `translateX(${nbCards === 1 ? '25%' : '0%'})`
|
|
14627
14581
|
},
|
|
14628
14582
|
config: {
|
|
14629
14583
|
duration: $78df6258e38451c4$var$springEnterDuration,
|
|
@@ -14631,7 +14585,8 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14631
14585
|
}
|
|
14632
14586
|
});
|
|
14633
14587
|
}, [
|
|
14634
|
-
draft
|
|
14588
|
+
draft,
|
|
14589
|
+
nbCards
|
|
14635
14590
|
]);
|
|
14636
14591
|
(0, $bZRJW$useEffect)(()=>{
|
|
14637
14592
|
handleClick(forcedCurrentCard || 0);
|
|
@@ -14889,7 +14844,7 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14889
14844
|
})
|
|
14890
14845
|
})
|
|
14891
14846
|
}),
|
|
14892
|
-
!draft && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
14847
|
+
!draft && nbCards > 1 && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
14893
14848
|
className: "rf-w-full rf-py-3 rf-flex rf-flex-row rf-justify-center rf-gap-1",
|
|
14894
14849
|
children: (0, $bZRJW$react).Children.map(children, (_child, key)=>{
|
|
14895
14850
|
return /*#__PURE__*/ (0, $bZRJW$jsx)("button", {
|
|
@@ -15294,17 +15249,17 @@ var $2ebe7b2fda999dc7$export$2e2bcd8739ae039 = $2ebe7b2fda999dc7$var$Grid;
|
|
|
15294
15249
|
|
|
15295
15250
|
|
|
15296
15251
|
parcelRegister("6EXzm", function(module, exports) {
|
|
15297
|
-
module.exports = import("./HistoryList.
|
|
15252
|
+
module.exports = import("./HistoryList.03a56119.js").then(()=>parcelRequire('2IZpO'));
|
|
15298
15253
|
|
|
15299
15254
|
});
|
|
15300
15255
|
|
|
15301
15256
|
parcelRegister("rAdI8", function(module, exports) {
|
|
15302
|
-
module.exports = import("./LanguageChoice.
|
|
15257
|
+
module.exports = import("./LanguageChoice.623ee802.js").then(()=>parcelRequire('4HBCW'));
|
|
15303
15258
|
|
|
15304
15259
|
});
|
|
15305
15260
|
|
|
15306
15261
|
parcelRegister("8y5Zs", function(module, exports) {
|
|
15307
|
-
module.exports = import("./AttachmentDetail.
|
|
15262
|
+
module.exports = import("./AttachmentDetail.fdcd1737.js").then(()=>parcelRequire('8QAGm'));
|
|
15308
15263
|
|
|
15309
15264
|
});
|
|
15310
15265
|
|
|
@@ -15314,17 +15269,17 @@ module.exports = import("./FullScreenImage.1fe27198.js").then(()=>parcelRequire(
|
|
|
15314
15269
|
});
|
|
15315
15270
|
|
|
15316
15271
|
parcelRegister("5Lxsr", function(module, exports) {
|
|
15317
|
-
module.exports = import("./Weather.
|
|
15272
|
+
module.exports = import("./Weather.cf58823d.js").then(()=>parcelRequire('2pbjN'));
|
|
15318
15273
|
|
|
15319
15274
|
});
|
|
15320
15275
|
|
|
15321
15276
|
parcelRegister("4tkZ7", function(module, exports) {
|
|
15322
|
-
module.exports = import("./CustomView.
|
|
15277
|
+
module.exports = import("./CustomView.c24a0e74.js").then(()=>parcelRequire('5s7df'));
|
|
15323
15278
|
|
|
15324
15279
|
});
|
|
15325
15280
|
|
|
15326
15281
|
parcelRegister("i6zhG", function(module, exports) {
|
|
15327
|
-
module.exports = import("./Emergency.
|
|
15282
|
+
module.exports = import("./Emergency.0cf005ce.js").then(()=>parcelRequire('4zoun'));
|
|
15328
15283
|
|
|
15329
15284
|
});
|
|
15330
15285
|
|
|
@@ -17103,6 +17058,11 @@ const $64c0a3f23b72e5d5$var$MicrophoneTextBubble = ({ showLoader: showLoader })=
|
|
|
17103
17058
|
const [text, setText] = (0, $bZRJW$useState)();
|
|
17104
17059
|
const [textUndefined, setTextUndefined] = (0, $bZRJW$useState)(false);
|
|
17105
17060
|
const timerRef = (0, $bZRJW$useRef)(null);
|
|
17061
|
+
(0, $bZRJW$useEffect)(()=>{
|
|
17062
|
+
return ()=>{
|
|
17063
|
+
timerRef.current && clearTimeout(timerRef.current);
|
|
17064
|
+
};
|
|
17065
|
+
}, []);
|
|
17106
17066
|
(0, $bZRJW$useEffect)(()=>{
|
|
17107
17067
|
setTextUndefined(speaking || showLoader || !botAnswerEnded || currentSubView !== (0, $4ucVo.CurrentSubView).none || dashboardOpened || retorikEvent === (0, $4ucVo.RetorikEvent).DetailViewOpen || listStatus === (0, $4ucVo.ListStatus).opened);
|
|
17108
17068
|
}, [
|
|
@@ -17132,8 +17092,12 @@ const $64c0a3f23b72e5d5$var$MicrophoneTextBubble = ({ showLoader: showLoader })=
|
|
|
17132
17092
|
setText(isMobile || isLandscape && lastRecognitionInterim ? undefined : translation.microphone.listening);
|
|
17133
17093
|
break;
|
|
17134
17094
|
case (0, $4ucVo.RecognitionState).Closed:
|
|
17135
|
-
|
|
17136
|
-
|
|
17095
|
+
let text = undefined;
|
|
17096
|
+
if (!textUndefined) text = useContinuousRecognition ? `<p>${translation.microphone.trigger}${isMobile ? ' ' : '<br />'}<strong>\xab ${agentData?.name} \xbb</strong></p>` : `<p>${translation.microphone.triggerwithoutname}</p>`;
|
|
17097
|
+
// Show the button only 1.5s after, to prevents it from appearing à fraction of second between several texts
|
|
17098
|
+
timerRef.current = setTimeout(()=>{
|
|
17099
|
+
setText(text);
|
|
17100
|
+
}, 1500);
|
|
17137
17101
|
break;
|
|
17138
17102
|
case (0, $4ucVo.RecognitionState).Initializing:
|
|
17139
17103
|
case (0, $4ucVo.RecognitionState).Closing:
|
|
@@ -18773,7 +18737,7 @@ var $af2bd3eba7cc813c$export$2e2bcd8739ae039 = $af2bd3eba7cc813c$var$DashboardIt
|
|
|
18773
18737
|
|
|
18774
18738
|
|
|
18775
18739
|
parcelRegister("lNCSW", function(module, exports) {
|
|
18776
|
-
module.exports = import("./NewsContainer.
|
|
18740
|
+
module.exports = import("./NewsContainer.05bb1b19.js").then(()=>parcelRequire('dUXW6'));
|
|
18777
18741
|
|
|
18778
18742
|
});
|
|
18779
18743
|
|
|
@@ -22426,7 +22390,6 @@ const $74b038ce1f8fa939$export$6108075486421829 = ()=>{
|
|
|
22426
22390
|
|
|
22427
22391
|
|
|
22428
22392
|
|
|
22429
|
-
|
|
22430
22393
|
var $1x02c = parcelRequire("1x02c");
|
|
22431
22394
|
|
|
22432
22395
|
var $aNpqK = parcelRequire("aNpqK");
|
|
@@ -22435,6 +22398,8 @@ var $9GPj7 = parcelRequire("9GPj7");
|
|
|
22435
22398
|
|
|
22436
22399
|
var $cT90l = parcelRequire("cT90l");
|
|
22437
22400
|
|
|
22401
|
+
var $4ucVo = parcelRequire("4ucVo");
|
|
22402
|
+
|
|
22438
22403
|
var $iT1WI = parcelRequire("iT1WI");
|
|
22439
22404
|
const $4551c1f557108aed$var$TelemetryContextDefaultValues = {
|
|
22440
22405
|
enabled: true,
|
|
@@ -22448,19 +22413,41 @@ function $4551c1f557108aed$export$a15d15518a3ec33d() {
|
|
|
22448
22413
|
}
|
|
22449
22414
|
function $4551c1f557108aed$export$bb3ea6dd2428edb6({ enabled: enabled, children: children }) {
|
|
22450
22415
|
const userId = (0, $aNpqK.useDirectlineStore)((state)=>state.userId);
|
|
22416
|
+
const conversationId = (0, $9GPj7.useActivityStore)((state)=>state.conversationId);
|
|
22451
22417
|
const addressData = (0, $1x02c.useRetorikStore)((state)=>state.addressData);
|
|
22452
22418
|
const lastActivity = (0, $9GPj7.useActivityStore)((state)=>state.lastActivity);
|
|
22453
22419
|
const botStreamingActivities = (0, $9GPj7.useActivityStore)((state)=>state.botStreamingActivities);
|
|
22454
|
-
const
|
|
22420
|
+
const lastUserActivityRef = (0, $bZRJW$useRef)(null);
|
|
22455
22421
|
const tracer = (0, $bZRJW$useMemo)(()=>{
|
|
22456
|
-
if (enabled && userId) {
|
|
22422
|
+
if (enabled && userId && conversationId) {
|
|
22457
22423
|
const exporter = new (0, $bZRJW$OTLPTraceExporter)({
|
|
22458
22424
|
url: (0, $cT90l.telemetryAddress),
|
|
22459
22425
|
headers: {},
|
|
22460
22426
|
concurrencyLimit: 1
|
|
22461
22427
|
});
|
|
22428
|
+
let serviceNamespace = '';
|
|
22429
|
+
switch(addressData.prefix){
|
|
22430
|
+
case 'dev':
|
|
22431
|
+
serviceNamespace = 'retorik-dev';
|
|
22432
|
+
break;
|
|
22433
|
+
case 'staging':
|
|
22434
|
+
case 'preview':
|
|
22435
|
+
serviceNamespace = 'retorik-preview';
|
|
22436
|
+
break;
|
|
22437
|
+
case 'experimental':
|
|
22438
|
+
serviceNamespace = 'retorik-experimental';
|
|
22439
|
+
break;
|
|
22440
|
+
default:
|
|
22441
|
+
serviceNamespace = 'retorik-prod';
|
|
22442
|
+
break;
|
|
22443
|
+
}
|
|
22444
|
+
// Create resource with custom parameters used globally in uptrace
|
|
22462
22445
|
const resource = (0, $bZRJW$defaultResource)().merge((0, $bZRJW$resourceFromAttributes)({
|
|
22463
|
-
[(0, $bZRJW$ATTR_SERVICE_NAME)]: 'retorik-framework'
|
|
22446
|
+
[(0, $bZRJW$ATTR_SERVICE_NAME)]: 'retorik-framework',
|
|
22447
|
+
['davi_retorik_activity_conversation_id']: conversationId,
|
|
22448
|
+
['service_namespace']: serviceNamespace,
|
|
22449
|
+
['retorik_framework_version']: (0, $iT1WI.version),
|
|
22450
|
+
['user_id']: userId
|
|
22464
22451
|
}));
|
|
22465
22452
|
const processor = new (0, $bZRJW$BatchSpanProcessor)(exporter);
|
|
22466
22453
|
const provider = new (0, $bZRJW$WebTracerProvider)({
|
|
@@ -22473,28 +22460,8 @@ function $4551c1f557108aed$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22473
22460
|
// Add common attributes to each span for better tracing
|
|
22474
22461
|
(0, $bZRJW$registerInstrumentations)({
|
|
22475
22462
|
instrumentations: [
|
|
22476
|
-
new (0, $bZRJW$FetchInstrumentation)(
|
|
22477
|
-
|
|
22478
|
-
...getCommonAttributes(),
|
|
22479
|
-
user_id: userId
|
|
22480
|
-
})
|
|
22481
|
-
}),
|
|
22482
|
-
new (0, $bZRJW$DocumentLoadInstrumentation)({
|
|
22483
|
-
applyCustomAttributesOnSpan: {
|
|
22484
|
-
documentLoad: (span)=>span.setAttributes({
|
|
22485
|
-
...getCommonAttributes(),
|
|
22486
|
-
user_id: userId
|
|
22487
|
-
}),
|
|
22488
|
-
documentFetch: (span)=>span.setAttributes({
|
|
22489
|
-
...getCommonAttributes(),
|
|
22490
|
-
user_id: userId
|
|
22491
|
-
}),
|
|
22492
|
-
resourceFetch: (span)=>span.setAttributes({
|
|
22493
|
-
...getCommonAttributes(),
|
|
22494
|
-
user_id: userId
|
|
22495
|
-
})
|
|
22496
|
-
}
|
|
22497
|
-
})
|
|
22463
|
+
new (0, $bZRJW$FetchInstrumentation)(),
|
|
22464
|
+
new (0, $bZRJW$DocumentLoadInstrumentation)()
|
|
22498
22465
|
]
|
|
22499
22466
|
});
|
|
22500
22467
|
return (0, $bZRJW$opentelemetryapi).trace.getTracer('retorik-framework');
|
|
@@ -22502,7 +22469,10 @@ function $4551c1f557108aed$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22502
22469
|
return undefined;
|
|
22503
22470
|
}, [
|
|
22504
22471
|
enabled,
|
|
22505
|
-
userId
|
|
22472
|
+
userId,
|
|
22473
|
+
conversationId,
|
|
22474
|
+
addressData,
|
|
22475
|
+
(0, $iT1WI.version)
|
|
22506
22476
|
]);
|
|
22507
22477
|
(0, $bZRJW$useEffect)(()=>{
|
|
22508
22478
|
if (lastActivity) lastActivity.from.role === 'user' ? handleUserActivity(lastActivity) : handleBotActivity(lastActivity);
|
|
@@ -22510,48 +22480,45 @@ function $4551c1f557108aed$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22510
22480
|
lastActivity
|
|
22511
22481
|
]);
|
|
22512
22482
|
(0, $bZRJW$useEffect)(()=>{
|
|
22513
|
-
if (
|
|
22514
|
-
const temp = botStreamingActivities.get(
|
|
22483
|
+
if (lastUserActivityRef.current) {
|
|
22484
|
+
const temp = botStreamingActivities.get(lastUserActivityRef.current.id);
|
|
22515
22485
|
temp?.length === 1 && handleBotActivity(temp[0]);
|
|
22516
22486
|
}
|
|
22517
22487
|
}, [
|
|
22518
|
-
botStreamingActivities
|
|
22519
|
-
lastUserActivityData
|
|
22488
|
+
botStreamingActivities
|
|
22520
22489
|
]);
|
|
22521
|
-
const getCommonAttributes = ()=>{
|
|
22522
|
-
let tenant = '';
|
|
22523
|
-
if (addressData.tenant) tenant = addressData.prefix ? `${addressData.tenant} (${addressData.prefix})` : addressData.tenant;
|
|
22524
|
-
return {
|
|
22525
|
-
tenant: tenant,
|
|
22526
|
-
current_URL: window.location.toString(),
|
|
22527
|
-
os: `${0, $bZRJW$osName} ${0, $bZRJW$osVersion}`,
|
|
22528
|
-
browser: `${0, $bZRJW$browserName} ${0, $bZRJW$browserVersion}`,
|
|
22529
|
-
retorik_framework_version: (0, $iT1WI.version)
|
|
22530
|
-
};
|
|
22531
|
-
};
|
|
22532
22490
|
const handleUserActivity = (activity)=>{
|
|
22533
22491
|
// Only handle message activites and event activities waiting for an answer, nothing for typing ones
|
|
22534
|
-
if (activity.type === 'message' || activity.type === 'event' && !(0, $cT90l.nonResponseInducingEvents).find((eventName)=>activity.name?.toLowerCase().includes(eventName)))
|
|
22492
|
+
if (activity.type === 'message' || activity.type === 'event' && !(0, $cT90l.nonResponseInducingEvents).find((eventName)=>activity.name?.toLowerCase().includes(eventName))) lastUserActivityRef.current = {
|
|
22535
22493
|
id: activity.id,
|
|
22536
22494
|
time: Date.now()
|
|
22537
|
-
}
|
|
22495
|
+
};
|
|
22538
22496
|
};
|
|
22539
22497
|
const handleBotActivity = (activity)=>{
|
|
22540
22498
|
// Do nothing for bring-up messages and non-streaming events
|
|
22541
|
-
if (
|
|
22542
|
-
sendTrace(
|
|
22543
|
-
|
|
22499
|
+
if (lastUserActivityRef.current && (activity.type === 'message' || activity.name?.toLocaleLowerCase() === 'davi.streammessageactivity') && activity.label?.toLowerCase() !== 'davi.bringupmessage' && activity.replyToId === lastUserActivityRef.current.id) {
|
|
22500
|
+
sendTrace((0, $4ucVo.TraceType).message, lastUserActivityRef.current.time);
|
|
22501
|
+
lastUserActivityRef.current = null;
|
|
22544
22502
|
}
|
|
22545
22503
|
};
|
|
22546
|
-
const sendTrace = (
|
|
22547
|
-
if (tracer) {
|
|
22548
|
-
const
|
|
22549
|
-
|
|
22550
|
-
|
|
22504
|
+
const sendTrace = (type, data)=>{
|
|
22505
|
+
if (tracer && type) {
|
|
22506
|
+
const parameters = {};
|
|
22507
|
+
switch(type){
|
|
22508
|
+
case (0, $4ucVo.TraceType).message:
|
|
22509
|
+
parameters.startTime = data;
|
|
22510
|
+
break;
|
|
22511
|
+
case (0, $4ucVo.TraceType).utteranceStart:
|
|
22512
|
+
parameters.text = data;
|
|
22513
|
+
break;
|
|
22514
|
+
case (0, $4ucVo.TraceType).utteranceEnd:
|
|
22515
|
+
parameters.text = data;
|
|
22516
|
+
break;
|
|
22517
|
+
}
|
|
22518
|
+
const span = tracer.startSpan(type, parameters);
|
|
22551
22519
|
span.setStatus({
|
|
22552
22520
|
code: (0, $bZRJW$SpanStatusCode).OK
|
|
22553
22521
|
});
|
|
22554
|
-
span.setAttributes(getCommonAttributes());
|
|
22555
22522
|
span.end();
|
|
22556
22523
|
}
|
|
22557
22524
|
};
|
|
@@ -22563,24 +22530,21 @@ function $4551c1f557108aed$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22563
22530
|
code: (0, $bZRJW$SpanStatusCode).ERROR,
|
|
22564
22531
|
message: `${error.message}`
|
|
22565
22532
|
});
|
|
22566
|
-
span.setAttributes(getCommonAttributes());
|
|
22567
22533
|
span.end();
|
|
22568
22534
|
}
|
|
22569
22535
|
};
|
|
22570
22536
|
const value = (0, $bZRJW$useMemo)(()=>({
|
|
22571
22537
|
enabled: enabled,
|
|
22572
22538
|
tracer: tracer,
|
|
22573
|
-
|
|
22574
|
-
|
|
22539
|
+
sendTrace: sendTrace,
|
|
22540
|
+
sendErrorTrace: sendErrorTrace
|
|
22575
22541
|
}), [
|
|
22576
22542
|
enabled,
|
|
22577
22543
|
tracer
|
|
22578
22544
|
]);
|
|
22579
|
-
return /*#__PURE__*/ (0, $bZRJW$jsx)(
|
|
22580
|
-
|
|
22581
|
-
|
|
22582
|
-
children: children
|
|
22583
|
-
})
|
|
22545
|
+
return /*#__PURE__*/ (0, $bZRJW$jsx)($4551c1f557108aed$export$7b6b7bc4acb29126.Provider, {
|
|
22546
|
+
value: value,
|
|
22547
|
+
children: children
|
|
22584
22548
|
});
|
|
22585
22549
|
}
|
|
22586
22550
|
|
|
@@ -23947,11 +23911,19 @@ var $f39384d6255fe275$export$2e2bcd8739ae039 = $f39384d6255fe275$var$BotResponse
|
|
|
23947
23911
|
|
|
23948
23912
|
|
|
23949
23913
|
|
|
23914
|
+
|
|
23915
|
+
var $1x02c = parcelRequire("1x02c");
|
|
23950
23916
|
parcelRequire("SZcIF");
|
|
23951
23917
|
var $jwPbX = parcelRequire("jwPbX");
|
|
23952
23918
|
const $3ff23eb3a82e4cf7$var$RetorikLogo = ()=>{
|
|
23953
|
-
|
|
23954
|
-
|
|
23919
|
+
const isUsedOnBorne = (0, $1x02c.useRetorikStore)((state)=>state.configuration.isUsedOnBorne);
|
|
23920
|
+
return isUsedOnBorne ? /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
23921
|
+
className: "rf-hidden large:rf-block rf-relative rf-z-[1] ltr:rf-col-start-1 rtl:rf-col-end-1 rf-col-span-full rf-row-start-12 rf-row-span-1 ltr:rf-self-end rtl:rf-self-start rf-justify-self-start",
|
|
23922
|
+
children: /*#__PURE__*/ (0, $bZRJW$jsx)((0, $jwPbX.default), {
|
|
23923
|
+
className: "ltr:rf-ml-4 rtl:rf-mr-4 rf-mb-4 rf-h-14"
|
|
23924
|
+
})
|
|
23925
|
+
}) : /*#__PURE__*/ (0, $bZRJW$jsx)("a", {
|
|
23926
|
+
href: "https://davi.ai",
|
|
23955
23927
|
title: "Retorik by Davi",
|
|
23956
23928
|
target: "_blank",
|
|
23957
23929
|
rel: "noreferrer",
|
|
@@ -24219,8 +24191,6 @@ var $1x02c = parcelRequire("1x02c");
|
|
|
24219
24191
|
|
|
24220
24192
|
var $9GPj7 = parcelRequire("9GPj7");
|
|
24221
24193
|
|
|
24222
|
-
var $i1rfm = parcelRequire("i1rfm");
|
|
24223
|
-
|
|
24224
24194
|
|
|
24225
24195
|
var $dklvz = parcelRequire("dklvz");
|
|
24226
24196
|
|
|
@@ -24336,8 +24306,6 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24336
24306
|
const endedActivities = (0, $9GPj7.useActivityStore)((state)=>state.endedActivities);
|
|
24337
24307
|
const watermark = (0, $9GPj7.useActivityStore)((state)=>state.watermark);
|
|
24338
24308
|
const forceMobileView = (0, $1x02c.useRetorikStore)((state)=>state.configuration.forceMobileView);
|
|
24339
|
-
const cancel = (0, $i1rfm.useSpeechStore)((state)=>state.cancel);
|
|
24340
|
-
const addEndedActivity = (0, $9GPj7.useActivityStore)((state)=>state.actions.addEndedActivity);
|
|
24341
24309
|
const [displayData, setDisplayData] = (0, $bZRJW$useState)([]);
|
|
24342
24310
|
const [currentDisplayDataIndex, setCurrentDisplayDataIndex] = (0, $bZRJW$useState)(0);
|
|
24343
24311
|
const [ended, setEnded] = (0, $bZRJW$useState)(!activities.length || endedActivities.includes(activities[activities.length - 1]?.id));
|
|
@@ -24352,7 +24320,7 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24352
24320
|
]);
|
|
24353
24321
|
(0, $bZRJW$useEffect)(()=>{
|
|
24354
24322
|
if (isWaitingForResponse) {
|
|
24355
|
-
// Create temporary activity with the id of the
|
|
24323
|
+
// Create temporary activity with the id of the next one to prevent re-renders, in order to display waiting dots
|
|
24356
24324
|
const nextActivityId = `${currentQuestionId.slice(0, currentQuestionId.length - watermark.toString().length)}${watermark.toString()}`;
|
|
24357
24325
|
const tempActivity = {
|
|
24358
24326
|
id: nextActivityId,
|
|
@@ -24367,36 +24335,14 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24367
24335
|
activity: tempActivity,
|
|
24368
24336
|
type: (0, $4ucVo.DisplayDataTypes).text,
|
|
24369
24337
|
isWaitingDots: true,
|
|
24370
|
-
canBeEnded: true
|
|
24338
|
+
canBeEnded: true,
|
|
24339
|
+
isEnded: false
|
|
24371
24340
|
}
|
|
24372
24341
|
]);
|
|
24373
24342
|
}
|
|
24374
24343
|
}, [
|
|
24375
24344
|
isWaitingForResponse
|
|
24376
24345
|
]);
|
|
24377
|
-
(0, $bZRJW$useEffect)(()=>{
|
|
24378
|
-
if (cancel) {
|
|
24379
|
-
activities.forEach((activity)=>{
|
|
24380
|
-
addEndedActivity(activity.id);
|
|
24381
|
-
});
|
|
24382
|
-
displayData.forEach((data)=>{
|
|
24383
|
-
addEndedActivity(data.activity.id);
|
|
24384
|
-
});
|
|
24385
|
-
}
|
|
24386
|
-
}, [
|
|
24387
|
-
cancel
|
|
24388
|
-
]);
|
|
24389
|
-
(0, $bZRJW$useEffect)(()=>{
|
|
24390
|
-
// End all current activities on component unmount
|
|
24391
|
-
return ()=>{
|
|
24392
|
-
activitiesRef.current.forEach((activity)=>{
|
|
24393
|
-
addEndedActivity(activity.id);
|
|
24394
|
-
});
|
|
24395
|
-
displayDataRef.current.forEach((data)=>{
|
|
24396
|
-
addEndedActivity(data.activity.id);
|
|
24397
|
-
});
|
|
24398
|
-
};
|
|
24399
|
-
}, []);
|
|
24400
24346
|
(0, $bZRJW$useEffect)(()=>{
|
|
24401
24347
|
activitiesRef.current = [
|
|
24402
24348
|
...activities
|
|
@@ -24408,7 +24354,7 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24408
24354
|
let streamingTexts = [];
|
|
24409
24355
|
activities.forEach((activity, index)=>{
|
|
24410
24356
|
let splitTextDataToAdd = [];
|
|
24411
|
-
// Check the attachments, special case if this is the message activity after streaming : show attachments if the first streaming
|
|
24357
|
+
// Check the attachments, special case if this is the message activity after streaming : show attachments if the first streaming activity didn't have any
|
|
24412
24358
|
let attachments = [];
|
|
24413
24359
|
if (activity.attachments?.length) {
|
|
24414
24360
|
if (activity.name?.toLowerCase() === 'davi.streammessageactivity') {
|
|
@@ -24417,14 +24363,16 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24417
24363
|
{
|
|
24418
24364
|
type: (0, $4ucVo.DisplayDataTypes).attachment,
|
|
24419
24365
|
activity: activity,
|
|
24420
|
-
canBeEnded: true
|
|
24366
|
+
canBeEnded: true,
|
|
24367
|
+
isEnded: true
|
|
24421
24368
|
}
|
|
24422
24369
|
];
|
|
24423
24370
|
} else if (!(activity.value?.streamingCount && streamingActivityHasAttachment) && !(0, $161354704eee0a17$export$7c55936a30618336)(activity)) attachments = [
|
|
24424
24371
|
{
|
|
24425
24372
|
type: (0, $4ucVo.DisplayDataTypes).attachment,
|
|
24426
24373
|
activity: activity,
|
|
24427
|
-
canBeEnded: true
|
|
24374
|
+
canBeEnded: true,
|
|
24375
|
+
isEnded: true
|
|
24428
24376
|
}
|
|
24429
24377
|
];
|
|
24430
24378
|
}
|
|
@@ -24442,14 +24390,20 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24442
24390
|
...currentFirstStreamingActivity,
|
|
24443
24391
|
htmlText: (0, $dklvz.processMarkdownAndSpeechMarkdown)(streamingTexts.join(''), false).htmlText
|
|
24444
24392
|
},
|
|
24445
|
-
canBeEnded: false
|
|
24393
|
+
canBeEnded: false,
|
|
24394
|
+
isEnded: false
|
|
24446
24395
|
}
|
|
24447
24396
|
];
|
|
24448
24397
|
}
|
|
24449
24398
|
} else if (activity.value?.streamingCount) {
|
|
24450
24399
|
if (tempDisplayData.length) {
|
|
24451
24400
|
const lastStreamingIndex = tempDisplayData.findLastIndex((d)=>d.type === (0, $4ucVo.DisplayDataTypes).text);
|
|
24452
|
-
lastStreamingIndex !== -1
|
|
24401
|
+
if (lastStreamingIndex !== -1) {
|
|
24402
|
+
// Set canBeEnded for the previous streaming
|
|
24403
|
+
tempDisplayData[lastStreamingIndex].canBeEnded = true;
|
|
24404
|
+
// Set previous streaming ended if this activity is ended in speech synthesis
|
|
24405
|
+
tempDisplayData[lastStreamingIndex].isEnded = endedActivities.includes(activity.id);
|
|
24406
|
+
}
|
|
24453
24407
|
}
|
|
24454
24408
|
// Reset streaming data if the message containing all streaming data is received
|
|
24455
24409
|
currentFirstStreamingActivity = undefined;
|
|
@@ -24464,7 +24418,8 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24464
24418
|
{
|
|
24465
24419
|
type: (0, $4ucVo.DisplayDataTypes).text,
|
|
24466
24420
|
activity: activity,
|
|
24467
|
-
canBeEnded: true
|
|
24421
|
+
canBeEnded: true,
|
|
24422
|
+
isEnded: endedActivities.includes(activity.id)
|
|
24468
24423
|
}
|
|
24469
24424
|
];
|
|
24470
24425
|
}
|
|
@@ -24486,7 +24441,8 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24486
24441
|
}
|
|
24487
24442
|
}, [
|
|
24488
24443
|
currentQuestionId,
|
|
24489
|
-
activities.length
|
|
24444
|
+
activities.length,
|
|
24445
|
+
endedActivities
|
|
24490
24446
|
]);
|
|
24491
24447
|
(0, $bZRJW$useEffect)(()=>{
|
|
24492
24448
|
displayDataRef.current = [
|
|
@@ -24509,7 +24465,6 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24509
24465
|
ended
|
|
24510
24466
|
]);
|
|
24511
24467
|
const handleEnded = ()=>{
|
|
24512
|
-
addEndedActivity(displayData[currentDisplayDataIndex]?.activity?.id);
|
|
24513
24468
|
setCurrentDisplayDataIndex((current)=>current + 1);
|
|
24514
24469
|
!ended && triggerScroll();
|
|
24515
24470
|
};
|
|
@@ -24517,7 +24472,7 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24517
24472
|
children: displayData.map((data, key)=>{
|
|
24518
24473
|
if (key <= currentDisplayDataIndex || ended) {
|
|
24519
24474
|
if (data.type === (0, $4ucVo.DisplayDataTypes).attachment) return data.activity.attachments?.length && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
24520
|
-
className: `${forceMobileView ? 'rf-m-auto' : 'rf-w-full'} ${data.activity.attachments.length
|
|
24475
|
+
className: `${forceMobileView ? 'rf-m-auto' : 'rf-w-full'} ${data.activity.attachments.filter((att)=>att.contentType.includes('card')).length === 1 && 'mobile:rf-px-4'} rf-flex rf-flex-col vertical:rf-items-center rf-gap-2`,
|
|
24521
24476
|
children: /*#__PURE__*/ (0, $bZRJW$jsx)((0, $1LYTj.default), {
|
|
24522
24477
|
activity: data.activity,
|
|
24523
24478
|
triggerScroll: triggerScroll
|
|
@@ -24530,7 +24485,7 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24530
24485
|
triggerScroll: triggerScroll,
|
|
24531
24486
|
onEnded: handleEnded,
|
|
24532
24487
|
canBeEnded: data.canBeEnded,
|
|
24533
|
-
isEnded: data.
|
|
24488
|
+
isEnded: data.isEnded,
|
|
24534
24489
|
isWaitingDots: data.isWaitingDots
|
|
24535
24490
|
}, `${data.activity.id}-${key}`);
|
|
24536
24491
|
}
|
|
@@ -25715,8 +25670,7 @@ const $52152cf5bb15b9c1$var$WarningBeforeNewsView = ()=>{
|
|
|
25715
25670
|
const sendEvent = (0, $aNpqK.useDirectlineStore)((state)=>state.actions.sendEvent);
|
|
25716
25671
|
const [waiting, setWaiting] = (0, $bZRJW$useState)(true);
|
|
25717
25672
|
const handleClick = (goHome)=>{
|
|
25718
|
-
sendEvent('Davi.CloseWindow', null);
|
|
25719
|
-
sendEvent('Davi.CloseWindowNewsSoundActivated', null);
|
|
25673
|
+
sendEvent('Davi.CloseWindow', null, ()=>sendEvent('Davi.CloseWindowNewsSoundActivated', null));
|
|
25720
25674
|
goHome ? setRoute((0, $4ucVo.Routes).Home) : setWaiting(false);
|
|
25721
25675
|
};
|
|
25722
25676
|
return waiting ? /*#__PURE__*/ (0, $bZRJW$jsxs)("div", {
|
|
@@ -26084,29 +26038,6 @@ var $1x02c = parcelRequire("1x02c");
|
|
|
26084
26038
|
var $aNpqK = parcelRequire("aNpqK");
|
|
26085
26039
|
|
|
26086
26040
|
var $4ucVo = parcelRequire("4ucVo");
|
|
26087
|
-
/* Return codes:
|
|
26088
|
-
0 => do nothing
|
|
26089
|
-
1 => add to queue
|
|
26090
|
-
2 => stop current activity + change to the one tested
|
|
26091
|
-
*/ const $98181c365642ebbf$var$checkLastbotActivity = (lastbotActivity, currentPlaying, currentReplyToId, queuedActivities, endedActivities)=>{
|
|
26092
|
-
// Check if the activity is the one currently being played
|
|
26093
|
-
if (lastbotActivity.id === currentPlaying.id) return 0;
|
|
26094
|
-
// Check if the activity has already been ended
|
|
26095
|
-
if (endedActivities.includes(lastbotActivity.id)) return 0;
|
|
26096
|
-
// Check if the activity has the same replyToId than the one currently being played
|
|
26097
|
-
if (lastbotActivity.replyToId === currentReplyToId) {
|
|
26098
|
-
// Check if the activity is already in the queue
|
|
26099
|
-
let count = 0;
|
|
26100
|
-
if (queuedActivities.length > 0) queuedActivities.forEach((activity)=>{
|
|
26101
|
-
if (activity.id === lastbotActivity.id) count++;
|
|
26102
|
-
});
|
|
26103
|
-
if (count === 0) return 1;
|
|
26104
|
-
else return 0;
|
|
26105
|
-
} else return 2;
|
|
26106
|
-
};
|
|
26107
|
-
var $98181c365642ebbf$export$2e2bcd8739ae039 = $98181c365642ebbf$var$checkLastbotActivity;
|
|
26108
|
-
|
|
26109
|
-
|
|
26110
26041
|
|
|
26111
26042
|
|
|
26112
26043
|
|
|
@@ -26698,7 +26629,8 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26698
26629
|
const microphoneCloseAudioRef = (0, $bZRJW$useRef)(null);
|
|
26699
26630
|
const [DBReady, setDBReady] = (0, $bZRJW$useState)(false);
|
|
26700
26631
|
const [playingBlob, setPlayingBlob] = (0, $bZRJW$useState)(false);
|
|
26701
|
-
const
|
|
26632
|
+
const nextUtteranceDataRef = (0, $bZRJW$useRef)(null);
|
|
26633
|
+
const nextUtteranceTextRef = (0, $bZRJW$useRef)(null);
|
|
26702
26634
|
const nextUtteranceBoundariesRef = (0, $bZRJW$useRef)([]);
|
|
26703
26635
|
const nextUtteranceVisemesRef = (0, $bZRJW$useRef)([]);
|
|
26704
26636
|
const emptyTextUtteranceRef = (0, $bZRJW$useRef)(null);
|
|
@@ -26712,7 +26644,7 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26712
26644
|
const stopCurrentPlaying = ()=>{
|
|
26713
26645
|
if (appAvailable || loaderClosed) {
|
|
26714
26646
|
// Cancel synthesis if using synthesizer
|
|
26715
|
-
if (!playingBlob) ponyfill
|
|
26647
|
+
if (!playingBlob) ponyfill.speechSynthesis.cancel();
|
|
26716
26648
|
resetNextUtteranceData();
|
|
26717
26649
|
if (audioRef.current && !audioRef.current?.paused) {
|
|
26718
26650
|
audioRef.current.pause();
|
|
@@ -26722,7 +26654,7 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26722
26654
|
};
|
|
26723
26655
|
const attachEvents = (tempUtterance, isMainUtterance)=>{
|
|
26724
26656
|
tempUtterance.onerror = (event)=>{
|
|
26725
|
-
isMainUtterance ? handleError(event) :
|
|
26657
|
+
isMainUtterance ? handleError(event) : nextUtteranceDataRef.current = null;
|
|
26726
26658
|
};
|
|
26727
26659
|
tempUtterance.onsynthesiscompleted = ()=>{
|
|
26728
26660
|
const endBoundary = {
|
|
@@ -26789,29 +26721,33 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26789
26721
|
return tempUtterance;
|
|
26790
26722
|
};
|
|
26791
26723
|
const processNextData = (data)=>{
|
|
26792
|
-
|
|
26793
|
-
|
|
26794
|
-
|
|
26795
|
-
|
|
26796
|
-
|
|
26724
|
+
nextUtteranceDataRef.current = data?.byteLength && nextUtteranceTextRef.current ? {
|
|
26725
|
+
text: nextUtteranceTextRef.current,
|
|
26726
|
+
data: {
|
|
26727
|
+
speechData: data,
|
|
26728
|
+
boundaries: nextUtteranceBoundariesRef.current,
|
|
26729
|
+
visemes: nextUtteranceVisemesRef.current
|
|
26730
|
+
}
|
|
26731
|
+
} : null;
|
|
26797
26732
|
// Reset boundary / viseme data
|
|
26798
26733
|
resetNextUtteranceData(true);
|
|
26799
26734
|
};
|
|
26800
26735
|
const resetNextUtteranceData = (keepArrayBufferData)=>{
|
|
26801
|
-
!keepArrayBufferData &&
|
|
26736
|
+
!keepArrayBufferData && (nextUtteranceDataRef.current = null);
|
|
26737
|
+
nextUtteranceTextRef.current = null;
|
|
26802
26738
|
nextUtteranceBoundariesRef.current = [];
|
|
26803
26739
|
nextUtteranceVisemesRef.current = [];
|
|
26804
26740
|
};
|
|
26805
26741
|
(0, $bZRJW$useEffect)(()=>{
|
|
26806
26742
|
if (utterance) {
|
|
26807
26743
|
if (utterance.text) {
|
|
26808
|
-
if (
|
|
26809
|
-
if (
|
|
26810
|
-
boundaryRef.current =
|
|
26811
|
-
setBoundaryData(
|
|
26812
|
-
setVisemeData(
|
|
26813
|
-
processData(
|
|
26814
|
-
} else // Play utterance whether by asking for a speech synthesis, or by retrieving data
|
|
26744
|
+
if (audioRef?.current) {
|
|
26745
|
+
if (nextUtteranceDataRef.current?.text === utterance.text && nextUtteranceDataRef.current.data) {
|
|
26746
|
+
boundaryRef.current = nextUtteranceDataRef.current.data.boundaries;
|
|
26747
|
+
setBoundaryData(nextUtteranceDataRef.current.data.boundaries);
|
|
26748
|
+
setVisemeData(nextUtteranceDataRef.current.data.visemes);
|
|
26749
|
+
processData(nextUtteranceDataRef.current.data.speechData, true);
|
|
26750
|
+
} else // Play utterance whether by asking for a speech synthesis, or by retrieving data from indexedDB
|
|
26815
26751
|
playUtterance(attachEvents(utterance, true));
|
|
26816
26752
|
} else stopCurrentPlaying();
|
|
26817
26753
|
} else handleEmptyTextUtterance();
|
|
@@ -26820,8 +26756,10 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26820
26756
|
utterance
|
|
26821
26757
|
]);
|
|
26822
26758
|
(0, $bZRJW$useEffect)(()=>{
|
|
26823
|
-
|
|
26759
|
+
// If there are data in nextUtteranceTextRef, this means the previous synthesis data retrieval is not finished, so we don't begin a new one
|
|
26760
|
+
if (nextUtterance?.text && !nextUtteranceTextRef.current) {
|
|
26824
26761
|
const tempUtterance = attachEvents(nextUtterance);
|
|
26762
|
+
nextUtteranceTextRef.current = nextUtterance.text;
|
|
26825
26763
|
ponyfill.speechSynthesis.synthesizeAndGetArrayData(tempUtterance, processNextData);
|
|
26826
26764
|
} else resetNextUtteranceData();
|
|
26827
26765
|
}, [
|
|
@@ -26829,14 +26767,14 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26829
26767
|
]);
|
|
26830
26768
|
const playUtterance = async (utt)=>{
|
|
26831
26769
|
if (DBReady && enableSpeechCaching !== false && utt) {
|
|
26832
|
-
const dataFromIndexedDB = await $637384b103093c58$var$DBManager.getSpeechData(`${locale}.${voice?.name}.${utt.text.replace($637384b103093c58$var$tagsRemoverRegex, '')
|
|
26770
|
+
const dataFromIndexedDB = await $637384b103093c58$var$DBManager.getSpeechData(`${locale}.${voice?.name}.${utt.text.replace($637384b103093c58$var$tagsRemoverRegex, '')}`);
|
|
26833
26771
|
if (dataFromIndexedDB) {
|
|
26834
26772
|
boundaryRef.current = dataFromIndexedDB.boundaries;
|
|
26835
26773
|
setBoundaryData(dataFromIndexedDB.boundaries);
|
|
26836
26774
|
setVisemeData(dataFromIndexedDB.visemes || []);
|
|
26837
26775
|
processData(dataFromIndexedDB.value, true);
|
|
26838
|
-
} else ponyfill
|
|
26839
|
-
} else ponyfill
|
|
26776
|
+
} else ponyfill.speechSynthesis.synthesizeAndGetArrayData(utt, processData);
|
|
26777
|
+
} else ponyfill.speechSynthesis.synthesizeAndGetArrayData(utt, processData);
|
|
26840
26778
|
};
|
|
26841
26779
|
const processData = (data, alreadyExistsInDB)=>{
|
|
26842
26780
|
if (data?.byteLength) {
|
|
@@ -26846,7 +26784,7 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26846
26784
|
type: 'audio/mp3'
|
|
26847
26785
|
});
|
|
26848
26786
|
enableSpeechCaching !== false && !alreadyExistsInDB && DBReady && boundaryRef?.current && utterance && $637384b103093c58$var$DBManager.addSpeechData({
|
|
26849
|
-
id: `${locale}.${voice?.name}.${utterance.text.replace($637384b103093c58$var$tagsRemoverRegex, '')
|
|
26787
|
+
id: `${locale}.${voice?.name}.${utterance.text.replace($637384b103093c58$var$tagsRemoverRegex, '')}`,
|
|
26850
26788
|
value: data,
|
|
26851
26789
|
boundaries: boundaryRef.current,
|
|
26852
26790
|
visemes: visemeRef.current || []
|
|
@@ -26871,13 +26809,13 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26871
26809
|
};
|
|
26872
26810
|
const handleEnd = ()=>{
|
|
26873
26811
|
if (appAvailable || loaderClosed) {
|
|
26874
|
-
onEnd
|
|
26812
|
+
onEnd?.();
|
|
26875
26813
|
resetData();
|
|
26876
26814
|
} else setLoaderClosed(true);
|
|
26877
26815
|
};
|
|
26878
26816
|
const handleError = (error)=>{
|
|
26879
|
-
console.log('
|
|
26880
|
-
onError
|
|
26817
|
+
console.log('Retorik Framework > speech synthesis error ', error);
|
|
26818
|
+
onError?.();
|
|
26881
26819
|
resetData();
|
|
26882
26820
|
};
|
|
26883
26821
|
const handleEmptyTextUtterance = ()=>{
|
|
@@ -26892,7 +26830,7 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26892
26830
|
* - play 1 second muted sound to prime audio output
|
|
26893
26831
|
* - MANDATORY FOR SAFARI IN VOCAL MODE
|
|
26894
26832
|
*/ const primeRetorikSpeech = ()=>{
|
|
26895
|
-
if (
|
|
26833
|
+
if (audioRef.current) {
|
|
26896
26834
|
audioRef.current.play().catch((e)=>console.warn(e));
|
|
26897
26835
|
speechRecognitionAudioRef?.current && speechRecognitionAudioRef.current.play().catch((e)=>console.warn(e));
|
|
26898
26836
|
// Send animation start event to secure animation not playing on safari if permissions are not sufficient
|
|
@@ -26902,13 +26840,6 @@ const $637384b103093c58$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26902
26840
|
/**
|
|
26903
26841
|
* Play sound on speech recognition activation if it isn't disabled in configuration
|
|
26904
26842
|
*/ (0, $bZRJW$useEffect)(()=>{
|
|
26905
|
-
// if (
|
|
26906
|
-
// !!speechRecognitionOptions?.enableActivationSound &&
|
|
26907
|
-
// activeRecognitionState === RecognitionState.Listening
|
|
26908
|
-
// ) {
|
|
26909
|
-
// speechRecognitionAudioRef?.current &&
|
|
26910
|
-
// speechRecognitionAudioRef.current.play().catch((e) => console.warn(e))
|
|
26911
|
-
// }
|
|
26912
26843
|
if (useOldRemote) {
|
|
26913
26844
|
if (!!speechRecognitionOptions?.enableActivationSound && activeRecognitionState === (0, $4ucVo.RecognitionState).Listening) speechRecognitionAudioRef?.current?.play().catch((e)=>console.warn(e));
|
|
26914
26845
|
} else if (!!speechRecognitionOptions?.enableActivationSound) switch(activeRecognitionState){
|
|
@@ -26965,11 +26896,7 @@ var $637384b103093c58$export$2e2bcd8739ae039 = $637384b103093c58$var$RetorikSpee
|
|
|
26965
26896
|
|
|
26966
26897
|
const $0b8e5d756ffed1ac$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikNews: isRetorikNews })=>{
|
|
26967
26898
|
const cancel = (0, $i1rfm.useSpeechStore)((state)=>state.cancel);
|
|
26968
|
-
const streamingReplyToId = (0, $i1rfm.useSpeechStore)((state)=>state.streamingReplyToId);
|
|
26969
26899
|
const streamingQueue = (0, $i1rfm.useSpeechStore)((state)=>state.streamingQueue);
|
|
26970
|
-
const currentPlaying = (0, $i1rfm.useSpeechStore)((state)=>state.currentPlaying);
|
|
26971
|
-
const currentReplyToId = (0, $i1rfm.useSpeechStore)((state)=>state.currentReplyToId);
|
|
26972
|
-
const endedActivities = (0, $i1rfm.useSpeechStore)((state)=>state.endedActivities);
|
|
26973
26900
|
const voice = (0, $i1rfm.useSpeechStore)((state)=>state.voice);
|
|
26974
26901
|
const customVoice = (0, $i1rfm.useSpeechStore)((state)=>state.customVoice);
|
|
26975
26902
|
const activeRecognitionState = (0, $i1rfm.useSpeechStore)((state)=>state.activeRecognitionState);
|
|
@@ -26982,24 +26909,17 @@ const $0b8e5d756ffed1ac$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
26982
26909
|
const appAvailable = (0, $1x02c.useRetorikStore)((state)=>state.appAvailable);
|
|
26983
26910
|
const preventExpectedInputHint = (0, $1x02c.useRetorikStore)((state)=>state.configuration.preventExpectedInputHint);
|
|
26984
26911
|
const speechSynthesisOptions = (0, $1x02c.useRetorikStore)((state)=>state.configuration.speechSynthesisOptions);
|
|
26985
|
-
const currentNewsActivity = (0, $j67YK.useUtilsStore)((state)=>state.currentNewsActivity);
|
|
26986
|
-
const lastBotActivity = (0, $9GPj7.useActivityStore)((state)=>state.lastBotMessageActivity);
|
|
26987
26912
|
const checkReplacementLocale = (0, $2fuDN.useLocaleStore)((state)=>state.actions.checkReplacementLocale);
|
|
26988
26913
|
const setRetorikNewsEnded = (0, $j67YK.useUtilsStore)((state)=>state.actions.setRetorikNewsEnded);
|
|
26989
|
-
const { resetCancelCurrentUtterance: resetCancelCurrentUtterance, setSpeaking: setSpeaking,
|
|
26914
|
+
const { setCurrentOrLastPlayedActivity: setCurrentOrLastPlayedActivity, resetCancelCurrentUtterance: resetCancelCurrentUtterance, setSpeaking: setSpeaking, setBoundaryData: setBoundaryData, removeFirstFromStreamingQueue: removeFirstFromStreamingQueue, killCurrentStreaming: killCurrentStreaming, askPermission: askPermission, toggleMicrophone: toggleMicrophone } = (0, $i1rfm.useSpeechStore)((state)=>state.actions);
|
|
26990
26915
|
const addEndedActivity = (0, $9GPj7.useActivityStore)((state)=>state.actions.addEndedActivity);
|
|
26991
26916
|
const dispatchMarkActivity = (0, $aNpqK.useDirectlineStore)((state)=>state.actions.dispatchMarkActivity);
|
|
26992
26917
|
const [utterance, setUtterance] = (0, $bZRJW$useState)(null);
|
|
26993
26918
|
const [nextUtterance, setNextUtterance] = (0, $bZRJW$useState)(null);
|
|
26994
|
-
const cancelRef = (0, $bZRJW$useRef)(false);
|
|
26995
|
-
const isSpeaking = (0, $bZRJW$useRef)(false);
|
|
26996
26919
|
const isNewsViewRef = (0, $bZRJW$useRef)(!!isRetorikNews);
|
|
26997
26920
|
const lastListTextPlayedRef = (0, $bZRJW$useRef)('');
|
|
26998
|
-
const
|
|
26921
|
+
const streamingQueueRef = (0, $bZRJW$useRef)([]);
|
|
26999
26922
|
const currentActivityRef = (0, $bZRJW$useRef)(null);
|
|
27000
|
-
const currentPlayingRef = (0, $bZRJW$useRef)(null);
|
|
27001
|
-
const tempCurrentStreamingRef = (0, $bZRJW$useRef)(null);
|
|
27002
|
-
const streamingRelatedMessageRef = (0, $bZRJW$useRef)(null);
|
|
27003
26923
|
/**
|
|
27004
26924
|
* Check activity locale in case of voice change during the speech, to keep the language defined in activity
|
|
27005
26925
|
* instead of switching languages between answers that are written in the same language
|
|
@@ -27026,17 +26946,20 @@ const $0b8e5d756ffed1ac$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
27026
26946
|
return (0, $66dccbb634d6ce27$export$f969af62bba9a48b)(params, speechSynthesisOptions?.sayAs);
|
|
27027
26947
|
};
|
|
27028
26948
|
const resetData = ()=>{
|
|
27029
|
-
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
|
|
27033
|
-
|
|
26949
|
+
// Set all activities curretnly in the queue as ended
|
|
26950
|
+
streamingQueueRef.current?.forEach((activity)=>{
|
|
26951
|
+
addEndedActivity(activity.id);
|
|
26952
|
+
});
|
|
26953
|
+
streamingQueueRef.current = [];
|
|
26954
|
+
killCurrentStreaming();
|
|
26955
|
+
currentActivityRef.current = null;
|
|
27034
26956
|
setUtterance(null);
|
|
27035
26957
|
setNextUtterance(null);
|
|
27036
26958
|
resetCancelCurrentUtterance();
|
|
26959
|
+
setSpeaking(false);
|
|
26960
|
+
setBoundaryData([]);
|
|
27037
26961
|
};
|
|
27038
|
-
const checkReplacementLocaleAndGetUtterance = (activity, checkReplacement = true
|
|
27039
|
-
setCurrent && (currentActivityRef.current = activity);
|
|
26962
|
+
const checkReplacementLocaleAndGetUtterance = (activity, checkReplacement = true)=>{
|
|
27040
26963
|
const replacementLocale = checkReplacement ? checkReplacementLocale(activity.locale || locale) : locale;
|
|
27041
26964
|
const params = {
|
|
27042
26965
|
activity: activity,
|
|
@@ -27045,172 +26968,39 @@ const $0b8e5d756ffed1ac$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
27045
26968
|
};
|
|
27046
26969
|
return checkActivityAndCreateUtterance(params);
|
|
27047
26970
|
};
|
|
27048
|
-
|
|
26971
|
+
/**
|
|
26972
|
+
* Check if the microphone can be opened automatically
|
|
26973
|
+
*/ const checkDictateState = ()=>{
|
|
27049
26974
|
if (!preventExpectedInputHint && mode === (0, $4ucVo.Mode).vocal && activeRecognitionState === (0, $4ucVo.RecognitionState).Closed) {
|
|
27050
26975
|
if (!isMicrophoneAllowed) askPermission();
|
|
27051
26976
|
else toggleMicrophone(true);
|
|
27052
26977
|
}
|
|
27053
26978
|
};
|
|
27054
|
-
(0, $bZRJW$useEffect)(()=>{
|
|
27055
|
-
if (isNewsViewRef.current) {
|
|
27056
|
-
if (currentNewsActivity) {
|
|
27057
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(currentNewsActivity));
|
|
27058
|
-
isSpeaking.current = true;
|
|
27059
|
-
} else {
|
|
27060
|
-
setUtterance(null);
|
|
27061
|
-
isSpeaking.current = false;
|
|
27062
|
-
}
|
|
27063
|
-
}
|
|
27064
|
-
}, [
|
|
27065
|
-
currentNewsActivity,
|
|
27066
|
-
ponyfill
|
|
27067
|
-
]);
|
|
27068
26979
|
/**
|
|
27069
|
-
* On
|
|
27070
|
-
* - when we toggle from a view to another, we reset the data related to speech
|
|
26980
|
+
* On route change, reset all data and check if we are on the news view
|
|
27071
26981
|
*/ (0, $bZRJW$useEffect)(()=>{
|
|
27072
|
-
setSpeaking(false);
|
|
27073
|
-
setBoundaryData([]);
|
|
27074
|
-
const ended = [
|
|
27075
|
-
...endedActivities
|
|
27076
|
-
];
|
|
27077
|
-
if (currentPlaying) {
|
|
27078
|
-
// Add played activity id to context's endedActivities
|
|
27079
|
-
ended.length > 10 && ended.splice(0, 1);
|
|
27080
|
-
if (currentPlaying.id) {
|
|
27081
|
-
ended.push(currentPlaying.id);
|
|
27082
|
-
addEndedActivity(currentPlaying.id);
|
|
27083
|
-
}
|
|
27084
|
-
setEndedActivities(ended);
|
|
27085
|
-
}
|
|
27086
|
-
setCurrentPlaying(undefined);
|
|
27087
26982
|
resetData();
|
|
27088
26983
|
if (!isRetorikNews) isNewsViewRef.current = route === (0, $4ucVo.Routes).News;
|
|
27089
26984
|
}, [
|
|
27090
26985
|
route
|
|
27091
26986
|
]);
|
|
27092
26987
|
/**
|
|
27093
|
-
* On
|
|
27094
|
-
* - appAvailable is set to true after the user interacted with the loader and every needed element is loaded
|
|
27095
|
-
* - no utterance is created while appAvailable isn't true
|
|
27096
|
-
* - if during the waiting time, some activities were queued, when appAvailable comes to true, let's begin creating the utterances and playing them
|
|
27097
|
-
*/ (0, $bZRJW$useEffect)(()=>{
|
|
27098
|
-
if (appAvailable && queuedActivitiesRef.current?.length) {
|
|
27099
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(queuedActivitiesRef.current[0]));
|
|
27100
|
-
queuedActivitiesRef.current.splice(0, 1);
|
|
27101
|
-
isSpeaking.current = true;
|
|
27102
|
-
}
|
|
27103
|
-
}, [
|
|
27104
|
-
appAvailable
|
|
27105
|
-
]);
|
|
27106
|
-
/**
|
|
27107
|
-
* On speechCancelStore's cancel state change :
|
|
27108
|
-
* - if there is currently no utterance being played, reset cancel state to false
|
|
27109
|
-
* - if an utterance is being played, set it to null to stop playing and prevent data in queue from being played
|
|
27110
|
-
* - setting an utterance to null will trigger the handleUtteranceEnded method automatically
|
|
26988
|
+
* On cancel call, reset all data and kill current streaming
|
|
27111
26989
|
*/ (0, $bZRJW$useEffect)(()=>{
|
|
27112
|
-
|
|
27113
|
-
if (cancel) {
|
|
27114
|
-
utterance ? setUtterance(null) : resetCancelCurrentUtterance();
|
|
27115
|
-
isSpeaking.current = false;
|
|
27116
|
-
setNextUtterance(null);
|
|
27117
|
-
killCurrentStreaming();
|
|
27118
|
-
}
|
|
26990
|
+
cancel && resetData();
|
|
27119
26991
|
}, [
|
|
27120
26992
|
cancel
|
|
27121
26993
|
]);
|
|
27122
26994
|
/**
|
|
27123
|
-
*
|
|
27124
|
-
* - if the activity doesn't have a replyToId value, put it in the queue (used for reminder process)
|
|
27125
|
-
* - if the app is not available yet, put the activity in the queue if it is not yet inside
|
|
27126
|
-
* - NB: an activity can be received once from the directline, but can be found several times in the activities in the botframework
|
|
27127
|
-
* this is because it is processed multiple times if there is something to speak (channelDate empty, then channelData with {speak: true})
|
|
27128
|
-
* - if an utterance is being played, process the new one (do nothing / put it in the queue / stop the current one and play the new one)
|
|
27129
|
-
* - if an utterance has to be created, create it and set the utterance state
|
|
26995
|
+
* Play external speech immediately but don't add it to the history
|
|
27130
26996
|
*/ (0, $bZRJW$useEffect)(()=>{
|
|
27131
|
-
if (voice && lastBotActivity?.id) {
|
|
27132
|
-
let createNewUtterance = false;
|
|
27133
|
-
if (!lastBotActivity.replyToId) {
|
|
27134
|
-
if (isNewsViewRef.current) ;
|
|
27135
|
-
else if (currentPlaying || queuedActivitiesRef.current?.length) queuedActivitiesRef.current = [
|
|
27136
|
-
...queuedActivitiesRef.current,
|
|
27137
|
-
lastBotActivity
|
|
27138
|
-
];
|
|
27139
|
-
else if (endedActivities.length === 0 || endedActivities[endedActivities.length - 1] !== lastBotActivity.id) createNewUtterance = true;
|
|
27140
|
-
} else if (lastBotActivity.replyToId === streamingReplyToId) {
|
|
27141
|
-
if (lastBotActivity.value?.streamingId) {
|
|
27142
|
-
setCurrentPlaying(lastBotActivity);
|
|
27143
|
-
currentPlayingRef.current = lastBotActivity;
|
|
27144
|
-
// Keep the message related to playing streaming activities to deal with when streaming is ended
|
|
27145
|
-
streamingRelatedMessageRef.current = lastBotActivity;
|
|
27146
|
-
} else queuedActivitiesRef.current = [
|
|
27147
|
-
...queuedActivitiesRef.current,
|
|
27148
|
-
lastBotActivity
|
|
27149
|
-
];
|
|
27150
|
-
} else if (!appAvailable) {
|
|
27151
|
-
if (!currentReplyToId) {
|
|
27152
|
-
setCurrentReplyToId(lastBotActivity.replyToId);
|
|
27153
|
-
queuedActivitiesRef.current = [
|
|
27154
|
-
lastBotActivity
|
|
27155
|
-
];
|
|
27156
|
-
} else {
|
|
27157
|
-
if (currentReplyToId === lastBotActivity.replyToId) {
|
|
27158
|
-
if (!queuedActivitiesRef.current?.find((act)=>act.id === lastBotActivity.id)) queuedActivitiesRef.current = [
|
|
27159
|
-
...queuedActivitiesRef.current,
|
|
27160
|
-
lastBotActivity
|
|
27161
|
-
];
|
|
27162
|
-
} else {
|
|
27163
|
-
setCurrentReplyToId(lastBotActivity.replyToId);
|
|
27164
|
-
queuedActivitiesRef.current = [
|
|
27165
|
-
lastBotActivity
|
|
27166
|
-
];
|
|
27167
|
-
}
|
|
27168
|
-
}
|
|
27169
|
-
} else if (currentActivityRef?.current) switch((0, $98181c365642ebbf$export$2e2bcd8739ae039)(lastBotActivity, currentActivityRef.current, currentReplyToId, queuedActivitiesRef.current, endedActivities)){
|
|
27170
|
-
case 0:
|
|
27171
|
-
break;
|
|
27172
|
-
case 1:
|
|
27173
|
-
// Add the activity to the queue
|
|
27174
|
-
queuedActivitiesRef.current.push(lastBotActivity);
|
|
27175
|
-
break;
|
|
27176
|
-
case 2:
|
|
27177
|
-
// Stop current activity and play the new one
|
|
27178
|
-
queuedActivitiesRef.current = [];
|
|
27179
|
-
createNewUtterance = true;
|
|
27180
|
-
break;
|
|
27181
|
-
}
|
|
27182
|
-
else createNewUtterance = !endedActivities.includes(lastBotActivity.id);
|
|
27183
|
-
if (createNewUtterance) {
|
|
27184
|
-
setCurrentReplyToId(lastBotActivity.replyToId || 'customReplyToIdIfNotPresent');
|
|
27185
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(lastBotActivity));
|
|
27186
|
-
isSpeaking.current = true;
|
|
27187
|
-
}
|
|
27188
|
-
}
|
|
27189
|
-
}, [
|
|
27190
|
-
lastBotActivity,
|
|
27191
|
-
ponyfill,
|
|
27192
|
-
voice
|
|
27193
|
-
]);
|
|
27194
|
-
(0, $bZRJW$useEffect)(()=>{
|
|
27195
|
-
if (streamingReplyToId && streamingQueue.length) {
|
|
27196
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(streamingQueue[0], false, false));
|
|
27197
|
-
isSpeaking.current = true;
|
|
27198
|
-
setCurrentPlaying(undefined);
|
|
27199
|
-
currentPlayingRef.current = null;
|
|
27200
|
-
currentActivityRef.current = null;
|
|
27201
|
-
tempCurrentStreamingRef.current = streamingQueue[0].text || null;
|
|
27202
|
-
removeFirstFromStreamingQueue();
|
|
27203
|
-
}
|
|
27204
|
-
}, [
|
|
27205
|
-
streamingReplyToId
|
|
27206
|
-
]);
|
|
27207
|
-
(0, $bZRJW$useEffect)(()=>{
|
|
27208
26997
|
if (externalTextToSpeech) {
|
|
27209
|
-
|
|
26998
|
+
const activity = {
|
|
27210
26999
|
speak: externalTextToSpeech,
|
|
27211
27000
|
locale: locale
|
|
27212
|
-
}
|
|
27213
|
-
|
|
27001
|
+
};
|
|
27002
|
+
currentActivityRef.current = activity;
|
|
27003
|
+
setUtterance(checkReplacementLocaleAndGetUtterance(activity, false));
|
|
27214
27004
|
}
|
|
27215
27005
|
}, [
|
|
27216
27006
|
externalTextToSpeech
|
|
@@ -27220,92 +27010,75 @@ const $0b8e5d756ffed1ac$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
27220
27010
|
document.dispatchEvent(speechEvent);
|
|
27221
27011
|
};
|
|
27222
27012
|
/**
|
|
27223
|
-
*
|
|
27224
|
-
* - set speaking state to true
|
|
27225
|
-
* - clear timerref timeout
|
|
27226
|
-
* - set currentPlaying and currentReplyToId states after a small delay to prevent make sure that the display will happen after the speech has begun
|
|
27013
|
+
* Called when utterance's "start" event is fired
|
|
27227
27014
|
*/ const handleUtteranceStart = ()=>{
|
|
27228
27015
|
setSpeaking(true);
|
|
27229
27016
|
if (!isNewsViewRef.current && currentActivityRef?.current) {
|
|
27230
|
-
|
|
27231
|
-
currentPlayingRef.current = currentActivityRef.current;
|
|
27017
|
+
setCurrentOrLastPlayedActivity(currentActivityRef.current);
|
|
27232
27018
|
currentActivityRef.current.id && dispatchMarkActivity(currentActivityRef.current.id, true);
|
|
27233
27019
|
}
|
|
27234
27020
|
dispatchSpeechEvent(true);
|
|
27235
27021
|
// Set next utterance to prepare synthesis data in order to improve fluidity
|
|
27236
|
-
if (
|
|
27237
|
-
const
|
|
27238
|
-
|
|
27239
|
-
const tempUtterance = checkReplacementLocaleAndGetUtterance(streamingQueue[0], false, false);
|
|
27240
|
-
tempUtterance.text !== nextUtterance?.text ? setNextUtterance(tempUtterance) : setNextUtterance(null);
|
|
27241
|
-
} else setNextUtterance(null);
|
|
27022
|
+
if (streamingQueueRef.current.length && !streamingQueueRef.current[0].value?.streamingCount) {
|
|
27023
|
+
const utt = checkReplacementLocaleAndGetUtterance(streamingQueueRef.current[0], false);
|
|
27024
|
+
setNextUtterance((current)=>utt.text === current?.text ? null : utt);
|
|
27242
27025
|
} else setNextUtterance(null);
|
|
27243
|
-
setCurrentStreaming(tempCurrentStreamingRef?.current);
|
|
27244
27026
|
};
|
|
27245
|
-
|
|
27027
|
+
/**
|
|
27028
|
+
* Called when utterance's "end" event is fired
|
|
27029
|
+
*/ const handleUtteranceEnd = ()=>{
|
|
27246
27030
|
setSpeaking(false);
|
|
27247
27031
|
dispatchSpeechEvent(false);
|
|
27248
|
-
if (isNewsViewRef.current)
|
|
27249
|
-
|
|
27250
|
-
|
|
27032
|
+
if (isNewsViewRef.current) {
|
|
27033
|
+
setRetorikNewsEnded(true);
|
|
27034
|
+
currentActivityRef.current = null;
|
|
27035
|
+
} else handleEnded();
|
|
27251
27036
|
};
|
|
27252
|
-
|
|
27253
|
-
|
|
27254
|
-
|
|
27255
|
-
|
|
27256
|
-
|
|
27257
|
-
* - if this was the last activity of the queue, check if the microphone has to be opened automatically (inputHint = expectingInput)
|
|
27258
|
-
*/ const handleEnded = ()=>{
|
|
27259
|
-
let futureUtterance = null;
|
|
27260
|
-
if (currentPlayingRef?.current) // Add played activity id to context's endedActivities
|
|
27261
|
-
{
|
|
27262
|
-
if (currentPlayingRef.current.id) {
|
|
27263
|
-
addEndedActivity(currentPlayingRef.current.id);
|
|
27264
|
-
dispatchMarkActivity(currentPlayingRef.current.id, false);
|
|
27265
|
-
}
|
|
27037
|
+
const handleEnded = ()=>{
|
|
27038
|
+
// Add played activity id to context's endedActivities
|
|
27039
|
+
if (currentActivityRef.current?.id) {
|
|
27040
|
+
addEndedActivity(currentActivityRef.current.id);
|
|
27041
|
+
dispatchMarkActivity(currentActivityRef.current.id, false);
|
|
27266
27042
|
}
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
27273
|
-
|
|
27274
|
-
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27043
|
+
if (streamingQueueRef.current?.length) {
|
|
27044
|
+
// Check if this is the message sent after streaming activities
|
|
27045
|
+
if (streamingQueueRef.current[0].value?.streamingCount) {
|
|
27046
|
+
addEndedActivity(streamingQueueRef.current[0].id);
|
|
27047
|
+
// If there is another activity after this message, play it. If not, let's check if the microphone should be opened
|
|
27048
|
+
if (streamingQueueRef.current?.length > 1) {
|
|
27049
|
+
const utt = checkReplacementLocaleAndGetUtterance(streamingQueueRef.current[1]);
|
|
27050
|
+
currentActivityRef.current = streamingQueueRef.current[1];
|
|
27051
|
+
setUtterance(utt);
|
|
27052
|
+
removeFirstFromStreamingQueue(true);
|
|
27053
|
+
} else {
|
|
27054
|
+
streamingQueueRef.current[0].inputHint === 'expectingInput' && checkDictateState();
|
|
27055
|
+
currentActivityRef.current = null;
|
|
27056
|
+
setUtterance(null);
|
|
27057
|
+
setNextUtterance(null);
|
|
27058
|
+
removeFirstFromStreamingQueue();
|
|
27281
27059
|
}
|
|
27282
|
-
} else
|
|
27283
|
-
|
|
27284
|
-
|
|
27285
|
-
|
|
27286
|
-
|
|
27287
|
-
}
|
|
27060
|
+
} else {
|
|
27061
|
+
const utt = checkReplacementLocaleAndGetUtterance(streamingQueueRef.current[0]);
|
|
27062
|
+
currentActivityRef.current = streamingQueueRef.current[0];
|
|
27063
|
+
setUtterance(utt);
|
|
27064
|
+
removeFirstFromStreamingQueue();
|
|
27065
|
+
}
|
|
27066
|
+
} else {
|
|
27067
|
+
currentActivityRef.current?.inputHint === 'expectingInput' && checkDictateState();
|
|
27068
|
+
currentActivityRef.current = null;
|
|
27069
|
+
setUtterance(null);
|
|
27070
|
+
setNextUtterance(null);
|
|
27288
27071
|
}
|
|
27289
|
-
currentPlayingRef.current = null;
|
|
27290
|
-
setUtterance(futureUtterance);
|
|
27291
|
-
isSpeaking.current = !!futureUtterance;
|
|
27292
27072
|
};
|
|
27293
27073
|
/**
|
|
27294
|
-
*
|
|
27074
|
+
* Wait for app loading and voice selection to begin playing speech
|
|
27295
27075
|
*/ (0, $bZRJW$useEffect)(()=>{
|
|
27296
|
-
|
|
27297
|
-
|
|
27298
|
-
|
|
27299
|
-
if (streamingQueue.length) {
|
|
27300
|
-
futureUtterance = checkReplacementLocaleAndGetUtterance(streamingQueue[0], false, false);
|
|
27301
|
-
tempCurrentStreamingRef.current = streamingQueue[0].text || null;
|
|
27302
|
-
removeFirstFromStreamingQueue();
|
|
27303
|
-
}
|
|
27304
|
-
currentPlayingRef.current = null;
|
|
27305
|
-
setUtterance(futureUtterance);
|
|
27306
|
-
isSpeaking.current = !!futureUtterance;
|
|
27307
|
-
}
|
|
27076
|
+
// Set ref from the state to use in events
|
|
27077
|
+
streamingQueueRef.current = streamingQueue;
|
|
27078
|
+
if (appAvailable && voice && streamingQueue.length && !currentActivityRef.current) handleEnded();
|
|
27308
27079
|
}, [
|
|
27080
|
+
appAvailable,
|
|
27081
|
+
voice,
|
|
27309
27082
|
streamingQueue
|
|
27310
27083
|
]);
|
|
27311
27084
|
return /*#__PURE__*/ (0, $bZRJW$jsx)((0, $637384b103093c58$export$2e2bcd8739ae039), {
|
|
@@ -27327,7 +27100,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27327
27100
|
const locale = (0, $2fuDN.useLocaleStore)((state)=>state.locale);
|
|
27328
27101
|
const agentData = (0, $1x02c.useRetorikStore)((state)=>state.agentData);
|
|
27329
27102
|
const setVoice = (0, $i1rfm.useSpeechStore)((state)=>state.actions.setVoice);
|
|
27330
|
-
const [
|
|
27103
|
+
const [ponyfillCreated, setPonyfillCreated] = (0, $bZRJW$useState)(false);
|
|
27104
|
+
const ponyfillRef = (0, $bZRJW$useRef)(undefined);
|
|
27331
27105
|
const refreshTimerRef = (0, $bZRJW$useRef)(null);
|
|
27332
27106
|
/**
|
|
27333
27107
|
* Async function to retrieve a new token and assign it to the speechConfig inside ponyfill.speechSynthesis
|
|
@@ -27337,8 +27111,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27337
27111
|
// A token is valid during 10 minutes, let's refresh it after 9 minutes
|
|
27338
27112
|
refreshTimerRef.current = setTimeout(async ()=>{
|
|
27339
27113
|
const token = await (0, $f9d43385082cde31$export$a2ce4fdd6972d6a7)(region, key);
|
|
27340
|
-
if (token &&
|
|
27341
|
-
|
|
27114
|
+
if (token && ponyfillRef.current?.speechSynthesis?.speechConfig) {
|
|
27115
|
+
ponyfillRef.current.speechSynthesis.speechConfig.authorizationToken = token;
|
|
27342
27116
|
refreshTokenInNineMinutes(region, key);
|
|
27343
27117
|
}
|
|
27344
27118
|
}, 540000) // 9 minutes
|
|
@@ -27351,14 +27125,15 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27351
27125
|
*/ const fetchTokenAndCreatePonyfill = async (region, key)=>{
|
|
27352
27126
|
const token = await (0, $f9d43385082cde31$export$a2ce4fdd6972d6a7)(region, key);
|
|
27353
27127
|
if (token) {
|
|
27354
|
-
|
|
27128
|
+
ponyfillRef.current = (0, $bZRJW$createSpeechSynthesisPonyfill)({
|
|
27355
27129
|
credentials: {
|
|
27356
27130
|
region: ponyfillCredentials?.region,
|
|
27357
27131
|
authorizationToken: token
|
|
27358
27132
|
}
|
|
27359
|
-
})
|
|
27133
|
+
});
|
|
27360
27134
|
// Launch token refresh after ponyfill creation
|
|
27361
27135
|
refreshTokenInNineMinutes(region, key);
|
|
27136
|
+
setPonyfillCreated(true);
|
|
27362
27137
|
}
|
|
27363
27138
|
};
|
|
27364
27139
|
(0, $bZRJW$useEffect)(()=>{
|
|
@@ -27366,23 +27141,24 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27366
27141
|
const data = {
|
|
27367
27142
|
credentials: ponyfillCredentials
|
|
27368
27143
|
};
|
|
27369
|
-
|
|
27144
|
+
ponyfillRef.current = (0, $bZRJW$createSpeechSynthesisPonyfill)(data);
|
|
27145
|
+
setPonyfillCreated(true);
|
|
27370
27146
|
} else if (ponyfillCredentials?.subscriptionKey && ponyfillCredentials.region) fetchTokenAndCreatePonyfill(ponyfillCredentials.region, ponyfillCredentials.subscriptionKey);
|
|
27371
27147
|
}, [
|
|
27372
27148
|
ponyfillCredentials
|
|
27373
27149
|
]);
|
|
27374
27150
|
const onVoicesChanged = ()=>{
|
|
27375
|
-
const voices =
|
|
27151
|
+
const voices = ponyfillRef.current?.speechSynthesis.getVoices();
|
|
27376
27152
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $e3b82aafad2d0e5e$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27377
27153
|
};
|
|
27378
27154
|
(0, $bZRJW$useEffect)(()=>{
|
|
27379
|
-
if (
|
|
27380
|
-
const voices =
|
|
27155
|
+
if (ponyfillRef.current) {
|
|
27156
|
+
const voices = ponyfillRef.current.speechSynthesis.getVoices();
|
|
27381
27157
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $e3b82aafad2d0e5e$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27382
|
-
else
|
|
27158
|
+
else ponyfillRef.current.speechSynthesis.onvoiceschanged = onVoicesChanged;
|
|
27383
27159
|
}
|
|
27384
27160
|
}, [
|
|
27385
|
-
|
|
27161
|
+
ponyfillCreated,
|
|
27386
27162
|
customVoice,
|
|
27387
27163
|
agentData,
|
|
27388
27164
|
locale
|
|
@@ -27392,8 +27168,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27392
27168
|
refreshTimerRef.current && clearTimeout(refreshTimerRef.current);
|
|
27393
27169
|
};
|
|
27394
27170
|
}, []);
|
|
27395
|
-
return
|
|
27396
|
-
ponyfill:
|
|
27171
|
+
return ponyfillCreated && ponyfillRef.current ? /*#__PURE__*/ (0, $bZRJW$jsx)((0, $0b8e5d756ffed1ac$export$2e2bcd8739ae039), {
|
|
27172
|
+
ponyfill: ponyfillRef.current,
|
|
27397
27173
|
isRetorikNews: isRetorikNews
|
|
27398
27174
|
}) : /*#__PURE__*/ (0, $bZRJW$jsx)((0, $bZRJW$react).Fragment, {});
|
|
27399
27175
|
};
|
|
@@ -27816,8 +27592,7 @@ const $9ab097b39dd0663e$var$typingTimer = 2000;
|
|
|
27816
27592
|
const $9ab097b39dd0663e$var$SendTypingIndicator = ({ isRetorikNews: isRetorikNews })=>{
|
|
27817
27593
|
const speaking = (0, $i1rfm.useSpeechStore)((state)=>state.speaking);
|
|
27818
27594
|
const streamingQueue = (0, $i1rfm.useSpeechStore)((state)=>state.streamingQueue);
|
|
27819
|
-
const
|
|
27820
|
-
const lastRecognitionInterim = (0, $i1rfm.useSpeechStore)((state)=>state.lastRecognitionInterim);
|
|
27595
|
+
const activeRecognitionState = (0, $i1rfm.useSpeechStore)((state)=>state.activeRecognitionState);
|
|
27821
27596
|
const route = (0, $1Qww3.useViewStore)((state)=>state.route);
|
|
27822
27597
|
const loaderClosed = (0, $1x02c.useRetorikStore)((state)=>state.loaderClosed);
|
|
27823
27598
|
const appAvailable = (0, $1x02c.useRetorikStore)((state)=>state.appAvailable);
|
|
@@ -27830,17 +27605,18 @@ const $9ab097b39dd0663e$var$SendTypingIndicator = ({ isRetorikNews: isRetorikNew
|
|
|
27830
27605
|
const sendTyping = (0, $aNpqK.useDirectlineStore)((state)=>state.actions.sendTyping);
|
|
27831
27606
|
const dataRef = (0, $bZRJW$useRef)(false);
|
|
27832
27607
|
(0, $bZRJW$useEffect)(()=>{
|
|
27608
|
+
// Don't send typing activity when we are receiving streaming events
|
|
27609
|
+
const isReceivingStreamingData = !!streamingQueue.length && !!streamingQueue.find((activity)=>activity.name?.toLowerCase() === 'davi.streammessageactivity') && !streamingQueue.find((activity)=>activity.value?.streamingCount);
|
|
27833
27610
|
dataRef.current = !isWaitingForResponse && // Don't send typing activity when we are receiving streaming events
|
|
27834
|
-
!
|
|
27611
|
+
!isReceivingStreamingData && (!loaderClosed || activeRecognitionState !== (0, $4ucVo.RecognitionState).Closed || userIsTyping || userIsSwiping || speaking || currentSubView !== (0, $4ucVo.CurrentSubView).none || route === (0, $4ucVo.Routes).News || retorikEvent === (0, $4ucVo.RetorikEvent).DetailViewOpen || listStatus === (0, $4ucVo.ListStatus).opened);
|
|
27835
27612
|
}, [
|
|
27836
27613
|
appAvailable,
|
|
27837
27614
|
loaderClosed,
|
|
27838
|
-
|
|
27615
|
+
activeRecognitionState,
|
|
27839
27616
|
userIsTyping,
|
|
27840
27617
|
userIsSwiping,
|
|
27841
27618
|
speaking,
|
|
27842
27619
|
streamingQueue,
|
|
27843
|
-
streamingQueueFullLength,
|
|
27844
27620
|
currentSubView,
|
|
27845
27621
|
route,
|
|
27846
27622
|
retorikEvent,
|