@memori.ai/memori-react 2.7.1 → 2.8.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +49 -28
  3. package/dist/components/Chat/Chat.d.ts +2 -0
  4. package/dist/components/Chat/Chat.js +2 -2
  5. package/dist/components/Chat/Chat.js.map +1 -1
  6. package/dist/components/MediaWidget/MediaItemWidget.d.ts +3 -1
  7. package/dist/components/MediaWidget/MediaItemWidget.js +8 -4
  8. package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
  9. package/dist/components/MediaWidget/MediaItemWidget.test.js +4 -0
  10. package/dist/components/MediaWidget/MediaItemWidget.test.js.map +1 -1
  11. package/dist/components/MediaWidget/MediaWidget.d.ts +2 -0
  12. package/dist/components/MediaWidget/MediaWidget.js +2 -2
  13. package/dist/components/MediaWidget/MediaWidget.js.map +1 -1
  14. package/dist/components/MemoriWidget/MemoriWidget.d.ts +2 -1
  15. package/dist/components/MemoriWidget/MemoriWidget.js +2 -1
  16. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  17. package/dist/components/StartPanel/StartPanel.js +6 -9
  18. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  19. package/dist/components/ui/Select.css +2 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +2 -2
  22. package/dist/index.js.map +1 -1
  23. package/esm/components/Chat/Chat.d.ts +2 -0
  24. package/esm/components/Chat/Chat.js +2 -2
  25. package/esm/components/Chat/Chat.js.map +1 -1
  26. package/esm/components/MediaWidget/MediaItemWidget.d.ts +3 -1
  27. package/esm/components/MediaWidget/MediaItemWidget.js +8 -4
  28. package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
  29. package/esm/components/MediaWidget/MediaItemWidget.test.js +4 -0
  30. package/esm/components/MediaWidget/MediaItemWidget.test.js.map +1 -1
  31. package/esm/components/MediaWidget/MediaWidget.d.ts +2 -0
  32. package/esm/components/MediaWidget/MediaWidget.js +2 -2
  33. package/esm/components/MediaWidget/MediaWidget.js.map +1 -1
  34. package/esm/components/MemoriWidget/MemoriWidget.d.ts +2 -1
  35. package/esm/components/MemoriWidget/MemoriWidget.js +2 -1
  36. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  37. package/esm/components/StartPanel/StartPanel.js +6 -9
  38. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  39. package/esm/components/ui/Select.css +2 -1
  40. package/esm/index.d.ts +1 -0
  41. package/esm/index.js +2 -2
  42. package/esm/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/components/Chat/Chat.tsx +6 -1
  45. package/src/components/MediaWidget/MediaItemWidget.stories.tsx +25 -0
  46. package/src/components/MediaWidget/MediaItemWidget.test.tsx +11 -0
  47. package/src/components/MediaWidget/MediaItemWidget.tsx +12 -0
  48. package/src/components/MediaWidget/MediaWidget.tsx +4 -1
  49. package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +12 -0
  50. package/src/components/MemoriWidget/MemoriWidget.stories.tsx +34 -0
  51. package/src/components/MemoriWidget/MemoriWidget.tsx +3 -0
  52. package/src/components/StartPanel/StartPanel.tsx +23 -19
  53. package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +62 -50
  54. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +62 -50
  55. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +62 -50
  56. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +62 -50
  57. package/src/components/ui/Select.css +2 -1
  58. package/src/index.tsx +3 -0
@@ -279,60 +279,72 @@ exports[`renders FullPage layout unchanged 1`] = `
279
279
  <div
280
280
  class="memori--language-chooser"
281
281
  >
282
- <div
283
- class="memori-select"
282
+ <label
283
+ for="user-lang-pref"
284
+ id="user-lang-pref-label"
285
+ >
286
+ write_and_speak.iWantToTalkToIn
287
+ </label>
288
+ <select
289
+ aria-labelledby="user-lang-pref-label"
290
+ class="memori-select--button"
291
+ id="user-lang-pref"
284
292
  >
285
- <input
286
- hidden=""
287
- name="day"
288
- readonly=""
289
- style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
290
- type="hidden"
293
+ <option
294
+ aria-label="Italiano"
291
295
  value="IT"
292
- />
293
- <label
294
- class="memori-select--label"
295
- data-headlessui-state=""
296
- id="headlessui-listbox-label-:r7:"
297
296
  >
298
- write_and_speak.iWantToTalkToIn
299
- :
300
- </label>
301
- <button
302
- aria-expanded="false"
303
- aria-haspopup="true"
304
- aria-label="write_and_speak.iWantToTalkToIn"
305
- aria-labelledby="headlessui-listbox-label-:r7: headlessui-listbox-button-:r8:"
306
- class="memori-select--button"
307
- data-headlessui-state=""
308
- id="headlessui-listbox-button-:r8:"
309
- type="button"
297
+ Italiano
298
+ </option>
299
+ <option
300
+ aria-label="English"
301
+ value="EN"
310
302
  >
311
- <span
312
- class="memori-select--value"
313
- >
314
- Italiano
315
- </span>
316
- <span
317
- class="memori-select--icon"
318
- >
319
- <svg
320
- aria-hidden="true"
321
- fill="currentColor"
322
- focusable="false"
323
- role="img"
324
- viewBox="0 0 20 20"
325
- xmlns="http://www.w3.org/2000/svg"
326
- >
327
- <path
328
- clip-rule="evenodd"
329
- d="M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z"
330
- fill-rule="evenodd"
331
- />
332
- </svg>
333
- </span>
334
- </button>
335
- </div>
303
+ English
304
+ </option>
305
+ <option
306
+ aria-label="Deutsch"
307
+ value="DE"
308
+ >
309
+ Deutsch
310
+ </option>
311
+ <option
312
+ aria-label="Español"
313
+ value="ES"
314
+ >
315
+ Español
316
+ </option>
317
+ <option
318
+ aria-label="Français"
319
+ value="FR"
320
+ >
321
+ Français
322
+ </option>
323
+ <option
324
+ aria-label="Português"
325
+ value="PT"
326
+ >
327
+ Português
328
+ </option>
329
+ <option
330
+ aria-label="Українська"
331
+ value="UK"
332
+ >
333
+ Українська
334
+ </option>
335
+ <option
336
+ aria-label="Русский"
337
+ value="RU"
338
+ >
339
+ Русский
340
+ </option>
341
+ <option
342
+ aria-label="Polski"
343
+ value="PL"
344
+ >
345
+ Polski
346
+ </option>
347
+ </select>
336
348
  </div>
337
349
  <button
338
350
  class="memori-button memori-button--primary memori-button--rounded memori-button--padded memori--start-button"
@@ -330,60 +330,72 @@ exports[`renders Totem layout unchanged 1`] = `
330
330
  <div
331
331
  class="memori--language-chooser"
332
332
  >
333
- <div
334
- class="memori-select"
333
+ <label
334
+ for="user-lang-pref"
335
+ id="user-lang-pref-label"
336
+ >
337
+ write_and_speak.iWantToTalkToIn
338
+ </label>
339
+ <select
340
+ aria-labelledby="user-lang-pref-label"
341
+ class="memori-select--button"
342
+ id="user-lang-pref"
335
343
  >
336
- <input
337
- hidden=""
338
- name="day"
339
- readonly=""
340
- style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
341
- type="hidden"
344
+ <option
345
+ aria-label="Italiano"
342
346
  value="IT"
343
- />
344
- <label
345
- class="memori-select--label"
346
- data-headlessui-state=""
347
- id="headlessui-listbox-label-:r7:"
348
347
  >
349
- write_and_speak.iWantToTalkToIn
350
- :
351
- </label>
352
- <button
353
- aria-expanded="false"
354
- aria-haspopup="true"
355
- aria-label="write_and_speak.iWantToTalkToIn"
356
- aria-labelledby="headlessui-listbox-label-:r7: headlessui-listbox-button-:r8:"
357
- class="memori-select--button"
358
- data-headlessui-state=""
359
- id="headlessui-listbox-button-:r8:"
360
- type="button"
348
+ Italiano
349
+ </option>
350
+ <option
351
+ aria-label="English"
352
+ value="EN"
361
353
  >
362
- <span
363
- class="memori-select--value"
364
- >
365
- Italiano
366
- </span>
367
- <span
368
- class="memori-select--icon"
369
- >
370
- <svg
371
- aria-hidden="true"
372
- fill="currentColor"
373
- focusable="false"
374
- role="img"
375
- viewBox="0 0 20 20"
376
- xmlns="http://www.w3.org/2000/svg"
377
- >
378
- <path
379
- clip-rule="evenodd"
380
- d="M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z"
381
- fill-rule="evenodd"
382
- />
383
- </svg>
384
- </span>
385
- </button>
386
- </div>
354
+ English
355
+ </option>
356
+ <option
357
+ aria-label="Deutsch"
358
+ value="DE"
359
+ >
360
+ Deutsch
361
+ </option>
362
+ <option
363
+ aria-label="Español"
364
+ value="ES"
365
+ >
366
+ Español
367
+ </option>
368
+ <option
369
+ aria-label="Français"
370
+ value="FR"
371
+ >
372
+ Français
373
+ </option>
374
+ <option
375
+ aria-label="Português"
376
+ value="PT"
377
+ >
378
+ Português
379
+ </option>
380
+ <option
381
+ aria-label="Українська"
382
+ value="UK"
383
+ >
384
+ Українська
385
+ </option>
386
+ <option
387
+ aria-label="Русский"
388
+ value="RU"
389
+ >
390
+ Русский
391
+ </option>
392
+ <option
393
+ aria-label="Polski"
394
+ value="PL"
395
+ >
396
+ Polski
397
+ </option>
398
+ </select>
387
399
  </div>
388
400
  <button
389
401
  class="memori-button memori-button--primary memori-button--rounded memori-button--padded memori--start-button"
@@ -6,6 +6,7 @@
6
6
  .memori-select--button {
7
7
  position: relative;
8
8
  width: 100%;
9
+ max-width: 240px;
9
10
  min-height: 38px;
10
11
  padding-top: 0.5rem;
11
12
  padding-right: 2.5rem;
@@ -136,4 +137,4 @@ li.memori-select--option:focus {
136
137
  li.memori-select--option:focus {
137
138
  outline: 2px solid #63b3ed;
138
139
  outline-offset: 2px;
139
- }
140
+ }
package/src/index.tsx CHANGED
@@ -40,6 +40,7 @@ export interface Props {
40
40
  AZURE_COGNITIVE_SERVICES_TTS_KEY?: string;
41
41
  onStateChange?: (state?: DialogState) => void;
42
42
  additionalInfo?: WidgetProps['additionalInfo'];
43
+ customMediaRenderer?: WidgetProps['customMediaRenderer'];
43
44
  }
44
45
 
45
46
  const getPreferredLanguages = () => {
@@ -87,6 +88,7 @@ const Memori: React.FC<Props> = ({
87
88
  AZURE_COGNITIVE_SERVICES_TTS_KEY,
88
89
  onStateChange,
89
90
  additionalInfo,
91
+ customMediaRenderer,
90
92
  }) => {
91
93
  const [memori, setMemori] = useState<IMemori>();
92
94
  const [speechKey, setSpeechKey] = useState<string | undefined>(
@@ -213,6 +215,7 @@ const Memori: React.FC<Props> = ({
213
215
  }
214
216
  onStateChange={onStateChange}
215
217
  additionalInfo={additionalInfo}
218
+ customMediaRenderer={customMediaRenderer}
216
219
  {...(tag && pin ? { personification: { tag, pin } } : {})}
217
220
  />
218
221
  ) : (