@memori.ai/memori-react 6.1.7 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/components/ChatBubble/ChatBubble.css +5 -0
- package/dist/components/ChatBubble/ChatBubble.js +9 -7
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/Header/Header.css +14 -1
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +97 -20
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/PositionDrawer/PositionDrawer.d.ts +9 -1
- package/dist/components/PositionDrawer/PositionDrawer.js +11 -1
- package/dist/components/PositionDrawer/PositionDrawer.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.js +2 -1
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/VenueWidget/VenueWidget.css +142 -0
- package/dist/components/VenueWidget/VenueWidget.d.ts +34 -0
- package/dist/components/VenueWidget/VenueWidget.js +212 -0
- package/dist/components/VenueWidget/VenueWidget.js.map +1 -0
- package/dist/components/ui/Drawer.d.ts +1 -0
- package/dist/components/ui/Drawer.js +1 -1
- package/dist/components/ui/Drawer.js.map +1 -1
- package/dist/components/ui/Select.d.ts +2 -1
- package/dist/components/ui/Select.js +2 -2
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/helpers/configuration.js +1 -0
- package/dist/helpers/configuration.js.map +1 -1
- package/dist/helpers/utils.d.ts +1 -0
- package/dist/helpers/utils.js +25 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/helpers/venue.d.ts +3 -0
- package/dist/helpers/venue.js +23 -0
- package/dist/helpers/venue.js.map +1 -0
- package/dist/locales/en.json +8 -1
- package/dist/locales/it.json +8 -2
- package/dist/styles.css +1 -0
- package/esm/components/ChatBubble/ChatBubble.css +5 -0
- package/esm/components/ChatBubble/ChatBubble.js +9 -7
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/Header/Header.css +14 -1
- package/esm/components/Header/Header.js +1 -1
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +97 -20
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/PositionDrawer/PositionDrawer.d.ts +9 -1
- package/esm/components/PositionDrawer/PositionDrawer.js +11 -2
- package/esm/components/PositionDrawer/PositionDrawer.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.js +2 -1
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/VenueWidget/VenueWidget.css +142 -0
- package/esm/components/VenueWidget/VenueWidget.d.ts +34 -0
- package/esm/components/VenueWidget/VenueWidget.js +209 -0
- package/esm/components/VenueWidget/VenueWidget.js.map +1 -0
- package/esm/components/ui/Drawer.d.ts +1 -0
- package/esm/components/ui/Drawer.js +1 -1
- package/esm/components/ui/Drawer.js.map +1 -1
- package/esm/components/ui/Select.d.ts +2 -1
- package/esm/components/ui/Select.js +2 -2
- package/esm/components/ui/Select.js.map +1 -1
- package/esm/helpers/configuration.js +1 -0
- package/esm/helpers/configuration.js.map +1 -1
- package/esm/helpers/utils.d.ts +1 -0
- package/esm/helpers/utils.js +24 -1
- package/esm/helpers/utils.js.map +1 -1
- package/esm/helpers/venue.d.ts +3 -0
- package/esm/helpers/venue.js +19 -0
- package/esm/helpers/venue.js.map +1 -0
- package/esm/locales/en.json +8 -1
- package/esm/locales/it.json +8 -2
- package/esm/styles.css +1 -0
- package/package.json +5 -2
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +0 -154
- package/src/components/ChatBubble/ChatBubble.css +5 -0
- package/src/components/ChatBubble/ChatBubble.tsx +3 -1
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +41 -100
- package/src/components/Header/Header.css +14 -1
- package/src/components/Header/Header.tsx +8 -4
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +2 -1
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +9 -0
- package/src/components/MemoriWidget/MemoriWidget.tsx +129 -16
- package/src/components/PositionDrawer/PositionDrawer.stories.tsx +51 -0
- package/src/components/PositionDrawer/PositionDrawer.test.tsx +39 -0
- package/src/components/PositionDrawer/PositionDrawer.tsx +36 -5
- package/src/components/PositionDrawer/__snapshots__/PositionDrawer.test.tsx.snap +17 -0
- package/src/components/StartPanel/StartPanel.tsx +5 -1
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +18 -2
- package/src/components/VenueWidget/VenueWidget.css +142 -0
- package/src/components/VenueWidget/VenueWidget.stories.tsx +66 -0
- package/src/components/VenueWidget/VenueWidget.test.tsx +49 -0
- package/src/components/VenueWidget/VenueWidget.tsx +459 -0
- package/src/components/VenueWidget/__snapshots__/VenueWidget.test.tsx.snap +370 -0
- package/src/components/ui/Drawer.tsx +5 -2
- package/src/components/ui/Select.tsx +3 -1
- package/src/components/ui/__snapshots__/Select.test.tsx.snap +0 -24
- package/src/helpers/configuration.ts +1 -0
- package/src/helpers/utils.ts +36 -1
- package/src/helpers/venue.ts +36 -0
- package/src/locales/en.json +8 -1
- package/src/locales/it.json +8 -2
- package/src/mocks/data.ts +8 -0
- package/src/styles.css +1 -0
|
@@ -12,8 +12,6 @@ exports[`renders ChatBubble from user with avatar as react element unchanged 1`]
|
|
|
12
12
|
<p>
|
|
13
13
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
14
14
|
</p>
|
|
15
|
-
|
|
16
|
-
|
|
17
15
|
</div>
|
|
18
16
|
</div>
|
|
19
17
|
<div
|
|
@@ -39,8 +37,6 @@ exports[`renders ChatBubble from user with avatar unchanged 1`] = `
|
|
|
39
37
|
<p>
|
|
40
38
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
41
39
|
</p>
|
|
42
|
-
|
|
43
|
-
|
|
44
40
|
</div>
|
|
45
41
|
</div>
|
|
46
42
|
<picture
|
|
@@ -68,8 +64,6 @@ exports[`renders ChatBubble from user with custom avatar unchanged 1`] = `
|
|
|
68
64
|
<p>
|
|
69
65
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
70
66
|
</p>
|
|
71
|
-
|
|
72
|
-
|
|
73
67
|
</div>
|
|
74
68
|
</div>
|
|
75
69
|
<picture
|
|
@@ -107,8 +101,6 @@ exports[`renders ChatBubble unchanged 1`] = `
|
|
|
107
101
|
<p>
|
|
108
102
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
109
103
|
</p>
|
|
110
|
-
|
|
111
|
-
|
|
112
104
|
</div>
|
|
113
105
|
</div>
|
|
114
106
|
</div>
|
|
@@ -140,8 +132,6 @@ exports[`renders ChatBubble with initial msg unchanged 1`] = `
|
|
|
140
132
|
<p>
|
|
141
133
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
142
134
|
</p>
|
|
143
|
-
|
|
144
|
-
|
|
145
135
|
</div>
|
|
146
136
|
</div>
|
|
147
137
|
</div>
|
|
@@ -170,16 +160,13 @@ exports[`renders ChatBubble with markdown unchanged 1`] = `
|
|
|
170
160
|
<h2>
|
|
171
161
|
Test
|
|
172
162
|
</h2>
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
<br />
|
|
175
164
|
<p>
|
|
176
165
|
Ecco tutte le possibili personalizzazioni che puoi applicare:
|
|
177
166
|
</p>
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
<br />
|
|
180
168
|
<ul>
|
|
181
|
-
|
|
182
|
-
|
|
169
|
+
<br />
|
|
183
170
|
<li>
|
|
184
171
|
<p>
|
|
185
172
|
<strong>
|
|
@@ -187,27 +174,21 @@ exports[`renders ChatBubble with markdown unchanged 1`] = `
|
|
|
187
174
|
</strong>
|
|
188
175
|
:
|
|
189
176
|
</p>
|
|
190
|
-
|
|
191
|
-
|
|
177
|
+
<br />
|
|
192
178
|
<ul>
|
|
193
|
-
|
|
194
|
-
|
|
179
|
+
<br />
|
|
195
180
|
<li>
|
|
196
181
|
Girocollo
|
|
197
182
|
</li>
|
|
198
|
-
|
|
199
|
-
|
|
183
|
+
<br />
|
|
200
184
|
<li>
|
|
201
185
|
Scollo a V
|
|
202
186
|
</li>
|
|
203
|
-
|
|
204
|
-
|
|
187
|
+
<br />
|
|
205
188
|
</ul>
|
|
206
|
-
|
|
207
|
-
|
|
189
|
+
<br />
|
|
208
190
|
</li>
|
|
209
|
-
|
|
210
|
-
|
|
191
|
+
<br />
|
|
211
192
|
<li>
|
|
212
193
|
<p>
|
|
213
194
|
<strong>
|
|
@@ -215,27 +196,21 @@ exports[`renders ChatBubble with markdown unchanged 1`] = `
|
|
|
215
196
|
</strong>
|
|
216
197
|
:
|
|
217
198
|
</p>
|
|
218
|
-
|
|
219
|
-
|
|
199
|
+
<br />
|
|
220
200
|
<ul>
|
|
221
|
-
|
|
222
|
-
|
|
201
|
+
<br />
|
|
223
202
|
<li>
|
|
224
203
|
Manica Lunga
|
|
225
204
|
</li>
|
|
226
|
-
|
|
227
|
-
|
|
205
|
+
<br />
|
|
228
206
|
<li>
|
|
229
207
|
Manica Corta
|
|
230
208
|
</li>
|
|
231
|
-
|
|
232
|
-
|
|
209
|
+
<br />
|
|
233
210
|
</ul>
|
|
234
|
-
|
|
235
|
-
|
|
211
|
+
<br />
|
|
236
212
|
</li>
|
|
237
|
-
|
|
238
|
-
|
|
213
|
+
<br />
|
|
239
214
|
<li>
|
|
240
215
|
<p>
|
|
241
216
|
<strong>
|
|
@@ -243,52 +218,41 @@ exports[`renders ChatBubble with markdown unchanged 1`] = `
|
|
|
243
218
|
</strong>
|
|
244
219
|
:
|
|
245
220
|
</p>
|
|
246
|
-
|
|
247
|
-
|
|
221
|
+
<br />
|
|
248
222
|
<ul>
|
|
249
|
-
|
|
250
|
-
|
|
223
|
+
<br />
|
|
251
224
|
<li>
|
|
252
225
|
XS
|
|
253
226
|
</li>
|
|
254
|
-
|
|
255
|
-
|
|
227
|
+
<br />
|
|
256
228
|
<li>
|
|
257
229
|
S
|
|
258
230
|
</li>
|
|
259
|
-
|
|
260
|
-
|
|
231
|
+
<br />
|
|
261
232
|
<li>
|
|
262
233
|
M
|
|
263
234
|
</li>
|
|
264
|
-
|
|
265
|
-
|
|
235
|
+
<br />
|
|
266
236
|
<li>
|
|
267
237
|
L
|
|
268
238
|
</li>
|
|
269
|
-
|
|
270
|
-
|
|
239
|
+
<br />
|
|
271
240
|
<li>
|
|
272
241
|
XL
|
|
273
242
|
</li>
|
|
274
|
-
|
|
275
|
-
|
|
243
|
+
<br />
|
|
276
244
|
<li>
|
|
277
245
|
XXL
|
|
278
246
|
</li>
|
|
279
|
-
|
|
280
|
-
|
|
247
|
+
<br />
|
|
281
248
|
<li>
|
|
282
249
|
3XL
|
|
283
250
|
</li>
|
|
284
|
-
|
|
285
|
-
|
|
251
|
+
<br />
|
|
286
252
|
</ul>
|
|
287
|
-
|
|
288
|
-
|
|
253
|
+
<br />
|
|
289
254
|
</li>
|
|
290
|
-
|
|
291
|
-
|
|
255
|
+
<br />
|
|
292
256
|
<li>
|
|
293
257
|
<p>
|
|
294
258
|
<strong>
|
|
@@ -296,37 +260,29 @@ exports[`renders ChatBubble with markdown unchanged 1`] = `
|
|
|
296
260
|
</strong>
|
|
297
261
|
:
|
|
298
262
|
</p>
|
|
299
|
-
|
|
300
|
-
|
|
263
|
+
<br />
|
|
301
264
|
<ul>
|
|
302
|
-
|
|
303
|
-
|
|
265
|
+
<br />
|
|
304
266
|
<li>
|
|
305
267
|
Fronte Petto
|
|
306
268
|
</li>
|
|
307
|
-
|
|
308
|
-
|
|
269
|
+
<br />
|
|
309
270
|
<li>
|
|
310
271
|
Retro Schiena
|
|
311
272
|
</li>
|
|
312
|
-
|
|
313
|
-
|
|
273
|
+
<br />
|
|
314
274
|
<li>
|
|
315
275
|
Fronte DX
|
|
316
276
|
</li>
|
|
317
|
-
|
|
318
|
-
|
|
277
|
+
<br />
|
|
319
278
|
<li>
|
|
320
279
|
Fronte SX
|
|
321
280
|
</li>
|
|
322
|
-
|
|
323
|
-
|
|
281
|
+
<br />
|
|
324
282
|
</ul>
|
|
325
|
-
|
|
326
|
-
|
|
283
|
+
<br />
|
|
327
284
|
</li>
|
|
328
|
-
|
|
329
|
-
|
|
285
|
+
<br />
|
|
330
286
|
<li>
|
|
331
287
|
<p>
|
|
332
288
|
<strong>
|
|
@@ -334,30 +290,23 @@ exports[`renders ChatBubble with markdown unchanged 1`] = `
|
|
|
334
290
|
</strong>
|
|
335
291
|
:
|
|
336
292
|
</p>
|
|
337
|
-
|
|
338
|
-
|
|
293
|
+
<br />
|
|
339
294
|
<ul>
|
|
340
|
-
|
|
341
|
-
|
|
295
|
+
<br />
|
|
342
296
|
<li>
|
|
343
297
|
Prompt generazione immagine
|
|
344
298
|
</li>
|
|
345
|
-
|
|
346
|
-
|
|
299
|
+
<br />
|
|
347
300
|
</ul>
|
|
348
|
-
|
|
349
|
-
|
|
301
|
+
<br />
|
|
350
302
|
</li>
|
|
351
|
-
|
|
352
|
-
|
|
303
|
+
<br />
|
|
353
304
|
</ul>
|
|
354
|
-
|
|
355
|
-
|
|
305
|
+
<br />
|
|
356
306
|
<p>
|
|
357
307
|
Seleziona le personalizzazioni che desideri applicare.
|
|
358
308
|
</p>
|
|
359
|
-
|
|
360
|
-
|
|
309
|
+
<br />
|
|
361
310
|
<p>
|
|
362
311
|
<a
|
|
363
312
|
href="https://memori.ai"
|
|
@@ -367,8 +316,6 @@ exports[`renders ChatBubble with markdown unchanged 1`] = `
|
|
|
367
316
|
Vedi altro
|
|
368
317
|
</a>
|
|
369
318
|
</p>
|
|
370
|
-
|
|
371
|
-
|
|
372
319
|
</div>
|
|
373
320
|
</div>
|
|
374
321
|
</div>
|
|
@@ -387,8 +334,6 @@ exports[`renders ChatBubble with msg from BoE expert unchanged 1`] = `
|
|
|
387
334
|
<p>
|
|
388
335
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
389
336
|
</p>
|
|
390
|
-
|
|
391
|
-
|
|
392
337
|
</div>
|
|
393
338
|
<div
|
|
394
339
|
class="memori-chat--bubble-addon"
|
|
@@ -471,8 +416,6 @@ exports[`renders ChatBubble with msg generated by AI unchanged 1`] = `
|
|
|
471
416
|
<p>
|
|
472
417
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
473
418
|
</p>
|
|
474
|
-
|
|
475
|
-
|
|
476
419
|
</div>
|
|
477
420
|
<div
|
|
478
421
|
class="memori-chat--bubble-addon"
|
|
@@ -555,8 +498,6 @@ exports[`renders ChatBubble with user msg unchanged 1`] = `
|
|
|
555
498
|
<p>
|
|
556
499
|
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
557
500
|
</p>
|
|
558
|
-
|
|
559
|
-
|
|
560
501
|
</div>
|
|
561
502
|
</div>
|
|
562
503
|
<div
|
|
@@ -48,11 +48,19 @@
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.memori-header--position {
|
|
51
|
-
display: inline-
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
.memori-header--position .memori-header--position-placeName {
|
|
56
|
+
display: inline-block;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
max-width: 250px;
|
|
59
|
+
padding-right: 0.25rem;
|
|
60
|
+
margin: 0;
|
|
55
61
|
font-style: italic;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
white-space: nowrap;
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
.memori-header--position .memori-header--button {
|
|
@@ -60,7 +68,12 @@
|
|
|
60
68
|
margin-left: 0.5rem;
|
|
61
69
|
}
|
|
62
70
|
|
|
71
|
+
.memori-header .memori-header--button--position,
|
|
63
72
|
.memori-header .memori-share-button,
|
|
64
73
|
.memori-header .memori-header--button-login {
|
|
65
74
|
margin-left: 0.25rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.memori-header .memori-header--button--position {
|
|
78
|
+
margin-right: 0.25rem;
|
|
66
79
|
}
|
|
@@ -109,13 +109,17 @@ const Header: React.FC<Props> = ({
|
|
|
109
109
|
)}
|
|
110
110
|
{memori.needsPosition && position && (
|
|
111
111
|
<div className="memori-header--position">
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
{position.latitude !== 0 && position.longitude !== 0 && (
|
|
113
|
+
<span className="memori-header--position-placeName">
|
|
114
|
+
{position.placeName}
|
|
115
|
+
</span>
|
|
116
|
+
)}
|
|
115
117
|
<Button
|
|
116
|
-
|
|
118
|
+
primary
|
|
117
119
|
shape="circle"
|
|
118
120
|
className="memori-header--button memori-header--button--position"
|
|
121
|
+
title={t('widget.position') || 'Position'}
|
|
122
|
+
icon={<MapMarker />}
|
|
119
123
|
onClick={() => setShowPositionDrawer(true)}
|
|
120
124
|
/>
|
|
121
125
|
</div>
|
|
@@ -757,7 +757,8 @@ exports[`renders Header with position unchanged 1`] = `
|
|
|
757
757
|
Berlin
|
|
758
758
|
</span>
|
|
759
759
|
<button
|
|
760
|
-
class="memori-button memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--position"
|
|
760
|
+
class="memori-button memori-button--primary memori-button--circle memori-button--padded memori-button--icon-only memori-header--button memori-header--button--position"
|
|
761
|
+
title="widget.position"
|
|
761
762
|
>
|
|
762
763
|
<span
|
|
763
764
|
class="memori-button--icon"
|
|
@@ -56,6 +56,15 @@ WithPosition.args = {
|
|
|
56
56
|
tenant,
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
+
export const WithDates = Template.bind({});
|
|
60
|
+
WithDates.args = {
|
|
61
|
+
memori: {
|
|
62
|
+
...memori,
|
|
63
|
+
needsDateTime: true,
|
|
64
|
+
},
|
|
65
|
+
tenant,
|
|
66
|
+
};
|
|
67
|
+
|
|
59
68
|
export const WithPublicPageIntegration = Template.bind({});
|
|
60
69
|
WithPublicPageIntegration.args = {
|
|
61
70
|
memori,
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
Invitation,
|
|
13
13
|
GamificationLevel,
|
|
14
14
|
Tenant,
|
|
15
|
-
Asset,
|
|
16
15
|
MemoriSession,
|
|
17
16
|
User,
|
|
18
17
|
ExpertReference,
|
|
@@ -37,7 +36,7 @@ import memoriApiClient from '@memori.ai/memori-api-client';
|
|
|
37
36
|
import { AudioContext, IAudioContext } from 'standardized-audio-context';
|
|
38
37
|
import * as speechSdk from 'microsoft-cognitiveservices-speech-sdk';
|
|
39
38
|
import cx from 'classnames';
|
|
40
|
-
|
|
39
|
+
import { DateTime } from 'luxon';
|
|
41
40
|
import toast from 'react-hot-toast';
|
|
42
41
|
|
|
43
42
|
// Components
|
|
@@ -416,6 +415,7 @@ const MemoriWidget = ({
|
|
|
416
415
|
initSession,
|
|
417
416
|
postTextEnteredEvent,
|
|
418
417
|
postPlaceChangedEvent,
|
|
418
|
+
postDateChangedEvent,
|
|
419
419
|
postTimeoutEvent,
|
|
420
420
|
postTagChangedEvent,
|
|
421
421
|
getSession,
|
|
@@ -560,7 +560,11 @@ const MemoriWidget = ({
|
|
|
560
560
|
});
|
|
561
561
|
|
|
562
562
|
if (currentState && response.resultCode === 0) {
|
|
563
|
-
|
|
563
|
+
_setCurrentDialogState(cds => ({
|
|
564
|
+
...cds,
|
|
565
|
+
...currentState,
|
|
566
|
+
hints: currentState.hints?.length ? currentState.hints : cds?.hints,
|
|
567
|
+
}));
|
|
564
568
|
}
|
|
565
569
|
}
|
|
566
570
|
};
|
|
@@ -568,8 +572,21 @@ const MemoriWidget = ({
|
|
|
568
572
|
const setPosition = (venue?: Venue) => {
|
|
569
573
|
_setPosition(venue);
|
|
570
574
|
applyPosition(venue);
|
|
575
|
+
|
|
576
|
+
if (venue) {
|
|
577
|
+
setLocalConfig('position', JSON.stringify(venue));
|
|
578
|
+
} else {
|
|
579
|
+
removeLocalConfig('position');
|
|
580
|
+
}
|
|
571
581
|
};
|
|
572
582
|
|
|
583
|
+
useEffect(() => {
|
|
584
|
+
const position = getLocalConfig<Venue | undefined>('position', undefined);
|
|
585
|
+
if (position) {
|
|
586
|
+
_setPosition(position);
|
|
587
|
+
}
|
|
588
|
+
}, []);
|
|
589
|
+
|
|
573
590
|
/**
|
|
574
591
|
* History e gestione invio messaggi
|
|
575
592
|
*/
|
|
@@ -1082,6 +1099,8 @@ const MemoriWidget = ({
|
|
|
1082
1099
|
}
|
|
1083
1100
|
|
|
1084
1101
|
if (position) applyPosition(position, sessionID);
|
|
1102
|
+
if (memori.needsDateTime)
|
|
1103
|
+
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
1085
1104
|
|
|
1086
1105
|
setLoading(false);
|
|
1087
1106
|
return {
|
|
@@ -1228,6 +1247,64 @@ const MemoriWidget = ({
|
|
|
1228
1247
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1229
1248
|
}, []);
|
|
1230
1249
|
|
|
1250
|
+
/**
|
|
1251
|
+
* Polling dates
|
|
1252
|
+
*/
|
|
1253
|
+
const sendDateChangedEvent = useCallback(
|
|
1254
|
+
async ({
|
|
1255
|
+
sessionID,
|
|
1256
|
+
date,
|
|
1257
|
+
state,
|
|
1258
|
+
}: {
|
|
1259
|
+
sessionID?: string;
|
|
1260
|
+
date?: string;
|
|
1261
|
+
state?: DialogState;
|
|
1262
|
+
}) => {
|
|
1263
|
+
const session = sessionID ?? sessionId;
|
|
1264
|
+
const dialogState = state ?? currentDialogState;
|
|
1265
|
+
|
|
1266
|
+
if (!session || !memori.needsDateTime || dialogState?.hints?.length) {
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
const now = (date ? DateTime.fromISO(date) : DateTime.now())
|
|
1271
|
+
.toUTC()
|
|
1272
|
+
.toFormat('yyyy/MM/dd HH:mm:ss ZZ')
|
|
1273
|
+
.split(':')
|
|
1274
|
+
.slice(0, -1)
|
|
1275
|
+
.join(':');
|
|
1276
|
+
|
|
1277
|
+
const { currentState, ...response } = await postDateChangedEvent(
|
|
1278
|
+
session,
|
|
1279
|
+
now
|
|
1280
|
+
);
|
|
1281
|
+
|
|
1282
|
+
if (response.resultCode === 0 && currentState) {
|
|
1283
|
+
_setCurrentDialogState(cds => ({
|
|
1284
|
+
...cds,
|
|
1285
|
+
...currentState,
|
|
1286
|
+
hints: currentState.hints?.length ? currentState.hints : cds?.hints,
|
|
1287
|
+
}));
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
[currentDialogState, memori.needsDateTime, sessionId]
|
|
1291
|
+
);
|
|
1292
|
+
useEffect(() => {
|
|
1293
|
+
if (sessionId && memori.needsDateTime) {
|
|
1294
|
+
sendDateChangedEvent({ sessionID: sessionId, state: currentDialogState });
|
|
1295
|
+
|
|
1296
|
+
let datePolling = setInterval(() => {
|
|
1297
|
+
sendDateChangedEvent({
|
|
1298
|
+
sessionID: sessionId,
|
|
1299
|
+
});
|
|
1300
|
+
}, 60 * 1000); // 1 minute
|
|
1301
|
+
|
|
1302
|
+
return () => {
|
|
1303
|
+
clearInterval(datePolling);
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
}, [memori.needsDateTime, sessionId]);
|
|
1307
|
+
|
|
1231
1308
|
/**
|
|
1232
1309
|
* Timeout conversazione
|
|
1233
1310
|
*/
|
|
@@ -2321,8 +2398,9 @@ const MemoriWidget = ({
|
|
|
2321
2398
|
tag: personification?.tag,
|
|
2322
2399
|
pin: personification?.pin,
|
|
2323
2400
|
initialContextVars: {
|
|
2324
|
-
PATHNAME: window.location.pathname,
|
|
2325
|
-
ROUTE:
|
|
2401
|
+
PATHNAME: window.location.pathname?.toUpperCase(),
|
|
2402
|
+
ROUTE:
|
|
2403
|
+
window.location.pathname?.split('/')?.pop()?.toUpperCase() || '',
|
|
2326
2404
|
...(initialContextVars || {}),
|
|
2327
2405
|
},
|
|
2328
2406
|
initialQuestion,
|
|
@@ -2371,6 +2449,11 @@ const MemoriWidget = ({
|
|
|
2371
2449
|
// reset history
|
|
2372
2450
|
setHistory([]);
|
|
2373
2451
|
|
|
2452
|
+
// date and place events
|
|
2453
|
+
if (position) applyPosition(position, sessionID);
|
|
2454
|
+
if (memori.needsDateTime)
|
|
2455
|
+
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
2456
|
+
|
|
2374
2457
|
// checks engine state for current tag
|
|
2375
2458
|
// opening session would have already correct tag
|
|
2376
2459
|
// otherwise change tag to anonymous for test, giver for instruct, receiver if set
|
|
@@ -2416,8 +2499,10 @@ const MemoriWidget = ({
|
|
|
2416
2499
|
memori?.giverTag,
|
|
2417
2500
|
memori?.giverPIN,
|
|
2418
2501
|
{
|
|
2419
|
-
PATHNAME: window.location.pathname,
|
|
2420
|
-
ROUTE:
|
|
2502
|
+
PATHNAME: window.location.pathname?.toUpperCase(),
|
|
2503
|
+
ROUTE:
|
|
2504
|
+
window.location.pathname?.split('/')?.pop()?.toUpperCase() ||
|
|
2505
|
+
'',
|
|
2421
2506
|
...(initialContextVars || {}),
|
|
2422
2507
|
},
|
|
2423
2508
|
initialQuestion,
|
|
@@ -2467,8 +2552,10 @@ const MemoriWidget = ({
|
|
|
2467
2552
|
personification.tag,
|
|
2468
2553
|
personification.pin,
|
|
2469
2554
|
{
|
|
2470
|
-
PATHNAME: window.location.pathname,
|
|
2471
|
-
ROUTE:
|
|
2555
|
+
PATHNAME: window.location.pathname?.toUpperCase(),
|
|
2556
|
+
ROUTE:
|
|
2557
|
+
window.location.pathname?.split('/')?.pop()?.toUpperCase() ||
|
|
2558
|
+
'',
|
|
2472
2559
|
...(initialContextVars || {}),
|
|
2473
2560
|
},
|
|
2474
2561
|
initialQuestion,
|
|
@@ -2518,8 +2605,10 @@ const MemoriWidget = ({
|
|
|
2518
2605
|
undefined,
|
|
2519
2606
|
undefined,
|
|
2520
2607
|
{
|
|
2521
|
-
PATHNAME: window.location.pathname,
|
|
2522
|
-
ROUTE:
|
|
2608
|
+
PATHNAME: window.location.pathname?.toUpperCase(),
|
|
2609
|
+
ROUTE:
|
|
2610
|
+
window.location.pathname?.split('/')?.pop()?.toUpperCase() ||
|
|
2611
|
+
'',
|
|
2523
2612
|
...(initialContextVars || {}),
|
|
2524
2613
|
},
|
|
2525
2614
|
initialQuestion,
|
|
@@ -2540,6 +2629,11 @@ const MemoriWidget = ({
|
|
|
2540
2629
|
setHasUserActivatedSpeak(true);
|
|
2541
2630
|
});
|
|
2542
2631
|
}
|
|
2632
|
+
|
|
2633
|
+
// date and place events
|
|
2634
|
+
if (position) applyPosition(position, sessionID);
|
|
2635
|
+
if (memori.needsDateTime)
|
|
2636
|
+
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
2543
2637
|
} else {
|
|
2544
2638
|
// reset history
|
|
2545
2639
|
setHistory([]);
|
|
@@ -2556,7 +2650,7 @@ const MemoriWidget = ({
|
|
|
2556
2650
|
});
|
|
2557
2651
|
}
|
|
2558
2652
|
},
|
|
2559
|
-
[memoriPwd, memori, memoriTokens, birthDate, sessionId, userLang]
|
|
2653
|
+
[memoriPwd, memori, memoriTokens, birthDate, sessionId, userLang, position]
|
|
2560
2654
|
);
|
|
2561
2655
|
useEffect(() => {
|
|
2562
2656
|
const targetNode =
|
|
@@ -2889,8 +2983,10 @@ const MemoriWidget = ({
|
|
|
2889
2983
|
instruct ? memori.giverTag : personification?.tag,
|
|
2890
2984
|
instruct ? memori.giverPIN : personification?.pin,
|
|
2891
2985
|
{
|
|
2892
|
-
PATHNAME: window.location.pathname,
|
|
2893
|
-
ROUTE:
|
|
2986
|
+
PATHNAME: window.location.pathname?.toUpperCase(),
|
|
2987
|
+
ROUTE:
|
|
2988
|
+
window.location.pathname?.split('/')?.pop()?.toUpperCase() ||
|
|
2989
|
+
'',
|
|
2894
2990
|
...(initialContextVars || {}),
|
|
2895
2991
|
},
|
|
2896
2992
|
initialQuestion,
|
|
@@ -2928,8 +3024,12 @@ const MemoriWidget = ({
|
|
|
2928
3024
|
instruct ? memori.giverTag : personification?.tag,
|
|
2929
3025
|
instruct ? memori.giverPIN : personification?.pin,
|
|
2930
3026
|
{
|
|
2931
|
-
PATHNAME: window.location.pathname,
|
|
2932
|
-
ROUTE:
|
|
3027
|
+
PATHNAME: window.location.pathname?.toUpperCase(),
|
|
3028
|
+
ROUTE:
|
|
3029
|
+
window.location.pathname
|
|
3030
|
+
?.split('/')
|
|
3031
|
+
?.pop()
|
|
3032
|
+
?.toUpperCase() || '',
|
|
2933
3033
|
...(initialContextVars || {}),
|
|
2934
3034
|
},
|
|
2935
3035
|
initialQuestion,
|
|
@@ -2969,6 +3069,19 @@ const MemoriWidget = ({
|
|
|
2969
3069
|
/>
|
|
2970
3070
|
)}
|
|
2971
3071
|
|
|
3072
|
+
{showPositionDrawer && (
|
|
3073
|
+
<PositionDrawer
|
|
3074
|
+
memori={memori}
|
|
3075
|
+
open={!!showPositionDrawer}
|
|
3076
|
+
venue={position}
|
|
3077
|
+
setVenue={setPosition}
|
|
3078
|
+
onClose={position => {
|
|
3079
|
+
if (position) applyPosition(position);
|
|
3080
|
+
setShowPositionDrawer(false);
|
|
3081
|
+
}}
|
|
3082
|
+
/>
|
|
3083
|
+
)}
|
|
3084
|
+
|
|
2972
3085
|
{showKnownFactsDrawer && sessionId && (
|
|
2973
3086
|
<KnownFacts
|
|
2974
3087
|
apiURL={apiUrl}
|