@athoscommerce/snap-preact 1.2.3-beta.3 → 1.2.3-beta.5

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 (218) hide show
  1. package/README.md +16 -0
  2. package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +3 -3
  3. package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
  4. package/dist/cjs/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +7 -8
  5. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +1 -1
  6. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -1
  7. package/dist/cjs/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +3 -3
  8. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +2 -0
  9. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -1
  10. package/dist/cjs/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +29 -27
  11. package/dist/cjs/components/src/components/Molecules/Filter/Filter.d.ts +1 -1
  12. package/dist/cjs/components/src/components/Molecules/Filter/Filter.d.ts.map +1 -1
  13. package/dist/cjs/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
  14. package/dist/cjs/components/src/components/Molecules/Result/Result.js +11 -6
  15. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts +4 -1
  16. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
  17. package/dist/cjs/components/src/components/Molecules/SearchInput/SearchInput.js +3 -3
  18. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/AbstractedControls.js +5 -5
  19. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/Control.d.ts.map +1 -1
  20. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/Components/Control.js +31 -31
  21. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.d.ts.map +1 -1
  22. package/dist/cjs/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.js +22 -36
  23. package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts +8 -0
  24. package/dist/cjs/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
  25. package/dist/cjs/components/src/components/Organisms/Chat/Chat.js +715 -427
  26. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -1
  27. package/dist/cjs/components/src/components/Organisms/Chat/ChatResult.js +13 -3
  28. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts +3 -1
  29. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.d.ts.map +1 -1
  30. package/dist/cjs/components/src/components/Organisms/Chat/MessageText.js +22 -19
  31. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts +3 -1
  32. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -1
  33. package/dist/cjs/components/src/components/Organisms/Chat/MessageUser.js +40 -23
  34. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +1 -1
  35. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
  36. package/dist/cjs/components/src/components/Organisms/Chat/ResultsDisplay.js +8 -7
  37. package/dist/cjs/components/src/components/Organisms/Facet/Facet.js +2 -1
  38. package/dist/cjs/components/src/components/Organisms/FacetsHorizontal/FacetsHorizontal.js +2 -1
  39. package/dist/cjs/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts +2 -2
  40. package/dist/cjs/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts.map +1 -1
  41. package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts +11 -0
  42. package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts.map +1 -0
  43. package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.js +461 -0
  44. package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.d.ts +2 -0
  45. package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.d.ts.map +1 -0
  46. package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.js +17 -0
  47. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  48. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -2
  49. package/dist/cjs/components/src/hooks/useAcRenderedInput.d.ts.map +1 -1
  50. package/dist/cjs/components/src/hooks/useAcRenderedInput.js +65 -15
  51. package/dist/cjs/components/src/hooks/useMediaQuery.d.ts.map +1 -1
  52. package/dist/cjs/components/src/hooks/useMediaQuery.js +3 -1
  53. package/dist/cjs/components/src/index.d.ts +1 -0
  54. package/dist/cjs/components/src/index.d.ts.map +1 -1
  55. package/dist/cjs/components/src/index.js +1 -0
  56. package/dist/cjs/components/src/providers/theme.d.ts +1 -1
  57. package/dist/cjs/components/src/providers/theme.d.ts.map +1 -1
  58. package/dist/cjs/components/src/themes/base/base.js +3 -3
  59. package/dist/cjs/components/src/utilities/Colour/Colour.d.ts +11 -0
  60. package/dist/cjs/components/src/utilities/Colour/Colour.d.ts.map +1 -1
  61. package/dist/cjs/components/src/utilities/Colour/Colour.js +32 -0
  62. package/dist/cjs/src/Instantiators/RecommendationInstantiator.d.ts +1 -0
  63. package/dist/cjs/src/Instantiators/RecommendationInstantiator.d.ts.map +1 -1
  64. package/dist/cjs/src/Instantiators/RecommendationInstantiator.js +161 -123
  65. package/dist/cjs/src/Snap.d.ts +1 -1
  66. package/dist/cjs/src/Snap.d.ts.map +1 -1
  67. package/dist/cjs/src/Snap.js +18 -6
  68. package/dist/cjs/src/SnapHybrid.d.ts.map +1 -1
  69. package/dist/cjs/src/Templates/SnapTemplates.d.ts +13 -72
  70. package/dist/cjs/src/Templates/SnapTemplates.d.ts.map +1 -1
  71. package/dist/cjs/src/Templates/SnapTemplates.js +123 -72
  72. package/dist/cjs/src/Templates/Stores/TargetStore.d.ts +7 -6
  73. package/dist/cjs/src/Templates/Stores/TargetStore.d.ts.map +1 -1
  74. package/dist/cjs/src/Templates/Stores/TargetStore.js +14 -8
  75. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +58 -8
  76. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
  77. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +467 -96
  78. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
  79. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
  80. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +123 -70
  81. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
  82. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
  83. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
  84. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
  85. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +86 -1
  86. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
  87. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +33 -14
  88. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts +93 -30
  89. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  90. package/dist/cjs/src/Templates/Stores/TemplateStore.js +33 -41
  91. package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts +2 -8
  92. package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
  93. package/dist/cjs/src/Templates/Stores/ThemeStore.js +3 -28
  94. package/dist/cjs/src/Templates/index.d.ts +1 -1
  95. package/dist/cjs/src/Templates/index.d.ts.map +1 -1
  96. package/dist/cjs/src/create/createChatController.js +1 -1
  97. package/dist/cjs/src/index.d.ts +1 -0
  98. package/dist/cjs/src/index.d.ts.map +1 -1
  99. package/dist/cjs/src/setupEvents.d.ts +13 -0
  100. package/dist/cjs/src/setupEvents.d.ts.map +1 -1
  101. package/dist/cjs/src/setupEvents.js +56 -8
  102. package/dist/cjs/src/types.d.ts +3 -1
  103. package/dist/cjs/src/types.d.ts.map +1 -1
  104. package/dist/cjs/src/utils/combineMerge.d.ts +2 -0
  105. package/dist/cjs/src/utils/combineMerge.d.ts.map +1 -0
  106. package/dist/cjs/src/utils/combineMerge.js +22 -0
  107. package/dist/cjs/src/utils/index.d.ts +1 -0
  108. package/dist/cjs/src/utils/index.d.ts.map +1 -1
  109. package/dist/cjs/src/utils/index.js +3 -1
  110. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +3 -3
  111. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
  112. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +7 -8
  113. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +1 -1
  114. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -1
  115. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +3 -3
  116. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +2 -0
  117. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -1
  118. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +29 -28
  119. package/dist/esm/components/src/components/Molecules/Filter/Filter.d.ts +1 -1
  120. package/dist/esm/components/src/components/Molecules/Filter/Filter.d.ts.map +1 -1
  121. package/dist/esm/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
  122. package/dist/esm/components/src/components/Molecules/Result/Result.js +9 -4
  123. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts +4 -1
  124. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
  125. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.js +3 -3
  126. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/AbstractedControls.js +5 -5
  127. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.d.ts.map +1 -1
  128. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.js +29 -29
  129. package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.d.ts.map +1 -1
  130. package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.js +22 -35
  131. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts +8 -0
  132. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
  133. package/dist/esm/components/src/components/Organisms/Chat/Chat.js +636 -359
  134. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -1
  135. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.js +13 -3
  136. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts +3 -1
  137. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts.map +1 -1
  138. package/dist/esm/components/src/components/Organisms/Chat/MessageText.js +21 -19
  139. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts +3 -1
  140. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -1
  141. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.js +37 -23
  142. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +1 -1
  143. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
  144. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.js +8 -7
  145. package/dist/esm/components/src/components/Organisms/Facet/Facet.js +1 -1
  146. package/dist/esm/components/src/components/Organisms/FacetsHorizontal/FacetsHorizontal.js +1 -1
  147. package/dist/esm/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts +2 -2
  148. package/dist/esm/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts.map +1 -1
  149. package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts +11 -0
  150. package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts.map +1 -0
  151. package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.js +436 -0
  152. package/dist/esm/components/src/components/Organisms/ProductQuickView/index.d.ts +2 -0
  153. package/dist/esm/components/src/components/Organisms/ProductQuickView/index.d.ts.map +1 -0
  154. package/dist/esm/components/src/components/Organisms/ProductQuickView/index.js +1 -0
  155. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  156. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -2
  157. package/dist/esm/components/src/hooks/useAcRenderedInput.d.ts.map +1 -1
  158. package/dist/esm/components/src/hooks/useAcRenderedInput.js +61 -11
  159. package/dist/esm/components/src/hooks/useMediaQuery.d.ts.map +1 -1
  160. package/dist/esm/components/src/hooks/useMediaQuery.js +3 -1
  161. package/dist/esm/components/src/index.d.ts +1 -0
  162. package/dist/esm/components/src/index.d.ts.map +1 -1
  163. package/dist/esm/components/src/index.js +1 -0
  164. package/dist/esm/components/src/providers/theme.d.ts +1 -1
  165. package/dist/esm/components/src/providers/theme.d.ts.map +1 -1
  166. package/dist/esm/components/src/themes/base/base.js +3 -3
  167. package/dist/esm/components/src/utilities/Colour/Colour.d.ts +11 -0
  168. package/dist/esm/components/src/utilities/Colour/Colour.d.ts.map +1 -1
  169. package/dist/esm/components/src/utilities/Colour/Colour.js +30 -0
  170. package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts +1 -0
  171. package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts.map +1 -1
  172. package/dist/esm/src/Instantiators/RecommendationInstantiator.js +130 -84
  173. package/dist/esm/src/Snap.d.ts +1 -1
  174. package/dist/esm/src/Snap.d.ts.map +1 -1
  175. package/dist/esm/src/Snap.js +21 -6
  176. package/dist/esm/src/SnapHybrid.d.ts.map +1 -1
  177. package/dist/esm/src/Templates/SnapTemplates.d.ts +13 -72
  178. package/dist/esm/src/Templates/SnapTemplates.d.ts.map +1 -1
  179. package/dist/esm/src/Templates/SnapTemplates.js +137 -78
  180. package/dist/esm/src/Templates/Stores/TargetStore.d.ts +7 -6
  181. package/dist/esm/src/Templates/Stores/TargetStore.d.ts.map +1 -1
  182. package/dist/esm/src/Templates/Stores/TargetStore.js +14 -8
  183. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +58 -8
  184. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
  185. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +447 -89
  186. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
  187. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
  188. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +118 -66
  189. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
  190. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
  191. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
  192. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
  193. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +82 -1
  194. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
  195. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +27 -8
  196. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts +93 -30
  197. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  198. package/dist/esm/src/Templates/Stores/TemplateStore.js +29 -38
  199. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts +2 -8
  200. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
  201. package/dist/esm/src/Templates/Stores/ThemeStore.js +3 -26
  202. package/dist/esm/src/Templates/index.d.ts +1 -1
  203. package/dist/esm/src/Templates/index.d.ts.map +1 -1
  204. package/dist/esm/src/create/createChatController.js +1 -1
  205. package/dist/esm/src/index.d.ts +1 -0
  206. package/dist/esm/src/index.d.ts.map +1 -1
  207. package/dist/esm/src/setupEvents.d.ts +13 -0
  208. package/dist/esm/src/setupEvents.d.ts.map +1 -1
  209. package/dist/esm/src/setupEvents.js +25 -8
  210. package/dist/esm/src/types.d.ts +3 -1
  211. package/dist/esm/src/types.d.ts.map +1 -1
  212. package/dist/esm/src/utils/combineMerge.d.ts +2 -0
  213. package/dist/esm/src/utils/combineMerge.d.ts.map +1 -0
  214. package/dist/esm/src/utils/combineMerge.js +16 -0
  215. package/dist/esm/src/utils/index.d.ts +1 -0
  216. package/dist/esm/src/utils/index.d.ts.map +1 -1
  217. package/dist/esm/src/utils/index.js +1 -0
  218. package/package.json +20 -14
@@ -80,36 +80,49 @@ var ChatInspirationResultMessage_1 = require("../../Molecules/ChatInspirationRes
80
80
  var ChatProductComparisonMessage_1 = require("../../Molecules/ChatProductComparisonMessage/ChatProductComparisonMessage");
81
81
  var ChatProductQueryMessage_1 = require("../../Molecules/ChatProductQueryMessage/ChatProductQueryMessage");
82
82
  var defaultStyles = function (_a) {
83
- var mobile = _a.mobile, offset = _a.offset, hasSideChat = _a.hasSideChat, footerHeight = _a.footerHeight;
84
- var colorPrimary = '#253B80';
83
+ var _b, _c, _d;
84
+ var mobile = _a.mobile, offset = _a.offset, hasSideChat = _a.hasSideChat, footerHeight = _a.footerHeight, primaryColorBg = _a.primaryColorBg, primaryColorFg = _a.primaryColorFg, primaryAccentColorBg = _a.primaryAccentColorBg, primaryAccentColorFg = _a.primaryAccentColorFg, secondaryAccentColorBg = _a.secondaryAccentColorBg, secondaryAccentColorFg = _a.secondaryAccentColorFg, position = _a.position;
85
+ var isRight = position === 'right';
86
+ // horizontal anchor for the root + bubble + suggested questions
87
+ var horizontalAnchor = isRight ? 'right' : 'left';
88
+ var colorPrimary = primaryColorBg;
89
+ var colorPrimaryText = primaryColorFg;
90
+ var colorPrimaryHover = new utilities_1.Colour(primaryColorBg).darkenHex();
91
+ var colorPrimaryAccent = primaryAccentColorBg;
92
+ var colorPrimaryAccentText = primaryAccentColorFg;
93
+ var colorPrimaryAccentHover = new utilities_1.Colour(primaryAccentColorBg).darkenHex();
94
+ var colorSecondaryAccent = secondaryAccentColorBg;
95
+ var colorSecondaryAccentText = secondaryAccentColorFg;
96
+ var colorSecondaryAccentHover = new utilities_1.Colour(secondaryAccentColorBg).darkenHex();
85
97
  var offsetValue = offset !== undefined ? (typeof offset === 'number' ? "".concat(offset, "px") : offset) : undefined;
86
- return (0, react_1.css)({
87
- position: 'fixed',
88
- left: '20px',
89
- bottom: '20px',
90
- zIndex: 1002,
91
- color: '#333',
92
- '@keyframes ss-chat-slide-up': {
98
+ return (0, react_1.css)((_b = {
99
+ position: 'fixed'
100
+ },
101
+ _b[horizontalAnchor] = '20px',
102
+ _b.bottom = '20px',
103
+ _b.zIndex = 1002,
104
+ _b.color = '#333',
105
+ _b['@keyframes ss-chat-slide-up'] = {
93
106
  from: { transform: 'translateY(100%)' },
94
107
  to: { transform: 'translateY(0)' },
95
108
  },
96
- '.ss__chat__primary': __assign(__assign({}, (mobile
109
+ _b['.ss__chat__primary'] = __assign(__assign({}, (mobile
97
110
  ? { width: '100%', height: '100%' }
98
111
  : hasSideChat
99
112
  ? { flex: '1 1 0', minWidth: 0, maxWidth: 600, height: '70vh' }
100
- : { width: 600, maxWidth: 'calc(100vw - 60px)', height: '70vh' })), { display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', overflow: 'hidden', order: 1, '.ss__chat__header__title': {
113
+ : { width: 600, maxWidth: 'calc(100vw - 60px)', height: '70vh' })), { display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', overflow: 'hidden', order: isRight ? 2 : 1, '.ss__chat__header__title': {
101
114
  gap: '22px',
102
115
  }, '.ss__chat__messages': {
103
116
  padding: '1em',
104
117
  } }),
105
- '.ss__chat__secondary': __assign(__assign(__assign(__assign(__assign(__assign({}, (mobile
118
+ _b['.ss__chat__secondary'] = __assign(__assign(__assign(__assign(__assign(__assign({}, (mobile
106
119
  ? {
107
120
  width: '100%',
108
121
  maxWidth: '100%',
109
122
  height: "calc(100% - 70px".concat(footerHeight > 0 ? " - ".concat(footerHeight, "px") : '', ")"),
110
123
  maxHeight: "calc(100% - 70px".concat(footerHeight > 0 ? " - ".concat(footerHeight, "px") : '', ")"),
111
124
  }
112
- : { flex: '1 1 0', minWidth: 0, maxWidth: 600, height: '70vh', maxHeight: '70vh' })), { display: 'flex', flexDirection: 'column', overflow: 'hidden', order: 2 }), (mobile
125
+ : { flex: '1 1 0', minWidth: 0, maxWidth: 600, height: '70vh', maxHeight: '70vh' })), { display: 'flex', flexDirection: 'column', overflow: 'hidden', order: isRight ? 1 : 2 }), (mobile
113
126
  ? {
114
127
  position: 'absolute',
115
128
  bottom: footerHeight > 0 ? footerHeight : 0,
@@ -159,55 +172,57 @@ var defaultStyles = function (_a) {
159
172
  }, '.ss__chat__messages': {
160
173
  background: '#fff!important',
161
174
  } }),
162
- '.ss__button': {
175
+ _b['.ss__button'] = {
163
176
  border: 'none',
164
177
  background: 'none',
165
178
  color: 'inherit',
166
179
  '&:not(.ss__button--disabled):hover': {
167
- background: '#dfeaf6',
180
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.85),
168
181
  },
169
182
  svg: {
170
183
  fill: colorPrimary,
171
184
  stroke: colorPrimary,
172
185
  },
173
186
  },
174
- '.ss__chat__bubble': {
175
- position: mobile ? 'fixed' : 'absolute',
176
- bottom: mobile ? '20px' : 0,
177
- left: mobile ? '20px' : 0,
178
- width: '60px',
179
- height: '60px',
180
- borderRadius: '50%',
181
- background: colorPrimary,
182
- color: 'white',
183
- display: 'flex',
184
- alignItems: 'center',
185
- justifyContent: 'center',
186
- cursor: 'pointer',
187
- fontSize: '24px',
188
- boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
189
- zIndex: 10,
190
- '&:hover': {
191
- background: '#0052a3',
187
+ _b['.ss__chat__bubble'] = (_c = {
188
+ position: mobile ? 'fixed' : 'absolute',
189
+ bottom: mobile ? '20px' : 0
190
+ },
191
+ _c[horizontalAnchor] = mobile ? '20px' : 0,
192
+ _c.width = '60px',
193
+ _c.height = '60px',
194
+ _c.borderRadius = '50%',
195
+ _c.background = colorPrimary,
196
+ _c.color = colorPrimaryText,
197
+ _c.display = 'flex',
198
+ _c.alignItems = 'center',
199
+ _c.justifyContent = 'center',
200
+ _c.cursor = 'pointer',
201
+ _c.fontSize = '24px',
202
+ _c.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)',
203
+ _c.zIndex = 10,
204
+ _c['&:hover'] = {
205
+ background: colorPrimaryHover,
192
206
  transform: 'scale(1.05)',
193
207
  },
194
- '.ss__icon': {
208
+ _c['.ss__icon'] = {
195
209
  height: '33px',
196
210
  width: '33px',
197
- fill: '#fff',
198
- stroke: '#fff',
211
+ fill: colorPrimaryText,
212
+ stroke: colorPrimaryText,
199
213
  },
200
- },
201
- '.ss__chat__suggested-questions': {
202
- position: mobile ? 'fixed' : 'absolute',
203
- bottom: mobile ? '90px' : '70px',
204
- left: mobile ? '20px' : 0,
205
- display: 'flex',
206
- flexDirection: 'column',
207
- gap: '8px',
208
- width: '250px',
209
- zIndex: 10,
210
- '.ss__chat__suggested-questions__item': {
214
+ _c),
215
+ _b['.ss__chat__suggested-questions'] = (_d = {
216
+ position: mobile ? 'fixed' : 'absolute',
217
+ bottom: mobile ? '90px' : '70px'
218
+ },
219
+ _d[horizontalAnchor] = mobile ? '20px' : 0,
220
+ _d.display = 'flex',
221
+ _d.flexDirection = 'column',
222
+ _d.gap = '8px',
223
+ _d.width = '250px',
224
+ _d.zIndex = 10,
225
+ _d['.ss__chat__suggested-questions__item'] = {
211
226
  background: '#fff',
212
227
  borderRadius: '12px',
213
228
  padding: '12px 16px',
@@ -220,13 +235,13 @@ var defaultStyles = function (_a) {
220
235
  boxShadow: '0 4px 12px rgba(0, 0, 0, 0.2)',
221
236
  },
222
237
  },
223
- },
224
- '&.ss__chat--minimized': {
238
+ _d),
239
+ _b['&.ss__chat--minimized'] = {
225
240
  width: '60px',
226
241
  height: '60px',
227
242
  minHeight: '60px',
228
243
  },
229
- '&.ss__chat--open': __assign(__assign({ display: 'flex', flexDirection: mobile ? 'column' : 'row', gap: mobile ? 0 : '12px' }, (mobile
244
+ _b['&.ss__chat--open'] = __assign(__assign({ display: 'flex', flexDirection: mobile ? 'column' : 'row', gap: mobile ? 0 : '12px' }, (mobile
230
245
  ? {
231
246
  top: offsetValue || 0,
232
247
  left: 0,
@@ -236,20 +251,23 @@ var defaultStyles = function (_a) {
236
251
  height: offsetValue ? "calc(100% - ".concat(offsetValue, ")") : '100%',
237
252
  }
238
253
  : {
239
- width: hasSideChat ? 'calc(100vw - 60px)' : 'auto',
254
+ // Hug the content width — two 600px panels + 12px gap — so the
255
+ // container stays anchored to its side instead of stretching to
256
+ // the opposite viewport edge when the side chat opens.
257
+ width: hasSideChat ? 'min(calc(100vw - 60px), 1212px)' : 'auto',
240
258
  maxWidth: 'calc(100vw - 60px)',
241
259
  maxHeight: 'calc(100vh - 40px)',
242
260
  })), { '.ss__chat__bubble': {
243
261
  display: 'none',
244
262
  } }),
245
- '.ss__chat__header': {
263
+ _b['.ss__chat__header'] = {
246
264
  display: 'flex',
247
265
  justifyContent: 'space-between',
248
266
  alignItems: 'center',
249
267
  fontSize: '16px',
250
268
  position: 'relative',
251
269
  padding: '10px 15px',
252
- color: '#fff',
270
+ color: colorPrimaryText,
253
271
  background: colorPrimary,
254
272
  borderTopLeftRadius: mobile ? 0 : '12px',
255
273
  borderTopRightRadius: mobile ? 0 : '12px',
@@ -283,8 +301,8 @@ var defaultStyles = function (_a) {
283
301
  backgroundColor: 'transparent',
284
302
  },
285
303
  svg: {
286
- fill: '#fff',
287
- stroke: '#fff',
304
+ fill: colorPrimaryText,
305
+ stroke: colorPrimaryText,
288
306
  },
289
307
  },
290
308
  },
@@ -339,6 +357,8 @@ var defaultStyles = function (_a) {
339
357
  display: 'flex',
340
358
  flexDirection: 'column-reverse',
341
359
  gap: 5,
360
+ maxHeight: '300px',
361
+ overflowY: 'auto',
342
362
  '.ss__chat__history__chats__chat': {
343
363
  '.ss__button': {
344
364
  borderRadius: '12px',
@@ -357,21 +377,21 @@ var defaultStyles = function (_a) {
357
377
  },
358
378
  },
359
379
  },
360
- '.ss__chat__session-feedback': {
380
+ _b['.ss__chat__session-feedback'] = {
361
381
  display: 'flex',
362
382
  alignItems: 'center',
363
383
  gap: '10px',
364
384
  padding: '8px 15px',
365
- background: '#40528e',
366
- color: '#fff',
385
+ background: new utilities_1.Colour(colorPrimary).darkenHex(0.1),
386
+ color: colorPrimaryText,
367
387
  fontSize: '14px',
368
388
  '.ss__chat__session-feedback__icon': {
369
389
  flex: '0 0 auto',
370
390
  display: 'flex',
371
391
  alignItems: 'center',
372
392
  svg: {
373
- fill: '#fff',
374
- stroke: '#fff',
393
+ fill: colorPrimaryText,
394
+ stroke: colorPrimaryText,
375
395
  },
376
396
  },
377
397
  '.ss__chat__session-feedback__label': {
@@ -380,25 +400,32 @@ var defaultStyles = function (_a) {
380
400
  },
381
401
  '.ss__chat__session-feedback__actions': {
382
402
  display: 'flex',
383
- gap: '10px',
403
+ gap: '6px',
384
404
  alignItems: 'center',
385
405
  '> span': {
386
406
  display: 'flex',
387
407
  alignItems: 'center',
388
408
  justifyContent: 'center',
389
- },
390
- svg: {
391
409
  cursor: 'pointer',
392
- fill: '#fff',
393
- stroke: '#fff',
394
- opacity: 0.7,
410
+ opacity: 0.85,
411
+ padding: '4px',
412
+ borderRadius: '4px',
413
+ border: '1px solid transparent',
414
+ transition: 'opacity 0.15s ease, border-color 0.15s ease',
395
415
  '&:hover': {
396
416
  opacity: 1,
397
417
  },
398
418
  },
399
- '&.ss__chat__session-feedback__actions--rated svg': {
419
+ svg: {
420
+ fill: colorPrimaryText,
421
+ stroke: colorPrimaryText,
422
+ },
423
+ '&.ss__chat__session-feedback__actions--rated > span': {
400
424
  opacity: 1,
401
425
  cursor: 'default',
426
+ '&:hover': {
427
+ borderColor: 'transparent',
428
+ },
402
429
  },
403
430
  },
404
431
  '.ss__chat__session-feedback__close': {
@@ -406,29 +433,42 @@ var defaultStyles = function (_a) {
406
433
  display: 'flex',
407
434
  alignItems: 'center',
408
435
  cursor: 'pointer',
436
+ opacity: 0.85,
437
+ transition: 'opacity 0.15s ease',
438
+ '&:hover': {
439
+ opacity: 1,
440
+ },
409
441
  svg: {
410
- fill: '#fff',
411
- stroke: '#fff',
412
- opacity: 0.7,
413
- '&:hover': {
414
- opacity: 1,
415
- },
442
+ fill: colorPrimaryText,
443
+ stroke: colorPrimaryText,
416
444
  },
417
445
  },
418
446
  },
419
- '.ss__chat__content': {
447
+ _b['.ss__chat__content'] = {
420
448
  background: '#fff',
421
449
  maxHeight: mobile ? undefined : '90vh',
422
450
  overflow: 'hidden',
423
451
  display: 'flex',
424
452
  flexDirection: 'column',
425
- border: '1px solid #0066cc',
453
+ border: "1px solid ".concat(colorPrimary),
426
454
  borderTop: 'none',
427
455
  marginTop: '-1px',
428
456
  borderBottomRightRadius: mobile ? 0 : '12px',
429
457
  borderBottomLeftRadius: mobile ? 0 : '12px',
430
458
  flexGrow: 1,
459
+ position: 'relative',
431
460
  '.ss__chat__content__header': {
461
+ // In overlay mode (only applied when messages overflow), the comparisons
462
+ // tray floats over the messages so toggling it doesn't shift the layout
463
+ // or push the latest message out of view. When messages don't overflow,
464
+ // the tray stays in flow so older messages remain reachable above it.
465
+ '&.ss__chat__content__header--overlay': {
466
+ position: 'absolute',
467
+ top: 0,
468
+ left: 0,
469
+ right: 0,
470
+ zIndex: 20,
471
+ },
432
472
  // '.ss__chat__attachments': {
433
473
  // '.ss__chat__attachment': {
434
474
  // borderRadius: 0,
@@ -440,7 +480,7 @@ var defaultStyles = function (_a) {
440
480
  display: 'flex',
441
481
  flexDirection: 'column',
442
482
  gap: '1em',
443
- background: '#f4f4ff',
483
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.95),
444
484
  padding: '1em',
445
485
  '.ss__chat__content__header__comparisons__header': {
446
486
  display: 'flex',
@@ -455,7 +495,7 @@ var defaultStyles = function (_a) {
455
495
  background: colorPrimary,
456
496
  borderRadius: '50%',
457
497
  padding: '5px',
458
- fill: '#fff',
498
+ fill: colorPrimaryText,
459
499
  height: '25px',
460
500
  width: '25px',
461
501
  },
@@ -528,11 +568,11 @@ var defaultStyles = function (_a) {
528
568
  borderRadius: '1em',
529
569
  padding: '0.5em 1em',
530
570
  background: colorPrimary,
531
- color: '#fff',
571
+ color: colorPrimaryText,
532
572
  textAlign: 'center',
533
573
  svg: {
534
- fill: '#fff',
535
- stroke: '#fff',
574
+ fill: colorPrimaryText,
575
+ stroke: colorPrimaryText,
536
576
  },
537
577
  },
538
578
  },
@@ -541,6 +581,7 @@ var defaultStyles = function (_a) {
541
581
  },
542
582
  '.ss__chat__messages': {
543
583
  flex: '1 1 auto',
584
+ overflowY: 'auto',
544
585
  overscrollBehavior: 'contain',
545
586
  margin: 0,
546
587
  maxHeight: '100%',
@@ -559,7 +600,7 @@ var defaultStyles = function (_a) {
559
600
  width: 'fit-content',
560
601
  padding: '6px 16px',
561
602
  background: colorPrimary,
562
- color: '#fff',
603
+ color: colorPrimaryText,
563
604
  borderRadius: '999px',
564
605
  fontSize: '13px',
565
606
  fontWeight: 500,
@@ -567,11 +608,11 @@ var defaultStyles = function (_a) {
567
608
  boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
568
609
  zIndex: 5,
569
610
  '&:hover': {
570
- background: '#1a2a5c',
611
+ background: colorPrimaryHover,
571
612
  },
572
613
  svg: {
573
- fill: '#fff',
574
- stroke: '#fff',
614
+ fill: colorPrimaryText,
615
+ stroke: colorPrimaryText,
575
616
  },
576
617
  },
577
618
  '.ss__chat__message': {
@@ -600,7 +641,7 @@ var defaultStyles = function (_a) {
600
641
  '.ss__chat__welcome': {
601
642
  display: 'flex',
602
643
  flexDirection: 'column',
603
- height: '100%',
644
+ minHeight: '100%',
604
645
  '.ss__chat__welcome__message': {
605
646
  fontSize: '15px',
606
647
  lineHeight: 1.5,
@@ -623,8 +664,8 @@ var defaultStyles = function (_a) {
623
664
  flexDirection: 'column',
624
665
  gap: '6px',
625
666
  padding: '8px 10px',
626
- background: '#f4f4ff',
627
- border: '1px solid #e3e3f5',
667
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.95),
668
+ border: "1px solid ".concat(new utilities_1.Colour(colorPrimary).lightenHex(0.85)),
628
669
  borderRadius: '8px',
629
670
  },
630
671
  '.ss__chat__actions--title': {
@@ -644,7 +685,7 @@ var defaultStyles = function (_a) {
644
685
  fontSize: '14px',
645
686
  color: '#333',
646
687
  '&:hover': {
647
- background: '#f9f9ff',
688
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.97),
648
689
  },
649
690
  },
650
691
  },
@@ -744,8 +785,8 @@ var defaultStyles = function (_a) {
744
785
  visibility: 'visible',
745
786
  },
746
787
  '.ss__button': {
747
- background: '#253B80',
748
- color: '#fff',
788
+ background: colorPrimary,
789
+ color: colorPrimaryText,
749
790
  border: 'none',
750
791
  borderRadius: '999px',
751
792
  padding: '2px 10px',
@@ -753,7 +794,7 @@ var defaultStyles = function (_a) {
753
794
  lineHeight: '1.4',
754
795
  cursor: 'pointer',
755
796
  '&:not(.ss__button--disabled):hover': {
756
- background: '#1a2a5c',
797
+ background: colorPrimaryHover,
757
798
  },
758
799
  '&.ss__button--disabled': {
759
800
  opacity: 0.5,
@@ -776,8 +817,8 @@ var defaultStyles = function (_a) {
776
817
  flexDirection: 'column',
777
818
  gap: '6px',
778
819
  padding: '8px 10px',
779
- background: '#f4f4ff',
780
- border: '1px solid #e3e3f5',
820
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.95),
821
+ border: "1px solid ".concat(new utilities_1.Colour(colorPrimary).lightenHex(0.85)),
781
822
  borderRadius: '8px',
782
823
  '.ss__chat__attachment-context__label': {
783
824
  fontSize: '14px',
@@ -907,19 +948,36 @@ var defaultStyles = function (_a) {
907
948
  },
908
949
  },
909
950
  },
910
- '.ss__chat__content__footer': __assign({ padding: '1em', display: 'flex', flexDirection: 'column', gap: '8px', flexShrink: 0 }, (mobile
951
+ '.ss__chat__content__footer': __assign(__assign({ padding: '1em', display: 'flex', flexDirection: 'column', gap: '8px', flexShrink: 0, position: 'relative' }, (mobile
911
952
  ? {
912
- position: 'relative',
913
953
  zIndex: 11,
914
954
  background: '#fff',
915
955
  }
916
- : {})),
956
+ : {})), { '.ss__chat__content__footer__drop-overlay': {
957
+ position: 'absolute',
958
+ inset: 0,
959
+ display: 'flex',
960
+ alignItems: 'center',
961
+ justifyContent: 'center',
962
+ gap: '8px',
963
+ borderRadius: '6px',
964
+ border: "2px dashed ".concat(colorPrimary),
965
+ backgroundColor: new utilities_1.Colour(colorPrimary).lightenHex(0.9),
966
+ color: colorPrimary,
967
+ fontWeight: 'bold',
968
+ pointerEvents: 'none',
969
+ zIndex: 12,
970
+ svg: {
971
+ fill: colorPrimary,
972
+ stroke: colorPrimary,
973
+ },
974
+ } }),
917
975
  '.ss__chat__topic-drift': {
918
976
  display: 'flex',
919
977
  alignItems: 'center',
920
978
  gap: '12px',
921
979
  padding: '12px 16px',
922
- border: '1px solid #93C5FD',
980
+ border: "1px solid ".concat(new utilities_1.Colour(colorPrimary).lightenHex(0.6)),
923
981
  borderRadius: '8px',
924
982
  backgroundColor: '#fff',
925
983
  '.ss__chat__topic-drift__icon--info': {
@@ -949,7 +1007,7 @@ var defaultStyles = function (_a) {
949
1007
  '.ss__chat__topic-drift__button': {
950
1008
  flex: '0 0 auto',
951
1009
  backgroundColor: colorPrimary,
952
- color: '#fff',
1010
+ color: colorPrimaryText,
953
1011
  borderRadius: '6px',
954
1012
  padding: '8px 14px',
955
1013
  fontSize: '13px',
@@ -957,7 +1015,7 @@ var defaultStyles = function (_a) {
957
1015
  cursor: 'pointer',
958
1016
  whiteSpace: 'nowrap',
959
1017
  '&:not(.ss__button--disabled):hover': {
960
- background: '#1a2a5c',
1018
+ background: colorPrimaryHover,
961
1019
  },
962
1020
  },
963
1021
  '.ss__chat__topic-drift__icon--close': {
@@ -995,7 +1053,7 @@ var defaultStyles = function (_a) {
995
1053
  },
996
1054
  '&:focus': {
997
1055
  outline: 'none',
998
- borderColor: '#0066cc',
1056
+ borderColor: colorPrimary,
999
1057
  },
1000
1058
  },
1001
1059
  '.ss__button': {
@@ -1011,18 +1069,20 @@ var defaultStyles = function (_a) {
1011
1069
  '.ss__chat__input__actions': {
1012
1070
  '.ss__button': {
1013
1071
  backgroundColor: colorPrimary,
1072
+ color: colorPrimaryText,
1014
1073
  borderRadius: '50%',
1015
1074
  height: '3em',
1016
1075
  width: '3em',
1017
1076
  cursor: 'pointer',
1018
1077
  justifyContent: 'center',
1078
+ boxSizing: 'border-box',
1019
1079
  '&:disabled': {
1020
1080
  opacity: 0.5,
1021
1081
  cursor: 'not-allowed',
1022
1082
  },
1023
1083
  svg: {
1024
- fill: '#fff',
1025
- stroke: '#fff',
1084
+ fill: colorPrimaryText,
1085
+ stroke: colorPrimaryText,
1026
1086
  },
1027
1087
  },
1028
1088
  },
@@ -1033,11 +1093,60 @@ var defaultStyles = function (_a) {
1033
1093
  textAlign: 'center',
1034
1094
  flexShrink: 0,
1035
1095
  },
1096
+ '.ss__chat__result__image__icons__icon--cart': {
1097
+ backgroundColor: "".concat(colorPrimaryAccent, " !important"),
1098
+ svg: {
1099
+ fill: "".concat(colorPrimaryAccentText, " !important"),
1100
+ stroke: "".concat(colorPrimaryAccentText, " !important"),
1101
+ },
1102
+ },
1103
+ '.ss__chat-product-query-message__header__product__actions__add-to-cart .ss__button': {
1104
+ background: "".concat(colorPrimaryAccent, " !important"),
1105
+ color: "".concat(colorPrimaryAccentText, " !important"),
1106
+ '&:not(.ss__button--disabled):hover': {
1107
+ background: "".concat(colorPrimaryAccentHover, " !important"),
1108
+ },
1109
+ },
1110
+ // Secondary accent — applied to the productQuery button (ChatResult inquire icon)
1111
+ // and the "Show similar" button (ChatProductQueryMessage). Both elements live in
1112
+ // child components but their styling overrides are intentionally scoped here so
1113
+ // the Chat-level theme can drive them.
1114
+ '.ss__chat__result__image__icons__icon--inquire': {
1115
+ backgroundColor: "".concat(colorSecondaryAccent, " !important"),
1116
+ svg: {
1117
+ fill: "".concat(colorSecondaryAccentText, " !important"),
1118
+ stroke: "".concat(colorSecondaryAccentText, " !important"),
1119
+ },
1120
+ },
1121
+ '.ss__chat-product-query-message__header__product__actions__show-similar .ss__button, .ss__chat-product-query-message__header__product__actions__discuss-product .ss__button': {
1122
+ background: "".concat(colorSecondaryAccent, " !important"),
1123
+ color: "".concat(colorSecondaryAccentText, " !important"),
1124
+ border: "1px solid ".concat(colorSecondaryAccentText, " !important"),
1125
+ '&:not(.ss__button--disabled):hover': {
1126
+ background: "".concat(colorSecondaryAccentHover, " !important"),
1127
+ },
1128
+ },
1129
+ '.ss__chat__expired': {
1130
+ display: 'flex',
1131
+ flexDirection: 'column',
1132
+ alignItems: 'center',
1133
+ justifyContent: 'center',
1134
+ gap: '12px',
1135
+ padding: '16px',
1136
+ textAlign: 'center',
1137
+ color: '#6A7282',
1138
+ '.ss__chat__expired__message': {
1139
+ fontSize: '14px',
1140
+ },
1141
+ '.ss__chat__expired__button': {
1142
+ alignSelf: 'center',
1143
+ },
1144
+ },
1036
1145
  },
1037
- });
1146
+ _b));
1038
1147
  };
1039
1148
  exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1040
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
1149
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1041
1150
  var globalTheme = (0, providers_1.useTheme)();
1042
1151
  var globalTreePath = (0, providers_1.useTreePath)();
1043
1152
  var isMobile = (0, __1.useMediaQuery)('(max-width: 767px)');
@@ -1045,11 +1154,26 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1045
1154
  treePath: globalTreePath,
1046
1155
  logo: 'https://cdn.athoscommerce.net/snap/images/Athos%20Commerce_Icon_white.svg',
1047
1156
  title: 'Athos Conversational Assistant',
1048
- subtitle: 'Ready to assist you',
1157
+ subtitle: 'Your Guided Discovery Expert',
1049
1158
  multiselectFacets: true,
1159
+ disableBubbleSuggestedQuestions: false,
1160
+ primaryColorBg: '#253B80',
1161
+ primaryColorFg: '#fff',
1162
+ primaryAccentColorBg: '#feeeae',
1163
+ primaryAccentColorFg: '#000000',
1164
+ secondaryAccentColorBg: '#000000',
1165
+ secondaryAccentColorFg: '#ffffff',
1166
+ position: 'right',
1050
1167
  };
1051
1168
  var props = (0, utilities_1.mergeProps)('facets', globalTheme, defaultProps, properties);
1052
- var className = props.className, internalClassName = props.internalClassName, controller = props.controller, logo = props.logo, title = props.title, subtitle = props.subtitle, offset = props.offset, multiselectFacets = props.multiselectFacets;
1169
+ var className = props.className, internalClassName = props.internalClassName, controller = props.controller, logo = props.logo, title = props.title, subtitle = props.subtitle, offset = props.offset, multiselectFacets = props.multiselectFacets, disableBubbleSuggestedQuestions = props.disableBubbleSuggestedQuestions, primaryColorBg = props.primaryColorBg, primaryColorFg = props.primaryColorFg, primaryAccentColorBg = props.primaryAccentColorBg, primaryAccentColorFg = props.primaryAccentColorFg, secondaryAccentColorBg = props.secondaryAccentColorBg, secondaryAccentColorFg = props.secondaryAccentColorFg, position = props.position;
1170
+ var colorPrimary = primaryColorBg;
1171
+ var colorPrimaryText = primaryColorFg;
1172
+ var colorPrimaryAccent = primaryAccentColorBg;
1173
+ var colorPrimaryAccentText = primaryAccentColorFg;
1174
+ var colorSecondaryAccent = secondaryAccentColorBg;
1175
+ var colorSecondaryAccentText = secondaryAccentColorFg;
1176
+ var chatPosition = position === 'right' ? 'right' : 'left';
1053
1177
  var store = controller.store;
1054
1178
  var themeDefaults = {
1055
1179
  components: {},
@@ -1060,26 +1184,39 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1060
1184
  var fileInputRef = (0, hooks_1.useRef)(null);
1061
1185
  var messagesEndRef = (0, hooks_1.useRef)(null);
1062
1186
  var messagesContainerRef = (0, hooks_1.useRef)(null);
1187
+ var headerRef = (0, hooks_1.useRef)(null);
1063
1188
  var footerRef = (0, hooks_1.useRef)(null);
1189
+ var chatRef = (0, hooks_1.useRef)(null);
1064
1190
  // Swipe-to-dismiss state for mobile secondary panel
1065
1191
  var secondaryRef = (0, hooks_1.useRef)(null);
1066
1192
  var swipeStartY = (0, hooks_1.useRef)(0);
1067
1193
  var swipeStartTime = (0, hooks_1.useRef)(0);
1068
1194
  var swipeActive = (0, hooks_1.useRef)(false);
1069
1195
  var swipeOffsetRef = (0, hooks_1.useRef)(0);
1070
- var _x = (0, hooks_1.useState)(0), swipeOffset = _x[0], setSwipeOffsetRaw = _x[1];
1071
- var _y = (0, hooks_1.useState)(false), swipeAnimating = _y[0], setSwipeAnimating = _y[1];
1072
- var _z = (0, hooks_1.useState)(false), mobileProductInfoOpen = _z[0], setMobileProductInfoOpen = _z[1];
1073
- var _0 = (0, hooks_1.useState)(0), footerHeight = _0[0], setFooterHeight = _0[1];
1074
- var _1 = (0, hooks_1.useState)(false), showNewMessages = _1[0], setShowNewMessages = _1[1];
1196
+ var _u = (0, hooks_1.useState)(0), swipeOffset = _u[0], setSwipeOffsetRaw = _u[1];
1197
+ var _v = (0, hooks_1.useState)(false), swipeAnimating = _v[0], setSwipeAnimating = _v[1];
1198
+ var _w = (0, hooks_1.useState)(false), mobileProductInfoOpen = _w[0], setMobileProductInfoOpen = _w[1];
1199
+ var _x = (0, hooks_1.useState)(0), footerHeight = _x[0], setFooterHeight = _x[1];
1200
+ var _y = (0, hooks_1.useState)(false), showNewMessages = _y[0], setShowNewMessages = _y[1];
1201
+ var _z = (0, hooks_1.useState)(false), messagesOverflow = _z[0], setMessagesOverflow = _z[1];
1075
1202
  var isNearBottomRef = (0, hooks_1.useRef)(true);
1203
+ // Drag-and-drop image upload onto the footer. `dragenter`/`dragleave` fire on every
1204
+ // child crossing, so use a counter to know when the pointer has truly left the footer.
1205
+ var _0 = (0, hooks_1.useState)(false), isDraggingFile = _0[0], setIsDraggingFile = _0[1];
1206
+ var dragCounterRef = (0, hooks_1.useRef)(0);
1076
1207
  var updateSwipeOffset = function (value) {
1077
1208
  swipeOffsetRef.current = value;
1078
1209
  setSwipeOffsetRaw(value);
1079
1210
  };
1080
1211
  var scrollToBottom = function () {
1081
- var _a;
1082
- (_a = messagesEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
1212
+ // Scroll the messages container directly (instead of scrollIntoView on the
1213
+ // bottom anchor) so the browser never walks up the ancestor chain. On small
1214
+ // viewports a smooth scrollIntoView could otherwise animate the document/
1215
+ // visual viewport and visually push the fixed-position chat off-screen.
1216
+ var container = messagesContainerRef.current;
1217
+ if (container) {
1218
+ container.scrollTo({ top: container.scrollHeight, behavior: 'smooth' });
1219
+ }
1083
1220
  };
1084
1221
  // Conditional scroll: only scrolls if the user is already near the bottom.
1085
1222
  // Passed to child components (e.g. image onLoad) so they don't yank the user
@@ -1146,6 +1283,36 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1146
1283
  container.addEventListener('scroll', handleScroll);
1147
1284
  return function () { return container.removeEventListener('scroll', handleScroll); };
1148
1285
  }, [store.open]);
1286
+ // Track whether the messages container is overflowing so the comparisons header
1287
+ // can switch between in-flow (short conversations — top content stays reachable)
1288
+ // and overlay (overflowing — avoid layout shift when toggling the tray).
1289
+ // Hysteresis: when already in overlay, only return to in-flow if the content
1290
+ // would still fit *with* the header re-inserted — otherwise the two states
1291
+ // fight each other and the layout flickers.
1292
+ (0, hooks_1.useEffect)(function () {
1293
+ var container = messagesContainerRef.current;
1294
+ if (!container || typeof ResizeObserver === 'undefined')
1295
+ return;
1296
+ var update = function () {
1297
+ setMessagesOverflow(function (prev) {
1298
+ var _a;
1299
+ var headerHeight = ((_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0;
1300
+ if (prev) {
1301
+ // Currently overlay: header isn't taking flow space. Only switch
1302
+ // back to in-flow if the content would fit with the header added.
1303
+ return container.scrollHeight > container.clientHeight - headerHeight + 1;
1304
+ }
1305
+ // Currently in-flow: header already takes space — straightforward check.
1306
+ return container.scrollHeight > container.clientHeight + 1;
1307
+ });
1308
+ };
1309
+ update();
1310
+ var observer = new ResizeObserver(update);
1311
+ observer.observe(container);
1312
+ if (headerRef.current)
1313
+ observer.observe(headerRef.current);
1314
+ return function () { return observer.disconnect(); };
1315
+ }, [store.open, visibleChatLength]);
1149
1316
  // Re-focus the chat input on desktop after a search completes.
1150
1317
  // The input is disabled while loading, which causes the browser to drop focus.
1151
1318
  // On mobile we intentionally skip this so the virtual keyboard dismisses.
@@ -1173,7 +1340,19 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1173
1340
  var sideChatTypes = isMobile
1174
1341
  ? __spreadArray(__spreadArray(['inspirationResult'], (isFirstMobileComparison ? ['productComparison'] : []), true), (mobileProductInfoOpen ? ['productQuery'] : []), true) : ['inspirationResult', 'productComparison', 'productQuery'];
1175
1342
  var shouldShowSideChat = activeMessage && sideChatTypes.includes(activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) && ((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.dismissedSideChatMessageId) !== activeMessage.id;
1176
- var styling = (0, utilities_1.mergeStyles)({ mobile: isMobile, offset: offset, hasSideChat: !!shouldShowSideChat, footerHeight: footerHeight }, defaultStyles);
1343
+ var styling = (0, utilities_1.mergeStyles)({
1344
+ mobile: isMobile,
1345
+ offset: offset,
1346
+ hasSideChat: !!shouldShowSideChat,
1347
+ footerHeight: footerHeight,
1348
+ primaryColorBg: colorPrimary,
1349
+ primaryColorFg: colorPrimaryText,
1350
+ primaryAccentColorBg: colorPrimaryAccent,
1351
+ primaryAccentColorFg: colorPrimaryAccentText,
1352
+ secondaryAccentColorBg: colorSecondaryAccent,
1353
+ secondaryAccentColorFg: colorSecondaryAccentText,
1354
+ position: chatPosition,
1355
+ }, defaultStyles);
1177
1356
  // Lock body scroll while chat is open so touch/wheel scrolls don't leak to the page behind
1178
1357
  (0, hooks_1.useEffect)(function () {
1179
1358
  if (!store.open)
@@ -1220,6 +1399,72 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1220
1399
  return text.length > 50 ? "".concat(text.slice(0, 50), "...") : text;
1221
1400
  })() }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__history__chat__button__date", children: chat.createdAt.toLocaleString() })] }) }, chat.id)); }) })) : null] })); };
1222
1401
  var FacetButton = function (props) { return (0, jsx_runtime_1.jsx)(Button_1.Button, { icon: props.open ? 'angle-down' : 'angle-up', children: props.label }); };
1402
+ var getFacetButtonLabel = function (facet) {
1403
+ var _a, _b, _c;
1404
+ var base = facet.label || facet.field;
1405
+ // Slider facets show the active low-high range in the button when narrowed.
1406
+ if (facet.type === 'range') {
1407
+ var rangeFacet = facet;
1408
+ var active = rangeFacet.active;
1409
+ var range = rangeFacet.range;
1410
+ if (active && range && (active.low !== range.low || active.high !== range.high)) {
1411
+ return "".concat(base, " (").concat((_a = active.low) !== null && _a !== void 0 ? _a : '*', "-").concat((_b = active.high) !== null && _b !== void 0 ? _b : '*', ")");
1412
+ }
1413
+ return base;
1414
+ }
1415
+ var applied = new Set();
1416
+ // Count values marked as filtered (already applied on the server)
1417
+ (facet.values || []).forEach(function (value) {
1418
+ var _a, _b;
1419
+ if (value === null || value === void 0 ? void 0 : value.filtered) {
1420
+ if ('low' in value && 'high' in value) {
1421
+ applied.add("".concat((_a = value.low) !== null && _a !== void 0 ? _a : '*', ":").concat((_b = value.high) !== null && _b !== void 0 ? _b : '*'));
1422
+ }
1423
+ else {
1424
+ applied.add(value.value);
1425
+ }
1426
+ }
1427
+ });
1428
+ // Count pending facet attachments (newly selected, not yet sent)
1429
+ (((_c = controller.store.currentChat) === null || _c === void 0 ? void 0 : _c.attachments.items) || [])
1430
+ .filter(function (item) { return item.type === 'facet' && item.key === facet.field && (item.state === 'active' || item.state === 'attached'); })
1431
+ .forEach(function (item) { return applied.add(item.value); });
1432
+ return applied.size > 0 ? "".concat(base, " (").concat(applied.size, ")") : base;
1433
+ };
1434
+ // Slider dropdown grows to fill the remaining chat width from its anchor,
1435
+ // so the price range slider isn't cramped inside a 150px-wide dropdown.
1436
+ var SliderFacetDropdown = function (props) {
1437
+ var anchorRef = (0, hooks_1.useRef)(null);
1438
+ var _a = (0, hooks_1.useState)(null), width = _a[0], setWidth = _a[1];
1439
+ (0, hooks_1.useEffect)(function () {
1440
+ var compute = function () {
1441
+ if (!anchorRef.current || !chatRef.current)
1442
+ return;
1443
+ var anchor = anchorRef.current.getBoundingClientRect();
1444
+ var chat = chatRef.current.getBoundingClientRect();
1445
+ var remaining = chat.right - anchor.left - 16;
1446
+ setWidth(Math.max(220, remaining));
1447
+ };
1448
+ compute();
1449
+ var ro = typeof ResizeObserver !== 'undefined' ? new ResizeObserver(compute) : null;
1450
+ if (ro && chatRef.current)
1451
+ ro.observe(chatRef.current);
1452
+ window.addEventListener('resize', compute);
1453
+ return function () {
1454
+ if (ro)
1455
+ ro.disconnect();
1456
+ window.removeEventListener('resize', compute);
1457
+ };
1458
+ }, []);
1459
+ return ((0, jsx_runtime_1.jsx)("div", { ref: anchorRef, className: "ss__chat__actions__facet ss__chat__actions__facet--range", children: (0, jsx_runtime_1.jsx)(__1.Dropdown, { usePortal: true, dropUp: true, button: (0, jsx_runtime_1.jsx)(FacetButton, { label: props.label }), style: {
1460
+ '.ss__dropdown__content': {
1461
+ width: width ? "".concat(width, "px") : 'auto',
1462
+ background: 'white',
1463
+ boxShadow: '0px 3px 6px 0px rgba(0, 0, 0, 0.2)',
1464
+ borderRadius: '6px',
1465
+ },
1466
+ }, children: (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facet__options", children: (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facet__slider", style: { padding: '12px 16px' }, children: (0, jsx_runtime_1.jsx)(__1.FacetSlider, { facet: props.facet }) }) }) }) }));
1467
+ };
1223
1468
  // TODO: if starting a new chat and it's expired, this button would then disappear
1224
1469
  if (!controller.store.chatEnabled) {
1225
1470
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
@@ -1306,11 +1551,11 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1306
1551
  return undefined;
1307
1552
  }
1308
1553
  }, [requestType]);
1309
- return ((0, jsx_runtime_1.jsx)(providers_1.CacheProvider, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)('ss__chat', {
1554
+ return ((0, jsx_runtime_1.jsx)(providers_1.CacheProvider, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ ref: chatRef, className: (0, classnames_1.default)('ss__chat', {
1310
1555
  'ss__chat--open': store.open,
1311
1556
  'ss__chat--minimized': !store.open,
1312
1557
  'ss__chat--mobile': isMobile,
1313
- }, className, internalClassName) }, styling, { children: [!store.open && !store.currentChat && ((_f = store.suggestedQuestions) === null || _f === void 0 ? void 0 : _f.length) > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__suggested-questions", children: store.suggestedQuestions.map(function (question, index) { return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__suggested-questions__item", onClick: function () {
1558
+ }, className, internalClassName) }, styling, { children: [!disableBubbleSuggestedQuestions && !store.open && !store.currentChat && ((_f = store.suggestedQuestions) === null || _f === void 0 ? void 0 : _f.length) > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__suggested-questions", children: store.suggestedQuestions.map(function (question, index) { return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__suggested-questions__item", onClick: function () {
1314
1559
  controller.openChat(question);
1315
1560
  }, children: question }, index)); }) })), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__bubble', onClick: function () { return controller.handlers.button.click(); }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "chat", title: "Open Chat" }) }), store.open && shouldShowSideChat && activeMessage ? ((0, jsx_runtime_1.jsxs)("div", { ref: secondaryRef, className: (0, classnames_1.default)('ss__chat__secondary'), style: isMobile
1316
1561
  ? {
@@ -1340,9 +1585,9 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1340
1585
  setMobileProductInfoOpen(false);
1341
1586
  (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1342
1587
  } }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__content", children: (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__messages', children: {
1343
- inspirationResult: ((0, jsx_runtime_1.jsx)(ChatInspirationResultMessage_1.ChatInspirationResultMessage, { chatItem: activeMessage, controller: controller, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined })),
1588
+ inspirationResult: ((0, jsx_runtime_1.jsx)(ChatInspirationResultMessage_1.ChatInspirationResultMessage, { chatItem: activeMessage, controller: controller, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined })),
1344
1589
  productComparison: ((0, jsx_runtime_1.jsx)(ChatProductComparisonMessage_1.ChatProductComparisonMessage, { chatItem: activeMessage, controller: controller })),
1345
- productQuery: ((0, jsx_runtime_1.jsx)(ChatProductQueryMessage_1.ChatProductQueryMessage, { chatItem: activeMessage, controller: controller, displayFields: (_h = controller.config.settings) === null || _h === void 0 ? void 0 : _h.displayFields })),
1590
+ productQuery: ((0, jsx_runtime_1.jsx)(ChatProductQueryMessage_1.ChatProductQueryMessage, { chatItem: activeMessage, controller: controller, displayFields: (_j = (_h = controller.config.settings) === null || _h === void 0 ? void 0 : _h.quickview) === null || _j === void 0 ? void 0 : _j.displayFields, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1346
1591
  }[activeMessage.messageType] || null }) })] })) : null, store.open ? ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__primary', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__header', children: [(0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__header__title", children: [logo ? (0, jsx_runtime_1.jsx)("img", { className: "ss__chat__header__title__logo", src: logo }) : null, (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__header__title__text", children: [title ? (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__header__title__text__primary", children: title }) : null, subtitle ? (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__header__title__text__secondary", children: subtitle }) : null] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__header__buttons", children: [(0, jsx_runtime_1.jsx)(Button_1.Button
1347
1592
  // disabled={store.currentChat?.chat && store.currentChat.chat.length <= 1}
1348
1593
  , {
@@ -1357,38 +1602,40 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1357
1602
  systemMessages.length >= feedbackAfterMessages &&
1358
1603
  !((_e = store.currentChat) === null || _e === void 0 ? void 0 : _e.feedbackDismissed) &&
1359
1604
  (!hasRated || ((_f = store.currentChat) === null || _f === void 0 ? void 0 : _f.feedbackJustGiven));
1360
- return shouldShowFeedback ? ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__session-feedback", children: [(0, jsx_runtime_1.jsx)("div", { className: "ss__chat__session-feedback__icon", children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "chat", size: "16px" }) }), (0, jsx_runtime_1.jsx)("span", { className: "ss__chat__session-feedback__label", children: hasRated ? 'Thank you for your feedback' : "How's your experience so far?" }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__session-feedback__actions".concat(hasRated ? ' ss__chat__session-feedback__actions--rated' : ''), children: [(!hasRated || currentRating === 'UP') && ((0, jsx_runtime_1.jsx)("span", { onClick: function () { return !hasRated && controller.handleFeedback('UP'); }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: 'thumbs-up', title: 'Thumbs Up' }) })), (!hasRated || currentRating === 'DOWN') && ((0, jsx_runtime_1.jsx)("span", { onClick: function () { return !hasRated && controller.handleFeedback('DOWN'); }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: 'thumbs-down', title: 'Thumbs Down' }) }))] }), !hasRated && ((0, jsx_runtime_1.jsx)("span", { className: "ss__chat__session-feedback__close", onClick: function () {
1605
+ return shouldShowFeedback ? ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__session-feedback", children: [(0, jsx_runtime_1.jsx)("div", { className: "ss__chat__session-feedback__icon", children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "chat", size: "16px" }) }), (0, jsx_runtime_1.jsx)("span", { className: "ss__chat__session-feedback__label", children: hasRated ? 'Thank you for your feedback' : "How's your experience so far?" }), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__session-feedback__actions".concat(hasRated ? ' ss__chat__session-feedback__actions--rated' : ''), children: [(!hasRated || currentRating === 'UP') && ((0, jsx_runtime_1.jsx)("span", { onClick: function () { return !hasRated && controller.handleFeedback('UP'); }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: 'thumbs-up', size: "16px", title: 'Thumbs Up' }) })), (!hasRated || currentRating === 'DOWN') && ((0, jsx_runtime_1.jsx)("span", { onClick: function () { return !hasRated && controller.handleFeedback('DOWN'); }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: 'thumbs-down', size: "16px", title: 'Thumbs Down' }) }))] }), !hasRated && ((0, jsx_runtime_1.jsx)("span", { className: "ss__chat__session-feedback__close", onClick: function () {
1361
1606
  if (store.currentChat) {
1362
1607
  store.currentChat.feedbackDismissed = true;
1363
1608
  store.currentChat.save();
1364
1609
  }
1365
1610
  }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "close-thin", size: "14px" }) }))] })) : null;
1366
- })(), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__content", children: [(0, jsx_runtime_1.jsx)("div", { className: "ss__chat__content__header", children: ((_j = store.currentChat) === null || _j === void 0 ? void 0 : _j.comparisons.compared) && store.currentChat.comparisons.compared.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons__header', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons__header__title', children: [(0, jsx_runtime_1.jsx)(__1.Icon, { className: 'ss__chat__content__header__comparisons__header__title__icon', icon: 'clipboard' }), (0, jsx_runtime_1.jsxs)("span", { className: 'ss__chat__content__header__comparisons__header__title__text', children: ["Compare Products (", (_k = store.currentChat) === null || _k === void 0 ? void 0 : _k.comparisons.compared.length, "/", (_l = store.currentChat) === null || _l === void 0 ? void 0 : _l.comparisons.maxItems, ")"] })] }), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__content__header__comparisons__header__actions', children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.reset(); }, children: "clear" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons__content', children: [(0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__content__header__comparisons__content__items', children: Array.from({ length: (_m = store.currentChat) === null || _m === void 0 ? void 0 : _m.comparisons.maxItems }).map(function (_, index) {
1611
+ })(), (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__content", children: [(0, jsx_runtime_1.jsx)("div", { ref: headerRef, className: (0, classnames_1.default)('ss__chat__content__header', {
1612
+ 'ss__chat__content__header--overlay': messagesOverflow,
1613
+ }), children: ((_k = store.currentChat) === null || _k === void 0 ? void 0 : _k.comparisons.compared) && store.currentChat.comparisons.compared.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons__header', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons__header__title', children: [(0, jsx_runtime_1.jsx)(__1.Icon, { className: 'ss__chat__content__header__comparisons__header__title__icon', icon: 'clipboard' }), (0, jsx_runtime_1.jsxs)("span", { className: 'ss__chat__content__header__comparisons__header__title__text', children: ["Compare Products (", (_l = store.currentChat) === null || _l === void 0 ? void 0 : _l.comparisons.compared.length, "/", (_m = store.currentChat) === null || _m === void 0 ? void 0 : _m.comparisons.maxItems, ")"] })] }), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__content__header__comparisons__header__actions', children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.reset(); }, children: "clear" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__content__header__comparisons__content', children: [(0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__content__header__comparisons__content__items', children: Array.from({ length: (_o = store.currentChat) === null || _o === void 0 ? void 0 : _o.comparisons.maxItems }).map(function (_, index) {
1367
1614
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1368
1615
  var comparisonItem = (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.compared[index];
1369
1616
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__content__header__comparisons__content__comparison', {
1370
1617
  'ss__chat__content__header__comparisons__content__comparison--placeholder': !comparisonItem,
1371
1618
  }), children: comparisonItem ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Image_1.Image
1372
1619
  // onClick={() => {
1373
- // controller?.viewProduct(product as any);
1620
+ // controller?.productQuickView(product as any);
1374
1621
  // }}
1375
1622
  , {
1376
1623
  // onClick={() => {
1377
- // controller?.viewProduct(product as any);
1624
+ // controller?.productQuickView(product as any);
1378
1625
  // }}
1379
1626
  alt: ((_e = (_d = (_c = (((_b = comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result) === null || _b === void 0 ? void 0 : _b.display) || (comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result))) === null || _c === void 0 ? void 0 : _c.mappings) === null || _d === void 0 ? void 0 : _d.core) === null || _e === void 0 ? void 0 : _e.name) || '', src: ((_j = (_h = (_g = (((_f = comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result) === null || _f === void 0 ? void 0 : _f.display) || (comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result))) === null || _g === void 0 ? void 0 : _g.mappings) === null || _h === void 0 ? void 0 : _h.core) === null || _j === void 0 ? void 0 : _j.imageUrl) || '' }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__content__header__comparisons__content__comparison__remove", onClick: function () {
1380
1627
  var _a;
1381
1628
  (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.remove(comparisonItem.result.id);
1382
1629
  }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: 'close-thin', size: '12px' }) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: 'plus-thin' }), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__content__header__comparisons__content__comparison--placeholder__text', children: "Add" })] })) }, index));
1383
1630
  }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__content__header__comparisons__action', {
1384
- 'ss__chat__content__header__comparisons__action--hidden': (((_o = store.currentChat) === null || _o === void 0 ? void 0 : _o.comparisons.compared.length) || 0) < 2,
1385
- }), children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () { return controller.search(); }, icon: { icon: 'compare', title: 'Compare' }, children: "Compare" }) })] })] })) }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__messages', ref: messagesContainerRef, style: visibleChatLength ? { overflowY: 'auto', scrollbarGutter: 'stable' } : undefined, children: [(!((_p = store.currentChat) === null || _p === void 0 ? void 0 : _p.chat) || store.currentChat.chat.length === 0) && store.welcomeMessage && ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__welcome", children: [(0, jsx_runtime_1.jsx)("div", { className: "ss__chat__welcome__message", children: store.welcomeMessage }), (0, jsx_runtime_1.jsx)(SuggestedQuestions_1.SuggestedQuestions, { questions: store.suggestedQuestions, controller: controller })] })), (_q = store.currentChat) === null || _q === void 0 ? void 0 : _q.chat.filter(function (chatItem) { return chatItem.messageType !== 'productQuery'; }).map(function (chatItem, index) { return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message ss__chat__message--".concat(chatItem.messageType), children: {
1386
- user: ((0, jsx_runtime_1.jsx)(MessageUser_1.MessageUser, { chatItem: chatItem, controller: controller, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined })),
1387
- text: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1388
- content: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1389
- productSearchResult: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1390
- inspirationResult: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1391
- productAnswer: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1631
+ 'ss__chat__content__header__comparisons__action--hidden': (((_p = store.currentChat) === null || _p === void 0 ? void 0 : _p.comparisons.compared.length) || 0) < 2,
1632
+ }), children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () { return controller.search(); }, icon: { icon: 'compare', title: 'Compare' }, children: "Compare" }) })] })] })) }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__messages', ref: messagesContainerRef, style: visibleChatLength ? { scrollbarGutter: 'stable' } : undefined, children: [(!((_q = store.currentChat) === null || _q === void 0 ? void 0 : _q.chat) || store.currentChat.chat.length === 0) && store.welcomeMessage && !((_r = store.currentChat) === null || _r === void 0 ? void 0 : _r.isExpired) && ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__welcome", children: [(0, jsx_runtime_1.jsx)("div", { className: "ss__chat__welcome__message", children: store.welcomeMessage }), (0, jsx_runtime_1.jsx)(SuggestedQuestions_1.SuggestedQuestions, { questions: store.suggestedQuestions, controller: controller })] })), (_s = store.currentChat) === null || _s === void 0 ? void 0 : _s.chat.filter(function (chatItem) { return chatItem.messageType !== 'productQuery'; }).map(function (chatItem, index) { return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__message ss__chat__message--".concat(chatItem.messageType), children: {
1633
+ user: ((0, jsx_runtime_1.jsx)(MessageUser_1.MessageUser, { chatItem: chatItem, controller: controller, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1634
+ text: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1635
+ content: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1636
+ productSearchResult: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1637
+ inspirationResult: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1638
+ productAnswer: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1392
1639
  productComparison: (function () {
1393
1640
  var _a;
1394
1641
  // On mobile, only the first productComparison in the session
@@ -1396,328 +1643,369 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1396
1643
  // prominent "Show Details" button instead.
1397
1644
  var comparisonMessages = (((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.chat) || []).filter(function (m) { return m.messageType === 'productComparison'; });
1398
1645
  var isFirst = comparisonMessages.length > 0 && comparisonMessages[0].id === chatItem.id;
1399
- return ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, showDetailsButton: isMobile && !isFirst, sideChatOpen: !!shouldShowSideChat }));
1646
+ return ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, showDetailsButton: isMobile && !isFirst, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText }));
1400
1647
  })(),
1401
- productRecommendation: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1648
+ productRecommendation: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onProductQuickView: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1402
1649
  actions: (0, jsx_runtime_1.jsx)(SuggestedQuestions_1.SuggestedQuestions, { actions: chatItem.actions, controller: controller }),
1403
- errorResponse: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, sideChatOpen: !!shouldShowSideChat })),
1404
- topicDrift: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, sideChatOpen: !!shouldShowSideChat })),
1650
+ errorResponse: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1651
+ topicDrift: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, sideChatOpen: !!shouldShowSideChat, primaryColor: colorPrimary, primaryColorText: colorPrimaryText })),
1405
1652
  productQuery: null,
1406
- }[chatItem.messageType] || null }, index)); }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__messages__end", ref: messagesEndRef }), showNewMessages && ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__new-messages", onClick: function () {
1653
+ }[chatItem.messageType] || null }, index)); }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__messages__end", ref: messagesEndRef }), showNewMessages && messagesOverflow && ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__new-messages", onClick: function () {
1407
1654
  scrollToBottom();
1408
1655
  setShowNewMessages(false);
1409
- }, children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: "angle-down", size: "12px" }), (0, jsx_runtime_1.jsx)("span", { children: "New messages" })] }))] }), (0, jsx_runtime_1.jsx)(ChatLoadingIndicator_1.ChatLoadingIndicator, { loading: store.loading, verbs: loadingVerbs }), !((_r = store.currentChat) === null || _r === void 0 ? void 0 : _r.isExpired) ? ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__content__footer", ref: footerRef, children: [store.error && (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__error", children: store.error.message }), ((_s = store.currentChat) === null || _s === void 0 ? void 0 : _s.sessionLimitReached) && ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift', children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: "info", size: "18px", className: 'ss__chat__topic-drift__icon--info' }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift__text', children: [(0, jsx_runtime_1.jsx)("span", { children: "Session limit reached" }), (0, jsx_runtime_1.jsx)("span", { children: "This chat has reached its maximum number of interactions. Start a new session to continue." })] }), (0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__topic-drift__button', onClick: function () {
1410
- controller.store.createChat();
1411
- }, children: "New Session" })] })), ((_t = store.currentChat) === null || _t === void 0 ? void 0 : _t.actions) && store.currentChat.actions.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__actions', children: (_u = store.currentChat) === null || _u === void 0 ? void 0 : _u.actions.map(function (action, index) {
1412
- var _a;
1413
- return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__wrap", children: {
1414
- facets: action.data.length ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facets-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions--title", children: "Filter by:" }), multiselectFacets && ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facets-apply".concat(((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.attached.some(function (item) { return item.type === 'facet'; }))
1415
- ? ' ss__chat__actions__facets-apply--active'
1416
- : ''), children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () {
1417
- controller.search();
1418
- }, children: "Apply" }) }))] }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions--facets", children: action.data.slice(0, 10).map(function (facet, idx) {
1419
- var _a;
1420
- if (!((_a = facet.values) === null || _a === void 0 ? void 0 : _a.length))
1421
- return null;
1422
- return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facet ss__chat__actions__facet--".concat(facet.type), children: (0, jsx_runtime_1.jsx)(__1.Dropdown, { usePortal: true, dropUp: true, button: (0, jsx_runtime_1.jsx)(FacetButton, { label: facet.label || facet.field }), style: {
1423
- '.ss__dropdown__content': __assign({ width: '150px', maxHeight: '200px', overflowY: 'auto', background: 'white', boxShadow: '0px 3px 6px 0px rgba(0, 0, 0, 0.2)', borderRadius: '6px' }, (multiselectFacets
1424
- ? {
1425
- '.ss__chat__actions__facet__option--checkbox': {
1426
- display: 'flex',
1427
- alignItems: 'center',
1428
- gap: '8px',
1429
- padding: '6px 10px',
1430
- cursor: 'pointer',
1431
- width: '100%',
1432
- boxSizing: 'border-box',
1433
- background: '#fff',
1434
- border: 'none',
1435
- borderBottom: '1px solid #f0f0f0',
1436
- '&:hover': {
1437
- background: '#f4f4ff',
1438
- },
1439
- '&:last-child': {
1440
- borderBottom: 'none',
1441
- },
1442
- '.ss__chat__actions__facet__option__checkbox': {
1443
- width: '16px',
1444
- height: '16px',
1445
- borderRadius: '3px',
1446
- border: '2px solid #ccc',
1447
- display: 'flex',
1448
- alignItems: 'center',
1449
- justifyContent: 'center',
1450
- flexShrink: 0,
1451
- '&.ss__chat__actions__facet__option__checkbox--checked': {
1452
- background: '#253B80',
1453
- borderColor: '#253B80',
1454
- },
1455
- },
1456
- '.ss__chat__actions__facet__option__label': {
1457
- fontSize: '14px',
1458
- color: '#333',
1459
- flex: '1 1 auto',
1460
- textAlign: 'left',
1461
- },
1462
- },
1463
- }
1464
- : {
1465
- '.ss__button': {
1466
- width: '100%',
1467
- border: 'none',
1468
- borderRadius: 0,
1469
- boxSizing: 'border-box',
1470
- background: '#fff',
1471
- '&:hover': {
1472
- background: '#f4f4ff',
1656
+ }, children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: "angle-down", size: "12px" }), (0, jsx_runtime_1.jsx)("span", { children: "New messages" })] }))] }), (0, jsx_runtime_1.jsx)(ChatLoadingIndicator_1.ChatLoadingIndicator, { loading: store.loading, verbs: loadingVerbs }), !((_t = store.currentChat) === null || _t === void 0 ? void 0 : _t.isExpired) ? ((function () {
1657
+ var _a, _b, _c, _d;
1658
+ var dropEnabled = store.features.imageSearch.enabled && !store.loading && !store.blocked && !((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.sessionLimitReached);
1659
+ var hasFiles = function (e) { var _a; return Array.from(((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.types) || []).includes('Files'); };
1660
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__content__footer", ref: footerRef, onDragEnter: function (e) {
1661
+ if (!dropEnabled || !hasFiles(e))
1662
+ return;
1663
+ e.preventDefault();
1664
+ dragCounterRef.current += 1;
1665
+ setIsDraggingFile(true);
1666
+ }, onDragOver: function (e) {
1667
+ if (!dropEnabled || !hasFiles(e))
1668
+ return;
1669
+ // Required to allow the drop event to fire
1670
+ e.preventDefault();
1671
+ if (e.dataTransfer)
1672
+ e.dataTransfer.dropEffect = 'copy';
1673
+ }, onDragLeave: function (e) {
1674
+ if (!dropEnabled || !hasFiles(e))
1675
+ return;
1676
+ dragCounterRef.current = Math.max(0, dragCounterRef.current - 1);
1677
+ if (dragCounterRef.current === 0)
1678
+ setIsDraggingFile(false);
1679
+ }, onDrop: function (e) { return __awaiter(void 0, void 0, void 0, function () {
1680
+ var dropped, images, dt;
1681
+ var _a;
1682
+ return __generator(this, function (_b) {
1683
+ switch (_b.label) {
1684
+ case 0:
1685
+ if (!dropEnabled || !hasFiles(e))
1686
+ return [2 /*return*/];
1687
+ e.preventDefault();
1688
+ dragCounterRef.current = 0;
1689
+ setIsDraggingFile(false);
1690
+ dropped = Array.from(((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) || []);
1691
+ images = dropped.filter(function (f) { return f.type.startsWith('image/'); });
1692
+ if (images.length === 0)
1693
+ return [2 /*return*/];
1694
+ dt = new DataTransfer();
1695
+ images.forEach(function (f) { return dt.items.add(f); });
1696
+ return [4 /*yield*/, controller.upload(dt.files)];
1697
+ case 1:
1698
+ _b.sent();
1699
+ return [2 /*return*/];
1700
+ }
1701
+ });
1702
+ }); }, children: [store.error && (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__error", children: store.error.message }), ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.sessionLimitReached) && ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift', children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: "info", size: "18px", className: 'ss__chat__topic-drift__icon--info' }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift__text', children: [(0, jsx_runtime_1.jsx)("span", { children: "Session limit reached" }), (0, jsx_runtime_1.jsx)("span", { children: "This chat has reached its maximum number of interactions. Start a new session to continue." })] }), (0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__topic-drift__button', onClick: function () {
1703
+ controller.store.createChat();
1704
+ }, children: "New Session" })] })), store.facets && store.facets.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__actions', children: (0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__wrap", children: [(0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facets-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions--title", children: "Filter by:" }), multiselectFacets && store.hasPendingFacetChanges && ((0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__actions__facets-apply ss__chat__actions__facets-apply--active', children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () {
1705
+ controller.search();
1706
+ }, children: "Apply" }) }))] }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions--facets", children: store.facets.slice(0, 10).map(function (facet, idx) {
1707
+ var _a;
1708
+ // range/slider facets render via FacetSlider; everything else needs at least one value to be useful
1709
+ if (facet.type !== 'range' && !((_a = facet.values) === null || _a === void 0 ? void 0 : _a.length))
1710
+ return null;
1711
+ if (facet.type === 'range') {
1712
+ return (0, jsx_runtime_1.jsx)(SliderFacetDropdown, { facet: facet, label: getFacetButtonLabel(facet) }, idx);
1713
+ }
1714
+ return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facet ss__chat__actions__facet--".concat(facet.type), children: (0, jsx_runtime_1.jsx)(__1.Dropdown, { usePortal: true, dropUp: true, button: (0, jsx_runtime_1.jsx)(FacetButton, { label: getFacetButtonLabel(facet) }), style: {
1715
+ '.ss__dropdown__content': __assign({ width: '150px', maxHeight: '200px', overflowY: 'auto', background: 'white', boxShadow: '0px 3px 6px 0px rgba(0, 0, 0, 0.2)', borderRadius: '6px' }, (multiselectFacets
1716
+ ? {
1717
+ '.ss__chat__actions__facet__option--checkbox': {
1718
+ display: 'flex',
1719
+ alignItems: 'center',
1720
+ gap: '8px',
1721
+ padding: '6px 10px',
1722
+ cursor: 'pointer',
1723
+ width: '100%',
1724
+ boxSizing: 'border-box',
1725
+ background: '#fff',
1726
+ border: 'none',
1727
+ borderBottom: '1px solid #f0f0f0',
1728
+ '&:hover': {
1729
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.95),
1730
+ },
1731
+ '&:last-child': {
1732
+ borderBottom: 'none',
1733
+ },
1734
+ '.ss__chat__actions__facet__option__checkbox': {
1735
+ width: '16px',
1736
+ height: '16px',
1737
+ borderRadius: '3px',
1738
+ border: '2px solid #ccc',
1739
+ display: 'flex',
1740
+ alignItems: 'center',
1741
+ justifyContent: 'center',
1742
+ flexShrink: 0,
1743
+ '&.ss__chat__actions__facet__option__checkbox--checked': {
1744
+ background: colorPrimary,
1745
+ borderColor: colorPrimary,
1746
+ color: colorPrimaryText,
1747
+ svg: {
1748
+ fill: colorPrimaryText,
1749
+ stroke: colorPrimaryText,
1473
1750
  },
1474
1751
  },
1475
- })),
1476
- }, children: (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facet__options", children: facet.type === 'range-buckets'
1477
- ? facet.values.map(function (option) {
1478
- var _a, _b;
1479
- var optionValue = "".concat((_a = option.low) !== null && _a !== void 0 ? _a : '*', ":").concat((_b = option.high) !== null && _b !== void 0 ? _b : '*');
1480
- if (multiselectFacets) {
1481
- var isSelected_1 = controller.store.isFacetSelected(facet.field, optionValue);
1482
- return ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: function () {
1483
- if (isSelected_1) {
1484
- controller.store.removeFacet(facet.field, optionValue);
1485
- }
1486
- else {
1487
- controller.store.addFacet({
1488
- key: facet.field,
1489
- facetLabel: facet.label,
1490
- value: optionValue,
1491
- label: option.label,
1492
- count: option.count,
1493
- });
1494
- }
1495
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__actions__facet__option__checkbox', {
1496
- 'ss__chat__actions__facet__option__checkbox--checked': isSelected_1,
1497
- }), children: isSelected_1 && (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "check-thin", size: "10px" }) }), (0, jsx_runtime_1.jsx)("span", { className: "ss__chat__actions__facet__option__label", children: option.label })] }, optionValue));
1498
- }
1499
- return ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () {
1752
+ },
1753
+ '.ss__chat__actions__facet__option__label': {
1754
+ fontSize: '14px',
1755
+ color: '#333',
1756
+ flex: '1 1 auto',
1757
+ textAlign: 'left',
1758
+ },
1759
+ },
1760
+ }
1761
+ : {
1762
+ '.ss__button': {
1763
+ width: '100%',
1764
+ border: 'none',
1765
+ borderRadius: 0,
1766
+ boxSizing: 'border-box',
1767
+ background: '#fff',
1768
+ '&:hover': {
1769
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.95),
1770
+ },
1771
+ },
1772
+ })),
1773
+ }, children: (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facet__options", children: facet.type === 'range-buckets'
1774
+ ? facet.values.map(function (option) {
1775
+ var _a, _b;
1776
+ var rangeOption = option;
1777
+ var optionValue = "".concat((_a = rangeOption.low) !== null && _a !== void 0 ? _a : '*', ":").concat((_b = rangeOption.high) !== null && _b !== void 0 ? _b : '*');
1778
+ if (multiselectFacets) {
1779
+ var isSelected_1 = controller.store.isFacetSelected(facet.field, optionValue);
1780
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: function () {
1781
+ if (isSelected_1) {
1782
+ controller.store.removeFacet(facet.field, optionValue);
1783
+ }
1784
+ else {
1500
1785
  controller.store.addFacet({
1501
1786
  key: facet.field,
1502
- facetLabel: facet.label,
1503
1787
  value: optionValue,
1504
- label: option.label,
1505
- count: option.count,
1506
1788
  });
1507
- controller.search();
1508
- }, children: option.label }, optionValue));
1509
- })
1510
- : facet.values.map(function (option) {
1511
- var optionValue = option.value || option.label;
1512
- if (multiselectFacets) {
1513
- var isSelected_2 = controller.store.isFacetSelected(facet.field, optionValue);
1514
- return ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: function () {
1515
- if (isSelected_2) {
1516
- controller.store.removeFacet(facet.field, optionValue);
1517
- }
1518
- else {
1519
- controller.store.addFacet({
1520
- key: facet.field,
1521
- facetLabel: facet.label,
1522
- value: optionValue,
1523
- label: option.label,
1524
- count: option.count,
1525
- });
1526
- }
1527
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__actions__facet__option__checkbox', {
1528
- 'ss__chat__actions__facet__option__checkbox--checked': isSelected_2,
1529
- }), children: isSelected_2 && (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "check-thin", size: "10px" }) }), (0, jsx_runtime_1.jsx)("span", { className: "ss__chat__actions__facet__option__label", children: option.label })] }, optionValue));
1530
- }
1531
- return ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () {
1789
+ }
1790
+ }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__actions__facet__option__checkbox', {
1791
+ 'ss__chat__actions__facet__option__checkbox--checked': isSelected_1,
1792
+ }), children: isSelected_1 && (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "check-thin", size: "10px" }) }), (0, jsx_runtime_1.jsx)("span", { className: "ss__chat__actions__facet__option__label", children: rangeOption.label })] }, optionValue));
1793
+ }
1794
+ return ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () {
1795
+ controller.store.addFacet({
1796
+ key: facet.field,
1797
+ value: optionValue,
1798
+ });
1799
+ controller.search();
1800
+ }, children: rangeOption.label }, optionValue));
1801
+ })
1802
+ : facet.values.map(function (option) {
1803
+ var valueOption = option;
1804
+ var optionValue = valueOption.value || valueOption.label;
1805
+ if (multiselectFacets) {
1806
+ var isSelected_2 = controller.store.isFacetSelected(facet.field, optionValue);
1807
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: function () {
1808
+ if (isSelected_2) {
1809
+ controller.store.removeFacet(facet.field, optionValue);
1810
+ }
1811
+ else {
1532
1812
  controller.store.addFacet({
1533
1813
  key: facet.field,
1534
- facetLabel: facet.label,
1535
1814
  value: optionValue,
1536
- label: option.label,
1537
- count: option.count,
1538
1815
  });
1539
- controller.search();
1540
- }, children: option.label }, optionValue));
1541
- }) }) }, facet.field) }, idx));
1542
- }) })] })) : null,
1543
- actions: ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions--suggested" })),
1544
- }[action.type] || null }, index));
1545
- }) })), (function () {
1546
- var _a, _b, _c;
1547
- var activeComparisonSearchResults = shouldShowSideChat && (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productComparison'
1548
- ? activeMessage.searchResults || []
1549
- : null;
1550
- var showCommittedComparisons = !activeComparisonSearchResults &&
1551
- ((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.committed) &&
1552
- store.currentChat.comparisons.committed.length > 0 &&
1553
- ((activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'user' ||
1554
- (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productComparison' ||
1555
- (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productQuery');
1556
- var visibleAttachments = ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.attachments.attached.filter(function (item) { return item.state === 'attached' || item.state === 'active' || item.state === 'loading' || item.state === 'error'; })) || [];
1557
- var productAttachments = visibleAttachments.filter(function (item) {
1558
- return item.type === 'product' &&
1559
- item.requestType !== 'productSimilar' &&
1560
- item.requestType !== 'productComparison';
1561
- });
1562
- var imageAttachments = visibleAttachments.filter(function (item) { return item.type === 'image'; });
1563
- var comparisonItems = activeComparisonSearchResults
1564
- ? activeComparisonSearchResults.map(function (result) {
1565
- var _a, _b, _c, _d, _e, _f;
1566
- var d = (result === null || result === void 0 ? void 0 : result.display) || result;
1567
- return {
1568
- id: result === null || result === void 0 ? void 0 : result.id,
1569
- name: ((_b = (_a = d === null || d === void 0 ? void 0 : d.mappings) === null || _a === void 0 ? void 0 : _a.core) === null || _b === void 0 ? void 0 : _b.name) || '',
1570
- imageUrl: ((_d = (_c = d === null || d === void 0 ? void 0 : d.mappings) === null || _c === void 0 ? void 0 : _c.core) === null || _d === void 0 ? void 0 : _d.thumbnailImageUrl) || ((_f = (_e = d === null || d === void 0 ? void 0 : d.mappings) === null || _e === void 0 ? void 0 : _e.core) === null || _f === void 0 ? void 0 : _f.imageUrl) || '',
1571
- onClick: isMobile
1572
- ? function () {
1573
- controller.viewProduct(result);
1574
- setMobileProductInfoOpen(true);
1575
- }
1576
- : undefined,
1577
- };
1578
- })
1579
- : showCommittedComparisons
1580
- ? (((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.comparisons.committed) || []).map(function (comparisonItem) {
1581
- var _a, _b, _c, _d, _e, _f, _g, _h;
1582
- var d = ((_a = comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result) === null || _a === void 0 ? void 0 : _a.display) || (comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result);
1816
+ }
1817
+ }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__actions__facet__option__checkbox', {
1818
+ 'ss__chat__actions__facet__option__checkbox--checked': isSelected_2,
1819
+ }), children: isSelected_2 && (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "check-thin", size: "10px" }) }), (0, jsx_runtime_1.jsx)("span", { className: "ss__chat__actions__facet__option__label", children: valueOption.label })] }, optionValue));
1820
+ }
1821
+ return ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () {
1822
+ controller.store.addFacet({
1823
+ key: facet.field,
1824
+ value: optionValue,
1825
+ });
1826
+ controller.search();
1827
+ }, children: valueOption.label }, optionValue));
1828
+ }) }) }, facet.field) }, idx));
1829
+ }) })] }) })), (function () {
1830
+ var _a, _b, _c;
1831
+ var activeComparisonSearchResults = shouldShowSideChat && (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productComparison'
1832
+ ? activeMessage.searchResults || []
1833
+ : null;
1834
+ var showCommittedComparisons = !activeComparisonSearchResults &&
1835
+ ((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.committed) &&
1836
+ store.currentChat.comparisons.committed.length > 0 &&
1837
+ ((activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'user' ||
1838
+ (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productComparison' ||
1839
+ (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productQuery');
1840
+ var visibleAttachments = ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.attachments.attached.filter(function (item) { return item.state === 'attached' || item.state === 'active' || item.state === 'loading' || item.state === 'error'; })) || [];
1841
+ var productAttachments = visibleAttachments.filter(function (item) {
1842
+ return item.type === 'product' &&
1843
+ item.requestType !== 'productSimilar' &&
1844
+ item.requestType !== 'productComparison';
1845
+ });
1846
+ var imageAttachments = visibleAttachments.filter(function (item) { return item.type === 'image'; });
1847
+ var comparisonItems = activeComparisonSearchResults
1848
+ ? activeComparisonSearchResults.map(function (result) {
1849
+ var _a, _b, _c, _d, _e, _f;
1850
+ var d = (result === null || result === void 0 ? void 0 : result.display) || result;
1583
1851
  return {
1584
- id: (_b = comparisonItem.result) === null || _b === void 0 ? void 0 : _b.id,
1585
- name: ((_d = (_c = d === null || d === void 0 ? void 0 : d.mappings) === null || _c === void 0 ? void 0 : _c.core) === null || _d === void 0 ? void 0 : _d.name) || '',
1586
- imageUrl: ((_f = (_e = d === null || d === void 0 ? void 0 : d.mappings) === null || _e === void 0 ? void 0 : _e.core) === null || _f === void 0 ? void 0 : _f.thumbnailImageUrl) || ((_h = (_g = d === null || d === void 0 ? void 0 : d.mappings) === null || _g === void 0 ? void 0 : _g.core) === null || _h === void 0 ? void 0 : _h.imageUrl) || '',
1852
+ id: result === null || result === void 0 ? void 0 : result.id,
1853
+ name: ((_b = (_a = d === null || d === void 0 ? void 0 : d.mappings) === null || _a === void 0 ? void 0 : _a.core) === null || _b === void 0 ? void 0 : _b.name) || '',
1854
+ imageUrl: ((_d = (_c = d === null || d === void 0 ? void 0 : d.mappings) === null || _c === void 0 ? void 0 : _c.core) === null || _d === void 0 ? void 0 : _d.thumbnailImageUrl) || ((_f = (_e = d === null || d === void 0 ? void 0 : d.mappings) === null || _e === void 0 ? void 0 : _e.core) === null || _f === void 0 ? void 0 : _f.imageUrl) || '',
1587
1855
  onClick: isMobile
1588
1856
  ? function () {
1589
- controller.viewProduct(comparisonItem.result);
1857
+ controller.productQuickView(result);
1590
1858
  setMobileProductInfoOpen(true);
1591
1859
  }
1592
1860
  : undefined,
1593
1861
  };
1594
1862
  })
1595
- : [];
1596
- var productItems = productAttachments.map(function (item) { return ({
1597
- id: item.id,
1598
- name: item.name || '',
1599
- imageUrl: item.thumbnailUrl || '',
1600
- onClick: isMobile
1601
- ? function () {
1602
- setMobileProductInfoOpen(true);
1603
- }
1604
- : function () {
1605
- var _a, _b, _c;
1606
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.setActiveMessage(((_c = (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.activeMessage) === null || _c === void 0 ? void 0 : _c.id) || '');
1607
- },
1608
- onRemove: function () {
1609
- var _a, _b;
1610
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id);
1611
- setMobileProductInfoOpen(false);
1612
- (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1613
- },
1614
- }); });
1615
- var imageItems = imageAttachments.map(function (item) {
1616
- var _a;
1617
- return ({
1863
+ : showCommittedComparisons
1864
+ ? (((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.comparisons.committed) || []).map(function (comparisonItem) {
1865
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1866
+ var d = ((_a = comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result) === null || _a === void 0 ? void 0 : _a.display) || (comparisonItem === null || comparisonItem === void 0 ? void 0 : comparisonItem.result);
1867
+ return {
1868
+ id: (_b = comparisonItem.result) === null || _b === void 0 ? void 0 : _b.id,
1869
+ name: ((_d = (_c = d === null || d === void 0 ? void 0 : d.mappings) === null || _c === void 0 ? void 0 : _c.core) === null || _d === void 0 ? void 0 : _d.name) || '',
1870
+ imageUrl: ((_f = (_e = d === null || d === void 0 ? void 0 : d.mappings) === null || _e === void 0 ? void 0 : _e.core) === null || _f === void 0 ? void 0 : _f.thumbnailImageUrl) || ((_h = (_g = d === null || d === void 0 ? void 0 : d.mappings) === null || _g === void 0 ? void 0 : _g.core) === null || _h === void 0 ? void 0 : _h.imageUrl) || '',
1871
+ onClick: isMobile
1872
+ ? function () {
1873
+ controller.productQuickView(comparisonItem.result);
1874
+ setMobileProductInfoOpen(true);
1875
+ }
1876
+ : undefined,
1877
+ };
1878
+ })
1879
+ : [];
1880
+ var productItems = productAttachments.map(function (item) { return ({
1618
1881
  id: item.id,
1619
- name: item.fileName || 'Image',
1620
- imageUrl: item.base64 || item.thumbnailUrl || '',
1621
- isLoading: item.state === 'loading',
1622
- hasError: !!item.error,
1623
- errorMessage: (_a = item.error) === null || _a === void 0 ? void 0 : _a.message,
1624
- onRemove: function () { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id); },
1625
- });
1626
- });
1627
- var productTitle = productItems.length > 1 ? 'Compare these products' : 'Ask about this product' + (isMobile ? '' : ' (click for details)');
1628
- var hasImageError = imageItems.some(function (item) { return item.hasError; });
1629
- var imageTitle = imageItems.length > 0 && !hasImageError ? 'Find products similar to this image:' : '';
1630
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [comparisonItems.length > 0 && ((0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: 'Compare these products', items: comparisonItems, onClose: function () {
1631
- var _a, _b;
1632
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.resetCommitted();
1633
- (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1634
- } })), productItems.length > 0 && ((0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: productTitle, items: productItems, onClose: function () {
1635
- var _a;
1636
- productAttachments.forEach(function (item) { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id); });
1637
- setMobileProductInfoOpen(false);
1638
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissSideChat();
1639
- } })), imageItems.length > 0 && (0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: imageTitle, items: imageItems })] }));
1640
- })(), (function () {
1641
- var _a;
1642
- var drift = (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.topicDrift;
1643
- if (!drift)
1644
- return null;
1645
- // recommendedAction is the prescription; driftType is the diagnosis.
1646
- // Hide the banner when the backend says to keep flowing, or when no drift was detected.
1647
- if (drift.recommendedAction === 'CONTINUE' || drift.driftType === 'NO_DRIFT')
1648
- return null;
1649
- var isScopeRedirect = drift.recommendedAction === 'SCOPE_REDIRECT';
1650
- var primaryText = isScopeRedirect ? "I'm here to help with shopping" : 'Looking for something new?';
1651
- var secondaryText = isScopeRedirect
1652
- ? 'Try asking about products, comparisons, or recommendations'
1653
- : 'Start a fresh session for better assistance, or keep going in this one?';
1654
- var buttonText = isScopeRedirect ? '' : 'New Session';
1655
- return ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift', children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: "info", size: "18px", className: 'ss__chat__topic-drift__icon--info' }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift__text', children: [(0, jsx_runtime_1.jsx)("span", { children: primaryText }), (0, jsx_runtime_1.jsx)("span", { children: secondaryText })] }), buttonText && ((0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__topic-drift__button', onClick: function () {
1656
- var _a, _b;
1657
- if (isScopeRedirect) {
1658
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissTopicDrift();
1659
- return;
1660
- }
1661
- var messageText = (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.handleTopicDrift();
1662
- if (messageText) {
1663
- controller.store.createChat();
1664
- controller.search({ data: { message: messageText } });
1665
- }
1666
- }, children: buttonText })), (0, jsx_runtime_1.jsx)("span", { onClick: function () {
1667
- var _a;
1668
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissTopicDrift();
1669
- }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "close-thin", size: "14px", className: 'ss__chat__topic-drift__icon--close' }) })] }));
1670
- })(), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__input', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__input__input', children: [(0, jsx_runtime_1.jsx)("input", { type: "text", name: "ss-chat-input", disabled: store.loading || store.blocked || ((_v = store.currentChat) === null || _v === void 0 ? void 0 : _v.sessionLimitReached), placeholder: (function () {
1671
- var _a, _b, _c;
1672
- var comparedCount = ((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.compared.length) || 0;
1673
- var committedCount = ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.comparisons.committed.length) || 0;
1674
- var attached = ((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.attachments.attached.filter(function (item) { return item.state === 'attached' || item.state === 'active'; })) || [];
1675
- var attachedProducts = attached.filter(function (item) { return item.type === 'product'; });
1676
- var attachedImages = attached.filter(function (item) { return item.type === 'image' && !item.error; });
1677
- if (attachedProducts.length === 1) {
1678
- return 'Ask about this product...';
1679
- }
1680
- if (comparedCount > 1 || attachedProducts.length > 1) {
1681
- return 'What would you like to compare?';
1682
- }
1683
- if (committedCount > 0) {
1684
- return 'Ask about the compared products...';
1685
- }
1686
- if (attachedImages.length > 0) {
1687
- return 'Ask about this image...';
1688
- }
1689
- if (comparedCount === 1) {
1690
- return 'Add another product to compare...';
1691
- }
1692
- return 'Type your message...';
1693
- })(), onInput: function (e) { return controller.handlers.input.input(e); }, onKeyDown: function (e) {
1694
- controller.handlers.input.enterKey(e);
1695
- if (e.keyCode === 13 && isMobile && mobileProductInfoOpen) {
1696
- setMobileProductInfoOpen(false);
1697
- }
1698
- }, value: controller.store.inputValue }), store.features.imageSearch.enabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__upload-button', disabled: store.loading || store.blocked || ((_w = store.currentChat) === null || _w === void 0 ? void 0 : _w.sessionLimitReached), onClick: function () { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, icon: { icon: 'image', title: 'Upload Image' } }), (0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, onChange: function (e) { return __awaiter(void 0, void 0, void 0, function () {
1699
- return __generator(this, function (_a) {
1700
- switch (_a.label) {
1701
- case 0: return [4 /*yield*/, controller.upload(e.target.files)];
1702
- case 1:
1703
- _a.sent();
1704
- // reset value
1705
- e.target.value = '';
1706
- return [2 /*return*/];
1707
- }
1708
- });
1709
- }); }, multiple: true, type: "file", accept: "image/*", className: "ss__chat__input__input__file" })] }))] }), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__input__actions', children: (function () {
1882
+ name: item.name || '',
1883
+ imageUrl: item.thumbnailUrl || '',
1884
+ onClick: isMobile
1885
+ ? function () {
1886
+ setMobileProductInfoOpen(true);
1887
+ }
1888
+ : function () {
1889
+ var _a, _b, _c;
1890
+ (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.setActiveMessage(((_c = (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.activeMessage) === null || _c === void 0 ? void 0 : _c.id) || '');
1891
+ },
1892
+ onRemove: function () {
1710
1893
  var _a, _b;
1711
- var hasImageAttachment = (((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.attached) || []).some(function (item) { return item.type === 'image' && !item.error; });
1712
- var messageEmpty = !controller.store.inputValue.trim();
1713
- var sendDisabled = store.blocked || ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.sessionLimitReached) || (hasImageAttachment && messageEmpty) || messageEmpty;
1714
- return ((0, jsx_runtime_1.jsx)(Button_1.Button, { className: "ss__chat__send-button", icon: { icon: 'send', title: 'Send Message' }, disabled: sendDisabled, onClick: function () {
1715
- if (sendDisabled)
1894
+ (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id);
1895
+ setMobileProductInfoOpen(false);
1896
+ (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1897
+ },
1898
+ }); });
1899
+ var imageItems = imageAttachments.map(function (item) {
1900
+ var _a;
1901
+ return ({
1902
+ id: item.id,
1903
+ name: item.fileName || 'Image',
1904
+ imageUrl: item.base64 || item.thumbnailUrl || '',
1905
+ isLoading: item.state === 'loading',
1906
+ hasError: !!item.error,
1907
+ errorMessage: (_a = item.error) === null || _a === void 0 ? void 0 : _a.message,
1908
+ onRemove: function () { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id); },
1909
+ });
1910
+ });
1911
+ var productTitle = productItems.length > 1 ? 'Compare these products' : 'Ask about this product' + (isMobile ? '' : ' (click for details)');
1912
+ var hasImageError = imageItems.some(function (item) { return item.hasError; });
1913
+ var imageTitle = imageItems.length > 0 && !hasImageError ? 'Find products similar to this image:' : '';
1914
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [comparisonItems.length > 0 && ((0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: 'Compare these products', items: comparisonItems, onClose: function () {
1915
+ var _a, _b;
1916
+ (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.resetCommitted();
1917
+ (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1918
+ } })), productItems.length > 0 && ((0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: productTitle, items: productItems, onClose: function () {
1919
+ var _a;
1920
+ productAttachments.forEach(function (item) { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id); });
1921
+ setMobileProductInfoOpen(false);
1922
+ (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissSideChat();
1923
+ } })), imageItems.length > 0 && (0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: imageTitle, items: imageItems })] }));
1924
+ })(), (function () {
1925
+ var _a;
1926
+ var drift = (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.topicDrift;
1927
+ if (!drift)
1928
+ return null;
1929
+ // recommendedAction is the prescription; driftType is the diagnosis.
1930
+ // Hide the banner when the backend says to keep flowing, or when no drift was detected.
1931
+ if (drift.recommendedAction === 'CONTINUE' || drift.driftType === 'NO_DRIFT')
1932
+ return null;
1933
+ var isScopeRedirect = drift.recommendedAction === 'SCOPE_REDIRECT';
1934
+ var primaryText = isScopeRedirect ? "I'm here to help with shopping" : 'Looking for something new?';
1935
+ var secondaryText = isScopeRedirect
1936
+ ? 'Try asking about products, comparisons, or recommendations'
1937
+ : 'Start a fresh session for better assistance, or keep going in this one?';
1938
+ var buttonText = isScopeRedirect ? '' : 'New Session';
1939
+ return ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift', children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: "info", size: "18px", className: 'ss__chat__topic-drift__icon--info' }), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__topic-drift__text', children: [(0, jsx_runtime_1.jsx)("span", { children: primaryText }), (0, jsx_runtime_1.jsx)("span", { children: secondaryText })] }), buttonText && ((0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__topic-drift__button', onClick: function () {
1940
+ var _a, _b;
1941
+ if (isScopeRedirect) {
1942
+ (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissTopicDrift();
1716
1943
  return;
1717
- controller.search();
1718
- if (isMobile && mobileProductInfoOpen) {
1719
- setMobileProductInfoOpen(false);
1720
1944
  }
1721
- } }));
1722
- })() })] }), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__disclaimer', children: (0, jsx_runtime_1.jsxs)("i", { children: ["Powered by Athos Commerce. AI-powered assistant. It sometimes make mistakes. Avoid sharing personal data.", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://athoscommerce.com/legal/privacy-policy/", target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })] }) })] })) : ((0, jsx_runtime_1.jsx)("div", { children: "This chat is expired. Please start a new chat." }))] })] })) : null] })), (0, jsx_runtime_1.jsx)(__1.Overlay, { style: { zIndex: 1001 }, color: "transparent", active: store.open, onClick: function () { return controller.handlers.button.click(); } })] }) }));
1945
+ var messageText = (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.handleTopicDrift();
1946
+ if (messageText) {
1947
+ controller.store.createChat();
1948
+ controller.search({ data: { message: messageText } });
1949
+ }
1950
+ }, children: buttonText })), (0, jsx_runtime_1.jsx)("span", { onClick: function () {
1951
+ var _a;
1952
+ (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissTopicDrift();
1953
+ }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "close-thin", size: "14px", className: 'ss__chat__topic-drift__icon--close' }) })] }));
1954
+ })(), (0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__input', children: [(0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__input__input', children: [(0, jsx_runtime_1.jsx)("input", { type: "text", name: "ss-chat-input", disabled: store.loading || store.blocked || ((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.sessionLimitReached), placeholder: (function () {
1955
+ var _a, _b, _c;
1956
+ var comparedCount = ((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.compared.length) || 0;
1957
+ var committedCount = ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.comparisons.committed.length) || 0;
1958
+ var attached = ((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.attachments.attached.filter(function (item) { return item.state === 'attached' || item.state === 'active'; })) ||
1959
+ [];
1960
+ var attachedProducts = attached.filter(function (item) { return item.type === 'product'; });
1961
+ var attachedImages = attached.filter(function (item) { return item.type === 'image' && !item.error; });
1962
+ if (attachedProducts.length === 1) {
1963
+ return 'Ask about this product...';
1964
+ }
1965
+ if (comparedCount > 1 || attachedProducts.length > 1) {
1966
+ return 'What would you like to compare?';
1967
+ }
1968
+ if (committedCount > 0) {
1969
+ return 'Ask about the compared products...';
1970
+ }
1971
+ if (attachedImages.length > 0) {
1972
+ return 'Ask about this image...';
1973
+ }
1974
+ if (comparedCount === 1) {
1975
+ return 'Add another product to compare...';
1976
+ }
1977
+ return 'Type your message...';
1978
+ })(), onInput: function (e) { return controller.handlers.input.input(e); }, onKeyDown: function (e) {
1979
+ controller.handlers.input.enterKey(e);
1980
+ if (e.keyCode === 13 && isMobile && mobileProductInfoOpen) {
1981
+ setMobileProductInfoOpen(false);
1982
+ }
1983
+ }, value: controller.store.inputValue }), store.features.imageSearch.enabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__upload-button', disabled: store.loading || store.blocked || ((_d = store.currentChat) === null || _d === void 0 ? void 0 : _d.sessionLimitReached), onClick: function () { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, icon: { icon: 'image', title: 'Upload Image' } }), (0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, onChange: function (e) { return __awaiter(void 0, void 0, void 0, function () {
1984
+ return __generator(this, function (_a) {
1985
+ switch (_a.label) {
1986
+ case 0: return [4 /*yield*/, controller.upload(e.target.files)];
1987
+ case 1:
1988
+ _a.sent();
1989
+ // reset value
1990
+ e.target.value = '';
1991
+ return [2 /*return*/];
1992
+ }
1993
+ });
1994
+ }); }, multiple: true, type: "file", accept: "image/*", className: "ss__chat__input__input__file" })] }))] }), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__input__actions', children: (function () {
1995
+ var _a, _b;
1996
+ var hasImageAttachment = (((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.attached) || []).some(function (item) { return item.type === 'image' && !item.error; });
1997
+ var messageEmpty = !controller.store.inputValue.trim();
1998
+ var sendDisabled = store.blocked || ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.sessionLimitReached) || (hasImageAttachment && messageEmpty) || messageEmpty;
1999
+ return ((0, jsx_runtime_1.jsx)(Button_1.Button, { className: "ss__chat__send-button", icon: { icon: 'send', title: 'Send Message' }, disabled: sendDisabled, onClick: function () {
2000
+ if (sendDisabled)
2001
+ return;
2002
+ controller.search();
2003
+ if (isMobile && mobileProductInfoOpen) {
2004
+ setMobileProductInfoOpen(false);
2005
+ }
2006
+ } }));
2007
+ })() })] }), (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__disclaimer', children: (0, jsx_runtime_1.jsxs)("i", { children: ["Powered by Athos Commerce. AI-powered assistant. It sometimes make mistakes. Avoid sharing personal data.", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://athoscommerce.com/legal/privacy-policy/", target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" })] }) }), isDraggingFile && ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__content__footer__drop-overlay", children: [(0, jsx_runtime_1.jsx)(__1.Icon, { icon: "image", size: "24px" }), (0, jsx_runtime_1.jsx)("span", { children: "Drop image to upload" })] }))] }));
2008
+ })()) : ((0, jsx_runtime_1.jsxs)("div", { className: 'ss__chat__expired', children: [(0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__expired__message', children: "This chat is expired. Please start a new chat." }), (0, jsx_runtime_1.jsx)(Button_1.Button, { className: 'ss__chat__expired__button', onClick: function () {
2009
+ controller.store.createChat();
2010
+ }, children: "New Session" })] }))] })] })) : null] })), (0, jsx_runtime_1.jsx)(__1.Overlay, { style: { zIndex: 1001 }, color: "transparent", active: store.open, onClick: function () { return controller.handlers.button.click(); } })] }) }));
1723
2011
  });