@athoscommerce/snap-preact 1.2.2 → 1.2.3-beta.1

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 (233) 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/ChatLoadingIndicator/ChatLoadingIndicator.d.ts +7 -0
  4. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.d.ts.map +1 -0
  5. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.js +85 -0
  6. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts +2 -0
  7. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts.map +1 -0
  8. package/dist/cjs/components/src/components/Atoms/ChatLoadingIndicator/index.js +17 -0
  9. package/dist/cjs/components/src/components/Atoms/Dropdown/Dropdown.d.ts +1 -0
  10. package/dist/cjs/components/src/components/Atoms/Dropdown/Dropdown.d.ts.map +1 -1
  11. package/dist/cjs/components/src/components/Atoms/Dropdown/Dropdown.js +30 -13
  12. package/dist/cjs/components/src/components/Atoms/Icon/paths.d.ts +21 -0
  13. package/dist/cjs/components/src/components/Atoms/Icon/paths.d.ts.map +1 -1
  14. package/dist/cjs/components/src/components/Atoms/Icon/paths.js +21 -0
  15. package/dist/cjs/components/src/components/Molecules/CalloutBadge/CalloutBadge.js +2 -2
  16. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +18 -0
  17. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -0
  18. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +115 -0
  19. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts +2 -0
  20. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts.map +1 -0
  21. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/index.js +17 -0
  22. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts +17 -0
  23. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts.map +1 -0
  24. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +106 -0
  25. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts +2 -0
  26. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts.map +1 -0
  27. package/dist/cjs/components/src/components/Molecules/ChatProductComparisonMessage/index.js +17 -0
  28. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +23 -0
  29. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -0
  30. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +445 -0
  31. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts +2 -0
  32. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts.map +1 -0
  33. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/index.js +17 -0
  34. package/dist/cjs/components/src/components/Molecules/OverlayBadge/OverlayBadge.js +2 -2
  35. package/dist/cjs/components/src/components/Molecules/Result/Result.d.ts +3 -3
  36. package/dist/cjs/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
  37. package/dist/cjs/components/src/components/Molecules/Result/Result.js +4 -4
  38. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts +2 -0
  39. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
  40. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.js +19 -2
  41. package/dist/cjs/components/src/components/Molecules/Slideout/Slideout.d.ts.map +1 -1
  42. package/dist/cjs/components/src/components/Molecules/Slideout/Slideout.js +30 -12
  43. package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts +14 -0
  44. package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -0
  45. package/dist/cjs/components/src/components/Organisms/Chat/Chat.js +1619 -0
  46. package/dist/cjs/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts +19 -0
  47. package/dist/cjs/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts.map +1 -0
  48. package/dist/cjs/components/src/components/Organisms/Chat/ChatAttachmentContext.js +22 -0
  49. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts +12 -0
  50. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -0
  51. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.js +158 -0
  52. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts +13 -0
  53. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts.map +1 -0
  54. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.js +170 -0
  55. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts +11 -0
  56. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -0
  57. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.js +192 -0
  58. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +11 -0
  59. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -0
  60. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.js +86 -0
  61. package/dist/cjs/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts +12 -0
  62. package/dist/cjs/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts.map +1 -0
  63. package/dist/cjs/components/src/components/Organisms/Chat/SuggestedQuestions.js +73 -0
  64. package/dist/cjs/components/src/components/Organisms/Chat/index.d.ts +2 -0
  65. package/dist/cjs/components/src/components/Organisms/Chat/index.d.ts.map +1 -0
  66. package/dist/cjs/components/src/components/Organisms/Chat/index.js +17 -0
  67. package/dist/cjs/components/src/components/Organisms/FacetsHorizontal/FacetsHorizontal.js +2 -2
  68. package/dist/cjs/components/src/components/Organisms/MobileSidebar/MobileSidebar.d.ts +1 -0
  69. package/dist/cjs/components/src/components/Organisms/MobileSidebar/MobileSidebar.d.ts.map +1 -1
  70. package/dist/cjs/components/src/components/Organisms/MobileSidebar/MobileSidebar.js +2 -2
  71. package/dist/cjs/components/src/components/Organisms/Results/Results.js +1 -1
  72. package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.d.ts.map +1 -1
  73. package/dist/cjs/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +2 -0
  74. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  75. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +2 -0
  76. package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.d.ts.map +1 -1
  77. package/dist/cjs/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +2 -0
  78. package/dist/cjs/components/src/components/Templates/Search/Search.d.ts +2 -2
  79. package/dist/cjs/components/src/components/Templates/Search/Search.d.ts.map +1 -1
  80. package/dist/cjs/components/src/hooks/useLayoutOptions.d.ts.map +1 -1
  81. package/dist/cjs/components/src/hooks/useLayoutOptions.js +21 -11
  82. package/dist/cjs/components/src/index.d.ts +1 -0
  83. package/dist/cjs/components/src/index.d.ts.map +1 -1
  84. package/dist/cjs/components/src/index.js +1 -0
  85. package/dist/cjs/components/src/providers/themeComponents.d.ts +50 -16
  86. package/dist/cjs/components/src/providers/themeComponents.d.ts.map +1 -1
  87. package/dist/cjs/components/src/providers/withTracking.d.ts +2 -2
  88. package/dist/cjs/components/src/providers/withTracking.d.ts.map +1 -1
  89. package/dist/cjs/components/src/types.d.ts +2 -0
  90. package/dist/cjs/components/src/types.d.ts.map +1 -1
  91. package/dist/cjs/src/Snap.d.ts +2 -1
  92. package/dist/cjs/src/Snap.d.ts.map +1 -1
  93. package/dist/cjs/src/Snap.js +124 -24
  94. package/dist/cjs/src/Templates/SnapTemplates.d.ts +12 -2
  95. package/dist/cjs/src/Templates/SnapTemplates.d.ts.map +1 -1
  96. package/dist/cjs/src/Templates/SnapTemplates.js +54 -1
  97. package/dist/cjs/src/Templates/Stores/LibraryStore.d.ts +4 -0
  98. package/dist/cjs/src/Templates/Stores/LibraryStore.d.ts.map +1 -1
  99. package/dist/cjs/src/Templates/Stores/LibraryStore.js +19 -0
  100. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts +5 -2
  101. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  102. package/dist/cjs/src/Templates/Stores/TemplateStore.js +1 -0
  103. package/dist/cjs/src/Templates/Stores/library/components/Chat.d.ts +2 -0
  104. package/dist/cjs/src/Templates/Stores/library/components/Chat.d.ts.map +1 -0
  105. package/dist/cjs/src/Templates/Stores/library/components/Chat.js +5 -0
  106. package/dist/cjs/src/Templates/Stores/library/languages/es.d.ts.map +1 -1
  107. package/dist/cjs/src/Templates/Stores/library/languages/es.js +5 -0
  108. package/dist/cjs/src/Templates/Stores/library/languages/fr.d.ts.map +1 -1
  109. package/dist/cjs/src/Templates/Stores/library/languages/fr.js +5 -0
  110. package/dist/cjs/src/create/createChatController.d.ts +5 -0
  111. package/dist/cjs/src/create/createChatController.d.ts.map +1 -0
  112. package/dist/cjs/src/create/createChatController.js +43 -0
  113. package/dist/cjs/src/setupEvents.d.ts.map +1 -1
  114. package/dist/cjs/src/setupEvents.js +39 -0
  115. package/dist/cjs/src/types.d.ts +15 -3
  116. package/dist/cjs/src/types.d.ts.map +1 -1
  117. package/dist/esm/components/src/components/Atoms/Button/Button.d.ts +1 -1
  118. package/dist/esm/components/src/components/Atoms/Button/Button.d.ts.map +1 -1
  119. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.d.ts +7 -0
  120. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.d.ts.map +1 -0
  121. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/ChatLoadingIndicator.js +67 -0
  122. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts +2 -0
  123. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/index.d.ts.map +1 -0
  124. package/dist/esm/components/src/components/Atoms/ChatLoadingIndicator/index.js +1 -0
  125. package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.d.ts +1 -0
  126. package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.d.ts.map +1 -1
  127. package/dist/esm/components/src/components/Atoms/Dropdown/Dropdown.js +33 -9
  128. package/dist/esm/components/src/components/Atoms/Icon/paths.d.ts +21 -0
  129. package/dist/esm/components/src/components/Atoms/Icon/paths.d.ts.map +1 -1
  130. package/dist/esm/components/src/components/Atoms/Icon/paths.js +21 -0
  131. package/dist/esm/components/src/components/Molecules/CalloutBadge/CalloutBadge.js +1 -1
  132. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +18 -0
  133. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -0
  134. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +109 -0
  135. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts +2 -0
  136. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/index.d.ts.map +1 -0
  137. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/index.js +1 -0
  138. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts +17 -0
  139. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.d.ts.map +1 -0
  140. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage.js +85 -0
  141. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts +2 -0
  142. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/index.d.ts.map +1 -0
  143. package/dist/esm/components/src/components/Molecules/ChatProductComparisonMessage/index.js +1 -0
  144. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +23 -0
  145. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -0
  146. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +421 -0
  147. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts +2 -0
  148. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.d.ts.map +1 -0
  149. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/index.js +1 -0
  150. package/dist/esm/components/src/components/Molecules/OverlayBadge/OverlayBadge.js +1 -1
  151. package/dist/esm/components/src/components/Molecules/Result/Result.d.ts +3 -3
  152. package/dist/esm/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
  153. package/dist/esm/components/src/components/Molecules/Result/Result.js +2 -2
  154. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts +2 -0
  155. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
  156. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.js +35 -2
  157. package/dist/esm/components/src/components/Molecules/Slideout/Slideout.d.ts.map +1 -1
  158. package/dist/esm/components/src/components/Molecules/Slideout/Slideout.js +30 -12
  159. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts +14 -0
  160. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -0
  161. package/dist/esm/components/src/components/Organisms/Chat/Chat.js +1560 -0
  162. package/dist/esm/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts +19 -0
  163. package/dist/esm/components/src/components/Organisms/Chat/ChatAttachmentContext.d.ts.map +1 -0
  164. package/dist/esm/components/src/components/Organisms/Chat/ChatAttachmentContext.js +16 -0
  165. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts +12 -0
  166. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -0
  167. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.js +143 -0
  168. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts +13 -0
  169. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts.map +1 -0
  170. package/dist/esm/components/src/components/Organisms/Chat/MessageText.js +152 -0
  171. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts +11 -0
  172. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -0
  173. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.js +164 -0
  174. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +11 -0
  175. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -0
  176. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.js +70 -0
  177. package/dist/esm/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts +12 -0
  178. package/dist/esm/components/src/components/Organisms/Chat/SuggestedQuestions.d.ts.map +1 -0
  179. package/dist/esm/components/src/components/Organisms/Chat/SuggestedQuestions.js +58 -0
  180. package/dist/esm/components/src/components/Organisms/Chat/index.d.ts +2 -0
  181. package/dist/esm/components/src/components/Organisms/Chat/index.d.ts.map +1 -0
  182. package/dist/esm/components/src/components/Organisms/Chat/index.js +1 -0
  183. package/dist/esm/components/src/components/Organisms/FacetsHorizontal/FacetsHorizontal.js +2 -2
  184. package/dist/esm/components/src/components/Organisms/MobileSidebar/MobileSidebar.d.ts +1 -0
  185. package/dist/esm/components/src/components/Organisms/MobileSidebar/MobileSidebar.d.ts.map +1 -1
  186. package/dist/esm/components/src/components/Organisms/MobileSidebar/MobileSidebar.js +2 -2
  187. package/dist/esm/components/src/components/Organisms/Results/Results.js +1 -1
  188. package/dist/esm/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.d.ts.map +1 -1
  189. package/dist/esm/components/src/components/Templates/AutocompleteFixed/AutocompleteFixed.js +3 -0
  190. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  191. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +3 -0
  192. package/dist/esm/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.d.ts.map +1 -1
  193. package/dist/esm/components/src/components/Templates/AutocompleteSlideout/AutocompleteSlideout.js +3 -0
  194. package/dist/esm/components/src/components/Templates/Search/Search.d.ts +2 -2
  195. package/dist/esm/components/src/components/Templates/Search/Search.d.ts.map +1 -1
  196. package/dist/esm/components/src/hooks/useLayoutOptions.d.ts.map +1 -1
  197. package/dist/esm/components/src/hooks/useLayoutOptions.js +21 -11
  198. package/dist/esm/components/src/index.d.ts +1 -0
  199. package/dist/esm/components/src/index.d.ts.map +1 -1
  200. package/dist/esm/components/src/index.js +1 -0
  201. package/dist/esm/components/src/providers/themeComponents.d.ts +50 -16
  202. package/dist/esm/components/src/providers/themeComponents.d.ts.map +1 -1
  203. package/dist/esm/components/src/providers/withTracking.d.ts +2 -2
  204. package/dist/esm/components/src/providers/withTracking.d.ts.map +1 -1
  205. package/dist/esm/components/src/types.d.ts +2 -0
  206. package/dist/esm/components/src/types.d.ts.map +1 -1
  207. package/dist/esm/src/Snap.d.ts +2 -1
  208. package/dist/esm/src/Snap.d.ts.map +1 -1
  209. package/dist/esm/src/Snap.js +59 -0
  210. package/dist/esm/src/Templates/SnapTemplates.d.ts +12 -2
  211. package/dist/esm/src/Templates/SnapTemplates.d.ts.map +1 -1
  212. package/dist/esm/src/Templates/SnapTemplates.js +43 -0
  213. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts +4 -0
  214. package/dist/esm/src/Templates/Stores/LibraryStore.d.ts.map +1 -1
  215. package/dist/esm/src/Templates/Stores/LibraryStore.js +6 -0
  216. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts +5 -2
  217. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  218. package/dist/esm/src/Templates/Stores/TemplateStore.js +1 -0
  219. package/dist/esm/src/Templates/Stores/library/components/Chat.d.ts +2 -0
  220. package/dist/esm/src/Templates/Stores/library/components/Chat.d.ts.map +1 -0
  221. package/dist/esm/src/Templates/Stores/library/components/Chat.js +1 -0
  222. package/dist/esm/src/Templates/Stores/library/languages/es.d.ts.map +1 -1
  223. package/dist/esm/src/Templates/Stores/library/languages/es.js +5 -0
  224. package/dist/esm/src/Templates/Stores/library/languages/fr.d.ts.map +1 -1
  225. package/dist/esm/src/Templates/Stores/library/languages/fr.js +5 -0
  226. package/dist/esm/src/create/createChatController.d.ts +5 -0
  227. package/dist/esm/src/create/createChatController.d.ts.map +1 -0
  228. package/dist/esm/src/create/createChatController.js +29 -0
  229. package/dist/esm/src/setupEvents.d.ts.map +1 -1
  230. package/dist/esm/src/setupEvents.js +23 -0
  231. package/dist/esm/src/types.d.ts +15 -3
  232. package/dist/esm/src/types.d.ts.map +1 -1
  233. package/package.json +13 -12
@@ -0,0 +1,19 @@
1
+ export type ChatAttachmentContextItem = {
2
+ id: string;
3
+ name: string;
4
+ imageUrl?: string;
5
+ isLoading?: boolean;
6
+ hasError?: boolean;
7
+ errorMessage?: string;
8
+ onClick?: () => void;
9
+ onRemove?: () => void;
10
+ };
11
+ export type ChatAttachmentContextProps = {
12
+ title: string;
13
+ items: ChatAttachmentContextItem[];
14
+ onClose?: () => void;
15
+ };
16
+ export declare const ChatAttachmentContext: ((props: ChatAttachmentContextProps) => JSX.Element) & {
17
+ displayName: string;
18
+ };
19
+ //# sourceMappingURL=ChatAttachmentContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatAttachmentContext.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/ChatAttachmentContext.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,yBAAyB,GAAG;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,yBAAyB,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAoB,0BAA0B,KAAG,GAAG,CAAC,OAAO;;CA8D5F,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { observer } from 'mobx-react-lite';
3
+ import classnames from 'classnames';
4
+ import { Image } from '../../Atoms/Image';
5
+ import { Button } from '../../Atoms/Button';
6
+ import { Icon } from '../../Atoms/Icon';
7
+ export const ChatAttachmentContext = observer((props) => {
8
+ const { title, items, onClose } = props;
9
+ if (!items || items.length === 0) {
10
+ return _jsx(_Fragment, {});
11
+ }
12
+ return (_jsxs("div", { className: 'ss__chat__attachment-context', children: [_jsxs("div", { className: 'ss__chat__attachment-context__label', children: [_jsx("span", { children: title }), onClose && (_jsx("div", { className: 'ss__chat__attachment-context__label__close', onClick: onClose, children: _jsx(Icon, { icon: 'close-thin', size: '12px' }) }))] }), _jsx("div", { className: 'ss__chat__attachment-context__items', children: items.map((item) => (_jsxs("div", { className: classnames('ss__chat__attachment-context__item', { error: item.hasError, clickable: !!item.onClick }), onClick: item.onClick, style: item.onClick ? { cursor: 'pointer' } : undefined, children: [item.hasError ? (_jsxs(_Fragment, { children: [_jsx("div", { className: 'ss__chat__attachment-context__item__error-icon', children: "\u26A0" }), _jsx("div", { className: 'ss__chat__attachment-context__item__error-message', children: item.errorMessage || `Upload Failed - ${item.name}` })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: 'ss__chat__attachment-context__item__content', children: [item.imageUrl && _jsx(Image, { className: item.isLoading ? 'loading' : '', src: item.imageUrl, alt: item.name }), item.isLoading && (_jsxs("div", { className: 'ss__chat__attachment-context__item__loading', children: [_jsx("div", { className: 'ss__chat__loading__dot' }), _jsx("div", { className: 'ss__chat__loading__dot' }), _jsx("div", { className: 'ss__chat__loading__dot' })] }))] }), _jsx("div", { className: 'ss__chat__attachment-context__item__name', title: item.name, children: item.name })] })), item.onRemove && (items.length > 1 || !onClose) && (_jsx(Button, { className: 'ss__chat__attachment-context__item__remove', onClick: () => !item.isLoading && item.onRemove?.(), icon: {
13
+ icon: 'close-thin',
14
+ size: '0.6em',
15
+ } }))] }, item.id))) })] }));
16
+ });
@@ -0,0 +1,12 @@
1
+ import { ChatController } from '@athoscommerce/snap-controller';
2
+ import { Product } from '@athoscommerce/snap-store-mobx';
3
+ import { ComponentProps } from '../../../types';
4
+ export declare const ChatResult: ((properties: ChatResultProps) => JSX.Element) & {
5
+ displayName: string;
6
+ };
7
+ export interface ChatResultProps extends ComponentProps {
8
+ result: Product;
9
+ controller: ChatController;
10
+ scrollToBottom: () => void;
11
+ }
12
+ //# sourceMappingURL=ChatResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatResult.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/ChatResult.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAMzD,OAAO,EAAE,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAyG7D,eAAO,MAAM,UAAU,gBAAyB,eAAe,KAAG,GAAG,CAAC,OAAO;;CAiG3E,CAAC;AAMH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACtD,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;CAC3B"}
@@ -0,0 +1,143 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { observer } from 'mobx-react-lite';
3
+ import { Image } from '../../Atoms/Image';
4
+ import { Button } from '../../Atoms/Button';
5
+ import { mergeProps, mergeStyles } from '../../../utilities';
6
+ import { css, useTheme, useTreePath, useSnap } from '../../../providers';
7
+ import { CalloutBadge, OverlayBadge, Price } from '../../..';
8
+ import { useComponent } from '../../../hooks';
9
+ const defaultStyles = () => {
10
+ return css({
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ height: '100%',
14
+ width: '100%',
15
+ boxSizing: 'border-box',
16
+ border: '1px solid #e5e7eb',
17
+ borderRadius: '1em',
18
+ overflow: 'hidden',
19
+ '.ss__chat__result__image': {
20
+ width: '100%',
21
+ position: 'relative',
22
+ overflow: 'hidden',
23
+ '.ss__chat__result__image__buttons': {
24
+ position: 'absolute',
25
+ bottom: 0,
26
+ width: '100%',
27
+ display: 'flex',
28
+ justifyContent: 'center',
29
+ gap: '0.5em',
30
+ padding: '0.5em',
31
+ '.ss__button': {
32
+ padding: '0.25em 0.5em',
33
+ background: 'rgba(255, 255, 255, 0.9)',
34
+ textAlign: 'center',
35
+ justifyContent: 'center',
36
+ borderRadius: '2em',
37
+ boxShadow: 'inset 0 0 1px 0px rgba(0, 0, 0, 0.5)',
38
+ flex: '1 1 0',
39
+ minWidth: 0,
40
+ fontWeight: 'bold',
41
+ whiteSpace: 'nowrap',
42
+ overflow: 'hidden',
43
+ textOverflow: 'ellipsis',
44
+ },
45
+ },
46
+ '.ss__chat__result__image__icons': {
47
+ position: 'absolute',
48
+ top: 0,
49
+ left: 0,
50
+ right: 0,
51
+ display: 'flex',
52
+ flexDirection: 'row',
53
+ justifyContent: 'space-between',
54
+ gap: '0.5em',
55
+ padding: '0.5em',
56
+ flex: '0 0 auto',
57
+ alignItems: 'flex-start',
58
+ '.ss__button': {
59
+ height: '2.5em',
60
+ width: '2.5em',
61
+ backgroundColor: '#000',
62
+ borderRadius: '50%',
63
+ justifyContent: 'center',
64
+ '&.ss__chat__result__image__icons__icon--cart': {
65
+ backgroundColor: '#feeeae',
66
+ svg: {
67
+ fill: '#000',
68
+ stroke: '#000',
69
+ },
70
+ },
71
+ svg: {
72
+ fill: '#fff',
73
+ stroke: '#fff',
74
+ },
75
+ },
76
+ },
77
+ },
78
+ '.ss__chat__result__content': {
79
+ background: '#f9fafb',
80
+ display: 'flex',
81
+ flexDirection: 'column',
82
+ gap: '0.5em',
83
+ flex: '1 1 auto',
84
+ padding: '0.5em 0',
85
+ '.ss__chat__result__content__title--primary': {
86
+ padding: '0 0.5em',
87
+ },
88
+ '.ss__chat__result__content__title--secondary': {
89
+ padding: '0 0.5em',
90
+ color: '#6A7282',
91
+ fontSize: '90%',
92
+ },
93
+ '.ss__chat__result__content__price': {
94
+ padding: '0 0.5em',
95
+ color: '#000',
96
+ fontWeight: 'bold',
97
+ fontSize: '1.2em',
98
+ marginTop: 'auto',
99
+ },
100
+ },
101
+ });
102
+ };
103
+ export const ChatResult = observer((properties) => {
104
+ const globalTheme = useTheme();
105
+ const globalTreePath = useTreePath();
106
+ const snap = useSnap();
107
+ const defaultProps = {
108
+ treePath: globalTreePath,
109
+ };
110
+ const props = mergeProps('chatResult', globalTheme, defaultProps, properties);
111
+ const { controller, result, scrollToBottom, customComponent } = props;
112
+ if (customComponent) {
113
+ const ComponentOverride = useComponent(snap?.templates?.library.import.component.result || {}, customComponent);
114
+ if (ComponentOverride) {
115
+ return _jsx(ComponentOverride, { ...props });
116
+ }
117
+ }
118
+ const isInComparison = controller.store.currentChat?.comparisons.items.some((item) => item.result?.id === result.id);
119
+ const subProps = {
120
+ button: {
121
+ // component theme overrides
122
+ theme: props.theme,
123
+ // treePath,
124
+ },
125
+ image: {
126
+ lazy: false,
127
+ onLoad: scrollToBottom,
128
+ // component theme overrides
129
+ theme: props.theme,
130
+ // treePath,
131
+ },
132
+ };
133
+ const styling = mergeStyles(properties, defaultStyles);
134
+ return (_jsxs("div", { className: "ss__chat__result", ...styling, children: [_jsxs("div", { className: "ss__chat__result__image", children: [_jsx(OverlayBadge, { controller: controller, result: result, renderEmpty: true, children: _jsx(Image, { className: 'ss__chat__result__detail-slot__image', alt: result.display.mappings.core?.name || '', src: result.display.mappings.core?.imageUrl || '', ...subProps.image }) }), _jsxs("div", { className: "ss__chat__result__image__buttons", children: [controller.store.features.similarProducts.enabled && (_jsx(Button, { className: 'ss__chat__result__image__buttons__similar', content: 'Similar', onClick: () => {
135
+ controller.discussProduct(result, { requestType: 'productSimilar' });
136
+ } })), _jsx(Button, { className: 'ss__chat__result__image__buttons__compare', content: isInComparison ? undefined : 'Compare', icon: isInComparison ? { icon: 'check-thin', title: 'Added to comparison' } : undefined, onClick: () => {
137
+ controller.compareProduct(result);
138
+ } })] }), _jsxs("div", { className: "ss__chat__result__image__icons", children: [_jsx(Button, { className: 'ss__chat__result__image__icons__icon--inquire', icon: { icon: 'chat', title: 'Discuss Product' }, onClick: () => {
139
+ controller.discussProduct(result, { requestType: 'productQuery' });
140
+ } }), _jsx(Button, { className: 'ss__chat__result__image__icons__icon--cart', icon: { icon: 'cart', title: 'Add to Cart' }, onClick: () => {
141
+ controller.addToCart(result);
142
+ } })] })] }), _jsxs("div", { className: "ss__chat__result__content", children: [result.display.mappings.core?.name && _jsx("div", { className: "ss__chat__result__content__title--primary", children: result.display.mappings.core?.name }), result.display.mappings.core?.price && (_jsx("div", { className: "ss__chat__result__content__price", children: _jsx(Price, { value: result.display.mappings.core?.price }) })), _jsx(CalloutBadge, { controller: controller, result: result })] })] }));
143
+ });
@@ -0,0 +1,13 @@
1
+ import { ChatController } from '@athoscommerce/snap-controller';
2
+ export declare const MessageText: ((props: MessageTextProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
3
+ displayName: string;
4
+ };
5
+ export interface MessageTextProps {
6
+ chatItem: any;
7
+ controller: ChatController;
8
+ scrollToBottom: () => void;
9
+ onViewProduct?: () => void;
10
+ showDetailsButton?: boolean;
11
+ sideChatOpen?: boolean;
12
+ }
13
+ //# sourceMappingURL=MessageText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageText.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/MessageText.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AA0HhE,eAAO,MAAM,WAAW,WAAoB,gBAAgB;;CA2D1D,CAAC;AAqCH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,cAAc,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB"}
@@ -0,0 +1,152 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { observer } from 'mobx-react-lite';
3
+ import classnames from 'classnames';
4
+ import { ResultsDisplay } from './ResultsDisplay';
5
+ import { marked } from 'marked';
6
+ import { css } from '../../..';
7
+ import { mergeStyles } from '../../../utilities';
8
+ import { Button } from '../../Atoms/Button';
9
+ const defaultStyles = () => {
10
+ return css({
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ justifyContent: 'flex-start',
14
+ gap: '5px',
15
+ background: '#fff',
16
+ padding: '1em',
17
+ borderRadius: '1em',
18
+ borderBottomLeftRadius: '3px',
19
+ '.ss__chat__message-text__text-wrapper': {
20
+ display: 'flex',
21
+ flexDirection: 'row',
22
+ justifyContent: 'flex-start',
23
+ alignItems: 'center',
24
+ gap: '8px',
25
+ '.ss__chat__message-text__text-wrapper__text': {
26
+ alignSelf: 'flex-end',
27
+ },
28
+ '.ss__chat__message-text__view-side-chat': {
29
+ marginLeft: 'auto',
30
+ flex: '0 0 auto',
31
+ width: '2em',
32
+ height: '2em',
33
+ padding: 0,
34
+ borderRadius: '50%',
35
+ border: '1px solid #253B80',
36
+ background: '#fff',
37
+ display: 'flex',
38
+ alignItems: 'center',
39
+ justifyContent: 'center',
40
+ cursor: 'pointer',
41
+ svg: {
42
+ fill: '#253B80',
43
+ stroke: '#253B80',
44
+ },
45
+ '&.ss__chat__message-text__view-side-chat--active': {
46
+ background: '#253B80',
47
+ svg: {
48
+ fill: '#fff',
49
+ stroke: '#fff',
50
+ },
51
+ },
52
+ },
53
+ },
54
+ '.ss__chat__message-text__show-details': {
55
+ alignSelf: 'flex-start',
56
+ border: '1px solid #253B80',
57
+ background: '#fff',
58
+ color: '#253B80',
59
+ borderRadius: '999px',
60
+ padding: '6px 16px',
61
+ fontSize: '14px',
62
+ fontWeight: 500,
63
+ cursor: 'pointer',
64
+ display: 'flex',
65
+ alignItems: 'center',
66
+ gap: '6px',
67
+ marginTop: '4px',
68
+ '&:not(.ss__button--disabled):hover': {
69
+ background: '#253B80',
70
+ color: '#fff',
71
+ svg: {
72
+ fill: '#fff',
73
+ stroke: '#fff',
74
+ },
75
+ },
76
+ svg: {
77
+ fill: '#253B80',
78
+ stroke: '#253B80',
79
+ },
80
+ },
81
+ '.ss__chat__message-text__results': {
82
+ marginTop: '12px',
83
+ '.swiper-container': {
84
+ alignItems: 'center',
85
+ gap: '5px',
86
+ '.swiper-wrapper': {},
87
+ '.swiper-scrollbar': {
88
+ position: 'static',
89
+ width: '95%',
90
+ height: '6px',
91
+ borderRadius: '6px',
92
+ '.swiper-scrollbar-drag': {
93
+ borderRadius: '6px',
94
+ },
95
+ },
96
+ '.swiper-pagination-lock': {
97
+ display: 'none !important',
98
+ },
99
+ },
100
+ '.ss__carousel__next-wrapper, .ss__carousel__prev-wrapper': {
101
+ svg: {
102
+ fill: '#0066cc',
103
+ stroke: '#0066cc',
104
+ },
105
+ },
106
+ },
107
+ '.ss__chat__message-text__facets': {
108
+ display: 'flex',
109
+ flexWrap: 'wrap',
110
+ gap: '10px',
111
+ margin: '10px 0 0 0',
112
+ '.ss__chat__message-text__facets__facet': {
113
+ display: 'flex',
114
+ gap: '5px',
115
+ alignItems: 'baseline',
116
+ label: {
117
+ fontWeight: 'bold',
118
+ },
119
+ },
120
+ },
121
+ });
122
+ };
123
+ export const MessageText = observer((props) => {
124
+ const { controller, chatItem, scrollToBottom, onViewProduct, showDetailsButton } = props;
125
+ const styling = mergeStyles(props, defaultStyles);
126
+ const text = chatItem.overallSummary || chatItem.text || chatItem.comparisonData?.summary || chatItem.errorMessage || chatItem.messageForDrift || '';
127
+ const currentChat = controller.store.currentChat;
128
+ const sideChatLabels = {
129
+ inspirationResult: { open: 'View inspiration', close: 'Close inspiration' },
130
+ productComparison: { open: 'View comparison', close: 'Close comparison' },
131
+ };
132
+ const sideChatLabel = sideChatLabels[chatItem?.messageType];
133
+ const hasSideChatView = !!sideChatLabel && !!chatItem?.id;
134
+ const isSideChatActive = hasSideChatView && !!props.sideChatOpen && currentChat?.activeMessage?.id === chatItem.id;
135
+ // Show the prominent "Show Details" button when requested (e.g. mobile subsequent comparisons)
136
+ const shouldShowDetailsButton = showDetailsButton && chatItem?.messageType === 'productComparison' && !isSideChatActive;
137
+ return (_jsxs("div", { className: "ss__chat__message-text", ...styling, children: [text && (_jsxs("div", { className: "ss__chat__message-text__text-wrapper", children: [_jsx("div", { className: "ss__chat__message-text__text-wrapper__text", dangerouslySetInnerHTML: { __html: marked.parse(text) } }), hasSideChatView ? (_jsx(Button, { className: classnames('ss__chat__message-text__view-side-chat', {
138
+ 'ss__chat__message-text__view-side-chat--active': isSideChatActive,
139
+ }), icon: {
140
+ icon: isSideChatActive ? 'close-thin' : 'angle-right',
141
+ title: isSideChatActive ? sideChatLabel.close : sideChatLabel.open,
142
+ }, onClick: () => {
143
+ if (isSideChatActive) {
144
+ currentChat?.dismissSideChat();
145
+ }
146
+ else {
147
+ currentChat?.setActiveMessage(chatItem.id);
148
+ }
149
+ } })) : null] })), shouldShowDetailsButton && (_jsx(Button, { className: "ss__chat__message-text__show-details", icon: { icon: 'angle-right', title: 'Show Details' }, onClick: () => {
150
+ currentChat?.setActiveMessage(chatItem.id);
151
+ }, children: "Show Details" })), chatItem && _jsx(ResultsDisplay, { controller: controller, chatItem: chatItem, scrollToBottom: scrollToBottom, onViewProduct: onViewProduct })] }));
152
+ });
@@ -0,0 +1,11 @@
1
+ import { ChatController } from '@athoscommerce/snap-controller';
2
+ export declare const MessageUser: ((props: MessageUserProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
3
+ displayName: string;
4
+ };
5
+ interface MessageUserProps {
6
+ chatItem: any;
7
+ controller: ChatController;
8
+ onViewProduct?: (product: any) => void;
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=MessageUser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageUser.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/MessageUser.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAyHhE,eAAO,MAAM,WAAW,WAAoB,gBAAgB;;CAsE1D,CAAC;AAEH,UAAU,gBAAgB;IACzB,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,cAAc,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;CACvC"}
@@ -0,0 +1,164 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { observer } from 'mobx-react-lite';
3
+ import classnames from 'classnames';
4
+ import { Image } from '../../Atoms/Image';
5
+ import { marked } from 'marked';
6
+ import { Icon } from '../../Atoms/Icon';
7
+ import { css } from '../../..';
8
+ import { mergeStyles } from '../../../utilities';
9
+ const defaultStyles = () => {
10
+ const colorPrimary = '#253B80';
11
+ return css({
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ alignItems: 'flex-end',
15
+ marginLeft: '40px',
16
+ '.ss__chat__message-user__request-type': {
17
+ fontStyle: 'italic',
18
+ color: '#999',
19
+ fontSize: '0.8em',
20
+ marginBottom: '4px',
21
+ textAlign: 'right',
22
+ },
23
+ '.ss__chat__message-user__row': {
24
+ display: 'flex',
25
+ flexDirection: 'row',
26
+ justifyContent: 'flex-end',
27
+ alignItems: 'center',
28
+ gap: '10px',
29
+ },
30
+ '.ss__chat__message-user__text': {
31
+ padding: '0.5em 1em',
32
+ borderRadius: '12px',
33
+ borderBottomRightRadius: '3px',
34
+ backgroundColor: colorPrimary,
35
+ color: '#fff',
36
+ },
37
+ '.ss__chat__message-user__attachments': {
38
+ listStyleType: 'none',
39
+ padding: 0,
40
+ margin: 0,
41
+ display: 'flex',
42
+ gap: '8px',
43
+ flexWrap: 'nowrap',
44
+ justifyContent: 'flex-end',
45
+ '.ss__chat__message-user__attachment__product, .ss__chat__message-user__attachment__image, .ss__chat__message-user__attachment__facet': {
46
+ width: '40px',
47
+ height: '40px',
48
+ borderRadius: '50%',
49
+ border: '2px solid #eee',
50
+ overflow: 'hidden',
51
+ display: 'flex',
52
+ justifyContent: 'center',
53
+ alignItems: 'center',
54
+ '.ss__image': {
55
+ aspectRatio: '1 / 1',
56
+ width: '100%',
57
+ height: '100%',
58
+ },
59
+ '.ss__icon': {
60
+ display: 'flex',
61
+ },
62
+ },
63
+ '.ss__chat__message-user__attachment__product--clickable': {
64
+ cursor: 'pointer',
65
+ transition: 'border-color 0.15s ease',
66
+ '&:hover': {
67
+ borderColor: colorPrimary,
68
+ },
69
+ },
70
+ },
71
+ });
72
+ };
73
+ function getRequestTypeLabel(chatItem) {
74
+ const requestType = chatItem.requestType;
75
+ if (!requestType || requestType === 'general')
76
+ return undefined;
77
+ switch (requestType) {
78
+ case 'productQuery':
79
+ return 'Asking about product';
80
+ case 'productComparison':
81
+ return 'Comparing products';
82
+ case 'productSearch':
83
+ return 'Filtering products';
84
+ case 'imageSearch':
85
+ return 'Searching by image';
86
+ case 'productSimilar':
87
+ return 'Finding similar products';
88
+ default:
89
+ return undefined;
90
+ }
91
+ }
92
+ function findProductInChat(chat, productId) {
93
+ if (!chat || !productId)
94
+ return null;
95
+ for (const msg of chat) {
96
+ if ((msg.messageType === 'productQuery' || msg.messageType === 'productAnswer') && msg.sourceProduct?.id === productId) {
97
+ return msg.sourceProduct;
98
+ }
99
+ const candidateLists = [];
100
+ if (Array.isArray(msg.results))
101
+ candidateLists.push(msg.results);
102
+ if (Array.isArray(msg.searchResults))
103
+ candidateLists.push(msg.searchResults);
104
+ if (Array.isArray(msg.inspirationSections)) {
105
+ msg.inspirationSections.forEach((section) => {
106
+ if (Array.isArray(section.products))
107
+ candidateLists.push(section.products);
108
+ });
109
+ }
110
+ if (Array.isArray(msg.recommendationResult)) {
111
+ msg.recommendationResult.forEach((rec) => {
112
+ if (Array.isArray(rec.results))
113
+ candidateLists.push(rec.results);
114
+ });
115
+ }
116
+ for (const list of candidateLists) {
117
+ const match = list.find((r) => r?.id === productId);
118
+ if (match)
119
+ return match;
120
+ }
121
+ }
122
+ return null;
123
+ }
124
+ export const MessageUser = observer((props) => {
125
+ const { controller, chatItem, onViewProduct } = props;
126
+ const { store } = controller;
127
+ const styling = mergeStyles(props, defaultStyles);
128
+ const requestTypeLabel = getRequestTypeLabel(chatItem);
129
+ const handleProductAttachmentClick = (attachment) => {
130
+ if (!attachment?.productId)
131
+ return;
132
+ const chat = store.currentChat?.chat;
133
+ const existingQuery = chat?.find((m) => m.messageType === 'productQuery' && m.sourceProduct?.id === attachment.productId);
134
+ if (existingQuery) {
135
+ store.currentChat?.setActiveMessage(existingQuery.id);
136
+ onViewProduct?.(existingQuery.sourceProduct);
137
+ return;
138
+ }
139
+ const product = findProductInChat(chat, attachment.productId);
140
+ if (product) {
141
+ controller.viewProduct(product);
142
+ onViewProduct?.(product);
143
+ }
144
+ };
145
+ return (_jsxs("div", { className: "ss__chat__message-user", ...styling, children: [requestTypeLabel ? _jsx("div", { className: "ss__chat__message-user__request-type", children: requestTypeLabel }) : null, _jsxs("div", { className: "ss__chat__message-user__row", children: [_jsx("ul", { className: "ss__chat__message-user__attachments", children: chatItem.attachments?.length
146
+ ? chatItem.attachments?.map((attachmentId) => {
147
+ const attachment = store.currentChat?.attachments.get(attachmentId);
148
+ switch (attachment?.type) {
149
+ case 'image':
150
+ return (_jsx("li", { className: "ss__chat__message-user__attachment__image", children: _jsx(Image, { style: { height: '200px', width: '200px' }, src: attachment.thumbnailUrl || attachment.base64 || '', alt: '' }) }, attachment.id));
151
+ case 'product': {
152
+ const canOpen = !!findProductInChat(store.currentChat?.chat, attachment.productId);
153
+ return (_jsx("li", { className: classnames('ss__chat__message-user__attachment__product', {
154
+ 'ss__chat__message-user__attachment__product--clickable': canOpen,
155
+ }), onClick: canOpen ? () => handleProductAttachmentClick(attachment) : undefined, title: canOpen ? `View details for ${attachment.name}` : undefined, children: _jsx(Image, { style: { height: '200px', width: '200px' }, src: attachment.thumbnailUrl || '', alt: attachment.name }) }, attachment.id));
156
+ }
157
+ case 'facet':
158
+ return (_jsx("li", { className: "ss__chat__message-user__attachment__facet", children: _jsx(Icon, { title: `Filter: ${attachment.facetLabel} = ${attachment.label}`, icon: "filter-funnel", size: 27 }) }, attachment.id));
159
+ default:
160
+ return null;
161
+ }
162
+ })
163
+ : null }), chatItem.text ? (_jsx("div", { className: "ss__chat__message-user__text", dangerouslySetInnerHTML: { __html: marked.parse(chatItem.text) } })) : null] })] }));
164
+ });
@@ -0,0 +1,11 @@
1
+ import { ChatController } from '@athoscommerce/snap-controller';
2
+ export declare const ResultsDisplay: ((props: ResultsDisplayProps) => import("@emotion/react/jsx-runtime").JSX.Element | null) & {
3
+ displayName: string;
4
+ };
5
+ export interface ResultsDisplayProps {
6
+ chatItem: any;
7
+ controller: ChatController;
8
+ scrollToBottom: () => void;
9
+ onViewProduct?: () => void;
10
+ }
11
+ //# sourceMappingURL=ResultsDisplay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultsDisplay.d.ts","sourceRoot":"","sources":["../../../../../../../components/src/components/Organisms/Chat/ResultsDisplay.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAgChE,eAAO,MAAM,cAAc,WAAoB,mBAAmB;;CA2EhE,CAAC;AAEH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,cAAc,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B"}
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
+ import { observer } from 'mobx-react-lite';
3
+ import { css } from '@emotion/react';
4
+ import { Carousel } from '../../Molecules/Carousel';
5
+ import { ChatResult } from './ChatResult';
6
+ const carouselStyleScript = () => {
7
+ return css({
8
+ position: 'relative',
9
+ '.ss__carousel__prev-wrapper, .ss__carousel__next-wrapper': {
10
+ position: 'absolute',
11
+ top: '50%',
12
+ transform: 'translateY(-50%)',
13
+ zIndex: 9,
14
+ '.ss__carousel__prev, .ss__carousel__next': {
15
+ background: 'rgba(255, 255, 255, 0.85)',
16
+ borderRadius: '50%',
17
+ width: '2em',
18
+ height: '2em',
19
+ display: 'flex',
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ boxShadow: '0 1px 3px rgba(0, 0, 0, 0.2)',
23
+ },
24
+ },
25
+ '.ss__carousel__prev-wrapper': {
26
+ left: 0,
27
+ },
28
+ '.ss__carousel__next-wrapper': {
29
+ right: 0,
30
+ },
31
+ });
32
+ };
33
+ export const ResultsDisplay = observer((props) => {
34
+ const { chatItem, controller, scrollToBottom, onViewProduct } = props;
35
+ const currentChat = controller.store.currentChat;
36
+ const activeMessage = currentChat?.activeMessage;
37
+ const isSideChatOpen = !!activeMessage &&
38
+ ['inspirationResult', 'productComparison', 'productQuery'].includes(activeMessage.messageType) &&
39
+ currentChat?.dismissedSideChatMessageId !== activeMessage.id;
40
+ const isNarrow = typeof window !== 'undefined' && window.innerWidth < 550;
41
+ const isConstrained = !isNarrow && isSideChatOpen && typeof window !== 'undefined' && window.innerWidth >= 768;
42
+ const slidesPerView = isNarrow || isConstrained ? 1.9 : 2.9;
43
+ const carouselProps = {
44
+ breakpoints: undefined,
45
+ slidesPerView,
46
+ slidesPerGroup: isNarrow || isConstrained ? 2 : 3,
47
+ loop: false,
48
+ pagination: false,
49
+ centerInsufficientSlides: false,
50
+ freeMode: true,
51
+ styleScript: carouselStyleScript,
52
+ };
53
+ const handleResultClick = (e, result) => {
54
+ // buttons should be able to be clicked without triggering the product click
55
+ if (e.composedPath().some((el) => el instanceof HTMLElement && el.matches('button, .ss__button, a')))
56
+ return;
57
+ controller.viewProduct(result);
58
+ onViewProduct?.();
59
+ };
60
+ if (chatItem.messageType === 'productRecommendation' && chatItem.recommendationResult?.length) {
61
+ return (_jsx(_Fragment, { children: chatItem.recommendationResult.map((recommendation, index) => {
62
+ return recommendation.results?.length > 0 ? (_jsx("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: _jsx(Carousel, { ...carouselProps, hideButtons: recommendation.results.length <= slidesPerView, children: recommendation.results.map((result) => {
63
+ return (_jsx("div", { className: "ss__chat__message-text__results__result", style: { height: '100%', width: '100%', display: 'flex', cursor: 'pointer' }, onClick: (e) => handleResultClick(e, result), children: _jsx(ChatResult, { result: result, controller: controller, scrollToBottom: scrollToBottom }) }, result.id));
64
+ }) }) }, index)) : null;
65
+ }) }));
66
+ }
67
+ return chatItem.results?.length > 0 ? (_jsx("div", { className: "ss__chat__message-text__results", style: { width: '100%' }, children: _jsx(Carousel, { ...carouselProps, hideButtons: chatItem.results.length <= slidesPerView, children: chatItem.results.map((result) => {
68
+ return (_jsx("div", { className: "ss__chat__message-text__results__result", style: { height: '100%', width: '100%', display: 'flex', cursor: 'pointer' }, onClick: (e) => handleResultClick(e, result), children: _jsx(ChatResult, { result: result, controller: controller, scrollToBottom: scrollToBottom }) }, result.id));
69
+ }) }) })) : null;
70
+ });