@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.js
CHANGED
|
@@ -4392,7 +4392,7 @@ var $c8770452d727244a$export$2e2bcd8739ae039 = $c8770452d727244a$var$activityMid
|
|
|
4392
4392
|
});
|
|
4393
4393
|
|
|
4394
4394
|
parcelRegister("93cl9", function(module, exports) {
|
|
4395
|
-
module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"3.2.
|
|
4395
|
+
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}}");
|
|
4396
4396
|
|
|
4397
4397
|
});
|
|
4398
4398
|
|
|
@@ -14326,7 +14326,7 @@ const $c0f9a707e7db7f07$var$Attachments = ({ activity: activity, display: displa
|
|
|
14326
14326
|
return attachments.length > 1 ? (0, $7WHA7.Displays).carousel : (0, $7WHA7.Displays).normal;
|
|
14327
14327
|
case 'grid':
|
|
14328
14328
|
// Grid display is not available in mobile mode
|
|
14329
|
-
return isMobile ?
|
|
14329
|
+
return isMobile ? (0, $7WHA7.Displays).carouselgrid : (0, $7WHA7.Displays).grid;
|
|
14330
14330
|
}
|
|
14331
14331
|
// If we have no attachment layout but attachment(s), we use none display by default is there are several attachments
|
|
14332
14332
|
return attachments.length > 1 ? (0, $7WHA7.Displays).none : (0, $7WHA7.Displays).normal;
|
|
@@ -14523,7 +14523,7 @@ const $31d1ee7383d825e1$var$CarouselContainer = ({ title: title, attachments: at
|
|
|
14523
14523
|
const carouselRef = (0, $dWhh5$react.useRef)(null);
|
|
14524
14524
|
(0, $dWhh5$react.useLayoutEffect)(()=>{
|
|
14525
14525
|
setHeight(0);
|
|
14526
|
-
if (attachments.length
|
|
14526
|
+
if (attachments.length) {
|
|
14527
14527
|
timerRef.current && clearTimeout(timerRef.current);
|
|
14528
14528
|
timerRef.current = setTimeout(()=>{
|
|
14529
14529
|
carouselRef.current && setHeight(carouselRef.current.clientHeight);
|
|
@@ -14692,7 +14692,7 @@ const $872024d5c381e99a$var$Carousel = /*#__PURE__*/ (0, ($parcel$interopDefault
|
|
|
14692
14692
|
transform: 'translateX(100%)'
|
|
14693
14693
|
},
|
|
14694
14694
|
to: {
|
|
14695
|
-
transform:
|
|
14695
|
+
transform: `translateX(${nbCards === 1 ? '25%' : '0%'})`
|
|
14696
14696
|
},
|
|
14697
14697
|
config: {
|
|
14698
14698
|
duration: $872024d5c381e99a$var$springEnterDuration,
|
|
@@ -14700,7 +14700,8 @@ const $872024d5c381e99a$var$Carousel = /*#__PURE__*/ (0, ($parcel$interopDefault
|
|
|
14700
14700
|
}
|
|
14701
14701
|
});
|
|
14702
14702
|
}, [
|
|
14703
|
-
draft
|
|
14703
|
+
draft,
|
|
14704
|
+
nbCards
|
|
14704
14705
|
]);
|
|
14705
14706
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
14706
14707
|
handleClick(forcedCurrentCard || 0);
|
|
@@ -14958,7 +14959,7 @@ const $872024d5c381e99a$var$Carousel = /*#__PURE__*/ (0, ($parcel$interopDefault
|
|
|
14958
14959
|
})
|
|
14959
14960
|
})
|
|
14960
14961
|
}),
|
|
14961
|
-
!draft && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
|
|
14962
|
+
!draft && nbCards > 1 && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
|
|
14962
14963
|
className: "rf-w-full rf-py-3 rf-flex rf-flex-row rf-justify-center rf-gap-1",
|
|
14963
14964
|
children: (0, ($parcel$interopDefault($dWhh5$react))).Children.map(children, (_child, key)=>{
|
|
14964
14965
|
return /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("button", {
|
|
@@ -24635,7 +24636,7 @@ const $a2a195f52aaf1332$var$DisplayStandard = ({ currentQuestionId: currentQuest
|
|
|
24635
24636
|
if (key <= currentDisplayDataIndex || ended) {
|
|
24636
24637
|
var _data_activity_attachments;
|
|
24637
24638
|
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
|
|
24639
|
+
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
24640
|
children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $eXl5q.default), {
|
|
24640
24641
|
activity: data.activity,
|
|
24641
24642
|
triggerScroll: triggerScroll
|
|
@@ -27469,7 +27470,8 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27469
27470
|
const locale = (0, $6Q0mk.useLocaleStore)((state)=>state.locale);
|
|
27470
27471
|
const agentData = (0, $6EkQS.useRetorikStore)((state)=>state.agentData);
|
|
27471
27472
|
const setVoice = (0, $jgaO0.useSpeechStore)((state)=>state.actions.setVoice);
|
|
27472
|
-
const [
|
|
27473
|
+
const [ponyfillCreated, setPonyfillCreated] = (0, $dWhh5$react.useState)(false);
|
|
27474
|
+
const ponyfillRef = (0, $dWhh5$react.useRef)(undefined);
|
|
27473
27475
|
const refreshTimerRef = (0, $dWhh5$react.useRef)(null);
|
|
27474
27476
|
/**
|
|
27475
27477
|
* Async function to retrieve a new token and assign it to the speechConfig inside ponyfill.speechSynthesis
|
|
@@ -27478,10 +27480,10 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27478
27480
|
*/ const refreshTokenInNineMinutes = async (region, key)=>{
|
|
27479
27481
|
// A token is valid during 10 minutes, let's refresh it after 9 minutes
|
|
27480
27482
|
refreshTimerRef.current = setTimeout(async ()=>{
|
|
27481
|
-
var
|
|
27483
|
+
var _ponyfillRef_current_speechSynthesis, _ponyfillRef_current;
|
|
27482
27484
|
const token = await (0, $f2ae26d736ec24dc$export$a2ce4fdd6972d6a7)(region, key);
|
|
27483
|
-
if (token && (
|
|
27484
|
-
|
|
27485
|
+
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)) {
|
|
27486
|
+
ponyfillRef.current.speechSynthesis.speechConfig.authorizationToken = token;
|
|
27485
27487
|
refreshTokenInNineMinutes(region, key);
|
|
27486
27488
|
}
|
|
27487
27489
|
}, 540000) // 9 minutes
|
|
@@ -27494,14 +27496,15 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27494
27496
|
*/ const fetchTokenAndCreatePonyfill = async (region, key)=>{
|
|
27495
27497
|
const token = await (0, $f2ae26d736ec24dc$export$a2ce4fdd6972d6a7)(region, key);
|
|
27496
27498
|
if (token) {
|
|
27497
|
-
|
|
27499
|
+
ponyfillRef.current = (0, $dWhh5$daviaiwebspeechcognitiveservicesdavi.createSpeechSynthesisPonyfill)({
|
|
27498
27500
|
credentials: {
|
|
27499
27501
|
region: ponyfillCredentials === null || ponyfillCredentials === void 0 ? void 0 : ponyfillCredentials.region,
|
|
27500
27502
|
authorizationToken: token
|
|
27501
27503
|
}
|
|
27502
|
-
})
|
|
27504
|
+
});
|
|
27503
27505
|
// Launch token refresh after ponyfill creation
|
|
27504
27506
|
refreshTokenInNineMinutes(region, key);
|
|
27507
|
+
setPonyfillCreated(true);
|
|
27505
27508
|
}
|
|
27506
27509
|
};
|
|
27507
27510
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
@@ -27509,23 +27512,25 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27509
27512
|
const data = {
|
|
27510
27513
|
credentials: ponyfillCredentials
|
|
27511
27514
|
};
|
|
27512
|
-
|
|
27515
|
+
ponyfillRef.current = (0, $dWhh5$daviaiwebspeechcognitiveservicesdavi.createSpeechSynthesisPonyfill)(data);
|
|
27516
|
+
setPonyfillCreated(true);
|
|
27513
27517
|
} else if ((ponyfillCredentials === null || ponyfillCredentials === void 0 ? void 0 : ponyfillCredentials.subscriptionKey) && ponyfillCredentials.region) fetchTokenAndCreatePonyfill(ponyfillCredentials.region, ponyfillCredentials.subscriptionKey);
|
|
27514
27518
|
}, [
|
|
27515
27519
|
ponyfillCredentials
|
|
27516
27520
|
]);
|
|
27517
27521
|
const onVoicesChanged = ()=>{
|
|
27518
|
-
|
|
27522
|
+
var _ponyfillRef_current;
|
|
27523
|
+
const voices = (_ponyfillRef_current = ponyfillRef.current) === null || _ponyfillRef_current === void 0 ? void 0 : _ponyfillRef_current.speechSynthesis.getVoices();
|
|
27519
27524
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $5679d80e89b3df01$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27520
27525
|
};
|
|
27521
27526
|
(0, $dWhh5$react.useEffect)(()=>{
|
|
27522
|
-
if (
|
|
27523
|
-
const voices =
|
|
27527
|
+
if (ponyfillRef.current) {
|
|
27528
|
+
const voices = ponyfillRef.current.speechSynthesis.getVoices();
|
|
27524
27529
|
if (voices && Array.isArray(voices) && voices.length) setVoice((0, $5679d80e89b3df01$export$4bf371fc4fa74a28)(voices, locale, customVoice, agentData));
|
|
27525
|
-
else
|
|
27530
|
+
else ponyfillRef.current.speechSynthesis.onvoiceschanged = onVoicesChanged;
|
|
27526
27531
|
}
|
|
27527
27532
|
}, [
|
|
27528
|
-
|
|
27533
|
+
ponyfillCreated,
|
|
27529
27534
|
customVoice,
|
|
27530
27535
|
agentData,
|
|
27531
27536
|
locale
|
|
@@ -27535,8 +27540,8 @@ const $fe06f31a645aa3a1$var$SynthesisPonyfillManager = ({ isRetorikNews: isRetor
|
|
|
27535
27540
|
refreshTimerRef.current && clearTimeout(refreshTimerRef.current);
|
|
27536
27541
|
};
|
|
27537
27542
|
}, []);
|
|
27538
|
-
return
|
|
27539
|
-
ponyfill:
|
|
27543
|
+
return ponyfillCreated && ponyfillRef.current ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $ad561f5c61e38c20$export$2e2bcd8739ae039), {
|
|
27544
|
+
ponyfill: ponyfillRef.current,
|
|
27540
27545
|
isRetorikNews: isRetorikNews
|
|
27541
27546
|
}) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {});
|
|
27542
27547
|
};
|