@athoscommerce/snap-preact 1.2.3-beta.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/dist/cjs/components/src/components/Atoms/Button/Button.d.ts +1 -1
  2. package/dist/cjs/components/src/components/Atoms/Button/Button.d.ts.map +1 -1
  3. package/dist/cjs/components/src/components/Atoms/Dropdown/Dropdown.d.ts +0 -1
  4. package/dist/cjs/components/src/components/Atoms/Dropdown/Dropdown.d.ts.map +1 -1
  5. package/dist/cjs/components/src/components/Atoms/Dropdown/Dropdown.js +13 -30
  6. package/dist/cjs/components/src/components/Atoms/Icon/paths.d.ts +0 -21
  7. package/dist/cjs/components/src/components/Atoms/Icon/paths.d.ts.map +1 -1
  8. package/dist/cjs/components/src/components/Atoms/Icon/paths.js +0 -21
  9. package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +3 -3
  10. package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
  11. package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +7 -8
  12. package/dist/cjs/components/src/components/Molecules/CalloutBadge/CalloutBadge.js +2 -2
  13. package/dist/cjs/components/src/components/Molecules/OverlayBadge/OverlayBadge.js +2 -2
  14. package/dist/cjs/components/src/components/Molecules/Result/Result.d.ts +3 -3
  15. package/dist/cjs/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
  16. package/dist/cjs/components/src/components/Molecules/Result/Result.js +4 -4
  17. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts +0 -2
  18. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
  19. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.js +2 -19
  20. package/dist/cjs/components/src/components/Molecules/Slideout/Slideout.d.ts.map +1 -1
  21. package/dist/cjs/components/src/components/Molecules/Slideout/Slideout.js +12 -30
  22. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/AbstractedControls.js +5 -5
  23. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/Control.d.ts.map +1 -1
  24. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/Control.js +31 -31
  25. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.d.ts.map +1 -1
  26. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.js +22 -36
  27. package/dist/cjs/components/src/components/Organisms/Results/Results.js +1 -1
  28. package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.d.ts.map +1 -1
  29. package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +0 -2
  30. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  31. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -2
  32. package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.d.ts.map +1 -1
  33. package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +0 -2
  34. package/dist/cjs/components/src/hooks/useMediaQuery.d.ts.map +1 -1
  35. package/dist/cjs/components/src/hooks/useMediaQuery.js +3 -1
  36. package/dist/cjs/components/src/index.d.ts +0 -1
  37. package/dist/cjs/components/src/index.d.ts.map +1 -1
  38. package/dist/cjs/components/src/index.js +0 -1
  39. package/dist/cjs/components/src/providers/withTracking.d.ts +2 -2
  40. package/dist/cjs/components/src/providers/withTracking.d.ts.map +1 -1
  41. package/dist/cjs/components/src/themes/base/base.js +3 -3
  42. package/dist/cjs/src/Snap.d.ts +1 -2
  43. package/dist/cjs/src/Snap.d.ts.map +1 -1
  44. package/dist/cjs/src/Snap.js +24 -124
  45. package/dist/cjs/src/SnapHybrid.d.ts.map +1 -1
  46. package/dist/cjs/src/Templates/SnapTemplates.d.ts +13 -73
  47. package/dist/cjs/src/Templates/SnapTemplates.d.ts.map +1 -1
  48. package/dist/cjs/src/Templates/SnapTemplates.js +100 -117
  49. package/dist/cjs/src/Templates/Stores/LibraryStore.d.ts +0 -4
  50. package/dist/cjs/src/Templates/Stores/LibraryStore.d.ts.map +1 -1
  51. package/dist/cjs/src/Templates/Stores/LibraryStore.js +0 -19
  52. package/dist/cjs/src/Templates/Stores/TargetStore.d.ts +7 -6
  53. package/dist/cjs/src/Templates/Stores/TargetStore.d.ts.map +1 -1
  54. package/dist/cjs/src/Templates/Stores/TargetStore.js +14 -8
  55. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +56 -7
  56. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
  57. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +465 -94
  58. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
  59. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
  60. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +123 -70
  61. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
  62. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
  63. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
  64. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
  65. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +86 -1
  66. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
  67. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +33 -14
  68. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts +80 -33
  69. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  70. package/dist/cjs/src/Templates/Stores/TemplateStore.js +28 -37
  71. package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts +2 -8
  72. package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
  73. package/dist/cjs/src/Templates/Stores/ThemeStore.js +3 -28
  74. package/dist/cjs/src/Templates/Stores/library/languages/es.d.ts.map +1 -1
  75. package/dist/cjs/src/Templates/Stores/library/languages/es.js +0 -5
  76. package/dist/cjs/src/Templates/Stores/library/languages/fr.d.ts.map +1 -1
  77. package/dist/cjs/src/Templates/Stores/library/languages/fr.js +0 -5
  78. package/dist/cjs/src/Templates/index.d.ts +1 -1
  79. package/dist/cjs/src/Templates/index.d.ts.map +1 -1
  80. package/dist/cjs/src/index.d.ts +1 -0
  81. package/dist/cjs/src/index.d.ts.map +1 -1
  82. package/dist/cjs/src/setupEvents.d.ts.map +1 -1
  83. package/dist/cjs/src/setupEvents.js +0 -39
  84. package/dist/cjs/src/types.d.ts +6 -16
  85. package/dist/cjs/src/types.d.ts.map +1 -1
  86. package/dist/cjs/src/utils/combineMerge.d.ts +2 -0
  87. package/dist/cjs/src/utils/combineMerge.d.ts.map +1 -0
  88. package/dist/cjs/src/utils/combineMerge.js +22 -0
  89. package/dist/cjs/src/utils/index.d.ts +1 -0
  90. package/dist/cjs/src/utils/index.d.ts.map +1 -1
  91. package/dist/cjs/src/utils/index.js +3 -1
  92. package/dist/esm/components/src/components/Atoms/Button/Button.d.ts +1 -1
  93. package/dist/esm/components/src/components/Atoms/Button/Button.d.ts.map +1 -1
  94. package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.d.ts +0 -1
  95. package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.d.ts.map +1 -1
  96. package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.js +9 -33
  97. package/dist/esm/components/src/components/Atoms/Icon/paths.d.ts +0 -21
  98. package/dist/esm/components/src/components/Atoms/Icon/paths.d.ts.map +1 -1
  99. package/dist/esm/components/src/components/Atoms/Icon/paths.js +0 -21
  100. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +3 -3
  101. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
  102. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +7 -8
  103. package/dist/esm/components/src/components/Molecules/CalloutBadge/CalloutBadge.js +1 -1
  104. package/dist/esm/components/src/components/Molecules/OverlayBadge/OverlayBadge.js +1 -1
  105. package/dist/esm/components/src/components/Molecules/Result/Result.d.ts +3 -3
  106. package/dist/esm/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
  107. package/dist/esm/components/src/components/Molecules/Result/Result.js +2 -2
  108. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts +0 -2
  109. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
  110. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.js +2 -35
  111. package/dist/esm/components/src/components/Molecules/Slideout/Slideout.d.ts.map +1 -1
  112. package/dist/esm/components/src/components/Molecules/Slideout/Slideout.js +12 -30
  113. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/AbstractedControls.js +5 -5
  114. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.d.ts.map +1 -1
  115. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.js +29 -29
  116. package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.d.ts.map +1 -1
  117. package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.js +22 -35
  118. package/dist/esm/components/src/components/Organisms/Results/Results.js +1 -1
  119. package/dist/esm/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.d.ts.map +1 -1
  120. package/dist/esm/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +0 -3
  121. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  122. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -3
  123. package/dist/esm/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.d.ts.map +1 -1
  124. package/dist/esm/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +0 -3
  125. package/dist/esm/components/src/hooks/useMediaQuery.d.ts.map +1 -1
  126. package/dist/esm/components/src/hooks/useMediaQuery.js +3 -1
  127. package/dist/esm/components/src/index.d.ts +0 -1
  128. package/dist/esm/components/src/index.d.ts.map +1 -1
  129. package/dist/esm/components/src/index.js +0 -1
  130. package/dist/esm/components/src/providers/withTracking.d.ts +2 -2
  131. package/dist/esm/components/src/providers/withTracking.d.ts.map +1 -1
  132. package/dist/esm/components/src/themes/base/base.js +3 -3
  133. package/dist/esm/src/Snap.d.ts +1 -2
  134. package/dist/esm/src/Snap.d.ts.map +1 -1
  135. package/dist/esm/src/Snap.js +0 -59
  136. package/dist/esm/src/SnapHybrid.d.ts.map +1 -1
  137. package/dist/esm/src/Templates/SnapTemplates.d.ts +13 -73
  138. package/dist/esm/src/Templates/SnapTemplates.d.ts.map +1 -1
  139. package/dist/esm/src/Templates/SnapTemplates.js +108 -112
  140. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts +0 -4
  141. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts.map +1 -1
  142. package/dist/esm/src/Templates/Stores/LibraryStore.js +0 -6
  143. package/dist/esm/src/Templates/Stores/TargetStore.d.ts +7 -6
  144. package/dist/esm/src/Templates/Stores/TargetStore.d.ts.map +1 -1
  145. package/dist/esm/src/Templates/Stores/TargetStore.js +14 -8
  146. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +56 -7
  147. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
  148. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +446 -88
  149. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
  150. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
  151. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +118 -66
  152. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
  153. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
  154. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
  155. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
  156. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +82 -1
  157. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
  158. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +27 -8
  159. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts +80 -33
  160. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  161. package/dist/esm/src/Templates/Stores/TemplateStore.js +27 -37
  162. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts +2 -8
  163. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
  164. package/dist/esm/src/Templates/Stores/ThemeStore.js +3 -26
  165. package/dist/esm/src/Templates/Stores/library/languages/es.d.ts.map +1 -1
  166. package/dist/esm/src/Templates/Stores/library/languages/es.js +0 -5
  167. package/dist/esm/src/Templates/Stores/library/languages/fr.d.ts.map +1 -1
  168. package/dist/esm/src/Templates/Stores/library/languages/fr.js +0 -5
  169. package/dist/esm/src/Templates/index.d.ts +1 -1
  170. package/dist/esm/src/Templates/index.d.ts.map +1 -1
  171. package/dist/esm/src/index.d.ts +1 -0
  172. package/dist/esm/src/index.d.ts.map +1 -1
  173. package/dist/esm/src/setupEvents.d.ts.map +1 -1
  174. package/dist/esm/src/setupEvents.js +0 -23
  175. package/dist/esm/src/types.d.ts +6 -16
  176. package/dist/esm/src/types.d.ts.map +1 -1
  177. package/dist/esm/src/utils/combineMerge.d.ts +2 -0
  178. package/dist/esm/src/utils/combineMerge.d.ts.map +1 -0
  179. package/dist/esm/src/utils/combineMerge.js +16 -0
  180. package/dist/esm/src/utils/index.d.ts +1 -0
  181. package/dist/esm/src/utils/index.d.ts.map +1 -1
  182. package/dist/esm/src/utils/index.js +1 -0
  183. package/package.json +12 -13
  184. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.d.ts +0 -7
  185. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.d.ts.map +0 -1
  186. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.js +0 -85
  187. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts +0 -2
  188. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts.map +0 -1
  189. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/index.js +0 -17
  190. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +0 -18
  191. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +0 -1
  192. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +0 -115
  193. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts +0 -2
  194. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts.map +0 -1
  195. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/index.js +0 -17
  196. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts +0 -17
  197. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts.map +0 -1
  198. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +0 -106
  199. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts +0 -2
  200. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts.map +0 -1
  201. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/index.js +0 -17
  202. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +0 -23
  203. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +0 -1
  204. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +0 -445
  205. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts +0 -2
  206. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts.map +0 -1
  207. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/index.js +0 -17
  208. package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts +0 -14
  209. package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts.map +0 -1
  210. package/dist/cjs/components/src/components/Organisms/Chat/Chat.js +0 -1619
  211. package/dist/cjs/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts +0 -19
  212. package/dist/cjs/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts.map +0 -1
  213. package/dist/cjs/components/src/components/Organisms/Chat/ChatAttachmentContext.js +0 -22
  214. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts +0 -12
  215. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts.map +0 -1
  216. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.js +0 -158
  217. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts +0 -13
  218. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts.map +0 -1
  219. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.js +0 -170
  220. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts +0 -11
  221. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts.map +0 -1
  222. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.js +0 -192
  223. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +0 -11
  224. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +0 -1
  225. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.js +0 -86
  226. package/dist/cjs/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts +0 -12
  227. package/dist/cjs/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts.map +0 -1
  228. package/dist/cjs/components/src/components/Organisms/Chat/SuggestedQuestions.js +0 -73
  229. package/dist/cjs/components/src/components/Organisms/Chat/index.d.ts +0 -2
  230. package/dist/cjs/components/src/components/Organisms/Chat/index.d.ts.map +0 -1
  231. package/dist/cjs/components/src/components/Organisms/Chat/index.js +0 -17
  232. package/dist/cjs/src/Templates/Stores/library/components/Chat.d.ts +0 -2
  233. package/dist/cjs/src/Templates/Stores/library/components/Chat.d.ts.map +0 -1
  234. package/dist/cjs/src/Templates/Stores/library/components/Chat.js +0 -5
  235. package/dist/cjs/src/create/createChatController.d.ts +0 -5
  236. package/dist/cjs/src/create/createChatController.d.ts.map +0 -1
  237. package/dist/cjs/src/create/createChatController.js +0 -43
  238. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.d.ts +0 -7
  239. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.d.ts.map +0 -1
  240. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.js +0 -67
  241. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts +0 -2
  242. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts.map +0 -1
  243. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/index.js +0 -1
  244. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +0 -18
  245. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +0 -1
  246. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +0 -109
  247. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts +0 -2
  248. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts.map +0 -1
  249. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/index.js +0 -1
  250. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts +0 -17
  251. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts.map +0 -1
  252. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +0 -85
  253. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts +0 -2
  254. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts.map +0 -1
  255. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/index.js +0 -1
  256. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +0 -23
  257. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +0 -1
  258. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +0 -421
  259. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts +0 -2
  260. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts.map +0 -1
  261. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.js +0 -1
  262. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts +0 -14
  263. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts.map +0 -1
  264. package/dist/esm/components/src/components/Organisms/Chat/Chat.js +0 -1560
  265. package/dist/esm/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts +0 -19
  266. package/dist/esm/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts.map +0 -1
  267. package/dist/esm/components/src/components/Organisms/Chat/ChatAttachmentContext.js +0 -16
  268. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts +0 -12
  269. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts.map +0 -1
  270. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.js +0 -143
  271. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts +0 -13
  272. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts.map +0 -1
  273. package/dist/esm/components/src/components/Organisms/Chat/MessageText.js +0 -152
  274. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts +0 -11
  275. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts.map +0 -1
  276. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.js +0 -164
  277. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +0 -11
  278. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +0 -1
  279. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.js +0 -70
  280. package/dist/esm/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts +0 -12
  281. package/dist/esm/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts.map +0 -1
  282. package/dist/esm/components/src/components/Organisms/Chat/SuggestedQuestions.js +0 -58
  283. package/dist/esm/components/src/components/Organisms/Chat/index.d.ts +0 -2
  284. package/dist/esm/components/src/components/Organisms/Chat/index.d.ts.map +0 -1
  285. package/dist/esm/components/src/components/Organisms/Chat/index.js +0 -1
  286. package/dist/esm/src/Templates/Stores/library/components/Chat.d.ts +0 -2
  287. package/dist/esm/src/Templates/Stores/library/components/Chat.d.ts.map +0 -1
  288. package/dist/esm/src/Templates/Stores/library/components/Chat.js +0 -1
  289. package/dist/esm/src/create/createChatController.d.ts +0 -5
  290. package/dist/esm/src/create/createChatController.d.ts.map +0 -1
  291. package/dist/esm/src/create/createChatController.js +0 -29
@@ -1,1560 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
- import { css } from '@emotion/react';
3
- import classnames from 'classnames';
4
- import deepmerge from 'deepmerge';
5
- import { observer } from 'mobx-react-lite';
6
- import { useTheme, CacheProvider, useTreePath } from '../../../providers';
7
- import { mergeProps, mergeStyles } from '../../../utilities';
8
- import { Button } from '../../Atoms/Button';
9
- import { useRef, useEffect, useMemo, useState } from 'preact/hooks';
10
- import { MessageUser } from './MessageUser';
11
- import { MessageText } from './MessageText';
12
- import { SuggestedQuestions } from './SuggestedQuestions';
13
- import { ChatAttachmentContext } from './ChatAttachmentContext';
14
- import { Image } from '../../Atoms/Image';
15
- import { ChatLoadingIndicator } from '../../Atoms/ChatLoadingIndicator';
16
- import { Dropdown, Icon, Overlay, useMediaQuery } from '../../..';
17
- import { ChatInspirationResultMessage } from '../../Molecules/ChatInspirationResultMessage';
18
- import { ChatProductComparisonMessage } from '../../Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage';
19
- import { ChatProductQueryMessage } from '../../Molecules/ChatProductQueryMessage/ChatProductQueryMessage';
20
- const defaultStyles = ({ mobile, offset, hasSideChat, footerHeight }) => {
21
- const colorPrimary = '#253B80';
22
- const offsetValue = offset !== undefined ? (typeof offset === 'number' ? `${offset}px` : offset) : undefined;
23
- return css({
24
- position: 'fixed',
25
- left: '20px',
26
- bottom: '20px',
27
- zIndex: 1002,
28
- color: '#333',
29
- '@keyframes ss-chat-slide-up': {
30
- from: { transform: 'translateY(100%)' },
31
- to: { transform: 'translateY(0)' },
32
- },
33
- '.ss__chat__primary': {
34
- ...(mobile
35
- ? { width: '100%', height: '100%' }
36
- : hasSideChat
37
- ? { flex: '1 1 0', minWidth: 0, maxWidth: 600, height: '70vh' }
38
- : { width: 600, maxWidth: 'calc(100vw - 60px)', height: '70vh' }),
39
- display: 'flex',
40
- flexDirection: 'column',
41
- justifyContent: 'flex-end',
42
- overflow: 'hidden',
43
- order: 1,
44
- '.ss__chat__header__title': {
45
- gap: '22px',
46
- },
47
- '.ss__chat__messages': {
48
- padding: '1em',
49
- },
50
- },
51
- '.ss__chat__secondary': {
52
- ...(mobile
53
- ? {
54
- width: '100%',
55
- maxWidth: '100%',
56
- height: `calc(100% - 70px${footerHeight > 0 ? ` - ${footerHeight}px` : ''})`,
57
- maxHeight: `calc(100% - 70px${footerHeight > 0 ? ` - ${footerHeight}px` : ''})`,
58
- }
59
- : { flex: '1 1 0', minWidth: 0, maxWidth: 600, height: '70vh', maxHeight: '70vh' }),
60
- display: 'flex',
61
- flexDirection: 'column',
62
- overflow: 'hidden',
63
- order: 2,
64
- ...(mobile
65
- ? {
66
- position: 'absolute',
67
- bottom: footerHeight > 0 ? footerHeight : 0,
68
- left: 0,
69
- right: 0,
70
- zIndex: 10,
71
- borderTopLeftRadius: '12px',
72
- borderTopRightRadius: '12px',
73
- overflow: 'hidden',
74
- overscrollBehavior: 'contain',
75
- boxShadow: '0 -4px 20px rgba(0, 0, 0, 0.15)',
76
- background: '#fff',
77
- willChange: 'transform',
78
- animation: 'ss-chat-slide-up 0.3s ease-out',
79
- }
80
- : {}),
81
- '.ss__chat__secondary__drag-handle': {
82
- display: 'flex',
83
- justifyContent: 'center',
84
- alignItems: 'center',
85
- padding: '10px 0 2px',
86
- background: colorPrimary,
87
- touchAction: 'none',
88
- cursor: 'grab',
89
- '.ss__chat__secondary__drag-handle__indicator': {
90
- width: '36px',
91
- height: '4px',
92
- borderRadius: '2px',
93
- background: 'rgba(255, 255, 255, 0.4)',
94
- },
95
- },
96
- ...(mobile
97
- ? {
98
- '.ss__chat__header': {
99
- touchAction: 'none',
100
- cursor: 'grab',
101
- },
102
- }
103
- : {}),
104
- '.ss__chat__header__title': {
105
- flexDirection: 'column',
106
- gap: '2px',
107
- '.ss__chat__header__title__primary': {
108
- fontWeight: 'bold',
109
- },
110
- '.ss__chat__header__title__secondary': {
111
- fontSize: '80%',
112
- opacity: 0.85,
113
- },
114
- },
115
- '.ss__chat__messages': {
116
- background: '#fff!important',
117
- },
118
- },
119
- '.ss__button': {
120
- border: 'none',
121
- background: 'none',
122
- color: 'inherit',
123
- '&:not(.ss__button--disabled):hover': {
124
- background: '#dfeaf6',
125
- },
126
- svg: {
127
- fill: colorPrimary,
128
- stroke: colorPrimary,
129
- },
130
- },
131
- '.ss__chat__bubble': {
132
- position: mobile ? 'fixed' : 'absolute',
133
- bottom: mobile ? '20px' : 0,
134
- left: mobile ? '20px' : 0,
135
- width: '60px',
136
- height: '60px',
137
- borderRadius: '50%',
138
- background: colorPrimary,
139
- color: 'white',
140
- display: 'flex',
141
- alignItems: 'center',
142
- justifyContent: 'center',
143
- cursor: 'pointer',
144
- fontSize: '24px',
145
- boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
146
- zIndex: 10,
147
- '&:hover': {
148
- background: '#0052a3',
149
- transform: 'scale(1.05)',
150
- },
151
- '.ss__icon': {
152
- height: '33px',
153
- width: '33px',
154
- fill: '#fff',
155
- stroke: '#fff',
156
- },
157
- },
158
- '.ss__chat__suggested-questions': {
159
- position: mobile ? 'fixed' : 'absolute',
160
- bottom: mobile ? '90px' : '70px',
161
- left: mobile ? '20px' : 0,
162
- display: 'flex',
163
- flexDirection: 'column',
164
- gap: '8px',
165
- width: '250px',
166
- zIndex: 10,
167
- '.ss__chat__suggested-questions__item': {
168
- background: '#fff',
169
- borderRadius: '12px',
170
- padding: '12px 16px',
171
- fontSize: '14px',
172
- color: '#333',
173
- boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
174
- cursor: 'pointer',
175
- lineHeight: 1.4,
176
- '&:hover': {
177
- boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
178
- },
179
- },
180
- },
181
- '&.ss__chat--minimized': {
182
- width: '60px',
183
- height: '60px',
184
- minHeight: '60px',
185
- },
186
- '&.ss__chat--open': {
187
- display: 'flex',
188
- flexDirection: mobile ? 'column' : 'row',
189
- gap: mobile ? 0 : '12px',
190
- ...(mobile
191
- ? {
192
- top: offsetValue || 0,
193
- left: 0,
194
- right: 0,
195
- bottom: 0,
196
- width: '100%',
197
- height: offsetValue ? `calc(100% - ${offsetValue})` : '100%',
198
- }
199
- : {
200
- width: hasSideChat ? 'calc(100vw - 60px)' : 'auto',
201
- maxWidth: 'calc(100vw - 60px)',
202
- maxHeight: 'calc(100vh - 40px)',
203
- }),
204
- '.ss__chat__bubble': {
205
- display: 'none',
206
- },
207
- },
208
- '.ss__chat__header': {
209
- display: 'flex',
210
- justifyContent: 'space-between',
211
- alignItems: 'center',
212
- fontSize: '16px',
213
- position: 'relative',
214
- padding: '10px 15px',
215
- color: '#fff',
216
- background: colorPrimary,
217
- borderTopLeftRadius: mobile ? 0 : '12px',
218
- borderTopRightRadius: mobile ? 0 : '12px',
219
- '.ss__chat__header__title': {
220
- display: 'flex',
221
- '.ss__chat__header__title__logo': {
222
- height: '44px',
223
- },
224
- '.ss__chat__header__title__text': {
225
- display: 'flex',
226
- flexDirection: 'column',
227
- '.ss__chat__header__title__text__primary': {
228
- fontWeight: 'bold',
229
- },
230
- '.ss__chat__header__title__text__secondary': {
231
- fontSize: '80%',
232
- },
233
- },
234
- },
235
- '.ss__chat__header__buttons': {
236
- display: 'flex',
237
- gap: '10px',
238
- '.ss__button': {
239
- display: 'flex',
240
- flexDirection: 'row-reverse',
241
- padding: '5px',
242
- border: 0,
243
- fontSize: '70%',
244
- '&:hover': {
245
- backgroundColor: 'transparent',
246
- },
247
- svg: {
248
- fill: '#fff',
249
- stroke: '#fff',
250
- },
251
- },
252
- },
253
- '.ss__chat__header__dropdown-history': {
254
- '&.ss__dropdown--open': {
255
- '.ss__dropdown__button': {
256
- backgroundColor: '#dddddd33',
257
- borderRadius: '6px',
258
- },
259
- },
260
- '.ss__dropdown__button': {
261
- display: 'flex',
262
- alignItems: 'center',
263
- },
264
- },
265
- '.ss__chat__history': {
266
- color: '#333',
267
- position: 'absolute',
268
- width: 300,
269
- minHeight: 170,
270
- top: 6,
271
- right: 0,
272
- background: 'white',
273
- zIndex: 2,
274
- boxShadow: '0px 3px 6px 0px rgba(0, 0, 0, 0.2)',
275
- borderRadius: '6px',
276
- display: 'flex',
277
- flexDirection: 'column',
278
- gap: 5,
279
- padding: '10px',
280
- boxSizing: 'border-box',
281
- '.ss__chat__history__header': {
282
- display: 'flex',
283
- justifyContent: 'space-between',
284
- alignItems: 'center',
285
- h4: {
286
- margin: 0,
287
- fontSize: '14px',
288
- },
289
- '.ss__chat__history__header__buttons': {
290
- '.ss__button': {
291
- fontSize: '14px',
292
- color: '#333',
293
- '&:hover': {
294
- background: 'none',
295
- color: '#000',
296
- },
297
- },
298
- },
299
- },
300
- '.ss__chat__history__chats': {
301
- display: 'flex',
302
- flexDirection: 'column-reverse',
303
- gap: 5,
304
- '.ss__chat__history__chats__chat': {
305
- '.ss__button': {
306
- borderRadius: '12px',
307
- width: '100%',
308
- border: '1px solid #eee',
309
- fontSize: '12px',
310
- display: 'flex',
311
- flexDirection: 'column',
312
- boxSizing: 'border-box',
313
- '.ss__chat__history__chat__button__text': {
314
- fontWeight: 'bold',
315
- },
316
- '.ss__chat__history__chat__button__date': {},
317
- },
318
- },
319
- },
320
- },
321
- },
322
- '.ss__chat__session-feedback': {
323
- display: 'flex',
324
- alignItems: 'center',
325
- gap: '10px',
326
- padding: '8px 15px',
327
- background: '#40528e',
328
- color: '#fff',
329
- fontSize: '14px',
330
- '.ss__chat__session-feedback__icon': {
331
- flex: '0 0 auto',
332
- display: 'flex',
333
- alignItems: 'center',
334
- svg: {
335
- fill: '#fff',
336
- stroke: '#fff',
337
- },
338
- },
339
- '.ss__chat__session-feedback__label': {
340
- flex: '1 1 auto',
341
- whiteSpace: 'nowrap',
342
- },
343
- '.ss__chat__session-feedback__actions': {
344
- display: 'flex',
345
- gap: '10px',
346
- alignItems: 'center',
347
- '> span': {
348
- display: 'flex',
349
- alignItems: 'center',
350
- justifyContent: 'center',
351
- },
352
- svg: {
353
- cursor: 'pointer',
354
- fill: '#fff',
355
- stroke: '#fff',
356
- opacity: 0.7,
357
- '&:hover': {
358
- opacity: 1,
359
- },
360
- },
361
- '&.ss__chat__session-feedback__actions--rated svg': {
362
- opacity: 1,
363
- cursor: 'default',
364
- },
365
- },
366
- '.ss__chat__session-feedback__close': {
367
- flex: '0 0 auto',
368
- display: 'flex',
369
- alignItems: 'center',
370
- cursor: 'pointer',
371
- svg: {
372
- fill: '#fff',
373
- stroke: '#fff',
374
- opacity: 0.7,
375
- '&:hover': {
376
- opacity: 1,
377
- },
378
- },
379
- },
380
- },
381
- '.ss__chat__content': {
382
- background: '#fff',
383
- maxHeight: mobile ? undefined : '90vh',
384
- overflow: 'hidden',
385
- display: 'flex',
386
- flexDirection: 'column',
387
- border: '1px solid #0066cc',
388
- borderTop: 'none',
389
- marginTop: '-1px',
390
- borderBottomRightRadius: mobile ? 0 : '12px',
391
- borderBottomLeftRadius: mobile ? 0 : '12px',
392
- flexGrow: 1,
393
- '.ss__chat__content__header': {
394
- // '.ss__chat__attachments': {
395
- // '.ss__chat__attachment': {
396
- // borderRadius: 0,
397
- // borderLeft: 0,
398
- // borderRight: 0,
399
- // },
400
- // },
401
- '.ss__chat__content__header__comparisons': {
402
- display: 'flex',
403
- flexDirection: 'column',
404
- gap: '1em',
405
- background: '#f4f4ff',
406
- padding: '1em',
407
- '.ss__chat__content__header__comparisons__header': {
408
- display: 'flex',
409
- justifyContent: 'space-between',
410
- '.ss__chat__content__header__comparisons__header__title': {
411
- fontWeight: 'bold',
412
- fontSize: '1.2em',
413
- display: 'flex',
414
- alignItems: 'center',
415
- gap: '0.5em',
416
- '.ss__chat__content__header__comparisons__header__title__icon': {
417
- background: colorPrimary,
418
- borderRadius: '50%',
419
- padding: '5px',
420
- fill: '#fff',
421
- height: '25px',
422
- width: '25px',
423
- },
424
- },
425
- '.ss__chat__content__header__comparisons__header__actions': {
426
- '.ss__button': {
427
- border: 'none',
428
- background: 'none',
429
- },
430
- },
431
- },
432
- '.ss__chat__content__header__comparisons__content': {
433
- display: 'flex',
434
- gap: '1em',
435
- alignItems: 'stretch',
436
- '.ss__chat__content__header__comparisons__content__items': {
437
- display: 'flex',
438
- gap: '1em',
439
- flex: '1 1 calc(100% - 100px)',
440
- justifyContent: 'space-between',
441
- },
442
- '.ss__chat__content__header__comparisons__content__comparison': {
443
- background: '#fff',
444
- padding: '0.5em',
445
- borderRadius: '1em',
446
- display: 'flex',
447
- flexDirection: 'column',
448
- gap: '0.5em',
449
- flex: '0 1 20%',
450
- position: 'relative',
451
- '&.ss__chat__content__header__comparisons__content__comparison--placeholder': {
452
- border: '2px dashed #ddd',
453
- display: 'flex',
454
- alignItems: 'center',
455
- justifyContent: 'center',
456
- '.ss__chat__content__header__comparisons__content__comparison--placeholder__text': {
457
- color: '#999',
458
- fontStyle: 'italic',
459
- },
460
- },
461
- '.ss__chat__content__header__comparisons__content__comparison__remove': {
462
- position: 'absolute',
463
- top: '-3px',
464
- right: '-3px',
465
- cursor: 'pointer',
466
- background: 'red',
467
- borderRadius: '50%',
468
- padding: '0.4em',
469
- height: 20,
470
- width: 20,
471
- display: 'flex',
472
- alignItems: 'center',
473
- justifyContent: 'center',
474
- svg: {
475
- fill: '#fff',
476
- stroke: '#fff',
477
- },
478
- },
479
- },
480
- '.ss__chat__content__header__comparisons__action': {
481
- display: 'flex',
482
- alignItems: 'center',
483
- marginLeft: 'auto',
484
- flex: '1 1 auto',
485
- '&.ss__chat__content__header__comparisons__action--hidden': {
486
- visibility: 'hidden',
487
- },
488
- '.ss__button': {
489
- flexDirection: 'row-reverse',
490
- borderRadius: '1em',
491
- padding: '0.5em 1em',
492
- background: colorPrimary,
493
- color: '#fff',
494
- textAlign: 'center',
495
- svg: {
496
- fill: '#fff',
497
- stroke: '#fff',
498
- },
499
- },
500
- },
501
- },
502
- },
503
- },
504
- '.ss__chat__messages': {
505
- flex: '1 1 auto',
506
- overflowY: 'auto',
507
- overscrollBehavior: 'contain',
508
- margin: 0,
509
- maxHeight: '100%',
510
- background: '#f9fafc',
511
- '.ss__chat__messages__end': {
512
- height: '1px',
513
- },
514
- '.ss__chat__message': {
515
- marginBottom: '30px',
516
- ul: {
517
- margin: 0,
518
- listStyle: 'inside',
519
- },
520
- p: {
521
- margin: 0,
522
- },
523
- thead: {
524
- backgroundColor: '#eee',
525
- },
526
- 'tbody tr:nth-child(even)': {
527
- backgroundColor: '#f5f5f5',
528
- },
529
- 'table th, table td': {
530
- padding: '0.2em 0.5em',
531
- },
532
- 'table + h3': {
533
- margin: '1em 0 0 0',
534
- fontSize: '1.3em',
535
- },
536
- },
537
- '.ss__chat__welcome': {
538
- display: 'flex',
539
- flexDirection: 'column',
540
- height: '100%',
541
- '.ss__chat__welcome__message': {
542
- fontSize: '15px',
543
- lineHeight: 1.5,
544
- color: '#333',
545
- padding: '2em',
546
- textAlign: 'center',
547
- },
548
- '.ss__chat__suggestions': {
549
- marginTop: 'auto',
550
- },
551
- },
552
- },
553
- '.ss__chat__actions': {
554
- display: 'flex',
555
- flexDirection: 'column',
556
- gap: '6px',
557
- overflow: 'hidden',
558
- '.ss__chat__actions__wrap': {
559
- display: 'flex',
560
- flexDirection: 'column',
561
- gap: '6px',
562
- padding: '8px 10px',
563
- background: '#f4f4ff',
564
- border: '1px solid #e3e3f5',
565
- borderRadius: '8px',
566
- },
567
- '.ss__chat__actions--title': {
568
- fontSize: '14px',
569
- color: '#333',
570
- },
571
- '.ss__chat__actions--facets, .ss__chat__actions--suggested': {
572
- display: 'flex',
573
- flexDirection: 'row',
574
- gap: '6px',
575
- '.ss__button': {
576
- flex: '0 0 auto',
577
- background: '#fff',
578
- border: '1px solid #ddd',
579
- borderRadius: '999px',
580
- padding: '3px 10px',
581
- fontSize: '14px',
582
- color: '#333',
583
- '&:hover': {
584
- background: '#f9f9ff',
585
- },
586
- },
587
- },
588
- '.ss__chat__actions--facets': {
589
- overflowX: 'auto',
590
- overflowY: 'hidden',
591
- scrollbarWidth: 'none',
592
- '&::-webkit-scrollbar': {
593
- display: 'none',
594
- },
595
- },
596
- '.ss__chat__actions--suggested': {
597
- overflowX: 'scroll',
598
- },
599
- '.ss__chat__actions__facet': {},
600
- '.ss__chat__actions__facets-dropdown': {
601
- '.ss__dropdown__content': {
602
- bottom: '0',
603
- top: 'auto',
604
- left: '-15px',
605
- width: mobile ? '100vw' : '600px',
606
- zIndex: 100,
607
- background: 'white',
608
- borderTop: '1px solid #ddd',
609
- },
610
- },
611
- },
612
- '.ss__chat__facets': {
613
- '.ss__chat__facets__header': {
614
- display: 'flex',
615
- flexDirection: mobile ? 'column' : 'row',
616
- justifyContent: 'space-between',
617
- alignItems: 'center',
618
- padding: '10px',
619
- '.ss__chat__facets__header__title': {
620
- width: mobile ? '100%' : undefined,
621
- fontSize: '18px',
622
- fontWeight: 'bold',
623
- color: '#333',
624
- order: mobile ? 1 : 0,
625
- marginTop: mobile ? '10px' : 0,
626
- },
627
- '.ss__chat__facets__close': {
628
- order: mobile ? 0 : 1,
629
- display: 'flex',
630
- justifyContent: mobile ? 'center' : 'flex-end',
631
- '.ss__chat__facets__close__button': {
632
- width: mobile ? '100px' : '20px',
633
- borderRadius: mobile ? '4px' : undefined,
634
- background: mobile ? '#ccc' : 'none',
635
- padding: '5px',
636
- flexGrow: 0,
637
- border: 'none',
638
- '.ss__icon': {
639
- display: mobile ? 'none' : 'inline',
640
- },
641
- },
642
- },
643
- },
644
- '.ss__chat__facets__wrapper': {
645
- padding: '10px',
646
- display: 'flex',
647
- flexDirection: 'column',
648
- gap: '10px',
649
- '.ss__chat__facets__facet': {
650
- display: 'flex',
651
- justifyContent: 'flex-start',
652
- alignItems: 'center',
653
- '.ss__chat__facets__facet__label': {
654
- fontWeight: 'bold',
655
- fontSize: '14px',
656
- marginRight: '10px',
657
- },
658
- '.ss__chat__facets__facet__options': {
659
- display: 'flex',
660
- gap: '5px',
661
- overflowX: 'scroll',
662
- '.ss__chat__facets__facet__options__option': {
663
- flexGrow: 0,
664
- },
665
- },
666
- },
667
- },
668
- },
669
- '.ss__chat__actions__facets-header': {
670
- display: 'flex',
671
- justifyContent: 'space-between',
672
- alignItems: 'center',
673
- },
674
- '.ss__chat__actions__facets-apply': {
675
- display: 'flex',
676
- justifyContent: 'flex-end',
677
- padding: '0 2px',
678
- '.ss__button': {
679
- background: '#253B80',
680
- color: '#fff',
681
- border: 'none',
682
- borderRadius: '999px',
683
- padding: '6px 16px',
684
- fontSize: '14px',
685
- cursor: 'pointer',
686
- '&:not(.ss__button--disabled):hover': {
687
- background: '#1a2a5c',
688
- },
689
- '&.ss__button--disabled': {
690
- opacity: 0.5,
691
- cursor: 'not-allowed',
692
- },
693
- },
694
- },
695
- '@keyframes ss-chat-dot-pulse': {
696
- '0%, 80%, 100%': {
697
- transform: 'scale(0.6)',
698
- opacity: 0.5,
699
- },
700
- '40%': {
701
- transform: 'scale(1)',
702
- opacity: 1,
703
- },
704
- },
705
- '.ss__chat__attachment-context': {
706
- display: 'flex',
707
- flexDirection: 'column',
708
- gap: '6px',
709
- padding: '8px 10px',
710
- background: '#f4f4ff',
711
- border: '1px solid #e3e3f5',
712
- borderRadius: '8px',
713
- '.ss__chat__attachment-context__label': {
714
- fontSize: '14px',
715
- display: 'flex',
716
- alignItems: 'center',
717
- justifyContent: 'space-between',
718
- gap: '8px',
719
- '.ss__chat__attachment-context__label__close': {
720
- display: 'flex',
721
- alignItems: 'center',
722
- justifyContent: 'center',
723
- cursor: 'pointer',
724
- flex: '0 0 auto',
725
- },
726
- },
727
- '.ss__chat__attachment-context__items': {
728
- display: 'flex',
729
- flexWrap: 'wrap',
730
- gap: '6px',
731
- },
732
- '.ss__chat__attachment-context__item': {
733
- display: 'flex',
734
- alignItems: 'center',
735
- gap: '6px',
736
- padding: '3px 8px 3px 3px',
737
- background: '#fff',
738
- border: '1px solid #ddd',
739
- borderRadius: '999px',
740
- maxWidth: 'calc(50% - 3px)',
741
- position: 'relative',
742
- '.ss__chat__attachment-context__item__content': {
743
- display: 'flex',
744
- alignItems: 'center',
745
- justifyContent: 'center',
746
- flex: '0 0 auto',
747
- '.ss__image': {
748
- width: '30px',
749
- height: '30px',
750
- margin: 0,
751
- img: {
752
- width: '30px',
753
- height: '30px',
754
- borderRadius: '50%',
755
- objectFit: 'cover',
756
- },
757
- },
758
- },
759
- '.ss__chat__attachment-context__item__name': {
760
- fontSize: '14px',
761
- color: '#333',
762
- whiteSpace: 'nowrap',
763
- overflow: 'hidden',
764
- textOverflow: 'ellipsis',
765
- flex: '1 1 auto',
766
- minWidth: 0,
767
- },
768
- '.ss__chat__attachment-context__item__remove': {
769
- width: '18px',
770
- height: '18px',
771
- minWidth: 'auto',
772
- margin: 0,
773
- padding: 0,
774
- background: 'none',
775
- border: 'none',
776
- display: 'flex',
777
- alignItems: 'center',
778
- justifyContent: 'center',
779
- cursor: 'pointer',
780
- flex: '0 0 auto',
781
- svg: {
782
- fill: '#6A7282',
783
- stroke: '#6A7282',
784
- },
785
- '&:hover': {
786
- svg: {
787
- fill: '#000',
788
- stroke: '#000',
789
- },
790
- },
791
- },
792
- '.ss__chat__attachment-context__item__loading': {
793
- display: 'flex',
794
- gap: '3px',
795
- margin: 0,
796
- '.ss__chat__loading__dot': {
797
- width: '5px',
798
- height: '5px',
799
- borderRadius: '50%',
800
- backgroundColor: '#ccc',
801
- animation: 'ss-chat-dot-pulse 1.4s infinite ease-in-out both',
802
- '&:nth-of-type(1)': {
803
- animationDelay: '-0.32s',
804
- },
805
- '&:nth-of-type(2)': {
806
- animationDelay: '-0.16s',
807
- },
808
- },
809
- },
810
- '&.error': {
811
- border: '1px solid #dc3545',
812
- background: '#fff5f5',
813
- '.ss__chat__attachment-context__item__error-icon': {
814
- fontSize: '14px',
815
- color: '#dc3545',
816
- margin: '0 4px',
817
- flex: '0 0 auto',
818
- },
819
- '.ss__chat__attachment-context__item__error-message': {
820
- fontSize: '12px',
821
- color: '#dc3545',
822
- whiteSpace: 'normal',
823
- wordBreak: 'break-word',
824
- flex: '1 1 auto',
825
- minWidth: 0,
826
- },
827
- '.ss__button': {
828
- svg: {
829
- fill: '#dc3545',
830
- stroke: '#dc3545',
831
- },
832
- },
833
- },
834
- img: {
835
- '&.loading': {
836
- opacity: 0.3,
837
- },
838
- },
839
- },
840
- },
841
- '.ss__chat__content__footer': {
842
- padding: '1em',
843
- display: 'flex',
844
- flexDirection: 'column',
845
- gap: '8px',
846
- flexShrink: 0,
847
- ...(mobile
848
- ? {
849
- position: 'relative',
850
- zIndex: 11,
851
- background: '#fff',
852
- }
853
- : {}),
854
- },
855
- '.ss__chat__topic-drift': {
856
- display: 'flex',
857
- alignItems: 'center',
858
- gap: '12px',
859
- padding: '12px 16px',
860
- border: '1px solid #93C5FD',
861
- borderRadius: '8px',
862
- backgroundColor: '#fff',
863
- '.ss__chat__topic-drift__icon--info': {
864
- flex: '0 0 auto',
865
- fill: colorPrimary,
866
- stroke: colorPrimary,
867
- svg: {
868
- fill: colorPrimary,
869
- stroke: colorPrimary,
870
- },
871
- },
872
- '.ss__chat__topic-drift__text': {
873
- flex: '1 1 0%',
874
- display: 'flex',
875
- flexDirection: 'column',
876
- gap: '2px',
877
- 'span:first-of-type': {
878
- fontWeight: 'bold',
879
- color: colorPrimary,
880
- fontSize: '14px',
881
- },
882
- 'span:last-of-type': {
883
- color: '#6A7282',
884
- fontSize: '13px',
885
- },
886
- },
887
- '.ss__chat__topic-drift__button': {
888
- flex: '0 0 auto',
889
- backgroundColor: colorPrimary,
890
- color: '#fff',
891
- borderRadius: '6px',
892
- padding: '8px 14px',
893
- fontSize: '13px',
894
- fontWeight: 500,
895
- cursor: 'pointer',
896
- whiteSpace: 'nowrap',
897
- '&:not(.ss__button--disabled):hover': {
898
- background: '#1a2a5c',
899
- },
900
- },
901
- '.ss__chat__topic-drift__icon--close': {
902
- flex: '0 0 auto',
903
- cursor: 'pointer',
904
- fill: '#6A7282',
905
- stroke: '#6A7282',
906
- svg: {
907
- fill: '#6A7282',
908
- stroke: '#6A7282',
909
- },
910
- },
911
- },
912
- '.ss__chat__input': {
913
- display: 'flex',
914
- justifyContent: 'space-between',
915
- gap: '8px',
916
- flexShrink: 0,
917
- '.ss__chat__input__input': {
918
- flex: '1 1 0%',
919
- minWidth: 0,
920
- border: '1px solid #ccc',
921
- borderRadius: '2em',
922
- display: 'flex',
923
- justifyContent: 'space-between',
924
- overflow: 'auto',
925
- 'input[type="text"]': {
926
- padding: '0.5em 0',
927
- margin: '0 0 0 1em',
928
- flex: '1 0 auto',
929
- '&::placeholder': {
930
- color: '#999',
931
- opacity: 0.7,
932
- },
933
- '&:focus': {
934
- outline: 'none',
935
- borderColor: '#0066cc',
936
- },
937
- },
938
- '.ss__button': {
939
- margin: '0 0.5em 0 0',
940
- '&:hover': {
941
- backgroundColor: 'transparent',
942
- },
943
- },
944
- 'input[type="file"]': {
945
- display: 'none',
946
- },
947
- },
948
- '.ss__chat__input__actions': {
949
- '.ss__button': {
950
- backgroundColor: colorPrimary,
951
- borderRadius: '50%',
952
- height: '3em',
953
- width: '3em',
954
- cursor: 'pointer',
955
- justifyContent: 'center',
956
- '&:disabled': {
957
- opacity: 0.5,
958
- cursor: 'not-allowed',
959
- },
960
- svg: {
961
- fill: '#fff',
962
- stroke: '#fff',
963
- },
964
- },
965
- },
966
- },
967
- '.ss__chat__disclaimer': {
968
- fontSize: '10px',
969
- color: '#6A7282',
970
- textAlign: 'center',
971
- flexShrink: 0,
972
- },
973
- },
974
- });
975
- };
976
- export const Chat = observer((properties) => {
977
- const globalTheme = useTheme();
978
- const globalTreePath = useTreePath();
979
- const isMobile = useMediaQuery('(max-width: 767px)');
980
- const defaultProps = {
981
- treePath: globalTreePath,
982
- logo: 'https://cdn.athoscommerce.net/snap/images/Athos%20Commerce_Icon_white.svg',
983
- title: 'Athos Conversational Assistant',
984
- subtitle: 'Ready to assist you',
985
- multiselectFacets: true,
986
- };
987
- let props = mergeProps('facets', globalTheme, defaultProps, properties);
988
- const { className, internalClassName, controller, logo, title, subtitle, offset, multiselectFacets } = props;
989
- const { store } = controller;
990
- const themeDefaults = {
991
- components: {},
992
- };
993
- // merge deeply the themeDefaults with the theme props and the displaySettings theme props (do not merge arrays, but replace them)
994
- const theme = deepmerge(themeDefaults, props?.theme || {}, { arrayMerge: (destinationArray, sourceArray) => sourceArray });
995
- props = {
996
- ...props,
997
- theme,
998
- };
999
- const fileInputRef = useRef(null);
1000
- const messagesEndRef = useRef(null);
1001
- const messagesContainerRef = useRef(null);
1002
- const footerRef = useRef(null);
1003
- // Swipe-to-dismiss state for mobile secondary panel
1004
- const secondaryRef = useRef(null);
1005
- const swipeStartY = useRef(0);
1006
- const swipeStartTime = useRef(0);
1007
- const swipeActive = useRef(false);
1008
- const swipeOffsetRef = useRef(0);
1009
- const [swipeOffset, setSwipeOffsetRaw] = useState(0);
1010
- const [swipeAnimating, setSwipeAnimating] = useState(false);
1011
- const [mobileProductInfoOpen, setMobileProductInfoOpen] = useState(false);
1012
- const [footerHeight, setFooterHeight] = useState(0);
1013
- const updateSwipeOffset = (value) => {
1014
- swipeOffsetRef.current = value;
1015
- setSwipeOffsetRaw(value);
1016
- };
1017
- const scrollToBottom = () => {
1018
- messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
1019
- };
1020
- // Auto-scroll to bottom when new messages are added or chat state changes
1021
- useEffect(() => {
1022
- // if (store.open && messagesContainerRef.current) {
1023
- // messagesContainerRef.current.scrollTop = messagesContainerRef.current.scrollHeight;
1024
- // }
1025
- if (store.open) {
1026
- scrollToBottom();
1027
- }
1028
- }, [store.currentChat?.chat.length, store.loading, store.open]);
1029
- // const subProps: ChatSubProps = {};
1030
- const activeMessage = store.currentChat?.activeMessage;
1031
- // On mobile, only auto-open the secondary panel for the first productComparison
1032
- // message in the chat session. Subsequent comparison results show a "Show Details"
1033
- // button instead (handled in MessageText via sideChatLabel toggle).
1034
- const isFirstMobileComparison = (() => {
1035
- if (!isMobile || activeMessage?.messageType !== 'productComparison')
1036
- return true;
1037
- // If the user explicitly activated a comparison (via "Show Details" or the
1038
- // view-side-chat button), always allow it regardless of position in the chat
1039
- if (store.currentChat?.activeMessageId)
1040
- return true;
1041
- const comparisonMessages = (store.currentChat?.chat || []).filter((m) => m.messageType === 'productComparison');
1042
- return comparisonMessages.length <= 1;
1043
- })();
1044
- const sideChatTypes = isMobile
1045
- ? ['inspirationResult', ...(isFirstMobileComparison ? ['productComparison'] : []), ...(mobileProductInfoOpen ? ['productQuery'] : [])]
1046
- : ['inspirationResult', 'productComparison', 'productQuery'];
1047
- const shouldShowSideChat = activeMessage && sideChatTypes.includes(activeMessage?.messageType) && store.currentChat?.dismissedSideChatMessageId !== activeMessage.id;
1048
- const styling = mergeStyles({ mobile: isMobile, offset, hasSideChat: !!shouldShowSideChat, footerHeight }, defaultStyles);
1049
- // Lock body scroll while chat is open so touch/wheel scrolls don't leak to the page behind
1050
- useEffect(() => {
1051
- if (!store.open)
1052
- return;
1053
- const body = document.body;
1054
- const previousOverflow = body.style.overflow;
1055
- const previousOverscroll = body.style.overscrollBehavior;
1056
- body.style.overflow = 'hidden';
1057
- body.style.overscrollBehavior = 'contain';
1058
- return () => {
1059
- body.style.overflow = previousOverflow;
1060
- body.style.overscrollBehavior = previousOverscroll;
1061
- };
1062
- }, [store.open]);
1063
- // Track the primary footer height so the mobile secondary panel can sit above it
1064
- useEffect(() => {
1065
- const el = footerRef.current;
1066
- if (!el)
1067
- return;
1068
- const observer = new ResizeObserver((entries) => {
1069
- for (const entry of entries) {
1070
- setFooterHeight(entry.borderBoxSize?.[0]?.blockSize ?? entry.target.getBoundingClientRect().height);
1071
- }
1072
- });
1073
- observer.observe(el);
1074
- return () => observer.disconnect();
1075
- }, [store.open, store.currentChat?.isExpired]);
1076
- const HistoryButton = (props) => (_jsx(Button, { className: "ss__chat__header__button--history", disabled: props.disabled, icon: {
1077
- icon: 'history',
1078
- title: 'Chat History',
1079
- } }));
1080
- const HistoryPopup = (props) => (_jsxs("div", { className: "ss__chat__history", children: [_jsxs("div", { className: "ss__chat__history__header", children: [_jsx("h4", { children: "History" }), _jsx("div", { className: "ss__chat__history__header__buttons", children: _jsx(Button, { content: "clear", onClick: () => {
1081
- controller.store.clearHistory();
1082
- props.toggleOpen && props.toggleOpen();
1083
- } }) })] }), store.chats.length > 0 ? (_jsx("div", { className: "ss__chat__history__chats", children: store.chats.map((chat) => (_jsx("div", { className: "ss__chat__history__chats__chat", children: _jsxs(Button, { className: "ss__chat__history__chat__button", onClick: () => {
1084
- controller.store.switchChat(chat.id);
1085
- }, disabled: chat.id === store.currentChatId, children: [_jsx("div", { className: "ss__chat__history__chat__button__text", children: (() => {
1086
- const lastUserMessage = [...chat.chat].reverse().find((message) => message.messageType === 'user');
1087
- if (!lastUserMessage)
1088
- return 'New Chat';
1089
- const text = lastUserMessage.text;
1090
- return text.length > 50 ? `${text.slice(0, 50)}...` : text;
1091
- })() }), _jsx("div", { className: "ss__chat__history__chat__button__date", children: chat.createdAt.toLocaleString() })] }) }, chat.id))) })) : null] }));
1092
- const FacetButton = (props) => _jsx(Button, { icon: props.open ? 'angle-down' : 'angle-up', children: props.label });
1093
- // TODO: if starting a new chat and it's expired, this button would then disappear
1094
- if (!controller.store.chatEnabled) {
1095
- return _jsx(_Fragment, {});
1096
- }
1097
- // Reset swipe state when secondary panel opens/closes or active message changes
1098
- useEffect(() => {
1099
- updateSwipeOffset(0);
1100
- setSwipeAnimating(false);
1101
- swipeActive.current = false;
1102
- }, [shouldShowSideChat, activeMessage?.id]);
1103
- const onSwipeStart = (e) => {
1104
- swipeStartY.current = e.touches[0].clientY;
1105
- swipeStartTime.current = Date.now();
1106
- swipeActive.current = false; // only activate after dead-zone threshold
1107
- setSwipeAnimating(false);
1108
- };
1109
- const onSwipeMove = (e) => {
1110
- const diff = e.touches[0].clientY - swipeStartY.current;
1111
- // Require a minimum drag distance before activating the swipe,
1112
- // so taps on buttons (e.g. close) still fire their click events.
1113
- if (!swipeActive.current) {
1114
- if (Math.abs(diff) < 8)
1115
- return; // still within dead-zone
1116
- swipeActive.current = true;
1117
- }
1118
- if (diff > 0) {
1119
- e.preventDefault();
1120
- updateSwipeOffset(diff);
1121
- }
1122
- else {
1123
- updateSwipeOffset(0);
1124
- }
1125
- };
1126
- const onSwipeEnd = () => {
1127
- if (!swipeActive.current)
1128
- return;
1129
- swipeActive.current = false;
1130
- const offset = swipeOffsetRef.current;
1131
- const height = secondaryRef.current?.offsetHeight || 400;
1132
- const elapsed = Date.now() - swipeStartTime.current;
1133
- const velocity = offset / (elapsed || 1); // px per ms
1134
- // Dismiss if dragged past 25% threshold OR a quick flick (>0.5 px/ms with >50px travel)
1135
- const shouldDismiss = offset > height * 0.25 || (velocity > 0.5 && offset > 50);
1136
- if (shouldDismiss) {
1137
- // Animate out then dismiss
1138
- setSwipeAnimating(true);
1139
- updateSwipeOffset(height);
1140
- setTimeout(() => {
1141
- const attachments = store.currentChat?.attachments.attached || [];
1142
- const productAttachments = attachments.filter((item) => item.type === 'product' && item.requestType !== 'productSimilar' && item.requestType !== 'productComparison');
1143
- productAttachments.forEach((item) => store.currentChat?.attachments.remove(item.id));
1144
- setMobileProductInfoOpen(false);
1145
- store.currentChat?.dismissSideChat();
1146
- updateSwipeOffset(0);
1147
- setSwipeAnimating(false);
1148
- }, 300);
1149
- }
1150
- else {
1151
- // Snap back
1152
- setSwipeAnimating(true);
1153
- updateSwipeOffset(0);
1154
- setTimeout(() => setSwipeAnimating(false), 300);
1155
- }
1156
- };
1157
- const requestType = store.currentChat?.requestType;
1158
- const loadingVerbs = useMemo(() => {
1159
- switch (requestType) {
1160
- case 'productQuery':
1161
- return ['Thinking', 'Searching', 'Analyzing', 'Gathering details'];
1162
- case 'productSearch':
1163
- return ['Searching', 'Browsing catalog', 'Finding products', 'Curating results'];
1164
- case 'productComparison':
1165
- return ['Comparing', 'Analyzing', 'Evaluating', 'Weighing options'];
1166
- case 'imageSearch':
1167
- return ['Analyzing image', 'Identifying', 'Searching', 'Matching'];
1168
- case 'productSimilar':
1169
- return ['Finding similar items', 'Searching', 'Matching', 'Curating'];
1170
- case 'inspirationRequest':
1171
- return ['Brainstorming', 'Imagining', 'Curating', 'Inspiring'];
1172
- case 'general':
1173
- default:
1174
- return undefined;
1175
- }
1176
- }, [requestType]);
1177
- return (_jsx(CacheProvider, { children: _jsxs(_Fragment, { children: [_jsxs("div", { className: classnames('ss__chat', {
1178
- 'ss__chat--open': store.open,
1179
- 'ss__chat--minimized': !store.open,
1180
- 'ss__chat--mobile': isMobile,
1181
- }, className, internalClassName), ...styling, children: [!store.open && !store.currentChat && store.suggestedQuestions?.length > 0 && (_jsx("div", { className: "ss__chat__suggested-questions", children: store.suggestedQuestions.map((question, index) => (_jsx("div", { className: "ss__chat__suggested-questions__item", onClick: () => {
1182
- controller.openChat(question);
1183
- }, children: question }, index))) })), _jsx("div", { className: 'ss__chat__bubble', onClick: () => controller.handlers.button.click(), children: _jsx(Icon, { icon: "chat", title: "Open Chat" }) }), store.open && shouldShowSideChat && activeMessage ? (_jsxs("div", { ref: secondaryRef, className: classnames('ss__chat__secondary'), style: isMobile
1184
- ? {
1185
- // Touch swipe animations need to be inline to prevent visual jumps
1186
- transform: swipeOffset > 0 ? `translateY(${swipeOffset}px)` : undefined,
1187
- transition: swipeAnimating ? 'transform 0.3s ease-out' : 'none',
1188
- }
1189
- : undefined, children: [isMobile && (_jsx("div", { className: "ss__chat__secondary__drag-handle", onTouchStart: onSwipeStart, onTouchMove: onSwipeMove, onTouchEnd: onSwipeEnd, children: _jsx("div", { className: "ss__chat__secondary__drag-handle__indicator" }) })), _jsxs("div", { className: 'ss__chat__header', onTouchStart: isMobile ? onSwipeStart : undefined, onTouchMove: isMobile ? onSwipeMove : undefined, onTouchEnd: isMobile ? onSwipeEnd : undefined, children: [_jsxs("div", { className: "ss__chat__header__title", children: [_jsx("div", { className: "ss__chat__header__title__primary", children: {
1190
- inspirationResult: 'Inspiration Scenarios',
1191
- productComparison: 'Product Comparison',
1192
- productQuery: 'Product Information',
1193
- }[activeMessage.messageType] || null }), _jsx("div", { className: "ss__chat__header__title__secondary", children: {
1194
- inspirationResult: 'Choose a style direction to explore',
1195
- productComparison: `Comparing ${activeMessage?.comparisonData?.features.length ||
1196
- activeMessage?.searchResults?.length} products`,
1197
- productQuery: 'Complete product details',
1198
- }[activeMessage.messageType] || null })] }), _jsx("div", { className: "ss__chat__header__buttons", children: _jsx(Button, { className: "ss__chat__header__button--close", icon: { icon: 'close2', title: 'Close Chat' }, onClick: () => {
1199
- // clear any product attachments tied to the side chat (discuss product flow)
1200
- // so the attachments bar disappears alongside the secondary panel
1201
- // but preserve productComparison attachments so the user can continue comparing
1202
- const productAttachmentsToRemove = (store.currentChat?.attachments.attached || []).filter((item) => item.type === 'product' &&
1203
- item.requestType !== 'productSimilar' &&
1204
- item.requestType !== 'productComparison');
1205
- productAttachmentsToRemove.forEach((item) => store.currentChat?.attachments.remove(item.id));
1206
- setMobileProductInfoOpen(false);
1207
- store.currentChat?.dismissSideChat();
1208
- } }) })] }), _jsx("div", { className: "ss__chat__content", children: _jsx("div", { className: 'ss__chat__messages', children: {
1209
- inspirationResult: (_jsx(ChatInspirationResultMessage, { chatItem: activeMessage, controller: controller, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined })),
1210
- productComparison: (_jsx(ChatProductComparisonMessage, { chatItem: activeMessage, controller: controller })),
1211
- productQuery: (_jsx(ChatProductQueryMessage, { chatItem: activeMessage, controller: controller, displayFields: controller.config.settings?.displayFields })),
1212
- }[activeMessage.messageType] || null }) })] })) : null, store.open ? (_jsxs("div", { className: 'ss__chat__primary', children: [_jsxs("div", { className: 'ss__chat__header', children: [_jsxs("div", { className: "ss__chat__header__title", children: [logo ? _jsx("img", { className: "ss__chat__header__title__logo", src: logo }) : null, _jsxs("div", { className: "ss__chat__header__title__text", children: [title ? _jsx("div", { className: "ss__chat__header__title__text__primary", children: title }) : null, subtitle ? _jsx("div", { className: "ss__chat__header__title__text__secondary", children: subtitle }) : null] })] }), _jsxs("div", { className: "ss__chat__header__buttons", children: [_jsx(Button
1213
- // disabled={store.currentChat?.chat && store.currentChat.chat.length <= 1}
1214
- , {
1215
- // disabled={store.currentChat?.chat && store.currentChat.chat.length <= 1}
1216
- className: "ss__chat__header__button--new", icon: { icon: controller.store.initChatLoading ? 'spinner' : 'plus2', title: 'New Chat' }, onClick: () => controller.store.createChat() }), store.chats.length > 1 && (_jsx(Dropdown, { disabled: store.chats.length == 1 && store.currentChat && store.currentChat.chat.length <= 1, className: "ss__chat__header__dropdown-history", button: _jsx(HistoryButton, {}), children: _jsx(HistoryPopup, {}) })), _jsx(Button, { className: "ss__chat__header__button--close", icon: { icon: 'close2', title: 'Close Chat' }, onClick: () => controller.handlers.button.click() })] })] }), (() => {
1217
- const feedbackAfterMessages = controller.config.settings?.feedbackAfterMessages;
1218
- const systemMessages = (store.currentChat?.chat || []).filter((msg) => msg.messageType !== 'user' && msg.messageType !== 'productQuery');
1219
- const currentRating = store.currentChat?.sessionFeedback?.rating;
1220
- const hasRated = !!currentRating;
1221
- const shouldShowFeedback = feedbackAfterMessages &&
1222
- systemMessages.length >= feedbackAfterMessages &&
1223
- !store.currentChat?.feedbackDismissed &&
1224
- (!hasRated || store.currentChat?.feedbackJustGiven);
1225
- return shouldShowFeedback ? (_jsxs("div", { className: "ss__chat__session-feedback", children: [_jsx("div", { className: "ss__chat__session-feedback__icon", children: _jsx(Icon, { icon: "chat", size: "16px" }) }), _jsx("span", { className: "ss__chat__session-feedback__label", children: hasRated ? 'Thank you for your feedback' : "How's your experience so far?" }), _jsxs("div", { className: `ss__chat__session-feedback__actions${hasRated ? ' ss__chat__session-feedback__actions--rated' : ''}`, children: [(!hasRated || currentRating === 'UP') && (_jsx("span", { onClick: () => !hasRated && controller.handleFeedback('UP'), children: _jsx(Icon, { icon: 'thumbs-up', title: 'Thumbs Up' }) })), (!hasRated || currentRating === 'DOWN') && (_jsx("span", { onClick: () => !hasRated && controller.handleFeedback('DOWN'), children: _jsx(Icon, { icon: 'thumbs-down', title: 'Thumbs Down' }) }))] }), !hasRated && (_jsx("span", { className: "ss__chat__session-feedback__close", onClick: () => {
1226
- if (store.currentChat) {
1227
- store.currentChat.feedbackDismissed = true;
1228
- store.currentChat.save();
1229
- }
1230
- }, children: _jsx(Icon, { icon: "close-thin", size: "14px" }) }))] })) : null;
1231
- })(), _jsxs("div", { className: "ss__chat__content", children: [_jsx("div", { className: "ss__chat__content__header", children: store.currentChat?.comparisons.compared && store.currentChat.comparisons.compared.length > 0 && (_jsxs("div", { className: 'ss__chat__content__header__comparisons', children: [_jsxs("div", { className: 'ss__chat__content__header__comparisons__header', children: [_jsxs("div", { className: 'ss__chat__content__header__comparisons__header__title', children: [_jsx(Icon, { className: 'ss__chat__content__header__comparisons__header__title__icon', icon: 'clipboard' }), _jsxs("span", { className: 'ss__chat__content__header__comparisons__header__title__text', children: ["Compare Products (", store.currentChat?.comparisons.compared.length, "/", store.currentChat?.comparisons.maxItems, ")"] })] }), _jsx("div", { className: 'ss__chat__content__header__comparisons__header__actions', children: _jsx(Button, { onClick: () => store.currentChat?.comparisons.reset(), children: "clear" }) })] }), _jsxs("div", { className: 'ss__chat__content__header__comparisons__content', children: [_jsx("div", { className: 'ss__chat__content__header__comparisons__content__items', children: Array.from({ length: store.currentChat?.comparisons.maxItems }).map((_, index) => {
1232
- const comparisonItem = store.currentChat?.comparisons.compared[index];
1233
- return (_jsx("div", { className: classnames('ss__chat__content__header__comparisons__content__comparison', {
1234
- 'ss__chat__content__header__comparisons__content__comparison--placeholder': !comparisonItem,
1235
- }), children: comparisonItem ? (_jsxs(_Fragment, { children: [_jsx(Image
1236
- // onClick={() => {
1237
- // controller?.viewProduct(product as any);
1238
- // }}
1239
- , {
1240
- // onClick={() => {
1241
- // controller?.viewProduct(product as any);
1242
- // }}
1243
- alt: (comparisonItem?.result?.display || comparisonItem?.result)?.mappings?.core?.name || '', src: (comparisonItem?.result?.display || comparisonItem?.result)?.mappings?.core?.imageUrl || '' }), _jsx("div", { className: "ss__chat__content__header__comparisons__content__comparison__remove", onClick: () => {
1244
- store.currentChat?.comparisons.remove(comparisonItem.result.id);
1245
- }, children: _jsx(Icon, { icon: 'close-thin', size: '12px' }) })] })) : (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: 'plus-thin' }), _jsx("div", { className: 'ss__chat__content__header__comparisons__content__comparison--placeholder__text', children: "Add" })] })) }, index));
1246
- }) }), _jsx("div", { className: classnames('ss__chat__content__header__comparisons__action', {
1247
- 'ss__chat__content__header__comparisons__action--hidden': (store.currentChat?.comparisons.compared.length || 0) < 2,
1248
- }), children: _jsx(Button, { onClick: () => controller.search(), icon: { icon: 'compare', title: 'Compare' }, children: "Compare" }) })] })] })) }), _jsxs("div", { className: 'ss__chat__messages', ref: messagesContainerRef, children: [(!store.currentChat?.chat || store.currentChat.chat.length === 0) && store.welcomeMessage && (_jsxs("div", { className: "ss__chat__welcome", children: [_jsx("div", { className: "ss__chat__welcome__message", children: store.welcomeMessage }), _jsx(SuggestedQuestions, { questions: store.suggestedQuestions, controller: controller })] })), store.currentChat?.chat
1249
- .filter((chatItem) => chatItem.messageType !== 'productQuery')
1250
- .map((chatItem, index) => (_jsx("div", { className: `ss__chat__message ss__chat__message--${chatItem.messageType}`, children: {
1251
- user: (_jsx(MessageUser, { chatItem: chatItem, controller: controller, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined })),
1252
- text: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined, sideChatOpen: !!shouldShowSideChat })),
1253
- content: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined, sideChatOpen: !!shouldShowSideChat })),
1254
- productSearchResult: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined, sideChatOpen: !!shouldShowSideChat })),
1255
- inspirationResult: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined, sideChatOpen: !!shouldShowSideChat })),
1256
- productAnswer: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined, sideChatOpen: !!shouldShowSideChat })),
1257
- productComparison: (() => {
1258
- // On mobile, only the first productComparison in the session
1259
- // auto-opens the secondary panel. Subsequent ones get a
1260
- // prominent "Show Details" button instead.
1261
- const comparisonMessages = (store.currentChat?.chat || []).filter((m) => m.messageType === 'productComparison');
1262
- const isFirst = comparisonMessages.length > 0 && comparisonMessages[0].id === chatItem.id;
1263
- return (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined, showDetailsButton: isMobile && !isFirst, sideChatOpen: !!shouldShowSideChat }));
1264
- })(),
1265
- productRecommendation: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, onViewProduct: isMobile ? () => setMobileProductInfoOpen(true) : undefined, sideChatOpen: !!shouldShowSideChat })),
1266
- actions: _jsx(SuggestedQuestions, { actions: chatItem.actions, controller: controller }),
1267
- errorResponse: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, sideChatOpen: !!shouldShowSideChat })),
1268
- topicDrift: (_jsx(MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottom, sideChatOpen: !!shouldShowSideChat })),
1269
- productQuery: null,
1270
- }[chatItem.messageType] || null }, index))), _jsx("div", { className: "ss__chat__messages__end", ref: messagesEndRef })] }), _jsx(ChatLoadingIndicator, { loading: store.loading, verbs: loadingVerbs }), !store.currentChat?.isExpired ? (_jsxs("div", { className: "ss__chat__content__footer", ref: footerRef, children: [store.error && _jsx("div", { className: "ss__chat__error", children: store.error.message }), store.currentChat?.sessionLimitReached && (_jsxs("div", { className: 'ss__chat__topic-drift', children: [_jsx(Icon, { icon: "info", size: "18px", className: 'ss__chat__topic-drift__icon--info' }), _jsxs("div", { className: 'ss__chat__topic-drift__text', children: [_jsx("span", { children: "Session limit reached" }), _jsx("span", { children: "This chat has reached its maximum number of interactions. Start a new session to continue." })] }), _jsx(Button, { className: 'ss__chat__topic-drift__button', onClick: () => {
1271
- controller.store.createChat();
1272
- }, children: "New Session" })] })), store.currentChat?.actions && store.currentChat.actions.length > 0 && (_jsx("div", { className: 'ss__chat__actions', children: store.currentChat?.actions.map((action, index) => (_jsx("div", { className: "ss__chat__actions__wrap", children: {
1273
- facets: action.data.length ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "ss__chat__actions__facets-header", children: [_jsx("div", { className: "ss__chat__actions--title", children: "Filter by:" }), multiselectFacets && (store.currentChat?.attachments.attached.some((item) => item.type === 'facet') || false) && (_jsx("div", { className: "ss__chat__actions__facets-apply", children: _jsx(Button, { onClick: () => {
1274
- controller.search();
1275
- }, children: "Apply Filters" }) }))] }), _jsx("div", { className: "ss__chat__actions--facets", children: action.data.slice(0, 10).map((facet, idx) => {
1276
- if (!facet.values?.length)
1277
- return null;
1278
- return (_jsx("div", { className: `ss__chat__actions__facet ss__chat__actions__facet--${facet.type}`, children: _jsx(Dropdown, { usePortal: true, dropUp: true, button: _jsx(FacetButton, { label: facet.label || facet.field }), style: {
1279
- '.ss__dropdown__content': {
1280
- width: '150px',
1281
- maxHeight: '200px',
1282
- overflowY: 'auto',
1283
- background: 'white',
1284
- boxShadow: '0px 3px 6px 0px rgba(0, 0, 0, 0.2)',
1285
- borderRadius: '6px',
1286
- ...(multiselectFacets
1287
- ? {
1288
- '.ss__chat__actions__facet__option--checkbox': {
1289
- display: 'flex',
1290
- alignItems: 'center',
1291
- gap: '8px',
1292
- padding: '6px 10px',
1293
- cursor: 'pointer',
1294
- width: '100%',
1295
- boxSizing: 'border-box',
1296
- background: '#fff',
1297
- border: 'none',
1298
- borderBottom: '1px solid #f0f0f0',
1299
- '&:hover': {
1300
- background: '#f4f4ff',
1301
- },
1302
- '&:last-child': {
1303
- borderBottom: 'none',
1304
- },
1305
- '.ss__chat__actions__facet__option__checkbox': {
1306
- width: '16px',
1307
- height: '16px',
1308
- borderRadius: '3px',
1309
- border: '2px solid #ccc',
1310
- display: 'flex',
1311
- alignItems: 'center',
1312
- justifyContent: 'center',
1313
- flexShrink: 0,
1314
- '&.ss__chat__actions__facet__option__checkbox--checked': {
1315
- background: '#253B80',
1316
- borderColor: '#253B80',
1317
- },
1318
- },
1319
- '.ss__chat__actions__facet__option__label': {
1320
- fontSize: '14px',
1321
- color: '#333',
1322
- flex: '1 1 auto',
1323
- textAlign: 'left',
1324
- },
1325
- },
1326
- }
1327
- : {
1328
- '.ss__button': {
1329
- width: '100%',
1330
- border: 'none',
1331
- borderRadius: 0,
1332
- boxSizing: 'border-box',
1333
- background: '#fff',
1334
- '&:hover': {
1335
- background: '#f4f4ff',
1336
- },
1337
- },
1338
- }),
1339
- },
1340
- }, children: _jsx("div", { className: "ss__chat__actions__facet__options", children: facet.type === 'range-buckets'
1341
- ? facet.values.map((option) => {
1342
- const optionValue = `${option.low ?? '*'}:${option.high ?? '*'}`;
1343
- if (multiselectFacets) {
1344
- const isSelected = controller.store.isFacetSelected(facet.field, optionValue);
1345
- return (_jsxs("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: () => {
1346
- if (isSelected) {
1347
- controller.store.removeFacet(facet.field, optionValue);
1348
- }
1349
- else {
1350
- controller.store.addFacet({
1351
- key: facet.field,
1352
- facetLabel: facet.label,
1353
- value: optionValue,
1354
- label: option.label,
1355
- count: option.count,
1356
- });
1357
- }
1358
- }, children: [_jsx("div", { className: classnames('ss__chat__actions__facet__option__checkbox', {
1359
- 'ss__chat__actions__facet__option__checkbox--checked': isSelected,
1360
- }), children: isSelected && _jsx(Icon, { icon: "check-thin", size: "10px" }) }), _jsx("span", { className: "ss__chat__actions__facet__option__label", children: option.label })] }, optionValue));
1361
- }
1362
- return (_jsx(Button, { onClick: () => {
1363
- controller.store.addFacet({
1364
- key: facet.field,
1365
- facetLabel: facet.label,
1366
- value: optionValue,
1367
- label: option.label,
1368
- count: option.count,
1369
- });
1370
- controller.search();
1371
- }, children: option.label }, optionValue));
1372
- })
1373
- : facet.values.map((option) => {
1374
- const optionValue = option.value || option.label;
1375
- if (multiselectFacets) {
1376
- const isSelected = controller.store.isFacetSelected(facet.field, optionValue);
1377
- return (_jsxs("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: () => {
1378
- if (isSelected) {
1379
- controller.store.removeFacet(facet.field, optionValue);
1380
- }
1381
- else {
1382
- controller.store.addFacet({
1383
- key: facet.field,
1384
- facetLabel: facet.label,
1385
- value: optionValue,
1386
- label: option.label,
1387
- count: option.count,
1388
- });
1389
- }
1390
- }, children: [_jsx("div", { className: classnames('ss__chat__actions__facet__option__checkbox', {
1391
- 'ss__chat__actions__facet__option__checkbox--checked': isSelected,
1392
- }), children: isSelected && _jsx(Icon, { icon: "check-thin", size: "10px" }) }), _jsx("span", { className: "ss__chat__actions__facet__option__label", children: option.label })] }, optionValue));
1393
- }
1394
- return (_jsx(Button, { onClick: () => {
1395
- controller.store.addFacet({
1396
- key: facet.field,
1397
- facetLabel: facet.label,
1398
- value: optionValue,
1399
- label: option.label,
1400
- count: option.count,
1401
- });
1402
- controller.search();
1403
- }, children: option.label }, optionValue));
1404
- }) }) }, facet.field) }, idx));
1405
- }) })] })) : null,
1406
- actions: (_jsx("div", { className: "ss__chat__actions--suggested" })),
1407
- }[action.type] || null }, index))) })), (() => {
1408
- const activeComparisonSearchResults = shouldShowSideChat && activeMessage?.messageType === 'productComparison'
1409
- ? activeMessage.searchResults || []
1410
- : null;
1411
- const showCommittedComparisons = !activeComparisonSearchResults &&
1412
- store.currentChat?.comparisons.committed &&
1413
- store.currentChat.comparisons.committed.length > 0 &&
1414
- (activeMessage?.messageType === 'user' ||
1415
- activeMessage?.messageType === 'productComparison' ||
1416
- activeMessage?.messageType === 'productQuery');
1417
- const visibleAttachments = store.currentChat?.attachments.attached.filter((item) => item.state === 'attached' || item.state === 'active' || item.state === 'loading' || item.state === 'error') || [];
1418
- const productAttachments = visibleAttachments.filter((item) => item.type === 'product' &&
1419
- item.requestType !== 'productSimilar' &&
1420
- item.requestType !== 'productComparison');
1421
- const imageAttachments = visibleAttachments.filter((item) => item.type === 'image');
1422
- const comparisonItems = activeComparisonSearchResults
1423
- ? activeComparisonSearchResults.map((result) => {
1424
- const d = result?.display || result;
1425
- return {
1426
- id: result?.id,
1427
- name: d?.mappings?.core?.name || '',
1428
- imageUrl: d?.mappings?.core?.thumbnailImageUrl || d?.mappings?.core?.imageUrl || '',
1429
- onClick: isMobile
1430
- ? () => {
1431
- controller.viewProduct(result);
1432
- setMobileProductInfoOpen(true);
1433
- }
1434
- : undefined,
1435
- };
1436
- })
1437
- : showCommittedComparisons
1438
- ? (store.currentChat?.comparisons.committed || []).map((comparisonItem) => {
1439
- const d = comparisonItem?.result?.display || comparisonItem?.result;
1440
- return {
1441
- id: comparisonItem.result?.id,
1442
- name: d?.mappings?.core?.name || '',
1443
- imageUrl: d?.mappings?.core?.thumbnailImageUrl || d?.mappings?.core?.imageUrl || '',
1444
- onClick: isMobile
1445
- ? () => {
1446
- controller.viewProduct(comparisonItem.result);
1447
- setMobileProductInfoOpen(true);
1448
- }
1449
- : undefined,
1450
- };
1451
- })
1452
- : [];
1453
- const productItems = productAttachments.map((item) => ({
1454
- id: item.id,
1455
- name: item.name || '',
1456
- imageUrl: item.thumbnailUrl || '',
1457
- onClick: isMobile
1458
- ? () => {
1459
- setMobileProductInfoOpen(true);
1460
- }
1461
- : () => {
1462
- store.currentChat?.setActiveMessage(store.currentChat?.activeMessage?.id || '');
1463
- },
1464
- onRemove: () => {
1465
- store.currentChat?.attachments.remove(item.id);
1466
- setMobileProductInfoOpen(false);
1467
- store.currentChat?.dismissSideChat();
1468
- },
1469
- }));
1470
- const imageItems = imageAttachments.map((item) => ({
1471
- id: item.id,
1472
- name: item.fileName || 'Image',
1473
- imageUrl: item.base64 || item.thumbnailUrl || '',
1474
- isLoading: item.state === 'loading',
1475
- hasError: !!item.error,
1476
- errorMessage: item.error?.message,
1477
- onRemove: () => store.currentChat?.attachments.remove(item.id),
1478
- }));
1479
- const productTitle = productItems.length > 1 ? 'Compare these products' : 'Ask about this product' + (isMobile ? '' : ' (click for details)');
1480
- const hasImageError = imageItems.some((item) => item.hasError);
1481
- const imageTitle = imageItems.length > 0 && !hasImageError ? 'Find products similar to this image:' : '';
1482
- return (_jsxs(_Fragment, { children: [comparisonItems.length > 0 && (_jsx(ChatAttachmentContext, { title: 'Compare these products', items: comparisonItems, onClose: () => {
1483
- store.currentChat?.comparisons.resetCommitted();
1484
- store.currentChat?.dismissSideChat();
1485
- } })), productItems.length > 0 && (_jsx(ChatAttachmentContext, { title: productTitle, items: productItems, onClose: () => {
1486
- productAttachments.forEach((item) => store.currentChat?.attachments.remove(item.id));
1487
- setMobileProductInfoOpen(false);
1488
- store.currentChat?.dismissSideChat();
1489
- } })), imageItems.length > 0 && _jsx(ChatAttachmentContext, { title: imageTitle, items: imageItems })] }));
1490
- })(), (() => {
1491
- const drift = store.currentChat?.topicDrift;
1492
- if (!drift)
1493
- return null;
1494
- // recommendedAction is the prescription; driftType is the diagnosis.
1495
- // Hide the banner when the backend says to keep flowing, or when no drift was detected.
1496
- if (drift.recommendedAction === 'CONTINUE' || drift.driftType === 'NO_DRIFT')
1497
- return null;
1498
- const isScopeRedirect = drift.recommendedAction === 'SCOPE_REDIRECT';
1499
- const primaryText = isScopeRedirect ? "I'm here to help with shopping" : 'Looking for something new?';
1500
- const secondaryText = isScopeRedirect
1501
- ? 'Try asking about products, comparisons, or recommendations'
1502
- : 'Start a fresh session for better assistance, or keep going in this one?';
1503
- const buttonText = isScopeRedirect ? '' : 'New Session';
1504
- return (_jsxs("div", { className: 'ss__chat__topic-drift', children: [_jsx(Icon, { icon: "info", size: "18px", className: 'ss__chat__topic-drift__icon--info' }), _jsxs("div", { className: 'ss__chat__topic-drift__text', children: [_jsx("span", { children: primaryText }), _jsx("span", { children: secondaryText })] }), buttonText && (_jsx(Button, { className: 'ss__chat__topic-drift__button', onClick: () => {
1505
- if (isScopeRedirect) {
1506
- store.currentChat?.dismissTopicDrift();
1507
- return;
1508
- }
1509
- const messageText = store.currentChat?.handleTopicDrift();
1510
- if (messageText) {
1511
- controller.store.createChat();
1512
- }
1513
- }, children: buttonText })), _jsx("span", { onClick: () => {
1514
- store.currentChat?.dismissTopicDrift();
1515
- }, children: _jsx(Icon, { icon: "close-thin", size: "14px", className: 'ss__chat__topic-drift__icon--close' }) })] }));
1516
- })(), _jsxs("div", { className: 'ss__chat__input', children: [_jsxs("div", { className: 'ss__chat__input__input', children: [_jsx("input", { type: "text", name: "ss-chat-input", disabled: store.loading || store.blocked || store.currentChat?.sessionLimitReached, placeholder: (() => {
1517
- const comparedCount = store.currentChat?.comparisons.compared.length || 0;
1518
- const committedCount = store.currentChat?.comparisons.committed.length || 0;
1519
- const attached = store.currentChat?.attachments.attached.filter((item) => item.state === 'attached' || item.state === 'active') || [];
1520
- const attachedProducts = attached.filter((item) => item.type === 'product');
1521
- const attachedImages = attached.filter((item) => item.type === 'image' && !item.error);
1522
- if (attachedProducts.length === 1) {
1523
- return 'Ask about this product...';
1524
- }
1525
- if (comparedCount > 1 || attachedProducts.length > 1) {
1526
- return 'What would you like to compare?';
1527
- }
1528
- if (committedCount > 0) {
1529
- return 'Ask about the compared products...';
1530
- }
1531
- if (attachedImages.length > 0) {
1532
- return 'Ask about this image...';
1533
- }
1534
- if (comparedCount === 1) {
1535
- return 'Add another product to compare...';
1536
- }
1537
- return 'Type your message...';
1538
- })(), onInput: (e) => controller.handlers.input.input(e), onKeyDown: (e) => {
1539
- controller.handlers.input.enterKey(e);
1540
- if (e.keyCode === 13 && isMobile && mobileProductInfoOpen) {
1541
- setMobileProductInfoOpen(false);
1542
- }
1543
- }, value: controller.store.inputValue }), store.features.imageSearch.enabled && (_jsxs(_Fragment, { children: [_jsx(Button, { className: 'ss__chat__upload-button', disabled: store.loading || store.blocked || store.currentChat?.sessionLimitReached, onClick: () => fileInputRef.current?.click(), icon: { icon: 'image', title: 'Upload Image' } }), _jsx("input", { ref: fileInputRef, onChange: async (e) => {
1544
- await controller.upload(e.target.files);
1545
- // reset value
1546
- e.target.value = '';
1547
- }, multiple: true, type: "file", accept: "image/*", className: "ss__chat__input__input__file" })] }))] }), _jsx("div", { className: 'ss__chat__input__actions', children: (() => {
1548
- const hasImageAttachment = (store.currentChat?.attachments.attached || []).some((item) => item.type === 'image' && !item.error);
1549
- const messageEmpty = !controller.store.inputValue.trim();
1550
- const sendDisabled = store.blocked || store.currentChat?.sessionLimitReached || (hasImageAttachment && messageEmpty);
1551
- return (_jsx(Button, { className: "ss__chat__send-button", icon: { icon: 'send', title: 'Send Message' }, disabled: sendDisabled, onClick: () => {
1552
- if (sendDisabled)
1553
- return;
1554
- controller.search();
1555
- if (isMobile && mobileProductInfoOpen) {
1556
- setMobileProductInfoOpen(false);
1557
- }
1558
- } }));
1559
- })() })] }), _jsx("div", { className: 'ss__chat__disclaimer', children: _jsxs("i", { children: ["Powered by Athos Commerce. AI-powered assistant. It sometimes make mistakes. Avoid sharing personal data.", ' ', _jsx("a", { href: "https://athoscommerce.com/legal/privacy-policy/", target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })] }) })] })) : (_jsx("div", { children: "This chat is expired. Please start a new chat." }))] })] })) : null] }), _jsx(Overlay, { style: { zIndex: 1001 }, color: "transparent", active: store.open, onClick: () => controller.handlers.button.click() })] }) }));
1560
- });