@memori.ai/memori-react 7.1.2 → 7.2.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 +19 -0
  2. package/README.md +1 -0
  3. package/dist/components/Chat/Chat.d.ts +1 -0
  4. package/dist/components/Chat/Chat.js +2 -2
  5. package/dist/components/Chat/Chat.js.map +1 -1
  6. package/dist/components/ChatBubble/ChatBubble.css +15 -10
  7. package/dist/components/ChatBubble/ChatBubble.d.ts +1 -0
  8. package/dist/components/ChatBubble/ChatBubble.js +14 -4
  9. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  10. package/dist/components/MemoriWidget/MemoriWidget.d.ts +2 -1
  11. package/dist/components/MemoriWidget/MemoriWidget.js +17 -16
  12. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  13. package/dist/components/icons/Code.d.ts +5 -0
  14. package/dist/components/icons/Code.js +6 -0
  15. package/dist/components/icons/Code.js.map +1 -0
  16. package/dist/components/icons/Copy.js +1 -1
  17. package/dist/components/icons/Copy.js.map +1 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +3 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/locales/en.json +1 -0
  22. package/dist/locales/it.json +1 -0
  23. package/esm/components/Chat/Chat.d.ts +1 -0
  24. package/esm/components/Chat/Chat.js +2 -2
  25. package/esm/components/Chat/Chat.js.map +1 -1
  26. package/esm/components/ChatBubble/ChatBubble.css +15 -10
  27. package/esm/components/ChatBubble/ChatBubble.d.ts +1 -0
  28. package/esm/components/ChatBubble/ChatBubble.js +14 -4
  29. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  30. package/esm/components/MemoriWidget/MemoriWidget.d.ts +2 -1
  31. package/esm/components/MemoriWidget/MemoriWidget.js +17 -16
  32. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  33. package/esm/components/icons/Code.d.ts +5 -0
  34. package/esm/components/icons/Code.js +4 -0
  35. package/esm/components/icons/Code.js.map +1 -0
  36. package/esm/components/icons/Copy.js +2 -2
  37. package/esm/components/icons/Copy.js.map +1 -1
  38. package/esm/index.d.ts +1 -0
  39. package/esm/index.js +3 -2
  40. package/esm/index.js.map +1 -1
  41. package/esm/locales/en.json +1 -0
  42. package/esm/locales/it.json +1 -0
  43. package/package.json +1 -1
  44. package/src/components/Chat/Chat.tsx +3 -0
  45. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +1672 -44
  46. package/src/components/ChatBubble/ChatBubble.css +15 -10
  47. package/src/components/ChatBubble/ChatBubble.stories.tsx +11 -0
  48. package/src/components/ChatBubble/ChatBubble.test.tsx +16 -0
  49. package/src/components/ChatBubble/ChatBubble.tsx +39 -1
  50. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +764 -11
  51. package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +30 -4
  52. package/src/components/MemoriWidget/MemoriWidget.tsx +18 -15
  53. package/src/components/Snippet/__snapshots__/Snippet.test.tsx.snap +120 -16
  54. package/src/components/icons/Code.tsx +24 -0
  55. package/src/components/icons/Copy.tsx +8 -2
  56. package/src/index.tsx +4 -0
  57. package/src/locales/en.json +1 -0
  58. package/src/locales/it.json +1 -0
@@ -121,13 +121,26 @@ exports[`renders MediaItemWidget unchanged with css snippet to show 1`] = `
121
121
  >
122
122
  <svg
123
123
  aria-hidden="true"
124
+ fill="none"
124
125
  focusable="false"
125
126
  role="img"
126
- viewBox="0 0 1024 1024"
127
+ stroke="currentColor"
128
+ stroke-linecap="round"
129
+ stroke-linejoin="round"
130
+ stroke-width="1.5"
131
+ viewBox="0 0 24 24"
127
132
  xmlns="http://www.w3.org/2000/svg"
128
133
  >
134
+ <rect
135
+ height="14"
136
+ rx="2"
137
+ ry="2"
138
+ width="14"
139
+ x="8"
140
+ y="8"
141
+ />
129
142
  <path
130
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
143
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
131
144
  />
132
145
  </svg>
133
146
  </span>
@@ -359,13 +372,26 @@ exports[`renders MediaItemWidget unchanged with js snippet to show 1`] = `
359
372
  >
360
373
  <svg
361
374
  aria-hidden="true"
375
+ fill="none"
362
376
  focusable="false"
363
377
  role="img"
364
- viewBox="0 0 1024 1024"
378
+ stroke="currentColor"
379
+ stroke-linecap="round"
380
+ stroke-linejoin="round"
381
+ stroke-width="1.5"
382
+ viewBox="0 0 24 24"
365
383
  xmlns="http://www.w3.org/2000/svg"
366
384
  >
385
+ <rect
386
+ height="14"
387
+ rx="2"
388
+ ry="2"
389
+ width="14"
390
+ x="8"
391
+ y="8"
392
+ />
367
393
  <path
368
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
394
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
369
395
  />
370
396
  </svg>
371
397
  </span>
@@ -337,6 +337,7 @@ export interface Props {
337
337
  layout?: 'DEFAULT' | 'FULLPAGE' | 'TOTEM' | 'CHAT' | 'WEBSITE_ASSISTANT';
338
338
  customLayout?: React.FC<LayoutProps>;
339
339
  showShare?: boolean;
340
+ showCopyButton?: boolean;
340
341
  showInstruct?: boolean;
341
342
  showInputs?: boolean;
342
343
  showDates?: boolean;
@@ -388,6 +389,7 @@ const MemoriWidget = ({
388
389
  showShare,
389
390
  preview = false,
390
391
  embed = false,
392
+ showCopyButton = true,
391
393
  showInputs = true,
392
394
  showDates = false,
393
395
  showContextPerLine = false,
@@ -993,7 +995,7 @@ const MemoriWidget = ({
993
995
  }, 400);
994
996
  }, 1000);
995
997
  } catch (e) {
996
- console.error(e);
998
+ console.warn(e);
997
999
  }
998
1000
  });
999
1001
  };
@@ -1040,7 +1042,7 @@ const MemoriWidget = ({
1040
1042
  return window.location.href;
1041
1043
  })();
1042
1044
  } catch (err) {
1043
- console.error(err);
1045
+ console.debug(err);
1044
1046
  }
1045
1047
 
1046
1048
  const session = await initSession({
@@ -1072,14 +1074,14 @@ const MemoriWidget = ({
1072
1074
  } else if (
1073
1075
  session?.resultMessage.startsWith('This Memori is aged restricted')
1074
1076
  ) {
1075
- console.error(session);
1077
+ console.warn(session);
1076
1078
  toast.error(t('underageTwinSession', { age: minAge }));
1077
1079
  setGotErrorInOpening(true);
1078
1080
  } else if (session?.resultCode === 403) {
1079
1081
  setMemoriPwd(undefined);
1080
1082
  setAuthModalState('password');
1081
1083
  } else {
1082
- console.error(session);
1084
+ console.warn(session);
1083
1085
  toast.error(t(getErrori18nKey(session?.resultCode)));
1084
1086
  setGotErrorInOpening(true);
1085
1087
  }
@@ -1127,7 +1129,7 @@ const MemoriWidget = ({
1127
1129
  return window.location.href;
1128
1130
  })();
1129
1131
  } catch (err) {
1130
- console.error(err);
1132
+ console.debug(err);
1131
1133
  }
1132
1134
 
1133
1135
  const { sessionID, currentState, ...response } = await initSession({
@@ -1279,7 +1281,7 @@ const MemoriWidget = ({
1279
1281
  return window.location.href;
1280
1282
  })();
1281
1283
  } catch (err) {
1282
- console.error(err);
1284
+ console.debug(err);
1283
1285
  }
1284
1286
 
1285
1287
  fetchSession({
@@ -1315,7 +1317,7 @@ const MemoriWidget = ({
1315
1317
  }
1316
1318
  } catch (_e) {
1317
1319
  let err = _e as Error;
1318
- console.error('[APPCONTEXT/CHANGETAG]', err);
1320
+ console.warn('[APPCONTEXT/CHANGETAG]', err);
1319
1321
  return Promise.reject(err);
1320
1322
  }
1321
1323
 
@@ -1925,7 +1927,7 @@ const MemoriWidget = ({
1925
1927
  speechSynthesizer = null;
1926
1928
  }
1927
1929
  } catch (e) {
1928
- console.error('speak error: ', e);
1930
+ console.warn('speak error: ', e);
1929
1931
  window.speechSynthesis.speak(new SpeechSynthesisUtterance(text));
1930
1932
  setIsPlayingAudio(false);
1931
1933
  memoriSpeaking = false;
@@ -1970,7 +1972,7 @@ const MemoriWidget = ({
1970
1972
  audioDestination.close();
1971
1973
  }
1972
1974
  } catch (e) {
1973
- console.error('stopAudio error: ', e);
1975
+ console.debug('stopAudio error: ', e);
1974
1976
  }
1975
1977
  };
1976
1978
 
@@ -2096,9 +2098,9 @@ const MemoriWidget = ({
2096
2098
  resetTranscript();
2097
2099
  recognizer.startContinuousRecognitionAsync();
2098
2100
  })
2099
- .catch(console.error);
2101
+ .catch(console.debug);
2100
2102
  } catch (error) {
2101
- console.error(error);
2103
+ console.debug(error);
2102
2104
  }
2103
2105
  };
2104
2106
  const stopListening = () => {
@@ -2318,7 +2320,7 @@ const MemoriWidget = ({
2318
2320
  }
2319
2321
  } catch (_e) {
2320
2322
  let err = _e as Error;
2321
- console.error('[APPCONTEXT/QUERYGAMIFICATIONPOINTS]', err);
2323
+ console.debug('[APPCONTEXT/QUERYGAMIFICATIONPOINTS]', err);
2322
2324
  }
2323
2325
 
2324
2326
  return {
@@ -2332,7 +2334,7 @@ const MemoriWidget = ({
2332
2334
  .then(value => {
2333
2335
  setGamificationLevel(getGamificationLevel(value.points));
2334
2336
  })
2335
- .catch(console.error);
2337
+ .catch(console.debug);
2336
2338
  }
2337
2339
  // eslint-disable-next-line react-hooks/exhaustive-deps
2338
2340
  }, [memori.engineMemoriID]);
@@ -2530,7 +2532,7 @@ const MemoriWidget = ({
2530
2532
  if (memoriAudioElement && isSafari) {
2531
2533
  memoriAudioElement.muted = false;
2532
2534
  memoriAudioElement.play().catch((e: any) => {
2533
- console.error('error playing intro audio', e);
2535
+ console.warn('error playing intro audio', e);
2534
2536
  });
2535
2537
  }
2536
2538
 
@@ -2914,7 +2916,7 @@ const MemoriWidget = ({
2914
2916
  }
2915
2917
  } catch (e) {
2916
2918
  let err = e as Error;
2917
- console.error(err);
2919
+ console.debug(err);
2918
2920
  }
2919
2921
  }, [tenant?.billingDelegation, deepThoughtEnabled]);
2920
2922
  useEffect(() => {
@@ -3036,6 +3038,7 @@ const MemoriWidget = ({
3036
3038
  showContextPerLine,
3037
3039
  showAIicon,
3038
3040
  showWhyThisAnswer,
3041
+ showCopyButton,
3039
3042
  client,
3040
3043
  selectReceiverTag,
3041
3044
  preview,
@@ -101,13 +101,26 @@ exports[`renders SnippetUpload with css code 1`] = `
101
101
  >
102
102
  <svg
103
103
  aria-hidden="true"
104
+ fill="none"
104
105
  focusable="false"
105
106
  role="img"
106
- viewBox="0 0 1024 1024"
107
+ stroke="currentColor"
108
+ stroke-linecap="round"
109
+ stroke-linejoin="round"
110
+ stroke-width="1.5"
111
+ viewBox="0 0 24 24"
107
112
  xmlns="http://www.w3.org/2000/svg"
108
113
  >
114
+ <rect
115
+ height="14"
116
+ rx="2"
117
+ ry="2"
118
+ width="14"
119
+ x="8"
120
+ y="8"
121
+ />
109
122
  <path
110
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
123
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
111
124
  />
112
125
  </svg>
113
126
  </span>
@@ -197,13 +210,26 @@ exports[`renders SnippetUpload with html code 1`] = `
197
210
  >
198
211
  <svg
199
212
  aria-hidden="true"
213
+ fill="none"
200
214
  focusable="false"
201
215
  role="img"
202
- viewBox="0 0 1024 1024"
216
+ stroke="currentColor"
217
+ stroke-linecap="round"
218
+ stroke-linejoin="round"
219
+ stroke-width="1.5"
220
+ viewBox="0 0 24 24"
203
221
  xmlns="http://www.w3.org/2000/svg"
204
222
  >
223
+ <rect
224
+ height="14"
225
+ rx="2"
226
+ ry="2"
227
+ width="14"
228
+ x="8"
229
+ y="8"
230
+ />
205
231
  <path
206
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
232
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
207
233
  />
208
234
  </svg>
209
235
  </span>
@@ -257,13 +283,26 @@ exports[`renders SnippetUpload with js code 1`] = `
257
283
  >
258
284
  <svg
259
285
  aria-hidden="true"
286
+ fill="none"
260
287
  focusable="false"
261
288
  role="img"
262
- viewBox="0 0 1024 1024"
289
+ stroke="currentColor"
290
+ stroke-linecap="round"
291
+ stroke-linejoin="round"
292
+ stroke-width="1.5"
293
+ viewBox="0 0 24 24"
263
294
  xmlns="http://www.w3.org/2000/svg"
264
295
  >
296
+ <rect
297
+ height="14"
298
+ rx="2"
299
+ ry="2"
300
+ width="14"
301
+ x="8"
302
+ y="8"
303
+ />
265
304
  <path
266
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
305
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
267
306
  />
268
307
  </svg>
269
308
  </span>
@@ -425,13 +464,26 @@ exports[`renders SnippetUpload with js code without line numbers 1`] = `
425
464
  >
426
465
  <svg
427
466
  aria-hidden="true"
467
+ fill="none"
428
468
  focusable="false"
429
469
  role="img"
430
- viewBox="0 0 1024 1024"
470
+ stroke="currentColor"
471
+ stroke-linecap="round"
472
+ stroke-linejoin="round"
473
+ stroke-width="1.5"
474
+ viewBox="0 0 24 24"
431
475
  xmlns="http://www.w3.org/2000/svg"
432
476
  >
477
+ <rect
478
+ height="14"
479
+ rx="2"
480
+ ry="2"
481
+ width="14"
482
+ x="8"
483
+ y="8"
484
+ />
433
485
  <path
434
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
486
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
435
487
  />
436
488
  </svg>
437
489
  </span>
@@ -763,13 +815,26 @@ exports[`renders SnippetUpload with preview mode (clamping) 1`] = `
763
815
  >
764
816
  <svg
765
817
  aria-hidden="true"
818
+ fill="none"
766
819
  focusable="false"
767
820
  role="img"
768
- viewBox="0 0 1024 1024"
821
+ stroke="currentColor"
822
+ stroke-linecap="round"
823
+ stroke-linejoin="round"
824
+ stroke-width="1.5"
825
+ viewBox="0 0 24 24"
769
826
  xmlns="http://www.w3.org/2000/svg"
770
827
  >
828
+ <rect
829
+ height="14"
830
+ rx="2"
831
+ ry="2"
832
+ width="14"
833
+ x="8"
834
+ y="8"
835
+ />
771
836
  <path
772
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
837
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
773
838
  />
774
839
  </svg>
775
840
  </span>
@@ -2812,13 +2877,26 @@ exports[`renders SnippetUpload with react/tsx code 1`] = `
2812
2877
  >
2813
2878
  <svg
2814
2879
  aria-hidden="true"
2880
+ fill="none"
2815
2881
  focusable="false"
2816
2882
  role="img"
2817
- viewBox="0 0 1024 1024"
2883
+ stroke="currentColor"
2884
+ stroke-linecap="round"
2885
+ stroke-linejoin="round"
2886
+ stroke-width="1.5"
2887
+ viewBox="0 0 24 24"
2818
2888
  xmlns="http://www.w3.org/2000/svg"
2819
2889
  >
2890
+ <rect
2891
+ height="14"
2892
+ rx="2"
2893
+ ry="2"
2894
+ width="14"
2895
+ x="8"
2896
+ y="8"
2897
+ />
2820
2898
  <path
2821
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
2899
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2822
2900
  />
2823
2901
  </svg>
2824
2902
  </span>
@@ -2870,13 +2948,26 @@ exports[`renders SnippetUpload with text 1`] = `
2870
2948
  >
2871
2949
  <svg
2872
2950
  aria-hidden="true"
2951
+ fill="none"
2873
2952
  focusable="false"
2874
2953
  role="img"
2875
- viewBox="0 0 1024 1024"
2954
+ stroke="currentColor"
2955
+ stroke-linecap="round"
2956
+ stroke-linejoin="round"
2957
+ stroke-width="1.5"
2958
+ viewBox="0 0 24 24"
2876
2959
  xmlns="http://www.w3.org/2000/svg"
2877
2960
  >
2961
+ <rect
2962
+ height="14"
2963
+ rx="2"
2964
+ ry="2"
2965
+ width="14"
2966
+ x="8"
2967
+ y="8"
2968
+ />
2878
2969
  <path
2879
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
2970
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2880
2971
  />
2881
2972
  </svg>
2882
2973
  </span>
@@ -2928,13 +3019,26 @@ exports[`renders SnippetUpload with text as fallback 1`] = `
2928
3019
  >
2929
3020
  <svg
2930
3021
  aria-hidden="true"
3022
+ fill="none"
2931
3023
  focusable="false"
2932
3024
  role="img"
2933
- viewBox="0 0 1024 1024"
3025
+ stroke="currentColor"
3026
+ stroke-linecap="round"
3027
+ stroke-linejoin="round"
3028
+ stroke-width="1.5"
3029
+ viewBox="0 0 24 24"
2934
3030
  xmlns="http://www.w3.org/2000/svg"
2935
3031
  >
3032
+ <rect
3033
+ height="14"
3034
+ rx="2"
3035
+ ry="2"
3036
+ width="14"
3037
+ x="8"
3038
+ y="8"
3039
+ />
2936
3040
  <path
2937
- d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"
3041
+ d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2938
3042
  />
2939
3043
  </svg>
2940
3044
  </span>
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+
3
+ const Code = ({ className, title }: { className?: string; title?: string }) => (
4
+ <svg
5
+ {...(!title ? { 'aria-hidden': 'true' } : {})}
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="1.5"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ focusable="false"
14
+ role="img"
15
+ className={className}
16
+ aria-label={title}
17
+ >
18
+ <path d="M10 9.5 8 12l2 2.5" />
19
+ <path d="m14 9.5 2 2.5-2 2.5" />
20
+ <rect width="18" height="18" x="3" y="3" rx="2" />
21
+ </svg>
22
+ );
23
+
24
+ export default Code;
@@ -4,13 +4,19 @@ const Copy = ({ className, title }: { className?: string; title?: string }) => (
4
4
  <svg
5
5
  {...(!title ? { 'aria-hidden': 'true' } : {})}
6
6
  xmlns="http://www.w3.org/2000/svg"
7
- viewBox="0 0 1024 1024"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ stroke-width="1.5"
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
8
13
  focusable="false"
9
14
  role="img"
10
15
  className={className}
11
16
  aria-label={title}
12
17
  >
13
- <path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" />
18
+ <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
19
+ <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
14
20
  </svg>
15
21
  );
16
22
 
package/src/index.tsx CHANGED
@@ -28,6 +28,7 @@ export interface Props {
28
28
  layout?: WidgetProps['layout'];
29
29
  customLayout?: WidgetProps['customLayout'];
30
30
  showShare?: boolean;
31
+ showCopyButton?: boolean;
31
32
  showInstruct?: boolean;
32
33
  showInputs?: boolean;
33
34
  showDates?: boolean;
@@ -88,6 +89,7 @@ const Memori: React.FC<Props> = ({
88
89
  layout = 'DEFAULT',
89
90
  customLayout,
90
91
  showShare = true,
92
+ showCopyButton = true,
91
93
  showSettings = true,
92
94
  showInstruct = false,
93
95
  showTypingText = false,
@@ -239,6 +241,7 @@ const Memori: React.FC<Props> = ({
239
241
  secret={secretToken}
240
242
  sessionID={sessionID}
241
243
  showShare={showShare}
244
+ showCopyButton={showCopyButton}
242
245
  showSettings={showSettings}
243
246
  showInstruct={showInstruct}
244
247
  showTypingText={showTypingText}
@@ -314,6 +317,7 @@ Memori.propTypes = {
314
317
  ]),
315
318
  customLayout: PropTypes.any,
316
319
  showShare: PropTypes.bool,
320
+ showCopyButton: PropTypes.bool,
317
321
  showInstruct: PropTypes.bool,
318
322
  showInputs: PropTypes.bool,
319
323
  showDates: PropTypes.bool,
@@ -28,6 +28,7 @@
28
28
  "next": "Next",
29
29
  "previous": "Previous",
30
30
  "copy": "Copy",
31
+ "copyRawCode": "Copy raw code",
31
32
  "copyToClipboard": "Copy to clipboard",
32
33
  "showOriginalText": "Show original",
33
34
  "showTranslatedText": "Show translation",
@@ -28,6 +28,7 @@
28
28
  "next": "Successivo",
29
29
  "previous": "Precedente",
30
30
  "copy": "Copia",
31
+ "copyRawCode": "Copia codice sorgente",
31
32
  "copyToClipboard": "Copia negli appunti",
32
33
  "showOriginalText": "Mostra originale",
33
34
  "showTranslatedText": "Mostra traduzione",