@davi-ai/retorik-framework 4.0.1 → 4.0.2

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 CHANGED
@@ -21,6 +21,7 @@ var $dWhh5$opentelemetryinstrumentationdocumentload = require("@opentelemetry/in
21
21
  var $dWhh5$reacterrorboundary = require("react-error-boundary");
22
22
  var $dWhh5$reactshadow = require("react-shadow");
23
23
  var $dWhh5$leaflet = require("leaflet");
24
+ var $dWhh5$daviaivirtualkeyboard = require("@davi-ai/virtual-keyboard");
24
25
  var $dWhh5$adaptivecardslibcardelements = require("adaptivecards/lib/card-elements");
25
26
  var $dWhh5$swchelperscjs_ts_decoratecjs = require("@swc/helpers/cjs/_ts_decorate.cjs");
26
27
  var $dWhh5$daviaiwebspeechcognitiveservicesdavi = require("@davi-ai/web-speech-cognitive-services-davi");
@@ -31803,16 +31804,15 @@ const $edd32e16dfb9e66e$var$Qb = /* @__PURE__ */ $edd32e16dfb9e66e$var$wy($edd32
31803
31804
  t.payload
31804
31805
  ]);
31805
31806
  },
31806
- setCookiesInBrowser: (e)=>{
31807
- const t = e.cookies;
31808
- t.length && (t.forEach((r)=>{
31809
- if (r.indexOf("<conversationId>") > -1) {
31810
- const i = e.conversationId;
31811
- if (i) {
31812
- const n = r.replace("<conversationId>", i);
31807
+ setCookiesInBrowser: (e, t)=>{
31808
+ const r = e.cookies;
31809
+ r.length && (r.forEach((i)=>{
31810
+ if (i.indexOf("<conversationId>") > -1) {
31811
+ if (t.payload) {
31812
+ const n = i.replace("<conversationId>", t.payload);
31813
31813
  document.cookie = n;
31814
31814
  }
31815
- } else document.cookie = r;
31815
+ } else document.cookie = i;
31816
31816
  }), e.cookies = []);
31817
31817
  },
31818
31818
  setCurrentQueue: (e, t)=>{
@@ -31904,10 +31904,10 @@ const $edd32e16dfb9e66e$var$Qb = /* @__PURE__ */ $edd32e16dfb9e66e$var$wy($edd32
31904
31904
  };
31905
31905
  localStorage.setItem(`Retorik.News.Conversation.${r.addRetorikNewsConversationIdInLocalStorage}`, JSON.stringify(n)), i.addRetorikNewsConversationIdInLocalStorage = void 0;
31906
31906
  }
31907
- return e && e !== r.conversationId && (t.dispatch($edd32e16dfb9e66e$var$Zb()), r.conversationId === null ? i.conversationId = e : i = {
31907
+ return e && e !== r.conversationId && (r.conversationId === null ? i.conversationId = e : i = {
31908
31908
  ...$edd32e16dfb9e66e$var$Lu,
31909
31909
  conversationId: e
31910
- }), i;
31910
+ }, t.dispatch($edd32e16dfb9e66e$var$Zb(e))), i;
31911
31911
  }), $edd32e16dfb9e66e$var$gn = $edd32e16dfb9e66e$var$Te("activity/processQueue", async (e, t)=>{
31912
31912
  const r = t.getState().activityReducer;
31913
31913
  if (r.queue.length) {
@@ -32404,14 +32404,14 @@ const $edd32e16dfb9e66e$var$Nc = {
32404
32404
  domain: e.addressData.directline.address,
32405
32405
  conversationId: l.id
32406
32406
  });
32407
- return t.dispatch($edd32e16dfb9e66e$var$rr()), t.dispatch($edd32e16dfb9e66e$var$rn(c)), {
32407
+ return await t.dispatch($edd32e16dfb9e66e$var$rr()), await t.dispatch($edd32e16dfb9e66e$var$rn(c)), {
32408
32408
  userId: e.userId
32409
32409
  };
32410
32410
  } else {
32411
32411
  const l = await $edd32e16dfb9e66e$var$QM(e.addressData.directline.tokenEndpoint);
32412
32412
  if (l) {
32413
32413
  const c = e.userId || `defaultId_${Date.now()}`;
32414
- t.dispatch($edd32e16dfb9e66e$var$rv()), r.externalActivityHandlers.forEach((h)=>{
32414
+ await t.dispatch($edd32e16dfb9e66e$var$rv()), r.externalActivityHandlers.forEach((h)=>{
32415
32415
  h({
32416
32416
  type: $edd32e16dfb9e66e$var$Nc[0]
32417
32417
  });
@@ -32420,7 +32420,7 @@ const $edd32e16dfb9e66e$var$Nc = {
32420
32420
  token: l,
32421
32421
  domain: e.addressData.directline.address
32422
32422
  });
32423
- return t.dispatch($edd32e16dfb9e66e$var$rr()), t.dispatch($edd32e16dfb9e66e$var$rn(d)), t.dispatch($edd32e16dfb9e66e$var$Nu({
32423
+ return await t.dispatch($edd32e16dfb9e66e$var$rr()), await t.dispatch($edd32e16dfb9e66e$var$rn(d)), await t.dispatch($edd32e16dfb9e66e$var$Nu({
32424
32424
  name: "Davi.GDPRConsent",
32425
32425
  value: {
32426
32426
  userConsent: !0
@@ -32501,7 +32501,7 @@ const $edd32e16dfb9e66e$var$Nc = {
32501
32501
  }), $edd32e16dfb9e66e$var$cv = $edd32e16dfb9e66e$var$Te("directline/endConversation", async (e, t)=>{
32502
32502
  var i;
32503
32503
  t.dispatch($edd32e16dfb9e66e$var$rr()), (i = t.getState().directlineReducer.directLine) == null || i.end();
32504
- }), $edd32e16dfb9e66e$var$lv = $edd32e16dfb9e66e$var$Te("directline/resetDirectlineStore", async (e, t)=>(t.dispatch($edd32e16dfb9e66e$var$rr()), t.dispatch($edd32e16dfb9e66e$var$cv()), {
32504
+ }), $edd32e16dfb9e66e$var$lv = $edd32e16dfb9e66e$var$Te("directline/resetDirectlineStore", async (e, t)=>(t.dispatch($edd32e16dfb9e66e$var$rr()), await t.dispatch($edd32e16dfb9e66e$var$cv()), {
32505
32505
  ...$edd32e16dfb9e66e$var$nv
32506
32506
  })), $edd32e16dfb9e66e$var$t9 = $edd32e16dfb9e66e$var$Te("directline/sendMessageToChatbot", async (e, t)=>{
32507
32507
  const r = t.getState();
@@ -32802,31 +32802,26 @@ const $51b67076509d447f$var$Carousel = ({ className: className, medias: medias,
32802
32802
  const [currentIndex, setCurrentIndex] = (0, $dWhh5$react.useState)(0);
32803
32803
  const [currentMedia, setCurrentMedia] = (0, $dWhh5$react.useState)();
32804
32804
  const timerRef = (0, $dWhh5$react.useRef)(null);
32805
- /**
32806
- * On medias state change :
32807
- * - clear timerRef interval if set
32808
- * - call startNewMedia to reset medias
32809
- * - if there are more than 1 media, set a timeout and launch it
32810
- * On component unmount :
32811
- * - clear timerRef interval if set
32812
- */ (0, $dWhh5$react.useEffect)(()=>{
32813
- // Clear interval
32814
- timerRef.current && clearInterval(timerRef.current);
32805
+ const startTimer = ()=>{
32806
+ if (medias.length > 1 && timer !== 0) {
32807
+ timerRef.current && clearTimeout(timerRef.current);
32808
+ timerRef.current = setTimeout(handleMore, timer || 3000);
32809
+ }
32810
+ };
32811
+ (0, $dWhh5$react.useEffect)(()=>{
32812
+ // Clear timeout
32813
+ timerRef.current && clearTimeout(timerRef.current);
32815
32814
  // Call the reset function to set currentIndex and currentMedia states
32816
32815
  startNewMedias();
32817
32816
  // Launch timer only if there are more than 1 media
32818
- if (medias.length > 1 && timer !== 0) timerRef.current = setTimeout(()=>{
32819
- handleMore();
32820
- }, timer || 3000);
32821
- return ()=>timerRef.current && clearTimeout(timerRef.current);
32817
+ startTimer();
32818
+ return ()=>{
32819
+ (timerRef === null || timerRef === void 0 ? void 0 : timerRef.current) && clearTimeout(timerRef.current);
32820
+ };
32822
32821
  }, [
32823
32822
  medias
32824
32823
  ]);
32825
- /**
32826
- * On currentIndex state change :
32827
- * - check type of media in medias array at current index by calling checkType method
32828
- * - set currentMedia state
32829
- */ (0, $dWhh5$react.useEffect)(()=>{
32824
+ (0, $dWhh5$react.useEffect)(()=>{
32830
32825
  if (currentIndex !== undefined) {
32831
32826
  const index = currentIndex % medias.length;
32832
32827
  const type = checkType(medias[index].url);
@@ -32836,51 +32831,40 @@ const $51b67076509d447f$var$Carousel = ({ className: className, medias: medias,
32836
32831
  type: type
32837
32832
  });
32838
32833
  // Reset timer only if there are more than 1 media
32839
- if (medias.length > 1 && timer !== 0) {
32840
- timerRef.current && clearTimeout(timerRef.current);
32841
- timerRef.current = setTimeout(()=>{
32842
- handleMore();
32843
- }, timer || 3000);
32844
- }
32834
+ if (medias.length > 1 && timer !== 0) startTimer();
32845
32835
  }
32846
32836
  }
32847
32837
  }, [
32848
32838
  currentIndex
32849
32839
  ]);
32850
- /**
32851
- * On call :
32852
- * - check if the currentIndex state is 0
32853
- * - if so, if we just update this state to 0 it will remain the same and won't change the currentMedia state. We just leave currentIndex as is and set currentMedia state instead.
32854
- * - otherwise, set the currentIndex state to 0
32855
- */ const startNewMedias = ()=>{
32840
+ const startNewMedias = ()=>{
32856
32841
  if (currentIndex === 0) {
32857
32842
  const type = checkType(medias[0].url);
32858
- if (type) setCurrentMedia({
32843
+ type && setCurrentMedia({
32859
32844
  ...medias[0],
32860
32845
  type: type
32861
32846
  });
32862
32847
  } else setCurrentIndex(0);
32863
32848
  };
32864
32849
  /**
32865
- * On call :
32866
- * - retrieve the extension of the media
32867
- * - return if it's either an image, or a video, or null
32850
+ * Retrieve the extension of the media and return if it's either an image, a video, or null
32868
32851
  * @param src : string
32869
32852
  * @returns number | null
32870
32853
  */ const checkType = (src)=>{
32871
- const extension = src.split('.').slice(-1)[0];
32854
+ const url = src.split('?')[0];
32855
+ const extension = url.split('.').slice(-1)[0].toLowerCase();
32872
32856
  return $51b67076509d447f$var$images.includes(extension.toLowerCase()) ? 1 : $51b67076509d447f$var$videos.includes(extension.toLowerCase()) ? 2 : null;
32873
32857
  };
32874
32858
  const handleChoice = (choice)=>{
32875
32859
  setCurrentIndex(choice);
32876
32860
  };
32877
32861
  const handleLess = ()=>{
32878
- currentIndex === 0 ? setCurrentIndex(medias.length - 1) : setCurrentIndex((currentIndex)=>currentIndex - 1);
32862
+ if (medias.length > 1) currentIndex === 0 ? setCurrentIndex(medias.length - 1) : setCurrentIndex((currentIndex)=>currentIndex - 1);
32879
32863
  };
32880
32864
  const handleMore = ()=>{
32881
- currentIndex === medias.length - 1 ? setCurrentIndex(0) : setCurrentIndex((currentIndex)=>currentIndex + 1);
32865
+ if (medias.length > 1) setCurrentIndex((prev)=>prev === medias.length - 1 ? 0 : prev + 1);
32882
32866
  };
32883
- return currentMedia && currentMedia.type ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {
32867
+ return (currentMedia === null || currentMedia === void 0 ? void 0 : currentMedia.type) ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {
32884
32868
  children: [
32885
32869
  currentMedia.type === 1 ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("img", {
32886
32870
  className: className,
@@ -32894,6 +32878,10 @@ const $51b67076509d447f$var$Carousel = ({ className: className, medias: medias,
32894
32878
  style: {
32895
32879
  maxHeight: maxHeight
32896
32880
  },
32881
+ autoPlay: true,
32882
+ muted: true,
32883
+ loop: medias.length === 1,
32884
+ onEnded: handleMore,
32897
32885
  children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("source", {
32898
32886
  src: currentMedia.url
32899
32887
  })
@@ -32912,7 +32900,8 @@ const $51b67076509d447f$var$Carousel = ({ className: className, medias: medias,
32912
32900
  }, `${media.url}${key}`);
32913
32901
  })
32914
32902
  }),
32915
- /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
32903
+ /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("button", {
32904
+ "aria-label": "Previous",
32916
32905
  className: "rf-absolute rf-left-4 rf-top-1/2 -rf-translate-y-1/2 rf-cursor-pointer",
32917
32906
  onClick: handleLess,
32918
32907
  children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $a1QE2.default), {
@@ -32920,7 +32909,8 @@ const $51b67076509d447f$var$Carousel = ({ className: className, medias: medias,
32920
32909
  color: "#FFF"
32921
32910
  })
32922
32911
  }),
32923
- /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
32912
+ /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("button", {
32913
+ "aria-label": "Next",
32924
32914
  className: "rf-absolute rf-right-4 rf-top-1/2 -rf-translate-y-1/2 rf-cursor-pointer",
32925
32915
  onClick: handleMore,
32926
32916
  children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $a4tZ1.default), {
@@ -33058,14 +33048,6 @@ $parcel$export(module.exports, "default", () => $071bb34c9db044ce$export$2e2bcd8
33058
33048
 
33059
33049
 
33060
33050
  var $kpW3P = parcelRequire("kpW3P");
33061
- var $071bb34c9db044ce$var$EventsReceived = /*#__PURE__*/ function(EventsReceived) {
33062
- EventsReceived[EventsReceived["retorikSendActivity"] = 1] = "retorikSendActivity";
33063
- EventsReceived[EventsReceived["retorikSendEvent"] = 2] = "retorikSendEvent";
33064
- EventsReceived[EventsReceived["retorikStartListening"] = 3] = "retorikStartListening";
33065
- EventsReceived[EventsReceived["retorikDisplaySubtitles"] = 4] = "retorikDisplaySubtitles";
33066
- EventsReceived[EventsReceived["retorikSetVisibility"] = 5] = "retorikSetVisibility";
33067
- return EventsReceived;
33068
- }($071bb34c9db044ce$var$EventsReceived || {});
33069
33051
  const $071bb34c9db044ce$var$SendActivityEventListener = ({ isRetorikNews: isRetorikNews, hasConversationCookie: hasConversationCookie, userData: userData })=>{
33070
33052
  const dispatch = (0, $dWhh5$reactredux.useDispatch)();
33071
33053
  const displayGDPR = (0, $dWhh5$reactredux.useSelector)((state)=>state.utilsReducer.GDPRDisplay);
@@ -33076,7 +33058,7 @@ const $071bb34c9db044ce$var$SendActivityEventListener = ({ isRetorikNews: isReto
33076
33058
  const userAlreadySet = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.userAlreadySet);
33077
33059
  const characterLoaded = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.characterLoaded);
33078
33060
  /**
33079
- * Send mandatory events : setUser to start conversation, Davi.GDPRConsent for GDPR module
33061
+ * Send mandatory events : Davi.GDPRConsent for GDPR module then setUser to start conversation
33080
33062
  */ const sendMandatoryEvents = async ()=>{
33081
33063
  dispatch((0, $kpW3P.storeActions).directline.sendEvent({
33082
33064
  name: 'Davi.GDPRConsent',
@@ -36589,7 +36571,7 @@ var $71d6c880af885c00$export$2e2bcd8739ae039 = $71d6c880af885c00$var$Version;
36589
36571
 
36590
36572
  });
36591
36573
  parcelRegister("93cl9", function(module, exports) {
36592
- module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"4.0.1\",\"homepage\":\".\",\"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 -force\"},\"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.12\",\"@davi-ai/retorik-map\":\"4.0.2\",\"@davi-ai/retorik-weather\":\"2.0.0\",\"@davi-ai/speechmarkdown-davi-js\":\"2.0.1\",\"@davi-ai/web-speech-cognitive-services-davi\":\"3.0.0\",\"@lottiefiles/react-lottie-player\":\"^3.4.1\",\"@mediapipe/tasks-vision\":\"^0.10.22-rc.20250304\",\"@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\",\"classnames\":\"^2.3.1\",\"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-redux\":\"^9.2.0\",\"react-shadow\":\"^20.5.0\",\"swiper\":\"^8.4.5\"},\"overrides\":{\"@davi-ai/web-speech-cognitive-services-davi\":\"$@davi-ai/web-speech-cognitive-services-davi\"},\"@parcel/resolver-default\":{\"packageExports\":true}}");
36574
+ module.exports = JSON.parse("{\"name\":\"@davi-ai/retorik-framework\",\"version\":\"4.0.2\",\"homepage\":\".\",\"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 -force\"},\"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.12\",\"@davi-ai/retorik-map\":\"4.0.2\",\"@davi-ai/retorik-weather\":\"2.0.0\",\"@davi-ai/speechmarkdown-davi-js\":\"2.0.1\",\"@davi-ai/virtual-keyboard\":\"1.0.1\",\"@davi-ai/web-speech-cognitive-services-davi\":\"3.0.0\",\"@lottiefiles/react-lottie-player\":\"^3.4.1\",\"@mediapipe/tasks-vision\":\"0.10.32\",\"@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\",\"classnames\":\"^2.3.1\",\"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-redux\":\"^9.2.0\",\"react-shadow\":\"^20.5.0\",\"swiper\":\"^8.4.5\"},\"overrides\":{\"@davi-ai/web-speech-cognitive-services-davi\":\"$@davi-ai/web-speech-cognitive-services-davi\"},\"@parcel/resolver-default\":{\"packageExports\":true}}");
36593
36575
 
36594
36576
  });
36595
36577
 
@@ -44161,11 +44143,6 @@ module.exports = Promise.resolve(require("./NewsContainer.c0a24775.js")).then(()
44161
44143
  });
44162
44144
 
44163
44145
 
44164
- parcelRegister("4gset", function(module, exports) {
44165
- module.exports = Promise.resolve(require("./VeilleManager.46a9de36.js")).then(()=>parcelRequire('jtgpJ'));
44166
-
44167
- });
44168
-
44169
44146
  parcelRegister("50fTr", function(module, exports) {
44170
44147
  module.exports = Promise.resolve(require("./ThreeJsWrapper.4302165c.js")).then(()=>parcelRequire('3QHCU'));
44171
44148
 
@@ -44176,6 +44153,11 @@ module.exports = Promise.resolve(require("./SpiritEngineWrapper.39627300.js")).t
44176
44153
 
44177
44154
  });
44178
44155
 
44156
+ parcelRegister("4gset", function(module, exports) {
44157
+ module.exports = Promise.resolve(require("./VeilleManager.26dcadac.js")).then(()=>parcelRequire('jtgpJ'));
44158
+
44159
+ });
44160
+
44179
44161
 
44180
44162
  $parcel$defineInteropFlag(module.exports);
44181
44163
 
@@ -50116,13 +50098,14 @@ const $c610b7db00433cde$var$RetorikComposer = ({ addressData: addressData, userD
50116
50098
  const conversationCookie = (_document_cookie_split_find = document.cookie.split('; ').find((row)=>row.startsWith('retorikConversationCookie='))) === null || _document_cookie_split_find === void 0 ? void 0 : _document_cookie_split_find.split('=')[1];
50117
50099
  if (conversationCookie) {
50118
50100
  const splitCookieData = conversationCookie.split('||');
50119
- if (splitCookieData.length === 2) {
50101
+ if (splitCookieData.length === 3) {
50120
50102
  const cookieConversationId = splitCookieData[0];
50121
50103
  const cookieTenantName = splitCookieData[1];
50104
+ const cookieConversationToken = splitCookieData[2];
50122
50105
  const fullTenantName = (addressData.baseURI || `${addressData.prefix || ''}${addressData.tenant}`).replace(/;|,|\s/g, '');
50123
50106
  if (cookieTenantName === fullTenantName) {
50124
50107
  setDirectLineCreationData({
50125
- token: token,
50108
+ token: cookieConversationToken || token,
50126
50109
  domain: directLineData.address,
50127
50110
  conversationId: cookieConversationId,
50128
50111
  watermark: '0'
@@ -50136,7 +50119,7 @@ const $c610b7db00433cde$var$RetorikComposer = ({ addressData: addressData, userD
50136
50119
  } else {
50137
50120
  const fullTenantName = (addressData.baseURI || `${addressData.prefix || ''}${addressData.tenant}`).replace(/;|,|\s/g, '');
50138
50121
  const maxAge = configuration.conversationCookieMaxAge || 3600;
50139
- dispatch((0, $kpW3P.storeActions).activity.addCookie(`retorikConversationCookie=<conversationId>||${fullTenantName}; max-age=${maxAge}`));
50122
+ dispatch((0, $kpW3P.storeActions).activity.addCookie(`retorikConversationCookie=<conversationId>||${fullTenantName}||${token}; max-age=${maxAge}`));
50140
50123
  }
50141
50124
  }
50142
50125
  test && setDirectLineCreationData({
@@ -50178,9 +50161,9 @@ const $c610b7db00433cde$var$RetorikComposer = ({ addressData: addressData, userD
50178
50161
  connectionStatus,
50179
50162
  calibrationCompleted
50180
50163
  ]);
50181
- return connectionStatus === (0, $kpW3P.ConnectionStatus).Online && agentData && processedUserData ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {
50164
+ return agentData && processedUserData ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {
50182
50165
  children: [
50183
- /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $7JzH7.default), {
50166
+ connectionStatus === (0, $kpW3P.ConnectionStatus).Online && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $7JzH7.default), {
50184
50167
  isRetorikNews: isRetorikNews,
50185
50168
  hasConversationCookie: hasConversationCookie,
50186
50169
  userData: processedUserData
@@ -53821,16 +53804,12 @@ const $3b4c49538547c1bc$var$WarningBeforeNewsView = ()=>{
53821
53804
  var $3b4c49538547c1bc$export$2e2bcd8739ae039 = $3b4c49538547c1bc$var$WarningBeforeNewsView;
53822
53805
 
53823
53806
 
53824
-
53825
- const $1e3451b8a577006c$var$VeilleManager = /*#__PURE__*/ (0, $dWhh5$react.lazy)(()=>(parcelRequire("4gset")));
53826
53807
  const $1e3451b8a577006c$var$RetorikRouter = (props)=>{
53827
53808
  const dispatch = (0, $dWhh5$reactredux.useDispatch)();
53828
53809
  const isUsedOnBorne = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.configuration.isUsedOnBorne);
53829
53810
  const mode = (0, $dWhh5$reactredux.useSelector)((state)=>state.speechReducer.mode);
53830
- const veilleConfiguration = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.veilleConfiguration);
53831
53811
  const route = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.route);
53832
53812
  const lastBotEvent = (0, $dWhh5$reactredux.useSelector)((state)=>state.activityReducer.lastBotEventActivity);
53833
- const [veilleEnabled, setVeilleEnabled] = (0, $dWhh5$react.useState)(false);
53834
53813
  (0, $dWhh5$react.useEffect)(()=>{
53835
53814
  if (lastBotEvent) switch(lastBotEvent.name){
53836
53815
  case 'news.ShowFlashInfo':
@@ -53845,20 +53824,12 @@ const $1e3451b8a577006c$var$RetorikRouter = (props)=>{
53845
53824
  }, [
53846
53825
  lastBotEvent
53847
53826
  ]);
53848
- (0, $dWhh5$react.useEffect)(()=>{
53849
- setVeilleEnabled(!!veilleConfiguration.enabled);
53850
- }, [
53851
- veilleConfiguration
53852
- ]);
53853
53827
  return /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {
53854
53828
  children: [
53855
53829
  route === (0, $7WHA7.Routes).Home ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $6c3069cd619942d1$export$2e2bcd8739ae039), {
53856
53830
  ...props
53857
53831
  }) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {}),
53858
- route === (0, $7WHA7.Routes).News ? mode === (0, $7WHA7.Mode).vocal || !!isUsedOnBorne ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $2sSL9.default), {}) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $3b4c49538547c1bc$export$2e2bcd8739ae039), {}) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {}),
53859
- veilleEnabled && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $dWhh5$react.Suspense), {
53860
- children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)($1e3451b8a577006c$var$VeilleManager, {})
53861
- })
53832
+ route === (0, $7WHA7.Routes).News ? mode === (0, $7WHA7.Mode).vocal || !!isUsedOnBorne ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $2sSL9.default), {}) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $3b4c49538547c1bc$export$2e2bcd8739ae039), {}) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, ($parcel$interopDefault($dWhh5$react))).Fragment, {})
53862
53833
  ]
53863
53834
  });
53864
53835
  };
@@ -53902,6 +53873,7 @@ var $9ccee10030bde87b$export$2e2bcd8739ae039 = $9ccee10030bde87b$var$ModalFullsc
53902
53873
 
53903
53874
  const $9242b50f1c1199a7$var$Container = ({ fullSize: fullSize, width: width, height: height, children: children, parent: parent })=>{
53904
53875
  const dispatch = (0, $dWhh5$reactredux.useDispatch)();
53876
+ const locale = (0, $dWhh5$reactredux.useSelector)((state)=>state.localeReducer.locale);
53905
53877
  const themeColors = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.themeColors);
53906
53878
  const currentDeviceType = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.currentDeviceType);
53907
53879
  const isTactile = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.isTactile);
@@ -55941,11 +55913,34 @@ const $8f73b7a6f73661a7$var$ThreeJsWrapper = /*#__PURE__*/ (0, $dWhh5$react.lazy
55941
55913
 
55942
55914
  const $8f73b7a6f73661a7$var$SpiritEngineWrapper = /*#__PURE__*/ (0, $dWhh5$react.lazy)(()=>(parcelRequire("4nh3H")));
55943
55915
  const $8f73b7a6f73661a7$var$intervalInMilliseconds = 100;
55944
- const $8f73b7a6f73661a7$var$ChatbotAndSubtitlesContainer = ({ centered: centered, chatbotData: chatbotData, showSubtitles: showSubtitles, isNewsView: isNewsView, visible: visible })=>{
55916
+ const $8f73b7a6f73661a7$var$ChatbotAndSubtitlesContainer = ({ centered: centered, chatbotData: chatbotData, isNewsView: isNewsView, parent: parent })=>{
55945
55917
  const dispatch = (0, $dWhh5$reactredux.useDispatch)();
55946
55918
  const agentData = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.agentData);
55947
55919
  const speaking = (0, $dWhh5$reactredux.useSelector)((state)=>state.speechReducer.speaking);
55948
55920
  const boundaryData = (0, $dWhh5$reactredux.useSelector)((state)=>state.speechReducer.boundaryData);
55921
+ const mode = (0, $dWhh5$reactredux.useSelector)((state)=>state.speechReducer.mode);
55922
+ const displayAgentInNews = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.displayAgentInNews);
55923
+ const displayAgent = (0, $dWhh5$reactredux.useSelector)((state)=>state.utilsReducer.displayAgent);
55924
+ const route = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.route);
55925
+ const isMobile = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.isMobile);
55926
+ const visibility = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.visibility);
55927
+ const isNews = (0, $dWhh5$react.useMemo)(()=>{
55928
+ return parent === (0, $7WHA7.ContainerParent).news || route === (0, $7WHA7.Routes).News;
55929
+ }, [
55930
+ parent,
55931
+ route
55932
+ ]);
55933
+ const isAgentVisible = (0, $dWhh5$react.useMemo)(()=>{
55934
+ return displayAgent && !(isNews && !displayAgentInNews) && !(isMobile && mode === (0, $7WHA7.Mode).text) && route !== (0, $7WHA7.Routes).EmptyVeille && route !== (0, $7WHA7.Routes).ScreenSaver && route !== (0, $7WHA7.Routes).SlideShow && visibility === 'visible';
55935
+ }, [
55936
+ mode,
55937
+ isMobile,
55938
+ displayAgent,
55939
+ displayAgentInNews,
55940
+ isNews,
55941
+ visibility,
55942
+ route
55943
+ ]);
55949
55944
  const [speechIntervals, setSpeechIntervals] = (0, $dWhh5$react.useState)([]);
55950
55945
  const [isSpeaking, setIsSpeaking] = (0, $dWhh5$react.useState)(false);
55951
55946
  const [elapsedTime, setElapsedTime] = (0, $dWhh5$react.useState)(0);
@@ -56034,18 +56029,18 @@ const $8f73b7a6f73661a7$var$ChatbotAndSubtitlesContainer = ({ centered: centered
56034
56029
  children: [
56035
56030
  /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)("div", {
56036
56031
  id: "retorik-animation-container",
56037
- className: `rf-relative rf-z-agent rf-col-start-1 rf-col-end-9 ${!centered && 'landscape-retorik:-rf-translate-x-1/4'} rf-row-span-full rf-self-end rf-h-full`,
56032
+ className: `rf-relative rf-z-agent rf-col-start-1 rf-col-end-9 ${(!centered || isNews) && 'landscape-retorik:-rf-translate-x-1/4'} rf-row-span-full rf-self-end rf-h-full`,
56038
56033
  style: {
56039
- visibility: visible ? 'visible' : 'hidden',
56034
+ visibility: isAgentVisible ? 'visible' : 'hidden',
56040
56035
  gridRow: `${gridRowStart} / span ${gridRowSpan}`
56041
56036
  },
56042
56037
  onClick: (e)=>handleClick(e),
56043
56038
  children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $dWhh5$react.Suspense), {
56044
56039
  children: agentData.useBodyEngineThree ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)($8f73b7a6f73661a7$var$ThreeJsWrapper, {
56045
56040
  agentData: agentData,
56046
- visible: visible,
56041
+ visible: isAgentVisible,
56047
56042
  ...chatbotData,
56048
- centered: !!centered
56043
+ centered: !!(centered && !isNews)
56049
56044
  }) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)($8f73b7a6f73661a7$var$SpiritEngineWrapper, {
56050
56045
  agentData: agentData,
56051
56046
  height: chatbotData === null || chatbotData === void 0 ? void 0 : chatbotData.height,
@@ -56054,7 +56049,7 @@ const $8f73b7a6f73661a7$var$ChatbotAndSubtitlesContainer = ({ centered: centered
56054
56049
  })
56055
56050
  })
56056
56051
  }),
56057
- showSubtitles && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $c6f26ebf51eadf8c$export$2e2bcd8739ae039), {
56052
+ !isNews && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $c6f26ebf51eadf8c$export$2e2bcd8739ae039), {
56058
56053
  isSpeaking: isSpeaking,
56059
56054
  elapsedTime: elapsedTime
56060
56055
  })
@@ -56064,35 +56059,116 @@ const $8f73b7a6f73661a7$var$ChatbotAndSubtitlesContainer = ({ centered: centered
56064
56059
  var $8f73b7a6f73661a7$export$2e2bcd8739ae039 = $8f73b7a6f73661a7$var$ChatbotAndSubtitlesContainer;
56065
56060
 
56066
56061
 
56067
- // Overload adaptive card rendering classes
56068
- (0, $85d8b0d1ec40dae5$export$6108075486421829)();
56069
- const $bbc725a084d1069a$var$RetorikContainer = ({ config: config, viewsConfig: viewsConfig, veilleConfig: veilleConfig, mapConfig: mapConfig, chatbotData: chatbotData, chatbotDataWidget: chatbotDataWidget, agentData: agentData, ponyfillFactoryCredentials: ponyfillFactoryCredentials, addressData: addressData, userData: userData, skipLoader: skipLoader, defaultMode: defaultMode, customVoice: customVoice, externalEventHandler: externalEventHandler, externalComponents: externalComponents, width: width, height: height, colors: colors, parent: parent })=>{
56062
+
56063
+
56064
+
56065
+
56066
+ var $kpW3P = parcelRequire("kpW3P");
56067
+
56068
+ const $a698bbd1dffc9091$var$VeilleManager = /*#__PURE__*/ (0, $dWhh5$react.lazy)(()=>(parcelRequire("4gset")));
56069
+ const $a698bbd1dffc9091$var$VeilleContainer = ()=>{
56070
56070
  const dispatch = (0, $dWhh5$reactredux.useDispatch)();
56071
- const currentLayout = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.currentLayout);
56072
- const mode = (0, $dWhh5$reactredux.useSelector)((state)=>state.speechReducer.mode);
56073
- const processedAgentData = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.agentData);
56074
- const displayAgentInNews = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.displayAgentInNews);
56075
- const displayAgent = (0, $dWhh5$reactredux.useSelector)((state)=>state.utilsReducer.displayAgent);
56076
- const route = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.route);
56077
- const isMobile = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.isMobile);
56078
- const visibility = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.visibility);
56079
- const isNews = (0, $dWhh5$react.useMemo)(()=>{
56080
- return parent === (0, $7WHA7.ContainerParent).news || route === (0, $7WHA7.Routes).News;
56071
+ const addressData = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.addressData);
56072
+ const veilleConfiguration = (0, $dWhh5$reactredux.useSelector)((state)=>state.viewReducer.veilleConfiguration);
56073
+ const veilleEnabled = (0, $dWhh5$reactredux.useSelector)((state)=>!!state.viewReducer.veilleConfiguration.enabled);
56074
+ const loaderClosed = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.loaderClosed);
56075
+ const appAvailable = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.appAvailable);
56076
+ const typingCount = (0, $dWhh5$reactredux.useSelector)((state)=>state.directlineReducer.typingCount);
56077
+ const [applicationReady, setApplicationReady] = (0, $dWhh5$react.useState)(false);
56078
+ const [veilleLaunched, setVeilleLaunched] = (0, $dWhh5$react.useState)(false);
56079
+ const timerRef = (0, $dWhh5$react.useRef)(null);
56080
+ const veilleConfigurationRef = (0, $dWhh5$react.useRef)(veilleConfiguration);
56081
+ const veilleEnabledRef = (0, $dWhh5$react.useRef)(veilleEnabled);
56082
+ const veilleLaunchedRef = (0, $dWhh5$react.useRef)(false);
56083
+ (0, $dWhh5$react.useEffect)(()=>{
56084
+ if (loaderClosed || appAvailable) setApplicationReady(true);
56081
56085
  }, [
56082
- parent,
56083
- route
56086
+ loaderClosed,
56087
+ appAvailable
56084
56088
  ]);
56085
- const isAgentVisible = (0, $dWhh5$react.useMemo)(()=>{
56086
- return displayAgent && !(isNews && !displayAgentInNews) && !(isMobile && mode === (0, $7WHA7.Mode).text) && route !== (0, $7WHA7.Routes).EmptyVeille && route !== (0, $7WHA7.Routes).ScreenSaver && route !== (0, $7WHA7.Routes).SlideShow && visibility === 'visible';
56089
+ (0, $dWhh5$react.useEffect)(()=>{
56090
+ if (!veilleEnabled) {
56091
+ veilleEnabledRef.current = veilleEnabled;
56092
+ timerRef.current && clearTimeout(timerRef.current);
56093
+ onClose();
56094
+ } else if (applicationReady) veilleEnabledRef.current = veilleEnabled;
56087
56095
  }, [
56088
- mode,
56089
- isMobile,
56090
- displayAgent,
56091
- displayAgentInNews,
56092
- isNews,
56093
- visibility,
56094
- route
56096
+ veilleEnabled,
56097
+ applicationReady
56098
+ ]);
56099
+ (0, $dWhh5$react.useEffect)(()=>{
56100
+ veilleLaunchedRef.current = veilleLaunched;
56101
+ }, [
56102
+ veilleLaunched
56095
56103
  ]);
56104
+ const refreshTimer = async ()=>{
56105
+ timerRef.current && clearTimeout(timerRef.current);
56106
+ timerRef.current = setTimeout(async ()=>{
56107
+ var _veilleConfigurationRef_current;
56108
+ if ((_veilleConfigurationRef_current = veilleConfigurationRef.current) === null || _veilleConfigurationRef_current === void 0 ? void 0 : _veilleConfigurationRef_current.killConversationOnLaunch) {
56109
+ var // Reset directline if a new one has already been recreated for the news inside the veille
56110
+ _veilleConfigurationRef_current_views_news, _veilleConfigurationRef_current_views;
56111
+ ((_veilleConfigurationRef_current_views = veilleConfigurationRef.current.views) === null || _veilleConfigurationRef_current_views === void 0 ? void 0 : (_veilleConfigurationRef_current_views_news = _veilleConfigurationRef_current_views.news) === null || _veilleConfigurationRef_current_views_news === void 0 ? void 0 : _veilleConfigurationRef_current_views_news.enabled) && await dispatch((0, $kpW3P.storeActions).directline.endConversation());
56112
+ await dispatch((0, $kpW3P.storeActions).directline.recreateDirectline({
56113
+ addressData: addressData,
56114
+ userId: `veille_${Date.now()}`,
56115
+ skipWelcome: true
56116
+ }));
56117
+ }
56118
+ setVeilleLaunched(true);
56119
+ }, (veilleConfiguration.delayBeforeLaunchInSeconds || 120) * 1000);
56120
+ };
56121
+ (0, $dWhh5$react.useEffect)(()=>{
56122
+ return ()=>{
56123
+ timerRef.current && clearTimeout(timerRef.current);
56124
+ };
56125
+ }, []);
56126
+ /**
56127
+ * Refresh the timer of the veille on each typing activity emitted
56128
+ */ (0, $dWhh5$react.useEffect)(()=>{
56129
+ if (!veilleLaunchedRef.current && veilleEnabledRef.current) refreshTimer();
56130
+ }, [
56131
+ typingCount
56132
+ ]);
56133
+ const onClose = async ()=>{
56134
+ if (veilleLaunchedRef.current) {
56135
+ var _veilleConfigurationRef_current;
56136
+ // Kill and recreate directline if needed
56137
+ if ((_veilleConfigurationRef_current = veilleConfigurationRef.current) === null || _veilleConfigurationRef_current === void 0 ? void 0 : _veilleConfigurationRef_current.killConversationOnLaunch) {
56138
+ var // Reset directline if a new one has already been recreated for the news inside the veille
56139
+ _veilleConfigurationRef_current_views_news, _veilleConfigurationRef_current_views;
56140
+ ((_veilleConfigurationRef_current_views = veilleConfigurationRef.current.views) === null || _veilleConfigurationRef_current_views === void 0 ? void 0 : (_veilleConfigurationRef_current_views_news = _veilleConfigurationRef_current_views.news) === null || _veilleConfigurationRef_current_views_news === void 0 ? void 0 : _veilleConfigurationRef_current_views_news.enabled) && await dispatch((0, $kpW3P.storeActions).directline.endConversation());
56141
+ await dispatch((0, $kpW3P.storeActions).directline.recreateDirectline({
56142
+ addressData: addressData
56143
+ }));
56144
+ }
56145
+ setVeilleLaunched(false);
56146
+ }
56147
+ veilleEnabledRef.current && refreshTimer();
56148
+ };
56149
+ return veilleLaunched ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $dWhh5$react.Suspense), {
56150
+ children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)($a698bbd1dffc9091$var$VeilleManager, {
56151
+ onClose: onClose
56152
+ })
56153
+ }) : null;
56154
+ };
56155
+ var $a698bbd1dffc9091$export$2e2bcd8739ae039 = $a698bbd1dffc9091$var$VeilleContainer;
56156
+
56157
+
56158
+
56159
+ const $bbc725a084d1069a$var$VirtualKeyboard = /*#__PURE__*/ (0, $dWhh5$react.lazy)(()=>Promise.resolve($dWhh5$daviaivirtualkeyboard).then((module)=>{
56160
+ var _module_default;
56161
+ return {
56162
+ default: (_module_default = module.default) !== null && _module_default !== void 0 ? _module_default : module
56163
+ };
56164
+ }));
56165
+ // Overload adaptive card rendering classes
56166
+ (0, $85d8b0d1ec40dae5$export$6108075486421829)();
56167
+ const $bbc725a084d1069a$var$RetorikContainer = ({ config: config, viewsConfig: viewsConfig, veilleConfig: veilleConfig, mapConfig: mapConfig, chatbotData: chatbotData, chatbotDataWidget: chatbotDataWidget, agentData: agentData, ponyfillFactoryCredentials: ponyfillFactoryCredentials, addressData: addressData, userData: userData, skipLoader: skipLoader, defaultMode: defaultMode, customVoice: customVoice, externalEventHandler: externalEventHandler, externalComponents: externalComponents, width: width, height: height, colors: colors, parent: parent, enableVirtualKeyboard: enableVirtualKeyboard })=>{
56168
+ const dispatch = (0, $dWhh5$reactredux.useDispatch)();
56169
+ const locale = (0, $dWhh5$reactredux.useSelector)((state)=>state.localeReducer.locale);
56170
+ const currentLayout = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.currentLayout);
56171
+ const processedAgentData = (0, $dWhh5$reactredux.useSelector)((state)=>state.retorikReducer.agentData);
56096
56172
  (0, $dWhh5$react.useEffect)(()=>{
56097
56173
  dispatch((0, $kpW3P.storeActions).view.setThemeColors((0, $68ec406cc754e31c$export$2e2bcd8739ae039)(colors)));
56098
56174
  }, []);
@@ -56126,16 +56202,23 @@ const $bbc725a084d1069a$var$RetorikContainer = ({ config: config, viewsConfig: v
56126
56202
  parent: parent,
56127
56203
  children: [
56128
56204
  processedAgentData && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $8f73b7a6f73661a7$export$2e2bcd8739ae039), {
56129
- centered: chatbotData.fullWidthInDesktopMode && !isNews,
56205
+ centered: chatbotData.fullWidthInDesktopMode,
56130
56206
  chatbotData: currentLayout === (0, $7WHA7.ContainerParent).agent ? chatbotData : chatbotDataWidget,
56131
- showSubtitles: !isNews,
56132
- visible: isAgentVisible
56207
+ parent: parent
56133
56208
  }),
56134
56209
  parent === (0, $7WHA7.ContainerParent).news ? /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $2sSL9.default), {
56135
56210
  hideMenu: true,
56136
56211
  isRetorikNews: true
56137
56212
  }) : /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $1e3451b8a577006c$export$2e2bcd8739ae039), {
56138
56213
  externalComponents: externalComponents
56214
+ }),
56215
+ /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $a698bbd1dffc9091$export$2e2bcd8739ae039), {}),
56216
+ enableVirtualKeyboard && /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)((0, $dWhh5$react.Suspense), {
56217
+ children: /*#__PURE__*/ (0, $dWhh5$reactjsxruntime.jsx)($bbc725a084d1069a$var$VirtualKeyboard, {
56218
+ locale: locale,
56219
+ onlyOnTactileDevices: false,
56220
+ onlyWithRetorikFramework: true
56221
+ })
56139
56222
  })
56140
56223
  ]
56141
56224
  }),
@@ -56222,7 +56305,7 @@ var $9569bd86e01b07fd$export$2e2bcd8739ae039 = $9569bd86e01b07fd$var$Loader;
56222
56305
 
56223
56306
 
56224
56307
 
56225
- const $ce7633a58d99dcca$var$RetorikConfigHandler = ({ config: config, viewsConfig: viewsConfig, veilleConfig: veilleConfig, mapConfig: mapConfig, chatbotData: chatbotData, chatbotDataWidget: chatbotDataWidget, agentData: agentData, ponyfillFactoryCredentials: ponyfillFactoryCredentials, customVoice: customVoice, colors: colors, skipLoader: skipLoader, defaultMode: defaultMode, GDPR: GDPR, customScripts: customScripts, customCSS: customCSS, addressData: addressData, externalEventHandler: externalEventHandler, externalComponents: externalComponents, userData: userData, width: width, height: height, menuConfig: menuConfig, environmentPreset: environmentPreset, parent: parent })=>{
56308
+ const $ce7633a58d99dcca$var$RetorikConfigHandler = ({ config: config, viewsConfig: viewsConfig, veilleConfig: veilleConfig, mapConfig: mapConfig, chatbotData: chatbotData, chatbotDataWidget: chatbotDataWidget, agentData: agentData, ponyfillFactoryCredentials: ponyfillFactoryCredentials, customVoice: customVoice, colors: colors, skipLoader: skipLoader, defaultMode: defaultMode, GDPR: GDPR, customScripts: customScripts, customCSS: customCSS, addressData: addressData, externalEventHandler: externalEventHandler, externalComponents: externalComponents, userData: userData, width: width, height: height, menuConfig: menuConfig, environmentPreset: environmentPreset, parent: parent, enableVirtualKeyboard: enableVirtualKeyboard })=>{
56226
56309
  const dispatch = (0, $dWhh5$reactredux.useDispatch)();
56227
56310
  const baseAddress = (0, $dWhh5$reactredux.useSelector)((state)=>state.localeReducer.baseAddress);
56228
56311
  const [fetchedConfig, setFetchedConfig] = (0, $dWhh5$react.useState)();
@@ -56249,7 +56332,8 @@ const $ce7633a58d99dcca$var$RetorikConfigHandler = ({ config: config, viewsConfi
56249
56332
  userData: userData,
56250
56333
  width: width,
56251
56334
  height: height,
56252
- menuConfig: menuConfig
56335
+ menuConfig: menuConfig,
56336
+ enableVirtualKeyboard: enableVirtualKeyboard
56253
56337
  }, baseAddress);
56254
56338
  console.log('Retorik Framework > configuration fetched from Retorik Studio');
56255
56339
  fetchedConfig && setFetchedConfig(fetchedConfig);
@@ -56348,7 +56432,8 @@ const $ce7633a58d99dcca$var$RetorikConfigHandler = ({ config: config, viewsConfi
56348
56432
  externalEventHandler: externalEventHandler,
56349
56433
  externalComponents: externalComponents,
56350
56434
  width: width,
56351
- height: height
56435
+ height: height,
56436
+ enableVirtualKeyboard: enableVirtualKeyboard
56352
56437
  };
56353
56438
  // Prevent menus from being copied again after each modification of configuration
56354
56439
  if (mergedMainConfig.config) {