@envive-ai/react-widgets-v3 0.3.2 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hocs/withBaseWidget/types.d.cts +3 -3
- package/dist/hocs/withBaseWidget/types.d.ts +3 -5
- package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
- package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
- package/dist/node_modules/uuid/dist/native.js +6 -0
- package/dist/node_modules/uuid/dist/rng.js +13 -0
- package/dist/node_modules/uuid/dist/stringify.js +9 -0
- package/dist/node_modules/uuid/dist/v4.js +27 -0
- package/dist/node_modules/uuid/dist-node/native.cjs +8 -0
- package/dist/node_modules/uuid/dist-node/rng.cjs +16 -0
- package/dist/node_modules/uuid/dist-node/stringify.cjs +10 -0
- package/dist/node_modules/uuid/dist-node/v4.cjs +27 -0
- package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResults.d.ts +3 -4
- package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
- package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
- package/dist/packages/widgets/dist/SearchZeroState/index.d.ts +3 -0
- package/dist/{widgets → packages/widgets}/dist/SearchZeroState/types.d.ts +2 -2
- package/dist/{widgets → packages/widgets}/dist/SuggestionBar/SuggestionBar.d.ts +1 -1
- package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/types.d.ts +2 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +28 -11
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +28 -11
- package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +27 -10
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
- package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +27 -10
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +3 -3
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
- package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +26 -8
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
- package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +27 -9
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +14 -6
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +15 -7
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts +2 -2
- package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +2 -2
- package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +36 -13
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
- package/dist/widgets/SocialProofWidget/SocialProofWidget.js +36 -13
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +13 -5
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
- package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +14 -6
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
- package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +2 -2
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +14 -7
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
- package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +14 -7
- package/dist/widgets/dist/SearchResults/SearchResults.d.cts +3 -4
- package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
- package/dist/widgets/dist/SearchZeroState/types.d.cts +2 -2
- package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +1 -1
- package/dist/widgets/dist/SuggestionButtonContainer/types.d.cts +2 -3
- package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
- package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
- package/dist/widgets/utils/functions.cjs +1 -1
- package/dist/widgets/utils/functions.js +1 -1
- package/dist/widgets-v2/SearchResults/index.d.ts +3 -3
- package/dist/widgets-v2/SearchZeroState/index.d.cts +1 -2
- package/dist/widgets-v2/SearchZeroState/index.d.ts +4 -5
- package/dist/widgets-v2/SuggestionBar/index.d.ts +3 -3
- package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/stories/SalesAgentTest/SalesAgentTest.tsx +2 -2
- package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +30 -8
- package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +33 -9
- package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +33 -8
- package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +19 -5
- package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +41 -10
- package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +19 -5
- package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +18 -5
- package/dist/hooks/dist/application/models/api/orgConfigResults.d.ts +0 -1
- package/dist/hooks/dist/application/models/frontendConfig.d.ts +0 -1
- package/dist/hooks/dist/contexts/amplitudeContext/amplitudeContext.d.ts +0 -2
- package/dist/hooks/dist/contexts/amplitudeContext/index.d.ts +0 -2
- package/dist/hooks/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +0 -2
- package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.cts +0 -8
- package/dist/hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts +0 -11
- package/dist/hooks/dist/contexts/hardcopyContext/index.d.ts +0 -1
- package/dist/hooks/dist/contexts/types.d.cts +0 -44
- package/dist/hooks/dist/contexts/types.d.ts +0 -47
- package/dist/hooks/dist/contexts/typesV3.d.cts +0 -201
- package/dist/hooks/dist/contexts/typesV3.d.ts +0 -201
- package/dist/hooks/dist/services/amplitudeService/amplitudeService.d.cts +0 -36
- package/dist/hooks/dist/services/amplitudeService/amplitudeService.d.ts +0 -37
- package/dist/hooks/dist/types/customerService.d.cts +0 -18
- package/dist/hooks/dist/types/customerService.d.ts +0 -18
- package/dist/widgets/dist/SearchZeroState/index.d.ts +0 -4
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.cts +0 -14
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/response.d.ts +0 -14
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.cts +0 -15
- package/dist/widgets/dist/packages/hooks/dist/application/models/api/search.d.ts +0 -15
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.cts +0 -73
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +0 -73
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.cts +0 -61
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +0 -61
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.cts +0 -25
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +0 -25
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.cts +0 -35
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +0 -35
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.cts +0 -32
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +0 -32
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.cts +0 -32
- package/dist/widgets/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +0 -32
- package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.cts +0 -14
- package/dist/widgets/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +0 -15
- package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.cts +0 -61
- package/dist/widgets/dist/packages/hooks/dist/contexts/types.d.ts +0 -61
- package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.cts +0 -60
- package/dist/widgets/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +0 -60
- package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.cts +0 -11
- package/dist/widgets/dist/packages/hooks/dist/hooks/utils.d.ts +0 -11
- package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.cts +0 -28
- package/dist/widgets/dist/packages/hooks/dist/types/search-filter-types.d.ts +0 -28
- package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.cts +0 -10
- package/dist/widgets/dist/packages/hooks/dist/types/test-types.d.ts +0 -10
- /package/dist/{widgets → packages/widgets}/dist/SearchResults/index.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SearchResults/types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroState.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/index.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/types.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/config/BaseWidgetConfig.d.ts +0 -0
- /package/dist/{widgets → packages/widgets}/dist/config/WidgetType.d.ts +0 -0
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
ChatPreviewComparisonWidgetV3Config,
|
|
3
3
|
WidgetTypeV3,
|
|
4
4
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import { useAtomValue } from 'jotai';
|
|
6
|
-
import {
|
|
5
|
+
import { useAtomValue, useSetAtom } from 'jotai';
|
|
6
|
+
import { handleReplyAtom } from '@envive-ai/react-hooks/atoms/chat/replies';
|
|
7
7
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
8
8
|
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
9
9
|
|
|
@@ -11,8 +11,12 @@ import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
|
11
11
|
import { useCallback, useMemo } from 'react';
|
|
12
12
|
import {
|
|
13
13
|
ChatElementDisplayLocationV3,
|
|
14
|
+
Message,
|
|
15
|
+
MessageRole,
|
|
16
|
+
MessageType,
|
|
14
17
|
VariantTypeEnum,
|
|
15
18
|
} from '@envive-ai/react-hooks/application/models';
|
|
19
|
+
import { v4 as uuid } from 'uuid';
|
|
16
20
|
import { ChatPreviewComparison } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison';
|
|
17
21
|
import { ChatPreviewComparisonProps } from '@envive-ai/react-toolkit-v3/ChatPreviewComparison/types/types';
|
|
18
22
|
import { variantInfoAtom } from '@envive-ai/react-hooks/atoms/app';
|
|
@@ -22,7 +26,7 @@ import { getMessageText, getRecentProductImageUrls } from '../utils/functions';
|
|
|
22
26
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
23
27
|
|
|
24
28
|
const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
25
|
-
const
|
|
29
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
26
30
|
const { openChat } = useChatToggle();
|
|
27
31
|
|
|
28
32
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
@@ -74,15 +78,33 @@ const ChatPreviewComparisonWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
74
78
|
|
|
75
79
|
const handlePromptButtonClick = useCallback(
|
|
76
80
|
(text: string) => {
|
|
77
|
-
|
|
81
|
+
const newMessage: Message = {
|
|
82
|
+
id: uuid(),
|
|
83
|
+
role: MessageRole.User,
|
|
84
|
+
type: MessageType.QueryTyped,
|
|
85
|
+
createdAt: new Date().toISOString(),
|
|
86
|
+
metadata: { content: text },
|
|
87
|
+
};
|
|
88
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
78
89
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_PROMPT_BUTTON);
|
|
79
90
|
},
|
|
80
|
-
[
|
|
91
|
+
[handleReply, openChat],
|
|
81
92
|
);
|
|
82
93
|
|
|
83
|
-
const handleTextFieldClick = useCallback(
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
const handleTextFieldClick = useCallback(
|
|
95
|
+
(text: string) => {
|
|
96
|
+
const newMessage: Message = {
|
|
97
|
+
id: uuid(),
|
|
98
|
+
role: MessageRole.User,
|
|
99
|
+
type: MessageType.QueryTyped,
|
|
100
|
+
createdAt: new Date().toISOString(),
|
|
101
|
+
metadata: { content: text },
|
|
102
|
+
};
|
|
103
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
104
|
+
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_COMPARISON_TEXT_FIELD);
|
|
105
|
+
},
|
|
106
|
+
[handleReply, openChat],
|
|
107
|
+
);
|
|
86
108
|
|
|
87
109
|
if (isLoading) {
|
|
88
110
|
return (
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { ChatPreviewWidgetV3Config, WidgetTypeV3 } from '@envive-ai/react-hooks/contexts/typesV3';
|
|
2
|
-
import { useAtomValue } from 'jotai';
|
|
3
|
-
import {
|
|
2
|
+
import { useAtomValue, useSetAtom } from 'jotai';
|
|
3
|
+
import { handleReplyAtom } from '@envive-ai/react-hooks/atoms/chat/replies';
|
|
4
4
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
5
5
|
import { chatAtom, lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
6
6
|
|
|
7
7
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
8
8
|
import { useCallback, useMemo } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
ChatElementDisplayLocationV3,
|
|
11
|
+
Message,
|
|
12
|
+
MessageRole,
|
|
13
|
+
MessageType,
|
|
14
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
15
|
+
import { v4 as uuid } from 'uuid';
|
|
10
16
|
import { ChatPreviewProps } from '@envive-ai/react-toolkit-v3/ChatPreview/types/types';
|
|
11
17
|
import { ChatPreview } from '@envive-ai/react-toolkit-v3/ChatPreview';
|
|
12
18
|
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
@@ -15,7 +21,7 @@ import { getMessageText } from '../utils/functions';
|
|
|
15
21
|
import { ChatPreviewLoadingWidgetWithBaseWidget } from '../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget';
|
|
16
22
|
|
|
17
23
|
const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
18
|
-
const
|
|
24
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
19
25
|
const { openChat } = useChatToggle();
|
|
20
26
|
|
|
21
27
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
@@ -50,15 +56,33 @@ const ChatPreviewWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
50
56
|
|
|
51
57
|
const handlePromptButtonClick = useCallback(
|
|
52
58
|
(text: string) => {
|
|
53
|
-
|
|
59
|
+
const newMessage: Message = {
|
|
60
|
+
id: uuid(),
|
|
61
|
+
role: MessageRole.User,
|
|
62
|
+
type: MessageType.QueryTyped,
|
|
63
|
+
createdAt: new Date().toISOString(),
|
|
64
|
+
metadata: { content: text },
|
|
65
|
+
};
|
|
66
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
54
67
|
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_PROMPT_BUTTON);
|
|
55
68
|
},
|
|
56
|
-
[
|
|
69
|
+
[handleReply, openChat],
|
|
57
70
|
);
|
|
58
71
|
|
|
59
|
-
const handleTextFieldClick = useCallback(
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
const handleTextFieldClick = useCallback(
|
|
73
|
+
(text: string) => {
|
|
74
|
+
const newMessage: Message = {
|
|
75
|
+
id: uuid(),
|
|
76
|
+
role: MessageRole.User,
|
|
77
|
+
type: MessageType.QueryTyped,
|
|
78
|
+
createdAt: new Date().toISOString(),
|
|
79
|
+
metadata: { content: text },
|
|
80
|
+
};
|
|
81
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
82
|
+
openChat(ChatElementDisplayLocationV3.CHAT_PREVIEW_TEXT_FIELD);
|
|
83
|
+
},
|
|
84
|
+
[handleReply, openChat],
|
|
85
|
+
);
|
|
62
86
|
|
|
63
87
|
if (isLoading) {
|
|
64
88
|
return (
|
package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
CHANGED
|
@@ -2,12 +2,19 @@ import {
|
|
|
2
2
|
PromptButtonCarouselWithImageWidgetV3Config,
|
|
3
3
|
WidgetTypeV3,
|
|
4
4
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
|
-
import {
|
|
5
|
+
import { useSetAtom } from 'jotai';
|
|
6
|
+
import { handleReplyAtom } from '@envive-ai/react-hooks/atoms/chat/replies';
|
|
6
7
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
7
8
|
|
|
8
9
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
9
10
|
import { useCallback } from 'react';
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ChatElementDisplayLocationV3,
|
|
13
|
+
Message,
|
|
14
|
+
MessageRole,
|
|
15
|
+
MessageType,
|
|
16
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
17
|
+
import { v4 as uuid } from 'uuid';
|
|
11
18
|
import {
|
|
12
19
|
PromptButtonCarouselWithImage,
|
|
13
20
|
PromptButtonCarouselWithImageProps,
|
|
@@ -16,7 +23,7 @@ import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
|
16
23
|
import { withBaseWidget } from '../../hocs/withBaseWidget/withBaseWidget';
|
|
17
24
|
|
|
18
25
|
const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
|
|
19
|
-
const
|
|
26
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
20
27
|
const { openChat } = useChatToggle();
|
|
21
28
|
|
|
22
29
|
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
@@ -37,15 +44,33 @@ const PromptButtonCarouselWithImageWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
37
44
|
|
|
38
45
|
const handlePromptButtonClick = useCallback(
|
|
39
46
|
(text: string) => {
|
|
40
|
-
|
|
47
|
+
const newMessage: Message = {
|
|
48
|
+
id: uuid(),
|
|
49
|
+
role: MessageRole.User,
|
|
50
|
+
type: MessageType.QueryTyped,
|
|
51
|
+
createdAt: new Date().toISOString(),
|
|
52
|
+
metadata: { content: text },
|
|
53
|
+
};
|
|
54
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
41
55
|
openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON);
|
|
42
56
|
},
|
|
43
|
-
[
|
|
57
|
+
[handleReply, openChat],
|
|
44
58
|
);
|
|
45
59
|
|
|
46
|
-
const handleTextFieldClick = useCallback(
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
const handleTextFieldClick = useCallback(
|
|
61
|
+
(text: string) => {
|
|
62
|
+
const newMessage: Message = {
|
|
63
|
+
id: uuid(),
|
|
64
|
+
role: MessageRole.User,
|
|
65
|
+
type: MessageType.QueryTyped,
|
|
66
|
+
createdAt: new Date().toISOString(),
|
|
67
|
+
metadata: { content: text },
|
|
68
|
+
};
|
|
69
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
70
|
+
openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
|
|
71
|
+
},
|
|
72
|
+
[handleReply, openChat],
|
|
73
|
+
);
|
|
49
74
|
|
|
50
75
|
return (
|
|
51
76
|
<PromptButtonCarouselWithImage
|
|
@@ -4,8 +4,15 @@ import {
|
|
|
4
4
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
5
|
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { v4 as uuid } from 'uuid';
|
|
8
|
+
import {
|
|
9
|
+
ChatElementDisplayLocationV3,
|
|
10
|
+
Message,
|
|
11
|
+
MessageRole,
|
|
12
|
+
MessageType,
|
|
13
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
14
|
+
import { useSetAtom } from 'jotai';
|
|
15
|
+
import { handleReplyAtom } from '@envive-ai/react-hooks/atoms/chat/replies';
|
|
9
16
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
10
17
|
import { AnimationSpeed } from '@envive-ai/react-toolkit-v3/PromptCarousel/types/types';
|
|
11
18
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
@@ -21,7 +28,7 @@ const mockButtonTexts = [
|
|
|
21
28
|
];
|
|
22
29
|
|
|
23
30
|
const PromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
24
|
-
const
|
|
31
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
25
32
|
const { openChat } = useChatToggle();
|
|
26
33
|
|
|
27
34
|
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
@@ -41,10 +48,17 @@ const PromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
41
48
|
|
|
42
49
|
const handleButtonClick = useCallback(
|
|
43
50
|
(text: string) => {
|
|
44
|
-
|
|
51
|
+
const newMessage: Message = {
|
|
52
|
+
id: uuid(),
|
|
53
|
+
role: MessageRole.User,
|
|
54
|
+
type: MessageType.QueryTyped,
|
|
55
|
+
createdAt: new Date().toISOString(),
|
|
56
|
+
metadata: { content: text },
|
|
57
|
+
};
|
|
58
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
45
59
|
openChat(ChatElementDisplayLocationV3.PROMPT_CAROUSEL);
|
|
46
60
|
},
|
|
47
|
-
[
|
|
61
|
+
[handleReply, openChat],
|
|
48
62
|
);
|
|
49
63
|
|
|
50
64
|
return (
|
|
@@ -4,14 +4,20 @@ import {
|
|
|
4
4
|
WidgetTypeV3,
|
|
5
5
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
6
6
|
import { useAtomValue, useSetAtom } from 'jotai';
|
|
7
|
-
import {
|
|
7
|
+
import { handleReplyAtom } from '@envive-ai/react-hooks/atoms/chat/replies';
|
|
8
8
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
9
9
|
import { lastAssistantMessageAtom } from '@envive-ai/react-hooks/atoms/chat';
|
|
10
10
|
|
|
11
11
|
import { SocialProof, SocialProofProps } from '@envive-ai/react-toolkit-v3/SocialProof';
|
|
12
12
|
import { Theme } from '@envive-ai/react-toolkit-v3/Tokens';
|
|
13
13
|
import { useCallback } from 'react';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ChatElementDisplayLocationV3,
|
|
16
|
+
Message,
|
|
17
|
+
MessageRole,
|
|
18
|
+
MessageType,
|
|
19
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
20
|
+
import { v4 as uuid } from 'uuid';
|
|
15
21
|
import { chatPreviewLoadingDataAtom } from '@envive-ai/react-hooks/atoms/widget';
|
|
16
22
|
import { ChatPreviewLoading } from '@envive-ai/react-toolkit-v3/ChatPreviewLoading';
|
|
17
23
|
import { BaseWidgetProps } from '../../hocs/withBaseWidget/types';
|
|
@@ -21,7 +27,7 @@ import { getProductImageUrl } from '../utils/functions';
|
|
|
21
27
|
const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
22
28
|
const setChatPreviewLoadingData = useSetAtom(chatPreviewLoadingDataAtom);
|
|
23
29
|
|
|
24
|
-
const
|
|
30
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
25
31
|
const { openChat } = useChatToggle();
|
|
26
32
|
const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
|
|
27
33
|
|
|
@@ -63,23 +69,48 @@ const SocialProofWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
63
69
|
|
|
64
70
|
const handlePrimaryButtonClick = useCallback(
|
|
65
71
|
(text: string) => {
|
|
66
|
-
|
|
72
|
+
const newMessage: Message = {
|
|
73
|
+
id: uuid(),
|
|
74
|
+
role: MessageRole.User,
|
|
75
|
+
type: MessageType.QueryTyped,
|
|
76
|
+
createdAt: new Date().toISOString(),
|
|
77
|
+
metadata: { content: text },
|
|
78
|
+
};
|
|
79
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
67
80
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
|
|
68
81
|
},
|
|
69
|
-
[
|
|
82
|
+
[handleReply, openChat],
|
|
70
83
|
);
|
|
71
84
|
|
|
72
85
|
const handleSecondaryButtonClick = useCallback(
|
|
73
86
|
(text: string) => {
|
|
74
|
-
|
|
87
|
+
const newMessage: Message = {
|
|
88
|
+
id: uuid(),
|
|
89
|
+
role: MessageRole.User,
|
|
90
|
+
type: MessageType.QueryTyped,
|
|
91
|
+
createdAt: new Date().toISOString(),
|
|
92
|
+
metadata: { content: text },
|
|
93
|
+
};
|
|
94
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
75
95
|
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
|
|
76
96
|
},
|
|
77
|
-
[
|
|
97
|
+
[handleReply, openChat],
|
|
78
98
|
);
|
|
79
99
|
|
|
80
|
-
const handleTextFieldClick = useCallback(
|
|
81
|
-
|
|
82
|
-
|
|
100
|
+
const handleTextFieldClick = useCallback(
|
|
101
|
+
(text: string) => {
|
|
102
|
+
const newMessage: Message = {
|
|
103
|
+
id: uuid(),
|
|
104
|
+
role: MessageRole.User,
|
|
105
|
+
type: MessageType.QueryTyped,
|
|
106
|
+
createdAt: new Date().toISOString(),
|
|
107
|
+
metadata: { content: text },
|
|
108
|
+
};
|
|
109
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
110
|
+
openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
|
|
111
|
+
},
|
|
112
|
+
[handleReply, openChat],
|
|
113
|
+
);
|
|
83
114
|
|
|
84
115
|
if (isLoading) {
|
|
85
116
|
return <ChatPreviewLoading fullIsLoading />;
|
|
@@ -4,8 +4,15 @@ import {
|
|
|
4
4
|
} from '@envive-ai/react-hooks/contexts/typesV3';
|
|
5
5
|
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { v4 as uuid } from 'uuid';
|
|
8
|
+
import {
|
|
9
|
+
ChatElementDisplayLocationV3,
|
|
10
|
+
Message,
|
|
11
|
+
MessageRole,
|
|
12
|
+
MessageType,
|
|
13
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
14
|
+
import { useSetAtom } from 'jotai';
|
|
15
|
+
import { handleReplyAtom } from '@envive-ai/react-hooks/atoms/chat/replies';
|
|
9
16
|
import { useChatToggle } from '@envive-ai/react-hooks/hooks/ChatToggle';
|
|
10
17
|
import { TitledPromptCarousel } from '@envive-ai/react-toolkit-v3/TitledPromptCarousel';
|
|
11
18
|
import { AnimationSpeed, PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
@@ -22,7 +29,7 @@ const mockButtonTexts = [
|
|
|
22
29
|
const mockTitleLabel = 'Loading...';
|
|
23
30
|
|
|
24
31
|
const TitledPromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
25
|
-
const
|
|
32
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
26
33
|
const { openChat } = useChatToggle();
|
|
27
34
|
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
28
35
|
|
|
@@ -50,10 +57,17 @@ const TitledPromptCarouselWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
50
57
|
|
|
51
58
|
const handleButtonClick = useCallback(
|
|
52
59
|
(text: string) => {
|
|
53
|
-
|
|
60
|
+
const newMessage: Message = {
|
|
61
|
+
id: uuid(),
|
|
62
|
+
role: MessageRole.User,
|
|
63
|
+
type: MessageType.QueryTyped,
|
|
64
|
+
createdAt: new Date().toISOString(),
|
|
65
|
+
metadata: { content: text },
|
|
66
|
+
};
|
|
67
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
54
68
|
openChat(ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
|
|
55
69
|
},
|
|
56
|
-
[
|
|
70
|
+
[handleReply, openChat],
|
|
57
71
|
);
|
|
58
72
|
|
|
59
73
|
return (
|
|
@@ -5,9 +5,15 @@ import {
|
|
|
5
5
|
import { PromptButtonVariant } from '@envive-ai/react-toolkit-v3/PromptButton/types';
|
|
6
6
|
import { WidgetWrapperVariant } from '@envive-ai/react-toolkit-v3/WidgetWrapper';
|
|
7
7
|
import { useCallback } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { v4 as uuid } from 'uuid';
|
|
9
|
+
import {
|
|
10
|
+
ChatElementDisplayLocationV3,
|
|
11
|
+
Message,
|
|
12
|
+
MessageRole,
|
|
13
|
+
MessageType,
|
|
14
|
+
} from '@envive-ai/react-hooks/application/models';
|
|
9
15
|
import { useSetAtom } from 'jotai';
|
|
10
|
-
import {
|
|
16
|
+
import { handleReplyAtom } from '@envive-ai/react-hooks/atoms/chat/replies';
|
|
11
17
|
import { chatOnToggleAtom } from '@envive-ai/react-hooks/atoms/chat/chatState';
|
|
12
18
|
import { PromptCarouselRows } from '@envive-ai/react-toolkit-v3/PromptCarousel';
|
|
13
19
|
import { TypingAnimation } from '@envive-ai/react-toolkit-v3/TypingAnimation';
|
|
@@ -26,7 +32,7 @@ const mockAnimatedTextSequence = ['...'];
|
|
|
26
32
|
const mockHintText = 'Ask me anything';
|
|
27
33
|
|
|
28
34
|
const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
|
|
29
|
-
const
|
|
35
|
+
const handleReply = useSetAtom(handleReplyAtom);
|
|
30
36
|
const onToggle = useSetAtom(chatOnToggleAtom);
|
|
31
37
|
|
|
32
38
|
const { hardcopyContent, widgetConfig, isLoading } = props;
|
|
@@ -56,10 +62,17 @@ const TypingAnimationWidgetHandler = (props: BaseWidgetProps) => {
|
|
|
56
62
|
|
|
57
63
|
const handleButtonClick = useCallback(
|
|
58
64
|
(text: string) => {
|
|
59
|
-
|
|
65
|
+
const newMessage: Message = {
|
|
66
|
+
id: uuid(),
|
|
67
|
+
role: MessageRole.User,
|
|
68
|
+
type: MessageType.QueryTyped,
|
|
69
|
+
createdAt: new Date().toISOString(),
|
|
70
|
+
metadata: { content: text },
|
|
71
|
+
};
|
|
72
|
+
handleReply({ message: newMessage, userTyped: false });
|
|
60
73
|
onToggle(ChatElementDisplayLocationV3.TYPING_ANIMATION);
|
|
61
74
|
},
|
|
62
|
-
[
|
|
75
|
+
[handleReply, onToggle],
|
|
63
76
|
);
|
|
64
77
|
|
|
65
78
|
const handleTextFieldClick = useCallback(() => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "../frontendConfig.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "../../contexts/types.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "../typesV3.js";
|
|
2
|
-
import "react";
|
|
3
|
-
|
|
4
|
-
//#region ../hooks/dist/contexts/hardcopyContext/hardcopyContext.d.ts
|
|
5
|
-
|
|
6
|
-
type HardcopyResponse = {
|
|
7
|
-
language: string;
|
|
8
|
-
values: Record<string, string | string[]>;
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { HardcopyResponse };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { HardcopyResponse } from "./hardcopyContext.js";
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//#region ../hooks/dist/contexts/types.d.ts
|
|
2
|
-
|
|
3
|
-
interface AlphabeticFilterSorting {
|
|
4
|
-
type: 'alphabetic';
|
|
5
|
-
}
|
|
6
|
-
interface ProductCountFilterSorting {
|
|
7
|
-
type: 'productCount';
|
|
8
|
-
}
|
|
9
|
-
interface CustomFilterSorting {
|
|
10
|
-
type: 'custom';
|
|
11
|
-
map: Record<string, number>;
|
|
12
|
-
}
|
|
13
|
-
type FilterSorting = AlphabeticFilterSorting | ProductCountFilterSorting | CustomFilterSorting;
|
|
14
|
-
interface BaseFilterConfig {
|
|
15
|
-
filterId: string;
|
|
16
|
-
displayName: string;
|
|
17
|
-
}
|
|
18
|
-
interface DynamicFilterConfig extends BaseFilterConfig {
|
|
19
|
-
type: 'dynamic';
|
|
20
|
-
attribute: string;
|
|
21
|
-
sorting: FilterSorting;
|
|
22
|
-
}
|
|
23
|
-
interface PriceFilterConfig extends BaseFilterConfig {
|
|
24
|
-
type: 'price';
|
|
25
|
-
bucketSize: number;
|
|
26
|
-
}
|
|
27
|
-
type FilterAttribute = DynamicFilterConfig | PriceFilterConfig;
|
|
28
|
-
interface MerchantVariantSettings {
|
|
29
|
-
dynamicVariants: {
|
|
30
|
-
enabled: boolean;
|
|
31
|
-
refreshInterval?: number;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
interface SearchConfig {
|
|
35
|
-
enableGlobalSearch: boolean;
|
|
36
|
-
searchFilterConfig: FilterAttribute[];
|
|
37
|
-
searchOverlayHeading?: string;
|
|
38
|
-
redirectSearchResultsUrl?: string;
|
|
39
|
-
additiveDynamicFilters?: boolean;
|
|
40
|
-
recommendedProducts?: string[];
|
|
41
|
-
recommendedProductsHeading?: string;
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
export { type MerchantVariantSettings, type SearchConfig };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import "./typesV3.js";
|
|
2
|
-
import "../application/models/api/orgConfigResults.js";
|
|
3
|
-
|
|
4
|
-
//#region ../hooks/dist/contexts/types.d.ts
|
|
5
|
-
|
|
6
|
-
interface AlphabeticFilterSorting {
|
|
7
|
-
type: 'alphabetic';
|
|
8
|
-
}
|
|
9
|
-
interface ProductCountFilterSorting {
|
|
10
|
-
type: 'productCount';
|
|
11
|
-
}
|
|
12
|
-
interface CustomFilterSorting {
|
|
13
|
-
type: 'custom';
|
|
14
|
-
map: Record<string, number>;
|
|
15
|
-
}
|
|
16
|
-
type FilterSorting = AlphabeticFilterSorting | ProductCountFilterSorting | CustomFilterSorting;
|
|
17
|
-
interface BaseFilterConfig {
|
|
18
|
-
filterId: string;
|
|
19
|
-
displayName: string;
|
|
20
|
-
}
|
|
21
|
-
interface DynamicFilterConfig extends BaseFilterConfig {
|
|
22
|
-
type: 'dynamic';
|
|
23
|
-
attribute: string;
|
|
24
|
-
sorting: FilterSorting;
|
|
25
|
-
}
|
|
26
|
-
interface PriceFilterConfig extends BaseFilterConfig {
|
|
27
|
-
type: 'price';
|
|
28
|
-
bucketSize: number;
|
|
29
|
-
}
|
|
30
|
-
type FilterAttribute = DynamicFilterConfig | PriceFilterConfig;
|
|
31
|
-
interface MerchantVariantSettings {
|
|
32
|
-
dynamicVariants: {
|
|
33
|
-
enabled: boolean;
|
|
34
|
-
refreshInterval?: number;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
interface SearchConfig {
|
|
38
|
-
enableGlobalSearch: boolean;
|
|
39
|
-
searchFilterConfig: FilterAttribute[];
|
|
40
|
-
searchOverlayHeading?: string;
|
|
41
|
-
redirectSearchResultsUrl?: string;
|
|
42
|
-
additiveDynamicFilters?: boolean;
|
|
43
|
-
recommendedProducts?: string[];
|
|
44
|
-
recommendedProductsHeading?: string;
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
export { type MerchantVariantSettings, type SearchConfig };
|