@davi-ai/retorik-framework 4.0.0 → 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.
@@ -42,27 +42,15 @@ var $62g7u = parcelRequire("62g7u");
42
42
 
43
43
  var $kBIQ4 = parcelRequire("kBIQ4");
44
44
  const $ae415dac8b23893c$var$springDuration = 500;
45
- const $ae415dac8b23893c$var$veilleRelatedRoutes = [
46
- (0, $4ucVo.Routes).EmptyVeille,
47
- (0, $4ucVo.Routes).NewsInVeille,
48
- (0, $4ucVo.Routes).ScreenSaver,
49
- (0, $4ucVo.Routes).SlideShow
50
- ];
51
- const $ae415dac8b23893c$var$VeilleManager = ()=>{
45
+ const $ae415dac8b23893c$var$VeilleManager = ({ onClose: onClose })=>{
52
46
  const dispatch = (0, $1cDKu$useDispatch)();
53
- const addressData = (0, $1cDKu$useSelector)((state)=>state.retorikReducer.addressData);
54
- const loaderClosed = (0, $1cDKu$useSelector)((state)=>state.retorikReducer.loaderClosed);
55
- const appAvailable = (0, $1cDKu$useSelector)((state)=>state.retorikReducer.appAvailable);
56
47
  const route = (0, $1cDKu$useSelector)((state)=>state.viewReducer.route);
57
48
  const veilleConfiguration = (0, $1cDKu$useSelector)((state)=>state.viewReducer.veilleConfiguration);
58
49
  const muted = (0, $1cDKu$useSelector)((state)=>state.speechReducer.muted);
59
- const typingCount = (0, $1cDKu$useSelector)((state)=>state.directlineReducer.typingCount);
60
- const [veilleLaunched, setVeilleLaunched] = (0, $1cDKu$useState)(false);
61
50
  const [loop, setLoop] = (0, $1cDKu$useState)(false);
62
51
  const veilleDataRef = (0, $1cDKu$useRef)(veilleConfiguration);
63
52
  const availableItemsToDisplayRef = (0, $1cDKu$useRef)([]);
64
53
  const currentItemDisplayedRef = (0, $1cDKu$useRef)(0);
65
- const timerRef = (0, $1cDKu$useRef)(null);
66
54
  const fadeTimerRef = (0, $1cDKu$useRef)(null);
67
55
  const oldMutedRef = (0, $1cDKu$useRef)(muted);
68
56
  const [spring, api] = (0, $1cDKu$useSpring)(()=>({
@@ -71,7 +59,7 @@ const $ae415dac8b23893c$var$VeilleManager = ()=>{
71
59
  }
72
60
  }));
73
61
  (0, $1cDKu$useEffect)(()=>{
74
- veilleLaunched && api.start({
62
+ api.start({
75
63
  from: {
76
64
  opacity: 0
77
65
  },
@@ -82,9 +70,7 @@ const $ae415dac8b23893c$var$VeilleManager = ()=>{
82
70
  duration: $ae415dac8b23893c$var$springDuration
83
71
  }
84
72
  });
85
- }, [
86
- veilleLaunched
87
- ]);
73
+ }, []);
88
74
  const handleClose = ()=>{
89
75
  api.start({
90
76
  from: {
@@ -103,47 +89,9 @@ const $ae415dac8b23893c$var$VeilleManager = ()=>{
103
89
  dispatch((0, $8ItUL.storeActions).speech.setMuted(oldMutedRef.current));
104
90
  // Get back to home view
105
91
  dispatch((0, $8ItUL.storeActions).view.setRoute((0, $4ucVo.Routes).Home));
92
+ onClose();
106
93
  }, $ae415dac8b23893c$var$springDuration);
107
94
  };
108
- const launchVeille = async ()=>{
109
- // Kill current directline if needed, and create a new one if the news are included in the veille
110
- if (veilleDataRef.current.killConversationOnLaunch) {
111
- await dispatch((0, $8ItUL.storeActions).directline.endConversation());
112
- veilleDataRef.current.views?.news?.enabled && dispatch((0, $8ItUL.storeActions).directline.recreateDirectline({
113
- addressData: addressData,
114
- userId: `veille_${Date.now()}`,
115
- skipWelcome: true
116
- }));
117
- }
118
- // Set muted state to true if it is demanded in the configuration
119
- veilleDataRef.current.views?.news?.muted && dispatch((0, $8ItUL.storeActions).speech.setMuted(true));
120
- setVeilleLaunched(true);
121
- dispatch((0, $8ItUL.storeActions).view.setRoute(availableItemsToDisplayRef.current.length ? availableItemsToDisplayRef.current[0] : (0, $4ucVo.Routes).EmptyVeille));
122
- };
123
- const refreshTimer = ()=>{
124
- timerRef.current && clearTimeout(timerRef.current);
125
- timerRef.current = setTimeout(()=>{
126
- launchVeille();
127
- }, (veilleDataRef.current.delayBeforeLaunchInSeconds || 120) * 1000);
128
- };
129
- const exitVeille = (firstTime)=>{
130
- // Recreate directline if needed
131
- if (!firstTime && veilleDataRef.current?.killConversationOnLaunch) {
132
- // Reset directline if a new one has already been recreated for the news inside the veille
133
- veilleDataRef.current.views?.news?.enabled && dispatch((0, $8ItUL.storeActions).directline.endConversation());
134
- dispatch((0, $8ItUL.storeActions).directline.recreateDirectline({
135
- addressData: addressData
136
- }));
137
- }
138
- setVeilleLaunched(false);
139
- // Set back the current item's index to 0 and clear the timeout
140
- currentItemDisplayedRef.current = 0;
141
- timerRef.current && clearTimeout(timerRef.current);
142
- // Launch the timer for veille opening
143
- refreshTimer();
144
- // Get back to home view if we came here to close the veille
145
- !firstTime && handleClose();
146
- };
147
95
  const switchComponent = ()=>{
148
96
  if (availableItemsToDisplayRef.current.length > currentItemDisplayedRef.current + 1) {
149
97
  currentItemDisplayedRef.current++;
@@ -155,32 +103,18 @@ const $ae415dac8b23893c$var$VeilleManager = ()=>{
155
103
  };
156
104
  (0, $1cDKu$useEffect)(()=>{
157
105
  veilleDataRef.current = veilleConfiguration;
158
- if (appAvailable || loaderClosed) {
159
- const tempViewArray = [];
160
- veilleConfiguration.views?.screenSaver?.enabled && tempViewArray.push((0, $4ucVo.Routes).ScreenSaver);
161
- veilleConfiguration.views?.news?.enabled && tempViewArray.push((0, $4ucVo.Routes).NewsInVeille);
162
- veilleConfiguration.views?.slideShow?.enabled && tempViewArray.push((0, $4ucVo.Routes).SlideShow);
163
- // Set loop if there is only 1 item to display
164
- setLoop(tempViewArray.length === 1);
165
- availableItemsToDisplayRef.current = tempViewArray;
166
- exitVeille(true);
167
- }
168
- }, [
169
- veilleConfiguration,
170
- appAvailable,
171
- loaderClosed
172
- ]);
173
- /**
174
- * Refresh the timer of the veille on each typing activity emitted
175
- */ (0, $1cDKu$useEffect)(()=>{
176
- !veilleLaunched && refreshTimer();
177
- }, [
178
- typingCount,
179
- veilleLaunched
180
- ]);
181
- (0, $1cDKu$useEffect)(()=>{
106
+ const tempViewArray = [];
107
+ veilleConfiguration.views?.screenSaver?.enabled && tempViewArray.push((0, $4ucVo.Routes).ScreenSaver);
108
+ veilleConfiguration.views?.news?.enabled && tempViewArray.push((0, $4ucVo.Routes).NewsInVeille);
109
+ veilleConfiguration.views?.slideShow?.enabled && tempViewArray.push((0, $4ucVo.Routes).SlideShow);
110
+ // Set loop if there is only 1 item to display
111
+ setLoop(tempViewArray.length === 1);
112
+ availableItemsToDisplayRef.current = tempViewArray;
113
+ currentItemDisplayedRef.current = 0;
114
+ // Mute the sound if the news in veille has to be muted
115
+ veilleDataRef.current.views?.news?.muted && dispatch((0, $8ItUL.storeActions).speech.setMuted(true));
116
+ dispatch((0, $8ItUL.storeActions).view.setRoute(availableItemsToDisplayRef.current.length ? availableItemsToDisplayRef.current[0] : (0, $4ucVo.Routes).EmptyVeille));
182
117
  return ()=>{
183
- timerRef.current && clearTimeout(timerRef.current);
184
118
  fadeTimerRef?.current && clearTimeout(fadeTimerRef.current);
185
119
  // Switch back the muted state (it could have not been changed but for security let's set it)
186
120
  dispatch((0, $8ItUL.storeActions).speech.setMuted(oldMutedRef.current));
@@ -190,16 +124,15 @@ const $ae415dac8b23893c$var$VeilleManager = ()=>{
190
124
  children: [
191
125
  /*#__PURE__*/ (0, $1cDKu$jsxs)((0, $1cDKu$animated).div, {
192
126
  id: "retorik-framework-veille-manager",
193
- className: "rf-relative rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-grid-cols-8 rf-grid-rows-12",
127
+ className: "rf-relative rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-grid rf-grid-cols-8 rf-grid-rows-12",
194
128
  style: {
195
- display: $ae415dac8b23893c$var$veilleRelatedRoutes.includes(route) ? 'grid' : 'none',
196
129
  ...spring
197
130
  },
198
131
  children: [
199
132
  /*#__PURE__*/ (0, $1cDKu$jsx)((0, $lmkZT.default), {}),
200
- veilleConfiguration.autoExitFromWebcam && veilleLaunched && /*#__PURE__*/ (0, $1cDKu$jsx)((0, $dJb7j.default), {
133
+ veilleConfiguration.autoExitFromWebcam && /*#__PURE__*/ (0, $1cDKu$jsx)((0, $dJb7j.default), {
201
134
  detectionThreshold: 0.95,
202
- onFaceDetected: ()=>exitVeille()
135
+ onFaceDetected: ()=>handleClose()
203
136
  }),
204
137
  route === (0, $4ucVo.Routes).EmptyVeille && /*#__PURE__*/ (0, $1cDKu$jsx)((0, $9fA0k.default), {}),
205
138
  route === (0, $4ucVo.Routes).NewsInVeille && /*#__PURE__*/ (0, $1cDKu$jsx)((0, $6Wtfz.default), {
@@ -225,9 +158,9 @@ const $ae415dac8b23893c$var$VeilleManager = ()=>{
225
158
  })
226
159
  ]
227
160
  }),
228
- veilleLaunched && /*#__PURE__*/ (0, $1cDKu$jsx)("div", {
161
+ /*#__PURE__*/ (0, $1cDKu$jsx)("div", {
229
162
  className: "rf-z-overlay rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-bg-transparent rf-cursor-pointer",
230
- onClick: ()=>exitVeille()
163
+ onClick: ()=>handleClose()
231
164
  })
232
165
  ]
233
166
  });
@@ -302,18 +235,24 @@ $parcel$export(module.exports, "default", () => $741aef3293d0db11$export$2e2bcd8
302
235
 
303
236
 
304
237
 
305
-
306
238
  const $741aef3293d0db11$var$runningMode = 'VIDEO';
307
239
  let $741aef3293d0db11$var$lastVideoTime = -1;
308
- const $741aef3293d0db11$var$constraints = {
309
- video: true,
310
- facingMode: 'user'
240
+ const $741aef3293d0db11$var$defaultConstraints = {
241
+ video: {
242
+ facingMode: 'user'
243
+ }
311
244
  };
312
- const $741aef3293d0db11$var$FaceDetector = ({ detectionThreshold: detectionThreshold, onFaceDetected: onFaceDetected })=>{
313
- const currentWidth = (0, $1cDKu$useSelector)((state)=>state.viewReducer.currentWidth);
314
- const currentHeight = (0, $1cDKu$useSelector)((state)=>state.viewReducer.currentHeight);
245
+ const $741aef3293d0db11$var$FaceDetector = ({ detectionThreshold: detectionThreshold, onFaceDetected: onFaceDetected, showThumbnail: showThumbnail, rotation: rotation })=>{
246
+ const [webcamWidth, setWebcamWidth] = (0, $1cDKu$useState)(0);
247
+ const [webcamHeight, setWebcamHeight] = (0, $1cDKu$useState)(0);
315
248
  const [faceDetector, setFaceDetector] = (0, $1cDKu$useState)();
316
249
  const videoRef = (0, $1cDKu$useRef)(null);
250
+ const rotationRef = (0, $1cDKu$useRef)(rotation || 0);
251
+ (0, $1cDKu$useEffect)(()=>{
252
+ rotationRef.current = rotation || 0;
253
+ }, [
254
+ rotation
255
+ ]);
317
256
  (0, $1cDKu$useEffect)(()=>{
318
257
  const createfaceDetector = async ()=>{
319
258
  const vision = await (0, $1cDKu$FilesetResolver).forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.0/wasm');
@@ -327,7 +266,10 @@ const $741aef3293d0db11$var$FaceDetector = ({ detectionThreshold: detectionThres
327
266
  newFaceDetector && setFaceDetector(newFaceDetector);
328
267
  };
329
268
  const initializefaceDetector = async ()=>{
330
- navigator.mediaDevices.getUserMedia($741aef3293d0db11$var$constraints).then(()=>{
269
+ navigator.mediaDevices.getUserMedia($741aef3293d0db11$var$defaultConstraints).then((display)=>{
270
+ const settings = display.getVideoTracks()[0].getSettings();
271
+ setWebcamWidth(settings.width || 0);
272
+ setWebcamHeight(settings.height || 0);
331
273
  createfaceDetector();
332
274
  }).catch((error)=>console.warn('Retorik Framework > an error occured when trying to use the webcam : ', error));
333
275
  };
@@ -339,7 +281,9 @@ const $741aef3293d0db11$var$FaceDetector = ({ detectionThreshold: detectionThres
339
281
  // Detect faces using detectForVideo
340
282
  if (videoRef.current.currentTime !== $741aef3293d0db11$var$lastVideoTime) {
341
283
  $741aef3293d0db11$var$lastVideoTime = videoRef.current.currentTime;
342
- const detections = faceDetector.detectForVideo(videoRef.current, startTimeMs).detections;
284
+ const detections = faceDetector.detectForVideo(videoRef.current, startTimeMs, {
285
+ rotationDegrees: rotationRef.current
286
+ }).detections;
343
287
  if (detections.length) {
344
288
  const score = detections[0].categories[0].score;
345
289
  score > detectionThreshold && onFaceDetected(detections, videoRef.current.videoWidth, videoRef.current.videoHeight);
@@ -350,8 +294,8 @@ const $741aef3293d0db11$var$FaceDetector = ({ detectionThreshold: detectionThres
350
294
  window.requestAnimationFrame(predictWebcam);
351
295
  };
352
296
  (0, $1cDKu$useEffect)(()=>{
353
- if (faceDetector && videoRef.current) // Activate the webcam stream.
354
- navigator.mediaDevices.getUserMedia($741aef3293d0db11$var$constraints).then((stream)=>{
297
+ if (faceDetector && videoRef.current) // Activate the webcam stream
298
+ navigator.mediaDevices.getUserMedia($741aef3293d0db11$var$defaultConstraints).then((stream)=>{
355
299
  if (videoRef.current) {
356
300
  videoRef.current.srcObject = stream;
357
301
  videoRef.current.addEventListener('loadeddata', predictWebcam);
@@ -364,15 +308,15 @@ const $741aef3293d0db11$var$FaceDetector = ({ detectionThreshold: detectionThres
364
308
  ]);
365
309
  return /*#__PURE__*/ (0, $1cDKu$jsx)("div", {
366
310
  id: "retorik-framework-face-detector",
367
- className: "rf-absolute rf-top-0 rf-left-0 rf-invisible",
311
+ className: `rf-absolute rf-top-0 rf-left-0 ${!showThumbnail && 'rf-invisible'}`,
368
312
  children: /*#__PURE__*/ (0, $1cDKu$jsx)("video", {
369
313
  ref: videoRef,
370
314
  src: "",
371
315
  autoPlay: true,
372
316
  style: {
373
- width: currentWidth > currentHeight ? currentWidth : undefined,
374
- height: currentHeight > currentWidth ? currentHeight : undefined,
375
- aspectRatio: currentWidth / currentHeight
317
+ rotate: `${rotation}deg`,
318
+ width: showThumbnail ? webcamWidth / 2 : webcamWidth,
319
+ height: showThumbnail ? webcamHeight / 2 : webcamHeight
376
320
  }
377
321
  })
378
322
  });
@@ -547,4 +491,4 @@ var $8ccf4a1e66e2b9e3$export$2e2bcd8739ae039 = $8ccf4a1e66e2b9e3$var$SlideShow;
547
491
 
548
492
 
549
493
 
550
- //# sourceMappingURL=VeilleManager.d8bde1ee.js.map
494
+ //# sourceMappingUR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S;YACX;YACA,IAAI;gBACF,SAAS;YACX;YACA,QAAQ;gBACN,UAAU;YACZ;QACF;QAEA,cAAc,WAAW,aAAa,aAAa,OAAO;QAC1D,aAAa,OAAO,GAAG,WAAW;YAChC,wBAAwB;YACxB;QACF,GAAG;IACL;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,UAAU,WAAW,aAAa,SAAS,OAAO;QAClD,IAAI,MAAM,QACR,SAAS,OAAO,GAAG,WAAW;YAC5B,iBAAiB,KAAK,MAAM,GAAG,IAAK,OAAO,gBAAgB,KAAK,gBAAiB,gBAAgB,eAAe;QAClH,GAAG,AAAC,CAAA,SAAS,CAAA,IAAK;aAElB;IAEJ,GAAG;QAAC;KAAa;IAEjB,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,UAAU,WAAW,aAAa,SAAS,OAAO;YAClD,cAAc,WAAW,aAAa,aAAa,OAAO;QAC5D;IACF,GAAG,EAAE;IAEL,qBACE,gBAAC,CAAA,GAAA,eAAO,EAAE,GAAG;QAAC,WAAU;QAAwH,OAAO;YAAE,GAAG,MAAM;QAAC;kBACjK,cAAA,gBAAC;YAAI,WAAW,GAAG,OAAO,WAAW,GAAG,OAAO,UAAU,GAAG,cAAc,aAAa;YAAE,KAAK,MAAM,CAAC,aAAa,IAAI;YAAI,KAAI;;;AAGpI;IAEA,2CAAe","sources":["src/components/Veille/VeilleManager.tsx","src/components/Veille/CallToAction.tsx","src/components/Icons/Miscellaneous/TouchIcon.tsx","src/components/Veille/FaceDetector.tsx","src/components/Veille/EmptyVeille.tsx","src/components/Veille/ScreenSaver.tsx","src/components/Veille/SlideShow.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react'\r\nimport { useSpring, animated } from '@react-spring/web'\r\nimport { useSelector, useDispatch } from 'react-redux'\r\nimport { RootState, storeActions } from '../../store'\r\n\r\nimport { Routes } from '../../models/enums'\r\nimport type { VeilleConfiguration } from '../../models/types'\r\n\r\nimport NewsView from '../Views/NewsView'\r\nimport CallToAction from './CallToAction'\r\nimport FaceDetector from './FaceDetector'\r\nimport EmptyVeille from './EmptyVeille'\r\nimport ScreenSaver from './ScreenSaver'\r\nimport SlideShow from './SlideShow'\r\n\r\nconst springDuration = 500\r\n\r\ninterface VeilleManagerProps {\r\n onClose: () => void\r\n}\r\n\r\nconst VeilleManager = ({ onClose }: VeilleManagerProps) => {\r\n const dispatch = useDispatch()\r\n const route = useSelector((state: RootState) => state.viewReducer.route)\r\n const veilleConfiguration = useSelector((state: RootState) => state.viewReducer.veilleConfiguration)\r\n const muted = useSelector((state: RootState) => state.speechReducer.muted)\r\n\r\n const [loop, setLoop] = useState<boolean>(false)\r\n\r\n const veilleDataRef = useRef<VeilleConfiguration>(veilleConfiguration)\r\n const availableItemsToDisplayRef = useRef<Array<Routes>>([])\r\n const currentItemDisplayedRef = useRef<number>(0)\r\n const fadeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const oldMutedRef = useRef<boolean>(muted)\r\n\r\n const [spring, api] = useSpring(() => ({\r\n from: { opacity: 0 }\r\n }))\r\n\r\n useEffect(() => {\r\n api.start({\r\n from: { opacity: 0 },\r\n to: { opacity: 1 },\r\n config: { duration: springDuration }\r\n })\r\n }, [])\r\n\r\n const handleClose = (): void => {\r\n api.start({\r\n from: { opacity: 1 },\r\n to: { opacity: 0 },\r\n config: { duration: springDuration }\r\n })\r\n\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n fadeTimerRef.current = setTimeout(() => {\r\n // Switch back the muted state (it could have not been changed but for security let's set it)\r\n dispatch(storeActions.speech.setMuted(oldMutedRef.current))\r\n // Get back to home view\r\n dispatch(storeActions.view.setRoute(Routes.Home))\r\n onClose()\r\n }, springDuration)\r\n }\r\n\r\n const switchComponent = (): void => {\r\n if (availableItemsToDisplayRef.current.length > currentItemDisplayedRef.current + 1) {\r\n currentItemDisplayedRef.current++\r\n dispatch(storeActions.view.setRoute(availableItemsToDisplayRef.current[currentItemDisplayedRef.current]))\r\n } else {\r\n currentItemDisplayedRef.current = 0\r\n dispatch(storeActions.view.setRoute(availableItemsToDisplayRef.current[0]))\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n veilleDataRef.current = veilleConfiguration\r\n const tempViewArray: Array<Routes> = []\r\n veilleConfiguration.views?.screenSaver?.enabled && tempViewArray.push(Routes.ScreenSaver)\r\n veilleConfiguration.views?.news?.enabled && tempViewArray.push(Routes.NewsInVeille)\r\n veilleConfiguration.views?.slideShow?.enabled && tempViewArray.push(Routes.SlideShow)\r\n // Set loop if there is only 1 item to display\r\n setLoop(tempViewArray.length === 1)\r\n availableItemsToDisplayRef.current = tempViewArray\r\n currentItemDisplayedRef.current = 0\r\n // Mute the sound if the news in veille has to be muted\r\n veilleDataRef.current.views?.news?.muted && dispatch(storeActions.speech.setMuted(true))\r\n dispatch(storeActions.view.setRoute(availableItemsToDisplayRef.current.length ? availableItemsToDisplayRef.current[0] : Routes.EmptyVeille))\r\n\r\n return () => {\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n // Switch back the muted state (it could have not been changed but for security let's set it)\r\n dispatch(storeActions.speech.setMuted(oldMutedRef.current))\r\n }\r\n }, [])\r\n\r\n return (\r\n <React.Fragment>\r\n <animated.div\r\n id='retorik-framework-veille-manager'\r\n className='rf-relative rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-grid rf-grid-cols-8 rf-grid-rows-12'\r\n style={{\r\n ...spring\r\n }}\r\n >\r\n <CallToAction />\r\n {veilleConfiguration.autoExitFromWebcam && <FaceDetector detectionThreshold={0.95} onFaceDetected={() => handleClose()} />}\r\n\r\n {route === Routes.EmptyVeille && <EmptyVeille />}\r\n {route === Routes.NewsInVeille && <NewsView hideMenu={true} isRetorikNews={true} handleEndedWithoutloop={switchComponent} loop={loop} fromVeille={true} />}\r\n {route === Routes.ScreenSaver && (\r\n <ScreenSaver\r\n url={veilleConfiguration.views?.screenSaver?.url}\r\n timer={veilleConfiguration.views?.screenSaver?.timerBeforeSwitchInSeconds}\r\n loop={loop}\r\n springDuration={springDuration}\r\n switchComponent={switchComponent}\r\n />\r\n )}\r\n {route === Routes.SlideShow && (\r\n <SlideShow\r\n urls={veilleConfiguration.views?.slideShow?.urls}\r\n timer={veilleConfiguration.views?.slideShow?.timerBeforeSwitchInSeconds}\r\n loop={loop}\r\n springDuration={springDuration}\r\n switchComponent={switchComponent}\r\n />\r\n )}\r\n </animated.div>\r\n\r\n {/* Overlay to exit the veille */}\r\n <div className='rf-z-overlay rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-bg-transparent rf-cursor-pointer' onClick={() => handleClose()} />\r\n </React.Fragment>\r\n )\r\n}\r\n\r\nexport default VeilleManager\r\n","import React, { useState } from 'react'\r\nimport { useSelector } from 'react-redux'\r\nimport { RootState } from '../../store'\r\nimport { getColorWithTransparency } from '../../utils/colorUtils'\r\nimport TouchIcon from '../Icons/Miscellaneous/TouchIcon'\r\n\r\nconst CallToAction = (): JSX.Element => {\r\n const themeColors = useSelector((state: RootState) => state.viewReducer.themeColors)\r\n const [colorWithTransparency] = useState<string>(getColorWithTransparency(themeColors.primary, 0.5))\r\n\r\n return (\r\n <div className='rf-absolute rf-z-ui rf-bottom-0 rf-right-0 rf-w-80 rf-h-80 rf-grid rf-grid-cols-1 rf-grid-rows-1 rf-justify-end rf-justify-items-end rf-content-end rf-items-end rf-text-center rf-overflow-hidden rf-z-10'>\r\n <div className='rf-relative rf-col-start-1 rf-col-end-2 rf-row-start-1 rf-row-end-2 rf-w-48 rf-h-36 rf-rotate-45 rf-translate-y-8' style={{ backgroundColor: colorWithTransparency }}></div>\r\n <div className='rf-relative rf-col-start-1 rf-col-end-2 rf-row-start-1 rf-row-end-2 rf-w-50 rf-h-32 rf-flex rf-flex-col rf-gap-2 rf-justify-center rf-items-center rf-text-white'>\r\n <TouchIcon />\r\n <p className='rf-mx-4'>Click on screen to start</p>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default CallToAction\r\n","import React from \"react\";\r\nimport type { IconDefaultProps } from '../../../models/types'\r\n\r\nconst TouchIcon = ({ className, color }: IconDefaultProps) => {\r\n return (\r\n <svg\r\n viewBox=\"0 0 48 67\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n stroke={color || 'currentColor'}\r\n fill={color || 'currentColor'}\r\n className={className || 'rf-h-12 rf-w-12'}\r\n >\r\n <path\r\n d=\"m41 24c-1.7 0-3.2 0.65-4.4 1.7-1.2-1.1-2.7-1.7-4.4-1.7-1.7 0-3.2 0.65-4.4 1.7-0.48-0.44-1-0.8-1.6-1.1 2.1-2.6 3.4-6 3.4-9.5 2.8e-4 -8.3-6.7-15-15-15-8.3 0-15 6.7-15 15 0 5.8 3.3 11 8.4 13v18c0 11 8.9 20 20 20 11 0 20-8.9 20-20v-16c0-3.6-2.9-6.6-6.6-6.6zm-37-8.8c0-5.9 4.8-11 11-11 5.9 0 11 4.8 11 11 0 3.4-1.6 6.5-4.1 8.5v-8.5c0-3.6-2.9-6.6-6.6-6.6-3.6 0-6.6 2.9-6.6 6.6v8.5c-2.6-2-4.1-5.1-4.1-8.5zm39 32c0 8.5-6.9 15-15 15-8.5 0-15-6.9-15-15v-20c4e-3 -0.072 4e-3 -0.14 0-0.22v-12c0-1.2 1-2.3 2.3-2.3 1.2 0 2.3 1 2.3 2.3v20c0 1.2 0.96 2.1 2.1 2.1 1.2 0 2.1-0.96 2.1-2.1v-4.7c0-1.2 1-2.3 2.3-2.3s2.3 1 2.3 2.3v4.7c0 1.2 0.96 2.1 2.1 2.1 1.2 0 2.1-0.96 2.1-2.1v-4.7c0-1.2 1-2.3 2.3-2.3 1.2 0 2.3 1 2.3 2.3v4.7c0 1.2 0.96 2.1 2.1 2.1s2.1-0.96 2.1-2.1v-4.7c0-1.2 1-2.3 2.3-2.3 1.2 0 2.3 1 2.3 2.3v16z\"\r\n strokeWidth=\".29\"\r\n />\r\n </svg>\r\n );\r\n};\r\n\r\nexport default TouchIcon;\r\n","import React, { useEffect, useState, useRef } from 'react'\r\nimport { FaceDetector as MediapipeFaceDetector, FilesetResolver, Detection } from '@mediapipe/tasks-vision'\r\n\r\ninterface FaceDetectorProps {\r\n detectionThreshold: number\r\n onFaceDetected: (detections?: Array<Detection>, imageWidth?: number, imageHeight?: number) => void\r\n showThumbnail?: boolean\r\n rotation?: number\r\n}\r\n\r\nconst runningMode = 'VIDEO'\r\nlet lastVideoTime = -1\r\nconst defaultConstraints: MediaStreamConstraints = {\r\n video: {\r\n facingMode: 'user'\r\n }\r\n}\r\n\r\nconst FaceDetector = ({ detectionThreshold, onFaceDetected, showThumbnail, rotation }: FaceDetectorProps): JSX.Element => {\r\n const [webcamWidth, setWebcamWidth] = useState<number>(0)\r\n const [webcamHeight, setWebcamHeight] = useState<number>(0)\r\n const [faceDetector, setFaceDetector] = useState<MediapipeFaceDetector | undefined>()\r\n const videoRef = useRef<HTMLVideoElement>(null)\r\n const rotationRef = useRef<number>(rotation || 0)\r\n\r\n useEffect(() => {\r\n rotationRef.current = rotation || 0\r\n }, [rotation])\r\n\r\n useEffect(() => {\r\n const createfaceDetector = async () => {\r\n const vision = await FilesetResolver.forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.0/wasm')\r\n const newFaceDetector = await MediapipeFaceDetector.createFromOptions(vision, {\r\n baseOptions: {\r\n modelAssetPath: `https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite`,\r\n delegate: 'GPU'\r\n },\r\n runningMode: runningMode\r\n })\r\n\r\n newFaceDetector && setFaceDetector(newFaceDetector)\r\n }\r\n\r\n const initializefaceDetector = async () => {\r\n navigator.mediaDevices\r\n .getUserMedia(defaultConstraints)\r\n .then((display) => {\r\n const settings = display.getVideoTracks()[0].getSettings()\r\n setWebcamWidth(settings.width || 0)\r\n setWebcamHeight(settings.height || 0)\r\n createfaceDetector()\r\n })\r\n .catch((error) => console.warn('Retorik Framework > an error occured when trying to use the webcam : ', error))\r\n }\r\n\r\n initializefaceDetector()\r\n }, [])\r\n\r\n const predictWebcam = async () => {\r\n if (faceDetector && videoRef.current) {\r\n let startTimeMs = performance.now()\r\n\r\n // Detect faces using detectForVideo\r\n if (videoRef.current.currentTime !== lastVideoTime) {\r\n lastVideoTime = videoRef.current.currentTime\r\n const detections = faceDetector.detectForVideo(videoRef.current, startTimeMs, { rotationDegrees: rotationRef.current }).detections\r\n\r\n if (detections.length) {\r\n const score = detections[0].categories[0].score\r\n score > detectionThreshold && onFaceDetected(detections, videoRef.current.videoWidth, videoRef.current.videoHeight)\r\n }\r\n }\r\n }\r\n\r\n // Call this function again to keep predicting when the browser is ready\r\n window.requestAnimationFrame(predictWebcam)\r\n }\r\n\r\n useEffect(() => {\r\n if (faceDetector && videoRef.current) {\r\n // Activate the webcam stream\r\n navigator.mediaDevices\r\n .getUserMedia(defaultConstraints)\r\n .then((stream) => {\r\n if (videoRef.current) {\r\n videoRef.current.srcObject = stream\r\n videoRef.current.addEventListener('loadeddata', predictWebcam)\r\n }\r\n })\r\n .catch((err) => {\r\n console.error(err)\r\n })\r\n }\r\n }, [faceDetector])\r\n\r\n return (\r\n <div id='retorik-framework-face-detector' className={`rf-absolute rf-top-0 rf-left-0 ${!showThumbnail && 'rf-invisible'}`}>\r\n <video\r\n ref={videoRef}\r\n src=''\r\n autoPlay\r\n style={{\r\n rotate: `${rotation}deg`,\r\n width: showThumbnail ? webcamWidth / 2 : webcamWidth,\r\n height: showThumbnail ? webcamHeight / 2 : webcamHeight\r\n }}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nexport default FaceDetector\r\n","import React from 'react'\r\n\r\nconst EmptyVeille = () => {\r\n return (\r\n <div className='rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-bg-black rf-flex rf-justify-center rf-items-center'>\r\n <div className='rf-uppercase rf-font-bold rf-text-3xl rf-text-white rf-animate-pulse'>click or tap on the screen...</div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default EmptyVeille\r\n","import React, { useEffect, useRef } from 'react'\r\nimport { useSpring, animated } from '@react-spring/web'\r\n\r\ninterface ScreenSaverProps {\r\n url?: string\r\n timer?: number\r\n loop?: boolean\r\n springDuration: number\r\n switchComponent: () => void\r\n}\r\n\r\nconst ScreenSaver = ({ url, timer, loop, springDuration, switchComponent }: ScreenSaverProps) => {\r\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const fadeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n\r\n const [spring, api] = useSpring(() => ({\r\n from: {\r\n opacity: 0\r\n }\r\n }))\r\n\r\n useEffect(() => {\r\n api.start({\r\n from: {\r\n opacity: 0\r\n },\r\n to: {\r\n opacity: 1\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n }, [])\r\n\r\n const handleClose = (): void => {\r\n api.start({\r\n from: {\r\n opacity: 1\r\n },\r\n to: {\r\n opacity: 0\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n fadeTimerRef.current = setTimeout(() => {\r\n // Get back to home view\r\n switchComponent()\r\n }, springDuration)\r\n }\r\n\r\n useEffect(() => {\r\n if (!loop) {\r\n timerRef.current = setTimeout(() => {\r\n handleClose()\r\n }, (timer || 8) * 1000 - springDuration)\r\n }\r\n\r\n return () => {\r\n timerRef.current && clearTimeout(timerRef.current)\r\n fadeTimerRef.current && clearTimeout(fadeTimerRef.current)\r\n }\r\n }, [])\r\n\r\n return (\r\n <animated.div\r\n className='rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full'\r\n style={{\r\n backgroundImage: `url(${url})`,\r\n backgroundPosition: 'center',\r\n backgroundRepeat: 'no-repeat',\r\n backgroundSize: 'cover',\r\n ...spring\r\n }}\r\n />\r\n )\r\n}\r\n\r\nexport default ScreenSaver\r\n","import React, { useEffect, useState, useRef } from 'react'\r\nimport { useSpring, animated } from '@react-spring/web'\r\n\r\ninterface SlideShowProps {\r\n urls?: Array<string>\r\n timer?: number\r\n loop?: boolean\r\n springDuration: number\r\n switchComponent: () => void\r\n}\r\n\r\nconst SlideShow = ({ urls, timer, loop, springDuration, switchComponent }: SlideShowProps) => {\r\n const [currentIndex, setCurrentIndex] = useState<number>(0)\r\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const fadeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n\r\n const [spring, api] = useSpring(() => ({\r\n from: {\r\n opacity: 0\r\n }\r\n }))\r\n\r\n useEffect(() => {\r\n api.start({\r\n from: {\r\n opacity: 0\r\n },\r\n to: {\r\n opacity: 1\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n }, [])\r\n\r\n const handleClose = (): void => {\r\n api.start({\r\n from: {\r\n opacity: 1\r\n },\r\n to: {\r\n opacity: 0\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n fadeTimerRef.current = setTimeout(() => {\r\n // Get back to home view\r\n switchComponent()\r\n }, springDuration)\r\n }\r\n\r\n useEffect(() => {\r\n timerRef?.current && clearTimeout(timerRef.current)\r\n if (urls?.length) {\r\n timerRef.current = setTimeout(() => {\r\n currentIndex === urls.length - 1 ? (loop ? setCurrentIndex(0) : handleClose()) : setCurrentIndex(currentIndex + 1)\r\n }, (timer || 5) * 1000)\r\n } else {\r\n switchComponent()\r\n }\r\n }, [currentIndex])\r\n\r\n useEffect(() => {\r\n return () => {\r\n timerRef?.current && clearTimeout(timerRef.current)\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n }\r\n }, [])\r\n\r\n return (\r\n <animated.div className='rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-flex rf-justify-center rf-items-center rf-bg-black' style={{ ...spring }}>\r\n <img className={`${window.innerHeight > window.innerWidth ? 'rf-w-full' : 'rf-h-full'}`} src={urls?.[currentIndex] || ''} alt='slideshow' />\r\n </animated.div>\r\n )\r\n}\r\n\r\nexport default SlideShow\r\n"],"names":[],"version":3,"file":"VeilleManager.72cf0e9c.js.map"}
package/dist/index.d.ts CHANGED
@@ -411,6 +411,28 @@ export interface ChatbotData extends ContainerPosition {
411
411
  height?: number | string;
412
412
  fullWidthInDesktopMode?: boolean;
413
413
  cameraPreset?: keyof typeof _presets1;
414
+ calibration?: {
415
+ static?: {
416
+ enabled: boolean;
417
+ loadStaticTargetFromLocalStorage?: boolean;
418
+ staticTarget?: {
419
+ x: number;
420
+ y: number;
421
+ z: number;
422
+ };
423
+ };
424
+ dynamic?: {
425
+ enabled: boolean;
426
+ loadDynamicDataFromLocalStorage?: boolean;
427
+ dynamicData?: {
428
+ webcamHeight: number;
429
+ ratioPixelToCentimeter: number;
430
+ deltaAgentHeightAgentWorldHeightInCentimeters: number;
431
+ cameraRotationInDegrees: number;
432
+ distanceFromAgentToCameraInCentimeters: number;
433
+ };
434
+ };
435
+ };
414
436
  }
415
437
  export type BaseAgentData = string | {
416
438
  url?: string;
@@ -733,6 +755,7 @@ export interface RetorikMainComponentConfiguration extends RetorikSharedProps {
733
755
  GDPR?: GDPR;
734
756
  customScripts?: Array<string>;
735
757
  customCSS?: Array<string>;
758
+ enableVirtualKeyboard?: boolean;
736
759
  }
737
760
  export interface RetorikMainComponentProps extends RetorikMainComponentConfiguration {
738
761
  menuConfig?: RetorikMenusConfiguration;