@davi-ai/retorik-framework 1.1.4 → 1.1.5
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/index.d.ts.map +1 -1
- package/dist/index.js +74 -36
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +73 -36
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -557,7 +557,8 @@ const $04ce41b46d359821$var$initialState = {
|
|
|
557
557
|
streamingQueueForText: [],
|
|
558
558
|
currentStreaming: null,
|
|
559
559
|
streamingQueueFullLength: 0,
|
|
560
|
-
streamingReplyToIdToIgnore: null
|
|
560
|
+
streamingReplyToIdToIgnore: null,
|
|
561
|
+
speechRecognitionDynamicGrammars: []
|
|
561
562
|
};
|
|
562
563
|
const $04ce41b46d359821$export$f299240efcda25a2 = (0, $b3y7N$create)()(()=>{
|
|
563
564
|
return $04ce41b46d359821$var$initialState;
|
|
@@ -744,6 +745,27 @@ const $04ce41b46d359821$export$e9ca045daeb00700 = (value, replyToId)=>{
|
|
|
744
745
|
streamingQueueFullLength: value
|
|
745
746
|
});
|
|
746
747
|
};
|
|
748
|
+
const $04ce41b46d359821$export$ec8986cae5ae5c2 = (value)=>{
|
|
749
|
+
const currentGrammars = $04ce41b46d359821$export$f299240efcda25a2.getState().speechRecognitionDynamicGrammars;
|
|
750
|
+
// For each value, verifiy if it doesn't exist in the array yet
|
|
751
|
+
if (Array.isArray(value)) {
|
|
752
|
+
const valuesToAdd = [];
|
|
753
|
+
value.forEach((val)=>{
|
|
754
|
+
!currentGrammars.includes(val) && valuesToAdd.push(val);
|
|
755
|
+
});
|
|
756
|
+
valuesToAdd.length && $04ce41b46d359821$export$f299240efcda25a2.setState({
|
|
757
|
+
speechRecognitionDynamicGrammars: [
|
|
758
|
+
...currentGrammars,
|
|
759
|
+
...valuesToAdd
|
|
760
|
+
]
|
|
761
|
+
});
|
|
762
|
+
} else !currentGrammars.includes(value) && $04ce41b46d359821$export$f299240efcda25a2.setState({
|
|
763
|
+
speechRecognitionDynamicGrammars: [
|
|
764
|
+
...currentGrammars,
|
|
765
|
+
value
|
|
766
|
+
]
|
|
767
|
+
});
|
|
768
|
+
};
|
|
747
769
|
const $04ce41b46d359821$export$b6d2196a3ce412d8 = ()=>{
|
|
748
770
|
$04ce41b46d359821$export$f299240efcda25a2.setState({
|
|
749
771
|
...$04ce41b46d359821$var$initialState
|
|
@@ -2258,7 +2280,6 @@ const $9b100ac34d01a331$export$bb2ccecd43d76d90 = async (value)=>{
|
|
|
2258
2280
|
(0, $56b00880a398c953$export$b468e470fbb95f20)(false);
|
|
2259
2281
|
// Create speak field from the text one
|
|
2260
2282
|
const processedText = (0, $2e5b8b358de6cd42$export$1b8fbc30fb87d9aa)(value.text, true);
|
|
2261
|
-
value.text = processedText.text;
|
|
2262
2283
|
value.speak = processedText.text;
|
|
2263
2284
|
(0, $957e950ca3ff2781$export$a6540370871e3c67)(undefined);
|
|
2264
2285
|
(0, $04ce41b46d359821$export$9a026d007e335fc0)(value);
|
|
@@ -2923,8 +2944,12 @@ const $b641028d2eac8925$var$dispatchActivity = (activity)=>{
|
|
|
2923
2944
|
(0, $9b100ac34d01a331$export$bf77ccf2b7638432)(retorikActivity);
|
|
2924
2945
|
break;
|
|
2925
2946
|
case (0, $0aa35ed98889e60d$export$bbd16b9b30e132b3).INCOMING_ACTIVITY:
|
|
2926
|
-
if (
|
|
2927
|
-
|
|
2947
|
+
if (!$b641028d2eac8925$var$checkIfHandlerAbortsActivity(legacyType, activity)) {
|
|
2948
|
+
// Add data for better speech recognition if therer are some
|
|
2949
|
+
if (retorikActivity.channelData?.speechRecognitionGrammars) (0, $04ce41b46d359821$export$ec8986cae5ae5c2)(retorikActivity.channelData?.speechRecognitionGrammars);
|
|
2950
|
+
if (retorikActivity.type === "event") (0, $9b100ac34d01a331$export$bb2ccecd43d76d90)(retorikActivity);
|
|
2951
|
+
else if (retorikActivity.type === "message") (0, $9b100ac34d01a331$export$2c98bb0c7fa688b3)(retorikActivity);
|
|
2952
|
+
}
|
|
2928
2953
|
break;
|
|
2929
2954
|
}
|
|
2930
2955
|
// Send POST_ACTIVITY_FULFILLED if the legacy type is SEND_MESSAGE or SEND_EVENT
|
|
@@ -10005,10 +10030,22 @@ const $a8e0bc17b0fe6d93$var$List = ({ activity: activity, onClose: onClose })=>{
|
|
|
10005
10030
|
const timerRef = (0, $b3y7N$useRef)(null);
|
|
10006
10031
|
const divRef = (0, $b3y7N$useRef)(null);
|
|
10007
10032
|
const [abortController, setAbortController] = (0, $b3y7N$useState)(null);
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10033
|
+
const handleOpen = ()=>{
|
|
10034
|
+
(0, $3426110875af99d0$export$324bf243c7501c4d)(true);
|
|
10035
|
+
api.start({
|
|
10036
|
+
from: {
|
|
10037
|
+
transform: "translateX(-100%)"
|
|
10038
|
+
},
|
|
10039
|
+
to: {
|
|
10040
|
+
transform: "translateX(0%)"
|
|
10041
|
+
},
|
|
10042
|
+
config: {
|
|
10043
|
+
duration: $a8e0bc17b0fe6d93$var$springEnterDuration,
|
|
10044
|
+
easing: (0, $b3y7N$easings).easeInBack
|
|
10045
|
+
}
|
|
10046
|
+
});
|
|
10047
|
+
};
|
|
10048
|
+
const handleClose = ()=>{
|
|
10012
10049
|
(0, $3426110875af99d0$export$324bf243c7501c4d)(false);
|
|
10013
10050
|
api.start({
|
|
10014
10051
|
from: {
|
|
@@ -10032,14 +10069,14 @@ const $a8e0bc17b0fe6d93$var$List = ({ activity: activity, onClose: onClose })=>{
|
|
|
10032
10069
|
}, $a8e0bc17b0fe6d93$var$springLeaveDuration);
|
|
10033
10070
|
}
|
|
10034
10071
|
};
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10072
|
+
(0, $b3y7N$useEffect)(()=>{
|
|
10073
|
+
if (activity && activity.id !== lastListActivity) {
|
|
10074
|
+
setContent(activity);
|
|
10075
|
+
if (timerRef.current) {
|
|
10076
|
+
clearTimeout(timerRef.current);
|
|
10077
|
+
handleOpen();
|
|
10078
|
+
}
|
|
10079
|
+
}
|
|
10043
10080
|
return ()=>{
|
|
10044
10081
|
activity?.id && (0, $3426110875af99d0$export$e2194ce98b9711c9)(activity.id);
|
|
10045
10082
|
};
|
|
@@ -10084,19 +10121,7 @@ const $a8e0bc17b0fe6d93$var$List = ({ activity: activity, onClose: onClose })=>{
|
|
|
10084
10121
|
content
|
|
10085
10122
|
]);
|
|
10086
10123
|
(0, $b3y7N$useEffect)(()=>{
|
|
10087
|
-
(
|
|
10088
|
-
api.start({
|
|
10089
|
-
from: {
|
|
10090
|
-
transform: "translateX(-100%)"
|
|
10091
|
-
},
|
|
10092
|
-
to: {
|
|
10093
|
-
transform: "translateX(0%)"
|
|
10094
|
-
},
|
|
10095
|
-
config: {
|
|
10096
|
-
duration: $a8e0bc17b0fe6d93$var$springEnterDuration,
|
|
10097
|
-
easing: (0, $b3y7N$easings).easeInBack
|
|
10098
|
-
}
|
|
10099
|
-
});
|
|
10124
|
+
handleOpen();
|
|
10100
10125
|
return ()=>{
|
|
10101
10126
|
(0, $3426110875af99d0$export$324bf243c7501c4d)(false);
|
|
10102
10127
|
timerRef?.current && clearTimeout(timerRef.current);
|
|
@@ -12953,7 +12978,7 @@ const $26692c14feff4dbf$export$6478e9f7582bd8fc = ()=>{
|
|
|
12953
12978
|
children: [
|
|
12954
12979
|
/*#__PURE__*/ (0, $b3y7N$jsxs)("div", {
|
|
12955
12980
|
children: [
|
|
12956
|
-
municipalPoliceNumber
|
|
12981
|
+
municipalPoliceNumber?.length && /*#__PURE__*/ (0, $b3y7N$jsxs)("p", {
|
|
12957
12982
|
className: "rf-text-xl rf-py-2",
|
|
12958
12983
|
children: [
|
|
12959
12984
|
`${translation.emergency.citypolice} : `,
|
|
@@ -12987,7 +13012,7 @@ const $26692c14feff4dbf$export$6478e9f7582bd8fc = ()=>{
|
|
|
12987
13012
|
}),
|
|
12988
13013
|
/*#__PURE__*/ (0, $b3y7N$jsxs)("div", {
|
|
12989
13014
|
children: [
|
|
12990
|
-
localHospitalName
|
|
13015
|
+
localHospitalName?.length && /*#__PURE__*/ (0, $b3y7N$jsxs)("p", {
|
|
12991
13016
|
className: "rf-text-xl rf-py-2",
|
|
12992
13017
|
children: [
|
|
12993
13018
|
`${translation.emergency.hospital} ${localHospitalName} : `,
|
|
@@ -12997,7 +13022,7 @@ const $26692c14feff4dbf$export$6478e9f7582bd8fc = ()=>{
|
|
|
12997
13022
|
})
|
|
12998
13023
|
]
|
|
12999
13024
|
}),
|
|
13000
|
-
poisonControlNumber
|
|
13025
|
+
poisonControlNumber?.length && /*#__PURE__*/ (0, $b3y7N$jsxs)("p", {
|
|
13001
13026
|
className: "rf-text-xl rf-py-2",
|
|
13002
13027
|
children: [
|
|
13003
13028
|
`${translation.emergency.poison} : `,
|
|
@@ -15374,7 +15399,12 @@ const $1286c804208ea5de$export$6969335ea1e4e77c = (target, source)=>{
|
|
|
15374
15399
|
const targetValue = target[key];
|
|
15375
15400
|
const sourceValue = source[key];
|
|
15376
15401
|
if (targetValue || targetValue === false) {
|
|
15377
|
-
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) source[key] =
|
|
15402
|
+
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) source[key] = [
|
|
15403
|
+
...new Set([
|
|
15404
|
+
...targetValue,
|
|
15405
|
+
...sourceValue
|
|
15406
|
+
])
|
|
15407
|
+
];
|
|
15378
15408
|
else if (isObject(targetValue) && isObject(sourceValue)) source[key] = $1286c804208ea5de$export$6969335ea1e4e77c(targetValue, sourceValue);
|
|
15379
15409
|
else source[key] = targetValue;
|
|
15380
15410
|
}
|
|
@@ -16707,6 +16737,7 @@ const $862dc1a8ff0214ad$var$RecognitionManager = ()=>{
|
|
|
16707
16737
|
const useContinuousRecognition = (0, $04ce41b46d359821$export$f299240efcda25a2)((state)=>state.useContinuousRecognition);
|
|
16708
16738
|
const activeRecognitionState = (0, $04ce41b46d359821$export$f299240efcda25a2)((state)=>state.activeRecognitionState);
|
|
16709
16739
|
const lastRecognitionInterim = (0, $04ce41b46d359821$export$f299240efcda25a2)((state)=>state.lastRecognitionInterim);
|
|
16740
|
+
const speechRecognitionDynamicGrammars = (0, $04ce41b46d359821$export$f299240efcda25a2)((state)=>state.speechRecognitionDynamicGrammars);
|
|
16710
16741
|
const route = (0, $957e950ca3ff2781$export$d13b2577cb75f2ad)((state)=>state.route);
|
|
16711
16742
|
const [ponyfill, setPonyfill] = (0, $b3y7N$useState)(null);
|
|
16712
16743
|
const isActiveModeRef = (0, $b3y7N$useRef)();
|
|
@@ -16785,10 +16816,14 @@ const $862dc1a8ff0214ad$var$RecognitionManager = ()=>{
|
|
|
16785
16816
|
// Set grammar list
|
|
16786
16817
|
const grammarList = new (0, $b3y7N$SpeechGrammarList)();
|
|
16787
16818
|
grammarList.phrases = getCommonAndLocalizedGrammars();
|
|
16819
|
+
if (speechRecognitionDynamicGrammars.length) speechRecognitionDynamicGrammars.forEach((grammar)=>{
|
|
16820
|
+
!grammarList.phrases.includes(grammar) && grammarList.phrases.push(grammar);
|
|
16821
|
+
});
|
|
16788
16822
|
ponyfill.speechRecognition.grammars = grammarList;
|
|
16789
16823
|
}
|
|
16790
16824
|
}, [
|
|
16791
|
-
locale
|
|
16825
|
+
locale,
|
|
16826
|
+
speechRecognitionDynamicGrammars
|
|
16792
16827
|
]);
|
|
16793
16828
|
/**
|
|
16794
16829
|
* Abort recognition if we are not on the 'home' page
|
|
@@ -17060,6 +17095,7 @@ const $9ecfb2c3feeca9a7$var$SendTypingIndicator = ({ isRetorikNews: isRetorikNew
|
|
|
17060
17095
|
const route = (0, $957e950ca3ff2781$export$d13b2577cb75f2ad)((state)=>state.route);
|
|
17061
17096
|
const loaderClosed = (0, $56b00880a398c953$export$bd22554f31e5f96f)((state)=>state.loaderClosed);
|
|
17062
17097
|
const appAvailable = (0, $56b00880a398c953$export$bd22554f31e5f96f)((state)=>state.appAvailable);
|
|
17098
|
+
const isWaitingForResponse = (0, $56b00880a398c953$export$bd22554f31e5f96f)((state)=>state.isWaitingForResponse);
|
|
17063
17099
|
const currentSubView = (0, $3426110875af99d0$export$77e4cc5334565f28)((state)=>state.currentSubView);
|
|
17064
17100
|
const listOpened = (0, $3426110875af99d0$export$77e4cc5334565f28)((state)=>state.listOpened);
|
|
17065
17101
|
const retorikEvent = (0, $3426110875af99d0$export$77e4cc5334565f28)((state)=>state.retorikEvent);
|
|
@@ -17067,7 +17103,7 @@ const $9ecfb2c3feeca9a7$var$SendTypingIndicator = ({ isRetorikNews: isRetorikNew
|
|
|
17067
17103
|
const userIsSwiping = (0, $3426110875af99d0$export$77e4cc5334565f28)((state)=>state.userIsSwiping);
|
|
17068
17104
|
const dataRef = (0, $b3y7N$useRef)(false);
|
|
17069
17105
|
(0, $b3y7N$useEffect)(()=>{
|
|
17070
|
-
dataRef.current = !loaderClosed || lastRecognitionInterim !== "" || userIsTyping || userIsSwiping || speaking || currentSubView !== (0, $f5ca62954d1f1f5b$export$f05d0fed0593ead7).none || route === (0, $f5ca62954d1f1f5b$export$3565eb3d00ca5a74).News || retorikEvent === (0, $f5ca62954d1f1f5b$export$4f7cd669585dc69f).DetailViewOpen || listOpened;
|
|
17106
|
+
dataRef.current = !isWaitingForResponse && (!loaderClosed || lastRecognitionInterim !== "" || userIsTyping || userIsSwiping || speaking || currentSubView !== (0, $f5ca62954d1f1f5b$export$f05d0fed0593ead7).none || route === (0, $f5ca62954d1f1f5b$export$3565eb3d00ca5a74).News || retorikEvent === (0, $f5ca62954d1f1f5b$export$4f7cd669585dc69f).DetailViewOpen || listOpened);
|
|
17071
17107
|
}, [
|
|
17072
17108
|
appAvailable,
|
|
17073
17109
|
loaderClosed,
|
|
@@ -17078,7 +17114,8 @@ const $9ecfb2c3feeca9a7$var$SendTypingIndicator = ({ isRetorikNews: isRetorikNew
|
|
|
17078
17114
|
currentSubView,
|
|
17079
17115
|
route,
|
|
17080
17116
|
retorikEvent,
|
|
17081
|
-
listOpened
|
|
17117
|
+
listOpened,
|
|
17118
|
+
isWaitingForResponse
|
|
17082
17119
|
]);
|
|
17083
17120
|
const checkShouldSendTypingIndicator = ()=>{
|
|
17084
17121
|
dataRef.current && !isRetorikNews && (0, $b641028d2eac8925$export$81487d3d3f61cca3)();
|