@davi-ai/retorik-framework 3.2.0 → 3.2.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.
Files changed (51) hide show
  1. package/dist/AttachmentDetail.1e06c2a5.js +1757 -0
  2. package/dist/AttachmentDetail.1e06c2a5.js.map +1 -0
  3. package/dist/AttachmentDetail.c6c297df.js +1732 -0
  4. package/dist/AttachmentDetail.c6c297df.js.map +1 -0
  5. package/dist/CustomView.080c8028.js +143 -0
  6. package/dist/CustomView.080c8028.js.map +1 -0
  7. package/dist/CustomView.90d2a13d.js +134 -0
  8. package/dist/CustomView.90d2a13d.js.map +1 -0
  9. package/dist/Emergency.423214ad.js +301 -0
  10. package/dist/Emergency.423214ad.js.map +1 -0
  11. package/dist/Emergency.a21f837c.js +292 -0
  12. package/dist/Emergency.a21f837c.js.map +1 -0
  13. package/dist/FullScreenImage.1fe27198.js +70 -0
  14. package/dist/FullScreenImage.1fe27198.js.map +1 -0
  15. package/dist/FullScreenImage.9a9b978e.js +83 -0
  16. package/dist/FullScreenImage.9a9b978e.js.map +1 -0
  17. package/dist/HistoryList.50ff0fd9.js +242 -0
  18. package/dist/HistoryList.50ff0fd9.js.map +1 -0
  19. package/dist/HistoryList.5fd6aa12.js +228 -0
  20. package/dist/HistoryList.5fd6aa12.js.map +1 -0
  21. package/dist/LanguageChoice.1579b654.js +125 -0
  22. package/dist/LanguageChoice.1579b654.js.map +1 -0
  23. package/dist/LanguageChoice.61e36c1d.js +116 -0
  24. package/dist/LanguageChoice.61e36c1d.js.map +1 -0
  25. package/dist/LittleWeatherContainer.07937cf3.js +57 -0
  26. package/dist/LittleWeatherContainer.07937cf3.js.map +1 -0
  27. package/dist/LittleWeatherContainer.d27a6b8a.js +44 -0
  28. package/dist/LittleWeatherContainer.d27a6b8a.js.map +1 -0
  29. package/dist/NewsContainer.67f04b19.js +730 -0
  30. package/dist/NewsContainer.67f04b19.js.map +1 -0
  31. package/dist/NewsContainer.932174e9.js +755 -0
  32. package/dist/NewsContainer.932174e9.js.map +1 -0
  33. package/dist/SpiritEngineWrapper.1d8db53d.js +82 -0
  34. package/dist/SpiritEngineWrapper.1d8db53d.js.map +1 -0
  35. package/dist/SpiritEngineWrapper.27e9c120.js +96 -0
  36. package/dist/SpiritEngineWrapper.27e9c120.js.map +1 -0
  37. package/dist/ThreeJsWrapper.09c689b8.js +141 -0
  38. package/dist/ThreeJsWrapper.09c689b8.js.map +1 -0
  39. package/dist/ThreeJsWrapper.7918143f.js +128 -0
  40. package/dist/ThreeJsWrapper.7918143f.js.map +1 -0
  41. package/dist/Weather.661c2cac.js +282 -0
  42. package/dist/Weather.661c2cac.js.map +1 -0
  43. package/dist/Weather.fb22fba3.js +268 -0
  44. package/dist/Weather.fb22fba3.js.map +1 -0
  45. package/dist/index.d.ts +69 -50
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +23055 -23224
  48. package/dist/index.js.map +1 -1
  49. package/dist/index.modern.js +22278 -22376
  50. package/dist/index.modern.js.map +1 -1
  51. package/package.json +4 -36
@@ -0,0 +1,730 @@
1
+ import "./Weather.fb22fba3.js";
2
+ import {jsxs as $7qgKV$jsxs, jsx as $7qgKV$jsx} from "react/jsx-runtime";
3
+ import $7qgKV$react, {useState as $7qgKV$useState, useRef as $7qgKV$useRef, useEffect as $7qgKV$useEffect, useMemo as $7qgKV$useMemo} from "react";
4
+
5
+
6
+ function $parcel$defineInteropFlag(a) {
7
+ Object.defineProperty(a, '__esModule', {value: true, configurable: true});
8
+ }
9
+
10
+ function $parcel$export(e, n, v, s) {
11
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
+ }
13
+
14
+ var $parcel$global = globalThis;
15
+ var parcelRequire = $parcel$global["parcelRequirea39d"];
16
+ var parcelRegister = parcelRequire.register;
17
+ parcelRegister("dUXW6", function(module, exports) {
18
+
19
+ $parcel$defineInteropFlag(module.exports);
20
+
21
+ $parcel$export(module.exports, "default", () => $aedc1e5f954603b8$export$2e2bcd8739ae039);
22
+
23
+
24
+
25
+ var $2fuDN = parcelRequire("2fuDN");
26
+
27
+ var $1Qww3 = parcelRequire("1Qww3");
28
+
29
+ var $i1rfm = parcelRequire("i1rfm");
30
+
31
+ var $1x02c = parcelRequire("1x02c");
32
+
33
+ var $aNpqK = parcelRequire("aNpqK");
34
+
35
+ var $4ucVo = parcelRequire("4ucVo");
36
+
37
+ var $6hdFJ = parcelRequire("6hdFJ");
38
+
39
+ var $hifTx = parcelRequire("hifTx");
40
+
41
+ var $hPPih = parcelRequire("hPPih");
42
+
43
+ var $2pbjN = parcelRequire("2pbjN");
44
+
45
+ var $9uOFS = parcelRequire("9uOFS");
46
+
47
+ var $g3FET = parcelRequire("g3FET");
48
+
49
+ var $9r8dA = parcelRequire("9r8dA");
50
+
51
+ var $28ved = parcelRequire("28ved");
52
+ // Steps enum
53
+ var $aedc1e5f954603b8$var$Steps = /*#__PURE__*/ function(Steps) {
54
+ Steps[Steps["opening"] = 1] = "opening";
55
+ Steps[Steps["news"] = 2] = "news";
56
+ Steps[Steps["events"] = 3] = "events";
57
+ Steps[Steps["weather"] = 4] = "weather";
58
+ Steps[Steps["ending"] = 5] = "ending";
59
+ return Steps;
60
+ }($aedc1e5f954603b8$var$Steps || {});
61
+ const $aedc1e5f954603b8$var$NewsContainer = ({ hideMenu: hideMenu, isRetorikNews: isRetorikNews, handleEndedWithoutloop: handleEndedWithoutloop })=>{
62
+ const translation = (0, $2fuDN.useLocaleStore)((state)=>state.currentTranslations);
63
+ const configuration = (0, $1x02c.useRetorikStore)((state)=>state.configuration);
64
+ const muted = (0, $i1rfm.useSpeechStore)((state)=>state.muted);
65
+ const isMobile = (0, $1Qww3.useViewStore)((state)=>state.isMobile);
66
+ const isLandscape = (0, $1Qww3.useViewStore)((state)=>state.isLandscape);
67
+ const isBorne = (0, $1Qww3.useViewStore)((state)=>state.isBorne);
68
+ const configurations = (0, $1Qww3.useViewStore)((state)=>state.configurations);
69
+ const { setRoute: setRoute, setDisplayControls: setDisplayControls } = (0, $1Qww3.useViewStore)((state)=>state.actions);
70
+ const setMuted = (0, $i1rfm.useSpeechStore)((state)=>state.actions.setMuted);
71
+ const setDisplayAgentInNews = (0, $1x02c.useRetorikStore)((state)=>state.actions.setDisplayAgentInNews);
72
+ const sendEvent = (0, $aNpqK.useDirectlineStore)((state)=>state.actions.sendEvent);
73
+ const [displayData, setDisplayData] = (0, $7qgKV$useState)(configurations.views.news || configurations.views.home);
74
+ const [step, setStep] = (0, $7qgKV$useState)(configurations.views.news?.openingVideo ? 1 : 2);
75
+ const timerRef = (0, $7qgKV$useRef)(null);
76
+ const newsEndedTimerRef = (0, $7qgKV$useRef)(null);
77
+ /**
78
+ * On call :
79
+ * - if the component is news-only, return
80
+ * - else set ViewContext's route state to 'home'
81
+ */ const handleBack = ()=>{
82
+ if (isRetorikNews) return;
83
+ setRoute((0, $4ucVo.Routes).Home);
84
+ };
85
+ (0, $7qgKV$useEffect)(()=>{
86
+ configuration.useOldRemote && setDisplayControls(false);
87
+ muted && setMuted(false);
88
+ return ()=>{
89
+ // Send closing events unless we are using RetorikNews component
90
+ if (!isRetorikNews) {
91
+ sendEvent('Davi.CloseWindow', null);
92
+ sendEvent('Davi.CloseWindowNews', null);
93
+ }
94
+ };
95
+ }, []);
96
+ /**
97
+ * On step change :
98
+ * - switch on the current step to launch corresponding processing
99
+ * On component unmount :
100
+ * - clear timerRef timeout
101
+ */ (0, $7qgKV$useEffect)(()=>{
102
+ switch(step){
103
+ case 1:
104
+ {
105
+ setDisplayAgentInNews(false);
106
+ const videoUrl = configurations.views.news?.openingVideo;
107
+ videoUrl ? setViewContextCurrentConfiguration(videoUrl) : setStep(2);
108
+ break;
109
+ }
110
+ case 2:
111
+ setDisplayAgentInNews(true);
112
+ setDisplayData(configurations.views.news || configurations.views.home);
113
+ break;
114
+ case 3:
115
+ break;
116
+ case 4:
117
+ setDisplayAgentInNews(false);
118
+ // If the position is known, display the weather page during 10 seconds, otherwise switch to the next step directly
119
+ configuration.position?.latitude && configuration.position?.longitude ? timerRef.current = setTimeout(()=>{
120
+ setStep(5);
121
+ }, 10000) : setStep(5);
122
+ break;
123
+ case 5:
124
+ {
125
+ setDisplayAgentInNews(false);
126
+ const videoUrl = configurations.views.news?.openingVideo;
127
+ videoUrl ? setViewContextCurrentConfiguration(videoUrl) : exitNewsOrLoop();
128
+ break;
129
+ }
130
+ default:
131
+ break;
132
+ }
133
+ return ()=>{
134
+ timerRef && clearTimeout(timerRef.current);
135
+ newsEndedTimerRef && clearTimeout(newsEndedTimerRef.current);
136
+ };
137
+ }, [
138
+ step
139
+ ]);
140
+ /**
141
+ * On call :
142
+ * - set the current display configuration to have the given video as background
143
+ * @param videoUrl
144
+ */ const setViewContextCurrentConfiguration = (videoUrl)=>{
145
+ setDisplayData({
146
+ ...configurations.views.news,
147
+ background: {
148
+ video: videoUrl,
149
+ style: 'video'
150
+ }
151
+ });
152
+ };
153
+ /**
154
+ * On call :
155
+ * - send the event 'newsEnded' used in retorik Kiosk
156
+ * - if the component is news-only :
157
+ * + if 'loop' is explicitly set to false, call props' handleEndedWithoutloop method if defined. Call handleBack method otherwise
158
+ * + if 'loop' is not false, loop by setting step state to Steps.news
159
+ * - or else if 'loop' parameter in configuration is true, get back to Steps.news step. Call handleBack method otherwise
160
+ */ const exitNewsOrLoop = ()=>{
161
+ // Send event 'newsEnded'
162
+ const endEvent = new Event('newsEnded');
163
+ document.dispatchEvent(endEvent);
164
+ // Relaunch from the start if this is a news-only component and loop hasn't explicitly been set to false
165
+ isRetorikNews ? displayData.loop !== false ? setStep(2) : handleEndedWithoutloop ? handleEndedWithoutloop() : handleBack() : displayData.loop ? setStep(2) : handleBack();
166
+ };
167
+ /**
168
+ * On video end :
169
+ * - if we are at the opening step, let's set the step state to Steps.news to launch the news
170
+ * - if we are at the ending step, call exitNewsOrLoop function
171
+ */ const handleVideoEnd = ()=>{
172
+ switch(step){
173
+ case 1:
174
+ setStep(2);
175
+ break;
176
+ case 5:
177
+ exitNewsOrLoop();
178
+ break;
179
+ }
180
+ };
181
+ /**
182
+ * On news end :
183
+ * - wait 3 seconds
184
+ * - get to the next step (Steps.events)
185
+ */ const handleNewsEnd = ()=>{
186
+ newsEndedTimerRef && (newsEndedTimerRef.current = setTimeout(()=>{
187
+ // setStep(Steps.events)
188
+ setStep(4);
189
+ }, 3000));
190
+ };
191
+ return /*#__PURE__*/ (0, $7qgKV$jsxs)((0, $7qgKV$react).Fragment, {
192
+ children: [
193
+ /*#__PURE__*/ (0, $7qgKV$jsx)((0, $6hdFJ.default), {
194
+ config: displayData.background,
195
+ videoLoop: false,
196
+ videoMuted: true,
197
+ onVideoEnded: handleVideoEnd
198
+ }),
199
+ isMobile && !isRetorikNews && !hideMenu ? /*#__PURE__*/ (0, $7qgKV$jsxs)("div", {
200
+ className: "rf-relative rf-z-util ltr:rf-col-start-1 rtl:rf-col-end-1 rf-col-span-full rf-row-start-1 rf-flex rf-flex-col rf-gap-2 rf-items-start",
201
+ children: [
202
+ /*#__PURE__*/ (0, $7qgKV$jsx)((0, $28ved.BackButton), {
203
+ title: translation.common.back,
204
+ handleBack: handleBack,
205
+ className: "ltr:rf-pr-2 rtl:rf-pl-2 rf-mt-4 ltr:rf-ml-4 rtl:rf-mr-4 rf-text-size-auto rf-bg-truewhite rf-rounded-lg"
206
+ }),
207
+ /*#__PURE__*/ (0, $7qgKV$jsx)((0, $hifTx.default), {
208
+ belowReturnButton: true
209
+ })
210
+ ]
211
+ }) : /*#__PURE__*/ (0, $7qgKV$jsx)((0, $hifTx.default), {}),
212
+ step === 2 && /*#__PURE__*/ (0, $7qgKV$jsx)((0, $hPPih.default), {
213
+ intervalInSeconds: displayData.intervalInSeconds ? displayData.intervalInSeconds : undefined,
214
+ onEnd: handleNewsEnd,
215
+ isRetorikNews: isRetorikNews
216
+ }),
217
+ step === 4 && /*#__PURE__*/ (0, $7qgKV$jsx)((0, $2pbjN.default), {
218
+ handleClose: handleBack
219
+ }),
220
+ !hideMenu && /*#__PURE__*/ (0, $7qgKV$jsx)((0, $9uOFS.default), {
221
+ dashboardVisible: true,
222
+ onClick: handleBack
223
+ }),
224
+ !hideMenu && isLandscape && !configuration.useOldRemote && !isRetorikNews && /*#__PURE__*/ (0, $7qgKV$jsx)((0, $g3FET.default), {
225
+ onClick: handleBack,
226
+ className: "rf-z-menu",
227
+ showLabel: true
228
+ }),
229
+ !hideMenu && isBorne && !configuration.useOldRemote && !isRetorikNews && /*#__PURE__*/ (0, $7qgKV$jsx)((0, $9r8dA.default), {
230
+ hideMenu: configuration?.hideMenu
231
+ })
232
+ ]
233
+ });
234
+ };
235
+ var $aedc1e5f954603b8$export$2e2bcd8739ae039 = $aedc1e5f954603b8$var$NewsContainer;
236
+
237
+ });
238
+ parcelRegister("hifTx", function(module, exports) {
239
+
240
+ $parcel$export(module.exports, "default", () => $c1e5018217fb7fb5$export$2e2bcd8739ae039);
241
+
242
+
243
+
244
+ var $2fuDN = parcelRequire("2fuDN");
245
+ const $c1e5018217fb7fb5$var$Time = ({ belowReturnButton: belowReturnButton })=>{
246
+ const translation = (0, $2fuDN.useLocaleStore)((state)=>state.currentTranslations);
247
+ const locale = (0, $2fuDN.useLocaleStore)((state)=>state.locale);
248
+ const [time, setTime] = (0, $7qgKV$useState)('');
249
+ const timerRef = (0, $7qgKV$useRef)(null);
250
+ /**
251
+ * Set current time (hours and minutes) depending on the locale (ex: adds AM/PM when needed)
252
+ */ const setCurrentTime = ()=>{
253
+ const now = new Date();
254
+ setTime(now.toLocaleTimeString(locale, {
255
+ hour: '2-digit',
256
+ minute: '2-digit'
257
+ }));
258
+ };
259
+ /**
260
+ * On component mount :
261
+ * - set time
262
+ * - set interval for time update
263
+ * On component unmount :
264
+ * - clear interval
265
+ */ (0, $7qgKV$useEffect)(()=>{
266
+ setCurrentTime();
267
+ timerRef && (timerRef.current = setInterval(setCurrentTime, 1000));
268
+ return ()=>timerRef && clearInterval(timerRef.current);
269
+ }, []);
270
+ return /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
271
+ className: `rf-relative ${belowReturnButton ? 'ltr:rf-ml-4 rtl:rf-mr-4' : 'rf-col-start-1 rf-col-span-2 rf-row-start-1 rf-row-span-2 rf-self-start rf-justify-self-start rf-m-4 large:rf-m-8'}`,
272
+ children: /*#__PURE__*/ (0, $7qgKV$jsxs)("div", {
273
+ className: "rf-w-fit rf-h-fit rf-flex rf-flex-col ltr:rf-justify-start rtl:rf-justify-end ltr:rf-items-start rtl:rf-items-end rf-text-white",
274
+ children: [
275
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
276
+ className: "rf-w-full rf-text-size-auto rf-px-3 rf-py-0 large:rf-px-4 large:rf-py-1 rf-text-center rf-font-semibold rf-bg-red-600 rf-whitespace-nowrap",
277
+ children: `${translation.news.live.toLocaleUpperCase(locale)} \u25cf`
278
+ }),
279
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
280
+ className: "rf-w-full rf-title-size-auto rf-px-3 rf-py-0 large:rf-px-4 large:rf-py-1 rf-text-center rf-font-bold rf-bg-blue-500",
281
+ children: time
282
+ })
283
+ ]
284
+ })
285
+ });
286
+ };
287
+ var $c1e5018217fb7fb5$export$2e2bcd8739ae039 = $c1e5018217fb7fb5$var$Time;
288
+
289
+ });
290
+
291
+ parcelRegister("hPPih", function(module, exports) {
292
+
293
+ $parcel$export(module.exports, "default", () => $c6bafeb4a00d3b53$export$2e2bcd8739ae039);
294
+
295
+
296
+
297
+ var $1Qww3 = parcelRequire("1Qww3");
298
+
299
+ var $aNpqK = parcelRequire("aNpqK");
300
+
301
+ var $j67YK = parcelRequire("j67YK");
302
+
303
+ var $kThjX = parcelRequire("kThjX");
304
+
305
+ var $4ucVo = parcelRequire("4ucVo");
306
+
307
+ var $auAlt = parcelRequire("auAlt");
308
+
309
+ var $9lsRd = parcelRequire("9lsRd");
310
+ const $c6bafeb4a00d3b53$var$News = ({ intervalInSeconds: intervalInSeconds = 3, onEnd: onEnd, isRetorikNews: isRetorikNews })=>{
311
+ const { newsAttachments: newsAttachments, activity: activity } = (0, $kThjX.default)();
312
+ const route = (0, $1Qww3.useViewStore)((state)=>state.route);
313
+ const isMobile = (0, $1Qww3.useViewStore)((state)=>state.isMobile);
314
+ const newsConfiguration = (0, $1Qww3.useViewStore)((state)=>state.configurations.views.news);
315
+ const currentDeviceType = (0, $1Qww3.useViewStore)((state)=>state.currentDeviceType);
316
+ const retorikNewsEnded = (0, $j67YK.useUtilsStore)((state)=>state.retorikNewsEnded);
317
+ const { setCurrentNewsActivity: setCurrentNewsActivity, setRetorikNewsEnded: setRetorikNewsEnded } = (0, $j67YK.useUtilsStore)((state)=>state.actions);
318
+ const sendEvent = (0, $aNpqK.useDirectlineStore)((state)=>state.actions.sendEvent);
319
+ const [carouselGridRowStart, setCarouselGridRowStart] = (0, $7qgKV$useState)();
320
+ const [carouselGridRowSpan, setCarouselGridRowSpan] = (0, $7qgKV$useState)();
321
+ const [bannerGridRowStart, setBannerGridRowStart] = (0, $7qgKV$useState)(10);
322
+ const [bannerGridRowSpan, setBannerGridRowSpan] = (0, $7qgKV$useState)(3);
323
+ // Banner's align-self is flex-end if the position of the banner hasn't been changed, flex-start in borne / landscape modes otherwise
324
+ const [alignSelfEnd, setAlignSelfEnd] = (0, $7qgKV$useState)(true);
325
+ const [current, setCurrent] = (0, $7qgKV$useState)(0);
326
+ const timerRef = (0, $7qgKV$useRef)(null);
327
+ const news = (0, $7qgKV$useMemo)(()=>{
328
+ return newsAttachments.map((newsAttachement)=>newsAttachement.content);
329
+ }, [
330
+ newsAttachments
331
+ ]);
332
+ (0, $7qgKV$useEffect)(()=>{
333
+ if (!newsAttachments.length) setTimeout(()=>{
334
+ sendEvent('news.getAllNews', null);
335
+ }, 2000);
336
+ return ()=>{
337
+ timerRef && clearTimeout(timerRef.current);
338
+ };
339
+ }, []);
340
+ (0, $7qgKV$useEffect)(()=>{
341
+ switch(currentDeviceType){
342
+ case (0, $4ucVo.DeviceType).mobile:
343
+ case (0, $4ucVo.DeviceType).widget:
344
+ // Set carousel's and banner's positions
345
+ setAlignSelfEnd(true);
346
+ setCarouselGridRowStart(1);
347
+ setCarouselGridRowSpan(9);
348
+ setBannerGridRowStart(10);
349
+ setBannerGridRowSpan(3);
350
+ break;
351
+ case (0, $4ucVo.DeviceType).landscape:
352
+ case (0, $4ucVo.DeviceType).widgetLandscape:
353
+ // Check banner's position and set carousel's position if there are no position data for this one
354
+ if (newsConfiguration?.bannerPosition?.landscape) {
355
+ const start = newsConfiguration.bannerPosition.landscape.containerRowStart || 10;
356
+ const end = newsConfiguration.bannerPosition.landscape.containerRowEnd || 13;
357
+ setAlignSelfEnd(false);
358
+ setBannerGridRowStart(start);
359
+ setBannerGridRowSpan(end - start);
360
+ if (!newsConfiguration?.mediaPosition?.landscape) {
361
+ // The base row span of the carousel is 9, if the custom position of the banner allows this span, let's keep it. If not, let's use the max span available.
362
+ if (start > 9) {
363
+ setCarouselGridRowStart(start - 9);
364
+ setCarouselGridRowSpan(9);
365
+ } else {
366
+ setCarouselGridRowStart(1);
367
+ setCarouselGridRowSpan(start - 1);
368
+ }
369
+ break;
370
+ }
371
+ } else {
372
+ setAlignSelfEnd(true);
373
+ setBannerGridRowStart(10);
374
+ setBannerGridRowSpan(3);
375
+ }
376
+ // Check carousel's position
377
+ if (newsConfiguration?.mediaPosition?.landscape) {
378
+ const start = newsConfiguration.mediaPosition.landscape.containerRowStart || 1;
379
+ const end = newsConfiguration.mediaPosition.landscape.containerRowEnd || 10;
380
+ setCarouselGridRowStart(start);
381
+ setCarouselGridRowStart(end - start);
382
+ } else {
383
+ setCarouselGridRowStart(1);
384
+ setCarouselGridRowSpan(9);
385
+ }
386
+ break;
387
+ case (0, $4ucVo.DeviceType).borne:
388
+ case (0, $4ucVo.DeviceType).widgetBorne:
389
+ // Check banner's position and set carousel's position if there are no position data for this one
390
+ if (newsConfiguration?.bannerPosition?.borne) {
391
+ const start = newsConfiguration.bannerPosition.borne.containerRowStart || 10;
392
+ const end = newsConfiguration.bannerPosition.borne.containerRowEnd || 13;
393
+ setAlignSelfEnd(false);
394
+ setBannerGridRowStart(start);
395
+ setBannerGridRowSpan(end - start);
396
+ if (!newsConfiguration?.mediaPosition?.borne) {
397
+ // The base row span of the carousel is 4, if the custom position of the banner allows this span, let's keep it. If not, let's use the max span available.
398
+ if (start > 4) {
399
+ setCarouselGridRowStart(start - 4);
400
+ setCarouselGridRowSpan(4);
401
+ } else {
402
+ setCarouselGridRowStart(1);
403
+ setCarouselGridRowSpan(start - 1);
404
+ }
405
+ break;
406
+ }
407
+ } else {
408
+ setAlignSelfEnd(true);
409
+ setBannerGridRowStart(10);
410
+ setBannerGridRowSpan(3);
411
+ }
412
+ // Check carousel's position
413
+ if (newsConfiguration?.mediaPosition?.borne) {
414
+ const start = newsConfiguration.mediaPosition.borne.containerRowStart || 7;
415
+ const end = newsConfiguration.mediaPosition.borne.containerRowEnd || 11;
416
+ setCarouselGridRowStart(start);
417
+ setCarouselGridRowSpan(end - start);
418
+ } else {
419
+ setCarouselGridRowStart(7);
420
+ setCarouselGridRowSpan(4);
421
+ }
422
+ break;
423
+ }
424
+ }, [
425
+ newsConfiguration,
426
+ currentDeviceType
427
+ ]);
428
+ (0, $7qgKV$useEffect)(()=>{
429
+ const currentNew = news[current];
430
+ if (currentNew) {
431
+ const textTitle = newsConfiguration?.removeTitleFromTextToSpeak ? '' : `${currentNew.title}, <break/> `;
432
+ const textSubtitle = newsConfiguration?.removeSubtitleFromTextToSpeak ? '' : `${currentNew.subtitle}: <break/> `;
433
+ const tempActivity = {
434
+ ...activity,
435
+ speak: `${textTitle}${textSubtitle}${currentNew.text}`
436
+ };
437
+ setCurrentNewsActivity(tempActivity);
438
+ } else setCurrentNewsActivity(undefined);
439
+ }, [
440
+ activity,
441
+ current
442
+ ]);
443
+ const currentMedia = (0, $7qgKV$useMemo)(()=>{
444
+ const currentNew = news[current];
445
+ if (currentNew) {
446
+ if (currentNew.media?.length) return currentNew.media;
447
+ else if (currentNew.image?.url) return [
448
+ currentNew.image
449
+ ];
450
+ }
451
+ return [];
452
+ }, [
453
+ news,
454
+ current
455
+ ]);
456
+ (0, $7qgKV$useEffect)(()=>{
457
+ if (retorikNewsEnded) {
458
+ if (news.length) {
459
+ if (current < news.length - 1) {
460
+ const delay = current < news.length - 1 ? intervalInSeconds : intervalInSeconds * 3;
461
+ timerRef && clearTimeout(timerRef.current);
462
+ if (route === (0, $4ucVo.Routes).News || isRetorikNews) timerRef.current = setTimeout(next, delay * 1000);
463
+ } else onEnd();
464
+ }
465
+ setRetorikNewsEnded(false);
466
+ }
467
+ }, [
468
+ retorikNewsEnded
469
+ ]);
470
+ const next = ()=>{
471
+ const next = (current + 1) % news.length;
472
+ changeNews(next);
473
+ };
474
+ const changeNews = (next)=>{
475
+ setCurrent(next);
476
+ };
477
+ return news.length && current >= 0 ? /*#__PURE__*/ (0, $7qgKV$jsxs)((0, $7qgKV$react).Fragment, {
478
+ children: [
479
+ !isMobile && /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
480
+ className: "rf-relative rf-col-start-5 rf-col-span-3 large-vertical:rf-col-start-2 large-vertical:rf-col-end-8 rf-flex rf-justify-center rf-items-center",
481
+ style: {
482
+ gridRow: `${carouselGridRowStart} / span ${carouselGridRowSpan}`
483
+ },
484
+ children: currentMedia.length ? /*#__PURE__*/ (0, $7qgKV$jsx)((0, $9lsRd.Carousel), {
485
+ className: "rf-z-[10] rf-max-h-4/5 large-vertical:rf-max-h-11/12 rf-max-w-full",
486
+ medias: news[current].media || [
487
+ news[current].image || {
488
+ url: ''
489
+ }
490
+ ]
491
+ }) : /*#__PURE__*/ (0, $7qgKV$jsx)((0, $7qgKV$react).Fragment, {})
492
+ }),
493
+ /*#__PURE__*/ (0, $7qgKV$jsx)((0, $auAlt.default), {
494
+ news: news[current],
495
+ gridRowStart: bannerGridRowStart,
496
+ gridRowSpan: bannerGridRowSpan,
497
+ alignSelfEnd: alignSelfEnd
498
+ })
499
+ ]
500
+ }) : /*#__PURE__*/ (0, $7qgKV$jsx)((0, $7qgKV$react).Fragment, {});
501
+ };
502
+ var $c6bafeb4a00d3b53$export$2e2bcd8739ae039 = $c6bafeb4a00d3b53$var$News;
503
+
504
+ });
505
+ parcelRegister("kThjX", function(module, exports) {
506
+
507
+ $parcel$export(module.exports, "default", () => $07fb045e03ad37d0$export$2e2bcd8739ae039);
508
+
509
+ var $5CsC6 = parcelRequire("5CsC6");
510
+
511
+ var $9GPj7 = parcelRequire("9GPj7");
512
+ const $07fb045e03ad37d0$var$useNews = ()=>{
513
+ const activities = (0, $9GPj7.useActivityStore)((state)=>state.botEventActivities);
514
+ if (!activities.length) return {
515
+ newsAttachments: []
516
+ };
517
+ // Filter messages that can income during news, with label = Davi.BringupMessage
518
+ const filterBringUpActivities = activities.filter((act)=>act.label !== 'Davi.BringupMessage');
519
+ const activity = filterBringUpActivities[filterBringUpActivities.length - 1];
520
+ if (!activity || !activity.attachments?.length) return {
521
+ newsAttachments: [],
522
+ activity: activity
523
+ };
524
+ const newsAttachments = [];
525
+ activity.attachments.forEach((attachment)=>{
526
+ if (attachment.contentType === (0, $5CsC6.CONTENT_TYPE_NEWS)) newsAttachments.push({
527
+ contentType: (0, $5CsC6.CONTENT_TYPE_NEWS),
528
+ content: attachment.content || ''
529
+ });
530
+ });
531
+ return {
532
+ newsAttachments: newsAttachments,
533
+ activity: activity
534
+ };
535
+ };
536
+ var $07fb045e03ad37d0$export$2e2bcd8739ae039 = $07fb045e03ad37d0$var$useNews;
537
+
538
+ });
539
+
540
+ parcelRegister("auAlt", function(module, exports) {
541
+
542
+ $parcel$export(module.exports, "default", () => $de1f380ff3be314f$export$2e2bcd8739ae039);
543
+
544
+
545
+
546
+ var $1Qww3 = parcelRequire("1Qww3");
547
+
548
+ var $2fuDN = parcelRequire("2fuDN");
549
+
550
+ var $7pypd = parcelRequire("7pypd");
551
+
552
+ var $fjXOk = parcelRequire("fjXOk");
553
+
554
+ var $6q7hI = parcelRequire("6q7hI");
555
+ const $de1f380ff3be314f$var$Banner = ({ news: news, gridRowStart: gridRowStart, gridRowSpan: gridRowSpan, alignSelfEnd: alignSelfEnd })=>{
556
+ const translation = (0, $2fuDN.useLocaleStore)((state)=>state.currentTranslations);
557
+ const locale = (0, $2fuDN.useLocaleStore)((state)=>state.localeForRetorikStudioContent);
558
+ const isMobile = (0, $1Qww3.useViewStore)((state)=>state.isMobile);
559
+ const currentWidth = (0, $1Qww3.useViewStore)((state)=>state.currentWidth);
560
+ const newsConfiguration = (0, $1Qww3.useViewStore)((state)=>state.configurations.views.news);
561
+ const timerRef = (0, $7qgKV$useRef)(null);
562
+ const [scrollDuration, setScrollDuration] = (0, $7qgKV$useState)(0);
563
+ const category = (0, $7qgKV$useMemo)(()=>{
564
+ if (news.category) return news.category;
565
+ else if (newsConfiguration?.bannerTitleLocalized?.[locale]) return newsConfiguration.bannerTitleLocalized[locale];
566
+ else if (newsConfiguration?.bannerTitle) return newsConfiguration.bannerTitle;
567
+ return translation.news.continuous;
568
+ }, [
569
+ news,
570
+ newsConfiguration,
571
+ locale,
572
+ translation
573
+ ]);
574
+ /**
575
+ * Set animation for text horizontal scrolling if necessary
576
+ */ const updateDuration = ()=>{
577
+ // Reset animation
578
+ setScrollDuration(0);
579
+ // Set animation, after a 1s timeout
580
+ timerRef && (timerRef.current = setTimeout(()=>{
581
+ setScrollDuration(Math.floor(news.text.length / 11));
582
+ }, 1000));
583
+ };
584
+ /**
585
+ * On news props change :
586
+ * - call updateDuration function
587
+ * On component unmount :
588
+ * - clear timeout
589
+ */ (0, $7qgKV$useEffect)(()=>{
590
+ updateDuration();
591
+ return ()=>timerRef && clearTimeout(timerRef.current);
592
+ }, [
593
+ news
594
+ ]);
595
+ return /*#__PURE__*/ (0, $7qgKV$jsxs)("div", {
596
+ className: "rf-h-fit rf-z-util rf-col-start-1 rf-col-span-full large:rf-mb-6 rf-flex rf-flex-col rf-items-center rf-glass-background rf-text-white",
597
+ style: {
598
+ alignSelf: alignSelfEnd ? 'flex-end' : 'flex-start',
599
+ gridRow: `${gridRowStart} / span ${gridRowSpan}`
600
+ },
601
+ children: [
602
+ isMobile ? /*#__PURE__*/ (0, $7qgKV$jsx)((0, $fjXOk.default), {
603
+ category: category,
604
+ title: news.title,
605
+ subtitle: news.subtitle,
606
+ url: news.image?.url
607
+ }) : /*#__PURE__*/ (0, $7qgKV$jsx)((0, $6q7hI.default), {
608
+ category: category,
609
+ title: news.title,
610
+ subtitle: news.subtitle
611
+ }),
612
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
613
+ className: "rf-w-full ltr:rf-pr-4 rtl:rf-pl-4 rf-py-2 large:rf-py-4 rf-subtitle-size-auto rf-text-black rf-bg-white rf-overflow-clip",
614
+ style: {
615
+ paddingLeft: currentWidth
616
+ },
617
+ children: scrollDuration !== 0 ? /*#__PURE__*/ (0, $7qgKV$jsx)("p", {
618
+ className: "rf-w-max rf-whitespace-nowrap rf-animate-hScroll",
619
+ style: {
620
+ animation: `rf-hScroll ${scrollDuration}s infinite linear`,
621
+ paddingRight: currentWidth
622
+ },
623
+ children: news.text ? (0, $7pypd.capitalizeFirstLetter)(news.text) : '...'
624
+ }) : /*#__PURE__*/ (0, $7qgKV$jsx)("p", {
625
+ className: "rf-w-max rf-whitespace-nowrap",
626
+ children: news.text ? (0, $7pypd.capitalizeFirstLetter)(news.text) : '...'
627
+ })
628
+ })
629
+ ]
630
+ });
631
+ };
632
+ var $de1f380ff3be314f$export$2e2bcd8739ae039 = $de1f380ff3be314f$var$Banner;
633
+
634
+ });
635
+ parcelRegister("fjXOk", function(module, exports) {
636
+
637
+ $parcel$export(module.exports, "default", () => $262dee73bb235081$export$2e2bcd8739ae039);
638
+
639
+
640
+
641
+ var $2fuDN = parcelRequire("2fuDN");
642
+
643
+ var $7pypd = parcelRequire("7pypd");
644
+ const $262dee73bb235081$var$BannerTopMobile = ({ category: category, title: title, subtitle: subtitle, url: url })=>{
645
+ const locale = (0, $2fuDN.useLocaleStore)((state)=>state.locale);
646
+ return /*#__PURE__*/ (0, $7qgKV$jsxs)((0, $7qgKV$react).Fragment, {
647
+ children: [
648
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
649
+ className: "rf-w-full rf-px-4 rf-py-2 rf-font-bold rf-bg-red-600 rf-whitespace-nowrap rf-text-size-auto",
650
+ children: category?.toLocaleUpperCase(locale)
651
+ }),
652
+ /*#__PURE__*/ (0, $7qgKV$jsxs)("div", {
653
+ className: "rf-w-full rf-flex rf-flex-row",
654
+ children: [
655
+ url && /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
656
+ className: "rf-aspect-video rf-w-1/4",
657
+ style: {
658
+ backgroundImage: `url(${url})`,
659
+ backgroundSize: 'cover',
660
+ backgroundRepeat: 'no-repeat',
661
+ backgroundPosition: 'center'
662
+ }
663
+ }),
664
+ /*#__PURE__*/ (0, $7qgKV$jsxs)("div", {
665
+ className: "rf-px-4 rf-py-1 rf-font-bold",
666
+ children: [
667
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
668
+ className: "rf-text-size-auto rf-line-clamp-1",
669
+ children: title && title.toLocaleUpperCase(locale)
670
+ }),
671
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
672
+ className: "rf-text-basecustom rf-line-clamp-2",
673
+ children: subtitle ? (0, $7pypd.capitalizeFirstLetter)(subtitle) : '...'
674
+ })
675
+ ]
676
+ })
677
+ ]
678
+ })
679
+ ]
680
+ });
681
+ };
682
+ var $262dee73bb235081$export$2e2bcd8739ae039 = $262dee73bb235081$var$BannerTopMobile;
683
+
684
+ });
685
+
686
+ parcelRegister("6q7hI", function(module, exports) {
687
+
688
+ $parcel$export(module.exports, "default", () => $5485971f80937390$export$2e2bcd8739ae039);
689
+
690
+
691
+
692
+ var $2fuDN = parcelRequire("2fuDN");
693
+
694
+ var $7pypd = parcelRequire("7pypd");
695
+ const $5485971f80937390$var$BannerTopLarge = ({ category: category, title: title, subtitle: subtitle })=>{
696
+ const locale = (0, $2fuDN.useLocaleStore)((state)=>state.locale);
697
+ return /*#__PURE__*/ (0, $7qgKV$jsxs)((0, $7qgKV$react).Fragment, {
698
+ children: [
699
+ /*#__PURE__*/ (0, $7qgKV$jsxs)("div", {
700
+ className: "rf-w-full rf-flex rf-flex-row rf-justify-start rf-text-size-auto",
701
+ children: [
702
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
703
+ className: "rf-px-4 rf-py-3 rf-font-bold rf-bg-red-600 rf-whitespace-nowrap",
704
+ children: category?.toLocaleUpperCase(locale)
705
+ }),
706
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
707
+ className: "rf-px-4 rf-mb-2 rf-mt-2 large:rf-mt-3 rf-font-bold rf-line-clamp-1",
708
+ children: title?.toLocaleUpperCase(locale)
709
+ })
710
+ ]
711
+ }),
712
+ /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
713
+ className: "rf-w-full rf-h-fit rf-flex rf-flex-row rf-justify-start",
714
+ children: /*#__PURE__*/ (0, $7qgKV$jsx)("div", {
715
+ className: "rf-px-4 rf-my-2 large:rf-my-3 rf-title-large-size-auto rf-line-clamp-2",
716
+ children: subtitle ? (0, $7pypd.capitalizeFirstLetter)(subtitle) : '...'
717
+ })
718
+ })
719
+ ]
720
+ });
721
+ };
722
+ var $5485971f80937390$export$2e2bcd8739ae039 = $5485971f80937390$var$BannerTopLarge;
723
+
724
+ });
725
+
726
+
727
+
728
+
729
+
730
+ //# sourceMappingURL=NewsContainer.67f04b19.js.map