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