@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.js
CHANGED
|
@@ -103,7 +103,6 @@ const $2793f2455cec0982$var$initialState = {
|
|
|
103
103
|
retorikEvent: undefined,
|
|
104
104
|
displayAgent: true,
|
|
105
105
|
activityToSend: undefined,
|
|
106
|
-
currentNewsActivity: undefined,
|
|
107
106
|
retorikNewsEnded: false,
|
|
108
107
|
userIsTyping: false,
|
|
109
108
|
userIsSwiping: false,
|
|
@@ -189,11 +188,6 @@ const $2793f2455cec0982$var$createUtilsStore = ()=>(0, $dWhh5$zustand.createStor
|
|
|
189
188
|
activityToSend: value
|
|
190
189
|
});
|
|
191
190
|
},
|
|
192
|
-
setCurrentNewsActivity: (value)=>{
|
|
193
|
-
set({
|
|
194
|
-
currentNewsActivity: value
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
191
|
setRetorikNewsEnded: (value)=>{
|
|
198
192
|
set({
|
|
199
193
|
retorikNewsEnded: value
|
|
@@ -351,6 +345,7 @@ $parcel$export(module.exports, "Source3DEngine", () => $71c613e2e831c34c$export$
|
|
|
351
345
|
$parcel$export(module.exports, "UIPart", () => $71c613e2e831c34c$export$63fc5f52b5b4da1e);
|
|
352
346
|
$parcel$export(module.exports, "TextFrom", () => $71c613e2e831c34c$export$b685c7d489184507);
|
|
353
347
|
$parcel$export(module.exports, "Theme", () => $71c613e2e831c34c$export$14faa19a0f3bbeb2);
|
|
348
|
+
$parcel$export(module.exports, "TraceType", () => $71c613e2e831c34c$export$d4b4ca0ba30ae29c);
|
|
354
349
|
var $71c613e2e831c34c$export$e4a712fff93fb00f = /*#__PURE__*/ function(ActionType) {
|
|
355
350
|
ActionType["message"] = "message";
|
|
356
351
|
ActionType["event"] = "event";
|
|
@@ -576,6 +571,12 @@ var $71c613e2e831c34c$export$14faa19a0f3bbeb2 = /*#__PURE__*/ function(Theme) {
|
|
|
576
571
|
Theme["auto"] = "auto";
|
|
577
572
|
return Theme;
|
|
578
573
|
}($71c613e2e831c34c$export$14faa19a0f3bbeb2 || {});
|
|
574
|
+
var $71c613e2e831c34c$export$d4b4ca0ba30ae29c = /*#__PURE__*/ function(TraceType) {
|
|
575
|
+
TraceType["message"] = "directlineMessage";
|
|
576
|
+
TraceType["utteranceStart"] = "utteranceStart";
|
|
577
|
+
TraceType["utteranceEnd"] = "utteranceEnd";
|
|
578
|
+
return TraceType;
|
|
579
|
+
}($71c613e2e831c34c$export$d4b4ca0ba30ae29c || {});
|
|
579
580
|
|
|
580
581
|
});
|
|
581
582
|
|
|
@@ -2078,9 +2079,6 @@ const $df401eb9a10f9e0e$var$initialState = {
|
|
|
2078
2079
|
visemeData: [],
|
|
2079
2080
|
singleVisemeAdded: null,
|
|
2080
2081
|
multiVisemesAdded: [],
|
|
2081
|
-
currentReplyToId: undefined,
|
|
2082
|
-
currentPlaying: undefined,
|
|
2083
|
-
endedActivities: [],
|
|
2084
2082
|
currentOrLastPlayedActivity: undefined,
|
|
2085
2083
|
isMicrophoneAllowed: false,
|
|
2086
2084
|
showMicrophoneModal: false,
|
|
@@ -2089,9 +2087,6 @@ const $df401eb9a10f9e0e$var$initialState = {
|
|
|
2089
2087
|
lastRecognitionInterim: '',
|
|
2090
2088
|
streamingReplyToId: null,
|
|
2091
2089
|
streamingQueue: [],
|
|
2092
|
-
streamingQueueForText: [],
|
|
2093
|
-
currentStreaming: null,
|
|
2094
|
-
streamingQueueFullLength: 0,
|
|
2095
2090
|
streamingReplyToIdToIgnore: null,
|
|
2096
2091
|
speechRecognitionDynamicGrammars: [],
|
|
2097
2092
|
externalTextToSpeech: undefined
|
|
@@ -2228,22 +2223,6 @@ const $df401eb9a10f9e0e$var$createSpeechStore = (setRetorikEvent, getListStatus,
|
|
|
2228
2223
|
if (getListStatus() !== (0, $7WHA7.ListStatus).opened) setListStatus((0, $7WHA7.ListStatus).available);
|
|
2229
2224
|
}
|
|
2230
2225
|
},
|
|
2231
|
-
setCurrentReplyToId: (value)=>{
|
|
2232
|
-
set({
|
|
2233
|
-
currentReplyToId: value
|
|
2234
|
-
});
|
|
2235
|
-
},
|
|
2236
|
-
setCurrentPlaying: (value)=>{
|
|
2237
|
-
set({
|
|
2238
|
-
currentPlaying: value
|
|
2239
|
-
});
|
|
2240
|
-
value && get().actions.setCurrentOrLastPlayedActivity(value);
|
|
2241
|
-
},
|
|
2242
|
-
setEndedActivities: (value)=>{
|
|
2243
|
-
set({
|
|
2244
|
-
endedActivities: value
|
|
2245
|
-
});
|
|
2246
|
-
},
|
|
2247
2226
|
setIsMicrophoneAllowed: (value)=>{
|
|
2248
2227
|
set({
|
|
2249
2228
|
isMicrophoneAllowed: value
|
|
@@ -2305,72 +2284,45 @@ const $df401eb9a10f9e0e$var$createSpeechStore = (setRetorikEvent, getListStatus,
|
|
|
2305
2284
|
streamingReplyToId: value
|
|
2306
2285
|
});
|
|
2307
2286
|
},
|
|
2308
|
-
setStreamingQueue: (value)=>{
|
|
2309
|
-
set({
|
|
2310
|
-
streamingQueue: value,
|
|
2311
|
-
streamingQueueForText: value
|
|
2312
|
-
});
|
|
2313
|
-
},
|
|
2314
2287
|
addToStreamingQueue: (value)=>{
|
|
2315
|
-
if (value.replyToId
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
}
|
|
2288
|
+
if (value.replyToId) {
|
|
2289
|
+
if (value.replyToId !== get().streamingReplyToIdToIgnore) {
|
|
2290
|
+
// Set replyToId and new queue if replyToId is different from the current one
|
|
2291
|
+
if (get().streamingReplyToId !== value.replyToId) set({
|
|
2292
|
+
streamingReplyToId: value.replyToId,
|
|
2293
|
+
streamingQueue: [
|
|
2294
|
+
value
|
|
2295
|
+
]
|
|
2296
|
+
});
|
|
2297
|
+
else set({
|
|
2298
|
+
streamingQueue: [
|
|
2299
|
+
...get().streamingQueue,
|
|
2300
|
+
value
|
|
2301
|
+
]
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
} else set({
|
|
2305
|
+
streamingQueue: [
|
|
2306
|
+
...get().streamingQueue,
|
|
2307
|
+
value
|
|
2308
|
+
]
|
|
2309
|
+
});
|
|
2338
2310
|
},
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
streamingQueue: tempStreamingQueue
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2311
|
+
// 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)
|
|
2312
|
+
removeFirstFromStreamingQueue: (twice)=>{
|
|
2313
|
+
set((state)=>({
|
|
2314
|
+
streamingQueue: state.streamingQueue.slice(twice ? 2 : 1)
|
|
2315
|
+
}));
|
|
2347
2316
|
},
|
|
2348
2317
|
killCurrentStreaming: ()=>{
|
|
2349
2318
|
set({
|
|
2350
|
-
|
|
2351
|
-
streamingQueue: []
|
|
2352
|
-
streamingQueueForText: [],
|
|
2353
|
-
currentStreaming: null,
|
|
2354
|
-
streamingQueueFullLength: 0,
|
|
2355
|
-
streamingReplyToIdToIgnore: get().streamingReplyToId
|
|
2319
|
+
streamingReplyToIdToIgnore: get().streamingReplyToId,
|
|
2320
|
+
streamingQueue: []
|
|
2356
2321
|
});
|
|
2357
2322
|
},
|
|
2358
2323
|
checkActivityReplyToId: (replyToId)=>{
|
|
2359
2324
|
get().streamingReplyToId !== replyToId && get().actions.killCurrentStreaming();
|
|
2360
2325
|
},
|
|
2361
|
-
setCurrentStreaming: (value)=>{
|
|
2362
|
-
set({
|
|
2363
|
-
currentStreaming: value
|
|
2364
|
-
});
|
|
2365
|
-
},
|
|
2366
|
-
setStreamingQueueFullLength: (value, replyToId)=>{
|
|
2367
|
-
if (replyToId) replyToId === get().streamingReplyToId && set({
|
|
2368
|
-
streamingQueueFullLength: value
|
|
2369
|
-
});
|
|
2370
|
-
else set({
|
|
2371
|
-
streamingQueueFullLength: value
|
|
2372
|
-
});
|
|
2373
|
-
},
|
|
2374
2326
|
addSpeechRecognitionDynamicGrammar: (value)=>{
|
|
2375
2327
|
const currentGrammars = get().speechRecognitionDynamicGrammars;
|
|
2376
2328
|
// For each value, verifiy if it doesn't exist in the array yet
|
|
@@ -2790,7 +2742,7 @@ const $8fc061e3e1dc64cb$var$initialState = {
|
|
|
2790
2742
|
queueLock: false
|
|
2791
2743
|
};
|
|
2792
2744
|
const $8fc061e3e1dc64cb$var$regexDataCommand = /(\{data-command=")[\p{L}\p{N}\p{Po}\p{Pd}\p{Pc}\s\u0027\u2019]+("\})(<br\s\/>)?/gu;
|
|
2793
|
-
const $8fc061e3e1dc64cb$var$createActivityStore = (localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue,
|
|
2745
|
+
const $8fc061e3e1dc64cb$var$createActivityStore = (localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue, setMode, unlockClickedButton, setSubmitDelayBeforeSendingMessage, setIsWaitingForResponse, setSendBoxPlaceHolder)=>{
|
|
2794
2746
|
return (0, $dWhh5$zustand.createStore)((set, get)=>{
|
|
2795
2747
|
return {
|
|
2796
2748
|
...$8fc061e3e1dc64cb$var$initialState,
|
|
@@ -2855,7 +2807,7 @@ const $8fc061e3e1dc64cb$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2855
2807
|
currentActivity.type === 'message' ? await get().actions.processAddBotMessage(currentActivity) : await get().actions.processAddBotEvent(currentActivity);
|
|
2856
2808
|
// Remove the first element from the queue (the one that got processed above) and process the queue once again
|
|
2857
2809
|
set({
|
|
2858
|
-
queue: get().queue.slice(
|
|
2810
|
+
queue: get().queue.slice(1)
|
|
2859
2811
|
});
|
|
2860
2812
|
get().actions.processQueue();
|
|
2861
2813
|
} else set({
|
|
@@ -2863,12 +2815,11 @@ const $8fc061e3e1dc64cb$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2863
2815
|
});
|
|
2864
2816
|
},
|
|
2865
2817
|
processAddBotMessage: async (value)=>{
|
|
2866
|
-
var _value_value;
|
|
2867
2818
|
setCurrentId(undefined);
|
|
2868
2819
|
const processedActivity = await get().actions.processBotMessageActivity(value);
|
|
2869
|
-
// If this activity is the one concluding a streaming, let's set the amount of streams previously generated
|
|
2870
|
-
if (!get().retrievingConversation && ((_value_value = value.value) === null || _value_value === void 0 ? void 0 : _value_value.streamingCount)) setStreamingQueueFullLength(value.value.streamingCount, value.replyToId);
|
|
2871
2820
|
const tempActivity = get().retrievingConversation ? undefined : processedActivity;
|
|
2821
|
+
// Add this activity to the streaming queue if we are not in conversation retrieval process
|
|
2822
|
+
!get().retrievingConversation && addToStreamingQueue(processedActivity);
|
|
2872
2823
|
set({
|
|
2873
2824
|
activities: [
|
|
2874
2825
|
...get().activities,
|
|
@@ -2910,6 +2861,29 @@ const $8fc061e3e1dc64cb$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2910
2861
|
}
|
|
2911
2862
|
},
|
|
2912
2863
|
processAddBotEvent: async (value)=>{
|
|
2864
|
+
var _value_name, _value_text;
|
|
2865
|
+
const streamingMap = new Map(get().botStreamingActivities);
|
|
2866
|
+
// Deal with streaming activities
|
|
2867
|
+
if (((_value_name = value.name) === null || _value_name === void 0 ? void 0 : _value_name.toLowerCase()) === 'davi.streammessageactivity') // Add this activity to the streaming queue if we are not in conversation retrieval process
|
|
2868
|
+
{
|
|
2869
|
+
if (((_value_text = value.text) === null || _value_text === void 0 ? void 0 : _value_text.trim().length) && !get().retrievingConversation) {
|
|
2870
|
+
// Create speak field from the text one
|
|
2871
|
+
const processedText = (0, $pFs7y.processMarkdownAndSpeechMarkdown)(value.text, true);
|
|
2872
|
+
value.speak = processedText.text;
|
|
2873
|
+
value.htmlText = processedText.htmlText;
|
|
2874
|
+
addToStreamingQueue(value);
|
|
2875
|
+
// Set data in the Map for text display
|
|
2876
|
+
if (value.replyToId) {
|
|
2877
|
+
const currentStreamingData = streamingMap.get(value.replyToId);
|
|
2878
|
+
currentStreamingData ? streamingMap.set(value.replyToId, [
|
|
2879
|
+
...currentStreamingData,
|
|
2880
|
+
value
|
|
2881
|
+
]) : streamingMap.set(value.replyToId, [
|
|
2882
|
+
value
|
|
2883
|
+
]);
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2913
2887
|
set({
|
|
2914
2888
|
activities: [
|
|
2915
2889
|
...get().activities,
|
|
@@ -2927,38 +2901,16 @@ const $8fc061e3e1dc64cb$var$createActivityStore = (localeRef, isUsedOnBorneRef,
|
|
|
2927
2901
|
],
|
|
2928
2902
|
lastBotEventActivity: value,
|
|
2929
2903
|
lastEventActivity: value,
|
|
2904
|
+
botStreamingActivities: streamingMap,
|
|
2930
2905
|
watermark: get().watermark + 1
|
|
2931
2906
|
});
|
|
2932
2907
|
Promise.resolve();
|
|
2933
2908
|
},
|
|
2934
2909
|
addBotEvent: async (value)=>{
|
|
2935
2910
|
if (get().actions.checkCurrentConversationId(value.id)) {
|
|
2936
|
-
var _value_name
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
setIsWaitingForResponse(false);
|
|
2940
|
-
// Create speak field from the text one
|
|
2941
|
-
const processedText = (0, $pFs7y.processMarkdownAndSpeechMarkdown)(value.text, true);
|
|
2942
|
-
value.speak = processedText.text;
|
|
2943
|
-
value.htmlText = processedText.htmlText;
|
|
2944
|
-
addToStreamingQueue(value);
|
|
2945
|
-
if (value.replyToId) {
|
|
2946
|
-
const currentStreamingMap = new Map(get().botStreamingActivities);
|
|
2947
|
-
const currentStreamingData = currentStreamingMap.get(value.replyToId);
|
|
2948
|
-
currentStreamingData ? currentStreamingMap.set(value.replyToId, [
|
|
2949
|
-
...currentStreamingData,
|
|
2950
|
-
value
|
|
2951
|
-
]) : currentStreamingMap.set(value.replyToId, [
|
|
2952
|
-
value
|
|
2953
|
-
]);
|
|
2954
|
-
set({
|
|
2955
|
-
botStreamingActivities: currentStreamingMap,
|
|
2956
|
-
watermark: get().watermark + 1
|
|
2957
|
-
});
|
|
2958
|
-
}
|
|
2959
|
-
unlockClickedButton();
|
|
2960
|
-
}
|
|
2961
|
-
} else if (((_value_name1 = value.name) === null || _value_name1 === void 0 ? void 0 : _value_name1.toLowerCase()) === 'switchtotextmode') {
|
|
2911
|
+
var _value_name;
|
|
2912
|
+
//
|
|
2913
|
+
if (((_value_name = value.name) === null || _value_name === void 0 ? void 0 : _value_name.toLowerCase()) === 'switchtotextmode') {
|
|
2962
2914
|
setMode((0, $7WHA7.Mode).text);
|
|
2963
2915
|
set({
|
|
2964
2916
|
watermark: get().watermark + 1
|
|
@@ -3233,10 +3185,10 @@ const $8fc061e3e1dc64cb$var$ActivityProvider = ({ children: children })=>{
|
|
|
3233
3185
|
const isUsedOnBorneRef = (0, $dWhh5$react.useRef)(false);
|
|
3234
3186
|
const inputHintBehaviourRef = (0, $dWhh5$react.useRef)(undefined);
|
|
3235
3187
|
const { setCurrentId: setCurrentId, setRestoreInputsState: setRestoreInputsState } = (0, $8AvjS.useAdaptiveCardStore)((state)=>state.actions);
|
|
3236
|
-
const { addToStreamingQueue: addToStreamingQueue,
|
|
3188
|
+
const { addToStreamingQueue: addToStreamingQueue, setMode: setMode } = (0, $jgaO0.useSpeechStore)((state)=>state.actions);
|
|
3237
3189
|
const unlockClickedButton = (0, $7eio0.useUtilsStore)((state)=>state.actions.unlockClickedButton);
|
|
3238
3190
|
const { setSubmitDelayBeforeSendingMessage: setSubmitDelayBeforeSendingMessage, setIsWaitingForResponse: setIsWaitingForResponse, setSendBoxPlaceHolder: setSendBoxPlaceHolder } = (0, $6EkQS.useRetorikStore)((state)=>state.actions);
|
|
3239
|
-
const [store] = (0, $dWhh5$react.useState)(()=>$8fc061e3e1dc64cb$var$createActivityStore(localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue,
|
|
3191
|
+
const [store] = (0, $dWhh5$react.useState)(()=>$8fc061e3e1dc64cb$var$createActivityStore(localeRef, isUsedOnBorneRef, inputHintBehaviourRef, setCurrentId, setRestoreInputsState, addToStreamingQueue, setMode, unlockClickedButton, setSubmitDelayBeforeSendingMessage, setIsWaitingForResponse, setSendBoxPlaceHolder));
|
|
3240
3192
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
3241
3193
|
localeRef.current = locale;
|
|
3242
3194
|
}, [
|
|
@@ -4164,7 +4116,7 @@ const $328a7f03b0982320$var$createDirectlineStore = (modeRef, recognitionStateRe
|
|
|
4164
4116
|
if (get().actions.checkIfHandlerAbortsActivity((0, $3DDGn.LegacyDirectLineActivityType).SEND_MESSAGE, tempActivity)) return;
|
|
4165
4117
|
(_get_directLine = get().directLine) === null || _get_directLine === void 0 ? void 0 : _get_directLine.postActivity(tempActivity).subscribe();
|
|
4166
4118
|
},
|
|
4167
|
-
sendEvent: (name, value)=>{
|
|
4119
|
+
sendEvent: (name, value, callback)=>{
|
|
4168
4120
|
var _get_directLine;
|
|
4169
4121
|
if (get().conversationPaused) return;
|
|
4170
4122
|
!name.toLowerCase().includes('davi.closewindow') && !$328a7f03b0982320$var$eventsWithoutCancel.includes(name.toLowerCase()) && get().actions.checkMicrophoneAndCancel();
|
|
@@ -4184,7 +4136,10 @@ const $328a7f03b0982320$var$createDirectlineStore = (modeRef, recognitionStateRe
|
|
|
4184
4136
|
// Check if the event should be stopped in the external activity handler if there is one
|
|
4185
4137
|
if (get().actions.checkIfHandlerAbortsActivity((0, $3DDGn.LegacyDirectLineActivityType).POST_ACTIVITY, tempEvent)) return;
|
|
4186
4138
|
if (get().actions.checkIfHandlerAbortsActivity((0, $3DDGn.LegacyDirectLineActivityType).SEND_EVENT, tempEvent)) return;
|
|
4187
|
-
(_get_directLine = get().directLine) === null || _get_directLine === void 0 ? void 0 : _get_directLine.postActivity(tempEvent).subscribe(
|
|
4139
|
+
(_get_directLine = get().directLine) === null || _get_directLine === void 0 ? void 0 : _get_directLine.postActivity(tempEvent).subscribe({
|
|
4140
|
+
error: (error)=>console.log('Retorik Framework > error while sending event : ', error),
|
|
4141
|
+
complete: ()=>callback === null || callback === void 0 ? void 0 : callback()
|
|
4142
|
+
});
|
|
4188
4143
|
},
|
|
4189
4144
|
sendTyping: ()=>{
|
|
4190
4145
|
var _get_directLine;
|
|
@@ -4392,7 +4347,7 @@ var $c8770452d727244a$export$2e2bcd8739ae039 = $c8770452d727244a$var$activityMid
|
|
|
4392
4347
|
});
|
|
4393
4348
|
|
|
4394
4349
|
parcelRegister("93cl9", function(module, exports) {
|
|
4395
|
-
module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"3.2.
|
|
4350
|
+
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}}");
|
|
4396
4351
|
|
|
4397
4352
|
});
|
|
4398
4353
|
|
|
@@ -5506,23 +5461,24 @@ const $071bb34c9db044ce$var$SendActivityEventListener = ({ isRetorikNews: isReto
|
|
|
5506
5461
|
document.removeEventListener('retorikSetVisibility', handleEvents);
|
|
5507
5462
|
};
|
|
5508
5463
|
}, []);
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5464
|
+
/**
|
|
5465
|
+
* Send mandatory events : setUser to start conversation, Davi.GDPRConsent for GDPR module
|
|
5466
|
+
*/ const sendMandatoryEvents = async ()=>{
|
|
5467
|
+
sendEvent('Davi.GDPRConsent', {
|
|
5468
|
+
userConsent: userConsent
|
|
5469
|
+
}, ()=>sendEvent('setUser', {
|
|
5515
5470
|
user: {
|
|
5516
5471
|
...userData,
|
|
5517
5472
|
gdprConsent: true
|
|
5518
5473
|
},
|
|
5519
5474
|
skipWelcome: !!skipWelcome
|
|
5520
|
-
});
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5475
|
+
}));
|
|
5476
|
+
};
|
|
5477
|
+
(0, $dWhh5$react.useEffect)(()=>{
|
|
5478
|
+
if (isRetorikNews || hasConversationCookie) setUserAlreadySet(true);
|
|
5479
|
+
else if (!userAlreadySet && appAvailable && !displayGDPR && characterLoaded) {
|
|
5480
|
+
setUserAlreadySet(true);
|
|
5481
|
+
sendMandatoryEvents();
|
|
5526
5482
|
}
|
|
5527
5483
|
}, [
|
|
5528
5484
|
appAvailable,
|
|
@@ -7738,8 +7694,7 @@ const $7a4829033e41af4d$var$List = ({ activity: activity, onClose: onClose })=>{
|
|
|
7738
7694
|
if (timerRef) {
|
|
7739
7695
|
timerRef.current && clearTimeout(timerRef.current);
|
|
7740
7696
|
timerRef.current = setTimeout(()=>{
|
|
7741
|
-
sendEvent('Davi.CloseWindow', null);
|
|
7742
|
-
sendEvent('Davi.CloseWindowList', null);
|
|
7697
|
+
sendEvent('Davi.CloseWindow', null, ()=>sendEvent('Davi.CloseWindowList', null));
|
|
7743
7698
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
7744
7699
|
setContent(undefined);
|
|
7745
7700
|
}, $7a4829033e41af4d$var$springLeaveDuration);
|
|
@@ -7799,7 +7754,6 @@ const $7a4829033e41af4d$var$List = ({ activity: activity, onClose: onClose })=>{
|
|
|
7799
7754
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
7800
7755
|
handleOpen();
|
|
7801
7756
|
return ()=>{
|
|
7802
|
-
console.log('in return');
|
|
7803
7757
|
setListStatus((0, $7WHA7.ListStatus).closed);
|
|
7804
7758
|
(timerRef === null || timerRef === void 0 ? void 0 : timerRef.current) && clearTimeout(timerRef.current);
|
|
7805
7759
|
};
|
|
@@ -14326,7 +14280,7 @@ const $c0f9a707e7db7f07$var$Attachments = ({ activity: activity, display: displa
|
|
|
14326
14280
|
return attachments.length > 1 ? (0, $7WHA7.Displays).carousel : (0, $7WHA7.Displays).normal;
|
|
14327
14281
|
case 'grid':
|
|
14328
14282
|
// Grid display is not available in mobile mode
|
|
14329
|
-
return isMobile ?
|
|
14283
|
+
return isMobile ? (0, $7WHA7.Displays).carouselgrid : (0, $7WHA7.Displays).grid;
|
|
14330
14284
|
}
|
|
14331
14285
|
// If we have no attachment layout but attachment(s), we use none display by default is there are several attachments
|
|
14332
14286
|
return attachments.length > 1 ? (0, $7WHA7.Displays).none : (0, $7WHA7.Displays).normal;
|
|
@@ -14523,7 +14477,7 @@ const $31d1ee7383d825e1$var$CarouselContainer = ({ title: title, attachments: at
|
|
|
14523
14477
|
const carouselRef = (0, $dWhh5$react.useRef)(null);
|
|
14524
14478
|
(0, $dWhh5$react.useLayoutEffect)(()=>{
|
|
14525
14479
|
setHeight(0);
|
|
14526
|
-
if (attachments.length
|
|
14480
|
+
if (attachments.length) {
|
|
14527
14481
|
timerRef.current && clearTimeout(timerRef.current);
|
|
14528
14482
|
timerRef.current = setTimeout(()=>{
|
|
14529
14483
|
carouselRef.current && setHeight(carouselRef.current.clientHeight);
|
|
@@ -14692,7 +14646,7 @@ const $872024d5c381e99a$var$Carousel = /*#__PURE__*/ (0, ($parcel$interopDefault
|
|
|
14692
14646
|
transform: 'translateX(100%)'
|
|
14693
14647
|
},
|
|
14694
14648
|
to: {
|
|
14695
|
-
transform:
|
|
14649
|
+
transform: `translateX(${nbCards === 1 ? '25%' : '0%'})`
|
|
14696
14650
|
},
|
|
14697
14651
|
config: {
|
|
14698
14652
|
duration: $872024d5c381e99a$var$springEnterDuration,
|
|
@@ -14700,7 +14654,8 @@ const $872024d5c381e99a$var$Carousel = /*#__PURE__*/ (0, ($parcel$interopDefault
|
|
|
14700
14654
|
}
|
|
14701
14655
|
});
|
|
14702
14656
|
}, [
|
|
14703
|
-
draft
|
|
14657
|
+
draft,
|
|
14658
|
+
nbCards
|
|
14704
14659
|
]);
|
|
14705
14660
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
14706
14661
|
handleClick(forcedCurrentCard || 0);
|
|
@@ -14958,7 +14913,7 @@ const $872024d5c381e99a$var$Carousel = /*#__PURE__*/ (0, ($parcel$interopDefault
|
|
|
14958
14913
|
})
|
|
14959
14914
|
})
|
|
14960
14915
|
}),
|
|
14961
|
-
!draft && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
|
|
14916
|
+
!draft && nbCards > 1 && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
|
|
14962
14917
|
className: "rf-w-full rf-py-3 rf-flex rf-flex-row rf-justify-center rf-gap-1",
|
|
14963
14918
|
children: (0, ($parcel$interopDefault($dWhh5$react))).Children.map(children, (_child, key)=>{
|
|
14964
14919
|
return /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("button", {
|
|
@@ -15366,17 +15321,17 @@ var $f0e30ad3081b61d6$export$2e2bcd8739ae039 = $f0e30ad3081b61d6$var$Grid;
|
|
|
15366
15321
|
|
|
15367
15322
|
|
|
15368
15323
|
parcelRegister("daT1M", function(module, exports) {
|
|
15369
|
-
module.exports = Promise.resolve(require("./HistoryList.
|
|
15324
|
+
module.exports = Promise.resolve(require("./HistoryList.4c303dc6.js")).then(()=>parcelRequire('1TROp'));
|
|
15370
15325
|
|
|
15371
15326
|
});
|
|
15372
15327
|
|
|
15373
15328
|
parcelRegister("8A8vC", function(module, exports) {
|
|
15374
|
-
module.exports = Promise.resolve(require("./LanguageChoice.
|
|
15329
|
+
module.exports = Promise.resolve(require("./LanguageChoice.ff0cd04c.js")).then(()=>parcelRequire('cMcsq'));
|
|
15375
15330
|
|
|
15376
15331
|
});
|
|
15377
15332
|
|
|
15378
15333
|
parcelRegister("ahTaB", function(module, exports) {
|
|
15379
|
-
module.exports = Promise.resolve(require("./AttachmentDetail.
|
|
15334
|
+
module.exports = Promise.resolve(require("./AttachmentDetail.cfd86776.js")).then(()=>parcelRequire('27nhc'));
|
|
15380
15335
|
|
|
15381
15336
|
});
|
|
15382
15337
|
|
|
@@ -15386,17 +15341,17 @@ module.exports = Promise.resolve(require("./FullScreenImage.9a9b978e.js")).then(
|
|
|
15386
15341
|
});
|
|
15387
15342
|
|
|
15388
15343
|
parcelRegister("jQXZd", function(module, exports) {
|
|
15389
|
-
module.exports = Promise.resolve(require("./Weather.
|
|
15344
|
+
module.exports = Promise.resolve(require("./Weather.99917b66.js")).then(()=>parcelRequire('j5z2A'));
|
|
15390
15345
|
|
|
15391
15346
|
});
|
|
15392
15347
|
|
|
15393
15348
|
parcelRegister("kVj24", function(module, exports) {
|
|
15394
|
-
module.exports = Promise.resolve(require("./CustomView.
|
|
15349
|
+
module.exports = Promise.resolve(require("./CustomView.ba7af9b6.js")).then(()=>parcelRequire('h8y4X'));
|
|
15395
15350
|
|
|
15396
15351
|
});
|
|
15397
15352
|
|
|
15398
15353
|
parcelRegister("2J06a", function(module, exports) {
|
|
15399
|
-
module.exports = Promise.resolve(require("./Emergency.
|
|
15354
|
+
module.exports = Promise.resolve(require("./Emergency.897ee3c7.js")).then(()=>parcelRequire('5Osom'));
|
|
15400
15355
|
|
|
15401
15356
|
});
|
|
15402
15357
|
|
|
@@ -17183,6 +17138,11 @@ const $b8818a8d75b2cc14$var$MicrophoneTextBubble = ({ showLoader: showLoader })=
|
|
|
17183
17138
|
const [text, setText] = (0, $dWhh5$react.useState)();
|
|
17184
17139
|
const [textUndefined, setTextUndefined] = (0, $dWhh5$react.useState)(false);
|
|
17185
17140
|
const timerRef = (0, $dWhh5$react.useRef)(null);
|
|
17141
|
+
(0, $dWhh5$react.useEffect)(()=>{
|
|
17142
|
+
return ()=>{
|
|
17143
|
+
timerRef.current && clearTimeout(timerRef.current);
|
|
17144
|
+
};
|
|
17145
|
+
}, []);
|
|
17186
17146
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
17187
17147
|
setTextUndefined(speaking || showLoader || !botAnswerEnded || currentSubView !== (0, $7WHA7.CurrentSubView).none || dashboardOpened || retorikEvent === (0, $7WHA7.RetorikEvent).DetailViewOpen || listStatus === (0, $7WHA7.ListStatus).opened);
|
|
17188
17148
|
}, [
|
|
@@ -17212,8 +17172,12 @@ const $b8818a8d75b2cc14$var$MicrophoneTextBubble = ({ showLoader: showLoader })=
|
|
|
17212
17172
|
setText(isMobile || isLandscape && lastRecognitionInterim ? undefined : translation.microphone.listening);
|
|
17213
17173
|
break;
|
|
17214
17174
|
case (0, $7WHA7.RecognitionState).Closed:
|
|
17215
|
-
|
|
17216
|
-
|
|
17175
|
+
let text = undefined;
|
|
17176
|
+
if (!textUndefined) text = useContinuousRecognition ? `<p>${translation.microphone.trigger}${isMobile ? ' ' : '<br />'}<strong>\xab ${agentData === null || agentData === void 0 ? void 0 : agentData.name} \xbb</strong></p>` : `<p>${translation.microphone.triggerwithoutname}</p>`;
|
|
17177
|
+
// Show the button only 1.5s after, to prevents it from appearing à fraction of second between several texts
|
|
17178
|
+
timerRef.current = setTimeout(()=>{
|
|
17179
|
+
setText(text);
|
|
17180
|
+
}, 1500);
|
|
17217
17181
|
break;
|
|
17218
17182
|
case (0, $7WHA7.RecognitionState).Initializing:
|
|
17219
17183
|
case (0, $7WHA7.RecognitionState).Closing:
|
|
@@ -18865,7 +18829,7 @@ var $341aa389b3b9926d$export$2e2bcd8739ae039 = $341aa389b3b9926d$var$DashboardIt
|
|
|
18865
18829
|
|
|
18866
18830
|
|
|
18867
18831
|
parcelRegister("ffoK4", function(module, exports) {
|
|
18868
|
-
module.exports = Promise.resolve(require("./NewsContainer.
|
|
18832
|
+
module.exports = Promise.resolve(require("./NewsContainer.5e80336b.js")).then(()=>parcelRequire('dKdsa'));
|
|
18869
18833
|
|
|
18870
18834
|
});
|
|
18871
18835
|
|
|
@@ -22520,7 +22484,6 @@ const $85d8b0d1ec40dae5$export$6108075486421829 = ()=>{
|
|
|
22520
22484
|
|
|
22521
22485
|
|
|
22522
22486
|
|
|
22523
|
-
|
|
22524
22487
|
var $6EkQS = parcelRequire("6EkQS");
|
|
22525
22488
|
|
|
22526
22489
|
var $6QoTL = parcelRequire("6QoTL");
|
|
@@ -22529,6 +22492,8 @@ var $e53vj = parcelRequire("e53vj");
|
|
|
22529
22492
|
|
|
22530
22493
|
var $7sZDv = parcelRequire("7sZDv");
|
|
22531
22494
|
|
|
22495
|
+
var $7WHA7 = parcelRequire("7WHA7");
|
|
22496
|
+
|
|
22532
22497
|
var $93cl9 = parcelRequire("93cl9");
|
|
22533
22498
|
const $6be7f5aa73e32bf5$var$TelemetryContextDefaultValues = {
|
|
22534
22499
|
enabled: true,
|
|
@@ -22542,19 +22507,41 @@ function $6be7f5aa73e32bf5$export$a15d15518a3ec33d() {
|
|
|
22542
22507
|
}
|
|
22543
22508
|
function $6be7f5aa73e32bf5$export$bb3ea6dd2428edb6({ enabled: enabled, children: children }) {
|
|
22544
22509
|
const userId = (0, $6QoTL.useDirectlineStore)((state)=>state.userId);
|
|
22510
|
+
const conversationId = (0, $e53vj.useActivityStore)((state)=>state.conversationId);
|
|
22545
22511
|
const addressData = (0, $6EkQS.useRetorikStore)((state)=>state.addressData);
|
|
22546
22512
|
const lastActivity = (0, $e53vj.useActivityStore)((state)=>state.lastActivity);
|
|
22547
22513
|
const botStreamingActivities = (0, $e53vj.useActivityStore)((state)=>state.botStreamingActivities);
|
|
22548
|
-
const
|
|
22514
|
+
const lastUserActivityRef = (0, $dWhh5$react.useRef)(null);
|
|
22549
22515
|
const tracer = (0, $dWhh5$react.useMemo)(()=>{
|
|
22550
|
-
if (enabled && userId) {
|
|
22516
|
+
if (enabled && userId && conversationId) {
|
|
22551
22517
|
const exporter = new (0, $dWhh5$opentelemetryexportertraceotlphttp.OTLPTraceExporter)({
|
|
22552
22518
|
url: (0, $7sZDv.telemetryAddress),
|
|
22553
22519
|
headers: {},
|
|
22554
22520
|
concurrencyLimit: 1
|
|
22555
22521
|
});
|
|
22522
|
+
let serviceNamespace = '';
|
|
22523
|
+
switch(addressData.prefix){
|
|
22524
|
+
case 'dev':
|
|
22525
|
+
serviceNamespace = 'retorik-dev';
|
|
22526
|
+
break;
|
|
22527
|
+
case 'staging':
|
|
22528
|
+
case 'preview':
|
|
22529
|
+
serviceNamespace = 'retorik-preview';
|
|
22530
|
+
break;
|
|
22531
|
+
case 'experimental':
|
|
22532
|
+
serviceNamespace = 'retorik-experimental';
|
|
22533
|
+
break;
|
|
22534
|
+
default:
|
|
22535
|
+
serviceNamespace = 'retorik-prod';
|
|
22536
|
+
break;
|
|
22537
|
+
}
|
|
22538
|
+
// Create resource with custom parameters used globally in uptrace
|
|
22556
22539
|
const resource = (0, $dWhh5$opentelemetryresources.defaultResource)().merge((0, $dWhh5$opentelemetryresources.resourceFromAttributes)({
|
|
22557
|
-
[(0, $dWhh5$opentelemetrysemanticconventions.ATTR_SERVICE_NAME)]: 'retorik-framework'
|
|
22540
|
+
[(0, $dWhh5$opentelemetrysemanticconventions.ATTR_SERVICE_NAME)]: 'retorik-framework',
|
|
22541
|
+
['davi_retorik_activity_conversation_id']: conversationId,
|
|
22542
|
+
['service_namespace']: serviceNamespace,
|
|
22543
|
+
['retorik_framework_version']: (0, $93cl9.version),
|
|
22544
|
+
['user_id']: userId
|
|
22558
22545
|
}));
|
|
22559
22546
|
const processor = new (0, $dWhh5$opentelemetrysdktraceweb.BatchSpanProcessor)(exporter);
|
|
22560
22547
|
const provider = new (0, $dWhh5$opentelemetrysdktraceweb.WebTracerProvider)({
|
|
@@ -22567,28 +22554,8 @@ function $6be7f5aa73e32bf5$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22567
22554
|
// Add common attributes to each span for better tracing
|
|
22568
22555
|
(0, $dWhh5$opentelemetryinstrumentation.registerInstrumentations)({
|
|
22569
22556
|
instrumentations: [
|
|
22570
|
-
new (0, $dWhh5$opentelemetryinstrumentationfetch.FetchInstrumentation)(
|
|
22571
|
-
|
|
22572
|
-
...getCommonAttributes(),
|
|
22573
|
-
user_id: userId
|
|
22574
|
-
})
|
|
22575
|
-
}),
|
|
22576
|
-
new (0, $dWhh5$opentelemetryinstrumentationdocumentload.DocumentLoadInstrumentation)({
|
|
22577
|
-
applyCustomAttributesOnSpan: {
|
|
22578
|
-
documentLoad: (span)=>span.setAttributes({
|
|
22579
|
-
...getCommonAttributes(),
|
|
22580
|
-
user_id: userId
|
|
22581
|
-
}),
|
|
22582
|
-
documentFetch: (span)=>span.setAttributes({
|
|
22583
|
-
...getCommonAttributes(),
|
|
22584
|
-
user_id: userId
|
|
22585
|
-
}),
|
|
22586
|
-
resourceFetch: (span)=>span.setAttributes({
|
|
22587
|
-
...getCommonAttributes(),
|
|
22588
|
-
user_id: userId
|
|
22589
|
-
})
|
|
22590
|
-
}
|
|
22591
|
-
})
|
|
22557
|
+
new (0, $dWhh5$opentelemetryinstrumentationfetch.FetchInstrumentation)(),
|
|
22558
|
+
new (0, $dWhh5$opentelemetryinstrumentationdocumentload.DocumentLoadInstrumentation)()
|
|
22592
22559
|
]
|
|
22593
22560
|
});
|
|
22594
22561
|
return (0, ($parcel$interopDefault($dWhh5$opentelemetryapi))).trace.getTracer('retorik-framework');
|
|
@@ -22596,7 +22563,10 @@ function $6be7f5aa73e32bf5$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22596
22563
|
return undefined;
|
|
22597
22564
|
}, [
|
|
22598
22565
|
enabled,
|
|
22599
|
-
userId
|
|
22566
|
+
userId,
|
|
22567
|
+
conversationId,
|
|
22568
|
+
addressData,
|
|
22569
|
+
(0, $93cl9.version)
|
|
22600
22570
|
]);
|
|
22601
22571
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
22602
22572
|
if (lastActivity) lastActivity.from.role === 'user' ? handleUserActivity(lastActivity) : handleBotActivity(lastActivity);
|
|
@@ -22604,52 +22574,49 @@ function $6be7f5aa73e32bf5$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22604
22574
|
lastActivity
|
|
22605
22575
|
]);
|
|
22606
22576
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
22607
|
-
if (
|
|
22608
|
-
const temp = botStreamingActivities.get(
|
|
22577
|
+
if (lastUserActivityRef.current) {
|
|
22578
|
+
const temp = botStreamingActivities.get(lastUserActivityRef.current.id);
|
|
22609
22579
|
(temp === null || temp === void 0 ? void 0 : temp.length) === 1 && handleBotActivity(temp[0]);
|
|
22610
22580
|
}
|
|
22611
22581
|
}, [
|
|
22612
|
-
botStreamingActivities
|
|
22613
|
-
lastUserActivityData
|
|
22582
|
+
botStreamingActivities
|
|
22614
22583
|
]);
|
|
22615
|
-
const getCommonAttributes = ()=>{
|
|
22616
|
-
let tenant = '';
|
|
22617
|
-
if (addressData.tenant) tenant = addressData.prefix ? `${addressData.tenant} (${addressData.prefix})` : addressData.tenant;
|
|
22618
|
-
return {
|
|
22619
|
-
tenant: tenant,
|
|
22620
|
-
current_URL: window.location.toString(),
|
|
22621
|
-
os: `${0, $dWhh5$reactdevicedetect.osName} ${0, $dWhh5$reactdevicedetect.osVersion}`,
|
|
22622
|
-
browser: `${0, $dWhh5$reactdevicedetect.browserName} ${0, $dWhh5$reactdevicedetect.browserVersion}`,
|
|
22623
|
-
retorik_framework_version: (0, $93cl9.version)
|
|
22624
|
-
};
|
|
22625
|
-
};
|
|
22626
22584
|
const handleUserActivity = (activity)=>{
|
|
22627
22585
|
// Only handle message activites and event activities waiting for an answer, nothing for typing ones
|
|
22628
22586
|
if (activity.type === 'message' || activity.type === 'event' && !(0, $7sZDv.nonResponseInducingEvents).find((eventName)=>{
|
|
22629
22587
|
var _activity_name;
|
|
22630
22588
|
return (_activity_name = activity.name) === null || _activity_name === void 0 ? void 0 : _activity_name.toLowerCase().includes(eventName);
|
|
22631
|
-
}))
|
|
22589
|
+
})) lastUserActivityRef.current = {
|
|
22632
22590
|
id: activity.id,
|
|
22633
22591
|
time: Date.now()
|
|
22634
|
-
}
|
|
22592
|
+
};
|
|
22635
22593
|
};
|
|
22636
22594
|
const handleBotActivity = (activity)=>{
|
|
22637
22595
|
var _activity_name, _activity_label;
|
|
22638
22596
|
// Do nothing for bring-up messages and non-streaming events
|
|
22639
|
-
if (
|
|
22640
|
-
sendTrace(
|
|
22641
|
-
|
|
22597
|
+
if (lastUserActivityRef.current && (activity.type === 'message' || ((_activity_name = activity.name) === null || _activity_name === void 0 ? void 0 : _activity_name.toLocaleLowerCase()) === 'davi.streammessageactivity') && ((_activity_label = activity.label) === null || _activity_label === void 0 ? void 0 : _activity_label.toLowerCase()) !== 'davi.bringupmessage' && activity.replyToId === lastUserActivityRef.current.id) {
|
|
22598
|
+
sendTrace((0, $7WHA7.TraceType).message, lastUserActivityRef.current.time);
|
|
22599
|
+
lastUserActivityRef.current = null;
|
|
22642
22600
|
}
|
|
22643
22601
|
};
|
|
22644
|
-
const sendTrace = (
|
|
22645
|
-
if (tracer) {
|
|
22646
|
-
const
|
|
22647
|
-
|
|
22648
|
-
|
|
22602
|
+
const sendTrace = (type, data)=>{
|
|
22603
|
+
if (tracer && type) {
|
|
22604
|
+
const parameters = {};
|
|
22605
|
+
switch(type){
|
|
22606
|
+
case (0, $7WHA7.TraceType).message:
|
|
22607
|
+
parameters.startTime = data;
|
|
22608
|
+
break;
|
|
22609
|
+
case (0, $7WHA7.TraceType).utteranceStart:
|
|
22610
|
+
parameters.text = data;
|
|
22611
|
+
break;
|
|
22612
|
+
case (0, $7WHA7.TraceType).utteranceEnd:
|
|
22613
|
+
parameters.text = data;
|
|
22614
|
+
break;
|
|
22615
|
+
}
|
|
22616
|
+
const span = tracer.startSpan(type, parameters);
|
|
22649
22617
|
span.setStatus({
|
|
22650
22618
|
code: (0, $dWhh5$opentelemetryapi.SpanStatusCode).OK
|
|
22651
22619
|
});
|
|
22652
|
-
span.setAttributes(getCommonAttributes());
|
|
22653
22620
|
span.end();
|
|
22654
22621
|
}
|
|
22655
22622
|
};
|
|
@@ -22661,24 +22628,21 @@ function $6be7f5aa73e32bf5$export$bb3ea6dd2428edb6({ enabled: enabled, children:
|
|
|
22661
22628
|
code: (0, $dWhh5$opentelemetryapi.SpanStatusCode).ERROR,
|
|
22662
22629
|
message: `${error.message}`
|
|
22663
22630
|
});
|
|
22664
|
-
span.setAttributes(getCommonAttributes());
|
|
22665
22631
|
span.end();
|
|
22666
22632
|
}
|
|
22667
22633
|
};
|
|
22668
22634
|
const value = (0, $dWhh5$react.useMemo)(()=>({
|
|
22669
22635
|
enabled: enabled,
|
|
22670
22636
|
tracer: tracer,
|
|
22671
|
-
|
|
22672
|
-
|
|
22637
|
+
sendTrace: sendTrace,
|
|
22638
|
+
sendErrorTrace: sendErrorTrace
|
|
22673
22639
|
}), [
|
|
22674
22640
|
enabled,
|
|
22675
22641
|
tracer
|
|
22676
22642
|
]);
|
|
22677
|
-
return /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)(
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
children: children
|
|
22681
|
-
})
|
|
22643
|
+
return /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)($6be7f5aa73e32bf5$export$7b6b7bc4acb29126.Provider, {
|
|
22644
|
+
value: value,
|
|
22645
|
+
children: children
|
|
22682
22646
|
});
|
|
22683
22647
|
}
|
|
22684
22648
|
|
|
@@ -24057,11 +24021,19 @@ var $5f568a67e3f1c45c$export$2e2bcd8739ae039 = $5f568a67e3f1c45c$var$BotResponse
|
|
|
24057
24021
|
|
|
24058
24022
|
|
|
24059
24023
|
|
|
24024
|
+
|
|
24025
|
+
var $6EkQS = parcelRequire("6EkQS");
|
|
24060
24026
|
parcelRequire("60kUR");
|
|
24061
24027
|
var $6tJr6 = parcelRequire("6tJr6");
|
|
24062
24028
|
const $190fac2b3b90e52b$var$RetorikLogo = ()=>{
|
|
24063
|
-
|
|
24064
|
-
|
|
24029
|
+
const isUsedOnBorne = (0, $6EkQS.useRetorikStore)((state)=>state.configuration.isUsedOnBorne);
|
|
24030
|
+
return isUsedOnBorne ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
|
|
24031
|
+
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",
|
|
24032
|
+
children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $6tJr6.default), {
|
|
24033
|
+
className: "ltr:rf-ml-4 rtl:rf-mr-4 rf-mb-4 rf-h-14"
|
|
24034
|
+
})
|
|
24035
|
+
}) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("a", {
|
|
24036
|
+
href: "https://davi.ai",
|
|
24065
24037
|
title: "Retorik by Davi",
|
|
24066
24038
|
target: "_blank",
|
|
24067
24039
|
rel: "noreferrer",
|
|
@@ -24330,8 +24302,6 @@ var $6EkQS = parcelRequire("6EkQS");
|
|
|
24330
24302
|
|
|
24331
24303
|
var $e53vj = parcelRequire("e53vj");
|
|
24332
24304
|
|
|
24333
|
-
var $jgaO0 = parcelRequire("jgaO0");
|
|
24334
|
-
|
|
24335
24305
|
|
|
24336
24306
|
var $pFs7y = parcelRequire("pFs7y");
|
|
24337
24307
|
|
|
@@ -24448,8 +24418,6 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24448
24418
|
const endedActivities = (0, $e53vj.useActivityStore)((state)=>state.endedActivities);
|
|
24449
24419
|
const watermark = (0, $e53vj.useActivityStore)((state)=>state.watermark);
|
|
24450
24420
|
const forceMobileView = (0, $6EkQS.useRetorikStore)((state)=>state.configuration.forceMobileView);
|
|
24451
|
-
const cancel = (0, $jgaO0.useSpeechStore)((state)=>state.cancel);
|
|
24452
|
-
const addEndedActivity = (0, $e53vj.useActivityStore)((state)=>state.actions.addEndedActivity);
|
|
24453
24421
|
const [displayData, setDisplayData] = (0, $dWhh5$react.useState)([]);
|
|
24454
24422
|
const [currentDisplayDataIndex, setCurrentDisplayDataIndex] = (0, $dWhh5$react.useState)(0);
|
|
24455
24423
|
const [ended, setEnded] = (0, $dWhh5$react.useState)(!activities.length || endedActivities.includes((_activities_ = activities[activities.length - 1]) === null || _activities_ === void 0 ? void 0 : _activities_.id));
|
|
@@ -24465,7 +24433,7 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24465
24433
|
]);
|
|
24466
24434
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
24467
24435
|
if (isWaitingForResponse) {
|
|
24468
|
-
// Create temporary activity with the id of the
|
|
24436
|
+
// Create temporary activity with the id of the next one to prevent re-renders, in order to display waiting dots
|
|
24469
24437
|
const nextActivityId = `${currentQuestionId.slice(0, currentQuestionId.length - watermark.toString().length)}${watermark.toString()}`;
|
|
24470
24438
|
const tempActivity = {
|
|
24471
24439
|
id: nextActivityId,
|
|
@@ -24480,36 +24448,14 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24480
24448
|
activity: tempActivity,
|
|
24481
24449
|
type: (0, $7WHA7.DisplayDataTypes).text,
|
|
24482
24450
|
isWaitingDots: true,
|
|
24483
|
-
canBeEnded: true
|
|
24451
|
+
canBeEnded: true,
|
|
24452
|
+
isEnded: false
|
|
24484
24453
|
}
|
|
24485
24454
|
]);
|
|
24486
24455
|
}
|
|
24487
24456
|
}, [
|
|
24488
24457
|
isWaitingForResponse
|
|
24489
24458
|
]);
|
|
24490
|
-
(0, $dWhh5$react.useEffect)(()=>{
|
|
24491
|
-
if (cancel) {
|
|
24492
|
-
activities.forEach((activity)=>{
|
|
24493
|
-
addEndedActivity(activity.id);
|
|
24494
|
-
});
|
|
24495
|
-
displayData.forEach((data)=>{
|
|
24496
|
-
addEndedActivity(data.activity.id);
|
|
24497
|
-
});
|
|
24498
|
-
}
|
|
24499
|
-
}, [
|
|
24500
|
-
cancel
|
|
24501
|
-
]);
|
|
24502
|
-
(0, $dWhh5$react.useEffect)(()=>{
|
|
24503
|
-
// End all current activities on component unmount
|
|
24504
|
-
return ()=>{
|
|
24505
|
-
activitiesRef.current.forEach((activity)=>{
|
|
24506
|
-
addEndedActivity(activity.id);
|
|
24507
|
-
});
|
|
24508
|
-
displayDataRef.current.forEach((data)=>{
|
|
24509
|
-
addEndedActivity(data.activity.id);
|
|
24510
|
-
});
|
|
24511
|
-
};
|
|
24512
|
-
}, []);
|
|
24513
24459
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
24514
24460
|
activitiesRef.current = [
|
|
24515
24461
|
...activities
|
|
@@ -24522,7 +24468,7 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24522
24468
|
activities.forEach((activity, index)=>{
|
|
24523
24469
|
var _activity_attachments, _activity_name, _activity_value;
|
|
24524
24470
|
let splitTextDataToAdd = [];
|
|
24525
|
-
// Check the attachments, special case if this is the message activity after streaming : show attachments if the first streaming
|
|
24471
|
+
// Check the attachments, special case if this is the message activity after streaming : show attachments if the first streaming activity didn't have any
|
|
24526
24472
|
let attachments = [];
|
|
24527
24473
|
if ((_activity_attachments = activity.attachments) === null || _activity_attachments === void 0 ? void 0 : _activity_attachments.length) {
|
|
24528
24474
|
var _activity_name1, _activity_value1;
|
|
@@ -24532,14 +24478,16 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24532
24478
|
{
|
|
24533
24479
|
type: (0, $7WHA7.DisplayDataTypes).attachment,
|
|
24534
24480
|
activity: activity,
|
|
24535
|
-
canBeEnded: true
|
|
24481
|
+
canBeEnded: true,
|
|
24482
|
+
isEnded: true
|
|
24536
24483
|
}
|
|
24537
24484
|
];
|
|
24538
24485
|
} else if (!(((_activity_value1 = activity.value) === null || _activity_value1 === void 0 ? void 0 : _activity_value1.streamingCount) && streamingActivityHasAttachment) && !(0, $1a0bdae30bc87d45$export$7c55936a30618336)(activity)) attachments = [
|
|
24539
24486
|
{
|
|
24540
24487
|
type: (0, $7WHA7.DisplayDataTypes).attachment,
|
|
24541
24488
|
activity: activity,
|
|
24542
|
-
canBeEnded: true
|
|
24489
|
+
canBeEnded: true,
|
|
24490
|
+
isEnded: true
|
|
24543
24491
|
}
|
|
24544
24492
|
];
|
|
24545
24493
|
}
|
|
@@ -24558,14 +24506,20 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24558
24506
|
...currentFirstStreamingActivity,
|
|
24559
24507
|
htmlText: (0, $pFs7y.processMarkdownAndSpeechMarkdown)(streamingTexts.join(''), false).htmlText
|
|
24560
24508
|
},
|
|
24561
|
-
canBeEnded: false
|
|
24509
|
+
canBeEnded: false,
|
|
24510
|
+
isEnded: false
|
|
24562
24511
|
}
|
|
24563
24512
|
];
|
|
24564
24513
|
}
|
|
24565
24514
|
} else if ((_activity_value = activity.value) === null || _activity_value === void 0 ? void 0 : _activity_value.streamingCount) {
|
|
24566
24515
|
if (tempDisplayData.length) {
|
|
24567
24516
|
const lastStreamingIndex = tempDisplayData.findLastIndex((d)=>d.type === (0, $7WHA7.DisplayDataTypes).text);
|
|
24568
|
-
lastStreamingIndex !== -1
|
|
24517
|
+
if (lastStreamingIndex !== -1) {
|
|
24518
|
+
// Set canBeEnded for the previous streaming
|
|
24519
|
+
tempDisplayData[lastStreamingIndex].canBeEnded = true;
|
|
24520
|
+
// Set previous streaming ended if this activity is ended in speech synthesis
|
|
24521
|
+
tempDisplayData[lastStreamingIndex].isEnded = endedActivities.includes(activity.id);
|
|
24522
|
+
}
|
|
24569
24523
|
}
|
|
24570
24524
|
// Reset streaming data if the message containing all streaming data is received
|
|
24571
24525
|
currentFirstStreamingActivity = undefined;
|
|
@@ -24580,7 +24534,8 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24580
24534
|
{
|
|
24581
24535
|
type: (0, $7WHA7.DisplayDataTypes).text,
|
|
24582
24536
|
activity: activity,
|
|
24583
|
-
canBeEnded: true
|
|
24537
|
+
canBeEnded: true,
|
|
24538
|
+
isEnded: endedActivities.includes(activity.id)
|
|
24584
24539
|
}
|
|
24585
24540
|
];
|
|
24586
24541
|
}
|
|
@@ -24602,7 +24557,8 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24602
24557
|
}
|
|
24603
24558
|
}, [
|
|
24604
24559
|
currentQuestionId,
|
|
24605
|
-
activities.length
|
|
24560
|
+
activities.length,
|
|
24561
|
+
endedActivities
|
|
24606
24562
|
]);
|
|
24607
24563
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
24608
24564
|
displayDataRef.current = [
|
|
@@ -24625,8 +24581,6 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24625
24581
|
ended
|
|
24626
24582
|
]);
|
|
24627
24583
|
const handleEnded = ()=>{
|
|
24628
|
-
var _displayData_currentDisplayDataIndex_activity, _displayData_currentDisplayDataIndex;
|
|
24629
|
-
addEndedActivity((_displayData_currentDisplayDataIndex = displayData[currentDisplayDataIndex]) === null || _displayData_currentDisplayDataIndex === void 0 ? void 0 : (_displayData_currentDisplayDataIndex_activity = _displayData_currentDisplayDataIndex.activity) === null || _displayData_currentDisplayDataIndex_activity === void 0 ? void 0 : _displayData_currentDisplayDataIndex_activity.id);
|
|
24630
24584
|
setCurrentDisplayDataIndex((current)=>current + 1);
|
|
24631
24585
|
!ended && triggerScroll();
|
|
24632
24586
|
};
|
|
@@ -24635,7 +24589,7 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24635
24589
|
if (key <= currentDisplayDataIndex || ended) {
|
|
24636
24590
|
var _data_activity_attachments;
|
|
24637
24591
|
if (data.type === (0, $7WHA7.DisplayDataTypes).attachment) return ((_data_activity_attachments = data.activity.attachments) === null || _data_activity_attachments === void 0 ? void 0 : _data_activity_attachments.length) && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
|
|
24638
|
-
className: `${forceMobileView ? 'rf-m-auto' : 'rf-w-full'} ${data.activity.attachments.length
|
|
24592
|
+
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`,
|
|
24639
24593
|
children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $eXl5q.default), {
|
|
24640
24594
|
activity: data.activity,
|
|
24641
24595
|
triggerScroll: triggerScroll
|
|
@@ -24648,7 +24602,7 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24648
24602
|
triggerScroll: triggerScroll,
|
|
24649
24603
|
onEnded: handleEnded,
|
|
24650
24604
|
canBeEnded: data.canBeEnded,
|
|
24651
|
-
isEnded: data.
|
|
24605
|
+
isEnded: data.isEnded,
|
|
24652
24606
|
isWaitingDots: data.isWaitingDots
|
|
24653
24607
|
}, `${data.activity.id}-${key}`);
|
|
24654
24608
|
}
|
|
@@ -25841,8 +25795,7 @@ const $3b4c49538547c1bc$var$WarningBeforeNewsView = ()=>{
|
|
|
25841
25795
|
const sendEvent = (0, $6QoTL.useDirectlineStore)((state)=>state.actions.sendEvent);
|
|
25842
25796
|
const [waiting, setWaiting] = (0, $dWhh5$react.useState)(true);
|
|
25843
25797
|
const handleClick = (goHome)=>{
|
|
25844
|
-
sendEvent('Davi.CloseWindow', null);
|
|
25845
|
-
sendEvent('Davi.CloseWindowNewsSoundActivated', null);
|
|
25798
|
+
sendEvent('Davi.CloseWindow', null, ()=>sendEvent('Davi.CloseWindowNewsSoundActivated', null));
|
|
25846
25799
|
goHome ? setRoute((0, $7WHA7.Routes).Home) : setWaiting(false);
|
|
25847
25800
|
};
|
|
25848
25801
|
return waiting ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsxs)("div", {
|
|
@@ -26214,29 +26167,6 @@ var $6EkQS = parcelRequire("6EkQS");
|
|
|
26214
26167
|
var $6QoTL = parcelRequire("6QoTL");
|
|
26215
26168
|
|
|
26216
26169
|
var $7WHA7 = parcelRequire("7WHA7");
|
|
26217
|
-
/* Return codes:
|
|
26218
|
-
0 => do nothing
|
|
26219
|
-
1 => add to queue
|
|
26220
|
-
2 => stop current activity + change to the one tested
|
|
26221
|
-
*/ const $549323f244f4782c$var$checkLastbotActivity = (lastbotActivity, currentPlaying, currentReplyToId, queuedActivities, endedActivities)=>{
|
|
26222
|
-
// Check if the activity is the one currently being played
|
|
26223
|
-
if (lastbotActivity.id === currentPlaying.id) return 0;
|
|
26224
|
-
// Check if the activity has already been ended
|
|
26225
|
-
if (endedActivities.includes(lastbotActivity.id)) return 0;
|
|
26226
|
-
// Check if the activity has the same replyToId than the one currently being played
|
|
26227
|
-
if (lastbotActivity.replyToId === currentReplyToId) {
|
|
26228
|
-
// Check if the activity is already in the queue
|
|
26229
|
-
let count = 0;
|
|
26230
|
-
if (queuedActivities.length > 0) queuedActivities.forEach((activity)=>{
|
|
26231
|
-
if (activity.id === lastbotActivity.id) count++;
|
|
26232
|
-
});
|
|
26233
|
-
if (count === 0) return 1;
|
|
26234
|
-
else return 0;
|
|
26235
|
-
} else return 2;
|
|
26236
|
-
};
|
|
26237
|
-
var $549323f244f4782c$export$2e2bcd8739ae039 = $549323f244f4782c$var$checkLastbotActivity;
|
|
26238
|
-
|
|
26239
|
-
|
|
26240
26170
|
|
|
26241
26171
|
|
|
26242
26172
|
|
|
@@ -26831,7 +26761,8 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26831
26761
|
const microphoneCloseAudioRef = (0, $dWhh5$react.useRef)(null);
|
|
26832
26762
|
const [DBReady, setDBReady] = (0, $dWhh5$react.useState)(false);
|
|
26833
26763
|
const [playingBlob, setPlayingBlob] = (0, $dWhh5$react.useState)(false);
|
|
26834
|
-
const
|
|
26764
|
+
const nextUtteranceDataRef = (0, $dWhh5$react.useRef)(null);
|
|
26765
|
+
const nextUtteranceTextRef = (0, $dWhh5$react.useRef)(null);
|
|
26835
26766
|
const nextUtteranceBoundariesRef = (0, $dWhh5$react.useRef)([]);
|
|
26836
26767
|
const nextUtteranceVisemesRef = (0, $dWhh5$react.useRef)([]);
|
|
26837
26768
|
const emptyTextUtteranceRef = (0, $dWhh5$react.useRef)(null);
|
|
@@ -26846,7 +26777,7 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26846
26777
|
if (appAvailable || loaderClosed) {
|
|
26847
26778
|
var _audioRef_current;
|
|
26848
26779
|
// Cancel synthesis if using synthesizer
|
|
26849
|
-
if (!playingBlob) ponyfill
|
|
26780
|
+
if (!playingBlob) ponyfill.speechSynthesis.cancel();
|
|
26850
26781
|
resetNextUtteranceData();
|
|
26851
26782
|
if (audioRef.current && !((_audioRef_current = audioRef.current) === null || _audioRef_current === void 0 ? void 0 : _audioRef_current.paused)) {
|
|
26852
26783
|
audioRef.current.pause();
|
|
@@ -26856,7 +26787,7 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26856
26787
|
};
|
|
26857
26788
|
const attachEvents = (tempUtterance, isMainUtterance)=>{
|
|
26858
26789
|
tempUtterance.onerror = (event)=>{
|
|
26859
|
-
isMainUtterance ? handleError(event) :
|
|
26790
|
+
isMainUtterance ? handleError(event) : nextUtteranceDataRef.current = null;
|
|
26860
26791
|
};
|
|
26861
26792
|
tempUtterance.onsynthesiscompleted = ()=>{
|
|
26862
26793
|
const endBoundary = {
|
|
@@ -26923,29 +26854,34 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26923
26854
|
return tempUtterance;
|
|
26924
26855
|
};
|
|
26925
26856
|
const processNextData = (data)=>{
|
|
26926
|
-
|
|
26927
|
-
|
|
26928
|
-
|
|
26929
|
-
|
|
26930
|
-
|
|
26857
|
+
nextUtteranceDataRef.current = (data === null || data === void 0 ? void 0 : data.byteLength) && nextUtteranceTextRef.current ? {
|
|
26858
|
+
text: nextUtteranceTextRef.current,
|
|
26859
|
+
data: {
|
|
26860
|
+
speechData: data,
|
|
26861
|
+
boundaries: nextUtteranceBoundariesRef.current,
|
|
26862
|
+
visemes: nextUtteranceVisemesRef.current
|
|
26863
|
+
}
|
|
26864
|
+
} : null;
|
|
26931
26865
|
// Reset boundary / viseme data
|
|
26932
26866
|
resetNextUtteranceData(true);
|
|
26933
26867
|
};
|
|
26934
26868
|
const resetNextUtteranceData = (keepArrayBufferData)=>{
|
|
26935
|
-
!keepArrayBufferData &&
|
|
26869
|
+
!keepArrayBufferData && (nextUtteranceDataRef.current = null);
|
|
26870
|
+
nextUtteranceTextRef.current = null;
|
|
26936
26871
|
nextUtteranceBoundariesRef.current = [];
|
|
26937
26872
|
nextUtteranceVisemesRef.current = [];
|
|
26938
26873
|
};
|
|
26939
26874
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
26940
26875
|
if (utterance) {
|
|
26941
26876
|
if (utterance.text) {
|
|
26942
|
-
if (
|
|
26943
|
-
|
|
26944
|
-
|
|
26945
|
-
|
|
26946
|
-
|
|
26947
|
-
|
|
26948
|
-
|
|
26877
|
+
if (audioRef === null || audioRef === void 0 ? void 0 : audioRef.current) {
|
|
26878
|
+
var _nextUtteranceDataRef_current;
|
|
26879
|
+
if (((_nextUtteranceDataRef_current = nextUtteranceDataRef.current) === null || _nextUtteranceDataRef_current === void 0 ? void 0 : _nextUtteranceDataRef_current.text) === utterance.text && nextUtteranceDataRef.current.data) {
|
|
26880
|
+
boundaryRef.current = nextUtteranceDataRef.current.data.boundaries;
|
|
26881
|
+
setBoundaryData(nextUtteranceDataRef.current.data.boundaries);
|
|
26882
|
+
setVisemeData(nextUtteranceDataRef.current.data.visemes);
|
|
26883
|
+
processData(nextUtteranceDataRef.current.data.speechData, true);
|
|
26884
|
+
} else // Play utterance whether by asking for a speech synthesis, or by retrieving data from indexedDB
|
|
26949
26885
|
playUtterance(attachEvents(utterance, true));
|
|
26950
26886
|
} else stopCurrentPlaying();
|
|
26951
26887
|
} else handleEmptyTextUtterance();
|
|
@@ -26954,8 +26890,10 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26954
26890
|
utterance
|
|
26955
26891
|
]);
|
|
26956
26892
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
26957
|
-
|
|
26893
|
+
// If there are data in nextUtteranceTextRef, this means the previous synthesis data retrieval is not finished, so we don't begin a new one
|
|
26894
|
+
if ((nextUtterance === null || nextUtterance === void 0 ? void 0 : nextUtterance.text) && !nextUtteranceTextRef.current) {
|
|
26958
26895
|
const tempUtterance = attachEvents(nextUtterance);
|
|
26896
|
+
nextUtteranceTextRef.current = nextUtterance.text;
|
|
26959
26897
|
ponyfill.speechSynthesis.synthesizeAndGetArrayData(tempUtterance, processNextData);
|
|
26960
26898
|
} else resetNextUtteranceData();
|
|
26961
26899
|
}, [
|
|
@@ -26963,14 +26901,14 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26963
26901
|
]);
|
|
26964
26902
|
const playUtterance = async (utt)=>{
|
|
26965
26903
|
if (DBReady && enableSpeechCaching !== false && utt) {
|
|
26966
|
-
const dataFromIndexedDB = await $d31b268c3b702355$var$DBManager.getSpeechData(`${locale}.${voice === null || voice === void 0 ? void 0 : voice.name}.${utt.text.replace($d31b268c3b702355$var$tagsRemoverRegex, '')
|
|
26904
|
+
const dataFromIndexedDB = await $d31b268c3b702355$var$DBManager.getSpeechData(`${locale}.${voice === null || voice === void 0 ? void 0 : voice.name}.${utt.text.replace($d31b268c3b702355$var$tagsRemoverRegex, '')}`);
|
|
26967
26905
|
if (dataFromIndexedDB) {
|
|
26968
26906
|
boundaryRef.current = dataFromIndexedDB.boundaries;
|
|
26969
26907
|
setBoundaryData(dataFromIndexedDB.boundaries);
|
|
26970
26908
|
setVisemeData(dataFromIndexedDB.visemes || []);
|
|
26971
26909
|
processData(dataFromIndexedDB.value, true);
|
|
26972
|
-
} else ponyfill
|
|
26973
|
-
} else ponyfill
|
|
26910
|
+
} else ponyfill.speechSynthesis.synthesizeAndGetArrayData(utt, processData);
|
|
26911
|
+
} else ponyfill.speechSynthesis.synthesizeAndGetArrayData(utt, processData);
|
|
26974
26912
|
};
|
|
26975
26913
|
const processData = (data, alreadyExistsInDB)=>{
|
|
26976
26914
|
if (data === null || data === void 0 ? void 0 : data.byteLength) {
|
|
@@ -26980,7 +26918,7 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
26980
26918
|
type: 'audio/mp3'
|
|
26981
26919
|
});
|
|
26982
26920
|
enableSpeechCaching !== false && !alreadyExistsInDB && DBReady && (boundaryRef === null || boundaryRef === void 0 ? void 0 : boundaryRef.current) && utterance && $d31b268c3b702355$var$DBManager.addSpeechData({
|
|
26983
|
-
id: `${locale}.${voice === null || voice === void 0 ? void 0 : voice.name}.${utterance.text.replace($d31b268c3b702355$var$tagsRemoverRegex, '')
|
|
26921
|
+
id: `${locale}.${voice === null || voice === void 0 ? void 0 : voice.name}.${utterance.text.replace($d31b268c3b702355$var$tagsRemoverRegex, '')}`,
|
|
26984
26922
|
value: data,
|
|
26985
26923
|
boundaries: boundaryRef.current,
|
|
26986
26924
|
visemes: visemeRef.current || []
|
|
@@ -27005,13 +26943,13 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
27005
26943
|
};
|
|
27006
26944
|
const handleEnd = ()=>{
|
|
27007
26945
|
if (appAvailable || loaderClosed) {
|
|
27008
|
-
onEnd
|
|
26946
|
+
onEnd === null || onEnd === void 0 ? void 0 : onEnd();
|
|
27009
26947
|
resetData();
|
|
27010
26948
|
} else setLoaderClosed(true);
|
|
27011
26949
|
};
|
|
27012
26950
|
const handleError = (error)=>{
|
|
27013
|
-
console.log('
|
|
27014
|
-
onError
|
|
26951
|
+
console.log('Retorik Framework > speech synthesis error ', error);
|
|
26952
|
+
onError === null || onError === void 0 ? void 0 : onError();
|
|
27015
26953
|
resetData();
|
|
27016
26954
|
};
|
|
27017
26955
|
const handleEmptyTextUtterance = ()=>{
|
|
@@ -27026,7 +26964,7 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
27026
26964
|
* - play 1 second muted sound to prime audio output
|
|
27027
26965
|
* - MANDATORY FOR SAFARI IN VOCAL MODE
|
|
27028
26966
|
*/ const primeRetorikSpeech = ()=>{
|
|
27029
|
-
if (
|
|
26967
|
+
if (audioRef.current) {
|
|
27030
26968
|
audioRef.current.play().catch((e)=>console.warn(e));
|
|
27031
26969
|
(speechRecognitionAudioRef === null || speechRecognitionAudioRef === void 0 ? void 0 : speechRecognitionAudioRef.current) && speechRecognitionAudioRef.current.play().catch((e)=>console.warn(e));
|
|
27032
26970
|
// Send animation start event to secure animation not playing on safari if permissions are not sufficient
|
|
@@ -27037,13 +26975,6 @@ const $d31b268c3b702355$var$RetorikSpeech = ({ ponyfill: ponyfill, onEnd: onEnd,
|
|
|
27037
26975
|
* Play sound on speech recognition activation if it isn't disabled in configuration
|
|
27038
26976
|
*/ (0, $dWhh5$react.useEffect)(()=>{
|
|
27039
26977
|
var _speechRecognitionAudioRef_current;
|
|
27040
|
-
// if (
|
|
27041
|
-
// !!speechRecognitionOptions?.enableActivationSound &&
|
|
27042
|
-
// activeRecognitionState === RecognitionState.Listening
|
|
27043
|
-
// ) {
|
|
27044
|
-
// speechRecognitionAudioRef?.current &&
|
|
27045
|
-
// speechRecognitionAudioRef.current.play().catch((e) => console.warn(e))
|
|
27046
|
-
// }
|
|
27047
26978
|
if (useOldRemote) {
|
|
27048
26979
|
if (!!(speechRecognitionOptions === null || speechRecognitionOptions === void 0 ? void 0 : speechRecognitionOptions.enableActivationSound) && activeRecognitionState === (0, $7WHA7.RecognitionState).Listening) speechRecognitionAudioRef === null || speechRecognitionAudioRef === void 0 ? void 0 : (_speechRecognitionAudioRef_current = speechRecognitionAudioRef.current) === null || _speechRecognitionAudioRef_current === void 0 ? void 0 : _speechRecognitionAudioRef_current.play().catch((e)=>console.warn(e));
|
|
27049
26980
|
} else if (!!(speechRecognitionOptions === null || speechRecognitionOptions === void 0 ? void 0 : speechRecognitionOptions.enableActivationSound)) switch(activeRecognitionState){
|
|
@@ -27102,11 +27033,7 @@ var $d31b268c3b702355$export$2e2bcd8739ae039 = $d31b268c3b702355$var$RetorikSpee
|
|
|
27102
27033
|
|
|
27103
27034
|
const $ad561f5c61e38c20$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikNews: isRetorikNews })=>{
|
|
27104
27035
|
const cancel = (0, $jgaO0.useSpeechStore)((state)=>state.cancel);
|
|
27105
|
-
const streamingReplyToId = (0, $jgaO0.useSpeechStore)((state)=>state.streamingReplyToId);
|
|
27106
27036
|
const streamingQueue = (0, $jgaO0.useSpeechStore)((state)=>state.streamingQueue);
|
|
27107
|
-
const currentPlaying = (0, $jgaO0.useSpeechStore)((state)=>state.currentPlaying);
|
|
27108
|
-
const currentReplyToId = (0, $jgaO0.useSpeechStore)((state)=>state.currentReplyToId);
|
|
27109
|
-
const endedActivities = (0, $jgaO0.useSpeechStore)((state)=>state.endedActivities);
|
|
27110
27037
|
const voice = (0, $jgaO0.useSpeechStore)((state)=>state.voice);
|
|
27111
27038
|
const customVoice = (0, $jgaO0.useSpeechStore)((state)=>state.customVoice);
|
|
27112
27039
|
const activeRecognitionState = (0, $jgaO0.useSpeechStore)((state)=>state.activeRecognitionState);
|
|
@@ -27119,24 +27046,17 @@ const $ad561f5c61e38c20$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
27119
27046
|
const appAvailable = (0, $6EkQS.useRetorikStore)((state)=>state.appAvailable);
|
|
27120
27047
|
const preventExpectedInputHint = (0, $6EkQS.useRetorikStore)((state)=>state.configuration.preventExpectedInputHint);
|
|
27121
27048
|
const speechSynthesisOptions = (0, $6EkQS.useRetorikStore)((state)=>state.configuration.speechSynthesisOptions);
|
|
27122
|
-
const currentNewsActivity = (0, $7eio0.useUtilsStore)((state)=>state.currentNewsActivity);
|
|
27123
|
-
const lastBotActivity = (0, $e53vj.useActivityStore)((state)=>state.lastBotMessageActivity);
|
|
27124
27049
|
const checkReplacementLocale = (0, $6Q0mk.useLocaleStore)((state)=>state.actions.checkReplacementLocale);
|
|
27125
27050
|
const setRetorikNewsEnded = (0, $7eio0.useUtilsStore)((state)=>state.actions.setRetorikNewsEnded);
|
|
27126
|
-
const { resetCancelCurrentUtterance: resetCancelCurrentUtterance, setSpeaking: setSpeaking,
|
|
27051
|
+
const { setCurrentOrLastPlayedActivity: setCurrentOrLastPlayedActivity, resetCancelCurrentUtterance: resetCancelCurrentUtterance, setSpeaking: setSpeaking, setBoundaryData: setBoundaryData, removeFirstFromStreamingQueue: removeFirstFromStreamingQueue, killCurrentStreaming: killCurrentStreaming, askPermission: askPermission, toggleMicrophone: toggleMicrophone } = (0, $jgaO0.useSpeechStore)((state)=>state.actions);
|
|
27127
27052
|
const addEndedActivity = (0, $e53vj.useActivityStore)((state)=>state.actions.addEndedActivity);
|
|
27128
27053
|
const dispatchMarkActivity = (0, $6QoTL.useDirectlineStore)((state)=>state.actions.dispatchMarkActivity);
|
|
27129
27054
|
const [utterance, setUtterance] = (0, $dWhh5$react.useState)(null);
|
|
27130
27055
|
const [nextUtterance, setNextUtterance] = (0, $dWhh5$react.useState)(null);
|
|
27131
|
-
const cancelRef = (0, $dWhh5$react.useRef)(false);
|
|
27132
|
-
const isSpeaking = (0, $dWhh5$react.useRef)(false);
|
|
27133
27056
|
const isNewsViewRef = (0, $dWhh5$react.useRef)(!!isRetorikNews);
|
|
27134
27057
|
const lastListTextPlayedRef = (0, $dWhh5$react.useRef)('');
|
|
27135
|
-
const
|
|
27058
|
+
const streamingQueueRef = (0, $dWhh5$react.useRef)([]);
|
|
27136
27059
|
const currentActivityRef = (0, $dWhh5$react.useRef)(null);
|
|
27137
|
-
const currentPlayingRef = (0, $dWhh5$react.useRef)(null);
|
|
27138
|
-
const tempCurrentStreamingRef = (0, $dWhh5$react.useRef)(null);
|
|
27139
|
-
const streamingRelatedMessageRef = (0, $dWhh5$react.useRef)(null);
|
|
27140
27060
|
/**
|
|
27141
27061
|
* Check activity locale in case of voice change during the speech, to keep the language defined in activity
|
|
27142
27062
|
* instead of switching languages between answers that are written in the same language
|
|
@@ -27163,17 +27083,21 @@ const $ad561f5c61e38c20$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
27163
27083
|
return (0, $285c8810199513ef$export$f969af62bba9a48b)(params, speechSynthesisOptions === null || speechSynthesisOptions === void 0 ? void 0 : speechSynthesisOptions.sayAs);
|
|
27164
27084
|
};
|
|
27165
27085
|
const resetData = ()=>{
|
|
27166
|
-
|
|
27167
|
-
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
|
|
27086
|
+
var // Set all activities curretnly in the queue as ended
|
|
27087
|
+
_streamingQueueRef_current;
|
|
27088
|
+
(_streamingQueueRef_current = streamingQueueRef.current) === null || _streamingQueueRef_current === void 0 ? void 0 : _streamingQueueRef_current.forEach((activity)=>{
|
|
27089
|
+
addEndedActivity(activity.id);
|
|
27090
|
+
});
|
|
27091
|
+
streamingQueueRef.current = [];
|
|
27092
|
+
killCurrentStreaming();
|
|
27093
|
+
currentActivityRef.current = null;
|
|
27171
27094
|
setUtterance(null);
|
|
27172
27095
|
setNextUtterance(null);
|
|
27173
27096
|
resetCancelCurrentUtterance();
|
|
27097
|
+
setSpeaking(false);
|
|
27098
|
+
setBoundaryData([]);
|
|
27174
27099
|
};
|
|
27175
|
-
const checkReplacementLocaleAndGetUtterance = (activity, checkReplacement = true
|
|
27176
|
-
setCurrent && (currentActivityRef.current = activity);
|
|
27100
|
+
const checkReplacementLocaleAndGetUtterance = (activity, checkReplacement = true)=>{
|
|
27177
27101
|
const replacementLocale = checkReplacement ? checkReplacementLocale(activity.locale || locale) : locale;
|
|
27178
27102
|
const params = {
|
|
27179
27103
|
activity: activity,
|
|
@@ -27182,176 +27106,39 @@ const $ad561f5c61e38c20$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
27182
27106
|
};
|
|
27183
27107
|
return checkActivityAndCreateUtterance(params);
|
|
27184
27108
|
};
|
|
27185
|
-
|
|
27109
|
+
/**
|
|
27110
|
+
* Check if the microphone can be opened automatically
|
|
27111
|
+
*/ const checkDictateState = ()=>{
|
|
27186
27112
|
if (!preventExpectedInputHint && mode === (0, $7WHA7.Mode).vocal && activeRecognitionState === (0, $7WHA7.RecognitionState).Closed) {
|
|
27187
27113
|
if (!isMicrophoneAllowed) askPermission();
|
|
27188
27114
|
else toggleMicrophone(true);
|
|
27189
27115
|
}
|
|
27190
27116
|
};
|
|
27191
|
-
(0, $dWhh5$react.useEffect)(()=>{
|
|
27192
|
-
if (isNewsViewRef.current) {
|
|
27193
|
-
if (currentNewsActivity) {
|
|
27194
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(currentNewsActivity));
|
|
27195
|
-
isSpeaking.current = true;
|
|
27196
|
-
} else {
|
|
27197
|
-
setUtterance(null);
|
|
27198
|
-
isSpeaking.current = false;
|
|
27199
|
-
}
|
|
27200
|
-
}
|
|
27201
|
-
}, [
|
|
27202
|
-
currentNewsActivity,
|
|
27203
|
-
ponyfill
|
|
27204
|
-
]);
|
|
27205
27117
|
/**
|
|
27206
|
-
* On
|
|
27207
|
-
* - when we toggle from a view to another, we reset the data related to speech
|
|
27118
|
+
* On route change, reset all data and check if we are on the news view
|
|
27208
27119
|
*/ (0, $dWhh5$react.useEffect)(()=>{
|
|
27209
|
-
setSpeaking(false);
|
|
27210
|
-
setBoundaryData([]);
|
|
27211
|
-
const ended = [
|
|
27212
|
-
...endedActivities
|
|
27213
|
-
];
|
|
27214
|
-
if (currentPlaying) {
|
|
27215
|
-
// Add played activity id to context's endedActivities
|
|
27216
|
-
ended.length > 10 && ended.splice(0, 1);
|
|
27217
|
-
if (currentPlaying.id) {
|
|
27218
|
-
ended.push(currentPlaying.id);
|
|
27219
|
-
addEndedActivity(currentPlaying.id);
|
|
27220
|
-
}
|
|
27221
|
-
setEndedActivities(ended);
|
|
27222
|
-
}
|
|
27223
|
-
setCurrentPlaying(undefined);
|
|
27224
27120
|
resetData();
|
|
27225
27121
|
if (!isRetorikNews) isNewsViewRef.current = route === (0, $7WHA7.Routes).News;
|
|
27226
27122
|
}, [
|
|
27227
27123
|
route
|
|
27228
27124
|
]);
|
|
27229
27125
|
/**
|
|
27230
|
-
* On
|
|
27231
|
-
* - appAvailable is set to true after the user interacted with the loader and every needed element is loaded
|
|
27232
|
-
* - no utterance is created while appAvailable isn't true
|
|
27233
|
-
* - if during the waiting time, some activities were queued, when appAvailable comes to true, let's begin creating the utterances and playing them
|
|
27234
|
-
*/ (0, $dWhh5$react.useEffect)(()=>{
|
|
27235
|
-
var _queuedActivitiesRef_current;
|
|
27236
|
-
if (appAvailable && ((_queuedActivitiesRef_current = queuedActivitiesRef.current) === null || _queuedActivitiesRef_current === void 0 ? void 0 : _queuedActivitiesRef_current.length)) {
|
|
27237
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(queuedActivitiesRef.current[0]));
|
|
27238
|
-
queuedActivitiesRef.current.splice(0, 1);
|
|
27239
|
-
isSpeaking.current = true;
|
|
27240
|
-
}
|
|
27241
|
-
}, [
|
|
27242
|
-
appAvailable
|
|
27243
|
-
]);
|
|
27244
|
-
/**
|
|
27245
|
-
* On speechCancelStore's cancel state change :
|
|
27246
|
-
* - if there is currently no utterance being played, reset cancel state to false
|
|
27247
|
-
* - if an utterance is being played, set it to null to stop playing and prevent data in queue from being played
|
|
27248
|
-
* - setting an utterance to null will trigger the handleUtteranceEnded method automatically
|
|
27126
|
+
* On cancel call, reset all data and kill current streaming
|
|
27249
27127
|
*/ (0, $dWhh5$react.useEffect)(()=>{
|
|
27250
|
-
|
|
27251
|
-
if (cancel) {
|
|
27252
|
-
utterance ? setUtterance(null) : resetCancelCurrentUtterance();
|
|
27253
|
-
isSpeaking.current = false;
|
|
27254
|
-
setNextUtterance(null);
|
|
27255
|
-
killCurrentStreaming();
|
|
27256
|
-
}
|
|
27128
|
+
cancel && resetData();
|
|
27257
27129
|
}, [
|
|
27258
27130
|
cancel
|
|
27259
27131
|
]);
|
|
27260
27132
|
/**
|
|
27261
|
-
*
|
|
27262
|
-
* - if the activity doesn't have a replyToId value, put it in the queue (used for reminder process)
|
|
27263
|
-
* - if the app is not available yet, put the activity in the queue if it is not yet inside
|
|
27264
|
-
* - NB: an activity can be received once from the directline, but can be found several times in the activities in the botframework
|
|
27265
|
-
* this is because it is processed multiple times if there is something to speak (channelDate empty, then channelData with {speak: true})
|
|
27266
|
-
* - 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)
|
|
27267
|
-
* - if an utterance has to be created, create it and set the utterance state
|
|
27133
|
+
* Play external speech immediately but don't add it to the history
|
|
27268
27134
|
*/ (0, $dWhh5$react.useEffect)(()=>{
|
|
27269
|
-
if (voice && (lastBotActivity === null || lastBotActivity === void 0 ? void 0 : lastBotActivity.id)) {
|
|
27270
|
-
let createNewUtterance = false;
|
|
27271
|
-
if (!lastBotActivity.replyToId) {
|
|
27272
|
-
var _queuedActivitiesRef_current;
|
|
27273
|
-
if (isNewsViewRef.current) ;
|
|
27274
|
-
else if (currentPlaying || ((_queuedActivitiesRef_current = queuedActivitiesRef.current) === null || _queuedActivitiesRef_current === void 0 ? void 0 : _queuedActivitiesRef_current.length)) queuedActivitiesRef.current = [
|
|
27275
|
-
...queuedActivitiesRef.current,
|
|
27276
|
-
lastBotActivity
|
|
27277
|
-
];
|
|
27278
|
-
else if (endedActivities.length === 0 || endedActivities[endedActivities.length - 1] !== lastBotActivity.id) createNewUtterance = true;
|
|
27279
|
-
} else if (lastBotActivity.replyToId === streamingReplyToId) {
|
|
27280
|
-
var _lastBotActivity_value;
|
|
27281
|
-
if ((_lastBotActivity_value = lastBotActivity.value) === null || _lastBotActivity_value === void 0 ? void 0 : _lastBotActivity_value.streamingId) {
|
|
27282
|
-
setCurrentPlaying(lastBotActivity);
|
|
27283
|
-
currentPlayingRef.current = lastBotActivity;
|
|
27284
|
-
// Keep the message related to playing streaming activities to deal with when streaming is ended
|
|
27285
|
-
streamingRelatedMessageRef.current = lastBotActivity;
|
|
27286
|
-
} else queuedActivitiesRef.current = [
|
|
27287
|
-
...queuedActivitiesRef.current,
|
|
27288
|
-
lastBotActivity
|
|
27289
|
-
];
|
|
27290
|
-
} else if (!appAvailable) {
|
|
27291
|
-
if (!currentReplyToId) {
|
|
27292
|
-
setCurrentReplyToId(lastBotActivity.replyToId);
|
|
27293
|
-
queuedActivitiesRef.current = [
|
|
27294
|
-
lastBotActivity
|
|
27295
|
-
];
|
|
27296
|
-
} else {
|
|
27297
|
-
var _queuedActivitiesRef_current1;
|
|
27298
|
-
if (currentReplyToId === lastBotActivity.replyToId) {
|
|
27299
|
-
if (!((_queuedActivitiesRef_current1 = queuedActivitiesRef.current) === null || _queuedActivitiesRef_current1 === void 0 ? void 0 : _queuedActivitiesRef_current1.find((act)=>act.id === lastBotActivity.id))) queuedActivitiesRef.current = [
|
|
27300
|
-
...queuedActivitiesRef.current,
|
|
27301
|
-
lastBotActivity
|
|
27302
|
-
];
|
|
27303
|
-
} else {
|
|
27304
|
-
setCurrentReplyToId(lastBotActivity.replyToId);
|
|
27305
|
-
queuedActivitiesRef.current = [
|
|
27306
|
-
lastBotActivity
|
|
27307
|
-
];
|
|
27308
|
-
}
|
|
27309
|
-
}
|
|
27310
|
-
} else if (currentActivityRef === null || currentActivityRef === void 0 ? void 0 : currentActivityRef.current) switch((0, $549323f244f4782c$export$2e2bcd8739ae039)(lastBotActivity, currentActivityRef.current, currentReplyToId, queuedActivitiesRef.current, endedActivities)){
|
|
27311
|
-
case 0:
|
|
27312
|
-
break;
|
|
27313
|
-
case 1:
|
|
27314
|
-
// Add the activity to the queue
|
|
27315
|
-
queuedActivitiesRef.current.push(lastBotActivity);
|
|
27316
|
-
break;
|
|
27317
|
-
case 2:
|
|
27318
|
-
// Stop current activity and play the new one
|
|
27319
|
-
queuedActivitiesRef.current = [];
|
|
27320
|
-
createNewUtterance = true;
|
|
27321
|
-
break;
|
|
27322
|
-
}
|
|
27323
|
-
else createNewUtterance = !endedActivities.includes(lastBotActivity.id);
|
|
27324
|
-
if (createNewUtterance) {
|
|
27325
|
-
setCurrentReplyToId(lastBotActivity.replyToId || 'customReplyToIdIfNotPresent');
|
|
27326
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(lastBotActivity));
|
|
27327
|
-
isSpeaking.current = true;
|
|
27328
|
-
}
|
|
27329
|
-
}
|
|
27330
|
-
}, [
|
|
27331
|
-
lastBotActivity,
|
|
27332
|
-
ponyfill,
|
|
27333
|
-
voice
|
|
27334
|
-
]);
|
|
27335
|
-
(0, $dWhh5$react.useEffect)(()=>{
|
|
27336
|
-
if (streamingReplyToId && streamingQueue.length) {
|
|
27337
|
-
setUtterance(checkReplacementLocaleAndGetUtterance(streamingQueue[0], false, false));
|
|
27338
|
-
isSpeaking.current = true;
|
|
27339
|
-
setCurrentPlaying(undefined);
|
|
27340
|
-
currentPlayingRef.current = null;
|
|
27341
|
-
currentActivityRef.current = null;
|
|
27342
|
-
tempCurrentStreamingRef.current = streamingQueue[0].text || null;
|
|
27343
|
-
removeFirstFromStreamingQueue();
|
|
27344
|
-
}
|
|
27345
|
-
}, [
|
|
27346
|
-
streamingReplyToId
|
|
27347
|
-
]);
|
|
27348
|
-
(0, $dWhh5$react.useEffect)(()=>{
|
|
27349
27135
|
if (externalTextToSpeech) {
|
|
27350
|
-
|
|
27136
|
+
const activity = {
|
|
27351
27137
|
speak: externalTextToSpeech,
|
|
27352
27138
|
locale: locale
|
|
27353
|
-
}
|
|
27354
|
-
|
|
27139
|
+
};
|
|
27140
|
+
currentActivityRef.current = activity;
|
|
27141
|
+
setUtterance(checkReplacementLocaleAndGetUtterance(activity, false));
|
|
27355
27142
|
}
|
|
27356
27143
|
}, [
|
|
27357
27144
|
externalTextToSpeech
|
|
@@ -27361,93 +27148,80 @@ const $ad561f5c61e38c20$var$SynthesisManager = ({ ponyfill: ponyfill, isRetorikN
|
|
|
27361
27148
|
document.dispatchEvent(speechEvent);
|
|
27362
27149
|
};
|
|
27363
27150
|
/**
|
|
27364
|
-
*
|
|
27365
|
-
* - set speaking state to true
|
|
27366
|
-
* - clear timerref timeout
|
|
27367
|
-
* - set currentPlaying and currentReplyToId states after a small delay to prevent make sure that the display will happen after the speech has begun
|
|
27151
|
+
* Called when utterance's "start" event is fired
|
|
27368
27152
|
*/ const handleUtteranceStart = ()=>{
|
|
27153
|
+
var _streamingQueueRef_current__value;
|
|
27369
27154
|
setSpeaking(true);
|
|
27370
27155
|
if (!isNewsViewRef.current && (currentActivityRef === null || currentActivityRef === void 0 ? void 0 : currentActivityRef.current)) {
|
|
27371
|
-
|
|
27372
|
-
currentPlayingRef.current = currentActivityRef.current;
|
|
27156
|
+
setCurrentOrLastPlayedActivity(currentActivityRef.current);
|
|
27373
27157
|
currentActivityRef.current.id && dispatchMarkActivity(currentActivityRef.current.id, true);
|
|
27374
27158
|
}
|
|
27375
27159
|
dispatchSpeechEvent(true);
|
|
27376
27160
|
// Set next utterance to prepare synthesis data in order to improve fluidity
|
|
27377
|
-
if (
|
|
27378
|
-
const
|
|
27379
|
-
|
|
27380
|
-
const tempUtterance = checkReplacementLocaleAndGetUtterance(streamingQueue[0], false, false);
|
|
27381
|
-
tempUtterance.text !== (nextUtterance === null || nextUtterance === void 0 ? void 0 : nextUtterance.text) ? setNextUtterance(tempUtterance) : setNextUtterance(null);
|
|
27382
|
-
} else setNextUtterance(null);
|
|
27161
|
+
if (streamingQueueRef.current.length && !((_streamingQueueRef_current__value = streamingQueueRef.current[0].value) === null || _streamingQueueRef_current__value === void 0 ? void 0 : _streamingQueueRef_current__value.streamingCount)) {
|
|
27162
|
+
const utt = checkReplacementLocaleAndGetUtterance(streamingQueueRef.current[0], false);
|
|
27163
|
+
setNextUtterance((current)=>utt.text === (current === null || current === void 0 ? void 0 : current.text) ? null : utt);
|
|
27383
27164
|
} else setNextUtterance(null);
|
|
27384
|
-
setCurrentStreaming(tempCurrentStreamingRef === null || tempCurrentStreamingRef === void 0 ? void 0 : tempCurrentStreamingRef.current);
|
|
27385
27165
|
};
|
|
27386
|
-
|
|
27166
|
+
/**
|
|
27167
|
+
* Called when utterance's "end" event is fired
|
|
27168
|
+
*/ const handleUtteranceEnd = ()=>{
|
|
27387
27169
|
setSpeaking(false);
|
|
27388
27170
|
dispatchSpeechEvent(false);
|
|
27389
|
-
if (isNewsViewRef.current)
|
|
27390
|
-
|
|
27391
|
-
|
|
27171
|
+
if (isNewsViewRef.current) {
|
|
27172
|
+
setRetorikNewsEnded(true);
|
|
27173
|
+
currentActivityRef.current = null;
|
|
27174
|
+
} else handleEnded();
|
|
27392
27175
|
};
|
|
27393
|
-
|
|
27394
|
-
|
|
27395
|
-
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
*/ const handleEnded = ()=>{
|
|
27400
|
-
let futureUtterance = null;
|
|
27401
|
-
if (currentPlayingRef === null || currentPlayingRef === void 0 ? void 0 : currentPlayingRef.current) // Add played activity id to context's endedActivities
|
|
27402
|
-
{
|
|
27403
|
-
if (currentPlayingRef.current.id) {
|
|
27404
|
-
addEndedActivity(currentPlayingRef.current.id);
|
|
27405
|
-
dispatchMarkActivity(currentPlayingRef.current.id, false);
|
|
27406
|
-
}
|
|
27176
|
+
const handleEnded = ()=>{
|
|
27177
|
+
var _currentActivityRef_current, _streamingQueueRef_current;
|
|
27178
|
+
// Add played activity id to context's endedActivities
|
|
27179
|
+
if ((_currentActivityRef_current = currentActivityRef.current) === null || _currentActivityRef_current === void 0 ? void 0 : _currentActivityRef_current.id) {
|
|
27180
|
+
addEndedActivity(currentActivityRef.current.id);
|
|
27181
|
+
dispatchMarkActivity(currentActivityRef.current.id, false);
|
|
27407
27182
|
}
|
|
27408
|
-
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
|
|
27412
|
-
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27422
|
-
|
|
27183
|
+
if ((_streamingQueueRef_current = streamingQueueRef.current) === null || _streamingQueueRef_current === void 0 ? void 0 : _streamingQueueRef_current.length) {
|
|
27184
|
+
var _streamingQueueRef_current__value;
|
|
27185
|
+
// Check if this is the message sent after streaming activities
|
|
27186
|
+
if ((_streamingQueueRef_current__value = streamingQueueRef.current[0].value) === null || _streamingQueueRef_current__value === void 0 ? void 0 : _streamingQueueRef_current__value.streamingCount) {
|
|
27187
|
+
var _streamingQueueRef_current1;
|
|
27188
|
+
addEndedActivity(streamingQueueRef.current[0].id);
|
|
27189
|
+
// If there is another activity after this message, play it. If not, let's check if the microphone should be opened
|
|
27190
|
+
if (((_streamingQueueRef_current1 = streamingQueueRef.current) === null || _streamingQueueRef_current1 === void 0 ? void 0 : _streamingQueueRef_current1.length) > 1) {
|
|
27191
|
+
const utt = checkReplacementLocaleAndGetUtterance(streamingQueueRef.current[1]);
|
|
27192
|
+
currentActivityRef.current = streamingQueueRef.current[1];
|
|
27193
|
+
setUtterance(utt);
|
|
27194
|
+
removeFirstFromStreamingQueue(true);
|
|
27195
|
+
} else {
|
|
27196
|
+
streamingQueueRef.current[0].inputHint === 'expectingInput' && checkDictateState();
|
|
27197
|
+
currentActivityRef.current = null;
|
|
27198
|
+
setUtterance(null);
|
|
27199
|
+
setNextUtterance(null);
|
|
27200
|
+
removeFirstFromStreamingQueue();
|
|
27423
27201
|
}
|
|
27424
|
-
} else
|
|
27425
|
-
|
|
27426
|
-
|
|
27427
|
-
|
|
27428
|
-
|
|
27429
|
-
}
|
|
27202
|
+
} else {
|
|
27203
|
+
const utt = checkReplacementLocaleAndGetUtterance(streamingQueueRef.current[0]);
|
|
27204
|
+
currentActivityRef.current = streamingQueueRef.current[0];
|
|
27205
|
+
setUtterance(utt);
|
|
27206
|
+
removeFirstFromStreamingQueue();
|
|
27207
|
+
}
|
|
27208
|
+
} else {
|
|
27209
|
+
var _currentActivityRef_current1;
|
|
27210
|
+
((_currentActivityRef_current1 = currentActivityRef.current) === null || _currentActivityRef_current1 === void 0 ? void 0 : _currentActivityRef_current1.inputHint) === 'expectingInput' && checkDictateState();
|
|
27211
|
+
currentActivityRef.current = null;
|
|
27212
|
+
setUtterance(null);
|
|
27213
|
+
setNextUtterance(null);
|
|
27430
27214
|
}
|
|
27431
|
-
currentPlayingRef.current = null;
|
|
27432
|
-
setUtterance(futureUtterance);
|
|
27433
|
-
isSpeaking.current = !!futureUtterance;
|
|
27434
27215
|
};
|
|
27435
27216
|
/**
|
|
27436
|
-
*
|
|
27217
|
+
* Wait for app loading and voice selection to begin playing speech
|
|
27437
27218
|
*/ (0, $dWhh5$react.useEffect)(()=>{
|
|
27438
|
-
|
|
27439
|
-
|
|
27440
|
-
|
|
27441
|
-
if (streamingQueue.length) {
|
|
27442
|
-
futureUtterance = checkReplacementLocaleAndGetUtterance(streamingQueue[0], false, false);
|
|
27443
|
-
tempCurrentStreamingRef.current = streamingQueue[0].text || null;
|
|
27444
|
-
removeFirstFromStreamingQueue();
|
|
27445
|
-
}
|
|
27446
|
-
currentPlayingRef.current = null;
|
|
27447
|
-
setUtterance(futureUtterance);
|
|
27448
|
-
isSpeaking.current = !!futureUtterance;
|
|
27449
|
-
}
|
|
27219
|
+
// Set ref from the state to use in events
|
|
27220
|
+
streamingQueueRef.current = streamingQueue;
|
|
27221
|
+
if (appAvailable && voice && streamingQueue.length && !currentActivityRef.current) handleEnded();
|
|
27450
27222
|
}, [
|
|
27223
|
+
appAvailable,
|
|
27224
|
+
voice,
|
|
27451
27225
|
streamingQueue
|
|
27452
27226
|
]);
|
|
27453
27227
|
return /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $d31b268c3b702355$export$2e2bcd8739ae039), {
|
|
@@ -27469,7 +27243,8 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27469
27243
|
const locale = (0, $6Q0mk.useLocaleStore)((state)=>state.locale);
|
|
27470
27244
|
const agentData = (0, $6EkQS.useRetorikStore)((state)=>state.agentData);
|
|
27471
27245
|
const setVoice = (0, $jgaO0.useSpeechStore)((state)=>state.actions.setVoice);
|
|
27472
|
-
const [
|
|
27246
|
+
const [ponyfillCreated, setPonyfillCreated] = (0, $dWhh5$react.useState)(false);
|
|
27247
|
+
const ponyfillRef = (0, $dWhh5$react.useRef)(undefined);
|
|
27473
27248
|
const refreshTimerRef = (0, $dWhh5$react.useRef)(null);
|
|
27474
27249
|
/**
|
|
27475
27250
|
* Async function to retrieve a new token and assign it to the speechConfig inside ponyfill.speechSynthesis
|
|
@@ -27478,10 +27253,10 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27478
27253
|
*/ const refreshTokenInNineMinutes = async (region, key)=>{
|
|
27479
27254
|
// A token is valid during 10 minutes, let's refresh it after 9 minutes
|
|
27480
27255
|
refreshTimerRef.current = setTimeout(async ()=>{
|
|
27481
|
-
var
|
|
27256
|
+
var _ponyfillRef_current_speechSynthesis, _ponyfillRef_current;
|
|
27482
27257
|
const token = await (0, $f2ae26d736ec24dc$export$a2ce4fdd6972d6a7)(region, key);
|
|
27483
|
-
if (token && (
|
|
27484
|
-
|
|
27258
|
+
if (token && ((_ponyfillRef_current = ponyfillRef.current) === null || _ponyfillRef_current === void 0 ? void 0 : (_ponyfillRef_current_speechSynthesis = _ponyfillRef_current.speechSynthesis) === null || _ponyfillRef_current_speechSynthesis === void 0 ? void 0 : _ponyfillRef_current_speechSynthesis.speechConfig)) {
|
|
27259
|
+
ponyfillRef.current.speechSynthesis.speechConfig.authorizationToken = token;
|
|
27485
27260
|
refreshTokenInNineMinutes(region, key);
|
|
27486
27261
|
}
|
|
27487
27262
|
}, 540000) // 9 minutes
|
|
@@ -27494,14 +27269,15 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27494
27269
|
*/ const fetchTokenAndCreatePonyfill = async (region, key)=>{
|
|
27495
27270
|
const token = await (0, $f2ae26d736ec24dc$export$a2ce4fdd6972d6a7)(region, key);
|
|
27496
27271
|
if (token) {
|
|
27497
|
-
|
|
27272
|
+
ponyfillRef.current = (0, $dWhh5$daviaiwebspeechcognitiveservicesdavi.createSpeechSynthesisPonyfill)({
|
|
27498
27273
|
credentials: {
|
|
27499
27274
|
region: ponyfillCredentials === null || ponyfillCredentials === void 0 ? void 0 : ponyfillCredentials.region,
|
|
27500
27275
|
authorizationToken: token
|
|
27501
27276
|
}
|
|
27502
|
-
})
|
|
27277
|
+
});
|
|
27503
27278
|
// Launch token refresh after ponyfill creation
|
|
27504
27279
|
refreshTokenInNineMinutes(region, key);
|
|
27280
|
+
setPonyfillCreated(true);
|
|
27505
27281
|
}
|
|
27506
27282
|
};
|
|
27507
27283
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
@@ -27509,23 +27285,25 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27509
27285
|
const data = {
|
|
27510
27286
|
credentials: ponyfillCredentials
|
|
27511
27287
|
};
|
|
27512
|
-
|
|
27288
|
+
ponyfillRef.current = (0, $dWhh5$daviaiwebspeechcognitiveservicesdavi.createSpeechSynthesisPonyfill)(data);
|
|
27289
|
+
setPonyfillCreated(true);
|
|
27513
27290
|
} else if ((ponyfillCredentials === null || ponyfillCredentials === void 0 ? void 0 : ponyfillCredentials.subscriptionKey) && ponyfillCredentials.region) fetchTokenAndCreatePonyfill(ponyfillCredentials.region, ponyfillCredentials.subscriptionKey);
|
|
27514
27291
|
}, [
|
|
27515
27292
|
ponyfillCredentials
|
|
27516
27293
|
]);
|
|
27517
27294
|
const onVoicesChanged = ()=>{
|
|
27518
|
-
|
|
27295
|
+
var _ponyfillRef_current;
|
|
27296
|
+
const voices = (_ponyfillRef_current = ponyfillRef.current) === null || _ponyfillRef_current === void 0 ? void 0 : _ponyfillRef_current.speechSynthesis.getVoices();
|
|
27519
27297
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $5679d80e89b3df01$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27520
27298
|
};
|
|
27521
27299
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
27522
|
-
if (
|
|
27523
|
-
const voices =
|
|
27300
|
+
if (ponyfillRef.current) {
|
|
27301
|
+
const voices = ponyfillRef.current.speechSynthesis.getVoices();
|
|
27524
27302
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $5679d80e89b3df01$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27525
|
-
else
|
|
27303
|
+
else ponyfillRef.current.speechSynthesis.onvoiceschanged = onVoicesChanged;
|
|
27526
27304
|
}
|
|
27527
27305
|
}, [
|
|
27528
|
-
|
|
27306
|
+
ponyfillCreated,
|
|
27529
27307
|
customVoice,
|
|
27530
27308
|
agentData,
|
|
27531
27309
|
locale
|
|
@@ -27535,8 +27313,8 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27535
27313
|
refreshTimerRef.current && clearTimeout(refreshTimerRef.current);
|
|
27536
27314
|
};
|
|
27537
27315
|
}, []);
|
|
27538
|
-
return
|
|
27539
|
-
ponyfill:
|
|
27316
|
+
return ponyfillCreated && ponyfillRef.current ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $ad561f5c61e38c20$export$2e2bcd8739ae039), {
|
|
27317
|
+
ponyfill: ponyfillRef.current,
|
|
27540
27318
|
isRetorikNews: isRetorikNews
|
|
27541
27319
|
}) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {});
|
|
27542
27320
|
};
|
|
@@ -27961,8 +27739,7 @@ const $4b02e31a53a4d2e7$var$typingTimer = 2000;
|
|
|
27961
27739
|
const $4b02e31a53a4d2e7$var$SendTypingIndicator = ({ isRetorikNews: isRetorikNews })=>{
|
|
27962
27740
|
const speaking = (0, $jgaO0.useSpeechStore)((state)=>state.speaking);
|
|
27963
27741
|
const streamingQueue = (0, $jgaO0.useSpeechStore)((state)=>state.streamingQueue);
|
|
27964
|
-
const
|
|
27965
|
-
const lastRecognitionInterim = (0, $jgaO0.useSpeechStore)((state)=>state.lastRecognitionInterim);
|
|
27742
|
+
const activeRecognitionState = (0, $jgaO0.useSpeechStore)((state)=>state.activeRecognitionState);
|
|
27966
27743
|
const route = (0, $kUiCn.useViewStore)((state)=>state.route);
|
|
27967
27744
|
const loaderClosed = (0, $6EkQS.useRetorikStore)((state)=>state.loaderClosed);
|
|
27968
27745
|
const appAvailable = (0, $6EkQS.useRetorikStore)((state)=>state.appAvailable);
|
|
@@ -27975,17 +27752,24 @@ const $4b02e31a53a4d2e7$var$SendTypingIndicator = ({ isRetorikNews: isRetorikNew
|
|
|
27975
27752
|
const sendTyping = (0, $6QoTL.useDirectlineStore)((state)=>state.actions.sendTyping);
|
|
27976
27753
|
const dataRef = (0, $dWhh5$react.useRef)(false);
|
|
27977
27754
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
27755
|
+
// Don't send typing activity when we are receiving streaming events
|
|
27756
|
+
const isReceivingStreamingData = !!streamingQueue.length && !!streamingQueue.find((activity)=>{
|
|
27757
|
+
var _activity_name;
|
|
27758
|
+
return ((_activity_name = activity.name) === null || _activity_name === void 0 ? void 0 : _activity_name.toLowerCase()) === 'davi.streammessageactivity';
|
|
27759
|
+
}) && !streamingQueue.find((activity)=>{
|
|
27760
|
+
var _activity_value;
|
|
27761
|
+
return (_activity_value = activity.value) === null || _activity_value === void 0 ? void 0 : _activity_value.streamingCount;
|
|
27762
|
+
});
|
|
27978
27763
|
dataRef.current = !isWaitingForResponse && // Don't send typing activity when we are receiving streaming events
|
|
27979
|
-
!
|
|
27764
|
+
!isReceivingStreamingData && (!loaderClosed || activeRecognitionState !== (0, $7WHA7.RecognitionState).Closed || userIsTyping || userIsSwiping || speaking || currentSubView !== (0, $7WHA7.CurrentSubView).none || route === (0, $7WHA7.Routes).News || retorikEvent === (0, $7WHA7.RetorikEvent).DetailViewOpen || listStatus === (0, $7WHA7.ListStatus).opened);
|
|
27980
27765
|
}, [
|
|
27981
27766
|
appAvailable,
|
|
27982
27767
|
loaderClosed,
|
|
27983
|
-
|
|
27768
|
+
activeRecognitionState,
|
|
27984
27769
|
userIsTyping,
|
|
27985
27770
|
userIsSwiping,
|
|
27986
27771
|
speaking,
|
|
27987
27772
|
streamingQueue,
|
|
27988
|
-
streamingQueueFullLength,
|
|
27989
27773
|
currentSubView,
|
|
27990
27774
|
route,
|
|
27991
27775
|
retorikEvent,
|