@envive-ai/react-widgets-v3 0.3.2 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/hocs/withBaseWidget/types.d.ts +5 -5
  2. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  3. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  4. package/dist/node_modules/uuid/dist/native.js +6 -0
  5. package/dist/node_modules/uuid/dist/rng.js +13 -0
  6. package/dist/node_modules/uuid/dist/stringify.js +9 -0
  7. package/dist/node_modules/uuid/dist/v4.js +27 -0
  8. package/dist/node_modules/uuid/dist-node/native.cjs +8 -0
  9. package/dist/node_modules/uuid/dist-node/rng.cjs +16 -0
  10. package/dist/node_modules/uuid/dist-node/stringify.cjs +10 -0
  11. package/dist/node_modules/uuid/dist-node/v4.cjs +27 -0
  12. package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResults.d.ts +2 -2
  13. package/dist/{widgets → packages/widgets}/dist/SearchResults/SearchResultsWidget.d.ts +2 -2
  14. package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroStateWidget.d.ts +2 -2
  15. package/dist/{widgets → packages/widgets}/dist/SuggestionBar/SuggestionBar.d.ts +2 -2
  16. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +28 -11
  17. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.cts +3 -3
  18. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  19. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +28 -11
  20. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  21. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  22. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +27 -10
  23. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  24. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  25. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +27 -10
  26. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +3 -3
  27. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  28. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  29. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +3 -3
  30. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +26 -8
  31. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  32. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +27 -9
  33. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +14 -6
  34. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  35. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +15 -7
  36. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.cjs +1 -1
  37. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  38. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.js +1 -1
  39. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +36 -13
  40. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  41. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  42. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +36 -13
  43. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +13 -5
  44. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  45. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  46. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +14 -6
  47. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.cjs +1 -1
  48. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  49. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  50. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.js +1 -1
  51. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +14 -7
  52. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.cts +3 -3
  53. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.d.ts +3 -3
  54. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.js +14 -7
  55. package/dist/widgets/dist/SearchResults/SearchResults.d.cts +2 -2
  56. package/dist/widgets/dist/SearchResults/SearchResultsWidget.d.cts +2 -2
  57. package/dist/widgets/dist/SearchZeroState/SearchZeroStateWidget.d.cts +2 -2
  58. package/dist/widgets/dist/SuggestionBar/SuggestionBar.d.cts +2 -2
  59. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  60. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  61. package/dist/widgets/utils/functions.cjs +1 -1
  62. package/dist/widgets/utils/functions.js +1 -1
  63. package/dist/widgets-v2/SearchResults/index.d.ts +3 -3
  64. package/dist/widgets-v2/SearchZeroState/index.d.ts +5 -5
  65. package/dist/widgets-v2/SuggestionBar/index.d.ts +3 -3
  66. package/dist/widgets-v2/SuggestionButtonContainer/index.d.ts +2 -2
  67. package/package.json +1 -1
  68. package/src/stories/SalesAgentTest/SalesAgentTest.tsx +2 -2
  69. package/src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx +30 -8
  70. package/src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx +33 -9
  71. package/src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx +33 -8
  72. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +19 -5
  73. package/src/widgets/SocialProofWidget/SocialProofWidget.tsx +41 -10
  74. package/src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.tsx +19 -5
  75. package/src/widgets/TypingAnimationWidget/TypingAnimationWidget.tsx +18 -5
  76. /package/dist/{hooks → packages/hooks}/dist/application/models/api/orgConfigResults.d.ts +0 -0
  77. /package/dist/{hooks → packages/hooks}/dist/application/models/frontendConfig.d.ts +0 -0
  78. /package/dist/{hooks → packages/hooks}/dist/contexts/amplitudeContext/amplitudeContext.d.ts +0 -0
  79. /package/dist/{hooks → packages/hooks}/dist/contexts/amplitudeContext/index.d.ts +0 -0
  80. /package/dist/{hooks → packages/hooks}/dist/contexts/featureFlagServiceContext/featureFlagServiceContext.d.ts +0 -0
  81. /package/dist/{hooks → packages/hooks}/dist/contexts/hardcopyContext/hardcopyContext.d.ts +0 -0
  82. /package/dist/{hooks → packages/hooks}/dist/contexts/hardcopyContext/index.d.ts +0 -0
  83. /package/dist/{hooks → packages/hooks}/dist/contexts/types.d.ts +0 -0
  84. /package/dist/{hooks → packages/hooks}/dist/contexts/typesV3.d.ts +0 -0
  85. /package/dist/{hooks → packages/hooks}/dist/services/amplitudeService/amplitudeService.d.ts +0 -0
  86. /package/dist/{hooks → packages/hooks}/dist/types/customerService.d.ts +0 -0
  87. /package/dist/{widgets → packages/widgets}/dist/SearchResults/index.d.ts +0 -0
  88. /package/dist/{widgets → packages/widgets}/dist/SearchResults/types.d.ts +0 -0
  89. /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/SearchZeroState.d.ts +0 -0
  90. /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/index.d.ts +0 -0
  91. /package/dist/{widgets → packages/widgets}/dist/SearchZeroState/types.d.ts +0 -0
  92. /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/index.d.ts +0 -0
  93. /package/dist/{widgets → packages/widgets}/dist/SuggestionBar/types.d.ts +0 -0
  94. /package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +0 -0
  95. /package/dist/{widgets → packages/widgets}/dist/SuggestionButtonContainer/types.d.ts +0 -0
  96. /package/dist/{widgets → packages/widgets}/dist/config/BaseWidgetConfig.d.ts +0 -0
  97. /package/dist/{widgets → packages/widgets}/dist/config/WidgetType.d.ts +0 -0
  98. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/api/response.d.ts +0 -0
  99. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/api/search.d.ts +0 -0
  100. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/camelCase.d.ts +0 -0
  101. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/camelCasedPropertiesDeep.d.ts +0 -0
  102. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/internal.d.ts +0 -0
  103. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/splitWords.d.ts +0 -0
  104. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/trim.d.ts +0 -0
  105. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/application/models/utilityTypes/unknownArray.d.ts +0 -0
  106. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/atoms/search/searchAPI.d.ts +0 -0
  107. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/contexts/types.d.ts +0 -0
  108. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/hooks/Search/useSearch.d.ts +0 -0
  109. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/hooks/utils.d.ts +0 -0
  110. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/types/search-filter-types.d.ts +0 -0
  111. /package/dist/{widgets → packages/widgets}/dist/packages/hooks/dist/types/test-types.d.ts +0 -0
@@ -9,12 +9,12 @@ const require_useUnifiedCXButton = require('../../CXIntegration/hooks/useUnified
9
9
  let react = require("react");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
12
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
13
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
14
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
12
15
  let __envive_ai_react_toolkit_v3_FloatingChat = require("@envive-ai/react-toolkit-v3/FloatingChat");
13
16
  let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
14
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
15
17
  let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
16
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
17
- let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
18
18
 
19
19
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
20
20
  const FloatingChatWidgetHandler = (props) => {
@@ -1,9 +1,9 @@
1
- import * as react_jsx_runtime13 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
4
4
  interface FloatingChatWidgetProps {}
5
5
  declare const FloatingChatWidget: {
6
- (): react_jsx_runtime13.JSX.Element;
6
+ (): react_jsx_runtime2.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -1,9 +1,9 @@
1
- import * as react_jsx_runtime9 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime6 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
4
4
  interface FloatingChatWidgetProps {}
5
5
  declare const FloatingChatWidget: {
6
- (): react_jsx_runtime9.JSX.Element;
6
+ (): react_jsx_runtime6.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -8,12 +8,12 @@ import { useUnifiedCXButton } from "../../CXIntegration/hooks/useUnifiedCXButton
8
8
  import { useMemo } from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
11
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
12
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
13
+ import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
11
14
  import { FloatingChat } from "@envive-ai/react-toolkit-v3/FloatingChat";
12
15
  import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
13
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
14
16
  import { FloatingButton } from "@envive-ai/react-toolkit-v3/FloatingButton";
15
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
16
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
17
17
 
18
18
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
19
19
  const FloatingChatWidgetHandler = (props) => {
@@ -1,17 +1,19 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
+ const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
3
4
  let react = require("react");
4
5
  let react_jsx_runtime = require("react/jsx-runtime");
5
6
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
6
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
7
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
7
+ let jotai = require("jotai");
8
+ let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
8
9
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
10
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
9
11
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
10
12
  let __envive_ai_react_toolkit_v3_PromptButtonCarouselWithImage = require("@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage");
11
13
 
12
14
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
13
15
  const PromptButtonCarouselWithImageWidgetHandler = (props) => {
14
- const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
16
+ const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
15
17
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
16
18
  const { hardcopyContent, widgetConfig, isLoading } = props;
17
19
  const promptButtonCarouselWithImageWidgetConfig = widgetConfig;
@@ -22,15 +24,31 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
22
24
  textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText
23
25
  };
24
26
  const handlePromptButtonClick = (0, react.useCallback)((text) => {
25
- onTypedMessageSubmitted({
26
- query: text,
27
+ handleReply({
28
+ message: {
29
+ id: require_v4.default(),
30
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
31
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
32
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
33
+ metadata: { content: text }
34
+ },
27
35
  userTyped: false
28
36
  });
29
37
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON);
30
- }, [onTypedMessageSubmitted, openChat]);
31
- const handleTextFieldClick = (0, react.useCallback)(() => {
38
+ }, [handleReply, openChat]);
39
+ const handleTextFieldClick = (0, react.useCallback)((text) => {
40
+ handleReply({
41
+ message: {
42
+ id: require_v4.default(),
43
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
44
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
45
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
46
+ metadata: { content: text }
47
+ },
48
+ userTyped: false
49
+ });
32
50
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
33
- }, [openChat]);
51
+ }, [handleReply, openChat]);
34
52
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_PromptButtonCarouselWithImage.PromptButtonCarouselWithImage, {
35
53
  id,
36
54
  theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts
5
5
  declare const PromptButtonCarouselWithImageWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime14.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime0.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface PromptButtonCarouselWithImageWidgetProps {
@@ -12,7 +12,7 @@ interface PromptButtonCarouselWithImageWidgetProps {
12
12
  declare const PromptButtonCarouselWithImageWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime14.JSX.Element;
15
+ }: PromptButtonCarouselWithImageWidgetProps): react_jsx_runtime0.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,16 +1,18 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
+ import v4_default from "../../node_modules/uuid/dist/v4.js";
2
3
  import { useCallback } from "react";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
5
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
6
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
6
+ import { useSetAtom } from "jotai";
7
+ import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
7
8
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
8
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
9
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
10
+ import { ChatElementDisplayLocationV3, MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
9
11
  import { PromptButtonCarouselWithImage } from "@envive-ai/react-toolkit-v3/PromptButtonCarouselWithImage";
10
12
 
11
13
  //#region src/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.tsx
12
14
  const PromptButtonCarouselWithImageWidgetHandler = (props) => {
13
- const { onTypedMessageSubmitted } = useSalesAgent();
15
+ const handleReply = useSetAtom(handleReplyAtom);
14
16
  const { openChat } = useChatToggle();
15
17
  const { hardcopyContent, widgetConfig, isLoading } = props;
16
18
  const promptButtonCarouselWithImageWidgetConfig = widgetConfig;
@@ -21,15 +23,31 @@ const PromptButtonCarouselWithImageWidgetHandler = (props) => {
21
23
  textFieldPlaceholder: hardcopyContent?.values?.textFieldPlaceholderText
22
24
  };
23
25
  const handlePromptButtonClick = useCallback((text) => {
24
- onTypedMessageSubmitted({
25
- query: text,
26
+ handleReply({
27
+ message: {
28
+ id: v4_default(),
29
+ role: MessageRole.User,
30
+ type: MessageType.QueryTyped,
31
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
32
+ metadata: { content: text }
33
+ },
26
34
  userTyped: false
27
35
  });
28
36
  openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_PROMPT_BUTTON);
29
- }, [onTypedMessageSubmitted, openChat]);
30
- const handleTextFieldClick = useCallback(() => {
37
+ }, [handleReply, openChat]);
38
+ const handleTextFieldClick = useCallback((text) => {
39
+ handleReply({
40
+ message: {
41
+ id: v4_default(),
42
+ role: MessageRole.User,
43
+ type: MessageType.QueryTyped,
44
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
45
+ metadata: { content: text }
46
+ },
47
+ userTyped: false
48
+ });
31
49
  openChat(ChatElementDisplayLocationV3.PROMPT_BUTTON_CAROUSEL_WITH_IMAGE_TEXT_FIELD);
32
- }, [openChat]);
50
+ }, [handleReply, openChat]);
33
51
  return /* @__PURE__ */ jsx(PromptButtonCarouselWithImage, {
34
52
  id,
35
53
  theme: Theme.GLOBAL_CUSTOM,
@@ -1,12 +1,14 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
3
  require('../../hocs/withBaseWidget/index.cjs');
4
+ const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
7
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
8
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
8
+ let jotai = require("jotai");
9
+ let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
9
10
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
11
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
10
12
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
11
13
  let __envive_ai_react_toolkit_v3_PromptCarousel_types_types = require("@envive-ai/react-toolkit-v3/PromptCarousel/types/types");
12
14
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
@@ -20,7 +22,7 @@ const mockButtonTexts = [
20
22
  "Loading button 5"
21
23
  ];
22
24
  const PromptCarouselWidgetHandler = (props) => {
23
- const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
25
+ const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
24
26
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
25
27
  const { hardcopyContent, widgetConfig, isLoading } = props;
26
28
  const promptButtonTexts = hardcopyContent?.values?.promptButtonTexts || [];
@@ -32,12 +34,18 @@ const PromptCarouselWidgetHandler = (props) => {
32
34
  const promptCarouselRows = promptCarouselWidgetConfig?.promptCarouselRows;
33
35
  const animationSpeed = isLoading ? __envive_ai_react_toolkit_v3_PromptCarousel_types_types.AnimationSpeed.FAST : promptCarouselWidgetConfig?.animationSpeed;
34
36
  const handleButtonClick = (0, react.useCallback)((text) => {
35
- onTypedMessageSubmitted({
36
- query: text,
37
+ handleReply({
38
+ message: {
39
+ id: require_v4.default(),
40
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
41
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
42
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
43
+ metadata: { content: text }
44
+ },
37
45
  userTyped: false
38
46
  });
39
47
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.PROMPT_CAROUSEL);
40
- }, [onTypedMessageSubmitted, openChat]);
48
+ }, [handleReply, openChat]);
41
49
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_PromptCarousel.PromptCarousel, {
42
50
  id,
43
51
  theme: __envive_ai_react_toolkit_v3_Tokens.Theme.GLOBAL_CUSTOM,
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime7 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts
4
4
  interface PromptCarouselWidgetProps {
@@ -7,7 +7,7 @@ interface PromptCarouselWidgetProps {
7
7
  declare const PromptCarouselWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: PromptCarouselWidgetProps): react_jsx_runtime2.JSX.Element;
10
+ }: PromptCarouselWidgetProps): react_jsx_runtime7.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,12 +1,14 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
2
  import "../../hocs/withBaseWidget/index.js";
3
+ import v4_default from "../../node_modules/uuid/dist/v4.js";
3
4
  import { useCallback } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
6
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
7
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
7
+ import { useSetAtom } from "jotai";
8
+ import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
8
9
  import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
9
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
10
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
11
+ import { ChatElementDisplayLocationV3, MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
10
12
  import { AnimationSpeed } from "@envive-ai/react-toolkit-v3/PromptCarousel/types/types";
11
13
  import { PromptCarousel } from "@envive-ai/react-toolkit-v3/PromptCarousel";
12
14
 
@@ -19,7 +21,7 @@ const mockButtonTexts = [
19
21
  "Loading button 5"
20
22
  ];
21
23
  const PromptCarouselWidgetHandler = (props) => {
22
- const { onTypedMessageSubmitted } = useSalesAgent();
24
+ const handleReply = useSetAtom(handleReplyAtom);
23
25
  const { openChat } = useChatToggle();
24
26
  const { hardcopyContent, widgetConfig, isLoading } = props;
25
27
  const promptButtonTexts = hardcopyContent?.values?.promptButtonTexts || [];
@@ -31,12 +33,18 @@ const PromptCarouselWidgetHandler = (props) => {
31
33
  const promptCarouselRows = promptCarouselWidgetConfig?.promptCarouselRows;
32
34
  const animationSpeed = isLoading ? AnimationSpeed.FAST : promptCarouselWidgetConfig?.animationSpeed;
33
35
  const handleButtonClick = useCallback((text) => {
34
- onTypedMessageSubmitted({
35
- query: text,
36
+ handleReply({
37
+ message: {
38
+ id: v4_default(),
39
+ role: MessageRole.User,
40
+ type: MessageType.QueryTyped,
41
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
42
+ metadata: { content: text }
43
+ },
36
44
  userTyped: false
37
45
  });
38
46
  openChat(ChatElementDisplayLocationV3.PROMPT_CAROUSEL);
39
- }, [onTypedMessageSubmitted, openChat]);
47
+ }, [handleReply, openChat]);
40
48
  return /* @__PURE__ */ jsx(PromptCarousel, {
41
49
  id,
42
50
  theme: Theme.GLOBAL_CUSTOM,
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
3
2
  const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.cjs');
4
3
  const require_ChatPreviewWidget = require('../ChatPreviewWidget/ChatPreviewWidget.cjs');
5
4
  const require_ChatPreviewComparisonWidget = require('../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs');
5
+ const require_useGetWidgetStatus = require('../hooks/useGetWidgetStatus.cjs');
6
6
  const require_SocialProofWidget = require('../SocialProofWidget/SocialProofWidget.cjs');
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
8
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime16 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.ts
4
4
  interface SocialProofFlowWidgetProps {
@@ -7,7 +7,7 @@ interface SocialProofFlowWidgetProps {
7
7
  declare const SocialProofFlowWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: SocialProofFlowWidgetProps): react_jsx_runtime1.JSX.Element;
10
+ }: SocialProofFlowWidgetProps): react_jsx_runtime16.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,7 +1,7 @@
1
- import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
2
1
  import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.js";
3
2
  import { ChatPreviewWidgetWithBaseWidget } from "../ChatPreviewWidget/ChatPreviewWidget.js";
4
3
  import { ChatPreviewComparisonWidgetWithBaseWidget } from "../ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js";
4
+ import useGetWidgetStatus_default from "../hooks/useGetWidgetStatus.js";
5
5
  import { SocialProofWidgetWithBaseWidget } from "../SocialProofWidget/SocialProofWidget.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
@@ -1,15 +1,16 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
+ const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
3
4
  const require_functions = require('../utils/functions.cjs');
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
7
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
8
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
9
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
10
- let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
11
8
  let jotai = require("jotai");
9
+ let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
10
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
12
11
  let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
12
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
13
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
13
14
  let __envive_ai_react_toolkit_v3_ChatPreviewLoading = require("@envive-ai/react-toolkit-v3/ChatPreviewLoading");
14
15
  let __envive_ai_react_hooks_atoms_widget = require("@envive-ai/react-hooks/atoms/widget");
15
16
  let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit-v3/SocialProof");
@@ -17,7 +18,7 @@ let __envive_ai_react_toolkit_v3_SocialProof = require("@envive-ai/react-toolkit
17
18
  //#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
18
19
  const SocialProofWidgetHandler = (props) => {
19
20
  const setChatPreviewLoadingData = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_widget.chatPreviewLoadingDataAtom);
20
- const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
21
+ const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
21
22
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
22
23
  const lastAssistantMessage = (0, jotai.useAtomValue)(__envive_ai_react_hooks_atoms_chat.lastAssistantMessageAtom);
23
24
  const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
@@ -40,22 +41,44 @@ const SocialProofWidgetHandler = (props) => {
40
41
  alt: "Product Image"
41
42
  }];
42
43
  const handlePrimaryButtonClick = (0, react.useCallback)((text) => {
43
- onTypedMessageSubmitted({
44
- query: text,
44
+ handleReply({
45
+ message: {
46
+ id: require_v4.default(),
47
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
48
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
49
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
50
+ metadata: { content: text }
51
+ },
45
52
  userTyped: false
46
53
  });
47
54
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
48
- }, [onTypedMessageSubmitted, openChat]);
55
+ }, [handleReply, openChat]);
49
56
  const handleSecondaryButtonClick = (0, react.useCallback)((text) => {
50
- onTypedMessageSubmitted({
51
- query: text,
57
+ handleReply({
58
+ message: {
59
+ id: require_v4.default(),
60
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
61
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
62
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
63
+ metadata: { content: text }
64
+ },
52
65
  userTyped: false
53
66
  });
54
67
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
55
- }, [onTypedMessageSubmitted, openChat]);
56
- const handleTextFieldClick = (0, react.useCallback)(() => {
68
+ }, [handleReply, openChat]);
69
+ const handleTextFieldClick = (0, react.useCallback)((text) => {
70
+ handleReply({
71
+ message: {
72
+ id: require_v4.default(),
73
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
74
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
75
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
76
+ metadata: { content: text }
77
+ },
78
+ userTyped: false
79
+ });
57
80
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
58
- }, [openChat]);
81
+ }, [handleReply, openChat]);
59
82
  if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_ChatPreviewLoading.ChatPreviewLoading, { fullIsLoading: true });
60
83
  setChatPreviewLoadingData({
61
84
  widgetConfigId,
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime7 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime10 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
5
5
  declare const SocialProofWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime10.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface SocialProofWidgetProps {
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
12
12
  declare const SocialProofWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: SocialProofWidgetProps): react_jsx_runtime7.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime10.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime7 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/SocialProofWidget/SocialProofWidget.d.ts
5
5
  declare const SocialProofWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime7.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime4.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface SocialProofWidgetProps {
@@ -12,7 +12,7 @@ interface SocialProofWidgetProps {
12
12
  declare const SocialProofWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: SocialProofWidgetProps): react_jsx_runtime7.JSX.Element;
15
+ }: SocialProofWidgetProps): react_jsx_runtime4.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -1,14 +1,15 @@
1
1
  import { withBaseWidget } from "../../hocs/withBaseWidget/withBaseWidget.js";
2
+ import v4_default from "../../node_modules/uuid/dist/v4.js";
2
3
  import { getProductImageUrl } from "../utils/functions.js";
3
4
  import { useCallback } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { SocialProofWidgetKind, WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
6
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
7
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
8
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
9
- import { ChatElementDisplayLocationV3 } from "@envive-ai/react-hooks/application/models";
10
7
  import { useAtomValue, useSetAtom } from "jotai";
8
+ import { handleReplyAtom } from "@envive-ai/react-hooks/atoms/chat/replies";
9
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
11
10
  import { lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
11
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
12
+ import { ChatElementDisplayLocationV3, MessageRole, MessageType } from "@envive-ai/react-hooks/application/models";
12
13
  import { ChatPreviewLoading } from "@envive-ai/react-toolkit-v3/ChatPreviewLoading";
13
14
  import { chatPreviewLoadingDataAtom } from "@envive-ai/react-hooks/atoms/widget";
14
15
  import { SocialProof } from "@envive-ai/react-toolkit-v3/SocialProof";
@@ -16,7 +17,7 @@ import { SocialProof } from "@envive-ai/react-toolkit-v3/SocialProof";
16
17
  //#region src/widgets/SocialProofWidget/SocialProofWidget.tsx
17
18
  const SocialProofWidgetHandler = (props) => {
18
19
  const setChatPreviewLoadingData = useSetAtom(chatPreviewLoadingDataAtom);
19
- const { onTypedMessageSubmitted } = useSalesAgent();
20
+ const handleReply = useSetAtom(handleReplyAtom);
20
21
  const { openChat } = useChatToggle();
21
22
  const lastAssistantMessage = useAtomValue(lastAssistantMessageAtom);
22
23
  const { hardcopyContent, widgetConfig, uiConfig, isLoading, widgetConfigId } = props;
@@ -39,22 +40,44 @@ const SocialProofWidgetHandler = (props) => {
39
40
  alt: "Product Image"
40
41
  }];
41
42
  const handlePrimaryButtonClick = useCallback((text) => {
42
- onTypedMessageSubmitted({
43
- query: text,
43
+ handleReply({
44
+ message: {
45
+ id: v4_default(),
46
+ role: MessageRole.User,
47
+ type: MessageType.QueryTyped,
48
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
49
+ metadata: { content: text }
50
+ },
44
51
  userTyped: false
45
52
  });
46
53
  openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_PRIMARY_BUTTON);
47
- }, [onTypedMessageSubmitted, openChat]);
54
+ }, [handleReply, openChat]);
48
55
  const handleSecondaryButtonClick = useCallback((text) => {
49
- onTypedMessageSubmitted({
50
- query: text,
56
+ handleReply({
57
+ message: {
58
+ id: v4_default(),
59
+ role: MessageRole.User,
60
+ type: MessageType.QueryTyped,
61
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
62
+ metadata: { content: text }
63
+ },
51
64
  userTyped: false
52
65
  });
53
66
  openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_SECONDARY_BUTTON);
54
- }, [onTypedMessageSubmitted, openChat]);
55
- const handleTextFieldClick = useCallback(() => {
67
+ }, [handleReply, openChat]);
68
+ const handleTextFieldClick = useCallback((text) => {
69
+ handleReply({
70
+ message: {
71
+ id: v4_default(),
72
+ role: MessageRole.User,
73
+ type: MessageType.QueryTyped,
74
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
75
+ metadata: { content: text }
76
+ },
77
+ userTyped: false
78
+ });
56
79
  openChat(ChatElementDisplayLocationV3.SOCIAL_PROOF_TEXT_FIELD);
57
- }, [openChat]);
80
+ }, [handleReply, openChat]);
58
81
  if (isLoading) return /* @__PURE__ */ jsx(ChatPreviewLoading, { fullIsLoading: true });
59
82
  setChatPreviewLoadingData({
60
83
  widgetConfigId,
@@ -1,10 +1,12 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_withBaseWidget = require('../../hocs/withBaseWidget/withBaseWidget.cjs');
3
3
  require('../../hocs/withBaseWidget/index.cjs');
4
+ const require_v4 = require('../../node_modules/uuid/dist-node/v4.cjs');
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
7
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
8
+ let jotai = require("jotai");
9
+ let __envive_ai_react_hooks_atoms_chat_replies = require("@envive-ai/react-hooks/atoms/chat/replies");
8
10
  let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
9
11
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
10
12
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
@@ -20,7 +22,7 @@ const mockButtonTexts = [
20
22
  ];
21
23
  const mockTitleLabel = "Loading...";
22
24
  const TitledPromptCarouselWidgetHandler = (props) => {
23
- const { onTypedMessageSubmitted } = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
25
+ const handleReply = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat_replies.handleReplyAtom);
24
26
  const { openChat } = (0, __envive_ai_react_hooks_hooks_ChatToggle.useChatToggle)();
25
27
  const { hardcopyContent, widgetConfig, isLoading } = props;
26
28
  const hardCopyTitleLabel = hardcopyContent?.values?.titleLabel;
@@ -44,12 +46,18 @@ const TitledPromptCarouselWidgetHandler = (props) => {
44
46
  promptCarouselRows,
45
47
  animationSpeed: isLoading ? __envive_ai_react_toolkit_v3_PromptCarousel.AnimationSpeed.FAST : titledPromptCarouselWidgetConfig?.animationSpeed,
46
48
  handleButtonClick: (0, react.useCallback)((text) => {
47
- onTypedMessageSubmitted({
48
- query: text,
49
+ handleReply({
50
+ message: {
51
+ id: require_v4.default(),
52
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
53
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
54
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
55
+ metadata: { content: text }
56
+ },
49
57
  userTyped: false
50
58
  });
51
59
  openChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.TITLED_PROMPT_CAROUSEL);
52
- }, [onTypedMessageSubmitted, openChat]),
60
+ }, [handleReply, openChat]),
53
61
  promptButtonTexts: buttonTexts,
54
62
  promptCarouselAriaLabel
55
63
  });
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime12 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
4
4
  interface TitledPromptCarouselWidgetProps {
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
7
7
  declare const TitledPromptCarouselWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: TitledPromptCarouselWidgetProps): react_jsx_runtime12.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime13.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime10 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts
4
4
  interface TitledPromptCarouselWidgetProps {
@@ -7,7 +7,7 @@ interface TitledPromptCarouselWidgetProps {
7
7
  declare const TitledPromptCarouselWidget: {
8
8
  ({
9
9
  widgetConfigId
10
- }: TitledPromptCarouselWidgetProps): react_jsx_runtime10.JSX.Element;
10
+ }: TitledPromptCarouselWidgetProps): react_jsx_runtime8.JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //#endregion