@athoscommerce/snap-preact 1.2.3-beta.4 → 1.2.3-beta.6

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 (214) 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 +24 -25
  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 +7 -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 +638 -431
  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 +4 -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 +39 -21
  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 +7 -11
  37. package/dist/cjs/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts +2 -2
  38. package/dist/cjs/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts.map +1 -1
  39. package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts +11 -0
  40. package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts.map +1 -0
  41. package/dist/cjs/components/src/components/Organisms/ProductQuickView/ProductQuickView.js +461 -0
  42. package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.d.ts +2 -0
  43. package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.d.ts.map +1 -0
  44. package/dist/cjs/components/src/components/Organisms/ProductQuickView/index.js +17 -0
  45. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  46. package/dist/cjs/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -2
  47. package/dist/cjs/components/src/hooks/useAcRenderedInput.d.ts.map +1 -1
  48. package/dist/cjs/components/src/hooks/useAcRenderedInput.js +65 -15
  49. package/dist/cjs/components/src/hooks/useMediaQuery.d.ts.map +1 -1
  50. package/dist/cjs/components/src/hooks/useMediaQuery.js +3 -1
  51. package/dist/cjs/components/src/index.d.ts +1 -0
  52. package/dist/cjs/components/src/index.d.ts.map +1 -1
  53. package/dist/cjs/components/src/index.js +1 -0
  54. package/dist/cjs/components/src/providers/theme.d.ts +1 -1
  55. package/dist/cjs/components/src/providers/theme.d.ts.map +1 -1
  56. package/dist/cjs/components/src/themes/base/base.js +3 -3
  57. package/dist/cjs/components/src/utilities/Colour/Colour.d.ts +11 -0
  58. package/dist/cjs/components/src/utilities/Colour/Colour.d.ts.map +1 -1
  59. package/dist/cjs/components/src/utilities/Colour/Colour.js +32 -0
  60. package/dist/cjs/src/Instantiators/RecommendationInstantiator.d.ts +3 -1
  61. package/dist/cjs/src/Instantiators/RecommendationInstantiator.d.ts.map +1 -1
  62. package/dist/cjs/src/Instantiators/RecommendationInstantiator.js +162 -123
  63. package/dist/cjs/src/Snap.d.ts +1 -1
  64. package/dist/cjs/src/Snap.d.ts.map +1 -1
  65. package/dist/cjs/src/Snap.js +18 -6
  66. package/dist/cjs/src/SnapHybrid.d.ts.map +1 -1
  67. package/dist/cjs/src/Templates/SnapTemplates.d.ts +13 -72
  68. package/dist/cjs/src/Templates/SnapTemplates.d.ts.map +1 -1
  69. package/dist/cjs/src/Templates/SnapTemplates.js +123 -72
  70. package/dist/cjs/src/Templates/Stores/TargetStore.d.ts +7 -6
  71. package/dist/cjs/src/Templates/Stores/TargetStore.d.ts.map +1 -1
  72. package/dist/cjs/src/Templates/Stores/TargetStore.js +14 -8
  73. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +58 -8
  74. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
  75. package/dist/cjs/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +467 -96
  76. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
  77. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
  78. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +123 -70
  79. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
  80. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
  81. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
  82. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
  83. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +86 -1
  84. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
  85. package/dist/cjs/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +33 -14
  86. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts +93 -30
  87. package/dist/cjs/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  88. package/dist/cjs/src/Templates/Stores/TemplateStore.js +33 -41
  89. package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts +2 -8
  90. package/dist/cjs/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
  91. package/dist/cjs/src/Templates/Stores/ThemeStore.js +3 -28
  92. package/dist/cjs/src/Templates/index.d.ts +1 -1
  93. package/dist/cjs/src/Templates/index.d.ts.map +1 -1
  94. package/dist/cjs/src/create/createChatController.js +1 -1
  95. package/dist/cjs/src/index.d.ts +1 -0
  96. package/dist/cjs/src/index.d.ts.map +1 -1
  97. package/dist/cjs/src/setupEvents.d.ts +13 -0
  98. package/dist/cjs/src/setupEvents.d.ts.map +1 -1
  99. package/dist/cjs/src/setupEvents.js +56 -8
  100. package/dist/cjs/src/types.d.ts +3 -1
  101. package/dist/cjs/src/types.d.ts.map +1 -1
  102. package/dist/cjs/src/utils/combineMerge.d.ts +2 -0
  103. package/dist/cjs/src/utils/combineMerge.d.ts.map +1 -0
  104. package/dist/cjs/src/utils/combineMerge.js +22 -0
  105. package/dist/cjs/src/utils/index.d.ts +1 -0
  106. package/dist/cjs/src/utils/index.d.ts.map +1 -1
  107. package/dist/cjs/src/utils/index.js +3 -1
  108. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts +3 -3
  109. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.d.ts.map +1 -1
  110. package/dist/esm/components/src/components/Atoms/TemplateSelect/TemplateSelect.js +7 -8
  111. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts +1 -1
  112. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.d.ts.map +1 -1
  113. package/dist/esm/components/src/components/Molecules/ChatInspirationResultMessage/ChatInspirationResultMessage.js +3 -3
  114. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts +2 -0
  115. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.d.ts.map +1 -1
  116. package/dist/esm/components/src/components/Molecules/ChatProductQueryMessage/ChatProductQueryMessage.js +24 -26
  117. package/dist/esm/components/src/components/Molecules/Filter/Filter.d.ts +1 -1
  118. package/dist/esm/components/src/components/Molecules/Filter/Filter.d.ts.map +1 -1
  119. package/dist/esm/components/src/components/Molecules/Result/Result.d.ts.map +1 -1
  120. package/dist/esm/components/src/components/Molecules/Result/Result.js +9 -4
  121. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts +4 -1
  122. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.d.ts.map +1 -1
  123. package/dist/esm/components/src/components/Molecules/SearchInput/SearchInput.js +3 -3
  124. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/AbstractedControls.js +5 -5
  125. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.d.ts.map +1 -1
  126. package/dist/esm/components/src/components/Molecules/TemplatesEditor/Components/Control.js +29 -29
  127. package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.d.ts.map +1 -1
  128. package/dist/esm/components/src/components/Molecules/TemplatesEditor/TemplatesEditor.js +22 -35
  129. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts +7 -0
  130. package/dist/esm/components/src/components/Organisms/Chat/Chat.d.ts.map +1 -1
  131. package/dist/esm/components/src/components/Organisms/Chat/Chat.js +557 -359
  132. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.d.ts.map +1 -1
  133. package/dist/esm/components/src/components/Organisms/Chat/ChatResult.js +4 -3
  134. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts +3 -1
  135. package/dist/esm/components/src/components/Organisms/Chat/MessageText.d.ts.map +1 -1
  136. package/dist/esm/components/src/components/Organisms/Chat/MessageText.js +21 -19
  137. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts +3 -1
  138. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.d.ts.map +1 -1
  139. package/dist/esm/components/src/components/Organisms/Chat/MessageUser.js +36 -21
  140. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts +1 -1
  141. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.d.ts.map +1 -1
  142. package/dist/esm/components/src/components/Organisms/Chat/ResultsDisplay.js +7 -11
  143. package/dist/esm/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts +2 -2
  144. package/dist/esm/components/src/components/Organisms/FilterSummary/FilterSummary.d.ts.map +1 -1
  145. package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts +11 -0
  146. package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.d.ts.map +1 -0
  147. package/dist/esm/components/src/components/Organisms/ProductQuickView/ProductQuickView.js +436 -0
  148. package/dist/esm/components/src/components/Organisms/ProductQuickView/index.d.ts +2 -0
  149. package/dist/esm/components/src/components/Organisms/ProductQuickView/index.d.ts.map +1 -0
  150. package/dist/esm/components/src/components/Organisms/ProductQuickView/index.js +1 -0
  151. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.d.ts.map +1 -1
  152. package/dist/esm/components/src/components/Templates/AutocompleteModal/AutocompleteModal.js +0 -2
  153. package/dist/esm/components/src/hooks/useAcRenderedInput.d.ts.map +1 -1
  154. package/dist/esm/components/src/hooks/useAcRenderedInput.js +61 -11
  155. package/dist/esm/components/src/hooks/useMediaQuery.d.ts.map +1 -1
  156. package/dist/esm/components/src/hooks/useMediaQuery.js +3 -1
  157. package/dist/esm/components/src/index.d.ts +1 -0
  158. package/dist/esm/components/src/index.d.ts.map +1 -1
  159. package/dist/esm/components/src/index.js +1 -0
  160. package/dist/esm/components/src/providers/theme.d.ts +1 -1
  161. package/dist/esm/components/src/providers/theme.d.ts.map +1 -1
  162. package/dist/esm/components/src/themes/base/base.js +3 -3
  163. package/dist/esm/components/src/utilities/Colour/Colour.d.ts +11 -0
  164. package/dist/esm/components/src/utilities/Colour/Colour.d.ts.map +1 -1
  165. package/dist/esm/components/src/utilities/Colour/Colour.js +30 -0
  166. package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts +3 -1
  167. package/dist/esm/src/Instantiators/RecommendationInstantiator.d.ts.map +1 -1
  168. package/dist/esm/src/Instantiators/RecommendationInstantiator.js +131 -84
  169. package/dist/esm/src/Snap.d.ts +1 -1
  170. package/dist/esm/src/Snap.d.ts.map +1 -1
  171. package/dist/esm/src/Snap.js +21 -6
  172. package/dist/esm/src/SnapHybrid.d.ts.map +1 -1
  173. package/dist/esm/src/Templates/SnapTemplates.d.ts +13 -72
  174. package/dist/esm/src/Templates/SnapTemplates.d.ts.map +1 -1
  175. package/dist/esm/src/Templates/SnapTemplates.js +137 -78
  176. package/dist/esm/src/Templates/Stores/TargetStore.d.ts +7 -6
  177. package/dist/esm/src/Templates/Stores/TargetStore.d.ts.map +1 -1
  178. package/dist/esm/src/Templates/Stores/TargetStore.js +14 -8
  179. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts +58 -8
  180. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.d.ts.map +1 -1
  181. package/dist/esm/src/Templates/Stores/TemplateEditor/TemplateEditorStore.js +447 -89
  182. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts +1 -0
  183. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.d.ts.map +1 -1
  184. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/autocompleteControllerUI.js +118 -66
  185. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.d.ts.map +1 -1
  186. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/configUI.js +9 -3
  187. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts +1 -0
  188. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.d.ts.map +1 -1
  189. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/searchControllerUI.js +82 -1
  190. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.d.ts.map +1 -1
  191. package/dist/esm/src/Templates/Stores/TemplateEditor/uiAbstractions/themeUI.js +27 -8
  192. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts +93 -30
  193. package/dist/esm/src/Templates/Stores/TemplateStore.d.ts.map +1 -1
  194. package/dist/esm/src/Templates/Stores/TemplateStore.js +29 -38
  195. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts +2 -8
  196. package/dist/esm/src/Templates/Stores/ThemeStore.d.ts.map +1 -1
  197. package/dist/esm/src/Templates/Stores/ThemeStore.js +3 -26
  198. package/dist/esm/src/Templates/index.d.ts +1 -1
  199. package/dist/esm/src/Templates/index.d.ts.map +1 -1
  200. package/dist/esm/src/create/createChatController.js +1 -1
  201. package/dist/esm/src/index.d.ts +1 -0
  202. package/dist/esm/src/index.d.ts.map +1 -1
  203. package/dist/esm/src/setupEvents.d.ts +13 -0
  204. package/dist/esm/src/setupEvents.d.ts.map +1 -1
  205. package/dist/esm/src/setupEvents.js +25 -8
  206. package/dist/esm/src/types.d.ts +3 -1
  207. package/dist/esm/src/types.d.ts.map +1 -1
  208. package/dist/esm/src/utils/combineMerge.d.ts +2 -0
  209. package/dist/esm/src/utils/combineMerge.d.ts.map +1 -0
  210. package/dist/esm/src/utils/combineMerge.js +16 -0
  211. package/dist/esm/src/utils/index.d.ts +1 -0
  212. package/dist/esm/src/utils/index.d.ts.map +1 -1
  213. package/dist/esm/src/utils/index.js +1 -0
  214. 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,23 +433,24 @@ 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',
@@ -452,7 +480,7 @@ var defaultStyles = function (_a) {
452
480
  display: 'flex',
453
481
  flexDirection: 'column',
454
482
  gap: '1em',
455
- background: '#f4f4ff',
483
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.95),
456
484
  padding: '1em',
457
485
  '.ss__chat__content__header__comparisons__header': {
458
486
  display: 'flex',
@@ -467,7 +495,7 @@ var defaultStyles = function (_a) {
467
495
  background: colorPrimary,
468
496
  borderRadius: '50%',
469
497
  padding: '5px',
470
- fill: '#fff',
498
+ fill: colorPrimaryText,
471
499
  height: '25px',
472
500
  width: '25px',
473
501
  },
@@ -540,11 +568,11 @@ var defaultStyles = function (_a) {
540
568
  borderRadius: '1em',
541
569
  padding: '0.5em 1em',
542
570
  background: colorPrimary,
543
- color: '#fff',
571
+ color: colorPrimaryText,
544
572
  textAlign: 'center',
545
573
  svg: {
546
- fill: '#fff',
547
- stroke: '#fff',
574
+ fill: colorPrimaryText,
575
+ stroke: colorPrimaryText,
548
576
  },
549
577
  },
550
578
  },
@@ -572,7 +600,7 @@ var defaultStyles = function (_a) {
572
600
  width: 'fit-content',
573
601
  padding: '6px 16px',
574
602
  background: colorPrimary,
575
- color: '#fff',
603
+ color: colorPrimaryText,
576
604
  borderRadius: '999px',
577
605
  fontSize: '13px',
578
606
  fontWeight: 500,
@@ -580,11 +608,11 @@ var defaultStyles = function (_a) {
580
608
  boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
581
609
  zIndex: 5,
582
610
  '&:hover': {
583
- background: '#1a2a5c',
611
+ background: colorPrimaryHover,
584
612
  },
585
613
  svg: {
586
- fill: '#fff',
587
- stroke: '#fff',
614
+ fill: colorPrimaryText,
615
+ stroke: colorPrimaryText,
588
616
  },
589
617
  },
590
618
  '.ss__chat__message': {
@@ -636,8 +664,8 @@ var defaultStyles = function (_a) {
636
664
  flexDirection: 'column',
637
665
  gap: '6px',
638
666
  padding: '8px 10px',
639
- background: '#f4f4ff',
640
- 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)),
641
669
  borderRadius: '8px',
642
670
  },
643
671
  '.ss__chat__actions--title': {
@@ -657,7 +685,7 @@ var defaultStyles = function (_a) {
657
685
  fontSize: '14px',
658
686
  color: '#333',
659
687
  '&:hover': {
660
- background: '#f9f9ff',
688
+ background: new utilities_1.Colour(colorPrimary).lightenHex(0.97),
661
689
  },
662
690
  },
663
691
  },
@@ -757,8 +785,8 @@ var defaultStyles = function (_a) {
757
785
  visibility: 'visible',
758
786
  },
759
787
  '.ss__button': {
760
- background: '#253B80',
761
- color: '#fff',
788
+ background: colorPrimary,
789
+ color: colorPrimaryText,
762
790
  border: 'none',
763
791
  borderRadius: '999px',
764
792
  padding: '2px 10px',
@@ -766,7 +794,7 @@ var defaultStyles = function (_a) {
766
794
  lineHeight: '1.4',
767
795
  cursor: 'pointer',
768
796
  '&:not(.ss__button--disabled):hover': {
769
- background: '#1a2a5c',
797
+ background: colorPrimaryHover,
770
798
  },
771
799
  '&.ss__button--disabled': {
772
800
  opacity: 0.5,
@@ -789,8 +817,8 @@ var defaultStyles = function (_a) {
789
817
  flexDirection: 'column',
790
818
  gap: '6px',
791
819
  padding: '8px 10px',
792
- background: '#f4f4ff',
793
- 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)),
794
822
  borderRadius: '8px',
795
823
  '.ss__chat__attachment-context__label': {
796
824
  fontSize: '14px',
@@ -920,19 +948,36 @@ var defaultStyles = function (_a) {
920
948
  },
921
949
  },
922
950
  },
923
- '.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
924
952
  ? {
925
- position: 'relative',
926
953
  zIndex: 11,
927
954
  background: '#fff',
928
955
  }
929
- : {})),
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
+ } }),
930
975
  '.ss__chat__topic-drift': {
931
976
  display: 'flex',
932
977
  alignItems: 'center',
933
978
  gap: '12px',
934
979
  padding: '12px 16px',
935
- border: '1px solid #93C5FD',
980
+ border: "1px solid ".concat(new utilities_1.Colour(colorPrimary).lightenHex(0.6)),
936
981
  borderRadius: '8px',
937
982
  backgroundColor: '#fff',
938
983
  '.ss__chat__topic-drift__icon--info': {
@@ -962,7 +1007,7 @@ var defaultStyles = function (_a) {
962
1007
  '.ss__chat__topic-drift__button': {
963
1008
  flex: '0 0 auto',
964
1009
  backgroundColor: colorPrimary,
965
- color: '#fff',
1010
+ color: colorPrimaryText,
966
1011
  borderRadius: '6px',
967
1012
  padding: '8px 14px',
968
1013
  fontSize: '13px',
@@ -970,7 +1015,7 @@ var defaultStyles = function (_a) {
970
1015
  cursor: 'pointer',
971
1016
  whiteSpace: 'nowrap',
972
1017
  '&:not(.ss__button--disabled):hover': {
973
- background: '#1a2a5c',
1018
+ background: colorPrimaryHover,
974
1019
  },
975
1020
  },
976
1021
  '.ss__chat__topic-drift__icon--close': {
@@ -1008,7 +1053,7 @@ var defaultStyles = function (_a) {
1008
1053
  },
1009
1054
  '&:focus': {
1010
1055
  outline: 'none',
1011
- borderColor: '#0066cc',
1056
+ borderColor: colorPrimary,
1012
1057
  },
1013
1058
  },
1014
1059
  '.ss__button': {
@@ -1024,18 +1069,20 @@ var defaultStyles = function (_a) {
1024
1069
  '.ss__chat__input__actions': {
1025
1070
  '.ss__button': {
1026
1071
  backgroundColor: colorPrimary,
1072
+ color: colorPrimaryText,
1027
1073
  borderRadius: '50%',
1028
1074
  height: '3em',
1029
1075
  width: '3em',
1030
1076
  cursor: 'pointer',
1031
1077
  justifyContent: 'center',
1078
+ boxSizing: 'border-box',
1032
1079
  '&:disabled': {
1033
1080
  opacity: 0.5,
1034
1081
  cursor: 'not-allowed',
1035
1082
  },
1036
1083
  svg: {
1037
- fill: '#fff',
1038
- stroke: '#fff',
1084
+ fill: colorPrimaryText,
1085
+ stroke: colorPrimaryText,
1039
1086
  },
1040
1087
  },
1041
1088
  },
@@ -1046,11 +1093,60 @@ var defaultStyles = function (_a) {
1046
1093
  textAlign: 'center',
1047
1094
  flexShrink: 0,
1048
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
+ },
1049
1145
  },
1050
- });
1146
+ _b));
1051
1147
  };
1052
1148
  exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1053
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
1149
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1054
1150
  var globalTheme = (0, providers_1.useTheme)();
1055
1151
  var globalTreePath = (0, providers_1.useTreePath)();
1056
1152
  var isMobile = (0, __1.useMediaQuery)('(max-width: 767px)');
@@ -1058,12 +1154,26 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1058
1154
  treePath: globalTreePath,
1059
1155
  logo: 'https://cdn.athoscommerce.net/snap/images/Athos%20Commerce_Icon_white.svg',
1060
1156
  title: 'Athos Conversational Assistant',
1061
- subtitle: 'Ready to assist you',
1157
+ subtitle: 'Your Guided Discovery Expert',
1062
1158
  multiselectFacets: true,
1063
1159
  disableBubbleSuggestedQuestions: false,
1160
+ primaryColorBg: '#253B80',
1161
+ primaryColorFg: '#fff',
1162
+ primaryAccentColorBg: '#feeeae',
1163
+ primaryAccentColorFg: '#000000',
1164
+ secondaryAccentColorBg: '#000000',
1165
+ secondaryAccentColorFg: '#ffffff',
1166
+ position: 'right',
1064
1167
  };
1065
1168
  var props = (0, utilities_1.mergeProps)('facets', globalTheme, defaultProps, properties);
1066
- 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;
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';
1067
1177
  var store = controller.store;
1068
1178
  var themeDefaults = {
1069
1179
  components: {},
@@ -1076,19 +1186,24 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1076
1186
  var messagesContainerRef = (0, hooks_1.useRef)(null);
1077
1187
  var headerRef = (0, hooks_1.useRef)(null);
1078
1188
  var footerRef = (0, hooks_1.useRef)(null);
1189
+ var chatRef = (0, hooks_1.useRef)(null);
1079
1190
  // Swipe-to-dismiss state for mobile secondary panel
1080
1191
  var secondaryRef = (0, hooks_1.useRef)(null);
1081
1192
  var swipeStartY = (0, hooks_1.useRef)(0);
1082
1193
  var swipeStartTime = (0, hooks_1.useRef)(0);
1083
1194
  var swipeActive = (0, hooks_1.useRef)(false);
1084
1195
  var swipeOffsetRef = (0, hooks_1.useRef)(0);
1085
- var _y = (0, hooks_1.useState)(0), swipeOffset = _y[0], setSwipeOffsetRaw = _y[1];
1086
- var _z = (0, hooks_1.useState)(false), swipeAnimating = _z[0], setSwipeAnimating = _z[1];
1087
- var _0 = (0, hooks_1.useState)(false), mobileProductInfoOpen = _0[0], setMobileProductInfoOpen = _0[1];
1088
- var _1 = (0, hooks_1.useState)(0), footerHeight = _1[0], setFooterHeight = _1[1];
1089
- var _2 = (0, hooks_1.useState)(false), showNewMessages = _2[0], setShowNewMessages = _2[1];
1090
- var _3 = (0, hooks_1.useState)(false), messagesOverflow = _3[0], setMessagesOverflow = _3[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];
1091
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);
1092
1207
  var updateSwipeOffset = function (value) {
1093
1208
  swipeOffsetRef.current = value;
1094
1209
  setSwipeOffsetRaw(value);
@@ -1225,7 +1340,19 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1225
1340
  var sideChatTypes = isMobile
1226
1341
  ? __spreadArray(__spreadArray(['inspirationResult'], (isFirstMobileComparison ? ['productComparison'] : []), true), (mobileProductInfoOpen ? ['productQuery'] : []), true) : ['inspirationResult', 'productComparison', 'productQuery'];
1227
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;
1228
- 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);
1229
1356
  // Lock body scroll while chat is open so touch/wheel scrolls don't leak to the page behind
1230
1357
  (0, hooks_1.useEffect)(function () {
1231
1358
  if (!store.open)
@@ -1273,7 +1400,18 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1273
1400
  })() }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__history__chat__button__date", children: chat.createdAt.toLocaleString() })] }) }, chat.id)); }) })) : null] })); };
1274
1401
  var FacetButton = function (props) { return (0, jsx_runtime_1.jsx)(Button_1.Button, { icon: props.open ? 'angle-down' : 'angle-up', children: props.label }); };
1275
1402
  var getFacetButtonLabel = function (facet) {
1276
- var _a;
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
+ }
1277
1415
  var applied = new Set();
1278
1416
  // Count values marked as filtered (already applied on the server)
1279
1417
  (facet.values || []).forEach(function (value) {
@@ -1288,12 +1426,45 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1288
1426
  }
1289
1427
  });
1290
1428
  // Count pending facet attachments (newly selected, not yet sent)
1291
- (((_a = controller.store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.items) || [])
1429
+ (((_c = controller.store.currentChat) === null || _c === void 0 ? void 0 : _c.attachments.items) || [])
1292
1430
  .filter(function (item) { return item.type === 'facet' && item.key === facet.field && (item.state === 'active' || item.state === 'attached'); })
1293
1431
  .forEach(function (item) { return applied.add(item.value); });
1294
- var base = facet.label || facet.field;
1295
1432
  return applied.size > 0 ? "".concat(base, " (").concat(applied.size, ")") : base;
1296
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
+ };
1297
1468
  // TODO: if starting a new chat and it's expired, this button would then disappear
1298
1469
  if (!controller.store.chatEnabled) {
1299
1470
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
@@ -1380,7 +1551,7 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1380
1551
  return undefined;
1381
1552
  }
1382
1553
  }, [requestType]);
1383
- 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', {
1384
1555
  'ss__chat--open': store.open,
1385
1556
  'ss__chat--minimized': !store.open,
1386
1557
  'ss__chat--mobile': isMobile,
@@ -1414,9 +1585,9 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1414
1585
  setMobileProductInfoOpen(false);
1415
1586
  (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1416
1587
  } }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__content", children: (0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__messages', children: {
1417
- 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 })),
1418
1589
  productComparison: ((0, jsx_runtime_1.jsx)(ChatProductComparisonMessage_1.ChatProductComparisonMessage, { chatItem: activeMessage, controller: controller })),
1419
- 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 })),
1420
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
1421
1592
  // disabled={store.currentChat?.chat && store.currentChat.chat.length <= 1}
1422
1593
  , {
@@ -1431,7 +1602,7 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1431
1602
  systemMessages.length >= feedbackAfterMessages &&
1432
1603
  !((_e = store.currentChat) === null || _e === void 0 ? void 0 : _e.feedbackDismissed) &&
1433
1604
  (!hasRated || ((_f = store.currentChat) === null || _f === void 0 ? void 0 : _f.feedbackJustGiven));
1434
- 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 () {
1435
1606
  if (store.currentChat) {
1436
1607
  store.currentChat.feedbackDismissed = true;
1437
1608
  store.currentChat.save();
@@ -1439,32 +1610,32 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1439
1610
  }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "close-thin", size: "14px" }) }))] })) : null;
1440
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', {
1441
1612
  'ss__chat__content__header--overlay': messagesOverflow,
1442
- }), 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) {
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) {
1443
1614
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1444
1615
  var comparisonItem = (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.compared[index];
1445
1616
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__content__header__comparisons__content__comparison', {
1446
1617
  'ss__chat__content__header__comparisons__content__comparison--placeholder': !comparisonItem,
1447
1618
  }), children: comparisonItem ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Image_1.Image
1448
1619
  // onClick={() => {
1449
- // controller?.viewProduct(product as any);
1620
+ // controller?.productQuickView(product as any);
1450
1621
  // }}
1451
1622
  , {
1452
1623
  // onClick={() => {
1453
- // controller?.viewProduct(product as any);
1624
+ // controller?.productQuickView(product as any);
1454
1625
  // }}
1455
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 () {
1456
1627
  var _a;
1457
1628
  (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.remove(comparisonItem.result.id);
1458
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));
1459
1630
  }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__content__header__comparisons__action', {
1460
- 'ss__chat__content__header__comparisons__action--hidden': (((_o = store.currentChat) === null || _o === void 0 ? void 0 : _o.comparisons.compared.length) || 0) < 2,
1461
- }), 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: [(!((_p = store.currentChat) === null || _p === void 0 ? void 0 : _p.chat) || store.currentChat.chat.length === 0) && store.welcomeMessage && !((_q = store.currentChat) === null || _q === void 0 ? void 0 : _q.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 })] })), (_r = store.currentChat) === null || _r === void 0 ? void 0 : _r.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: {
1462
- user: ((0, jsx_runtime_1.jsx)(MessageUser_1.MessageUser, { chatItem: chatItem, controller: controller, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined })),
1463
- text: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1464
- content: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1465
- productSearchResult: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1466
- inspirationResult: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, onViewProduct: isMobile ? function () { return setMobileProductInfoOpen(true); } : undefined, sideChatOpen: !!shouldShowSideChat })),
1467
- 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 })),
1468
1639
  productComparison: (function () {
1469
1640
  var _a;
1470
1641
  // On mobile, only the first productComparison in the session
@@ -1472,333 +1643,369 @@ exports.Chat = (0, mobx_react_lite_1.observer)(function (properties) {
1472
1643
  // prominent "Show Details" button instead.
1473
1644
  var comparisonMessages = (((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.chat) || []).filter(function (m) { return m.messageType === 'productComparison'; });
1474
1645
  var isFirst = comparisonMessages.length > 0 && comparisonMessages[0].id === chatItem.id;
1475
- 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 }));
1476
1647
  })(),
1477
- 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 })),
1478
1649
  actions: (0, jsx_runtime_1.jsx)(SuggestedQuestions_1.SuggestedQuestions, { actions: chatItem.actions, controller: controller }),
1479
- errorResponse: ((0, jsx_runtime_1.jsx)(MessageText_1.MessageText, { chatItem: chatItem, controller: controller, scrollToBottom: scrollToBottomIfNear, sideChatOpen: !!shouldShowSideChat })),
1480
- 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 })),
1481
1652
  productQuery: null,
1482
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 () {
1483
1654
  scrollToBottom();
1484
1655
  setShowNewMessages(false);
1485
- }, 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 }), !((_s = store.currentChat) === null || _s === void 0 ? void 0 : _s.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 }), ((_t = store.currentChat) === null || _t === void 0 ? void 0 : _t.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 () {
1486
- controller.store.createChat();
1487
- }, children: "New Session" })] })), ((_u = store.currentChat) === null || _u === void 0 ? void 0 : _u.actions) && store.currentChat.actions.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: 'ss__chat__actions', children: (_v = store.currentChat) === null || _v === void 0 ? void 0 : _v.actions.map(function (action, index) {
1488
- var _a, _b;
1489
- return ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__wrap", children: {
1490
- 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'; })) ||
1491
- (((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.removedFacets) && store.currentChat.removedFacets.length > 0)
1492
- ? ' ss__chat__actions__facets-apply--active'
1493
- : ''), children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: function () {
1494
- controller.search();
1495
- }, children: "Apply" }) }))] }), (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions--facets", children: action.data.slice(0, 10).map(function (facet, idx) {
1496
- var _a;
1497
- if (!((_a = facet.values) === null || _a === void 0 ? void 0 : _a.length))
1498
- return null;
1499
- 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: {
1500
- '.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
1501
- ? {
1502
- '.ss__chat__actions__facet__option--checkbox': {
1503
- display: 'flex',
1504
- alignItems: 'center',
1505
- gap: '8px',
1506
- padding: '6px 10px',
1507
- cursor: 'pointer',
1508
- width: '100%',
1509
- boxSizing: 'border-box',
1510
- background: '#fff',
1511
- border: 'none',
1512
- borderBottom: '1px solid #f0f0f0',
1513
- '&:hover': {
1514
- background: '#f4f4ff',
1515
- },
1516
- '&:last-child': {
1517
- borderBottom: 'none',
1518
- },
1519
- '.ss__chat__actions__facet__option__checkbox': {
1520
- width: '16px',
1521
- height: '16px',
1522
- borderRadius: '3px',
1523
- border: '2px solid #ccc',
1524
- display: 'flex',
1525
- alignItems: 'center',
1526
- justifyContent: 'center',
1527
- flexShrink: 0,
1528
- '&.ss__chat__actions__facet__option__checkbox--checked': {
1529
- background: '#253B80',
1530
- borderColor: '#253B80',
1531
- },
1532
- },
1533
- '.ss__chat__actions__facet__option__label': {
1534
- fontSize: '14px',
1535
- color: '#333',
1536
- flex: '1 1 auto',
1537
- textAlign: 'left',
1538
- },
1539
- },
1540
- }
1541
- : {
1542
- '.ss__button': {
1543
- width: '100%',
1544
- border: 'none',
1545
- borderRadius: 0,
1546
- boxSizing: 'border-box',
1547
- background: '#fff',
1548
- '&:hover': {
1549
- 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,
1550
1750
  },
1551
1751
  },
1552
- })),
1553
- }, children: (0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions__facet__options", children: facet.type === 'range-buckets'
1554
- ? facet.values.map(function (option) {
1555
- var _a, _b;
1556
- var rangeOption = option;
1557
- var optionValue = "".concat((_a = rangeOption.low) !== null && _a !== void 0 ? _a : '*', ":").concat((_b = rangeOption.high) !== null && _b !== void 0 ? _b : '*');
1558
- if (multiselectFacets) {
1559
- var isSelected_1 = (rangeOption.filtered && !controller.store.isFacetRemoved(facet.field, optionValue)) ||
1560
- controller.store.isFacetSelected(facet.field, optionValue);
1561
- return ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: function () {
1562
- if (isSelected_1) {
1563
- controller.store.removeFacet(facet.field, optionValue);
1564
- }
1565
- else {
1566
- controller.store.addFacet({
1567
- key: facet.field,
1568
- facetLabel: facet.label,
1569
- value: optionValue,
1570
- label: rangeOption.label,
1571
- count: rangeOption.count,
1572
- });
1573
- }
1574
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__actions__facet__option__checkbox', {
1575
- 'ss__chat__actions__facet__option__checkbox--checked': isSelected_1,
1576
- }), 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));
1577
- }
1578
- 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 {
1579
1785
  controller.store.addFacet({
1580
1786
  key: facet.field,
1581
- facetLabel: facet.label,
1582
1787
  value: optionValue,
1583
- label: rangeOption.label,
1584
- count: rangeOption.count,
1585
1788
  });
1586
- controller.search();
1587
- }, children: rangeOption.label }, optionValue));
1588
- })
1589
- : facet.values.map(function (option) {
1590
- var valueOption = option;
1591
- var optionValue = valueOption.value || valueOption.label;
1592
- if (multiselectFacets) {
1593
- var isSelected_2 = (valueOption.filtered && !controller.store.isFacetRemoved(facet.field, optionValue)) ||
1594
- controller.store.isFacetSelected(facet.field, optionValue);
1595
- return ((0, jsx_runtime_1.jsxs)("div", { className: "ss__chat__actions__facet__option--checkbox", onClick: function () {
1596
- if (isSelected_2) {
1597
- controller.store.removeFacet(facet.field, optionValue);
1598
- }
1599
- else {
1600
- controller.store.addFacet({
1601
- key: facet.field,
1602
- facetLabel: facet.label,
1603
- value: optionValue,
1604
- label: valueOption.label,
1605
- count: valueOption.count,
1606
- });
1607
- }
1608
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ss__chat__actions__facet__option__checkbox', {
1609
- 'ss__chat__actions__facet__option__checkbox--checked': isSelected_2,
1610
- }), 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));
1611
- }
1612
- 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 {
1613
1812
  controller.store.addFacet({
1614
1813
  key: facet.field,
1615
- facetLabel: facet.label,
1616
1814
  value: optionValue,
1617
- label: valueOption.label,
1618
- count: valueOption.count,
1619
1815
  });
1620
- controller.search();
1621
- }, children: valueOption.label }, optionValue));
1622
- }) }) }, facet.field) }, idx));
1623
- }) })] })) : null,
1624
- actions: ((0, jsx_runtime_1.jsx)("div", { className: "ss__chat__actions--suggested" })),
1625
- }[action.type] || null }, index));
1626
- }) })), (function () {
1627
- var _a, _b, _c;
1628
- var activeComparisonSearchResults = shouldShowSideChat && (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productComparison'
1629
- ? activeMessage.searchResults || []
1630
- : null;
1631
- var showCommittedComparisons = !activeComparisonSearchResults &&
1632
- ((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.committed) &&
1633
- store.currentChat.comparisons.committed.length > 0 &&
1634
- ((activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'user' ||
1635
- (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productComparison' ||
1636
- (activeMessage === null || activeMessage === void 0 ? void 0 : activeMessage.messageType) === 'productQuery');
1637
- 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'; })) || [];
1638
- var productAttachments = visibleAttachments.filter(function (item) {
1639
- return item.type === 'product' &&
1640
- item.requestType !== 'productSimilar' &&
1641
- item.requestType !== 'productComparison';
1642
- });
1643
- var imageAttachments = visibleAttachments.filter(function (item) { return item.type === 'image'; });
1644
- var comparisonItems = activeComparisonSearchResults
1645
- ? activeComparisonSearchResults.map(function (result) {
1646
- var _a, _b, _c, _d, _e, _f;
1647
- var d = (result === null || result === void 0 ? void 0 : result.display) || result;
1648
- return {
1649
- id: result === null || result === void 0 ? void 0 : result.id,
1650
- 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) || '',
1651
- 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) || '',
1652
- onClick: isMobile
1653
- ? function () {
1654
- controller.viewProduct(result);
1655
- setMobileProductInfoOpen(true);
1656
- }
1657
- : undefined,
1658
- };
1659
- })
1660
- : showCommittedComparisons
1661
- ? (((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.comparisons.committed) || []).map(function (comparisonItem) {
1662
- var _a, _b, _c, _d, _e, _f, _g, _h;
1663
- 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;
1664
1851
  return {
1665
- id: (_b = comparisonItem.result) === null || _b === void 0 ? void 0 : _b.id,
1666
- 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) || '',
1667
- 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) || '',
1668
1855
  onClick: isMobile
1669
1856
  ? function () {
1670
- controller.viewProduct(comparisonItem.result);
1857
+ controller.productQuickView(result);
1671
1858
  setMobileProductInfoOpen(true);
1672
1859
  }
1673
1860
  : undefined,
1674
1861
  };
1675
1862
  })
1676
- : [];
1677
- var productItems = productAttachments.map(function (item) { return ({
1678
- id: item.id,
1679
- name: item.name || '',
1680
- imageUrl: item.thumbnailUrl || '',
1681
- onClick: isMobile
1682
- ? function () {
1683
- setMobileProductInfoOpen(true);
1684
- }
1685
- : function () {
1686
- var _a, _b, _c;
1687
- (_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) || '');
1688
- },
1689
- onRemove: function () {
1690
- var _a, _b;
1691
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id);
1692
- setMobileProductInfoOpen(false);
1693
- (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1694
- },
1695
- }); });
1696
- var imageItems = imageAttachments.map(function (item) {
1697
- var _a;
1698
- 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 ({
1699
1881
  id: item.id,
1700
- name: item.fileName || 'Image',
1701
- imageUrl: item.base64 || item.thumbnailUrl || '',
1702
- isLoading: item.state === 'loading',
1703
- hasError: !!item.error,
1704
- errorMessage: (_a = item.error) === null || _a === void 0 ? void 0 : _a.message,
1705
- onRemove: function () { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id); },
1706
- });
1707
- });
1708
- var productTitle = productItems.length > 1 ? 'Compare these products' : 'Ask about this product' + (isMobile ? '' : ' (click for details)');
1709
- var hasImageError = imageItems.some(function (item) { return item.hasError; });
1710
- var imageTitle = imageItems.length > 0 && !hasImageError ? 'Find products similar to this image:' : '';
1711
- 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 () {
1712
- var _a, _b;
1713
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.resetCommitted();
1714
- (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.dismissSideChat();
1715
- } })), productItems.length > 0 && ((0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: productTitle, items: productItems, onClose: function () {
1716
- var _a;
1717
- productAttachments.forEach(function (item) { var _a; return (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.remove(item.id); });
1718
- setMobileProductInfoOpen(false);
1719
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissSideChat();
1720
- } })), imageItems.length > 0 && (0, jsx_runtime_1.jsx)(ChatAttachmentContext_1.ChatAttachmentContext, { title: imageTitle, items: imageItems })] }));
1721
- })(), (function () {
1722
- var _a;
1723
- var drift = (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.topicDrift;
1724
- if (!drift)
1725
- return null;
1726
- // recommendedAction is the prescription; driftType is the diagnosis.
1727
- // Hide the banner when the backend says to keep flowing, or when no drift was detected.
1728
- if (drift.recommendedAction === 'CONTINUE' || drift.driftType === 'NO_DRIFT')
1729
- return null;
1730
- var isScopeRedirect = drift.recommendedAction === 'SCOPE_REDIRECT';
1731
- var primaryText = isScopeRedirect ? "I'm here to help with shopping" : 'Looking for something new?';
1732
- var secondaryText = isScopeRedirect
1733
- ? 'Try asking about products, comparisons, or recommendations'
1734
- : 'Start a fresh session for better assistance, or keep going in this one?';
1735
- var buttonText = isScopeRedirect ? '' : 'New Session';
1736
- 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 () {
1737
- var _a, _b;
1738
- if (isScopeRedirect) {
1739
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissTopicDrift();
1740
- return;
1741
- }
1742
- var messageText = (_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.handleTopicDrift();
1743
- if (messageText) {
1744
- controller.store.createChat();
1745
- controller.search({ data: { message: messageText } });
1746
- }
1747
- }, children: buttonText })), (0, jsx_runtime_1.jsx)("span", { onClick: function () {
1748
- var _a;
1749
- (_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.dismissTopicDrift();
1750
- }, children: (0, jsx_runtime_1.jsx)(__1.Icon, { icon: "close-thin", size: "14px", className: 'ss__chat__topic-drift__icon--close' }) })] }));
1751
- })(), (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 || ((_w = store.currentChat) === null || _w === void 0 ? void 0 : _w.sessionLimitReached), placeholder: (function () {
1752
- var _a, _b, _c;
1753
- var comparedCount = ((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.comparisons.compared.length) || 0;
1754
- var committedCount = ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.comparisons.committed.length) || 0;
1755
- var attached = ((_c = store.currentChat) === null || _c === void 0 ? void 0 : _c.attachments.attached.filter(function (item) { return item.state === 'attached' || item.state === 'active'; })) || [];
1756
- var attachedProducts = attached.filter(function (item) { return item.type === 'product'; });
1757
- var attachedImages = attached.filter(function (item) { return item.type === 'image' && !item.error; });
1758
- if (attachedProducts.length === 1) {
1759
- return 'Ask about this product...';
1760
- }
1761
- if (comparedCount > 1 || attachedProducts.length > 1) {
1762
- return 'What would you like to compare?';
1763
- }
1764
- if (committedCount > 0) {
1765
- return 'Ask about the compared products...';
1766
- }
1767
- if (attachedImages.length > 0) {
1768
- return 'Ask about this image...';
1769
- }
1770
- if (comparedCount === 1) {
1771
- return 'Add another product to compare...';
1772
- }
1773
- return 'Type your message...';
1774
- })(), onInput: function (e) { return controller.handlers.input.input(e); }, onKeyDown: function (e) {
1775
- controller.handlers.input.enterKey(e);
1776
- if (e.keyCode === 13 && isMobile && mobileProductInfoOpen) {
1777
- setMobileProductInfoOpen(false);
1778
- }
1779
- }, 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 || ((_x = store.currentChat) === null || _x === void 0 ? void 0 : _x.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 () {
1780
- return __generator(this, function (_a) {
1781
- switch (_a.label) {
1782
- case 0: return [4 /*yield*/, controller.upload(e.target.files)];
1783
- case 1:
1784
- _a.sent();
1785
- // reset value
1786
- e.target.value = '';
1787
- return [2 /*return*/];
1788
- }
1789
- });
1790
- }); }, 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 () {
1791
1893
  var _a, _b;
1792
- var hasImageAttachment = (((_a = store.currentChat) === null || _a === void 0 ? void 0 : _a.attachments.attached) || []).some(function (item) { return item.type === 'image' && !item.error; });
1793
- var messageEmpty = !controller.store.inputValue.trim();
1794
- var sendDisabled = store.blocked || ((_b = store.currentChat) === null || _b === void 0 ? void 0 : _b.sessionLimitReached) || (hasImageAttachment && messageEmpty) || messageEmpty;
1795
- return ((0, jsx_runtime_1.jsx)(Button_1.Button, { className: "ss__chat__send-button", icon: { icon: 'send', title: 'Send Message' }, disabled: sendDisabled, onClick: function () {
1796
- 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();
1797
1943
  return;
1798
- controller.search();
1799
- if (isMobile && mobileProductInfoOpen) {
1800
- setMobileProductInfoOpen(false);
1801
1944
  }
1802
- } }));
1803
- })() })] }), (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(); } })] }) }));
1804
2011
  });