@davi-ai/retorik-framework 3.2.2 → 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 +26 -21
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +24 -20
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -4352,7 +4352,7 @@ var $c54ebc4ba0100ff1$export$2e2bcd8739ae039 = $c54ebc4ba0100ff1$var$activityMid
|
|
|
4352
4352
|
});
|
|
4353
4353
|
|
|
4354
4354
|
parcelRegister("iT1WI", function(module, exports) {
|
|
4355
|
-
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}}");
|
|
4356
4356
|
|
|
4357
4357
|
});
|
|
4358
4358
|
|
|
@@ -14262,7 +14262,7 @@ const $ac35eca22c14c48d$var$Attachments = ({ activity: activity, display: displa
|
|
|
14262
14262
|
return attachments.length > 1 ? (0, $4ucVo.Displays).carousel : (0, $4ucVo.Displays).normal;
|
|
14263
14263
|
case 'grid':
|
|
14264
14264
|
// Grid display is not available in mobile mode
|
|
14265
|
-
return isMobile ?
|
|
14265
|
+
return isMobile ? (0, $4ucVo.Displays).carouselgrid : (0, $4ucVo.Displays).grid;
|
|
14266
14266
|
}
|
|
14267
14267
|
// If we have no attachment layout but attachment(s), we use none display by default is there are several attachments
|
|
14268
14268
|
return attachments.length > 1 ? (0, $4ucVo.Displays).none : (0, $4ucVo.Displays).normal;
|
|
@@ -14455,7 +14455,7 @@ const $ab587b2431a9b830$var$CarouselContainer = ({ title: title, attachments: at
|
|
|
14455
14455
|
const carouselRef = (0, $bZRJW$useRef)(null);
|
|
14456
14456
|
(0, $bZRJW$useLayoutEffect)(()=>{
|
|
14457
14457
|
setHeight(0);
|
|
14458
|
-
if (attachments.length
|
|
14458
|
+
if (attachments.length) {
|
|
14459
14459
|
timerRef.current && clearTimeout(timerRef.current);
|
|
14460
14460
|
timerRef.current = setTimeout(()=>{
|
|
14461
14461
|
carouselRef.current && setHeight(carouselRef.current.clientHeight);
|
|
@@ -14623,7 +14623,7 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14623
14623
|
transform: 'translateX(100%)'
|
|
14624
14624
|
},
|
|
14625
14625
|
to: {
|
|
14626
|
-
transform:
|
|
14626
|
+
transform: `translateX(${nbCards === 1 ? '25%' : '0%'})`
|
|
14627
14627
|
},
|
|
14628
14628
|
config: {
|
|
14629
14629
|
duration: $78df6258e38451c4$var$springEnterDuration,
|
|
@@ -14631,7 +14631,8 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14631
14631
|
}
|
|
14632
14632
|
});
|
|
14633
14633
|
}, [
|
|
14634
|
-
draft
|
|
14634
|
+
draft,
|
|
14635
|
+
nbCards
|
|
14635
14636
|
]);
|
|
14636
14637
|
(0, $bZRJW$useEffect)(()=>{
|
|
14637
14638
|
handleClick(forcedCurrentCard || 0);
|
|
@@ -14889,7 +14890,7 @@ const $78df6258e38451c4$var$Carousel = /*#__PURE__*/ (0, $bZRJW$react).forwardRe
|
|
|
14889
14890
|
})
|
|
14890
14891
|
})
|
|
14891
14892
|
}),
|
|
14892
|
-
!draft && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
14893
|
+
!draft && nbCards > 1 && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
14893
14894
|
className: "rf-w-full rf-py-3 rf-flex rf-flex-row rf-justify-center rf-gap-1",
|
|
14894
14895
|
children: (0, $bZRJW$react).Children.map(children, (_child, key)=>{
|
|
14895
14896
|
return /*#__PURE__*/ (0, $bZRJW$jsx)("button", {
|
|
@@ -24517,7 +24518,7 @@ const $ec519e4becb3ec60$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24517
24518
|
children: displayData.map((data, key)=>{
|
|
24518
24519
|
if (key <= currentDisplayDataIndex || ended) {
|
|
24519
24520
|
if (data.type === (0, $4ucVo.DisplayDataTypes).attachment) return data.activity.attachments?.length && /*#__PURE__*/ (0, $bZRJW$jsx)("div", {
|
|
24520
|
-
className: `${forceMobileView ? 'rf-m-auto' : 'rf-w-full'} ${data.activity.attachments.length
|
|
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`,
|
|
24521
24522
|
children: /*#__PURE__*/ (0, $bZRJW$jsx)((0, $1LYTj.default), {
|
|
24522
24523
|
activity: data.activity,
|
|
24523
24524
|
triggerScroll: triggerScroll
|
|
@@ -27327,7 +27328,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27327
27328
|
const locale = (0, $2fuDN.useLocaleStore)((state)=>state.locale);
|
|
27328
27329
|
const agentData = (0, $1x02c.useRetorikStore)((state)=>state.agentData);
|
|
27329
27330
|
const setVoice = (0, $i1rfm.useSpeechStore)((state)=>state.actions.setVoice);
|
|
27330
|
-
const [
|
|
27331
|
+
const [ponyfillCreated, setPonyfillCreated] = (0, $bZRJW$useState)(false);
|
|
27332
|
+
const ponyfillRef = (0, $bZRJW$useRef)(undefined);
|
|
27331
27333
|
const refreshTimerRef = (0, $bZRJW$useRef)(null);
|
|
27332
27334
|
/**
|
|
27333
27335
|
* Async function to retrieve a new token and assign it to the speechConfig inside ponyfill.speechSynthesis
|
|
@@ -27337,8 +27339,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27337
27339
|
// A token is valid during 10 minutes, let's refresh it after 9 minutes
|
|
27338
27340
|
refreshTimerRef.current = setTimeout(async ()=>{
|
|
27339
27341
|
const token = await (0, $f9d43385082cde31$export$a2ce4fdd6972d6a7)(region, key);
|
|
27340
|
-
if (token &&
|
|
27341
|
-
|
|
27342
|
+
if (token && ponyfillRef.current?.speechSynthesis?.speechConfig) {
|
|
27343
|
+
ponyfillRef.current.speechSynthesis.speechConfig.authorizationToken = token;
|
|
27342
27344
|
refreshTokenInNineMinutes(region, key);
|
|
27343
27345
|
}
|
|
27344
27346
|
}, 540000) // 9 minutes
|
|
@@ -27351,14 +27353,15 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27351
27353
|
*/ const fetchTokenAndCreatePonyfill = async (region, key)=>{
|
|
27352
27354
|
const token = await (0, $f9d43385082cde31$export$a2ce4fdd6972d6a7)(region, key);
|
|
27353
27355
|
if (token) {
|
|
27354
|
-
|
|
27356
|
+
ponyfillRef.current = (0, $bZRJW$createSpeechSynthesisPonyfill)({
|
|
27355
27357
|
credentials: {
|
|
27356
27358
|
region: ponyfillCredentials?.region,
|
|
27357
27359
|
authorizationToken: token
|
|
27358
27360
|
}
|
|
27359
|
-
})
|
|
27361
|
+
});
|
|
27360
27362
|
// Launch token refresh after ponyfill creation
|
|
27361
27363
|
refreshTokenInNineMinutes(region, key);
|
|
27364
|
+
setPonyfillCreated(true);
|
|
27362
27365
|
}
|
|
27363
27366
|
};
|
|
27364
27367
|
(0, $bZRJW$useEffect)(()=>{
|
|
@@ -27366,23 +27369,24 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27366
27369
|
const data = {
|
|
27367
27370
|
credentials: ponyfillCredentials
|
|
27368
27371
|
};
|
|
27369
|
-
|
|
27372
|
+
ponyfillRef.current = (0, $bZRJW$createSpeechSynthesisPonyfill)(data);
|
|
27373
|
+
setPonyfillCreated(true);
|
|
27370
27374
|
} else if (ponyfillCredentials?.subscriptionKey && ponyfillCredentials.region) fetchTokenAndCreatePonyfill(ponyfillCredentials.region, ponyfillCredentials.subscriptionKey);
|
|
27371
27375
|
}, [
|
|
27372
27376
|
ponyfillCredentials
|
|
27373
27377
|
]);
|
|
27374
27378
|
const onVoicesChanged = ()=>{
|
|
27375
|
-
const voices =
|
|
27379
|
+
const voices = ponyfillRef.current?.speechSynthesis.getVoices();
|
|
27376
27380
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $e3b82aafad2d0e5e$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27377
27381
|
};
|
|
27378
27382
|
(0, $bZRJW$useEffect)(()=>{
|
|
27379
|
-
if (
|
|
27380
|
-
const voices =
|
|
27383
|
+
if (ponyfillRef.current) {
|
|
27384
|
+
const voices = ponyfillRef.current.speechSynthesis.getVoices();
|
|
27381
27385
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $e3b82aafad2d0e5e$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27382
|
-
else
|
|
27386
|
+
else ponyfillRef.current.speechSynthesis.onvoiceschanged = onVoicesChanged;
|
|
27383
27387
|
}
|
|
27384
27388
|
}, [
|
|
27385
|
-
|
|
27389
|
+
ponyfillCreated,
|
|
27386
27390
|
customVoice,
|
|
27387
27391
|
agentData,
|
|
27388
27392
|
locale
|
|
@@ -27392,8 +27396,8 @@ const $982637234a32cc59$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27392
27396
|
refreshTimerRef.current && clearTimeout(refreshTimerRef.current);
|
|
27393
27397
|
};
|
|
27394
27398
|
}, []);
|
|
27395
|
-
return
|
|
27396
|
-
ponyfill:
|
|
27399
|
+
return ponyfillCreated && ponyfillRef.current ? /*#__PURE__*/ (0, $bZRJW$jsx)((0, $0b8e5d756ffed1ac$export$2e2bcd8739ae039), {
|
|
27400
|
+
ponyfill: ponyfillRef.current,
|
|
27397
27401
|
isRetorikNews: isRetorikNews
|
|
27398
27402
|
}) : /*#__PURE__*/ (0, $bZRJW$jsx)((0, $bZRJW$react).Fragment, {});
|
|
27399
27403
|
};
|