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

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 (1094) hide show
  1. package/CHANGELOG.md +1103 -0
  2. package/dist/components/AgeVerificationModal/AgeVerificationModal.css +9 -4
  3. package/dist/components/AgeVerificationModal/AgeVerificationModal.js +8 -3
  4. package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
  5. package/dist/components/Auth/Auth.js +3 -1
  6. package/dist/components/Auth/Auth.js.map +1 -1
  7. package/dist/components/Avatar/Avatar.js +5 -10
  8. package/dist/components/Avatar/Avatar.js.map +1 -1
  9. package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +8 -1
  10. package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -1
  11. package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +1 -1
  12. package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -1
  13. package/dist/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +2 -0
  14. package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js +14 -5
  15. package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -1
  16. package/dist/components/Chat/Chat.css +137 -34
  17. package/dist/components/Chat/Chat.d.ts +3 -0
  18. package/dist/components/Chat/Chat.js +68 -58
  19. package/dist/components/Chat/Chat.js.map +1 -1
  20. package/dist/components/ChatBubble/ChatBubble.css +150 -32
  21. package/dist/components/ChatBubble/ChatBubble.d.ts +1 -0
  22. package/dist/components/ChatBubble/ChatBubble.js +122 -95
  23. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  24. package/dist/components/ChatHistoryDrawer/ChatHistory.css +5 -0
  25. package/dist/components/ChatHistoryDrawer/ChatHistory.js +27 -10
  26. package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
  27. package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  28. package/dist/components/ChatInputs/ChatInputs.css +332 -149
  29. package/dist/components/ChatInputs/ChatInputs.d.ts +2 -0
  30. package/dist/components/ChatInputs/ChatInputs.js +5 -6
  31. package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
  32. package/dist/components/ChatTextArea/ChatTextArea.css +31 -27
  33. package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js +6 -3
  34. package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
  35. package/dist/components/ContentPreviewModal/ContentPreviewModal.css +6 -22
  36. package/dist/components/ContentPreviewModal/ContentPreviewModal.js +3 -1
  37. package/dist/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
  38. package/dist/components/DateSelector/DateSelector.css +25 -2
  39. package/dist/components/DateSelector/DateSelector.d.ts +2 -1
  40. package/dist/components/DateSelector/DateSelector.js +17 -7
  41. package/dist/components/DateSelector/DateSelector.js.map +1 -1
  42. package/dist/components/ExpertsDrawer/ExpertsDrawer.js +3 -1
  43. package/dist/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
  44. package/dist/components/FilePreview/FilePreview.css +42 -21
  45. package/dist/components/FilePreview/FilePreview.d.ts +2 -1
  46. package/dist/components/FilePreview/FilePreview.js +28 -7
  47. package/dist/components/FilePreview/FilePreview.js.map +1 -1
  48. package/dist/components/Header/ChatConsumptionDropdown.d.ts +3 -1
  49. package/dist/components/Header/ChatConsumptionDropdown.js +5 -3
  50. package/dist/components/Header/ChatConsumptionDropdown.js.map +1 -1
  51. package/dist/components/Header/Header.css +210 -39
  52. package/dist/components/Header/Header.d.ts +1 -0
  53. package/dist/components/Header/Header.js +135 -51
  54. package/dist/components/Header/Header.js.map +1 -1
  55. package/dist/components/IconButton/IconButton.css +144 -0
  56. package/dist/components/IconButton/IconButton.d.ts +9 -0
  57. package/dist/components/IconButton/IconButton.js +36 -0
  58. package/dist/components/IconButton/IconButton.js.map +1 -0
  59. package/dist/components/KnownFacts/KnownFacts.css +22 -9
  60. package/dist/components/KnownFacts/KnownFacts.js +18 -7
  61. package/dist/components/KnownFacts/KnownFacts.js.map +1 -1
  62. package/dist/components/LoginDrawer/LoginDrawer.css +42 -0
  63. package/dist/components/LoginDrawer/LoginDrawer.js +3 -1
  64. package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
  65. package/dist/components/MediaWidget/MediaItemWidget.js +14 -12
  66. package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
  67. package/dist/components/MediaWidget/MediaItemWidget.utils.d.ts +3 -2
  68. package/dist/components/MediaWidget/MediaItemWidget.utils.js +28 -6
  69. package/dist/components/MediaWidget/MediaItemWidget.utils.js.map +1 -1
  70. package/dist/components/MediaWidget/MediaPreviewModal.js +6 -7
  71. package/dist/components/MediaWidget/MediaPreviewModal.js.map +1 -1
  72. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
  73. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +1 -1
  74. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -1
  75. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +14 -12
  76. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -1
  77. package/dist/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +36 -124
  78. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +251 -170
  79. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +1 -0
  80. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +25 -15
  81. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  82. package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +18 -2
  83. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +210 -62
  84. package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
  85. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
  86. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +1 -1
  87. package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  88. package/dist/components/MemoriArtifactSystem/context/ArtifactContext.d.ts +3 -1
  89. package/dist/components/MemoriArtifactSystem/context/ArtifactContext.js +65 -1
  90. package/dist/components/MemoriArtifactSystem/context/ArtifactContext.js.map +1 -1
  91. package/dist/components/MemoriArtifactSystem/types/artifact.types.d.ts +11 -0
  92. package/dist/components/MemoriArtifactSystem/utils/ArtifactAPI.js +18 -13
  93. package/dist/components/MemoriArtifactSystem/utils/ArtifactAPI.js.map +1 -1
  94. package/dist/components/MemoriArtifactSystem/utils/applyEdits.d.ts +8 -0
  95. package/dist/components/MemoriArtifactSystem/utils/applyEdits.js +117 -0
  96. package/dist/components/MemoriArtifactSystem/utils/applyEdits.js.map +1 -0
  97. package/dist/components/MemoriWidget/MemoriWidget.css +65 -5
  98. package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -0
  99. package/dist/components/MemoriWidget/MemoriWidget.js +820 -457
  100. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  101. package/dist/components/MicrophoneButton/MicrophoneButton.css +4 -131
  102. package/dist/components/MicrophoneButton/MicrophoneButton.js +3 -1
  103. package/dist/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
  104. package/dist/components/MobileSessionPanel/MobileSessionPanel.css +29 -7
  105. package/dist/components/MobileSessionPanel/MobileSessionPanel.d.ts +6 -1
  106. package/dist/components/MobileSessionPanel/MobileSessionPanel.js +12 -9
  107. package/dist/components/MobileSessionPanel/MobileSessionPanel.js.map +1 -1
  108. package/dist/components/PositionPopover/PositionPopover.d.ts +2 -0
  109. package/dist/components/PositionPopover/PositionPopover.js +19 -11
  110. package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
  111. package/dist/components/PoweredBy/PoweredBy.css +4 -3
  112. package/dist/components/SettingsDrawer/SettingsDrawer.js +4 -2
  113. package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
  114. package/dist/components/ShareButton/ShareButton.css +3 -2
  115. package/dist/components/ShareButton/ShareButton.js +3 -4
  116. package/dist/components/ShareButton/ShareButton.js.map +1 -1
  117. package/dist/components/Snippet/Snippet.css +6 -36
  118. package/dist/components/Snippet/Snippet.js +3 -1
  119. package/dist/components/Snippet/Snippet.js.map +1 -1
  120. package/dist/components/StartPanel/StartPanel.css +114 -10
  121. package/dist/components/StartPanel/StartPanel.js +14 -9
  122. package/dist/components/StartPanel/StartPanel.js.map +1 -1
  123. package/dist/components/UploadButton/UploadButton.css +3 -40
  124. package/dist/components/UploadButton/UploadButton.d.ts +1 -0
  125. package/dist/components/UploadButton/UploadButton.js +34 -25
  126. package/dist/components/UploadButton/UploadButton.js.map +1 -1
  127. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +1 -6
  128. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +47 -113
  129. package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  130. package/dist/components/UploadButton/UploadImages/UploadImages.js +3 -1
  131. package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  132. package/dist/components/WhyThisAnswer/WhyThisAnswer.js +3 -1
  133. package/dist/components/WhyThisAnswer/WhyThisAnswer.js.map +1 -1
  134. package/dist/components/layouts/Chat.js +67 -79
  135. package/dist/components/layouts/Chat.js.map +1 -1
  136. package/dist/components/layouts/FullPage.js +90 -42
  137. package/dist/components/layouts/FullPage.js.map +1 -1
  138. package/dist/components/layouts/HiddenChat.js +11 -236
  139. package/dist/components/layouts/HiddenChat.js.map +1 -1
  140. package/dist/components/layouts/Totem.js +10 -1
  141. package/dist/components/layouts/Totem.js.map +1 -1
  142. package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js +30 -3
  143. package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -1
  144. package/dist/components/layouts/WebsiteAssistant/website-assistant.css +175 -61
  145. package/dist/components/layouts/ZoomedFullBody.js +90 -42
  146. package/dist/components/layouts/ZoomedFullBody.js.map +1 -1
  147. package/dist/components/layouts/chat.css +232 -85
  148. package/dist/components/layouts/fullpage.css +253 -93
  149. package/dist/components/layouts/hidden-chat.css +172 -62
  150. package/dist/components/layouts/totem.css +151 -50
  151. package/dist/components/layouts/zoomed-full-body.css +339 -34
  152. package/dist/context/widgetSurfaceContext.d.ts +3 -0
  153. package/dist/context/widgetSurfaceContext.js +11 -0
  154. package/dist/context/widgetSurfaceContext.js.map +1 -0
  155. package/dist/helpers/constants.d.ts +4 -0
  156. package/dist/helpers/constants.js +50 -1
  157. package/dist/helpers/constants.js.map +1 -1
  158. package/dist/helpers/convertDocument.d.ts +1 -0
  159. package/dist/helpers/convertDocument.js +24 -0
  160. package/dist/helpers/convertDocument.js.map +1 -0
  161. package/dist/helpers/credits.d.ts +5 -2
  162. package/dist/helpers/credits.js +5 -1
  163. package/dist/helpers/credits.js.map +1 -1
  164. package/dist/helpers/media.js +18 -3
  165. package/dist/helpers/media.js.map +1 -1
  166. package/dist/helpers/message.d.ts +1 -1
  167. package/dist/helpers/message.js +7 -4
  168. package/dist/helpers/message.js.map +1 -1
  169. package/dist/helpers/nats/getNatsConfig.d.ts +9 -0
  170. package/dist/helpers/nats/getNatsConfig.js +65 -0
  171. package/dist/helpers/nats/getNatsConfig.js.map +1 -0
  172. package/dist/helpers/nats/isSessionExpiredError.d.ts +3 -0
  173. package/dist/helpers/nats/isSessionExpiredError.js +36 -0
  174. package/dist/helpers/nats/isSessionExpiredError.js.map +1 -0
  175. package/dist/helpers/nats/useNats.d.ts +12 -0
  176. package/dist/helpers/nats/useNats.js +75 -0
  177. package/dist/helpers/nats/useNats.js.map +1 -0
  178. package/dist/helpers/nats/useNatsSession.d.ts +28 -0
  179. package/dist/helpers/nats/useNatsSession.js +212 -0
  180. package/dist/helpers/nats/useNatsSession.js.map +1 -0
  181. package/dist/helpers/positionPopover.d.ts +1 -0
  182. package/dist/helpers/positionPopover.js +7 -0
  183. package/dist/helpers/positionPopover.js.map +1 -0
  184. package/dist/helpers/tts/muteSpeaker.d.ts +13 -0
  185. package/dist/helpers/tts/muteSpeaker.js +26 -0
  186. package/dist/helpers/tts/muteSpeaker.js.map +1 -0
  187. package/dist/helpers/tts/useTTS.js +18 -9
  188. package/dist/helpers/tts/useTTS.js.map +1 -1
  189. package/dist/helpers/usePressTooltip.d.ts +13 -0
  190. package/dist/helpers/usePressTooltip.js +23 -0
  191. package/dist/helpers/usePressTooltip.js.map +1 -0
  192. package/dist/helpers/utils.d.ts +21 -0
  193. package/dist/helpers/utils.js +75 -4
  194. package/dist/helpers/utils.js.map +1 -1
  195. package/dist/index.js +16 -16
  196. package/dist/index.js.map +1 -1
  197. package/dist/locales/de.json +15 -1
  198. package/dist/locales/en.json +16 -2
  199. package/dist/locales/es.json +15 -1
  200. package/dist/locales/fr.json +15 -1
  201. package/dist/locales/it.json +16 -2
  202. package/dist/styles.css +1 -163
  203. package/dist/types/integration.d.ts +3 -0
  204. package/dist/types/integration.js +16 -0
  205. package/dist/types/integration.js.map +1 -0
  206. package/dist/version.d.ts +1 -1
  207. package/dist/version.js +1 -1
  208. package/dist/version.js.map +1 -1
  209. package/esm/components/AgeVerificationModal/AgeVerificationModal.css +9 -4
  210. package/esm/components/AgeVerificationModal/AgeVerificationModal.js +8 -3
  211. package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
  212. package/esm/components/Auth/Auth.js +3 -1
  213. package/esm/components/Auth/Auth.js.map +1 -1
  214. package/esm/components/Avatar/Avatar.js +5 -10
  215. package/esm/components/Avatar/Avatar.js.map +1 -1
  216. package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +9 -2
  217. package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -1
  218. package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +2 -2
  219. package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -1
  220. package/esm/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +2 -0
  221. package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js +12 -4
  222. package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -1
  223. package/esm/components/Chat/Chat.css +137 -34
  224. package/esm/components/Chat/Chat.d.ts +3 -0
  225. package/esm/components/Chat/Chat.js +68 -58
  226. package/esm/components/Chat/Chat.js.map +1 -1
  227. package/esm/components/ChatBubble/ChatBubble.css +150 -32
  228. package/esm/components/ChatBubble/ChatBubble.d.ts +1 -0
  229. package/esm/components/ChatBubble/ChatBubble.js +123 -96
  230. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  231. package/esm/components/ChatHistoryDrawer/ChatHistory.css +5 -0
  232. package/esm/components/ChatHistoryDrawer/ChatHistory.js +27 -10
  233. package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
  234. package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  235. package/esm/components/ChatInputs/ChatInputs.css +332 -149
  236. package/esm/components/ChatInputs/ChatInputs.d.ts +2 -0
  237. package/esm/components/ChatInputs/ChatInputs.js +5 -6
  238. package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
  239. package/esm/components/ChatTextArea/ChatTextArea.css +31 -27
  240. package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js +6 -3
  241. package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
  242. package/esm/components/ContentPreviewModal/ContentPreviewModal.css +6 -22
  243. package/esm/components/ContentPreviewModal/ContentPreviewModal.js +3 -1
  244. package/esm/components/ContentPreviewModal/ContentPreviewModal.js.map +1 -1
  245. package/esm/components/DateSelector/DateSelector.css +25 -2
  246. package/esm/components/DateSelector/DateSelector.d.ts +2 -1
  247. package/esm/components/DateSelector/DateSelector.js +17 -7
  248. package/esm/components/DateSelector/DateSelector.js.map +1 -1
  249. package/esm/components/ExpertsDrawer/ExpertsDrawer.js +3 -1
  250. package/esm/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
  251. package/esm/components/FilePreview/FilePreview.css +42 -21
  252. package/esm/components/FilePreview/FilePreview.d.ts +2 -1
  253. package/esm/components/FilePreview/FilePreview.js +31 -10
  254. package/esm/components/FilePreview/FilePreview.js.map +1 -1
  255. package/esm/components/Header/ChatConsumptionDropdown.d.ts +3 -1
  256. package/esm/components/Header/ChatConsumptionDropdown.js +7 -5
  257. package/esm/components/Header/ChatConsumptionDropdown.js.map +1 -1
  258. package/esm/components/Header/Header.css +210 -39
  259. package/esm/components/Header/Header.d.ts +1 -0
  260. package/esm/components/Header/Header.js +136 -52
  261. package/esm/components/Header/Header.js.map +1 -1
  262. package/esm/components/IconButton/IconButton.css +144 -0
  263. package/esm/components/IconButton/IconButton.d.ts +9 -0
  264. package/esm/components/IconButton/IconButton.js +33 -0
  265. package/esm/components/IconButton/IconButton.js.map +1 -0
  266. package/esm/components/KnownFacts/KnownFacts.css +22 -9
  267. package/esm/components/KnownFacts/KnownFacts.js +18 -7
  268. package/esm/components/KnownFacts/KnownFacts.js.map +1 -1
  269. package/esm/components/LoginDrawer/LoginDrawer.css +42 -0
  270. package/esm/components/LoginDrawer/LoginDrawer.js +3 -1
  271. package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
  272. package/esm/components/MediaWidget/MediaItemWidget.js +16 -14
  273. package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
  274. package/esm/components/MediaWidget/MediaItemWidget.utils.d.ts +3 -2
  275. package/esm/components/MediaWidget/MediaItemWidget.utils.js +27 -6
  276. package/esm/components/MediaWidget/MediaItemWidget.utils.js.map +1 -1
  277. package/esm/components/MediaWidget/MediaPreviewModal.js +6 -7
  278. package/esm/components/MediaWidget/MediaPreviewModal.js.map +1 -1
  279. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
  280. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +1 -1
  281. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -1
  282. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +15 -13
  283. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -1
  284. package/esm/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +36 -124
  285. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +251 -170
  286. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +1 -0
  287. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +26 -16
  288. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
  289. package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +18 -2
  290. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +211 -63
  291. package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -1
  292. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
  293. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +2 -2
  294. package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
  295. package/esm/components/MemoriArtifactSystem/context/ArtifactContext.d.ts +3 -1
  296. package/esm/components/MemoriArtifactSystem/context/ArtifactContext.js +66 -2
  297. package/esm/components/MemoriArtifactSystem/context/ArtifactContext.js.map +1 -1
  298. package/esm/components/MemoriArtifactSystem/types/artifact.types.d.ts +11 -0
  299. package/esm/components/MemoriArtifactSystem/utils/ArtifactAPI.js +18 -13
  300. package/esm/components/MemoriArtifactSystem/utils/ArtifactAPI.js.map +1 -1
  301. package/esm/components/MemoriArtifactSystem/utils/applyEdits.d.ts +8 -0
  302. package/esm/components/MemoriArtifactSystem/utils/applyEdits.js +112 -0
  303. package/esm/components/MemoriArtifactSystem/utils/applyEdits.js.map +1 -0
  304. package/esm/components/MemoriWidget/MemoriWidget.css +65 -5
  305. package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -0
  306. package/esm/components/MemoriWidget/MemoriWidget.js +821 -458
  307. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  308. package/esm/components/MicrophoneButton/MicrophoneButton.css +4 -131
  309. package/esm/components/MicrophoneButton/MicrophoneButton.js +3 -2
  310. package/esm/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
  311. package/esm/components/MobileSessionPanel/MobileSessionPanel.css +29 -7
  312. package/esm/components/MobileSessionPanel/MobileSessionPanel.d.ts +6 -1
  313. package/esm/components/MobileSessionPanel/MobileSessionPanel.js +12 -9
  314. package/esm/components/MobileSessionPanel/MobileSessionPanel.js.map +1 -1
  315. package/esm/components/PositionPopover/PositionPopover.d.ts +2 -0
  316. package/esm/components/PositionPopover/PositionPopover.js +20 -12
  317. package/esm/components/PositionPopover/PositionPopover.js.map +1 -1
  318. package/esm/components/PoweredBy/PoweredBy.css +4 -3
  319. package/esm/components/SettingsDrawer/SettingsDrawer.js +4 -2
  320. package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -1
  321. package/esm/components/ShareButton/ShareButton.css +3 -2
  322. package/esm/components/ShareButton/ShareButton.js +4 -5
  323. package/esm/components/ShareButton/ShareButton.js.map +1 -1
  324. package/esm/components/Snippet/Snippet.css +6 -36
  325. package/esm/components/Snippet/Snippet.js +4 -2
  326. package/esm/components/Snippet/Snippet.js.map +1 -1
  327. package/esm/components/StartPanel/StartPanel.css +114 -10
  328. package/esm/components/StartPanel/StartPanel.js +15 -10
  329. package/esm/components/StartPanel/StartPanel.js.map +1 -1
  330. package/esm/components/UploadButton/UploadButton.css +3 -40
  331. package/esm/components/UploadButton/UploadButton.d.ts +1 -0
  332. package/esm/components/UploadButton/UploadButton.js +34 -25
  333. package/esm/components/UploadButton/UploadButton.js.map +1 -1
  334. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +1 -6
  335. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +47 -113
  336. package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
  337. package/esm/components/UploadButton/UploadImages/UploadImages.js +3 -1
  338. package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
  339. package/esm/components/WhyThisAnswer/WhyThisAnswer.js +3 -1
  340. package/esm/components/WhyThisAnswer/WhyThisAnswer.js.map +1 -1
  341. package/esm/components/layouts/Chat.js +70 -82
  342. package/esm/components/layouts/Chat.js.map +1 -1
  343. package/esm/components/layouts/FullPage.js +91 -43
  344. package/esm/components/layouts/FullPage.js.map +1 -1
  345. package/esm/components/layouts/HiddenChat.js +13 -238
  346. package/esm/components/layouts/HiddenChat.js.map +1 -1
  347. package/esm/components/layouts/Totem.js +10 -1
  348. package/esm/components/layouts/Totem.js.map +1 -1
  349. package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js +30 -3
  350. package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -1
  351. package/esm/components/layouts/WebsiteAssistant/website-assistant.css +175 -61
  352. package/esm/components/layouts/ZoomedFullBody.js +91 -43
  353. package/esm/components/layouts/ZoomedFullBody.js.map +1 -1
  354. package/esm/components/layouts/chat.css +232 -85
  355. package/esm/components/layouts/fullpage.css +253 -93
  356. package/esm/components/layouts/hidden-chat.css +172 -62
  357. package/esm/components/layouts/totem.css +151 -50
  358. package/esm/components/layouts/zoomed-full-body.css +339 -34
  359. package/esm/context/widgetSurfaceContext.d.ts +3 -0
  360. package/esm/context/widgetSurfaceContext.js +7 -0
  361. package/esm/context/widgetSurfaceContext.js.map +1 -0
  362. package/esm/helpers/constants.d.ts +4 -0
  363. package/esm/helpers/constants.js +49 -0
  364. package/esm/helpers/constants.js.map +1 -1
  365. package/esm/helpers/convertDocument.d.ts +1 -0
  366. package/esm/helpers/convertDocument.js +20 -0
  367. package/esm/helpers/convertDocument.js.map +1 -0
  368. package/esm/helpers/credits.d.ts +5 -2
  369. package/esm/helpers/credits.js +5 -1
  370. package/esm/helpers/credits.js.map +1 -1
  371. package/esm/helpers/media.js +18 -3
  372. package/esm/helpers/media.js.map +1 -1
  373. package/esm/helpers/message.d.ts +1 -1
  374. package/esm/helpers/message.js +5 -2
  375. package/esm/helpers/message.js.map +1 -1
  376. package/esm/helpers/nats/getNatsConfig.d.ts +9 -0
  377. package/esm/helpers/nats/getNatsConfig.js +61 -0
  378. package/esm/helpers/nats/getNatsConfig.js.map +1 -0
  379. package/esm/helpers/nats/isSessionExpiredError.d.ts +3 -0
  380. package/esm/helpers/nats/isSessionExpiredError.js +32 -0
  381. package/esm/helpers/nats/isSessionExpiredError.js.map +1 -0
  382. package/esm/helpers/nats/useNats.d.ts +12 -0
  383. package/esm/helpers/nats/useNats.js +72 -0
  384. package/esm/helpers/nats/useNats.js.map +1 -0
  385. package/esm/helpers/nats/useNatsSession.d.ts +28 -0
  386. package/esm/helpers/nats/useNatsSession.js +208 -0
  387. package/esm/helpers/nats/useNatsSession.js.map +1 -0
  388. package/esm/helpers/positionPopover.d.ts +1 -0
  389. package/esm/helpers/positionPopover.js +4 -0
  390. package/esm/helpers/positionPopover.js.map +1 -0
  391. package/esm/helpers/tts/muteSpeaker.d.ts +13 -0
  392. package/esm/helpers/tts/muteSpeaker.js +21 -0
  393. package/esm/helpers/tts/muteSpeaker.js.map +1 -0
  394. package/esm/helpers/tts/useTTS.js +18 -9
  395. package/esm/helpers/tts/useTTS.js.map +1 -1
  396. package/esm/helpers/usePressTooltip.d.ts +13 -0
  397. package/esm/helpers/usePressTooltip.js +20 -0
  398. package/esm/helpers/usePressTooltip.js.map +1 -0
  399. package/esm/helpers/utils.d.ts +21 -0
  400. package/esm/helpers/utils.js +68 -3
  401. package/esm/helpers/utils.js.map +1 -1
  402. package/esm/index.js +17 -17
  403. package/esm/index.js.map +1 -1
  404. package/esm/locales/de.json +15 -1
  405. package/esm/locales/en.json +16 -2
  406. package/esm/locales/es.json +15 -1
  407. package/esm/locales/fr.json +15 -1
  408. package/esm/locales/it.json +16 -2
  409. package/esm/styles.css +1 -163
  410. package/esm/types/integration.d.ts +3 -0
  411. package/esm/types/integration.js +11 -0
  412. package/esm/types/integration.js.map +1 -0
  413. package/esm/version.d.ts +1 -1
  414. package/esm/version.js +1 -1
  415. package/esm/version.js.map +1 -1
  416. package/package.json +13 -6
  417. package/src/__snapshots__/index.test.tsx.snap +0 -50
  418. package/src/components/AgeVerificationModal/AgeVerificationModal.css +9 -4
  419. package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +13 -2
  420. package/src/components/Auth/Auth.tsx +3 -0
  421. package/src/components/Avatar/Avatar.stories.tsx +45 -28
  422. package/src/components/Avatar/Avatar.test.tsx +54 -0
  423. package/src/components/Avatar/Avatar.tsx +8 -12
  424. package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.tsx +12 -5
  425. package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.ts +2 -1
  426. package/src/components/Avatar/AvatarView/AvatarComponent/constants.test.ts +19 -0
  427. package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +19 -4
  428. package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +164 -0
  429. package/src/components/BlockedMemoriBadge/__snapshots__/BlockedMemoriBadge.test.tsx.snap +10 -10
  430. package/src/components/Chat/Chat.css +137 -34
  431. package/src/components/Chat/Chat.tsx +43 -22
  432. package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +7429 -7603
  433. package/src/components/ChatBubble/ChatBubble.css +150 -32
  434. package/src/components/ChatBubble/ChatBubble.test.tsx +65 -1
  435. package/src/components/ChatBubble/ChatBubble.tsx +168 -90
  436. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +6491 -6387
  437. package/src/components/ChatHistoryDrawer/ChatHistory.css +5 -0
  438. package/src/components/ChatHistoryDrawer/ChatHistory.test.tsx +77 -1
  439. package/src/components/ChatHistoryDrawer/ChatHistory.tsx +59 -27
  440. package/src/components/ChatHistoryDrawer/ChatResumeDrawer.css +6 -1
  441. package/src/components/ChatInputs/ChatInputs.css +332 -149
  442. package/src/components/ChatInputs/ChatInputs.tsx +25 -11
  443. package/src/components/ChatTextArea/ChatTextArea.css +31 -27
  444. package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +8 -4
  445. package/src/components/CompletionProviderStatus/__snapshots__/CompletionProviderStatus.test.tsx.snap +6 -6
  446. package/src/components/ContentPreviewModal/ContentPreviewModal.css +6 -22
  447. package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +3 -0
  448. package/src/components/DateSelector/DateSelector.css +25 -2
  449. package/src/components/DateSelector/DateSelector.stories.tsx +11 -2
  450. package/src/components/DateSelector/DateSelector.tsx +28 -9
  451. package/src/components/ExpertsDrawer/ExpertsDrawer.tsx +3 -0
  452. package/src/components/FeedbackButtons/__snapshots__/FeedbackButtons.test.tsx.snap +2 -2
  453. package/src/components/FilePreview/FilePreview.css +42 -21
  454. package/src/components/FilePreview/FilePreview.stories.tsx +0 -3
  455. package/src/components/FilePreview/FilePreview.tsx +42 -7
  456. package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +14 -0
  457. package/src/components/Header/ChatConsumptionDropdown.tsx +18 -6
  458. package/src/components/Header/Header.css +210 -39
  459. package/src/components/Header/Header.test.tsx +55 -1
  460. package/src/components/Header/Header.tsx +456 -160
  461. package/src/components/Header/__snapshots__/Header.test.tsx.snap +194 -135
  462. package/src/components/IconButton/IconButton.css +144 -0
  463. package/src/components/IconButton/IconButton.tsx +89 -0
  464. package/src/components/KnownFacts/KnownFacts.css +22 -9
  465. package/src/components/KnownFacts/KnownFacts.tsx +18 -3
  466. package/src/components/LoginDrawer/LoginDrawer.css +42 -0
  467. package/src/components/LoginDrawer/LoginDrawer.tsx +3 -0
  468. package/src/components/MediaWidget/MediaItemWidget.tsx +26 -13
  469. package/src/components/MediaWidget/MediaItemWidget.utils.test.ts +45 -2
  470. package/src/components/MediaWidget/MediaItemWidget.utils.ts +39 -6
  471. package/src/components/MediaWidget/MediaPreviewModal.test.tsx +2 -3
  472. package/src/components/MediaWidget/MediaPreviewModal.tsx +9 -7
  473. package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +218 -2252
  474. package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +7 -2
  475. package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +19 -33
  476. package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.tsx +44 -45
  477. package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +36 -124
  478. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +251 -170
  479. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +110 -105
  480. package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +18 -2
  481. package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +359 -149
  482. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +1 -0
  483. package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +2 -2
  484. package/src/components/MemoriArtifactSystem/context/ArtifactContext.tsx +111 -9
  485. package/src/components/MemoriArtifactSystem/types/artifact.types.ts +20 -1
  486. package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +1 -0
  487. package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.tsx +19 -13
  488. package/src/components/MemoriArtifactSystem/utils/applyEdits.test.ts +85 -0
  489. package/src/components/MemoriArtifactSystem/utils/applyEdits.ts +173 -0
  490. package/src/components/MemoriWidget/MemoriWidget.css +65 -5
  491. package/src/components/MemoriWidget/MemoriWidget.tsx +1294 -764
  492. package/src/components/MicrophoneButton/MicrophoneButton.css +4 -131
  493. package/src/components/MicrophoneButton/MicrophoneButton.tsx +5 -5
  494. package/src/components/MobileSessionPanel/MobileSessionPanel.css +29 -7
  495. package/src/components/MobileSessionPanel/MobileSessionPanel.test.tsx +44 -0
  496. package/src/components/MobileSessionPanel/MobileSessionPanel.tsx +60 -38
  497. package/src/components/PositionPopover/PositionPopover.tsx +32 -20
  498. package/src/components/PoweredBy/PoweredBy.css +4 -3
  499. package/src/components/SettingsDrawer/SettingsDrawer.tsx +4 -1
  500. package/src/components/ShareButton/ShareButton.css +3 -2
  501. package/src/components/ShareButton/ShareButton.tsx +14 -12
  502. package/src/components/ShareButton/__snapshots__/ShareButton.test.tsx.snap +36 -27
  503. package/src/components/Snippet/Snippet.css +6 -36
  504. package/src/components/Snippet/Snippet.tsx +6 -7
  505. package/src/components/StartPanel/StartPanel.css +114 -10
  506. package/src/components/StartPanel/StartPanel.stories.tsx +43 -1
  507. package/src/components/StartPanel/StartPanel.test.tsx +64 -1
  508. package/src/components/StartPanel/StartPanel.tsx +38 -10
  509. package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +287 -86
  510. package/src/components/UploadButton/UploadButton.css +3 -40
  511. package/src/components/UploadButton/UploadButton.stories.tsx +3 -3
  512. package/src/components/UploadButton/UploadButton.tsx +50 -44
  513. package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +59 -143
  514. package/src/components/UploadButton/UploadImages/UploadImages.tsx +3 -0
  515. package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +33 -29
  516. package/src/components/WhyThisAnswer/WhyThisAnswer.tsx +3 -0
  517. package/src/components/layouts/Chat.tsx +235 -239
  518. package/src/components/layouts/FullPage.tsx +160 -65
  519. package/src/components/layouts/HiddenChat.tsx +20 -413
  520. package/src/components/layouts/Totem.tsx +20 -3
  521. package/src/components/layouts/WebsiteAssistant/WebsiteAssistant.tsx +72 -16
  522. package/src/components/layouts/WebsiteAssistant/__snapshots__/WebsiteAssistant.test.tsx.snap +60 -44
  523. package/src/components/layouts/WebsiteAssistant/website-assistant.css +175 -61
  524. package/src/components/layouts/ZoomedFullBody.tsx +163 -67
  525. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +597 -583
  526. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +1186 -1146
  527. package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +409 -435
  528. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +590 -602
  529. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +585 -565
  530. package/src/components/layouts/chat.css +232 -85
  531. package/src/components/layouts/fullpage.css +253 -93
  532. package/src/components/layouts/hidden-chat.css +172 -62
  533. package/src/components/layouts/layouts.stories.tsx +135 -15
  534. package/src/components/layouts/totem.css +151 -50
  535. package/src/components/layouts/zoomed-full-body.css +339 -34
  536. package/src/context/widgetSurfaceContext.tsx +14 -0
  537. package/src/helpers/constants.ts +56 -1
  538. package/src/helpers/convertDocument.test.ts +67 -0
  539. package/src/helpers/convertDocument.ts +35 -0
  540. package/src/helpers/credits.ts +16 -1
  541. package/src/helpers/media.test.ts +36 -0
  542. package/src/helpers/media.ts +39 -12
  543. package/src/helpers/message.test.ts +28 -1
  544. package/src/helpers/message.ts +19 -4
  545. package/src/helpers/nats/getNatsConfig.ts +145 -0
  546. package/src/helpers/nats/isSessionExpiredError.test.ts +38 -0
  547. package/src/helpers/nats/isSessionExpiredError.ts +51 -0
  548. package/src/helpers/nats/useNats.ts +124 -0
  549. package/src/helpers/nats/useNatsSession.ts +394 -0
  550. package/src/helpers/positionPopover.test.ts +39 -0
  551. package/src/helpers/positionPopover.ts +16 -0
  552. package/src/helpers/tts/muteSpeaker.test.ts +81 -0
  553. package/src/helpers/tts/muteSpeaker.ts +46 -0
  554. package/src/helpers/tts/useTTS.ts +32 -22
  555. package/src/helpers/usePressTooltip.ts +29 -0
  556. package/src/helpers/utils.test.ts +162 -0
  557. package/src/helpers/utils.ts +108 -3
  558. package/src/index.stories.tsx +32 -0
  559. package/src/index.tsx +1 -5
  560. package/src/locales/de.json +15 -1
  561. package/src/locales/en.json +16 -2
  562. package/src/locales/es.json +15 -1
  563. package/src/locales/fr.json +15 -1
  564. package/src/locales/it.json +16 -2
  565. package/src/styles.css +113 -15
  566. package/src/types/integration.test.ts +32 -0
  567. package/src/types/integration.ts +31 -0
  568. package/src/version.ts +1 -1
  569. package/dist/components/PositionDrawer/PositionDrawer.d.ts +0 -12
  570. package/dist/components/PositionDrawer/PositionDrawer.js +0 -17
  571. package/dist/components/PositionDrawer/PositionDrawer.js.map +0 -1
  572. package/dist/components/icons/AI.d.ts +0 -6
  573. package/dist/components/icons/AI.js +0 -6
  574. package/dist/components/icons/AI.js.map +0 -1
  575. package/dist/components/icons/Alert.d.ts +0 -6
  576. package/dist/components/icons/Alert.js +0 -6
  577. package/dist/components/icons/Alert.js.map +0 -1
  578. package/dist/components/icons/ArrowUp.d.ts +0 -6
  579. package/dist/components/icons/ArrowUp.js +0 -6
  580. package/dist/components/icons/ArrowUp.js.map +0 -1
  581. package/dist/components/icons/Bug.d.ts +0 -6
  582. package/dist/components/icons/Bug.js +0 -6
  583. package/dist/components/icons/Bug.js.map +0 -1
  584. package/dist/components/icons/Chat.d.ts +0 -6
  585. package/dist/components/icons/Chat.js +0 -6
  586. package/dist/components/icons/Chat.js.map +0 -1
  587. package/dist/components/icons/ChevronDown.d.ts +0 -6
  588. package/dist/components/icons/ChevronDown.js +0 -6
  589. package/dist/components/icons/ChevronDown.js.map +0 -1
  590. package/dist/components/icons/ChevronLeft.d.ts +0 -6
  591. package/dist/components/icons/ChevronLeft.js +0 -6
  592. package/dist/components/icons/ChevronLeft.js.map +0 -1
  593. package/dist/components/icons/ChevronRight.d.ts +0 -6
  594. package/dist/components/icons/ChevronRight.js +0 -6
  595. package/dist/components/icons/ChevronRight.js.map +0 -1
  596. package/dist/components/icons/ChevronUp.d.ts +0 -6
  597. package/dist/components/icons/ChevronUp.js +0 -6
  598. package/dist/components/icons/ChevronUp.js.map +0 -1
  599. package/dist/components/icons/Clear.d.ts +0 -6
  600. package/dist/components/icons/Clear.js +0 -6
  601. package/dist/components/icons/Clear.js.map +0 -1
  602. package/dist/components/icons/Close.d.ts +0 -7
  603. package/dist/components/icons/Close.js +0 -6
  604. package/dist/components/icons/Close.js.map +0 -1
  605. package/dist/components/icons/Code.d.ts +0 -6
  606. package/dist/components/icons/Code.js +0 -6
  607. package/dist/components/icons/Code.js.map +0 -1
  608. package/dist/components/icons/Copy.d.ts +0 -6
  609. package/dist/components/icons/Copy.js +0 -6
  610. package/dist/components/icons/Copy.js.map +0 -1
  611. package/dist/components/icons/DeepThought.d.ts +0 -6
  612. package/dist/components/icons/DeepThought.js +0 -6
  613. package/dist/components/icons/DeepThought.js.map +0 -1
  614. package/dist/components/icons/Delete.d.ts +0 -6
  615. package/dist/components/icons/Delete.js +0 -6
  616. package/dist/components/icons/Delete.js.map +0 -1
  617. package/dist/components/icons/Document.d.ts +0 -5
  618. package/dist/components/icons/Document.js +0 -10
  619. package/dist/components/icons/Document.js.map +0 -1
  620. package/dist/components/icons/Download.d.ts +0 -6
  621. package/dist/components/icons/Download.js +0 -6
  622. package/dist/components/icons/Download.js.map +0 -1
  623. package/dist/components/icons/Edit.d.ts +0 -6
  624. package/dist/components/icons/Edit.js +0 -6
  625. package/dist/components/icons/Edit.js.map +0 -1
  626. package/dist/components/icons/Expand.d.ts +0 -6
  627. package/dist/components/icons/Expand.js +0 -6
  628. package/dist/components/icons/Expand.js.map +0 -1
  629. package/dist/components/icons/Eye.d.ts +0 -6
  630. package/dist/components/icons/Eye.js +0 -6
  631. package/dist/components/icons/Eye.js.map +0 -1
  632. package/dist/components/icons/EyeInvisible.d.ts +0 -6
  633. package/dist/components/icons/EyeInvisible.js +0 -6
  634. package/dist/components/icons/EyeInvisible.js.map +0 -1
  635. package/dist/components/icons/Facebook.d.ts +0 -6
  636. package/dist/components/icons/Facebook.js +0 -6
  637. package/dist/components/icons/Facebook.js.map +0 -1
  638. package/dist/components/icons/Feedback.d.ts +0 -6
  639. package/dist/components/icons/Feedback.js +0 -6
  640. package/dist/components/icons/Feedback.js.map +0 -1
  641. package/dist/components/icons/File.d.ts +0 -6
  642. package/dist/components/icons/File.js +0 -6
  643. package/dist/components/icons/File.js.map +0 -1
  644. package/dist/components/icons/FileExcel.d.ts +0 -6
  645. package/dist/components/icons/FileExcel.js +0 -6
  646. package/dist/components/icons/FileExcel.js.map +0 -1
  647. package/dist/components/icons/FilePdf.d.ts +0 -6
  648. package/dist/components/icons/FilePdf.js +0 -6
  649. package/dist/components/icons/FilePdf.js.map +0 -1
  650. package/dist/components/icons/FileWord.d.ts +0 -6
  651. package/dist/components/icons/FileWord.js +0 -6
  652. package/dist/components/icons/FileWord.js.map +0 -1
  653. package/dist/components/icons/Fullscreen.d.ts +0 -6
  654. package/dist/components/icons/Fullscreen.js +0 -6
  655. package/dist/components/icons/Fullscreen.js.map +0 -1
  656. package/dist/components/icons/FullscreenExit.d.ts +0 -6
  657. package/dist/components/icons/FullscreenExit.js +0 -6
  658. package/dist/components/icons/FullscreenExit.js.map +0 -1
  659. package/dist/components/icons/Group.d.ts +0 -6
  660. package/dist/components/icons/Group.js +0 -6
  661. package/dist/components/icons/Group.js.map +0 -1
  662. package/dist/components/icons/History.d.ts +0 -7
  663. package/dist/components/icons/History.js +0 -6
  664. package/dist/components/icons/History.js.map +0 -1
  665. package/dist/components/icons/Image.d.ts +0 -4
  666. package/dist/components/icons/Image.js +0 -9
  667. package/dist/components/icons/Image.js.map +0 -1
  668. package/dist/components/icons/Info.d.ts +0 -6
  669. package/dist/components/icons/Info.js +0 -6
  670. package/dist/components/icons/Info.js.map +0 -1
  671. package/dist/components/icons/Link.d.ts +0 -6
  672. package/dist/components/icons/Link.js +0 -6
  673. package/dist/components/icons/Link.js.map +0 -1
  674. package/dist/components/icons/Linkedin.d.ts +0 -6
  675. package/dist/components/icons/Linkedin.js +0 -6
  676. package/dist/components/icons/Linkedin.js.map +0 -1
  677. package/dist/components/icons/Loading.d.ts +0 -7
  678. package/dist/components/icons/Loading.js +0 -10
  679. package/dist/components/icons/Loading.js.map +0 -1
  680. package/dist/components/icons/Logout.d.ts +0 -6
  681. package/dist/components/icons/Logout.js +0 -6
  682. package/dist/components/icons/Logout.js.map +0 -1
  683. package/dist/components/icons/Mail.d.ts +0 -6
  684. package/dist/components/icons/Mail.js +0 -6
  685. package/dist/components/icons/Mail.js.map +0 -1
  686. package/dist/components/icons/MapMarker.d.ts +0 -6
  687. package/dist/components/icons/MapMarker.js +0 -6
  688. package/dist/components/icons/MapMarker.js.map +0 -1
  689. package/dist/components/icons/MenuHorizontal.d.ts +0 -7
  690. package/dist/components/icons/MenuHorizontal.js +0 -6
  691. package/dist/components/icons/MenuHorizontal.js.map +0 -1
  692. package/dist/components/icons/MenuVertical.d.ts +0 -7
  693. package/dist/components/icons/MenuVertical.js +0 -6
  694. package/dist/components/icons/MenuVertical.js.map +0 -1
  695. package/dist/components/icons/Message.d.ts +0 -6
  696. package/dist/components/icons/Message.js +0 -6
  697. package/dist/components/icons/Message.js.map +0 -1
  698. package/dist/components/icons/Microphone.d.ts +0 -6
  699. package/dist/components/icons/Microphone.js +0 -6
  700. package/dist/components/icons/Microphone.js.map +0 -1
  701. package/dist/components/icons/Minus.d.ts +0 -6
  702. package/dist/components/icons/Minus.js +0 -6
  703. package/dist/components/icons/Minus.js.map +0 -1
  704. package/dist/components/icons/MinusCircle.d.ts +0 -6
  705. package/dist/components/icons/MinusCircle.js +0 -6
  706. package/dist/components/icons/MinusCircle.js.map +0 -1
  707. package/dist/components/icons/PaperClip.d.ts +0 -6
  708. package/dist/components/icons/PaperClip.js +0 -6
  709. package/dist/components/icons/PaperClip.js.map +0 -1
  710. package/dist/components/icons/Picture.d.ts +0 -6
  711. package/dist/components/icons/Picture.js +0 -6
  712. package/dist/components/icons/Picture.js.map +0 -1
  713. package/dist/components/icons/Plus.d.ts +0 -6
  714. package/dist/components/icons/Plus.js +0 -6
  715. package/dist/components/icons/Plus.js.map +0 -1
  716. package/dist/components/icons/Preview.d.ts +0 -4
  717. package/dist/components/icons/Preview.js +0 -9
  718. package/dist/components/icons/Preview.js.map +0 -1
  719. package/dist/components/icons/Print.d.ts +0 -6
  720. package/dist/components/icons/Print.js +0 -6
  721. package/dist/components/icons/Print.js.map +0 -1
  722. package/dist/components/icons/QuestionHelp.d.ts +0 -6
  723. package/dist/components/icons/QuestionHelp.js +0 -6
  724. package/dist/components/icons/QuestionHelp.js.map +0 -1
  725. package/dist/components/icons/Refresh.d.ts +0 -6
  726. package/dist/components/icons/Refresh.js +0 -6
  727. package/dist/components/icons/Refresh.js.map +0 -1
  728. package/dist/components/icons/SelectIcon.d.ts +0 -6
  729. package/dist/components/icons/SelectIcon.js +0 -6
  730. package/dist/components/icons/SelectIcon.js.map +0 -1
  731. package/dist/components/icons/Send.d.ts +0 -6
  732. package/dist/components/icons/Send.js +0 -6
  733. package/dist/components/icons/Send.js.map +0 -1
  734. package/dist/components/icons/Setting.d.ts +0 -6
  735. package/dist/components/icons/Setting.js +0 -6
  736. package/dist/components/icons/Setting.js.map +0 -1
  737. package/dist/components/icons/Share.d.ts +0 -6
  738. package/dist/components/icons/Share.js +0 -6
  739. package/dist/components/icons/Share.js.map +0 -1
  740. package/dist/components/icons/Sound.d.ts +0 -6
  741. package/dist/components/icons/Sound.js +0 -6
  742. package/dist/components/icons/Sound.js.map +0 -1
  743. package/dist/components/icons/SoundDeactivated.d.ts +0 -6
  744. package/dist/components/icons/SoundDeactivated.js +0 -6
  745. package/dist/components/icons/SoundDeactivated.js.map +0 -1
  746. package/dist/components/icons/Telegram.d.ts +0 -6
  747. package/dist/components/icons/Telegram.js +0 -6
  748. package/dist/components/icons/Telegram.js.map +0 -1
  749. package/dist/components/icons/ThumbDown.d.ts +0 -6
  750. package/dist/components/icons/ThumbDown.js +0 -6
  751. package/dist/components/icons/ThumbDown.js.map +0 -1
  752. package/dist/components/icons/ThumbUp.d.ts +0 -6
  753. package/dist/components/icons/ThumbUp.js +0 -6
  754. package/dist/components/icons/ThumbUp.js.map +0 -1
  755. package/dist/components/icons/Translation.d.ts +0 -6
  756. package/dist/components/icons/Translation.js +0 -6
  757. package/dist/components/icons/Translation.js.map +0 -1
  758. package/dist/components/icons/Twitter.d.ts +0 -6
  759. package/dist/components/icons/Twitter.js +0 -6
  760. package/dist/components/icons/Twitter.js.map +0 -1
  761. package/dist/components/icons/Upload.d.ts +0 -4
  762. package/dist/components/icons/Upload.js +0 -9
  763. package/dist/components/icons/Upload.js.map +0 -1
  764. package/dist/components/icons/User.d.ts +0 -6
  765. package/dist/components/icons/User.js +0 -6
  766. package/dist/components/icons/User.js.map +0 -1
  767. package/dist/components/icons/Warning.d.ts +0 -6
  768. package/dist/components/icons/Warning.js +0 -6
  769. package/dist/components/icons/Warning.js.map +0 -1
  770. package/dist/components/icons/WhatsApp.d.ts +0 -6
  771. package/dist/components/icons/WhatsApp.js +0 -6
  772. package/dist/components/icons/WhatsApp.js.map +0 -1
  773. package/dist/components/icons/loading.css +0 -14
  774. package/dist/components/layouts/WebsiteAssistant.d.ts +0 -4
  775. package/dist/components/layouts/WebsiteAssistant.js +0 -38
  776. package/dist/components/layouts/WebsiteAssistant.js.map +0 -1
  777. package/dist/components/layouts/website-assistant.css +0 -676
  778. package/dist/components/ui/Alert.css +0 -93
  779. package/dist/components/ui/Alert.d.ts +0 -18
  780. package/dist/components/ui/Alert.js +0 -42
  781. package/dist/components/ui/Alert.js.map +0 -1
  782. package/dist/components/ui/Button.css +0 -167
  783. package/dist/components/ui/Button.d.ts +0 -27
  784. package/dist/components/ui/Button.js +0 -23
  785. package/dist/components/ui/Button.js.map +0 -1
  786. package/dist/components/ui/Card.css +0 -65
  787. package/dist/components/ui/Card.d.ts +0 -13
  788. package/dist/components/ui/Card.js +0 -14
  789. package/dist/components/ui/Card.js.map +0 -1
  790. package/dist/components/ui/Checkbox.css +0 -116
  791. package/dist/components/ui/Checkbox.d.ts +0 -11
  792. package/dist/components/ui/Checkbox.js +0 -20
  793. package/dist/components/ui/Checkbox.js.map +0 -1
  794. package/dist/components/ui/ConfirmDialog.css +0 -42
  795. package/dist/components/ui/ConfirmDialog.d.ts +0 -11
  796. package/dist/components/ui/ConfirmDialog.js +0 -12
  797. package/dist/components/ui/ConfirmDialog.js.map +0 -1
  798. package/dist/components/ui/Details.css +0 -66
  799. package/dist/components/ui/Drawer.css +0 -270
  800. package/dist/components/ui/Drawer.d.ts +0 -46
  801. package/dist/components/ui/Drawer.js +0 -60
  802. package/dist/components/ui/Drawer.js.map +0 -1
  803. package/dist/components/ui/Dropdown.css +0 -173
  804. package/dist/components/ui/Dropdown.d.ts +0 -11
  805. package/dist/components/ui/Dropdown.js +0 -33
  806. package/dist/components/ui/Dropdown.js.map +0 -1
  807. package/dist/components/ui/Expandable.css +0 -15
  808. package/dist/components/ui/Expandable.d.ts +0 -15
  809. package/dist/components/ui/Expandable.js +0 -59
  810. package/dist/components/ui/Expandable.js.map +0 -1
  811. package/dist/components/ui/Modal.css +0 -98
  812. package/dist/components/ui/Modal.d.ts +0 -16
  813. package/dist/components/ui/Modal.js +0 -24
  814. package/dist/components/ui/Modal.js.map +0 -1
  815. package/dist/components/ui/Select.css +0 -138
  816. package/dist/components/ui/Select.d.ts +0 -17
  817. package/dist/components/ui/Select.js +0 -17
  818. package/dist/components/ui/Select.js.map +0 -1
  819. package/dist/components/ui/Slider.css +0 -192
  820. package/dist/components/ui/Slider.d.ts +0 -12
  821. package/dist/components/ui/Slider.js +0 -78
  822. package/dist/components/ui/Slider.js.map +0 -1
  823. package/dist/components/ui/Spin.css +0 -31
  824. package/dist/components/ui/Spin.d.ts +0 -9
  825. package/dist/components/ui/Spin.js +0 -12
  826. package/dist/components/ui/Spin.js.map +0 -1
  827. package/dist/components/ui/Table.css +0 -132
  828. package/dist/components/ui/Tooltip.css +0 -171
  829. package/dist/components/ui/Tooltip.d.ts +0 -11
  830. package/dist/components/ui/Tooltip.js +0 -90
  831. package/dist/components/ui/Tooltip.js.map +0 -1
  832. package/esm/components/PositionDrawer/PositionDrawer.d.ts +0 -12
  833. package/esm/components/PositionDrawer/PositionDrawer.js +0 -14
  834. package/esm/components/PositionDrawer/PositionDrawer.js.map +0 -1
  835. package/esm/components/icons/AI.d.ts +0 -6
  836. package/esm/components/icons/AI.js +0 -4
  837. package/esm/components/icons/AI.js.map +0 -1
  838. package/esm/components/icons/Alert.d.ts +0 -6
  839. package/esm/components/icons/Alert.js +0 -4
  840. package/esm/components/icons/Alert.js.map +0 -1
  841. package/esm/components/icons/ArrowUp.d.ts +0 -6
  842. package/esm/components/icons/ArrowUp.js +0 -4
  843. package/esm/components/icons/ArrowUp.js.map +0 -1
  844. package/esm/components/icons/Bug.d.ts +0 -6
  845. package/esm/components/icons/Bug.js +0 -4
  846. package/esm/components/icons/Bug.js.map +0 -1
  847. package/esm/components/icons/Chat.d.ts +0 -6
  848. package/esm/components/icons/Chat.js +0 -4
  849. package/esm/components/icons/Chat.js.map +0 -1
  850. package/esm/components/icons/ChevronDown.d.ts +0 -6
  851. package/esm/components/icons/ChevronDown.js +0 -4
  852. package/esm/components/icons/ChevronDown.js.map +0 -1
  853. package/esm/components/icons/ChevronLeft.d.ts +0 -6
  854. package/esm/components/icons/ChevronLeft.js +0 -4
  855. package/esm/components/icons/ChevronLeft.js.map +0 -1
  856. package/esm/components/icons/ChevronRight.d.ts +0 -6
  857. package/esm/components/icons/ChevronRight.js +0 -4
  858. package/esm/components/icons/ChevronRight.js.map +0 -1
  859. package/esm/components/icons/ChevronUp.d.ts +0 -6
  860. package/esm/components/icons/ChevronUp.js +0 -4
  861. package/esm/components/icons/ChevronUp.js.map +0 -1
  862. package/esm/components/icons/Clear.d.ts +0 -6
  863. package/esm/components/icons/Clear.js +0 -4
  864. package/esm/components/icons/Clear.js.map +0 -1
  865. package/esm/components/icons/Close.d.ts +0 -7
  866. package/esm/components/icons/Close.js +0 -4
  867. package/esm/components/icons/Close.js.map +0 -1
  868. package/esm/components/icons/Code.d.ts +0 -6
  869. package/esm/components/icons/Code.js +0 -4
  870. package/esm/components/icons/Code.js.map +0 -1
  871. package/esm/components/icons/Copy.d.ts +0 -6
  872. package/esm/components/icons/Copy.js +0 -4
  873. package/esm/components/icons/Copy.js.map +0 -1
  874. package/esm/components/icons/DeepThought.d.ts +0 -6
  875. package/esm/components/icons/DeepThought.js +0 -4
  876. package/esm/components/icons/DeepThought.js.map +0 -1
  877. package/esm/components/icons/Delete.d.ts +0 -6
  878. package/esm/components/icons/Delete.js +0 -4
  879. package/esm/components/icons/Delete.js.map +0 -1
  880. package/esm/components/icons/Document.d.ts +0 -5
  881. package/esm/components/icons/Document.js +0 -6
  882. package/esm/components/icons/Document.js.map +0 -1
  883. package/esm/components/icons/Download.d.ts +0 -6
  884. package/esm/components/icons/Download.js +0 -4
  885. package/esm/components/icons/Download.js.map +0 -1
  886. package/esm/components/icons/Edit.d.ts +0 -6
  887. package/esm/components/icons/Edit.js +0 -4
  888. package/esm/components/icons/Edit.js.map +0 -1
  889. package/esm/components/icons/Expand.d.ts +0 -6
  890. package/esm/components/icons/Expand.js +0 -4
  891. package/esm/components/icons/Expand.js.map +0 -1
  892. package/esm/components/icons/Eye.d.ts +0 -6
  893. package/esm/components/icons/Eye.js +0 -4
  894. package/esm/components/icons/Eye.js.map +0 -1
  895. package/esm/components/icons/EyeInvisible.d.ts +0 -6
  896. package/esm/components/icons/EyeInvisible.js +0 -4
  897. package/esm/components/icons/EyeInvisible.js.map +0 -1
  898. package/esm/components/icons/Facebook.d.ts +0 -6
  899. package/esm/components/icons/Facebook.js +0 -4
  900. package/esm/components/icons/Facebook.js.map +0 -1
  901. package/esm/components/icons/Feedback.d.ts +0 -6
  902. package/esm/components/icons/Feedback.js +0 -4
  903. package/esm/components/icons/Feedback.js.map +0 -1
  904. package/esm/components/icons/File.d.ts +0 -6
  905. package/esm/components/icons/File.js +0 -4
  906. package/esm/components/icons/File.js.map +0 -1
  907. package/esm/components/icons/FileExcel.d.ts +0 -6
  908. package/esm/components/icons/FileExcel.js +0 -4
  909. package/esm/components/icons/FileExcel.js.map +0 -1
  910. package/esm/components/icons/FilePdf.d.ts +0 -6
  911. package/esm/components/icons/FilePdf.js +0 -4
  912. package/esm/components/icons/FilePdf.js.map +0 -1
  913. package/esm/components/icons/FileWord.d.ts +0 -6
  914. package/esm/components/icons/FileWord.js +0 -4
  915. package/esm/components/icons/FileWord.js.map +0 -1
  916. package/esm/components/icons/Fullscreen.d.ts +0 -6
  917. package/esm/components/icons/Fullscreen.js +0 -4
  918. package/esm/components/icons/Fullscreen.js.map +0 -1
  919. package/esm/components/icons/FullscreenExit.d.ts +0 -6
  920. package/esm/components/icons/FullscreenExit.js +0 -4
  921. package/esm/components/icons/FullscreenExit.js.map +0 -1
  922. package/esm/components/icons/Group.d.ts +0 -6
  923. package/esm/components/icons/Group.js +0 -4
  924. package/esm/components/icons/Group.js.map +0 -1
  925. package/esm/components/icons/History.d.ts +0 -7
  926. package/esm/components/icons/History.js +0 -4
  927. package/esm/components/icons/History.js.map +0 -1
  928. package/esm/components/icons/Image.d.ts +0 -4
  929. package/esm/components/icons/Image.js +0 -5
  930. package/esm/components/icons/Image.js.map +0 -1
  931. package/esm/components/icons/Info.d.ts +0 -6
  932. package/esm/components/icons/Info.js +0 -4
  933. package/esm/components/icons/Info.js.map +0 -1
  934. package/esm/components/icons/Link.d.ts +0 -6
  935. package/esm/components/icons/Link.js +0 -4
  936. package/esm/components/icons/Link.js.map +0 -1
  937. package/esm/components/icons/Linkedin.d.ts +0 -6
  938. package/esm/components/icons/Linkedin.js +0 -4
  939. package/esm/components/icons/Linkedin.js.map +0 -1
  940. package/esm/components/icons/Loading.d.ts +0 -7
  941. package/esm/components/icons/Loading.js +0 -7
  942. package/esm/components/icons/Loading.js.map +0 -1
  943. package/esm/components/icons/Logout.d.ts +0 -6
  944. package/esm/components/icons/Logout.js +0 -4
  945. package/esm/components/icons/Logout.js.map +0 -1
  946. package/esm/components/icons/Mail.d.ts +0 -6
  947. package/esm/components/icons/Mail.js +0 -4
  948. package/esm/components/icons/Mail.js.map +0 -1
  949. package/esm/components/icons/MapMarker.d.ts +0 -6
  950. package/esm/components/icons/MapMarker.js +0 -4
  951. package/esm/components/icons/MapMarker.js.map +0 -1
  952. package/esm/components/icons/MenuHorizontal.d.ts +0 -7
  953. package/esm/components/icons/MenuHorizontal.js +0 -4
  954. package/esm/components/icons/MenuHorizontal.js.map +0 -1
  955. package/esm/components/icons/MenuVertical.d.ts +0 -7
  956. package/esm/components/icons/MenuVertical.js +0 -4
  957. package/esm/components/icons/MenuVertical.js.map +0 -1
  958. package/esm/components/icons/Message.d.ts +0 -6
  959. package/esm/components/icons/Message.js +0 -4
  960. package/esm/components/icons/Message.js.map +0 -1
  961. package/esm/components/icons/Microphone.d.ts +0 -6
  962. package/esm/components/icons/Microphone.js +0 -4
  963. package/esm/components/icons/Microphone.js.map +0 -1
  964. package/esm/components/icons/Minus.d.ts +0 -6
  965. package/esm/components/icons/Minus.js +0 -4
  966. package/esm/components/icons/Minus.js.map +0 -1
  967. package/esm/components/icons/MinusCircle.d.ts +0 -6
  968. package/esm/components/icons/MinusCircle.js +0 -4
  969. package/esm/components/icons/MinusCircle.js.map +0 -1
  970. package/esm/components/icons/PaperClip.d.ts +0 -6
  971. package/esm/components/icons/PaperClip.js +0 -4
  972. package/esm/components/icons/PaperClip.js.map +0 -1
  973. package/esm/components/icons/Picture.d.ts +0 -6
  974. package/esm/components/icons/Picture.js +0 -4
  975. package/esm/components/icons/Picture.js.map +0 -1
  976. package/esm/components/icons/Plus.d.ts +0 -6
  977. package/esm/components/icons/Plus.js +0 -4
  978. package/esm/components/icons/Plus.js.map +0 -1
  979. package/esm/components/icons/Preview.d.ts +0 -4
  980. package/esm/components/icons/Preview.js +0 -5
  981. package/esm/components/icons/Preview.js.map +0 -1
  982. package/esm/components/icons/Print.d.ts +0 -6
  983. package/esm/components/icons/Print.js +0 -4
  984. package/esm/components/icons/Print.js.map +0 -1
  985. package/esm/components/icons/QuestionHelp.d.ts +0 -6
  986. package/esm/components/icons/QuestionHelp.js +0 -4
  987. package/esm/components/icons/QuestionHelp.js.map +0 -1
  988. package/esm/components/icons/Refresh.d.ts +0 -6
  989. package/esm/components/icons/Refresh.js +0 -4
  990. package/esm/components/icons/Refresh.js.map +0 -1
  991. package/esm/components/icons/SelectIcon.d.ts +0 -6
  992. package/esm/components/icons/SelectIcon.js +0 -4
  993. package/esm/components/icons/SelectIcon.js.map +0 -1
  994. package/esm/components/icons/Send.d.ts +0 -6
  995. package/esm/components/icons/Send.js +0 -4
  996. package/esm/components/icons/Send.js.map +0 -1
  997. package/esm/components/icons/Setting.d.ts +0 -6
  998. package/esm/components/icons/Setting.js +0 -4
  999. package/esm/components/icons/Setting.js.map +0 -1
  1000. package/esm/components/icons/Share.d.ts +0 -6
  1001. package/esm/components/icons/Share.js +0 -4
  1002. package/esm/components/icons/Share.js.map +0 -1
  1003. package/esm/components/icons/Sound.d.ts +0 -6
  1004. package/esm/components/icons/Sound.js +0 -4
  1005. package/esm/components/icons/Sound.js.map +0 -1
  1006. package/esm/components/icons/SoundDeactivated.d.ts +0 -6
  1007. package/esm/components/icons/SoundDeactivated.js +0 -4
  1008. package/esm/components/icons/SoundDeactivated.js.map +0 -1
  1009. package/esm/components/icons/Telegram.d.ts +0 -6
  1010. package/esm/components/icons/Telegram.js +0 -4
  1011. package/esm/components/icons/Telegram.js.map +0 -1
  1012. package/esm/components/icons/ThumbDown.d.ts +0 -6
  1013. package/esm/components/icons/ThumbDown.js +0 -4
  1014. package/esm/components/icons/ThumbDown.js.map +0 -1
  1015. package/esm/components/icons/ThumbUp.d.ts +0 -6
  1016. package/esm/components/icons/ThumbUp.js +0 -4
  1017. package/esm/components/icons/ThumbUp.js.map +0 -1
  1018. package/esm/components/icons/Translation.d.ts +0 -6
  1019. package/esm/components/icons/Translation.js +0 -4
  1020. package/esm/components/icons/Translation.js.map +0 -1
  1021. package/esm/components/icons/Twitter.d.ts +0 -6
  1022. package/esm/components/icons/Twitter.js +0 -4
  1023. package/esm/components/icons/Twitter.js.map +0 -1
  1024. package/esm/components/icons/Upload.d.ts +0 -4
  1025. package/esm/components/icons/Upload.js +0 -5
  1026. package/esm/components/icons/Upload.js.map +0 -1
  1027. package/esm/components/icons/User.d.ts +0 -6
  1028. package/esm/components/icons/User.js +0 -4
  1029. package/esm/components/icons/User.js.map +0 -1
  1030. package/esm/components/icons/Warning.d.ts +0 -6
  1031. package/esm/components/icons/Warning.js +0 -4
  1032. package/esm/components/icons/Warning.js.map +0 -1
  1033. package/esm/components/icons/WhatsApp.d.ts +0 -6
  1034. package/esm/components/icons/WhatsApp.js +0 -4
  1035. package/esm/components/icons/WhatsApp.js.map +0 -1
  1036. package/esm/components/icons/loading.css +0 -14
  1037. package/esm/components/layouts/WebsiteAssistant.d.ts +0 -4
  1038. package/esm/components/layouts/WebsiteAssistant.js +0 -35
  1039. package/esm/components/layouts/WebsiteAssistant.js.map +0 -1
  1040. package/esm/components/layouts/website-assistant.css +0 -676
  1041. package/esm/components/ui/Alert.css +0 -93
  1042. package/esm/components/ui/Alert.d.ts +0 -18
  1043. package/esm/components/ui/Alert.js +0 -39
  1044. package/esm/components/ui/Alert.js.map +0 -1
  1045. package/esm/components/ui/Button.css +0 -167
  1046. package/esm/components/ui/Button.d.ts +0 -27
  1047. package/esm/components/ui/Button.js +0 -20
  1048. package/esm/components/ui/Button.js.map +0 -1
  1049. package/esm/components/ui/Card.css +0 -65
  1050. package/esm/components/ui/Card.d.ts +0 -13
  1051. package/esm/components/ui/Card.js +0 -11
  1052. package/esm/components/ui/Card.js.map +0 -1
  1053. package/esm/components/ui/Checkbox.css +0 -116
  1054. package/esm/components/ui/Checkbox.d.ts +0 -11
  1055. package/esm/components/ui/Checkbox.js +0 -17
  1056. package/esm/components/ui/Checkbox.js.map +0 -1
  1057. package/esm/components/ui/ConfirmDialog.css +0 -42
  1058. package/esm/components/ui/ConfirmDialog.d.ts +0 -11
  1059. package/esm/components/ui/ConfirmDialog.js +0 -9
  1060. package/esm/components/ui/ConfirmDialog.js.map +0 -1
  1061. package/esm/components/ui/Details.css +0 -66
  1062. package/esm/components/ui/Drawer.css +0 -270
  1063. package/esm/components/ui/Drawer.d.ts +0 -46
  1064. package/esm/components/ui/Drawer.js +0 -57
  1065. package/esm/components/ui/Drawer.js.map +0 -1
  1066. package/esm/components/ui/Dropdown.css +0 -173
  1067. package/esm/components/ui/Dropdown.d.ts +0 -11
  1068. package/esm/components/ui/Dropdown.js +0 -30
  1069. package/esm/components/ui/Dropdown.js.map +0 -1
  1070. package/esm/components/ui/Expandable.css +0 -15
  1071. package/esm/components/ui/Expandable.d.ts +0 -15
  1072. package/esm/components/ui/Expandable.js +0 -56
  1073. package/esm/components/ui/Expandable.js.map +0 -1
  1074. package/esm/components/ui/Modal.css +0 -98
  1075. package/esm/components/ui/Modal.d.ts +0 -16
  1076. package/esm/components/ui/Modal.js +0 -21
  1077. package/esm/components/ui/Modal.js.map +0 -1
  1078. package/esm/components/ui/Select.css +0 -138
  1079. package/esm/components/ui/Select.d.ts +0 -17
  1080. package/esm/components/ui/Select.js +0 -14
  1081. package/esm/components/ui/Select.js.map +0 -1
  1082. package/esm/components/ui/Slider.css +0 -192
  1083. package/esm/components/ui/Slider.d.ts +0 -12
  1084. package/esm/components/ui/Slider.js +0 -75
  1085. package/esm/components/ui/Slider.js.map +0 -1
  1086. package/esm/components/ui/Spin.css +0 -31
  1087. package/esm/components/ui/Spin.d.ts +0 -9
  1088. package/esm/components/ui/Spin.js +0 -9
  1089. package/esm/components/ui/Spin.js.map +0 -1
  1090. package/esm/components/ui/Table.css +0 -132
  1091. package/esm/components/ui/Tooltip.css +0 -171
  1092. package/esm/components/ui/Tooltip.d.ts +0 -11
  1093. package/esm/components/ui/Tooltip.js +0 -87
  1094. package/esm/components/ui/Tooltip.js.map +0 -1
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArtifactAPIBridge } from '../MemoriArtifactSystem/utils/ArtifactAPI';
3
3
  import { checkPii } from '../../helpers/piiDetection';
4
+ import { shouldRestartSessionOnPositionPopoverClose } from '../../helpers/positionPopover';
4
5
  import { useState, useEffect, useCallback, useRef, useMemo, } from 'react';
5
6
  import { useTranslation } from 'react-i18next';
6
7
  import memoriApiClient from '@memori.ai/memori-api-client';
7
8
  import cx from 'classnames';
8
9
  import { DateTime } from 'luxon';
9
- import { useAlertManager, createAlertOptions } from '@memori.ai/ui';
10
+ import { useAlertManager, createAlertOptions, MemoriUIProvider, AlertViewport, } from '@memori.ai/ui';
11
+ import { WidgetSurfaceProvider } from '../../context/widgetSurfaceContext';
10
12
  import MemoriAuth from '../Auth/Auth';
11
13
  import Chat from '../Chat/Chat';
12
14
  import StartPanel from '../StartPanel/StartPanel';
@@ -30,6 +32,7 @@ import { getTranslation } from '../../helpers/translations';
30
32
  import { setLocalConfig, getLocalConfig, removeLocalConfig, } from '../../helpers/configuration';
31
33
  import { hasTouchscreen, stripDuplicates, installMathJax, } from '../../helpers/utils';
32
34
  import { getTTSVoice } from '../../helpers/tts/ttsVoiceUtility';
35
+ import { getMuteSpeakerFallback, shouldPlayTtsAudio, } from '../../helpers/tts/muteSpeaker';
33
36
  import { allowedMediaTypes, anonTag, uiLanguages, } from '../../helpers/constants';
34
37
  import { getErrori18nKey } from '../../helpers/error';
35
38
  import { getCredits } from '../../helpers/credits';
@@ -37,6 +40,8 @@ import { sanitizeText } from '../../helpers/sanitizer';
37
40
  import { useTTS } from '../../helpers/tts/useTTS';
38
41
  import ChatHistoryDrawer from '../ChatHistoryDrawer/ChatHistory';
39
42
  import { useSTT } from '../../helpers/stt/useSTT';
43
+ import { useNats } from '../../helpers/nats/useNats';
44
+ import { isSessionExpiredNatsError, isSessionExpiredNatsResponse, } from '../../helpers/nats/isSessionExpiredError';
40
45
  const getMemoriState = (integrationId) => {
41
46
  var _a, _b, _c, _d, _f;
42
47
  let widget = integrationId
@@ -58,12 +63,23 @@ const getMemoriState = (integrationId) => {
58
63
  loginToken,
59
64
  };
60
65
  };
66
+ const resolveLoginTokenValue = (loginToken, userTokenRef, callAdditionalInfoLoginToken, additionalInfoLoginToken, authTokenProp) => {
67
+ var _a, _b, _c;
68
+ return (_c = (_b = (_a = loginToken !== null && loginToken !== void 0 ? loginToken : userTokenRef) !== null && _a !== void 0 ? _a : callAdditionalInfoLoginToken) !== null && _b !== void 0 ? _b : additionalInfoLoginToken) !== null && _c !== void 0 ? _c : authTokenProp;
69
+ };
61
70
  const NULL_PLACE_SPEC = {
62
71
  placeName: null,
63
72
  latitude: null,
64
73
  longitude: null,
65
74
  uncertaintyKm: null,
66
75
  };
76
+ const logWidgetError = (context, detail) => {
77
+ console.error(`[MemoriWidget] ${context}`, detail !== null && detail !== void 0 ? detail : '');
78
+ };
79
+ function readCorrelationID(response) {
80
+ const value = response.correlationID;
81
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
82
+ }
67
83
  const typeMessage = (message, waitForPrevious = true, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false) => {
68
84
  const e = new CustomEvent('MemoriTextEntered', {
69
85
  detail: {
@@ -159,7 +175,6 @@ window.typeMessageHidden = typeMessageHidden;
159
175
  window.typeBatchMessages = typeBatchMessages;
160
176
  let audioContext;
161
177
  let memoriPassword;
162
- let userToken;
163
178
  export function getChatStyles(config) {
164
179
  var _a;
165
180
  const primary = config === null || config === void 0 ? void 0 : config.buttonBgColor;
@@ -170,18 +185,20 @@ export function getChatStyles(config) {
170
185
  '--memori-primary-color': primary,
171
186
  '--memori-primary': primary,
172
187
  '--memori-primary-content': primaryContent,
173
- '--memori-primary-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, black) 15%)',
174
- '--memori-primary-active': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, black) 25%)',
188
+ '--memori-primary-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 15%)',
189
+ '--memori-primary-active': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, black) 25%)',
175
190
  '--memori-primary-disabled': 'color-mix(in oklch, var(--memori-primary), transparent 60%)',
176
- '--memori-primary-subtle': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, white) 60%)',
177
- '--memori-primary-subtle-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, white) 50%)',
191
+ '--memori-primary-subtle': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 60%)',
192
+ '--memori-primary-subtle-hover': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 50%)',
178
193
  '--memori-border-primary': 'color-mix(in oklch, var(--memori-primary), transparent 70%)',
179
194
  '--memori-border-primary-hover': 'color-mix(in oklch, var(--memori-primary), transparent 50%)',
180
195
  '--memori-focus-ring-color': 'color-mix(in oklch, var(--memori-primary), transparent 80%)',
181
196
  '--memori-focus-ring': '0 0 0 3px var(--memori-focus-ring-color)',
182
197
  '--memori-shadow-primary': '0 8px 16px -4px color-mix(in oklch, var(--memori-primary), transparent 70%)',
183
- '--memori-skeleton-base': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, white) 85%)',
184
- '--memori-skeleton-highlight': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast, white) 75%)',
198
+ '--memori-skeleton-base': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 85%)',
199
+ '--memori-skeleton-highlight': 'color-mix(in oklch, var(--memori-primary), var(--memori-surface-contrast-inverse, white) 75%)',
200
+ '--memori-icon-active-bg': 'color-mix(in oklch, var(--memori-primary) 12%, transparent)',
201
+ '--memori-icon-recording-bg': 'color-mix(in oklch, var(--memori-error, #dc2626) 12%, transparent)',
185
202
  };
186
203
  }
187
204
  const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, uiLang, spokenLang, multilingual, integration, layout, customLayout, showShare, preview = false, embed = false, showCopyButton = true, showTranslationOriginal = false, showInputs = true, showDates = false, showContextPerLine = false, showMessageConsumption = false, showSettings, showTypingText = false, showClear = false, showLogin = false, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, avatar3dHidden, height = '100vh', secret, baseUrl = 'https://aisuru-staging.aclambda.online', apiURL = 'https://backend-staging.memori.ai', engineURL = 'https://engine-staging.memori.ai', initialContextVars, initialQuestion, ttsProvider, ogImage, sessionID: initialSessionID, tenant, personification, authToken, enableAudio, defaultSpeakerActive = true, disableTextEnteredEvents = false, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, __WEBCOMPONENT__ = false, useMathFormatting = false, autoStart = false, applyVarsToRoot = false, showFunctionCache = false, maxTotalMessagePayload, maxTextareaCharacters, }) => {
@@ -193,59 +210,70 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
193
210
  setIsClient(true);
194
211
  }, []);
195
212
  const client = memoriApiClient(apiURL, engineURL);
196
- const { initSession, deleteSession, postTextEnteredEvent, postPlaceChangedEvent, postDateChangedEvent, postTagChangedEvent, getSession, getExpertReferences, getSessionChatLogs, } = client;
213
+ const { initSession, deleteSession, postEnterTextAsync, postTextEnteredEvent, postPlaceChangedEvent, postDateChangedEvent, postTagChangedEvent, getSession, getExpertReferences, getSessionChatLogs, } = client;
197
214
  const [instruct, setInstruct] = useState(false);
198
215
  const [enableFocusChatInput, setEnableFocusChatInput] = useState(true);
199
- const widgetRootRef = useRef(null);
200
- const [isDarkTheme, setIsDarkTheme] = useState(false);
201
- useEffect(() => {
202
- var _a;
203
- const el = widgetRootRef.current;
204
- if (!el)
205
- return;
206
- const check = () => {
207
- setIsDarkTheme(!!el.closest('[data-theme="dark"]'));
208
- };
209
- check();
210
- const observer = new MutationObserver(check);
211
- const parent = (_a = el.parentElement) !== null && _a !== void 0 ? _a : document.body;
212
- observer.observe(parent, {
213
- attributes: true,
214
- attributeFilter: ['data-theme'],
215
- subtree: true,
216
- });
217
- return () => observer.disconnect();
218
- }, []);
216
+ const [widgetRootEl, setWidgetRootEl] = useState(null);
217
+ const [widgetSurfaceEl, setWidgetSurfaceEl] = useState(null);
219
218
  const [loginToken, setLoginToken] = useState((_a = additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _a !== void 0 ? _a : authToken);
219
+ const userTokenRef = useRef((_b = additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _b !== void 0 ? _b : authToken);
220
+ const prevPropsLoginTokenRef = useRef((_c = additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _c !== void 0 ? _c : authToken);
220
221
  const [user, setUser] = useState({
221
222
  avatarURL: typeof userAvatar === 'string' ? userAvatar : undefined,
222
223
  });
224
+ const resolveLoginToken = useCallback((callAdditionalInfoLoginToken) => resolveLoginTokenValue(loginToken, userTokenRef.current, callAdditionalInfoLoginToken, additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken, authToken), [loginToken, additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken, authToken]);
223
225
  useEffect(() => {
224
- if (loginToken &&
225
- !(user === null || user === void 0 ? void 0 : user.userID) &&
226
- (showLogin || memori.requireLoginToken)) {
227
- client.backend
228
- .pwlGetCurrentUser(loginToken)
229
- .then(({ user, resultCode }) => {
230
- if (user && resultCode === 0) {
231
- setUser(user);
232
- setLocalConfig('loginToken', loginToken);
233
- if (!birthDate && user.birthDate) {
234
- setBirthDate(user.birthDate);
235
- setLocalConfig('birthDate', user.birthDate);
236
- }
237
- }
238
- else {
239
- removeLocalConfig('loginToken');
240
- }
241
- });
226
+ var _a;
227
+ const incomingToken = (_a = additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _a !== void 0 ? _a : authToken;
228
+ const prevPropsToken = prevPropsLoginTokenRef.current;
229
+ prevPropsLoginTokenRef.current = incomingToken;
230
+ if (incomingToken !== prevPropsToken) {
231
+ setLoginToken(incomingToken);
232
+ userTokenRef.current = incomingToken;
233
+ if (!incomingToken) {
234
+ removeLocalConfig('loginToken');
235
+ setUser(undefined);
236
+ }
242
237
  }
243
- }, [loginToken, user === null || user === void 0 ? void 0 : user.userID]);
238
+ }, [additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken, authToken]);
239
+ useEffect(() => {
240
+ if (!loginToken || !(showLogin || memori.requireLoginToken)) {
241
+ return;
242
+ }
243
+ let cancelled = false;
244
+ client.backend
245
+ .pwlGetCurrentUser(loginToken)
246
+ .then(({ user: fetchedUser, resultCode }) => {
247
+ if (cancelled)
248
+ return;
249
+ if (fetchedUser && resultCode === 0) {
250
+ setUser(fetchedUser);
251
+ setLocalConfig('loginToken', loginToken);
252
+ userTokenRef.current = loginToken;
253
+ if (!birthDate && fetchedUser.birthDate) {
254
+ setBirthDate(fetchedUser.birthDate);
255
+ setLocalConfig('birthDate', fetchedUser.birthDate);
256
+ }
257
+ }
258
+ else {
259
+ setLoginToken(undefined);
260
+ userTokenRef.current = undefined;
261
+ setUser(undefined);
262
+ removeLocalConfig('loginToken');
263
+ }
264
+ });
265
+ return () => {
266
+ cancelled = true;
267
+ };
268
+ }, [loginToken, showLogin, memori.requireLoginToken]);
244
269
  const [showLoginDrawer, setShowLoginDrawer] = useState(false);
245
270
  const [clickedStart, setClickedStart] = useState(false);
246
271
  const [gotErrorInOpening, setGotErrorInOpening] = useState(false);
247
- const language = ((_d = (_c = (_b = memori.culture) === null || _b === void 0 ? void 0 : _b.split('-')) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.toUpperCase()) ||
248
- ((_j = (_h = (_g = (_f = memoriConfigs === null || memoriConfigs === void 0 ? void 0 : memoriConfigs.find(c => c.memoriConfigID === memori.memoriConfigurationID)) === null || _f === void 0 ? void 0 : _f.culture) === null || _g === void 0 ? void 0 : _g.split('-')) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.toUpperCase());
272
+ const sessionStartingRef = useRef(false);
273
+ const needsCredits = tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation;
274
+ const [hasEnoughCredits, setHasEnoughCredits] = useState(true);
275
+ const language = ((_g = (_f = (_d = memori.culture) === null || _d === void 0 ? void 0 : _d.split('-')) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.toUpperCase()) ||
276
+ ((_l = (_k = (_j = (_h = memoriConfigs === null || memoriConfigs === void 0 ? void 0 : memoriConfigs.find(c => c.memoriConfigID === memori.memoriConfigurationID)) === null || _h === void 0 ? void 0 : _h.culture) === null || _j === void 0 ? void 0 : _j.split('-')) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.toUpperCase());
249
277
  const integrationConfig = (integration === null || integration === void 0 ? void 0 : integration.customData)
250
278
  ? JSON.parse(integration.customData)
251
279
  : null;
@@ -253,7 +281,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
253
281
  ? multilingual
254
282
  : !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.multilanguage);
255
283
  const forcedTimeout = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.forcedTimeout;
256
- const [userLang, setUserLang] = useState((_p = (_o = (_m = (_l = (_k = spokenLang !== null && spokenLang !== void 0 ? spokenLang : memoriLang) !== null && _k !== void 0 ? _k : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.lang) !== null && _l !== void 0 ? _l : language) !== null && _m !== void 0 ? _m : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.uiLang) !== null && _o !== void 0 ? _o : i18n.language) !== null && _p !== void 0 ? _p : 'IT');
284
+ const [userLang, setUserLang] = useState((_r = (_q = (_p = (_o = (_m = spokenLang !== null && spokenLang !== void 0 ? spokenLang : memoriLang) !== null && _m !== void 0 ? _m : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.lang) !== null && _o !== void 0 ? _o : language) !== null && _p !== void 0 ? _p : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.uiLang) !== null && _q !== void 0 ? _q : i18n.language) !== null && _r !== void 0 ? _r : 'IT');
257
285
  useEffect(() => {
258
286
  if (spokenLang != null) {
259
287
  setUserLang(spokenLang);
@@ -279,6 +307,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
279
307
  const [loading, setLoading] = useState(false);
280
308
  const [memoriTyping, setMemoriTyping] = useState(false);
281
309
  const [typingText, setTypingText] = useState();
310
+ const pendingEnterTextRef = useRef(new Map());
311
+ const bufferedNatsResponsesRef = useRef(new Map());
282
312
  const layoutName = typeof layout === 'string'
283
313
  ? layout
284
314
  : layout &&
@@ -289,7 +319,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
289
319
  ? layout.name
290
320
  : typeof (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === 'string'
291
321
  ? integrationConfig.layout
292
- : (_q = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _q === void 0 ? void 0 : _q.name;
322
+ : (_s = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _s === void 0 ? void 0 : _s.name;
293
323
  const selectedLayout = (() => {
294
324
  if (typeof layoutName === 'string') {
295
325
  const lower = layoutName.toLowerCase();
@@ -311,23 +341,24 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
311
341
  }
312
342
  if (layoutName === 2 || layoutName === '2')
313
343
  return 'FULLPAGE';
314
- return 'DEFAULT';
344
+ return 'FULLPAGE';
315
345
  })();
316
346
  const piiDetection = layout &&
317
347
  typeof layout === 'object' &&
318
348
  layout !== null &&
319
349
  'piiDetection' in layout &&
320
- ((_r = layout.piiDetection) === null || _r === void 0 ? void 0 : _r.enabled)
350
+ ((_t = layout.piiDetection) === null || _t === void 0 ? void 0 : _t.enabled)
321
351
  ? layout.piiDetection
322
352
  : typeof (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === 'object' &&
323
353
  (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) !== null &&
324
- ((_t = (_s = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _s === void 0 ? void 0 : _s.piiDetection) === null || _t === void 0 ? void 0 : _t.enabled)
354
+ ((_v = (_u = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.layout) === null || _u === void 0 ? void 0 : _u.piiDetection) === null || _v === void 0 ? void 0 : _v.enabled)
325
355
  ? integrationConfig.layout.piiDetection
326
356
  : undefined;
327
- const defaultEnableAudio = (_u = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _u !== void 0 ? _u : true;
357
+ const defaultEnableAudio = (_w = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _w !== void 0 ? _w : true;
328
358
  const [hasUserActivatedListening, setHasUserActivatedListening] = useState(false);
329
359
  const [hasUserTypedMessage, setHasUserTypedMessage] = useState(false);
330
360
  const [positionPopoverOpen, setPositionPopoverOpenState] = useState(false);
361
+ const [autoStartPositionGeolocation, setAutoStartPositionGeolocation] = useState(false);
331
362
  const [showSettingsDrawer, setShowSettingsDrawer] = useState(false);
332
363
  const [showChatHistoryDrawer, setShowChatHistoryDrawer] = useState(false);
333
364
  const [showKnownFactsDrawer, setShowKnownFactsDrawer] = useState(false);
@@ -367,7 +398,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
367
398
  setRuntimeShowMessageConsumption(getLocalConfig('showMessageConsumption', (_a = showMessageConsumption !== null && showMessageConsumption !== void 0 ? showMessageConsumption : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showMessageConsumption) !== null && _a !== void 0 ? _a : false));
368
399
  if (!(additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) && !authToken) {
369
400
  setLoginToken(getLocalConfig('loginToken', undefined));
370
- userToken = getLocalConfig('loginToken', undefined);
401
+ userTokenRef.current = getLocalConfig('loginToken', undefined);
371
402
  setBirthDate(getLocalConfig('birthDate', undefined));
372
403
  }
373
404
  if (!((_b = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _b !== void 0 ? _b : true)) {
@@ -465,8 +496,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
465
496
  });
466
497
  };
467
498
  const [chatLogID, setChatLogID] = useState(undefined);
468
- const sendMessage = async (text, media, newSessionId, translate = true, translatedText, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false) => {
469
- var _a, _b, _c, _d, _f, _g;
499
+ const sendMessage = async (text, media, newSessionId, translate = true, translatedText, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false, skipHistoryPush = false) => {
500
+ var _a, _b;
470
501
  const sessionID = newSessionId ||
471
502
  sessionId ||
472
503
  ((_a = window.getMemoriState()) === null || _a === void 0 ? void 0 : _a.sessionID);
@@ -510,7 +541,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
510
541
  return;
511
542
  }
512
543
  }
513
- if (!hidden)
544
+ if (!hidden && !skipHistoryPush)
514
545
  pushMessage({
515
546
  text: text,
516
547
  translatedText,
@@ -520,12 +551,10 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
520
551
  ? !!newSessionId && newSessionId !== sessionId
521
552
  : !!newSessionId,
522
553
  });
523
- setMemoriTyping(true);
524
- setTypingText(typingText);
525
554
  let gotError = false;
526
555
  try {
527
556
  const placeSpec = getPlaceSpecForEnterText(position);
528
- const { currentState, ...response } = await postTextEnteredEvent({
557
+ const response = await postEnterTextAsync({
529
558
  sessionId: sessionID,
530
559
  text: msg,
531
560
  ...(memori.needsDateTime && {
@@ -533,65 +562,37 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
533
562
  }),
534
563
  ...(placeSpec !== undefined && { place: placeSpec }),
535
564
  });
536
- if (response.resultCode === 0 && currentState) {
537
- setChatLogID(undefined);
538
- const emission = useLoaderTextAsMsg && typingText
539
- ? typingText
540
- : (_c = currentState.emission) !== null && _c !== void 0 ? _c : currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission;
541
- if (userLang.toLowerCase() !== language.toLowerCase() &&
542
- emission &&
543
- isMultilanguageEnabled) {
544
- currentState.emission = emission;
545
- translateDialogState(currentState, userLang, msg).then(ts => {
546
- let text = ts.translatedEmission || ts.emission;
547
- if (text && shouldPlayAudio(text)) {
548
- handleSpeak(text);
549
- }
550
- });
551
- }
552
- else {
553
- setCurrentDialogState({
554
- ...currentState,
555
- emission,
556
- });
557
- if (emission) {
558
- pushMessage({
559
- text: emission,
560
- emitter: currentState.emitter,
561
- media: (_d = currentState.emittedMedia) !== null && _d !== void 0 ? _d : currentState.media,
562
- llmUsage: currentState.llmUsage,
563
- fromUser: false,
564
- questionAnswered: msg,
565
- generatedByAI: !!currentState.completion,
566
- contextVars: currentState.contextVars,
567
- date: currentState.currentDate,
568
- placeName: currentState.currentPlaceName,
569
- placeLatitude: currentState.currentLatitude,
570
- placeLongitude: currentState.currentLongitude,
571
- placeUncertaintyKm: currentState.currentUncertaintyKm,
572
- tag: currentState.currentTag,
573
- memoryTags: currentState.memoryTags,
574
- });
575
- if (emission && shouldPlayAudio(emission)) {
576
- handleSpeak(emission);
577
- }
578
- }
579
- }
565
+ const correlationID = readCorrelationID(response);
566
+ if (response.resultCode === 0 && correlationID) {
567
+ registerPendingEnterText(correlationID, {
568
+ msg,
569
+ text,
570
+ media,
571
+ translate,
572
+ translatedText,
573
+ hidden,
574
+ typingText,
575
+ useLoaderTextAsMsg,
576
+ hasBatchQueued,
577
+ });
578
+ setMemoriTyping(true);
579
+ setTypingText(typingText);
580
+ }
581
+ else if (response.resultCode === 0) {
582
+ logWidgetError('enter-text missing correlationID', response);
580
583
  }
581
584
  else if (response.resultCode === 404) {
582
- setHistory(h => [...h.slice(0, h.length - 1)]);
583
- reopenSession(true, memoriPwd || memori.secretToken, memoriTokens, undefined, undefined, {
584
- LANG: userLang,
585
- PATHNAME: window.location.pathname,
586
- ROUTE: ((_g = (_f = window.location.pathname) === null || _f === void 0 ? void 0 : _f.split('/')) === null || _g === void 0 ? void 0 : _g.pop()) || '',
587
- ...(initialContextVars || {}),
588
- }, initialQuestion, undefined, undefined, undefined, undefined, true).then(state => {
589
- console.info('session timeout');
590
- if (state === null || state === void 0 ? void 0 : state.sessionID) {
591
- setTimeout(() => {
592
- sendMessage(text, media, state === null || state === void 0 ? void 0 : state.sessionID);
593
- }, 500);
594
- }
585
+ retryAfterExpiredSessionRef.current({
586
+ text,
587
+ media,
588
+ translate,
589
+ translatedText,
590
+ hidden,
591
+ typingText,
592
+ useLoaderTextAsMsg,
593
+ hasBatchQueued,
594
+ expiredSessionID: sessionID,
595
+ continueFromChatLogID: chatLogID,
595
596
  });
596
597
  }
597
598
  else if (response.resultCode === 500 && response.resultMessage) {
@@ -608,18 +609,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
608
609
  ]);
609
610
  }
610
611
  else {
611
- console.warn('[SEND_MESSAGE]', response);
612
612
  return Promise.reject(response);
613
613
  }
614
614
  }
615
615
  catch (error) {
616
- console.log('error', error);
617
- console.error(error);
618
616
  gotError = true;
619
- setTypingText(undefined);
620
- setMemoriTyping(false);
621
- }
622
- if (!hasBatchQueued) {
617
+ logWidgetError('sendMessage failed', error);
623
618
  setTypingText(undefined);
624
619
  setMemoriTyping(false);
625
620
  }
@@ -701,7 +696,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
701
696
  }
702
697
  }
703
698
  catch (error) {
704
- console.error('[TRANSLATE] Error during translation:', error);
705
699
  translatedState = { ...state, emission };
706
700
  translatedMsg = {
707
701
  text: emission,
@@ -809,7 +803,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
809
803
  try {
810
804
  setTimeout(() => {
811
805
  var _a;
812
- console.log('snippet', s);
813
806
  new Function((_a = s.content) !== null && _a !== void 0 ? _a : '')();
814
807
  setTimeout(() => {
815
808
  var _a, _b, _c;
@@ -818,8 +811,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
818
811
  }, 400);
819
812
  }, 1000);
820
813
  }
821
- catch (e) {
822
- console.warn(e);
814
+ catch (_a) {
823
815
  }
824
816
  });
825
817
  };
@@ -830,7 +822,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
830
822
  }
831
823
  }, [initialSessionID]);
832
824
  const fetchSession = async (params) => {
833
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l;
825
+ var _a, _b, _c, _d, _f, _g, _h;
834
826
  let storageBirthDate = getLocalConfig('birthDate', undefined);
835
827
  let userBirthDate = (_a = birthDate !== null && birthDate !== void 0 ? birthDate : params.birthDate) !== null && _a !== void 0 ? _a : storageBirthDate;
836
828
  if (!userBirthDate && !!minAge) {
@@ -844,6 +836,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
844
836
  setAuthModalState('password');
845
837
  return;
846
838
  }
839
+ if (!(await checkCredits({ notify: true }))) {
840
+ return;
841
+ }
847
842
  setLoading(true);
848
843
  try {
849
844
  let referral;
@@ -852,8 +847,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
852
847
  return window.location.href;
853
848
  })();
854
849
  }
855
- catch (err) {
856
- console.debug(err);
850
+ catch (_j) {
857
851
  }
858
852
  const session = await initSession({
859
853
  ...params,
@@ -862,8 +856,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
862
856
  pin: (_c = params.pin) !== null && _c !== void 0 ? _c : personification === null || personification === void 0 ? void 0 : personification.pin,
863
857
  additionalInfo: {
864
858
  ...(params.additionalInfo || additionalInfo || {}),
865
- loginToken: (_h = (_g = (_d = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _d !== void 0 ? _d : (_f = params.additionalInfo) === null || _f === void 0 ? void 0 : _f.loginToken) !== null && _g !== void 0 ? _g : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _h !== void 0 ? _h : authToken,
866
- language: ((_l = userLang !== null && userLang !== void 0 ? userLang : (_k = (_j = memori.culture) === null || _j === void 0 ? void 0 : _j.split('-')) === null || _k === void 0 ? void 0 : _k[0]) !== null && _l !== void 0 ? _l : 'IT').toLowerCase(),
859
+ loginToken: resolveLoginToken((_d = params.additionalInfo) === null || _d === void 0 ? void 0 : _d.loginToken),
860
+ language: ((_h = userLang !== null && userLang !== void 0 ? userLang : (_g = (_f = memori.culture) === null || _f === void 0 ? void 0 : _f.split('-')) === null || _g === void 0 ? void 0 : _g[0]) !== null && _h !== void 0 ? _h : 'IT').toLowerCase(),
867
861
  referral: referral,
868
862
  timeZoneOffset: new Date().getTimezoneOffset().toString(),
869
863
  },
@@ -892,7 +886,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
892
886
  }));
893
887
  setGotErrorInOpening(true);
894
888
  }
895
- else if ((session === null || session === void 0 ? void 0 : session.resultCode) === 403) {
889
+ else if ((session === null || session === void 0 ? void 0 : session.resultCode) === 403 && memori.privacyType !== 'PUBLIC') {
896
890
  setMemoriPwd(undefined);
897
891
  setAuthModalState('password');
898
892
  return session;
@@ -904,16 +898,15 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
904
898
  severity: 'error',
905
899
  duration: 0,
906
900
  }));
907
- setGotErrorInOpening(true);
908
901
  return session;
909
902
  }
910
903
  }
911
904
  catch (err) {
912
- console.error(err);
905
+ logWidgetError('fetchSession failed', err);
913
906
  }
914
907
  };
915
- const reopenSession = async (updateDialogState = false, password, recoveryTokens, tag, pin, initialContextVars, initialQuestion, birthDate, additionalInfoProp, continueFromChatLogID, continueFromSessionID, isSessionExpired) => {
916
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m;
908
+ const reopenSession = async (updateDialogState = false, password, recoveryTokens, tag, pin, initialContextVars, initialQuestion, birthDate, additionalInfoProp, continueFromChatLogID, continueFromSessionID, isSessionExpired, suppressHistoryUpdate) => {
909
+ var _a, _b, _c, _d, _f, _g, _h, _j;
917
910
  setLoading(true);
918
911
  let storageBirthDate = getLocalConfig('birthDate', undefined);
919
912
  let userBirthDate = birthDate !== null && birthDate !== void 0 ? birthDate : storageBirthDate;
@@ -931,14 +924,17 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
931
924
  setAuthModalState('password');
932
925
  return;
933
926
  }
927
+ if (!(await checkCredits({ notify: true }))) {
928
+ setLoading(false);
929
+ return null;
930
+ }
934
931
  let referral;
935
932
  try {
936
933
  referral = (() => {
937
934
  return window.location.href;
938
935
  })();
939
936
  }
940
- catch (err) {
941
- console.debug('[REOPEN_SESSION] Error getting referral:', err);
937
+ catch (_k) {
942
938
  }
943
939
  const { sessionID, currentState, ...response } = await initSession({
944
940
  memoriID: (_a = memori.engineMemoriID) !== null && _a !== void 0 ? _a : '',
@@ -958,21 +954,32 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
958
954
  birthDate: userBirthDate,
959
955
  additionalInfo: {
960
956
  ...(additionalInfoProp || additionalInfo || {}),
961
- loginToken: (_g = (_f = (_d = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _d !== void 0 ? _d : additionalInfoProp === null || additionalInfoProp === void 0 ? void 0 : additionalInfoProp.loginToken) !== null && _f !== void 0 ? _f : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _g !== void 0 ? _g : authToken,
962
- language: ((_k = userLang !== null && userLang !== void 0 ? userLang : (_j = (_h = memori.culture) === null || _h === void 0 ? void 0 : _h.split('-')) === null || _j === void 0 ? void 0 : _j[0]) !== null && _k !== void 0 ? _k : 'IT').toLowerCase(),
957
+ loginToken: resolveLoginToken(additionalInfoProp === null || additionalInfoProp === void 0 ? void 0 : additionalInfoProp.loginToken),
958
+ language: ((_g = userLang !== null && userLang !== void 0 ? userLang : (_f = (_d = memori.culture) === null || _d === void 0 ? void 0 : _d.split('-')) === null || _f === void 0 ? void 0 : _f[0]) !== null && _g !== void 0 ? _g : 'IT').toLowerCase(),
963
959
  referral: referral,
964
960
  timeZoneOffset: new Date().getTimezoneOffset().toString(),
965
961
  },
966
962
  });
967
963
  if (sessionID && currentState && response.resultCode === 0) {
968
- console.log('[REOPEN_SESSION] Session initialized successfully:', sessionID);
969
964
  setSessionId(sessionID);
970
965
  if (updateDialogState) {
971
966
  setCurrentDialogState(currentState);
972
- if (currentState.emission) {
973
- console.log('[REOPEN_SESSION] Processing emission:', currentState.emission);
974
- const initialStatus = isSessionExpired && history.length > 1
975
- ? 'Session Expired, reopening session'
967
+ const sessionExpiredStatus = isSessionExpired && history.length > 1
968
+ ? t('sessionExpiredReopening')
969
+ : null;
970
+ if (sessionExpiredStatus && suppressHistoryUpdate) {
971
+ pushMessage({
972
+ text: '',
973
+ emitter: 'system',
974
+ fromUser: false,
975
+ initial: sessionExpiredStatus,
976
+ contextVars: {},
977
+ date: new Date().toISOString(),
978
+ });
979
+ }
980
+ if (currentState.emission && !suppressHistoryUpdate) {
981
+ const initialStatus = sessionExpiredStatus
982
+ ? sessionExpiredStatus
976
983
  : history.length <= 1
977
984
  ? true
978
985
  : undefined;
@@ -981,7 +988,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
981
988
  {
982
989
  text: currentState.emission,
983
990
  emitter: currentState.emitter,
984
- media: (_l = currentState.emittedMedia) !== null && _l !== void 0 ? _l : currentState.media,
991
+ media: (_h = currentState.emittedMedia) !== null && _h !== void 0 ? _h : currentState.media,
985
992
  fromUser: false,
986
993
  initial: (initialStatus === true
987
994
  ? true
@@ -999,7 +1006,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
999
1006
  : pushMessage({
1000
1007
  text: currentState.emission,
1001
1008
  emitter: currentState.emitter,
1002
- media: (_m = currentState.emittedMedia) !== null && _m !== void 0 ? _m : currentState.media,
1009
+ media: (_j = currentState.emittedMedia) !== null && _j !== void 0 ? _j : currentState.media,
1003
1010
  fromUser: false,
1004
1011
  initial: (initialStatus === true
1005
1012
  ? true
@@ -1029,8 +1036,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1029
1036
  }));
1030
1037
  setGotErrorInOpening(true);
1031
1038
  }
1032
- else if ((response === null || response === void 0 ? void 0 : response.resultCode) === 403) {
1033
- console.error('[REOPEN_SESSION] Authentication error');
1039
+ else if ((response === null || response === void 0 ? void 0 : response.resultCode) === 403 &&
1040
+ memori.privacyType !== 'PUBLIC') {
1034
1041
  setMemoriPwd(undefined);
1035
1042
  setAuthModalState('password');
1036
1043
  }
@@ -1044,15 +1051,61 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1044
1051
  }
1045
1052
  }
1046
1053
  catch (err) {
1047
- console.error('[REOPEN_SESSION] Caught error:', err);
1054
+ logWidgetError('reopenSession failed', err);
1048
1055
  }
1049
1056
  setLoading(false);
1050
1057
  return null;
1051
1058
  };
1059
+ const retryAfterExpiredSessionRef = useRef(() => Promise.resolve(null));
1060
+ retryAfterExpiredSessionRef.current = (params) => {
1061
+ const { text, media, translate = true, translatedText, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false, expiredSessionID, continueFromChatLogID: continueFromChatLogIDParam, } = params;
1062
+ const continueFromSessionID = expiredSessionID !== null && expiredSessionID !== void 0 ? expiredSessionID : sessionId;
1063
+ const continueFromChatLogID = continueFromChatLogIDParam !== null && continueFromChatLogIDParam !== void 0 ? continueFromChatLogIDParam : chatLogID;
1064
+ const reopenAfterExpiry = () => {
1065
+ var _a, _b;
1066
+ return reopenSession(true, memoriPwd || memori.secretToken, memoriTokens, undefined, undefined, {
1067
+ LANG: userLang,
1068
+ PATHNAME: window.location.pathname,
1069
+ ROUTE: ((_b = (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.split('/')) === null || _b === void 0 ? void 0 : _b.pop()) || '',
1070
+ ...(initialContextVars || {}),
1071
+ }, initialQuestion, undefined, undefined, continueFromChatLogID, continueFromSessionID, true, true);
1072
+ };
1073
+ const scheduleRetry = (newSessionID) => {
1074
+ setTimeout(() => {
1075
+ sendMessage(text, media, newSessionID, translate, translatedText, hidden, typingText, useLoaderTextAsMsg, hasBatchQueued, true);
1076
+ }, 500);
1077
+ };
1078
+ const handleReopenFailure = (state) => {
1079
+ setMemoriTyping(false);
1080
+ setTypingText(undefined);
1081
+ if (state === null && text && !hidden) {
1082
+ add(createAlertOptions({
1083
+ description: t('errors.SESSION_EXPIRED'),
1084
+ severity: 'error',
1085
+ }));
1086
+ }
1087
+ };
1088
+ if (!text) {
1089
+ return reopenAfterExpiry().then(state => {
1090
+ if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
1091
+ handleReopenFailure(state);
1092
+ }
1093
+ return state;
1094
+ });
1095
+ }
1096
+ return reopenAfterExpiry().then(state => {
1097
+ if (state === null || state === void 0 ? void 0 : state.sessionID) {
1098
+ scheduleRetry(state.sessionID);
1099
+ }
1100
+ else {
1101
+ handleReopenFailure(state);
1102
+ }
1103
+ return state;
1104
+ });
1105
+ };
1052
1106
  const changeTag = async (memoriId, sessionId, tag, pin) => {
1053
- var _a, _b, _c, _d, _f, _g, _h, _j, _k;
1107
+ var _a, _b, _c, _d, _f, _g, _h;
1054
1108
  if (!memoriId || !sessionId) {
1055
- console.error('CHANGETAG/Session not found');
1056
1109
  return Promise.reject('Session not found');
1057
1110
  }
1058
1111
  try {
@@ -1084,7 +1137,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1084
1137
  }
1085
1138
  }
1086
1139
  else if ([400, 401, 403, 404, 500].includes(resultCode)) {
1087
- console.warn('[APPCONTEXT/CHANGETAG]', resultCode);
1088
1140
  let storageBirthDate = getLocalConfig('birthDate', undefined);
1089
1141
  let referral;
1090
1142
  try {
@@ -1092,8 +1144,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1092
1144
  return window.location.href;
1093
1145
  })();
1094
1146
  }
1095
- catch (err) {
1096
- console.debug(err);
1147
+ catch (_j) {
1097
1148
  }
1098
1149
  fetchSession({
1099
1150
  memoriID: (_b = memori.engineMemoriID) !== null && _b !== void 0 ? _b : '',
@@ -1110,8 +1161,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1110
1161
  birthDate: birthDate || storageBirthDate || undefined,
1111
1162
  additionalInfo: {
1112
1163
  ...(additionalInfo || {}),
1113
- loginToken: (_g = (_f = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _f !== void 0 ? _f : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _g !== void 0 ? _g : authToken,
1114
- language: ((_k = userLang !== null && userLang !== void 0 ? userLang : (_j = (_h = memori.culture) === null || _h === void 0 ? void 0 : _h.split('-')) === null || _j === void 0 ? void 0 : _j[0]) !== null && _k !== void 0 ? _k : 'IT').toLowerCase(),
1164
+ loginToken: resolveLoginToken(),
1165
+ language: ((_h = userLang !== null && userLang !== void 0 ? userLang : (_g = (_f = memori.culture) === null || _f === void 0 ? void 0 : _f.split('-')) === null || _g === void 0 ? void 0 : _g[0]) !== null && _h !== void 0 ? _h : 'IT').toLowerCase(),
1115
1166
  referral: referral,
1116
1167
  timeZoneOffset: new Date().getTimezoneOffset().toString(),
1117
1168
  },
@@ -1128,7 +1179,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1128
1179
  }
1129
1180
  catch (_e) {
1130
1181
  let err = _e;
1131
- console.warn('[APPCONTEXT/CHANGETAG]', err);
1132
1182
  return Promise.reject(err);
1133
1183
  }
1134
1184
  return null;
@@ -1149,6 +1199,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1149
1199
  return () => {
1150
1200
  setHasUserActivatedSpeak(false);
1151
1201
  setClickedStart(false);
1202
+ sessionStartingRef.current = false;
1152
1203
  clearInteractionTimeout();
1153
1204
  timeoutRef.current = undefined;
1154
1205
  };
@@ -1171,35 +1222,34 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1171
1222
  language: getCultureCodeByLanguage(userLang),
1172
1223
  tenant: tenantID,
1173
1224
  }), [ttsProvider, userLang]);
1225
+ const resolvedDefaultSpeakerActive = (_x = defaultSpeakerActive !== null && defaultSpeakerActive !== void 0 ? defaultSpeakerActive : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.defaultSpeakerActive) !== null && _x !== void 0 ? _x : true;
1174
1226
  const { speak: ttsSpeak, stop: ttsStop, isPlaying: isPlayingAudio, speakerMuted, toggleMute, hasUserActivatedSpeak, setHasUserActivatedSpeak, } = useTTS(ttsConfig, {
1175
1227
  apiUrl: `${baseUrl}/api/tts`,
1176
1228
  continuousSpeech: continuousSpeech,
1177
1229
  preview: preview,
1178
- }, autoStart, defaultEnableAudio, (_v = defaultSpeakerActive !== null && defaultSpeakerActive !== void 0 ? defaultSpeakerActive : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.defaultSpeakerActive) !== null && _v !== void 0 ? _v : true);
1179
- const shouldPlayAudio = (text) => {
1180
- const currentSpeakerMuted = getLocalConfig('muteSpeaker', !defaultEnableAudio);
1181
- console.log('[MemoriWidget] shouldPlayAudio', currentSpeakerMuted);
1182
- return (text &&
1183
- text.trim() &&
1184
- !preview &&
1185
- !currentSpeakerMuted &&
1186
- defaultEnableAudio);
1187
- };
1230
+ }, autoStart, defaultEnableAudio, resolvedDefaultSpeakerActive);
1231
+ const muteSpeakerFallback = getMuteSpeakerFallback(defaultEnableAudio, resolvedDefaultSpeakerActive, autoStart);
1232
+ const shouldPlayAudio = (text) => shouldPlayTtsAudio({
1233
+ text,
1234
+ preview,
1235
+ defaultEnableAudio,
1236
+ defaultSpeakerActive: resolvedDefaultSpeakerActive,
1237
+ autoStart,
1238
+ speakerMuted,
1239
+ storedMute: getLocalConfig('muteSpeaker', muteSpeakerFallback),
1240
+ });
1188
1241
  const processSpeechAndSendMessage = (text) => {
1189
1242
  if (!text || text.trim().length === 0) {
1190
1243
  return;
1191
1244
  }
1192
1245
  try {
1193
1246
  const message = stripDuplicates(text);
1194
- console.debug('Processing speech message:', message);
1195
1247
  if (message.length > 0) {
1196
1248
  setUserMessage('');
1197
- console.debug('Sending message:', message);
1198
1249
  sendMessage(message);
1199
1250
  }
1200
1251
  }
1201
- catch (error) {
1202
- console.error('Error in processSpeechAndSendMessage:', error);
1252
+ catch (_a) {
1203
1253
  }
1204
1254
  };
1205
1255
  const { isListening, startRecording, stopRecording, } = useSTT(sttConfig, processSpeechAndSendMessage, {
@@ -1233,8 +1283,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1233
1283
  }
1234
1284
  return translatedState;
1235
1285
  }
1236
- catch (error) {
1237
- console.error('Error in translateAndSpeak:', error);
1286
+ catch (_a) {
1238
1287
  if (!hasUserActivatedSpeak) {
1239
1288
  setHasUserActivatedSpeak(true);
1240
1289
  }
@@ -1247,6 +1296,221 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1247
1296
  setHasUserActivatedSpeak,
1248
1297
  speakerMuted,
1249
1298
  ]);
1299
+ const processEnterTextDialogResponse = useCallback((event, pending) => {
1300
+ var _a, _b;
1301
+ const { msg, typingText: pendingTypingText, useLoaderTextAsMsg, } = pending;
1302
+ const currentState = event.currentState;
1303
+ if (event.resultCode !== 0 || !currentState) {
1304
+ if (isSessionExpiredNatsResponse(event) && pending.text) {
1305
+ setMemoriTyping(false);
1306
+ setTypingText(undefined);
1307
+ retryAfterExpiredSessionRef.current({
1308
+ text: pending.text,
1309
+ media: pending.media,
1310
+ translate: pending.translate,
1311
+ translatedText: pending.translatedText,
1312
+ hidden: pending.hidden,
1313
+ typingText: pending.typingText,
1314
+ useLoaderTextAsMsg: pending.useLoaderTextAsMsg,
1315
+ hasBatchQueued: pending.hasBatchQueued,
1316
+ expiredSessionID: sessionId,
1317
+ continueFromChatLogID: chatLogID,
1318
+ });
1319
+ return;
1320
+ }
1321
+ if (event.resultCode === 500 && event.resultMessage) {
1322
+ setHistory(h => [
1323
+ ...h,
1324
+ {
1325
+ text: 'Error: ' + event.resultMessage,
1326
+ emitter: 'system',
1327
+ fromUser: false,
1328
+ initial: false,
1329
+ contextVars: {},
1330
+ date: new Date().toISOString(),
1331
+ },
1332
+ ]);
1333
+ }
1334
+ return;
1335
+ }
1336
+ if (!msg) {
1337
+ return;
1338
+ }
1339
+ setChatLogID(undefined);
1340
+ const emission = useLoaderTextAsMsg && pendingTypingText
1341
+ ? pendingTypingText
1342
+ : (_a = currentState.emission) !== null && _a !== void 0 ? _a : currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission;
1343
+ if (userLang.toLowerCase() !== language.toLowerCase() &&
1344
+ emission &&
1345
+ isMultilanguageEnabled) {
1346
+ currentState.emission = emission;
1347
+ translateDialogState(currentState, userLang, msg).then(ts => {
1348
+ const text = ts.translatedEmission || ts.emission;
1349
+ if (text && shouldPlayAudio(text)) {
1350
+ handleSpeak(text);
1351
+ }
1352
+ });
1353
+ }
1354
+ else {
1355
+ setCurrentDialogState({
1356
+ ...currentState,
1357
+ emission,
1358
+ });
1359
+ if (emission) {
1360
+ pushMessage({
1361
+ text: emission,
1362
+ emitter: currentState.emitter,
1363
+ media: (_b = currentState.emittedMedia) !== null && _b !== void 0 ? _b : currentState.media,
1364
+ llmUsage: currentState.llmUsage,
1365
+ fromUser: false,
1366
+ questionAnswered: msg,
1367
+ generatedByAI: !!currentState.completion,
1368
+ contextVars: currentState.contextVars,
1369
+ date: currentState.currentDate,
1370
+ placeName: currentState.currentPlaceName,
1371
+ placeLatitude: currentState.currentLatitude,
1372
+ placeLongitude: currentState.currentLongitude,
1373
+ placeUncertaintyKm: currentState.currentUncertaintyKm,
1374
+ tag: currentState.currentTag,
1375
+ memoryTags: currentState.memoryTags,
1376
+ });
1377
+ if (emission && shouldPlayAudio(emission)) {
1378
+ handleSpeak(emission);
1379
+ }
1380
+ }
1381
+ }
1382
+ }, [
1383
+ userLang,
1384
+ language,
1385
+ isMultilanguageEnabled,
1386
+ currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission,
1387
+ translateDialogState,
1388
+ handleSpeak,
1389
+ shouldPlayAudio,
1390
+ ]);
1391
+ const clearEnterTextPending = useCallback((correlationID, pending) => {
1392
+ var _a;
1393
+ if ((_a = pending.waitForResponse) === null || _a === void 0 ? void 0 : _a.timeoutId) {
1394
+ clearTimeout(pending.waitForResponse.timeoutId);
1395
+ }
1396
+ pendingEnterTextRef.current.delete(correlationID);
1397
+ }, []);
1398
+ const deliverEnterTextNatsError = useCallback((event) => {
1399
+ var _a, _b, _c;
1400
+ const correlationID = event.correlationID;
1401
+ let pending;
1402
+ if (correlationID) {
1403
+ pending = pendingEnterTextRef.current.get(correlationID);
1404
+ if (pending) {
1405
+ clearEnterTextPending(correlationID, pending);
1406
+ (_a = pending.waitForResponse) === null || _a === void 0 ? void 0 : _a.reject(new Error((_b = event.errorMessage) !== null && _b !== void 0 ? _b : String((_c = event.errorCode) !== null && _c !== void 0 ? _c : 'NATS error')));
1407
+ }
1408
+ }
1409
+ if (isSessionExpiredNatsError(event) && (pending === null || pending === void 0 ? void 0 : pending.text)) {
1410
+ setMemoriTyping(false);
1411
+ setTypingText(undefined);
1412
+ retryAfterExpiredSessionRef.current({
1413
+ text: pending.text,
1414
+ media: pending.media,
1415
+ translate: pending.translate,
1416
+ translatedText: pending.translatedText,
1417
+ hidden: pending.hidden,
1418
+ typingText: pending.typingText,
1419
+ useLoaderTextAsMsg: pending.useLoaderTextAsMsg,
1420
+ hasBatchQueued: pending.hasBatchQueued,
1421
+ expiredSessionID: sessionId,
1422
+ continueFromChatLogID: chatLogID,
1423
+ });
1424
+ return;
1425
+ }
1426
+ const errorText = event.errorMessage
1427
+ ? `Error: ${event.errorMessage}`
1428
+ : event.errorCode
1429
+ ? `Error: ${event.errorCode}`
1430
+ : 'Error: An unexpected error occurred';
1431
+ pushMessage({
1432
+ text: errorText,
1433
+ emitter: 'system',
1434
+ fromUser: false,
1435
+ initial: false,
1436
+ contextVars: {},
1437
+ date: new Date().toISOString(),
1438
+ });
1439
+ setMemoriTyping(false);
1440
+ setTypingText(undefined);
1441
+ }, [clearEnterTextPending]);
1442
+ const deliverEnterTextNatsResponse = useCallback((correlationID, event) => {
1443
+ const pending = pendingEnterTextRef.current.get(correlationID);
1444
+ if (!pending) {
1445
+ bufferedNatsResponsesRef.current.set(correlationID, event);
1446
+ return;
1447
+ }
1448
+ clearEnterTextPending(correlationID, pending);
1449
+ if (pending.waitForResponse) {
1450
+ pending.waitForResponse.resolve(event);
1451
+ setMemoriTyping(false);
1452
+ setTypingText(undefined);
1453
+ return;
1454
+ }
1455
+ processEnterTextDialogResponse(event, pending);
1456
+ if (!pending.hasBatchQueued) {
1457
+ setMemoriTyping(false);
1458
+ setTypingText(undefined);
1459
+ }
1460
+ }, [processEnterTextDialogResponse, clearEnterTextPending]);
1461
+ const registerPendingEnterText = useCallback((correlationID, pending) => {
1462
+ const buffered = bufferedNatsResponsesRef.current.get(correlationID);
1463
+ if (buffered) {
1464
+ bufferedNatsResponsesRef.current.delete(correlationID);
1465
+ pendingEnterTextRef.current.set(correlationID, pending);
1466
+ deliverEnterTextNatsResponse(correlationID, buffered);
1467
+ return;
1468
+ }
1469
+ pendingEnterTextRef.current.set(correlationID, pending);
1470
+ }, [deliverEnterTextNatsResponse]);
1471
+ const waitForEnterTextNatsResponse = useCallback((correlationID, timeoutMs = 120000) => new Promise((resolve, reject) => {
1472
+ const timeoutId = setTimeout(() => {
1473
+ const current = pendingEnterTextRef.current.get(correlationID);
1474
+ if (current) {
1475
+ clearEnterTextPending(correlationID, current);
1476
+ }
1477
+ logWidgetError('NATS timeout', { correlationID, timeoutMs });
1478
+ reject(new Error('NATS enter-text response timeout'));
1479
+ }, timeoutMs);
1480
+ registerPendingEnterText(correlationID, {
1481
+ waitForResponse: {
1482
+ resolve: event => {
1483
+ clearTimeout(timeoutId);
1484
+ resolve(event);
1485
+ },
1486
+ reject: error => {
1487
+ clearTimeout(timeoutId);
1488
+ reject(error);
1489
+ },
1490
+ timeoutId,
1491
+ },
1492
+ });
1493
+ }), [registerPendingEnterText, clearEnterTextPending]);
1494
+ useNats({
1495
+ baseUrl,
1496
+ sessionId,
1497
+ onProgress: useCallback((event) => {
1498
+ if (event.message) {
1499
+ setTypingText(event.message);
1500
+ }
1501
+ }, []),
1502
+ onDialogResponse: useCallback((event) => {
1503
+ const correlationID = event.correlationID;
1504
+ if (!correlationID) {
1505
+ logWidgetError('NATS dialog response missing correlationID', event);
1506
+ setMemoriTyping(false);
1507
+ setTypingText(undefined);
1508
+ return;
1509
+ }
1510
+ deliverEnterTextNatsResponse(correlationID, event);
1511
+ }, [deliverEnterTextNatsResponse]),
1512
+ onError: deliverEnterTextNatsError,
1513
+ });
1250
1514
  const focusChatInput = () => {
1251
1515
  let textarea = document.querySelector('#chat-fieldset textarea');
1252
1516
  if (textarea && enableFocusChatInput) {
@@ -1268,7 +1532,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1268
1532
  timeoutRef.current = undefined;
1269
1533
  ttsStop();
1270
1534
  }
1271
- catch (e) {
1535
+ catch (_a) {
1272
1536
  }
1273
1537
  };
1274
1538
  useEffect(() => {
@@ -1306,9 +1570,6 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1306
1570
  }, []);
1307
1571
  const [attachmentsMenuOpen, setAttachmentsMenuOpen] = useState();
1308
1572
  const globalBackground = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.globalBackground;
1309
- const globalBackgroundUrl = globalBackground
1310
- ? `url(${globalBackground})`
1311
- : null;
1312
1573
  const integrationProperties = (integration ? getChatStyles(integrationConfig) : {});
1313
1574
  const integrationSelectors = [
1314
1575
  preview ? '#preview' : null,
@@ -1339,8 +1600,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1339
1600
  ${integrationCssBlock}
1340
1601
  }`);
1341
1602
  }
1342
- if (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.blurBackground) {
1343
- integrationStylesheetParts.push('.memori-widget .memori--global-background { filter: blur(5px); }');
1603
+ if ((integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.blurBackground) === false) {
1604
+ integrationStylesheetParts.push(`.memori-widget .memori-chat--history--has-global-background::before,
1605
+ .memori-widget .memori-chat-layout--main--has-background::before {
1606
+ filter: none;
1607
+ transform: none;
1608
+ }`);
1344
1609
  }
1345
1610
  const integrationStylesheet = `@layer integration {
1346
1611
  ${integrationStylesheetParts.join('\n ')}
@@ -1431,7 +1696,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1431
1696
  };
1432
1697
  }, [sessionId, userLang, disableTextEnteredEvents]);
1433
1698
  const onClickStart = useCallback(async (session, initialSessionExpired = false, chatLog, targetSessionID) => {
1434
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
1699
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1435
1700
  const sessionID = chatLog ? undefined : (session === null || session === void 0 ? void 0 : session.sessionID) || sessionId;
1436
1701
  const dialogState = chatLog
1437
1702
  ? undefined
@@ -1448,9 +1713,15 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1448
1713
  setPositionPopoverOpenState(true);
1449
1714
  return;
1450
1715
  }
1716
+ if (!(await checkCredits({ notify: true }))) {
1717
+ setClickedStart(false);
1718
+ setLoading(false);
1719
+ return;
1720
+ }
1451
1721
  if (!sessionID && !!minAge && !birth) {
1452
1722
  setShowAgeVerification(true);
1453
1723
  setClickedStart(false);
1724
+ return;
1454
1725
  }
1455
1726
  else if ((!sessionID &&
1456
1727
  memori.privacyType !== 'PUBLIC' &&
@@ -1463,83 +1734,95 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1463
1734
  return;
1464
1735
  }
1465
1736
  else if (!sessionID || initialSessionExpired) {
1466
- setClickedStart(false);
1467
1737
  setGotErrorInOpening(false);
1468
- const session = await fetchSession({
1469
- memoriID: memori.engineMemoriID,
1470
- password: secret || memoriPwd || memori.secretToken,
1471
- tag: personification === null || personification === void 0 ? void 0 : personification.tag,
1472
- pin: personification === null || personification === void 0 ? void 0 : personification.pin,
1473
- continueFromChatLogID: chatLog === null || chatLog === void 0 ? void 0 : chatLog.chatLogID,
1474
- initialContextVars: {
1475
- LANG: userLang,
1476
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
1477
- ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
1478
- ...((!chatLog
1479
- ? initialContextVars
1480
- : chatLog.lines[chatLog.lines.length - 1].contextVars) || {}),
1481
- },
1482
- initialQuestion: chatLog ? undefined : initialQuestion,
1483
- birthDate: birth,
1484
- additionalInfo: {
1485
- ...(additionalInfo || {}),
1486
- loginToken: (_g = (_f = userToken !== null && userToken !== void 0 ? userToken : loginToken) !== null && _f !== void 0 ? _f : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _g !== void 0 ? _g : authToken,
1487
- language: ((_k = userLang !== null && userLang !== void 0 ? userLang : (_j = (_h = memori.culture) === null || _h === void 0 ? void 0 : _h.split('-')) === null || _j === void 0 ? void 0 : _j[0]) !== null && _k !== void 0 ? _k : 'IT').toLowerCase(),
1488
- timeZoneOffset: new Date().getTimezoneOffset().toString(),
1489
- },
1490
- });
1491
- if (session === null || session === void 0 ? void 0 : session.dialogState) {
1492
- if (!chatLog) {
1493
- setHistory([]);
1494
- await translateAndSpeak(session.dialogState, userLang);
1495
- setHasUserActivatedSpeak(true);
1496
- }
1497
- else {
1498
- const messages = chatLog.lines.map((l, i) => {
1499
- var _a, _b;
1500
- return ({
1501
- text: l.text,
1502
- media: (_b = (_a = l.media) === null || _a === void 0 ? void 0 : _a.filter(m => allowedMediaTypes.includes(m.mimeType))) === null || _b === void 0 ? void 0 : _b.map(m => ({
1503
- mediumID: `${i}-${m.mimeType}`,
1504
- ...m,
1505
- })),
1506
- fromUser: l.inbound,
1507
- llmUsage: l.llmUsage,
1508
- timestamp: l.timestamp,
1509
- emitter: l.emitter,
1510
- initial: i === 0,
1511
- });
1512
- });
1513
- translatedMessages = messages !== null && messages !== void 0 ? messages : [];
1514
- if (language.toUpperCase() !== userLang.toUpperCase() &&
1515
- isMultilanguageEnabled) {
1516
- try {
1517
- translatedMessages = await Promise.all(messages.map(async (m) => {
1518
- if ('originalText' in m && m.originalText) {
1519
- return m;
1520
- }
1521
- return {
1738
+ if (sessionStartingRef.current) {
1739
+ return;
1740
+ }
1741
+ sessionStartingRef.current = true;
1742
+ try {
1743
+ const session = await fetchSession({
1744
+ memoriID: memori.engineMemoriID,
1745
+ password: secret || memoriPwd || memori.secretToken,
1746
+ tag: personification === null || personification === void 0 ? void 0 : personification.tag,
1747
+ pin: personification === null || personification === void 0 ? void 0 : personification.pin,
1748
+ continueFromChatLogID: chatLog === null || chatLog === void 0 ? void 0 : chatLog.chatLogID,
1749
+ initialContextVars: {
1750
+ LANG: userLang,
1751
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
1752
+ ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) ||
1753
+ '',
1754
+ ...((!chatLog
1755
+ ? initialContextVars
1756
+ : chatLog.lines[chatLog.lines.length - 1].contextVars) || {}),
1757
+ },
1758
+ initialQuestion: chatLog ? undefined : initialQuestion,
1759
+ birthDate: birth,
1760
+ additionalInfo: {
1761
+ ...(additionalInfo || {}),
1762
+ loginToken: resolveLoginToken(),
1763
+ language: ((_h = userLang !== null && userLang !== void 0 ? userLang : (_g = (_f = memori.culture) === null || _f === void 0 ? void 0 : _f.split('-')) === null || _g === void 0 ? void 0 : _g[0]) !== null && _h !== void 0 ? _h : 'IT').toLowerCase(),
1764
+ timeZoneOffset: new Date().getTimezoneOffset().toString(),
1765
+ },
1766
+ });
1767
+ if (session === null || session === void 0 ? void 0 : session.dialogState) {
1768
+ if (!chatLog) {
1769
+ setHistory([]);
1770
+ await translateAndSpeak(session.dialogState, userLang);
1771
+ setHasUserActivatedSpeak(true);
1772
+ setClickedStart(false);
1773
+ }
1774
+ else {
1775
+ const messages = chatLog.lines.map((l, i) => {
1776
+ var _a, _b;
1777
+ return ({
1778
+ text: l.text,
1779
+ media: (_b = (_a = l.media) === null || _a === void 0 ? void 0 : _a.filter(m => allowedMediaTypes.includes(m.mimeType))) === null || _b === void 0 ? void 0 : _b.map(m => ({
1780
+ mediumID: `${i}-${m.mimeType}`,
1522
1781
  ...m,
1523
- originalText: m.text,
1524
- text: (await getTranslation(m.text, userLang, language, baseUrl)).text,
1525
- };
1526
- }));
1527
- }
1528
- catch (e) {
1529
- console.error('[onClickStart] Error translating messages:', e);
1782
+ })),
1783
+ fromUser: l.inbound,
1784
+ llmUsage: l.llmUsage,
1785
+ timestamp: l.timestamp,
1786
+ emitter: l.emitter,
1787
+ initial: i === 0,
1788
+ });
1789
+ });
1790
+ translatedMessages = messages !== null && messages !== void 0 ? messages : [];
1791
+ if (language.toUpperCase() !== userLang.toUpperCase() &&
1792
+ isMultilanguageEnabled) {
1793
+ try {
1794
+ translatedMessages = await Promise.all(messages.map(async (m) => {
1795
+ if ('originalText' in m && m.originalText) {
1796
+ return m;
1797
+ }
1798
+ return {
1799
+ ...m,
1800
+ originalText: m.text,
1801
+ text: (await getTranslation(m.text, userLang, language, baseUrl)).text,
1802
+ };
1803
+ }));
1804
+ }
1805
+ catch (_u) {
1806
+ }
1530
1807
  }
1808
+ setHistory(translatedMessages);
1809
+ translateDialogState(session.dialogState, userLang, undefined, true).finally(() => {
1810
+ setHasUserActivatedSpeak(true);
1811
+ setClickedStart(false);
1812
+ });
1531
1813
  }
1532
- setHistory(translatedMessages);
1533
- translateDialogState(session.dialogState, userLang, undefined, true).finally(() => {
1534
- setHasUserActivatedSpeak(true);
1535
- });
1814
+ }
1815
+ else if ((session === null || session === void 0 ? void 0 : session.resultCode) === 0) {
1816
+ sessionStartingRef.current = false;
1817
+ await onClickStart(session || undefined);
1818
+ }
1819
+ else {
1820
+ setLoading(false);
1821
+ setClickedStart(false);
1536
1822
  }
1537
1823
  }
1538
- else if ((session === null || session === void 0 ? void 0 : session.resultCode) === 0) {
1539
- await onClickStart(session || undefined);
1540
- }
1541
- else {
1542
- setLoading(false);
1824
+ finally {
1825
+ sessionStartingRef.current = false;
1543
1826
  }
1544
1827
  return;
1545
1828
  }
@@ -1548,9 +1831,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1548
1831
  const { currentState, ...response } = await getSession(sessionID);
1549
1832
  if (response.resultCode !== 0 || !currentState) {
1550
1833
  const { chatLogs } = await getSessionChatLogs(sessionID, sessionID);
1551
- setGotErrorInOpening(true);
1552
1834
  setSessionId(undefined);
1553
- setClickedStart(false);
1554
1835
  await onClickStart(undefined, true, chatLogs === null || chatLogs === void 0 ? void 0 : chatLogs[0]);
1555
1836
  return;
1556
1837
  }
@@ -1562,21 +1843,22 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1562
1843
  const session = await changeTag(memori.engineMemoriID, sessionID, personification.tag, personification.pin);
1563
1844
  if (session && session.resultCode === 0) {
1564
1845
  await translateAndSpeak(session.currentState, userLang);
1846
+ setClickedStart(false);
1565
1847
  }
1566
1848
  else {
1567
1849
  throw new Error('No session');
1568
1850
  }
1569
1851
  }
1570
- catch (e) {
1571
- console.error('[onClickStart] Error changing tag:', e);
1852
+ catch (_v) {
1572
1853
  reopenSession(true, memori === null || memori === void 0 ? void 0 : memori.secretToken, undefined, personification.tag, personification.pin, {
1573
1854
  LANG: userLang,
1574
- PATHNAME: (_l = window.location.pathname) === null || _l === void 0 ? void 0 : _l.toUpperCase(),
1575
- ROUTE: ((_p = (_o = (_m = window.location.pathname) === null || _m === void 0 ? void 0 : _m.split('/')) === null || _o === void 0 ? void 0 : _o.pop()) === null || _p === void 0 ? void 0 : _p.toUpperCase()) ||
1855
+ PATHNAME: (_j = window.location.pathname) === null || _j === void 0 ? void 0 : _j.toUpperCase(),
1856
+ ROUTE: ((_m = (_l = (_k = window.location.pathname) === null || _k === void 0 ? void 0 : _k.split('/')) === null || _l === void 0 ? void 0 : _l.pop()) === null || _m === void 0 ? void 0 : _m.toUpperCase()) ||
1576
1857
  '',
1577
1858
  ...(initialContextVars || {}),
1578
1859
  }, initialQuestion, birth).then(() => {
1579
1860
  setHasUserActivatedSpeak(true);
1861
+ setClickedStart(false);
1580
1862
  });
1581
1863
  }
1582
1864
  }
@@ -1589,6 +1871,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1589
1871
  const session = await changeTag(memori.engineMemoriID, sessionID, anonTag);
1590
1872
  if (session && session.resultCode === 0) {
1591
1873
  await translateAndSpeak(session.currentState, userLang);
1874
+ setClickedStart(false);
1592
1875
  }
1593
1876
  else {
1594
1877
  throw new Error('No session');
@@ -1597,19 +1880,20 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1597
1880
  catch (e) {
1598
1881
  reopenSession(true, memori === null || memori === void 0 ? void 0 : memori.secretToken, undefined, undefined, undefined, {
1599
1882
  LANG: userLang,
1600
- PATHNAME: (_q = window.location.pathname) === null || _q === void 0 ? void 0 : _q.toUpperCase(),
1601
- ROUTE: ((_t = (_s = (_r = window.location.pathname) === null || _r === void 0 ? void 0 : _r.split('/')) === null || _s === void 0 ? void 0 : _s.pop()) === null || _t === void 0 ? void 0 : _t.toUpperCase()) ||
1883
+ PATHNAME: (_o = window.location.pathname) === null || _o === void 0 ? void 0 : _o.toUpperCase(),
1884
+ ROUTE: ((_r = (_q = (_p = window.location.pathname) === null || _p === void 0 ? void 0 : _p.split('/')) === null || _q === void 0 ? void 0 : _q.pop()) === null || _r === void 0 ? void 0 : _r.toUpperCase()) ||
1602
1885
  '',
1603
1886
  ...(initialContextVars || {}),
1604
1887
  }, initialQuestion, birth).then(() => {
1605
1888
  setHasUserActivatedSpeak(true);
1889
+ setClickedStart(false);
1606
1890
  });
1607
1891
  }
1608
1892
  }
1609
1893
  else {
1610
1894
  try {
1611
1895
  const { chatLogs } = await getSessionChatLogs(sessionID, sessionID);
1612
- const messages = (_u = chatLogs === null || chatLogs === void 0 ? void 0 : chatLogs[0]) === null || _u === void 0 ? void 0 : _u.lines.map((l, i) => {
1896
+ const messages = (_s = chatLogs === null || chatLogs === void 0 ? void 0 : chatLogs[0]) === null || _s === void 0 ? void 0 : _s.lines.map((l, i) => {
1613
1897
  var _a, _b;
1614
1898
  return ({
1615
1899
  text: l.text,
@@ -1634,31 +1918,28 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1634
1918
  text: (await getTranslation(m.text, userLang, language, baseUrl)).text,
1635
1919
  })));
1636
1920
  }
1637
- catch (e) {
1638
- console.error('[onClickStart] Error translating messages:', e);
1921
+ catch (_w) {
1639
1922
  }
1640
1923
  }
1641
1924
  setHistory(translatedMessages);
1642
1925
  }
1643
- catch (e) {
1644
- console.error('[onClickStart] Error retrieving chat logs:', e);
1926
+ catch (_x) {
1645
1927
  }
1646
1928
  if ((!!(translatedMessages === null || translatedMessages === void 0 ? void 0 : translatedMessages.length) && translatedMessages.length > 1) ||
1647
1929
  !initialQuestion) {
1648
1930
  setHasUserActivatedSpeak(true);
1931
+ setClickedStart(false);
1649
1932
  await translateAndSpeak(currentState, userLang, undefined, !!(translatedMessages === null || translatedMessages === void 0 ? void 0 : translatedMessages.length));
1650
1933
  }
1651
1934
  else {
1652
- console.log('[onClickStart] Starting with initial question');
1653
1935
  translatedMessages = [];
1654
1936
  setHistory([]);
1655
- setMemoriTyping(true);
1656
1937
  const placeSpec = getPlaceSpecForEnterText(position);
1657
- const response = await postTextEnteredEvent({
1938
+ const response = await postEnterTextAsync({
1658
1939
  sessionId: sessionID,
1659
1940
  text: initialQuestion,
1660
1941
  ...(memori.needsDateTime && {
1661
- dateUTC: (_v = DateTime.utc().toISO()) !== null && _v !== void 0 ? _v : undefined,
1942
+ dateUTC: (_t = DateTime.utc().toISO()) !== null && _t !== void 0 ? _t : undefined,
1662
1943
  }),
1663
1944
  ...(placeSpec !== undefined && { place: placeSpec }),
1664
1945
  });
@@ -1674,51 +1955,99 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1674
1955
  date: new Date().toISOString(),
1675
1956
  },
1676
1957
  ]);
1677
- setMemoriTyping(false);
1678
1958
  return;
1679
1959
  }
1680
- await translateAndSpeak((_w = response.currentState) !== null && _w !== void 0 ? _w : currentState, userLang, undefined, false);
1960
+ const onClickStartCorrelationID = readCorrelationID(response);
1961
+ if (response.resultCode === 0 && onClickStartCorrelationID) {
1962
+ setMemoriTyping(true);
1963
+ try {
1964
+ const natsEvent = await waitForEnterTextNatsResponse(onClickStartCorrelationID);
1965
+ if (natsEvent.resultCode === 0 && natsEvent.currentState) {
1966
+ await translateAndSpeak(natsEvent.currentState, userLang, undefined, false);
1967
+ setClickedStart(false);
1968
+ }
1969
+ }
1970
+ catch (err) {
1971
+ logWidgetError('onClickStart NATS wait failed', err);
1972
+ setMemoriTyping(false);
1973
+ setTypingText(undefined);
1974
+ }
1975
+ }
1976
+ else if (response.resultCode === 0) {
1977
+ logWidgetError('onClickStart enter-text missing correlationID', response);
1978
+ }
1681
1979
  }
1682
1980
  }
1683
1981
  }
1684
1982
  else {
1685
1983
  setHistory([]);
1686
1984
  await translateAndSpeak(dialogState, userLang);
1985
+ setClickedStart(false);
1687
1986
  }
1688
1987
  }, [memoriPwd, memori, memoriTokens, birthDate, sessionId, userLang, position]);
1689
1988
  const setPositionPopoverOpen = useCallback((open) => {
1690
- setPositionPopoverOpenState(open);
1691
- if (!open && autoStart) {
1692
- onClickStart();
1693
- }
1694
- }, [autoStart, onClickStart]);
1989
+ const sessionAlreadyStarted = !!(sessionId && hasUserActivatedSpeak);
1990
+ setPositionPopoverOpenState(wasOpen => {
1991
+ if (shouldRestartSessionOnPositionPopoverClose(wasOpen, open, autoStart, sessionAlreadyStarted)) {
1992
+ queueMicrotask(() => {
1993
+ onClickStart();
1994
+ });
1995
+ }
1996
+ if (!open) {
1997
+ queueMicrotask(() => {
1998
+ setAutoStartPositionGeolocation(false);
1999
+ });
2000
+ }
2001
+ return open;
2002
+ });
2003
+ }, [autoStart, onClickStart, sessionId, hasUserActivatedSpeak]);
1695
2004
  useEffect(() => {
1696
- if (!clickedStart && autoStart && selectedLayout !== 'HIDDEN_CHAT') {
2005
+ if (!clickedStart &&
2006
+ !sessionStartingRef.current &&
2007
+ !sessionId &&
2008
+ autoStart &&
2009
+ selectedLayout !== 'HIDDEN_CHAT' &&
2010
+ (!needsCredits || hasEnoughCredits)) {
1697
2011
  onClickStart();
1698
2012
  }
1699
- }, [clickedStart, autoStart, selectedLayout]);
2013
+ }, [
2014
+ clickedStart,
2015
+ autoStart,
2016
+ selectedLayout,
2017
+ sessionId,
2018
+ needsCredits,
2019
+ hasEnoughCredits,
2020
+ ]);
1700
2021
  useEffect(() => {
2022
+ var _a;
1701
2023
  const targetNode = document.querySelector(`memori-client[memoriname="${memori.name}"]`) ||
1702
2024
  document.querySelector(`memori-client[memoriid="${memori.memoriID}"]`) ||
1703
2025
  document.querySelector('memori-client');
1704
2026
  if (!targetNode) {
1705
2027
  return;
1706
2028
  }
2029
+ const propsToken = (_a = additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _a !== void 0 ? _a : authToken;
2030
+ const initialDomToken = targetNode.getAttribute('authtoken') || undefined;
2031
+ if (initialDomToken && !propsToken) {
2032
+ setLoginToken(initialDomToken);
2033
+ userTokenRef.current = initialDomToken;
2034
+ }
2035
+ const applyAuthTokenFromElement = (element) => {
2036
+ var _a;
2037
+ const clientNode = element.nodeName === 'MEMORI-CLIENT'
2038
+ ? element
2039
+ : (_a = element.closest('memori-client')) !== null && _a !== void 0 ? _a : element.parentElement;
2040
+ const token = (clientNode === null || clientNode === void 0 ? void 0 : clientNode.getAttribute('authtoken')) || undefined;
2041
+ setLoginToken(token);
2042
+ userTokenRef.current = token;
2043
+ };
1707
2044
  const config = { attributes: true, childList: false, subtree: false };
1708
- const callback = (mutationList, _observer) => {
1709
- var _a, _b, _c;
2045
+ const callback = mutationList => {
2046
+ var _a;
1710
2047
  for (const mutation of mutationList) {
1711
2048
  if (mutation.type === 'attributes' &&
1712
2049
  ((_a = mutation.attributeName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'authtoken') {
1713
- if (mutation.target.nodeName === 'MEMORI-CLIENT') {
1714
- setLoginToken(mutation.target.getAttribute('authtoken') || undefined);
1715
- userToken = mutation.target.getAttribute('authtoken') || undefined;
1716
- }
1717
- else {
1718
- setLoginToken(((_c = (_b = mutation.target) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.getAttribute('authtoken')) ||
1719
- undefined);
1720
- userToken = mutation.target.getAttribute('authtoken') || undefined;
1721
- }
2050
+ applyAuthTokenFromElement(mutation.target);
1722
2051
  }
1723
2052
  }
1724
2053
  };
@@ -1727,7 +2056,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1727
2056
  return () => {
1728
2057
  observer.disconnect();
1729
2058
  };
1730
- }, []);
2059
+ }, [memori.name, memori.memoriID, additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken, authToken]);
1731
2060
  const [experts, setExperts] = useState();
1732
2061
  const fetchExperts = useCallback(async () => {
1733
2062
  if (!sessionId || !(memori === null || memori === void 0 ? void 0 : memori.enableBoardOfExperts))
@@ -1737,12 +2066,8 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1737
2066
  if (resp.resultCode === 0) {
1738
2067
  setExperts(experts);
1739
2068
  }
1740
- else {
1741
- console.warn('Error fetching experts', resp);
1742
- }
1743
2069
  }
1744
- catch (err) {
1745
- console.warn(err);
2070
+ catch (_a) {
1746
2071
  }
1747
2072
  }, [sessionId, memori === null || memori === void 0 ? void 0 : memori.enableBoardOfExperts]);
1748
2073
  useEffect(() => {
@@ -1752,11 +2077,26 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1752
2077
  !!loginToken &&
1753
2078
  !!(user === null || user === void 0 ? void 0 : user.userID) &&
1754
2079
  (user === null || user === void 0 ? void 0 : user.pAndCUAccepted);
1755
- const needsCredits = tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation;
1756
- const [hasEnoughCredits, setHasEnoughCredits] = useState(true);
1757
- const checkCredits = useCallback(async () => {
2080
+ const handleNotEnoughCredits = useCallback(() => {
2081
+ setHasEnoughCredits(false);
2082
+ setAuthModalState(null);
2083
+ add(createAlertOptions({
2084
+ description: t('notEnoughCredits'),
2085
+ severity: 'error',
2086
+ }));
2087
+ }, [add, t]);
2088
+ const checkCredits = useCallback(async (options) => {
1758
2089
  if (!(tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation))
1759
- return;
2090
+ return true;
2091
+ if (!ownerUserID && !ownerUserName) {
2092
+ if (options === null || options === void 0 ? void 0 : options.notify) {
2093
+ handleNotEnoughCredits();
2094
+ }
2095
+ else {
2096
+ setHasEnoughCredits(false);
2097
+ }
2098
+ return false;
2099
+ }
1760
2100
  try {
1761
2101
  const resp = await getCredits({
1762
2102
  operation: deepThoughtEnabled
@@ -1769,22 +2109,36 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1769
2109
  });
1770
2110
  if (resp.enough) {
1771
2111
  setHasEnoughCredits(true);
2112
+ return true;
1772
2113
  }
1773
2114
  else {
1774
- setHasEnoughCredits(false);
1775
- console.warn('Not enough credits. Required:', resp.required);
2115
+ if (options === null || options === void 0 ? void 0 : options.notify) {
2116
+ handleNotEnoughCredits();
2117
+ }
2118
+ else {
2119
+ setHasEnoughCredits(false);
2120
+ }
2121
+ return false;
1776
2122
  }
1777
2123
  }
1778
- catch (e) {
1779
- let err = e;
1780
- console.debug(err);
2124
+ catch (err) {
2125
+ logWidgetError('checkCredits failed', err);
2126
+ return true;
1781
2127
  }
1782
- }, [tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation, deepThoughtEnabled]);
2128
+ }, [
2129
+ baseUrl,
2130
+ deepThoughtEnabled,
2131
+ handleNotEnoughCredits,
2132
+ ownerUserID,
2133
+ ownerUserName,
2134
+ tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation,
2135
+ tenantID,
2136
+ ]);
1783
2137
  useEffect(() => {
1784
2138
  if (tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation) {
1785
2139
  checkCredits();
1786
2140
  }
1787
- }, [tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation, deepThoughtEnabled]);
2141
+ }, [tenant === null || tenant === void 0 ? void 0 : tenant.billingDelegation, deepThoughtEnabled, checkCredits]);
1788
2142
  useEffect(() => {
1789
2143
  if (__WEBCOMPONENT__)
1790
2144
  return;
@@ -1803,37 +2157,40 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1803
2157
  ? selectedLayout !== 'TOTEM' && selectedLayout !== 'WEBSITE_ASSISTANT'
1804
2158
  : !showOnlyLastMessages;
1805
2159
  const canShowLoginButton = !(tenant === null || tenant === void 0 ? void 0 : tenant.ssoLogin) &&
1806
- ((_w = showLogin !== null && showLogin !== void 0 ? showLogin : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showLogin) !== null && _w !== void 0 ? _w : memori.requireLoginToken);
2160
+ ((_y = showLogin !== null && showLogin !== void 0 ? showLogin : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showLogin) !== null && _y !== void 0 ? _y : memori.requireLoginToken);
1807
2161
  const headerProps = {
1808
2162
  memori: {
1809
2163
  ...memori,
1810
- ownerUserID: (_y = (_x = memori.ownerUserID) !== null && _x !== void 0 ? _x : ownerUserID) !== null && _y !== void 0 ? _y : undefined,
2164
+ ownerUserID: (_0 = (_z = memori.ownerUserID) !== null && _z !== void 0 ? _z : ownerUserID) !== null && _0 !== void 0 ? _0 : undefined,
1811
2165
  },
1812
2166
  apiClient: client,
1813
2167
  tenant,
1814
2168
  history,
1815
- showShare: (_z = showShare !== null && showShare !== void 0 ? showShare : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showShare) !== null && _z !== void 0 ? _z : true,
2169
+ showShare: (_1 = showShare !== null && showShare !== void 0 ? showShare : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showShare) !== null && _1 !== void 0 ? _1 : true,
1816
2170
  position,
1817
2171
  layout: selectedLayout,
1818
2172
  additionalSettings,
1819
2173
  setVenue: setPosition,
1820
2174
  positionPopoverOpen,
1821
2175
  setPositionPopoverOpen,
2176
+ autoStartPositionGeolocation,
1822
2177
  setShowSettingsDrawer,
1823
2178
  setShowKnownFactsDrawer,
1824
2179
  setShowExpertsDrawer,
1825
- enableAudio: (_0 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _0 !== void 0 ? _0 : true,
2180
+ enableAudio: (_2 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _2 !== void 0 ? _2 : true,
1826
2181
  speakerMuted: speakerMuted !== null && speakerMuted !== void 0 ? speakerMuted : false,
1827
2182
  setSpeakerMuted: (mute) => {
1828
2183
  toggleMute(mute);
1829
2184
  },
1830
2185
  setShowChatHistoryDrawer,
1831
- showSettings: (_1 = showSettings !== null && showSettings !== void 0 ? showSettings : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showSettings) !== null && _1 !== void 0 ? _1 : true,
1832
- showChatHistory: (_2 = showChatHistory !== null && showChatHistory !== void 0 ? showChatHistory : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showChatHistory) !== null && _2 !== void 0 ? _2 : true,
2186
+ showSettings: (_3 = showSettings !== null && showSettings !== void 0 ? showSettings : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showSettings) !== null && _3 !== void 0 ? _3 : true,
2187
+ showChatHistory: selectedLayout === 'WEBSITE_ASSISTANT'
2188
+ ? false
2189
+ : (_4 = showChatHistory !== null && showChatHistory !== void 0 ? showChatHistory : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showChatHistory) !== null && _4 !== void 0 ? _4 : true,
1833
2190
  showMessageConsumption: enableMessageConsumption,
1834
2191
  hasUserActivatedSpeak,
1835
2192
  showReload: selectedLayout === 'TOTEM',
1836
- showClear: (_3 = showClear !== null && showClear !== void 0 ? showClear : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showClear) !== null && _3 !== void 0 ? _3 : false,
2193
+ showClear: (_5 = showClear !== null && showClear !== void 0 ? showClear : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showClear) !== null && _5 !== void 0 ? _5 : false,
1837
2194
  clearHistory: () => setHistory(h => h.slice(-1)),
1838
2195
  showLogin: canShowLoginButton,
1839
2196
  setShowLoginDrawer,
@@ -1848,7 +2205,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1848
2205
  setShowLoginDrawer(false);
1849
2206
  setUser(undefined);
1850
2207
  setLoginToken(undefined);
1851
- userToken = undefined;
2208
+ userTokenRef.current = undefined;
1852
2209
  removeLocalConfig('loginToken');
1853
2210
  });
1854
2211
  },
@@ -1864,7 +2221,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1864
2221
  hasUserActivatedSpeak,
1865
2222
  isPlayingAudio: isPlayingAudio &&
1866
2223
  !speakerMuted &&
1867
- ((_4 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _4 !== void 0 ? _4 : true),
2224
+ ((_6 = enableAudio !== null && enableAudio !== void 0 ? enableAudio : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.enableAudio) !== null && _6 !== void 0 ? _6 : true),
1868
2225
  loading: !!memoriTyping,
1869
2226
  baseUrl,
1870
2227
  apiUrl: client.constants.BACKEND_URL,
@@ -1882,7 +2239,10 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1882
2239
  apiUrl: client.constants.BACKEND_URL,
1883
2240
  position: position,
1884
2241
  setVenue: setPosition,
1885
- openPositionPopover: () => setPositionPopoverOpen(true),
2242
+ openPositionPopover: () => {
2243
+ setAutoStartPositionGeolocation(true);
2244
+ setPositionPopoverOpen(true);
2245
+ },
1886
2246
  integrationConfig: integrationConfig,
1887
2247
  instruct: instruct,
1888
2248
  sessionId: sessionId,
@@ -1894,7 +2254,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1894
2254
  notEnoughCredits: needsCredits && !hasEnoughCredits,
1895
2255
  showLogin: canShowLoginButton,
1896
2256
  setShowLoginDrawer,
1897
- showChatHistory: (_5 = showChatHistory !== null && showChatHistory !== void 0 ? showChatHistory : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showChatHistory) !== null && _5 !== void 0 ? _5 : true,
2257
+ showChatHistory: selectedLayout === 'WEBSITE_ASSISTANT'
2258
+ ? false
2259
+ : (_7 = showChatHistory !== null && showChatHistory !== void 0 ? showChatHistory : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showChatHistory) !== null && _7 !== void 0 ? _7 : true,
1898
2260
  setShowChatHistoryDrawer,
1899
2261
  user,
1900
2262
  };
@@ -1904,7 +2266,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1904
2266
  tenant,
1905
2267
  translateTo: isMultilanguageEnabled &&
1906
2268
  userLang.toUpperCase() !==
1907
- ((_10 = ((_9 = (_8 = (_7 = (_6 = memori.culture) === null || _6 === void 0 ? void 0 : _6.split('-')) === null || _7 === void 0 ? void 0 : _7[0]) !== null && _8 !== void 0 ? _8 : i18n.language) !== null && _9 !== void 0 ? _9 : 'IT')) === null || _10 === void 0 ? void 0 : _10.toUpperCase())
2269
+ ((_12 = ((_11 = (_10 = (_9 = (_8 = memori.culture) === null || _8 === void 0 ? void 0 : _8.split('-')) === null || _9 === void 0 ? void 0 : _9[0]) !== null && _10 !== void 0 ? _10 : i18n.language) !== null && _11 !== void 0 ? _11 : 'IT')) === null || _12 === void 0 ? void 0 : _12.toUpperCase())
1908
2270
  ? userLang
1909
2271
  : undefined,
1910
2272
  baseUrl,
@@ -1912,9 +2274,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1912
2274
  layout,
1913
2275
  memoriTyping,
1914
2276
  typingText,
1915
- showTypingText: (_11 = showTypingText !== null && showTypingText !== void 0 ? showTypingText : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showTypingText) !== null && _11 !== void 0 ? _11 : false,
2277
+ showTypingText: (_13 = showTypingText !== null && showTypingText !== void 0 ? showTypingText : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.showTypingText) !== null && _13 !== void 0 ? _13 : false,
1916
2278
  history: showFullHistory ? history : history.slice(-2),
1917
- authToken: (_13 = (_12 = loginToken !== null && loginToken !== void 0 ? loginToken : userToken) !== null && _12 !== void 0 ? _12 : additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.loginToken) !== null && _13 !== void 0 ? _13 : authToken,
2279
+ authToken: resolveLoginToken(),
1918
2280
  dialogState: currentDialogState,
1919
2281
  pushMessage,
1920
2282
  simulateUserPrompt,
@@ -1964,11 +2326,12 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1964
2326
  maxTotalMessagePayload,
1965
2327
  maxTextareaCharacters,
1966
2328
  isChatlogPanel: (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.artifactChatLogPanel) === true,
2329
+ globalBackground: globalBackground || undefined,
1967
2330
  };
1968
- const integrationBackground = integration && globalBackgroundUrl ? (_jsx("div", { className: "memori--global-background", children: _jsx("div", { className: "memori--global-background-image", style: { backgroundImage: globalBackgroundUrl } }) })) : (_jsx("div", { className: "memori--global-background no-background-image" }));
2331
+ const integrationBackground = (_jsx("div", { className: "memori--global-background no-background-image" }));
1969
2332
  const integrationStyle = integration &&
1970
2333
  (Object.keys(integrationProperties).length > 0 ||
1971
- (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.blurBackground)) ? (_jsx("style", { dangerouslySetInnerHTML: { __html: integrationStylesheet } })) : null;
2334
+ (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.blurBackground) === false) ? (_jsx("style", { dangerouslySetInnerHTML: { __html: integrationStylesheet } })) : null;
1972
2335
  const poweredBy = (_jsx(PoweredBy, { tenant: tenant, userLang: userLang, integrationID: integration === null || integration === void 0 ? void 0 : integration.integrationID, memoriHash: `${memori.ownerTenantName}-${memori.ownerUserName}-${memori.name}` }));
1973
2336
  const Layout = customLayout
1974
2337
  ? customLayout
@@ -1985,7 +2348,10 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1985
2348
  : selectedLayout === 'ZOOMED_FULL_BODY'
1986
2349
  ? ZoomedFullBodyLayout
1987
2350
  : FullPageLayout;
1988
- return (_jsxs("div", { ref: widgetRootRef, className: cx('memori', 'memori-widget', `memori-layout-${String(selectedLayout).toLowerCase()}`, `memori-controls-${String(controlsPosition).toLowerCase()}`, `memori--avatar-${(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) || 'default'}`, {
2351
+ const widgetTheme = (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.theme) === 'light' || (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.theme) === 'dark'
2352
+ ? integrationConfig.theme
2353
+ : 'light';
2354
+ return (_jsx("div", { ref: setWidgetRootEl, className: cx('memori', 'memori-widget', `memori-layout-${String(selectedLayout).toLowerCase()}`, `memori-controls-${String(controlsPosition).toLowerCase()}`, `memori--avatar-${(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) || 'default'}`, {
1989
2355
  'memori--auto-start': autoStart,
1990
2356
  'memori--preview': preview,
1991
2357
  'memori--embed': embed,
@@ -1994,138 +2360,135 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
1994
2360
  'memori--active': hasUserActivatedSpeak,
1995
2361
  'memori--hide-emissions': hideEmissions,
1996
2362
  'memori--has-active-session': !!sessionId,
1997
- }), "data-theme": (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.theme) === 'light' ||
1998
- (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.theme) === 'dark'
1999
- ? integrationConfig.theme
2000
- : undefined, "data-memori-name": memori === null || memori === void 0 ? void 0 : memori.name, "data-memori-id": memori === null || memori === void 0 ? void 0 : memori.engineMemoriID, "data-memori-secondary-id": memori === null || memori === void 0 ? void 0 : memori.memoriID, "data-memori-session-id": sessionId, "data-memori-integration": integration === null || integration === void 0 ? void 0 : integration.integrationID, "data-memori-engine-state": JSON.stringify({
2363
+ }), "data-theme": widgetTheme, "data-memori-name": memori === null || memori === void 0 ? void 0 : memori.name, "data-memori-id": memori === null || memori === void 0 ? void 0 : memori.engineMemoriID, "data-memori-secondary-id": memori === null || memori === void 0 ? void 0 : memori.memoriID, "data-memori-session-id": sessionId, "data-memori-integration": integration === null || integration === void 0 ? void 0 : integration.integrationID, "data-memori-engine-state": JSON.stringify({
2001
2364
  ...currentDialogState,
2002
2365
  sessionID: sessionId,
2003
- }), style: { height }, children: [_jsx(Layout, { Header: Header, headerProps: headerProps, Avatar: Avatar, avatarProps: avatarProps, Chat: Chat, chatProps: chatProps, StartPanel: StartPanel, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground, poweredBy: poweredBy, autoStart: autoStart, sessionId: sessionId, hasUserActivatedSpeak: hasUserActivatedSpeak, loading: loading, avatar3dHidden: avatar3dHidden !== null && avatar3dHidden !== void 0 ? avatar3dHidden : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar_3d_hidden }), _jsx(ArtifactAPIBridge, { pushMessage: (message) => {
2004
- setHistory(history => {
2005
- if (!history.length)
2006
- return history;
2007
- const lastMessage = history[history.length - 1];
2008
- if (!lastMessage || lastMessage.fromUser)
2009
- return history;
2010
- const updatedLastMessage = {
2011
- ...lastMessage,
2012
- text: lastMessage.text + message.text,
2013
- };
2014
- return [...history.slice(0, -1), updatedLastMessage];
2015
- });
2016
- } }), _jsx("audio", { id: "memori-audio", style: { display: 'none' }, src: "https://aisuru.com/intro.mp3" }), isClient && (_jsx(MemoriAuth, { withModal: true, pwdOrTokens: authModalState, openModal: !!authModalState, setPwdOrTokens: setAuthModalState, showTokens: memori.privacyType === 'SECRET', onFinish: (values) => {
2017
- var _a, _b, _c, _d;
2018
- if (values['password'])
2019
- setMemoriPwd(values['password']);
2020
- if (values['password'])
2021
- memoriPassword = values['password'];
2022
- if (values['tokens'])
2023
- setMemoriTokens(values['tokens']);
2024
- return reopenSession(!sessionId, values['password'], values['tokens'], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2025
- LANG: userLang,
2026
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2027
- ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) ||
2028
- '',
2029
- ...(initialContextVars || {}),
2030
- }, initialQuestion, birthDate)
2031
- .then(state => {
2032
- if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
2033
- throw new Error('AUTH_FAILED');
2034
- }
2035
- setAuthModalState(null);
2036
- if (state === null || state === void 0 ? void 0 : state.dialogState) {
2037
- setHasUserActivatedSpeak(true);
2038
- }
2039
- else {
2040
- onClickStart(state);
2041
- }
2042
- })
2043
- .catch(error => {
2044
- if (!(error instanceof Error) ||
2045
- error.message !== 'AUTH_FAILED') {
2046
- setGotErrorInOpening(true);
2047
- }
2048
- throw error;
2049
- });
2050
- }, minimumNumberOfRecoveryTokens: (_17 = memori === null || memori === void 0 ? void 0 : memori.minimumNumberOfRecoveryTokens) !== null && _17 !== void 0 ? _17 : 1 })), isClient && (_jsx(AgeVerificationModal, { visible: showAgeVerification, minAge: minAge, onClose: birthDate => {
2051
- var _a, _b, _c, _d;
2052
- if (birthDate) {
2053
- setBirthDate(birthDate);
2054
- setLocalConfig('birthDate', birthDate);
2055
- reopenSession(!sessionId, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), memoriTokens, personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2056
- LANG: userLang,
2057
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2058
- ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2059
- ...(initialContextVars || {}),
2060
- }, initialQuestion, birthDate)
2061
- .then(state => {
2062
- setShowAgeVerification(false);
2063
- setAuthModalState(null);
2064
- onClickStart(state || undefined);
2065
- })
2066
- .catch(() => {
2067
- setShowAgeVerification(false);
2068
- setGotErrorInOpening(true);
2069
- });
2070
- }
2071
- else {
2072
- setShowAgeVerification(false);
2073
- setClickedStart(false);
2074
- }
2075
- } })), showSettingsDrawer && (_jsx(SettingsDrawer, { layout: selectedLayout, open: !!showSettingsDrawer, onClose: () => setShowSettingsDrawer(false), microphoneMode: continuousSpeech ? 'CONTINUOUS' : 'HOLD_TO_TALK', continuousSpeechTimeout: continuousSpeechTimeout, setMicrophoneMode: mode => setContinuousSpeech(mode === 'CONTINUOUS'), setContinuousSpeechTimeout: setContinuousSpeechTimeout, controlsPosition: controlsPosition, setControlsPosition: setControlsPosition, hideEmissions: hideEmissions, setHideEmissions: setHideEmissions, avatarType: avatarType, setAvatarType: setAvatarType, enablePositionControls: enablePositionControls, setEnablePositionControls: setEnablePositionControls, isAvatar3d: !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL), additionalSettings: additionalSettings, speakerMuted: speakerMuted })), showChatHistoryDrawer && (_jsx(ChatHistoryDrawer, { open: !!showChatHistoryDrawer, onClose: () => setShowChatHistoryDrawer(false), resumeSession: chatLog => {
2076
- setChatLogID(chatLog.chatLogID);
2077
- onClickStart(undefined, false, chatLog);
2078
- setShowChatHistoryDrawer(false);
2079
- }, apiClient: client, sessionId: sessionId || '', memori: memori, baseUrl: baseUrl, history: history, apiUrl: client.constants.BACKEND_URL, loginToken: loginToken, language: language, userLang: userLang, isMultilanguageEnabled: isMultilanguageEnabled })), showKnownFactsDrawer && sessionId && (_jsx(KnownFacts, { apiClient: client, memori: memori, sessionID: sessionId, visible: showKnownFactsDrawer, closeDrawer: () => setShowKnownFactsDrawer(false) })), showExpertsDrawer && !!experts && (_jsx(ExpertsDrawer, { apiUrl: client.constants.BACKEND_URL, baseUrl: baseUrl, tenant: tenant, experts: experts, open: showExpertsDrawer, onClose: () => setShowExpertsDrawer(false) })), showLoginDrawer && (tenant === null || tenant === void 0 ? void 0 : tenant.name) && (_jsx(LoginDrawer, { tenant: tenant, apiClient: client, open: !!showLoginDrawer, user: user, loginToken: loginToken, onClose: () => setShowLoginDrawer(false), drawerClassName: selectedLayout === 'WEBSITE_ASSISTANT'
2080
- ? 'memori-drawer--above-website-assistant'
2081
- : undefined, onLogin: (user, token) => {
2082
- var _a, _b, _c, _d;
2083
- reopenSession(false, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), [], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2084
- LANG: userLang,
2085
- PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2086
- ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) ||
2087
- '',
2088
- ...(initialContextVars || {}),
2089
- }, undefined, birthDate, { loginToken: token }, undefined, sessionId).then(state => {
2090
- var _a, _b;
2091
- setShowLoginDrawer(false);
2092
- setUser(user);
2093
- setLoginToken(token);
2094
- userToken = token;
2095
- setLocalConfig('loginToken', token);
2096
- if ((state === null || state === void 0 ? void 0 : state.sessionID) &&
2097
- state.sessionID !== sessionId &&
2098
- (state === null || state === void 0 ? void 0 : state.dialogState)) {
2099
- const username = (user === null || user === void 0 ? void 0 : user.userName) || t('login.user');
2100
- pushMessage({
2101
- text: '',
2102
- emitter: state.dialogState.emitter,
2103
- media: (_b = (_a = state.dialogState.emittedMedia) !== null && _a !== void 0 ? _a : state.dialogState.media) !== null && _b !== void 0 ? _b : [],
2104
- fromUser: false,
2105
- initial: t('login.successfullyLoggedIn', { username }),
2106
- contextVars: state.dialogState.contextVars,
2107
- date: state.dialogState.currentDate,
2108
- placeName: state.dialogState.currentPlaceName,
2109
- placeLatitude: state.dialogState.currentLatitude,
2110
- placeLongitude: state.dialogState.currentLongitude,
2111
- placeUncertaintyKm: state.dialogState.currentUncertaintyKm,
2112
- tag: state.dialogState.currentTag,
2113
- memoryTags: state.dialogState.memoryTags,
2114
- });
2115
- setCurrentDialogState(state.dialogState);
2116
- }
2117
- });
2118
- }, setUser: setUser, onLogout: () => {
2119
- if (!loginToken)
2120
- return;
2121
- client.backend.pwlUserLogout(loginToken).then(() => {
2122
- setShowLoginDrawer(false);
2123
- setUser(undefined);
2124
- setLoginToken(undefined);
2125
- userToken = undefined;
2126
- removeLocalConfig('loginToken');
2127
- });
2128
- } }))] }));
2366
+ }), style: { height }, children: _jsxs(MemoriUIProvider, { container: widgetRootEl, theme: widgetTheme, children: [_jsx(AlertViewport, { placement: "top-end", style: { zIndex: 10002 } }), _jsx(WidgetSurfaceProvider, { value: widgetSurfaceEl, children: _jsxs("div", { ref: setWidgetSurfaceEl, className: "memori-widget__surface", children: [_jsx(Layout, { Header: Header, headerProps: headerProps, Avatar: Avatar, avatarProps: avatarProps, Chat: Chat, chatProps: chatProps, StartPanel: StartPanel, startPanelProps: startPanelProps, integrationStyle: integrationStyle, integrationBackground: integrationBackground, poweredBy: poweredBy, autoStart: autoStart, sessionId: sessionId, hasUserActivatedSpeak: hasUserActivatedSpeak, loading: loading, avatar3dHidden: avatar3dHidden !== null && avatar3dHidden !== void 0 ? avatar3dHidden : integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar_3d_hidden, totemContentMaxWidth: integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.totemContentMaxWidth }), _jsx(ArtifactAPIBridge, { pushMessage: (message) => {
2367
+ setHistory(history => {
2368
+ if (!history.length)
2369
+ return history;
2370
+ const lastMessage = history[history.length - 1];
2371
+ if (!lastMessage || lastMessage.fromUser)
2372
+ return history;
2373
+ const updatedLastMessage = {
2374
+ ...lastMessage,
2375
+ text: lastMessage.text + message.text,
2376
+ };
2377
+ return [...history.slice(0, -1), updatedLastMessage];
2378
+ });
2379
+ } }), _jsx("audio", { id: "memori-audio", style: { display: 'none' }, src: "https://aisuru.com/intro.mp3" }), isClient && (_jsx(MemoriAuth, { withModal: true, pwdOrTokens: authModalState, openModal: !!authModalState, setPwdOrTokens: setAuthModalState, showTokens: memori.privacyType === 'SECRET', onFinish: (values) => {
2380
+ var _a, _b, _c, _d;
2381
+ if (values['password'])
2382
+ setMemoriPwd(values['password']);
2383
+ if (values['password'])
2384
+ memoriPassword = values['password'];
2385
+ if (values['tokens'])
2386
+ setMemoriTokens(values['tokens']);
2387
+ return reopenSession(!sessionId, values['password'], values['tokens'], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2388
+ LANG: userLang,
2389
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2390
+ ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2391
+ ...(initialContextVars || {}),
2392
+ }, initialQuestion, birthDate)
2393
+ .then(state => {
2394
+ if (!(state === null || state === void 0 ? void 0 : state.sessionID)) {
2395
+ throw new Error('AUTH_FAILED');
2396
+ }
2397
+ setAuthModalState(null);
2398
+ if (state === null || state === void 0 ? void 0 : state.dialogState) {
2399
+ setHasUserActivatedSpeak(true);
2400
+ }
2401
+ else {
2402
+ onClickStart(state);
2403
+ }
2404
+ })
2405
+ .catch(error => {
2406
+ if (!(error instanceof Error) ||
2407
+ error.message !== 'AUTH_FAILED') {
2408
+ setGotErrorInOpening(true);
2409
+ }
2410
+ throw error;
2411
+ });
2412
+ }, minimumNumberOfRecoveryTokens: (_17 = memori === null || memori === void 0 ? void 0 : memori.minimumNumberOfRecoveryTokens) !== null && _17 !== void 0 ? _17 : 1 })), isClient && (_jsx(AgeVerificationModal, { visible: showAgeVerification, minAge: minAge, onClose: birthDate => {
2413
+ var _a, _b, _c, _d;
2414
+ if (birthDate) {
2415
+ setBirthDate(birthDate);
2416
+ setLocalConfig('birthDate', birthDate);
2417
+ reopenSession(!sessionId, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), memoriTokens, personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2418
+ LANG: userLang,
2419
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2420
+ ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2421
+ ...(initialContextVars || {}),
2422
+ }, initialQuestion, birthDate)
2423
+ .then(state => {
2424
+ setShowAgeVerification(false);
2425
+ setAuthModalState(null);
2426
+ onClickStart(state || undefined);
2427
+ })
2428
+ .catch(() => {
2429
+ setShowAgeVerification(false);
2430
+ setGotErrorInOpening(true);
2431
+ });
2432
+ }
2433
+ else {
2434
+ setShowAgeVerification(false);
2435
+ setClickedStart(false);
2436
+ }
2437
+ } })), showSettingsDrawer && (_jsx(SettingsDrawer, { layout: selectedLayout, open: !!showSettingsDrawer, onClose: () => setShowSettingsDrawer(false), microphoneMode: continuousSpeech ? 'CONTINUOUS' : 'HOLD_TO_TALK', continuousSpeechTimeout: continuousSpeechTimeout, setMicrophoneMode: mode => setContinuousSpeech(mode === 'CONTINUOUS'), setContinuousSpeechTimeout: setContinuousSpeechTimeout, controlsPosition: controlsPosition, setControlsPosition: setControlsPosition, hideEmissions: hideEmissions, setHideEmissions: setHideEmissions, avatarType: avatarType, setAvatarType: setAvatarType, enablePositionControls: enablePositionControls, setEnablePositionControls: setEnablePositionControls, isAvatar3d: !!(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL), additionalSettings: additionalSettings, speakerMuted: speakerMuted })), showChatHistoryDrawer && (_jsx(ChatHistoryDrawer, { open: !!showChatHistoryDrawer, onClose: () => setShowChatHistoryDrawer(false), resumeSession: chatLog => {
2438
+ setChatLogID(chatLog.chatLogID);
2439
+ onClickStart(undefined, false, chatLog);
2440
+ setShowChatHistoryDrawer(false);
2441
+ }, apiClient: client, sessionId: sessionId || '', memori: memori, baseUrl: baseUrl, history: history, apiUrl: client.constants.BACKEND_URL, loginToken: loginToken, language: language, userLang: userLang, isMultilanguageEnabled: isMultilanguageEnabled })), showKnownFactsDrawer && sessionId && (_jsx(KnownFacts, { apiClient: client, memori: memori, sessionID: sessionId, visible: showKnownFactsDrawer, closeDrawer: () => setShowKnownFactsDrawer(false) })), showExpertsDrawer && !!experts && (_jsx(ExpertsDrawer, { apiUrl: client.constants.BACKEND_URL, baseUrl: baseUrl, tenant: tenant, experts: experts, open: showExpertsDrawer, onClose: () => setShowExpertsDrawer(false) })), showLoginDrawer && (tenant === null || tenant === void 0 ? void 0 : tenant.name) && (_jsx(LoginDrawer, { tenant: tenant, apiClient: client, open: !!showLoginDrawer, user: user, loginToken: loginToken, onClose: () => setShowLoginDrawer(false), drawerClassName: selectedLayout === 'WEBSITE_ASSISTANT'
2442
+ ? 'memori-drawer--above-website-assistant'
2443
+ : undefined, onLogin: (user, token) => {
2444
+ var _a, _b, _c, _d;
2445
+ reopenSession(false, memoriPassword || memoriPwd || (memori === null || memori === void 0 ? void 0 : memori.secretToken), [], personification === null || personification === void 0 ? void 0 : personification.tag, personification === null || personification === void 0 ? void 0 : personification.pin, {
2446
+ LANG: userLang,
2447
+ PATHNAME: (_a = window.location.pathname) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2448
+ ROUTE: ((_d = (_c = (_b = window.location.pathname) === null || _b === void 0 ? void 0 : _b.split('/')) === null || _c === void 0 ? void 0 : _c.pop()) === null || _d === void 0 ? void 0 : _d.toUpperCase()) || '',
2449
+ ...(initialContextVars || {}),
2450
+ }, undefined, birthDate, { loginToken: token }, undefined, sessionId).then(state => {
2451
+ var _a, _b;
2452
+ setShowLoginDrawer(false);
2453
+ setUser(user);
2454
+ setLoginToken(token);
2455
+ userTokenRef.current = token;
2456
+ setLocalConfig('loginToken', token);
2457
+ if ((state === null || state === void 0 ? void 0 : state.sessionID) &&
2458
+ state.sessionID !== sessionId &&
2459
+ (state === null || state === void 0 ? void 0 : state.dialogState)) {
2460
+ const username = (user === null || user === void 0 ? void 0 : user.userName) || t('login.user');
2461
+ pushMessage({
2462
+ text: '',
2463
+ emitter: state.dialogState.emitter,
2464
+ media: (_b = (_a = state.dialogState.emittedMedia) !== null && _a !== void 0 ? _a : state.dialogState.media) !== null && _b !== void 0 ? _b : [],
2465
+ fromUser: false,
2466
+ initial: t('login.successfullyLoggedIn', {
2467
+ username,
2468
+ }),
2469
+ contextVars: state.dialogState.contextVars,
2470
+ date: state.dialogState.currentDate,
2471
+ placeName: state.dialogState.currentPlaceName,
2472
+ placeLatitude: state.dialogState.currentLatitude,
2473
+ placeLongitude: state.dialogState.currentLongitude,
2474
+ placeUncertaintyKm: state.dialogState.currentUncertaintyKm,
2475
+ tag: state.dialogState.currentTag,
2476
+ memoryTags: state.dialogState.memoryTags,
2477
+ });
2478
+ setCurrentDialogState(state.dialogState);
2479
+ }
2480
+ });
2481
+ }, setUser: setUser, onLogout: () => {
2482
+ if (!loginToken)
2483
+ return;
2484
+ client.backend.pwlUserLogout(loginToken).then(() => {
2485
+ setShowLoginDrawer(false);
2486
+ setUser(undefined);
2487
+ setLoginToken(undefined);
2488
+ userTokenRef.current = undefined;
2489
+ removeLocalConfig('loginToken');
2490
+ });
2491
+ } }))] }) })] }) }));
2129
2492
  };
2130
2493
  export default MemoriWidget;
2131
2494
  //# sourceMappingURL=MemoriWidget.js.map