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