@davi-ai/retorik-framework 3.2.1 → 3.2.3
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.js +31 -37
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +29 -36
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -2139,8 +2139,7 @@ const $244e94971d503466$var$createSpeechStore = (setRetorikEvent, getListStatus,
|
|
|
2139
2139
|
setMode: (value)=>{
|
|
2140
2140
|
set({
|
|
2141
2141
|
mode: value
|
|
2142
|
-
})
|
|
2143
|
-
;
|
|
2142
|
+
});
|
|
2144
2143
|
setLastListActivity(undefined);
|
|
2145
2144
|
value !== (0, $4ucVo.Mode).text && setUserTyping(false);
|
|
2146
2145
|
!get().disableSound && get().actions.setMuted(value === (0, $4ucVo.Mode).text);
|
|
@@ -2443,8 +2442,6 @@ $parcel$export(module.exports, "default", () => $aab770e2a22c2c28$export$2e2bcd8
|
|
|
2443
2442
|
|
|
2444
2443
|
|
|
2445
2444
|
|
|
2446
|
-
var $i1rfm = parcelRequire("i1rfm");
|
|
2447
|
-
|
|
2448
2445
|
var $4ucVo = parcelRequire("4ucVo");
|
|
2449
2446
|
|
|
2450
2447
|
var $1TxAn = parcelRequire("1TxAn");
|
|
@@ -2483,7 +2480,7 @@ let $aab770e2a22c2c28$var$timer = null;
|
|
|
2483
2480
|
$aab770e2a22c2c28$var$timer = setTimeout(()=>{
|
|
2484
2481
|
return true;
|
|
2485
2482
|
}, 1000);
|
|
2486
|
-
const $aab770e2a22c2c28$var$createSpeechStore = (
|
|
2483
|
+
const $aab770e2a22c2c28$var$createSpeechStore = ()=>{
|
|
2487
2484
|
return (0, $bZRJW$createStore)((set, get)=>{
|
|
2488
2485
|
return {
|
|
2489
2486
|
...$aab770e2a22c2c28$var$initialState,
|
|
@@ -2555,7 +2552,7 @@ const $aab770e2a22c2c28$var$createSpeechStore = (modeRef)=>{
|
|
|
2555
2552
|
setSubtitlesInConfiguration: (value)=>{
|
|
2556
2553
|
set({
|
|
2557
2554
|
subtitlesInConfiguration: value,
|
|
2558
|
-
displaySubtitles: value
|
|
2555
|
+
displaySubtitles: value
|
|
2559
2556
|
});
|
|
2560
2557
|
},
|
|
2561
2558
|
setDisplaySubtitles: (value)=>{
|
|
@@ -2660,14 +2657,7 @@ const $aab770e2a22c2c28$export$bd22554f31e5f96f = (selector)=>{
|
|
|
2660
2657
|
return (0, $bZRJW$useStore)(store, selector);
|
|
2661
2658
|
};
|
|
2662
2659
|
const $aab770e2a22c2c28$var$RetorikProvider = ({ children: children })=>{
|
|
2663
|
-
const
|
|
2664
|
-
const modeRef = (0, $bZRJW$useRef)((0, $4ucVo.Mode).text);
|
|
2665
|
-
const [store] = (0, $bZRJW$useState)(()=>$aab770e2a22c2c28$var$createSpeechStore(modeRef));
|
|
2666
|
-
(0, $bZRJW$useEffect)(()=>{
|
|
2667
|
-
modeRef.current = mode;
|
|
2668
|
-
}, [
|
|
2669
|
-
mode
|
|
2670
|
-
]);
|
|
2660
|
+
const [store] = (0, $bZRJW$useState)(()=>$aab770e2a22c2c28$var$createSpeechStore());
|
|
2671
2661
|
return /*#__PURE__*/ (0, $bZRJW$jsx)($aab770e2a22c2c28$var$RetorikContext.Provider, {
|
|
2672
2662
|
value: store,
|
|
2673
2663
|
children: children
|
|
@@ -4362,7 +4352,7 @@ var $c54ebc4ba0100ff1$export$2e2bcd8739ae039 = $c54ebc4ba0100ff1$var$activityMid
|
|
|
4362
4352
|
});
|
|
4363
4353
|
|
|
4364
4354
|
parcelRegister("iT1WI", function(module, exports) {
|
|
4365
|
-
module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"3.2.
|
|
4355
|
+
module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"3.2.3\",\"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}}");
|
|
4366
4356
|
|
|
4367
4357
|
});
|
|
4368
4358
|
|
|
@@ -14272,7 +14262,7 @@ const $ac35eca22c14c48d$var$Attachments = ({ activity: activity, display: displa
|
|
|
14272
14262
|
return attachments.length > 1 ? (0, $4ucVo.Displays).carousel : (0, $4ucVo.Displays).normal;
|
|
14273
14263
|
case 'grid':
|
|
14274
14264
|
// Grid display is not available in mobile mode
|
|
14275
|
-
return isMobile ?
|
|
14265
|
+
return isMobile ? (0, $4ucVo.Displays).carouselgrid : (0, $4ucVo.Displays).grid;
|
|
14276
14266
|
}
|
|
14277
14267
|
// If we have no attachment layout but attachment(s), we use none display by default is there are several attachments
|
|
14278
14268
|
return attachments.length > 1 ? (0, $4ucVo.Displays).none : (0, $4ucVo.Displays).normal;
|
|
@@ -14465,7 +14455,7 @@ const $ab587b2431a9b830$var$CarouselContainer = ({ title: title, attachments: at
|
|
|
14465
14455
|
const carouselRef = (0, $bZRJW$useRef)(null);
|
|
14466
14456
|
(0, $bZRJW$useLayoutEffect)(()=>{
|
|
14467
14457
|
setHeight(0);
|
|
14468
|
-
if (attachments.length
|
|
14458
|
+
if (attachments.length) {
|
|
14469
14459
|
timerRef.current && clearTimeout(timerRef.current);
|
|
14470
14460
|
timerRef.current = setTimeout(()=>{
|
|
14471
14461
|
carouselRef.current && setHeight(carouselRef.current.clientHeight);
|
|
@@ -14633,7 +14623,7 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14633
14623
|
transform: 'translateX(100%)'
|
|
14634
14624
|
},
|
|
14635
14625
|
to: {
|
|
14636
|
-
transform:
|
|
14626
|
+
transform: `translateX(${nbCards === 1 ? '25%' : '0%'})`
|
|
14637
14627
|
},
|
|
14638
14628
|
config: {
|
|
14639
14629
|
duration: $78df6258e38451c4$var$springEnterDuration,
|
|
@@ -14641,7 +14631,8 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14641
14631
|
}
|
|
14642
14632
|
});
|
|
14643
14633
|
}, [
|
|
14644
|
-
draft
|
|
14634
|
+
draft,
|
|
14635
|
+
nbCards
|
|
14645
14636
|
]);
|
|
14646
14637
|
(0, $bZRJW$useEffect)(()=>{
|
|
14647
14638
|
handleClick(forcedCurrentCard || 0);
|
|
@@ -14899,7 +14890,7 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14899
14890
|
})
|
|
14900
14891
|
})
|
|
14901
14892
|
}),
|
|
14902
|
-
!draft && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
14893
|
+
!draft && nbCards > 1 && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
14903
14894
|
className: "rf-w-full rf-py-3 rf-flex rf-flex-row rf-justify-center rf-gap-1",
|
|
14904
14895
|
children: (0, $bZRJW$react).Children.map(children, (_child, key)=>{
|
|
14905
14896
|
return /*#__PURE__*/ (0, $bZRJW$jsx)("button", {
|
|
@@ -24527,7 +24518,7 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24527
24518
|
children: displayData.map((data, key)=>{
|
|
24528
24519
|
if (key <= currentDisplayDataIndex || ended) {
|
|
24529
24520
|
if (data.type === (0, $4ucVo.DisplayDataTypes).attachment) return data.activity.attachments?.length && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
24530
|
-
className: `${forceMobileView ? 'rf-m-auto' : 'rf-w-full'} ${data.activity.attachments.length
|
|
24521
|
+
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`,
|
|
24531
24522
|
children: /*#__PURE__*/ (0, $bZRJW$jsx)((0, $1LYTj.default), {
|
|
24532
24523
|
activity: data.activity,
|
|
24533
24524
|
triggerScroll: triggerScroll
|
|
@@ -27337,7 +27328,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27337
27328
|
const locale = (0, $2fuDN.useLocaleStore)((state)=>state.locale);
|
|
27338
27329
|
const agentData = (0, $1x02c.useRetorikStore)((state)=>state.agentData);
|
|
27339
27330
|
const setVoice = (0, $i1rfm.useSpeechStore)((state)=>state.actions.setVoice);
|
|
27340
|
-
const [
|
|
27331
|
+
const [ponyfillCreated, setPonyfillCreated] = (0, $bZRJW$useState)(false);
|
|
27332
|
+
const ponyfillRef = (0, $bZRJW$useRef)(undefined);
|
|
27341
27333
|
const refreshTimerRef = (0, $bZRJW$useRef)(null);
|
|
27342
27334
|
/**
|
|
27343
27335
|
* Async function to retrieve a new token and assign it to the speechConfig inside ponyfill.speechSynthesis
|
|
@@ -27347,8 +27339,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27347
27339
|
// A token is valid during 10 minutes, let's refresh it after 9 minutes
|
|
27348
27340
|
refreshTimerRef.current = setTimeout(async ()=>{
|
|
27349
27341
|
const token = await (0, $f9d43385082cde31$export$a2ce4fdd6972d6a7)(region, key);
|
|
27350
|
-
if (token &&
|
|
27351
|
-
|
|
27342
|
+
if (token && ponyfillRef.current?.speechSynthesis?.speechConfig) {
|
|
27343
|
+
ponyfillRef.current.speechSynthesis.speechConfig.authorizationToken = token;
|
|
27352
27344
|
refreshTokenInNineMinutes(region, key);
|
|
27353
27345
|
}
|
|
27354
27346
|
}, 540000) // 9 minutes
|
|
@@ -27361,14 +27353,15 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27361
27353
|
*/ const fetchTokenAndCreatePonyfill = async (region, key)=>{
|
|
27362
27354
|
const token = await (0, $f9d43385082cde31$export$a2ce4fdd6972d6a7)(region, key);
|
|
27363
27355
|
if (token) {
|
|
27364
|
-
|
|
27356
|
+
ponyfillRef.current = (0, $bZRJW$createSpeechSynthesisPonyfill)({
|
|
27365
27357
|
credentials: {
|
|
27366
27358
|
region: ponyfillCredentials?.region,
|
|
27367
27359
|
authorizationToken: token
|
|
27368
27360
|
}
|
|
27369
|
-
})
|
|
27361
|
+
});
|
|
27370
27362
|
// Launch token refresh after ponyfill creation
|
|
27371
27363
|
refreshTokenInNineMinutes(region, key);
|
|
27364
|
+
setPonyfillCreated(true);
|
|
27372
27365
|
}
|
|
27373
27366
|
};
|
|
27374
27367
|
(0, $bZRJW$useEffect)(()=>{
|
|
@@ -27376,23 +27369,24 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27376
27369
|
const data = {
|
|
27377
27370
|
credentials: ponyfillCredentials
|
|
27378
27371
|
};
|
|
27379
|
-
|
|
27372
|
+
ponyfillRef.current = (0, $bZRJW$createSpeechSynthesisPonyfill)(data);
|
|
27373
|
+
setPonyfillCreated(true);
|
|
27380
27374
|
} else if (ponyfillCredentials?.subscriptionKey && ponyfillCredentials.region) fetchTokenAndCreatePonyfill(ponyfillCredentials.region, ponyfillCredentials.subscriptionKey);
|
|
27381
27375
|
}, [
|
|
27382
27376
|
ponyfillCredentials
|
|
27383
27377
|
]);
|
|
27384
27378
|
const onVoicesChanged = ()=>{
|
|
27385
|
-
const voices =
|
|
27379
|
+
const voices = ponyfillRef.current?.speechSynthesis.getVoices();
|
|
27386
27380
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $e3b82aafad2d0e5e$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27387
27381
|
};
|
|
27388
27382
|
(0, $bZRJW$useEffect)(()=>{
|
|
27389
|
-
if (
|
|
27390
|
-
const voices =
|
|
27383
|
+
if (ponyfillRef.current) {
|
|
27384
|
+
const voices = ponyfillRef.current.speechSynthesis.getVoices();
|
|
27391
27385
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $e3b82aafad2d0e5e$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27392
|
-
else
|
|
27386
|
+
else ponyfillRef.current.speechSynthesis.onvoiceschanged = onVoicesChanged;
|
|
27393
27387
|
}
|
|
27394
27388
|
}, [
|
|
27395
|
-
|
|
27389
|
+
ponyfillCreated,
|
|
27396
27390
|
customVoice,
|
|
27397
27391
|
agentData,
|
|
27398
27392
|
locale
|
|
@@ -27402,8 +27396,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27402
27396
|
refreshTimerRef.current && clearTimeout(refreshTimerRef.current);
|
|
27403
27397
|
};
|
|
27404
27398
|
}, []);
|
|
27405
|
-
return
|
|
27406
|
-
ponyfill:
|
|
27399
|
+
return ponyfillCreated && ponyfillRef.current ? /*#__PURE__*/ (0, $bZRJW$jsx)((0, $0b8e5d756ffed1ac$export$2e2bcd8739ae039), {
|
|
27400
|
+
ponyfill: ponyfillRef.current,
|
|
27407
27401
|
isRetorikNews: isRetorikNews
|
|
27408
27402
|
}) : /*#__PURE__*/ (0, $bZRJW$jsx)((0, $bZRJW$react).Fragment, {});
|
|
27409
27403
|
};
|
|
@@ -28192,7 +28186,6 @@ const $1d1e69185b24eda9$var$RetorikContainer = ({ config: config, viewsConfig: v
|
|
|
28192
28186
|
mode,
|
|
28193
28187
|
isMobile,
|
|
28194
28188
|
displayAgent,
|
|
28195
|
-
displayAgent,
|
|
28196
28189
|
displayAgentInNews,
|
|
28197
28190
|
isNews,
|
|
28198
28191
|
visibility
|
|
@@ -28228,7 +28221,7 @@ const $1d1e69185b24eda9$var$RetorikContainer = ({ config: config, viewsConfig: v
|
|
|
28228
28221
|
height: height,
|
|
28229
28222
|
parent: parent,
|
|
28230
28223
|
children: [
|
|
28231
|
-
processedAgentData &&
|
|
28224
|
+
processedAgentData && /*#__PURE__*/ (0, $bZRJW$jsx)((0, $55bf4c9965ea9afa$export$2e2bcd8739ae039), {
|
|
28232
28225
|
centered: chatbotData.fullWidthInDesktopMode && !isNews,
|
|
28233
28226
|
chatbotData: currentLayout === (0, $4ucVo.ContainerParent).agent ? chatbotData : chatbotDataWidget,
|
|
28234
28227
|
showSubtitles: !isNews,
|