@memori.ai/memori-react 9.0.0-alpha.21 → 9.0.0-alpha.23

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 (283) hide show
  1. package/CHANGELOG.md +453 -0
  2. package/dist/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
  3. package/dist/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
  4. package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
  5. package/dist/components/Auth/Auth.css +12 -5
  6. package/dist/components/Auth/Auth.d.ts +1 -1
  7. package/dist/components/Auth/Auth.js +46 -32
  8. package/dist/components/Auth/Auth.js.map +1 -1
  9. package/dist/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
  10. package/dist/components/Chat/Chat.css +1 -0
  11. package/dist/components/Chat/Chat.js +1 -1
  12. package/dist/components/Chat/Chat.js.map +1 -1
  13. package/dist/components/ChatBubble/ChatBubble.css +32 -5
  14. package/dist/components/ChatBubble/ChatBubble.js +14 -11
  15. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  16. package/dist/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
  17. package/dist/components/ChatHistoryDrawer/ChatHistory.js +2 -2
  18. package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
  19. package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
  20. package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
  21. package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +7 -57
  22. package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
  23. package/dist/components/ChatInputs/ChatInputs.js +10 -1
  24. package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
  25. package/dist/components/ChatTextArea/ChatTextArea.css +1 -1
  26. package/dist/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
  27. package/dist/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
  28. package/dist/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
  29. package/dist/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
  30. package/dist/components/FeedbackButtons/FeedbackButtons.js +2 -2
  31. package/dist/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
  32. package/dist/components/Header/Header.css +8 -3
  33. package/dist/components/Header/Header.js +15 -18
  34. package/dist/components/Header/Header.js.map +1 -1
  35. package/dist/components/IconButton/IconButton.d.ts +1 -1
  36. package/dist/components/KnownFacts/KnownFacts.css +1 -1
  37. package/dist/components/KnownFacts/KnownFacts.js +2 -5
  38. package/dist/components/KnownFacts/KnownFacts.js.map +1 -1
  39. package/dist/components/LoginDrawer/LoginDrawer.css +16 -14
  40. package/dist/components/LoginDrawer/LoginDrawer.js +19 -11
  41. package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
  42. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
  43. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
  44. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
  45. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  46. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
  47. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
  48. package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -0
  49. package/dist/components/MemoriWidget/MemoriWidget.js +93 -32
  50. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  51. package/dist/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
  52. package/dist/components/PositionPopover/PositionPopover.css +3 -3
  53. package/dist/components/PositionPopover/PositionPopover.js +38 -25
  54. package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
  55. package/dist/components/Snippet/Snippet.css +1 -1
  56. package/dist/components/StartPanel/StartPanel.css +19 -3
  57. package/dist/components/StartPanel/StartPanel.js +12 -18
  58. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  59. package/dist/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
  60. package/dist/components/layouts/chat.css +5 -2
  61. package/dist/components/layouts/totem.css +43 -9
  62. package/dist/helpers/nats/getNatsConfig.js.map +1 -1
  63. package/dist/helpers/nats/useNats.d.ts +2 -1
  64. package/dist/helpers/nats/useNats.js +87 -20
  65. package/dist/helpers/nats/useNats.js.map +1 -1
  66. package/dist/helpers/nats/useNatsSession.d.ts +6 -1
  67. package/dist/helpers/nats/useNatsSession.js +48 -7
  68. package/dist/helpers/nats/useNatsSession.js.map +1 -1
  69. package/dist/helpers/positionPopover.d.ts +2 -1
  70. package/dist/helpers/positionPopover.js +10 -2
  71. package/dist/helpers/positionPopover.js.map +1 -1
  72. package/dist/icons/MemoriIcon.js +1 -1
  73. package/dist/icons/MemoriIcon.js.map +1 -1
  74. package/dist/locales/de.json +4 -1
  75. package/dist/locales/en.json +3 -1
  76. package/dist/locales/es.json +3 -1
  77. package/dist/locales/fr.json +3 -1
  78. package/dist/locales/it.json +3 -1
  79. package/dist/styles.css +1 -1
  80. package/dist/version.d.ts +1 -1
  81. package/dist/version.js +1 -1
  82. package/esm/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
  83. package/esm/components/AgeVerificationModal/AgeVerificationModal.js +1 -1
  84. package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
  85. package/esm/components/Auth/Auth.css +12 -5
  86. package/esm/components/Auth/Auth.d.ts +1 -1
  87. package/esm/components/Auth/Auth.js +47 -33
  88. package/esm/components/Auth/Auth.js.map +1 -1
  89. package/esm/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
  90. package/esm/components/Chat/Chat.css +1 -0
  91. package/esm/components/Chat/Chat.js +1 -1
  92. package/esm/components/Chat/Chat.js.map +1 -1
  93. package/esm/components/ChatBubble/ChatBubble.css +32 -5
  94. package/esm/components/ChatBubble/ChatBubble.js +14 -11
  95. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  96. package/esm/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -1
  97. package/esm/components/ChatHistoryDrawer/ChatHistory.js +2 -2
  98. package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
  99. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
  100. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +3 -1
  101. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js +9 -59
  102. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
  103. package/esm/components/ChatInputs/ChatInputs.js +11 -2
  104. package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
  105. package/esm/components/ChatTextArea/ChatTextArea.css +1 -1
  106. package/esm/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
  107. package/esm/components/ContentPreviewModal/ContentPreviewModal.js +1 -1
  108. package/esm/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
  109. package/esm/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
  110. package/esm/components/FeedbackButtons/FeedbackButtons.js +2 -2
  111. package/esm/components/FeedbackButtons/FeedbackButtons.js.map +1 -1
  112. package/esm/components/Header/Header.css +8 -3
  113. package/esm/components/Header/Header.js +15 -18
  114. package/esm/components/Header/Header.js.map +1 -1
  115. package/esm/components/IconButton/IconButton.d.ts +1 -1
  116. package/esm/components/KnownFacts/KnownFacts.css +1 -1
  117. package/esm/components/KnownFacts/KnownFacts.js +2 -5
  118. package/esm/components/KnownFacts/KnownFacts.js.map +1 -1
  119. package/esm/components/LoginDrawer/LoginDrawer.css +16 -14
  120. package/esm/components/LoginDrawer/LoginDrawer.js +20 -12
  121. package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
  122. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
  123. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
  124. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
  125. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  126. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +1 -1
  127. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
  128. package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -0
  129. package/esm/components/MemoriWidget/MemoriWidget.js +93 -33
  130. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  131. package/esm/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
  132. package/esm/components/PositionPopover/PositionPopover.css +3 -3
  133. package/esm/components/PositionPopover/PositionPopover.js +39 -26
  134. package/esm/components/PositionPopover/PositionPopover.js.map +1 -1
  135. package/esm/components/Snippet/Snippet.css +1 -1
  136. package/esm/components/StartPanel/StartPanel.css +19 -3
  137. package/esm/components/StartPanel/StartPanel.js +12 -18
  138. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  139. package/esm/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
  140. package/esm/components/layouts/chat.css +5 -2
  141. package/esm/components/layouts/totem.css +43 -9
  142. package/esm/helpers/nats/getNatsConfig.js.map +1 -1
  143. package/esm/helpers/nats/useNats.d.ts +2 -1
  144. package/esm/helpers/nats/useNats.js +87 -20
  145. package/esm/helpers/nats/useNats.js.map +1 -1
  146. package/esm/helpers/nats/useNatsSession.d.ts +6 -1
  147. package/esm/helpers/nats/useNatsSession.js +48 -8
  148. package/esm/helpers/nats/useNatsSession.js.map +1 -1
  149. package/esm/helpers/positionPopover.d.ts +2 -1
  150. package/esm/helpers/positionPopover.js +9 -2
  151. package/esm/helpers/positionPopover.js.map +1 -1
  152. package/esm/icons/MemoriIcon.js +1 -1
  153. package/esm/icons/MemoriIcon.js.map +1 -1
  154. package/esm/locales/de.json +4 -1
  155. package/esm/locales/en.json +3 -1
  156. package/esm/locales/es.json +3 -1
  157. package/esm/locales/fr.json +3 -1
  158. package/esm/locales/it.json +3 -1
  159. package/esm/styles.css +1 -1
  160. package/esm/version.d.ts +1 -1
  161. package/esm/version.js +1 -1
  162. package/package.json +8 -5
  163. package/src/Live/Agents.stories.tsx +49 -0
  164. package/src/Live/KnownFacts.stories.tsx +50 -0
  165. package/src/Showcase.stories.tsx +3 -14
  166. package/src/components/AgeVerificationModal/AgeVerificationModal.css +1 -7
  167. package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +1 -1
  168. package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +1 -0
  169. package/src/components/Auth/Auth.css +12 -5
  170. package/src/components/Auth/Auth.stories.tsx +1 -1
  171. package/src/components/Auth/Auth.test.tsx +68 -1
  172. package/src/components/Auth/Auth.tsx +69 -54
  173. package/src/components/Auth/__snapshots__/Auth.test.tsx.snap +5 -6
  174. package/src/components/Avatar/Avatar.stories.tsx +1 -18
  175. package/src/components/Avatar/AvatarView/AvatarView.stories.tsx +1 -103
  176. package/src/components/Blob/Blob.stories.tsx +1 -1
  177. package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.css +7 -6
  178. package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +1 -1
  179. package/src/components/ChangeMode/ChangeMode.stories.tsx +1 -1
  180. package/src/components/Chat/Chat.css +1 -0
  181. package/src/components/Chat/Chat.stories.tsx +61 -7
  182. package/src/components/Chat/Chat.tsx +1 -0
  183. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +151 -151
  184. package/src/components/ChatBubble/ChatBubble.css +32 -5
  185. package/src/components/ChatBubble/ChatBubble.stories.tsx +24 -2
  186. package/src/components/ChatBubble/ChatBubble.test.tsx +37 -1
  187. package/src/components/ChatBubble/ChatBubble.tsx +308 -299
  188. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +384 -264
  189. package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +1 -1
  190. package/src/components/ChatHistoryDrawer/ChatHistory.tsx +6 -0
  191. package/src/components/ChatHistoryDrawer/ChatResumeDrawer.css +1 -1
  192. package/src/components/ChatHistoryDrawer/ChatResumeDrawer.tsx +24 -81
  193. package/src/components/ChatInputs/ChatInputs.stories.tsx +1 -39
  194. package/src/components/ChatInputs/ChatInputs.test.tsx +47 -0
  195. package/src/components/ChatInputs/ChatInputs.tsx +12 -2
  196. package/src/components/ChatTextArea/ChatTextArea.css +1 -1
  197. package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +1 -1
  198. package/src/components/ContentPreviewModal/ContentPreviewModal.css +1 -10
  199. package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +1 -1
  200. package/src/components/ExpertsDrawer/ExpertsDrawer.css +0 -6
  201. package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +1 -1
  202. package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +29 -10
  203. package/src/components/FeedbackButtons/FeedbackButtons.tsx +2 -0
  204. package/src/components/FeedbackButtons/__snapshots__/FeedbackButtons.test.tsx.snap +1 -1
  205. package/src/components/Header/Header.css +8 -3
  206. package/src/components/Header/Header.stories.tsx +1 -1
  207. package/src/components/Header/Header.tsx +146 -117
  208. package/src/components/KnownFacts/KnownFacts.css +1 -1
  209. package/src/components/KnownFacts/KnownFacts.stories.tsx +1 -23
  210. package/src/components/KnownFacts/KnownFacts.tsx +4 -9
  211. package/src/components/KnownFacts/__snapshots__/KnownFacts.test.tsx.snap +6 -2
  212. package/src/components/LoginDrawer/LoginDrawer.css +16 -14
  213. package/src/components/LoginDrawer/LoginDrawer.stories.tsx +2 -52
  214. package/src/components/LoginDrawer/LoginDrawer.tsx +51 -39
  215. package/src/components/LoginDrawer/__snapshots__/LoginDrawer.test.tsx.snap +33 -11
  216. package/src/components/MediaWidget/MediaItemWidget.stories.tsx +1 -15
  217. package/src/components/MediaWidget/MediaWidget.stories.tsx +1 -45
  218. package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +1 -1
  219. package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +4 -4
  220. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +28 -5
  221. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +4 -6
  222. package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +1 -1
  223. package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +32 -28
  224. package/src/components/MemoriWidget/MemoriUIProvider.contract.test.tsx +55 -0
  225. package/src/components/MemoriWidget/MemoriWidget.stories.tsx +55 -77
  226. package/src/components/MemoriWidget/MemoriWidget.tsx +114 -45
  227. package/src/components/MemoriWidget/getChatStyles.test.ts +24 -0
  228. package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +1 -1
  229. package/src/components/MobileSessionPanel/MobileSessionPanel.css +2 -2
  230. package/src/components/PositionPopover/PositionPopover.css +3 -3
  231. package/src/components/PositionPopover/PositionPopover.stories.tsx +1 -1
  232. package/src/components/PositionPopover/PositionPopover.tsx +50 -28
  233. package/src/components/PoweredBy/PoweredBy.stories.tsx +1 -54
  234. package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +2 -2
  235. package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +1 -1
  236. package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +1 -1
  237. package/src/components/ShareButton/ShareButton.stories.tsx +1 -1
  238. package/src/components/Snippet/Snippet.css +1 -1
  239. package/src/components/Snippet/Snippet.stories.tsx +1 -1
  240. package/src/components/StartPanel/StartPanel.css +19 -3
  241. package/src/components/StartPanel/StartPanel.stories.tsx +2 -2
  242. package/src/components/StartPanel/StartPanel.tsx +22 -35
  243. package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +177 -121
  244. package/src/components/Typing/Typing.stories.tsx +1 -1
  245. package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +22 -44
  246. package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +9 -3
  247. package/src/components/layouts/FullBody/FullBody.stories.tsx +55 -68
  248. package/src/components/layouts/Totem/Totem.stories.tsx +69 -87
  249. package/src/components/layouts/WebsiteAssistant/website-assistant.css +3 -3
  250. package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +69 -87
  251. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +19 -41
  252. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +39 -83
  253. package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +15 -11
  254. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +116 -42
  255. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +18 -40
  256. package/src/components/layouts/chat.css +5 -2
  257. package/src/components/layouts/layouts.stories.tsx +96 -179
  258. package/src/components/layouts/totem.css +43 -9
  259. package/src/helpers/nats/getNatsConfig.ts +4 -1
  260. package/src/helpers/nats/useNats.test.tsx +81 -0
  261. package/src/helpers/nats/useNats.ts +109 -29
  262. package/src/helpers/nats/useNatsSession.test.ts +16 -0
  263. package/src/helpers/nats/useNatsSession.ts +79 -13
  264. package/src/helpers/positionPopover.test.ts +36 -1
  265. package/src/helpers/positionPopover.ts +21 -4
  266. package/src/i18n.knownFacts.test.ts +40 -0
  267. package/src/icons/MemoriIcon.tsx +1 -1
  268. package/src/index.stories.tsx +1 -47
  269. package/src/locales/de.json +4 -1
  270. package/src/locales/en.json +3 -1
  271. package/src/locales/es.json +3 -1
  272. package/src/locales/fr.json +3 -1
  273. package/src/locales/it.json +3 -1
  274. package/src/styles.css +13 -27
  275. package/src/version.ts +1 -1
  276. package/src/components/ChatTextArea/ChatTextArea.stories.tsx +0 -55
  277. package/src/components/CustomGLBModelViewer/ModelViewer.stories.tsx +0 -58
  278. package/src/components/DateSelector/DateSelector.stories.tsx +0 -47
  279. package/src/components/FilePreview/FilePreview.stories.tsx +0 -63
  280. package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +0 -265
  281. package/src/components/UploadButton/UploadButton.stories.tsx +0 -510
  282. package/src/components/VenueWidget/VenueWidget.stories.tsx +0 -69
  283. package/src/components/layouts/WebsiteAssistant/WebsiteAssistant.stories.tsx +0 -115
@@ -1,510 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Meta, Story } from '@storybook/react';
3
- import { AlertProvider, AlertViewport } from '@memori.ai/ui';
4
- import I18nWrapper from '../../I18nWrapper';
5
- import UploadButton from './UploadButton';
6
- import FilePreview from '../FilePreview/FilePreview';
7
- import memoriApiClient from '@memori.ai/memori-api-client';
8
- import './UploadButton.css';
9
-
10
- // Mock API client for stories
11
- const createMockClient = () => {
12
- return {
13
- backend: {
14
- uploadAsset: async (
15
- fileName: string,
16
- fileDataUrl: string,
17
- authToken: string
18
- ) => {
19
- // Simulate API delay
20
- await new Promise(resolve => setTimeout(resolve, 1000));
21
- return {
22
- resultCode: 0,
23
- resultMessage: 'Success',
24
- asset: {
25
- assetURL: `https://example.com/assets/${fileName}`,
26
- mimeType: 'image/jpeg',
27
- assetID: `asset-${Date.now()}`,
28
- },
29
- };
30
- },
31
- uploadAssetUnlogged: async (
32
- fileName: string,
33
- fileDataUrl: string,
34
- memoriID: string,
35
- sessionID: string
36
- ) => {
37
- // Simulate API delay
38
- await new Promise(resolve => setTimeout(resolve, 1000));
39
- return {
40
- resultCode: 0,
41
- resultMessage: 'Success',
42
- asset: {
43
- assetURL: `https://example.com/assets/${fileName}`,
44
- mimeType: 'image/jpeg',
45
- assetID: `asset-${Date.now()}`,
46
- },
47
- };
48
- },
49
- },
50
- dialog: {
51
- postMediumSelectedEvent: async (sessionID: string, medium: any) => {
52
- await new Promise(resolve => setTimeout(resolve, 500));
53
- return {
54
- currentState: {
55
- currentMedia: [
56
- {
57
- mediumID: `medium-${Date.now()}`,
58
- url: medium.url,
59
- mimeType: medium.mimeType,
60
- },
61
- ],
62
- },
63
- };
64
- },
65
- postMediumDeselectedEvent: async (
66
- sessionID: string,
67
- mediumID: string
68
- ) => {
69
- await new Promise(resolve => setTimeout(resolve, 500));
70
- return { success: true };
71
- },
72
- },
73
- };
74
- };
75
-
76
- // Define the component props
77
- interface UploadButtonProps {
78
- authToken?: string;
79
- client?: ReturnType<typeof memoriApiClient>;
80
- sessionID?: string;
81
- isMediaAccepted?: boolean;
82
- setDocumentPreviewFiles: (
83
- files: {
84
- name: string;
85
- id: string;
86
- content: string;
87
- type?: string;
88
- mediumID?: string;
89
- mimeType?: string;
90
- url?: string;
91
- }[]
92
- ) => void;
93
- documentPreviewFiles: {
94
- name: string;
95
- id: string;
96
- content: string;
97
- type?: string;
98
- mediumID?: string;
99
- mimeType?: string;
100
- url?: string;
101
- }[];
102
- memoriID?: string;
103
- }
104
-
105
- const meta: Meta<UploadButtonProps> = {
106
- title: 'Widget/Upload Button',
107
- component: UploadButton as React.ComponentType<UploadButtonProps>,
108
- argTypes: {
109
- isMediaAccepted: {
110
- control: {
111
- type: 'boolean',
112
- },
113
- description: 'Whether media (images) uploads are accepted',
114
- },
115
- authToken: {
116
- control: {
117
- type: 'text',
118
- },
119
- description: 'Authentication token for logged-in users',
120
- },
121
- sessionID: {
122
- control: {
123
- type: 'text',
124
- },
125
- description: 'Session ID for the current chat session',
126
- },
127
- memoriID: {
128
- control: {
129
- type: 'text',
130
- },
131
- description: 'Memori ID for unauthenticated uploads',
132
- },
133
- },
134
- parameters: {
135
- controls: { expanded: true },
136
- docs: {
137
- description: {
138
- component: `
139
- # Upload Button Component
140
-
141
- A unified upload button that supports both images and documents with the following features:
142
-
143
- ## Features
144
-
145
- - **Direct File Chooser**: Clicking the button opens the file chooser directly (no menu)
146
- - **Unified Input**: Single file input accepts both images and documents
147
- - **Automatic File Type Detection**: Files are automatically categorized as images or documents and routed to the appropriate handler
148
- - **Keyboard Shortcut**: Press \`Cmd+V\` (Mac) or \`Ctrl+V\` (Windows/Linux) to open the file chooser (when not in a text input)
149
- - **Drag and Drop**: Drag files anywhere in the widget to upload them
150
- - **Paste Support**: Paste files from clipboard using \`Cmd+V\` / \`Ctrl+V\`
151
-
152
- ## Limits
153
-
154
- - **Images**: Maximum 5 images, 15MB per file, formats: .jpg, .jpeg, .png
155
- - **Documents**: Maximum 5 documents, 25MB per file; PDF, Office, OpenDocument, HTML, structured text, and plain-text formats
156
- - **Content**: Document content is limited to 300,000 characters per document (truncated if exceeded)
157
- `,
158
- },
159
- },
160
- },
161
- };
162
-
163
- export default meta;
164
-
165
- // Create the template
166
- const Template: Story<UploadButtonProps> = args => {
167
- const [documentPreviewFiles, setDocumentPreviewFiles] = useState<
168
- {
169
- name: string;
170
- id: string;
171
- content: string;
172
- type?: string;
173
- mediumID?: string;
174
- mimeType?: string;
175
- url?: string;
176
- }[]
177
- >([]);
178
-
179
- const removeFile = (id: string, mediumID?: string) => {
180
- setDocumentPreviewFiles(prev => prev.filter(file => file.id !== id));
181
- };
182
-
183
- return (
184
- <I18nWrapper>
185
- <AlertProvider>
186
- <div
187
- style={{
188
- minHeight: '500px',
189
- display: 'flex',
190
- flexDirection: 'column',
191
- alignItems: 'flex-start',
192
- justifyContent: 'flex-start',
193
- padding: '20px',
194
- border: '1px solid #eee',
195
- borderRadius: '8px',
196
- backgroundColor: '#f9f9f9',
197
- }}
198
- >
199
- <div
200
- style={{
201
- alignSelf: 'flex-end',
202
- marginBottom: '20px',
203
- position: 'relative',
204
- }}
205
- >
206
- <UploadButton
207
- {...args}
208
- setDocumentPreviewFiles={setDocumentPreviewFiles}
209
- documentPreviewFiles={documentPreviewFiles}
210
- {...(args.client
211
- ? { client: args.client }
212
- : { client: createMockClient() as any })}
213
- />
214
- </div>
215
-
216
- <div style={{ width: '100%', marginTop: '20px' }}>
217
- <h3
218
- style={{
219
- marginBottom: '10px',
220
- fontSize: '16px',
221
- fontWeight: '600',
222
- }}
223
- >
224
- Uploaded Files ({documentPreviewFiles.length})
225
- </h3>
226
- {documentPreviewFiles.length > 0 ? (
227
- <FilePreview
228
- previewFiles={documentPreviewFiles}
229
- removeFile={removeFile}
230
- />
231
- ) : (
232
- <p
233
- style={{ color: '#999', fontStyle: 'italic', fontSize: '14px' }}
234
- >
235
- No files uploaded yet. Click the upload button, drag & drop
236
- files, or use Cmd+V / Ctrl+V to upload.
237
- </p>
238
- )}
239
- </div>
240
-
241
- <div
242
- style={{
243
- marginTop: '30px',
244
- padding: '15px',
245
- backgroundColor: '#fff',
246
- borderRadius: '6px',
247
- border: '1px solid #ddd',
248
- fontSize: '13px',
249
- color: '#666',
250
- }}
251
- >
252
- <strong>Try these features:</strong>
253
- <ul style={{ marginTop: '8px', paddingLeft: '20px' }}>
254
- <li>Click the upload button to open file chooser</li>
255
- <li>Drag and drop files anywhere in this area</li>
256
- <li>
257
- Press{' '}
258
- <kbd
259
- style={{
260
- padding: '2px 6px',
261
- backgroundColor: '#f0f0f0',
262
- borderRadius: '3px',
263
- }}
264
- >
265
- Cmd+V
266
- </kbd>{' '}
267
- /{' '}
268
- <kbd
269
- style={{
270
- padding: '2px 6px',
271
- backgroundColor: '#f0f0f0',
272
- borderRadius: '3px',
273
- }}
274
- >
275
- Ctrl+V
276
- </kbd>{' '}
277
- to open file chooser
278
- </li>
279
- <li>
280
- Paste files from clipboard using{' '}
281
- <kbd
282
- style={{
283
- padding: '2px 6px',
284
- backgroundColor: '#f0f0f0',
285
- borderRadius: '3px',
286
- }}
287
- >
288
- Cmd+V
289
- </kbd>{' '}
290
- /{' '}
291
- <kbd
292
- style={{
293
- padding: '2px 6px',
294
- backgroundColor: '#f0f0f0',
295
- borderRadius: '3px',
296
- }}
297
- >
298
- Ctrl+V
299
- </kbd>
300
- </li>
301
- <li>
302
- Upload images and supported PDF, Office, OpenDocument, HTML, or
303
- text documents
304
- </li>
305
- </ul>
306
- </div>
307
- </div>
308
- </AlertProvider>
309
- </I18nWrapper>
310
- );
311
- };
312
-
313
- // Default state - no auth token, documents only
314
- export const Default = Template.bind({});
315
- Default.args = {
316
- authToken: '',
317
- sessionID: 'session-123',
318
- isMediaAccepted: false,
319
- memoriID: 'memori-123',
320
- documentPreviewFiles: [],
321
- };
322
- Default.parameters = {
323
- docs: {
324
- description: {
325
- story:
326
- 'Default state with documents only (no images). Users can upload up to 5 documents. Click the button to open the file chooser directly.',
327
- },
328
- },
329
- };
330
-
331
- // Authenticated user - can upload documents
332
- export const AuthenticatedDocumentsOnly = Template.bind({});
333
- AuthenticatedDocumentsOnly.args = {
334
- authToken: 'dummy-auth-token-12345',
335
- sessionID: 'session-123',
336
- isMediaAccepted: false,
337
- documentPreviewFiles: [],
338
- };
339
- AuthenticatedDocumentsOnly.parameters = {
340
- docs: {
341
- description: {
342
- story:
343
- 'Authenticated user can upload documents. The button opens the file chooser directly when clicked.',
344
- },
345
- },
346
- };
347
-
348
- // Authenticated user - can upload documents and images
349
- export const AuthenticatedWithImages = Template.bind({});
350
- AuthenticatedWithImages.args = {
351
- authToken: 'dummy-auth-token-12345',
352
- sessionID: 'session-123',
353
- isMediaAccepted: true,
354
- memoriID: 'memori-123',
355
- documentPreviewFiles: [],
356
- };
357
- AuthenticatedWithImages.parameters = {
358
- docs: {
359
- description: {
360
- story:
361
- 'Full functionality: authenticated user can upload both images and documents. Supports drag & drop, Cmd+V / Ctrl+V shortcut, and paste from clipboard.',
362
- },
363
- },
364
- };
365
-
366
- // With existing files
367
- export const WithExistingFiles = Template.bind({});
368
- WithExistingFiles.args = {
369
- authToken: 'dummy-auth-token-12345',
370
- sessionID: 'session-123',
371
- isMediaAccepted: true,
372
- memoriID: 'memori-123',
373
- documentPreviewFiles: [
374
- {
375
- id: '1',
376
- name: 'document.pdf',
377
- content: 'Sample document content',
378
- type: 'document',
379
- mimeType: 'application/pdf',
380
- },
381
- {
382
- id: '2',
383
- name: 'image.jpg',
384
- content: 'https://example.com/image.jpg',
385
- type: 'image',
386
- mimeType: 'image/jpeg',
387
- url: 'https://example.com/image.jpg',
388
- mediumID: 'medium-123',
389
- },
390
- ],
391
- };
392
- WithExistingFiles.parameters = {
393
- docs: {
394
- description: {
395
- story:
396
- 'Shows the upload button with existing files. The document count indicator shows 2/5. You can still upload more files up to the limit.',
397
- },
398
- },
399
- };
400
-
401
- // At maximum capacity
402
- export const AtMaximumCapacity = Template.bind({});
403
- AtMaximumCapacity.args = {
404
- authToken: 'dummy-auth-token-12345',
405
- sessionID: 'session-123',
406
- isMediaAccepted: true,
407
- memoriID: 'memori-123',
408
- documentPreviewFiles: [
409
- {
410
- id: '1',
411
- name: 'doc1.pdf',
412
- content: 'Content 1',
413
- type: 'document',
414
- mimeType: 'application/pdf',
415
- },
416
- {
417
- id: '2',
418
- name: 'doc2.pdf',
419
- content: 'Content 2',
420
- type: 'document',
421
- mimeType: 'application/pdf',
422
- },
423
- {
424
- id: '3',
425
- name: 'doc3.pdf',
426
- content: 'Content 3',
427
- type: 'document',
428
- mimeType: 'application/pdf',
429
- },
430
- {
431
- id: '4',
432
- name: 'doc4.pdf',
433
- content: 'Content 4',
434
- type: 'document',
435
- mimeType: 'application/pdf',
436
- },
437
- {
438
- id: '5',
439
- name: 'doc5.pdf',
440
- content: 'Content 5',
441
- type: 'document',
442
- mimeType: 'application/pdf',
443
- },
444
- ],
445
- };
446
- AtMaximumCapacity.parameters = {
447
- docs: {
448
- description: {
449
- story:
450
- 'Button is disabled when maximum capacity (5 documents) is reached. The count indicator shows 5/5.',
451
- },
452
- },
453
- };
454
-
455
- // Not authenticated but media accepted
456
- export const UnauthenticatedWithMediaAccepted = Template.bind({});
457
- UnauthenticatedWithMediaAccepted.args = {
458
- authToken: '',
459
- sessionID: 'session-123',
460
- isMediaAccepted: true,
461
- memoriID: 'memori-123',
462
- documentPreviewFiles: [],
463
- };
464
- UnauthenticatedWithMediaAccepted.parameters = {
465
- docs: {
466
- description: {
467
- story:
468
- 'Unauthenticated user with media accepted. Images can be uploaded using unlogged API. Documents work normally.',
469
- },
470
- },
471
- };
472
-
473
- // Mobile view simulation
474
- export const MobileView = Template.bind({});
475
- MobileView.args = {
476
- authToken: 'dummy-auth-token-12345',
477
- sessionID: 'session-123',
478
- isMediaAccepted: true,
479
- memoriID: 'memori-123',
480
- documentPreviewFiles: [],
481
- };
482
- MobileView.parameters = {
483
- viewport: {
484
- defaultViewport: 'mobile1',
485
- },
486
- docs: {
487
- description: {
488
- story:
489
- 'Mobile view simulation. All features work on mobile: tap to upload, drag & drop (on supported devices), and paste from clipboard.',
490
- },
491
- },
492
- };
493
-
494
- // Drag and drop demonstration
495
- export const DragAndDropDemo = Template.bind({});
496
- DragAndDropDemo.args = {
497
- authToken: 'dummy-auth-token-12345',
498
- sessionID: 'session-123',
499
- isMediaAccepted: true,
500
- memoriID: 'memori-123',
501
- documentPreviewFiles: [],
502
- };
503
- DragAndDropDemo.parameters = {
504
- docs: {
505
- description: {
506
- story:
507
- 'Try dragging files from your file system into this area. The overlay will appear when dragging files over the chat area. Files are automatically categorized as images or documents.',
508
- },
509
- },
510
- };
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import { Meta, Story } from '@storybook/react';
3
- import I18nWrapper from '../../I18nWrapper';
4
- import VenueWidget, { Props } from './VenueWidget';
5
- import { venue } from '../../mocks/data';
6
- import './VenueWidget.css';
7
- import { AlertProvider } from '@memori.ai/ui';
8
-
9
- const meta: Meta = {
10
- title: 'Widget/VenueWidget',
11
- component: VenueWidget,
12
- parameters: {
13
- controls: { expanded: true },
14
- },
15
- };
16
-
17
- export default meta;
18
-
19
- const Template: Story<Props> = args => {
20
- const [venue, setVenue] = React.useState(args.venue);
21
- return (
22
- <I18nWrapper>
23
- <AlertProvider defaultDuration={5000}>
24
- <VenueWidget {...args} venue={venue} setVenue={setVenue} />
25
- </AlertProvider>
26
- </I18nWrapper>
27
- );
28
- };
29
-
30
- // By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
31
- // https://storybook.js.org/docs/react/workflows/unit-testing
32
- export const Default = Template.bind({});
33
- Default.args = {};
34
-
35
- export const WithVenueExactLocartion = Template.bind({});
36
- WithVenueExactLocartion.args = {
37
- venue: {
38
- ...venue,
39
- uncertainty: 0,
40
- },
41
- };
42
-
43
- export const WithVenueUncertainty = Template.bind({});
44
- WithVenueUncertainty.args = {
45
- venue: {
46
- ...venue,
47
- uncertainty: 2,
48
- },
49
- };
50
-
51
- export const WithVenueLargeUncertainty = Template.bind({});
52
- WithVenueLargeUncertainty.args = {
53
- venue: {
54
- ...venue,
55
- uncertainty: 20,
56
- },
57
- };
58
-
59
- export const WithUncertaintyUI = Template.bind({});
60
- WithUncertaintyUI.args = {
61
- venue,
62
- showUncertainty: true,
63
- };
64
-
65
- export const WithoutGpsButton = Template.bind({});
66
- WithoutGpsButton.args = {
67
- venue,
68
- showGpsButton: false,
69
- };
@@ -1,115 +0,0 @@
1
- import React from 'react';
2
- import { Meta, Story } from '@storybook/react';
3
- import { memori, tenant, integration } from '../../../mocks/data';
4
- import Memori, { Props } from '../../../index';
5
- import I18nWrapper from '../../../I18nWrapper';
6
- import { VisemeProvider } from '../../../context/visemeContext';
7
- import { ArtifactProvider } from '../../MemoriArtifactSystem/context/ArtifactContext';
8
-
9
- const meta: Meta = {
10
- title: 'General/Layouts/WebsiteAssistant',
11
- component: (args: Props) => (
12
- <Memori
13
- {...args}
14
- engineURL="https://engine.memori.ai"
15
- apiURL="https://backend.memori.ai"
16
- baseURL="https://www.aisuru.com"
17
- />
18
- ),
19
- argTypes: {},
20
- parameters: {
21
- controls: { expanded: true },
22
- layout: 'fullscreen',
23
- },
24
- };
25
-
26
- export default meta;
27
-
28
- const Template: Story<Props> = args => (
29
- <I18nWrapper>
30
- <ArtifactProvider>
31
- <VisemeProvider>
32
- <Memori {...args} />
33
- </VisemeProvider>
34
- </ArtifactProvider>
35
- </I18nWrapper>
36
- );
37
-
38
- export const WebsiteAssistant2 = Template.bind({});
39
- WebsiteAssistant2.args = {
40
- memoriName: 'Marconi Express',
41
- ownerUserName: 'exmita',
42
- memoriID: '1755979f-28f1-45d1-8f41-bb34e1f7756b',
43
- ownerUserID: '3194fcd3-040b-4d5e-a925-691911fb1177',
44
- tenantID: 'exmachina.aclambda.online',
45
- engineURL: 'https://engine.memori.ai',
46
- apiURL: 'https://backend.memori.ai',
47
- baseURL: 'https://exmachina.aclambda.online',
48
- uiLang: 'IT',
49
- avatar3dHidden: true,
50
- spokenLang: 'IT',
51
- layout: 'WEBSITE_ASSISTANT',
52
- };
53
-
54
- export const WebsiteAssistant3 = Template.bind({});
55
- WebsiteAssistant3.args = {
56
- memoriName: 'Layout Storybook',
57
- ownerUserName: 'Andrea-Patini',
58
- memoriID: 'ae20fc5a-cc15-4db9-b7dd-2cd4a621b85e',
59
- ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
60
- tenantID: 'aisuru-staging.aclambda.online',
61
- engineURL: 'https://engine-staging.memori.ai/memori/v2',
62
- apiURL: 'https://backend-staging.memori.ai/api/v2',
63
- baseURL: 'http://localhost:3000',
64
- layout: 'WEBSITE_ASSISTANT',
65
- avatar3dHidden: true,
66
- uiLang: 'IT',
67
- spokenLang: 'IT',
68
- showOnlyLastMessages: true,
69
- integrationID: '716f4728-919c-4015-aae1-88998a081c6f',
70
- };
71
-
72
- export const WebsiteAssistant = Template.bind({});
73
- WebsiteAssistant.args = {
74
- uiLang: 'EN',
75
- showShare: false,
76
- showSettings: true,
77
- memori: memori,
78
- tenant,
79
- layout: 'WEBSITE_ASSISTANT',
80
- memoriName: 'Memori',
81
- memoriID: '25ced51c-3520-41af-8bbe-222d861b8e32',
82
- ownerUserName: 'memoridev',
83
- tenantID: 'www.aisuru.com',
84
- apiURL: 'https://backend.memori.ai',
85
- baseURL: 'https://www.aisuru.com',
86
- spokenLang: 'EN',
87
- context: {
88
- SOURCE: 'WEBSITE',
89
- PATH: '/en/',
90
- },
91
- multilingual: true,
92
- integrationID: 'cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1',
93
- integration: {
94
- ...integration,
95
- customData: JSON.stringify({
96
- textColor: '#2a2a2a',
97
- buttonBgColor: '#653165',
98
- buttonTextColor: '#ffffff',
99
- blurBackground: true,
100
- innerBgColor: 'light',
101
- innerBgAlpha: 0.8,
102
- multilanguage: true,
103
- avatar: 'readyplayerme',
104
- avatarURL:
105
- 'https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb',
106
- }),
107
- },
108
- };
109
-
110
- export const WebsiteAssistantWithout3DAvatar = Template.bind({});
111
- WebsiteAssistantWithout3DAvatar.args = {
112
- ...WebsiteAssistant.args,
113
- avatar3dHidden: true,
114
- };
115
-