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