@envive-ai/react-widgets-v3 0.3.56 → 0.3.57

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 (73) hide show
  1. package/dist/debug/GenericSelect.cjs +4 -1
  2. package/dist/debug/GenericSelect.js +3 -1
  3. package/dist/debug/chatEmbed.cjs +1 -1
  4. package/dist/debug/chatEmbed.js +1 -1
  5. package/dist/debug/reportIssue.cjs +7 -4
  6. package/dist/debug/reportIssue.js +6 -4
  7. package/dist/hocs/withBaseWidget/withBaseWidget.cjs +13 -4
  8. package/dist/hocs/withBaseWidget/withBaseWidget.d.cts +2 -2
  9. package/dist/hocs/withBaseWidget/withBaseWidget.d.ts +2 -2
  10. package/dist/hocs/withBaseWidget/withBaseWidget.js +13 -4
  11. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.cjs +6 -6
  12. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts +3 -3
  13. package/dist/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.js +6 -6
  14. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.cts +3 -3
  15. package/dist/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts +3 -3
  16. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.cjs +4 -4
  17. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.cts +3 -3
  18. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts +3 -3
  19. package/dist/widgets/ChatPreviewWidget/ChatPreviewWidget.js +4 -4
  20. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.cjs +5 -27
  21. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.cts +2 -2
  22. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.d.ts +2 -2
  23. package/dist/widgets/FloatingChatWidget/FloatingChatWidget.js +6 -28
  24. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.cjs +1 -1
  25. package/dist/widgets/FloatingChatWidget/hooks/useAutoPopup.js +1 -1
  26. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.cts +2 -2
  27. package/dist/widgets/FullPageSalesAgentWidget/FullPageSalesAgentWidget.d.ts +2 -2
  28. package/dist/widgets/ProductCardWidget/ProductCardWidget.cjs +3 -3
  29. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.cts +2 -2
  30. package/dist/widgets/ProductCardWidget/ProductCardWidget.d.ts +2 -2
  31. package/dist/widgets/ProductCardWidget/ProductCardWidget.js +3 -3
  32. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.cjs +4 -4
  33. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.cts +3 -3
  34. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.d.ts +3 -3
  35. package/dist/widgets/PromptButtonCarouselWithImageWidget/PromptButtonCarouselWithImageWidget.js +4 -4
  36. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.cjs +4 -4
  37. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.cts +2 -2
  38. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.d.ts +2 -2
  39. package/dist/widgets/PromptCarouselWidget/PromptCarouselWidget.js +4 -4
  40. package/dist/widgets/SocialProofFlowWidget/SocialProofFlowWidget.d.cts +2 -2
  41. package/dist/widgets/SocialProofWidget/SocialProofWidget.cjs +6 -6
  42. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.cts +3 -3
  43. package/dist/widgets/SocialProofWidget/SocialProofWidget.d.ts +3 -3
  44. package/dist/widgets/SocialProofWidget/SocialProofWidget.js +6 -6
  45. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.cjs +2 -2
  46. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.cts +2 -2
  47. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.d.ts +2 -2
  48. package/dist/widgets/TitledPromptCarouselWidget/TitledPromptCarouselWidget.js +2 -2
  49. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.cts +2 -2
  50. package/dist/widgets/TypingAnimationFlowWidget/TypingAnimationFlowWidget.d.ts +2 -2
  51. package/dist/widgets/TypingAnimationWidget/TypingAnimationWidget.cjs +3 -3
  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 +3 -3
  55. package/dist/widgets/hooks/useGetWidgetStatus.cjs +1 -1
  56. package/dist/widgets/hooks/useGetWidgetStatus.js +1 -1
  57. package/dist/widgets/utils/functions.cjs +1 -1
  58. package/dist/widgets/utils/functions.js +1 -1
  59. package/package.json +1 -1
  60. package/src/debug/GenericSelect.tsx +4 -1
  61. package/src/debug/reportIssue.tsx +6 -3
  62. package/src/hocs/withBaseWidget/__tests__/withBaseWidget.test.tsx +159 -2
  63. package/src/hocs/withBaseWidget/withBaseWidget.tsx +29 -1
  64. package/src/widgets/ChatPreviewWidget/__tests__/ChatPreviewWidget.test.tsx +5 -1
  65. package/src/widgets/FloatingChatWidget/FloatingChatWidget.tsx +19 -42
  66. package/src/widgets/FloatingChatWidget/__tests__/FloatingChatWidget.test.tsx +1 -1
  67. package/src/widgets/ProductCardWidget/__tests__/ProductCardWidget.test.tsx +6 -1
  68. package/src/widgets/PromptButtonCarouselWithImageWidget/__tests__/PromptButtonCarouselWithImageWidget.test.tsx +5 -1
  69. package/src/widgets/PromptCarouselWidget/PromptCarouselWidget.tsx +3 -1
  70. package/src/widgets/PromptCarouselWidget/__tests__/PromptCarouselWidget.test.tsx +1 -1
  71. package/src/widgets/SocialProofWidget/__tests__/SocialProofWidget.test.tsx +5 -1
  72. package/src/widgets/TitledPromptCarouselWidget/__tests__/TitledPromptCarouselWidget.test.tsx +1 -1
  73. package/src/widgets/TypingAnimationWidget/__tests__/TypingAnimationWidget.test.tsx +5 -1
@@ -2,8 +2,11 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let react = require("react");
3
3
  react = require_rolldown_runtime.__toESM(react);
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
+ let __envive_ai_react_hooks_application_logging = require("@envive-ai/react-hooks/application/logging");
6
+ __envive_ai_react_hooks_application_logging = require_rolldown_runtime.__toESM(__envive_ai_react_hooks_application_logging);
5
7
 
6
8
  //#region src/debug/GenericSelect.tsx
9
+ const logger = new __envive_ai_react_hooks_application_logging.default("GenericSelect");
7
10
  const dictionaries = { priority: {
8
11
  p0: { label: "Urgent" },
9
12
  p1: { label: "High" },
@@ -114,7 +117,7 @@ function GenericSelect({ type, selectedKey, onSelect, buttonStyle = {}, menuStyl
114
117
  };
115
118
  }, [isOpen]);
116
119
  if (!dictionary) {
117
- console.error(`Invalid type "${type}".`);
120
+ logger.logError(`Invalid type "${type}".`, void 0);
118
121
  return null;
119
122
  }
120
123
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1,7 +1,9 @@
1
1
  import React, { useRef, useState } from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import Logger from "@envive-ai/react-hooks/application/logging";
3
4
 
4
5
  //#region src/debug/GenericSelect.tsx
6
+ const logger = new Logger("GenericSelect");
5
7
  const dictionaries = { priority: {
6
8
  p0: { label: "Urgent" },
7
9
  p1: { label: "High" },
@@ -112,7 +114,7 @@ function GenericSelect({ type, selectedKey, onSelect, buttonStyle = {}, menuStyl
112
114
  };
113
115
  }, [isOpen]);
114
116
  if (!dictionary) {
115
- console.error(`Invalid type "${type}".`);
117
+ logger.logError(`Invalid type "${type}".`, void 0);
116
118
  return null;
117
119
  }
118
120
  return /* @__PURE__ */ jsxs("div", {
@@ -3,10 +3,10 @@ const require_MessageContent = require('./MessageContent.cjs');
3
3
  let react = require("react");
4
4
  react = require_rolldown_runtime.__toESM(react);
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
6
7
  let jotai = require("jotai");
7
8
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
8
9
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
9
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
10
10
  let classnames = require("classnames");
11
11
  classnames = require_rolldown_runtime.__toESM(classnames);
12
12
 
@@ -1,10 +1,10 @@
1
1
  import { MessageContent } from "./MessageContent.js";
2
2
  import React from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { chatAtom } from "@envive-ai/react-hooks/atoms/chat";
4
5
  import { useAtomValue } from "jotai";
5
6
  import { MessageType } from "@envive-ai/react-hooks/application/models";
6
7
  import { PromptCarousel, PromptCarouselRows } from "@envive-ai/react-toolkit-v3/PromptCarousel";
7
- import { chatAtom } from "@envive-ai/react-hooks/atoms/chat";
8
8
  import classNames from "classnames";
9
9
 
10
10
  //#region src/debug/chatEmbed.tsx
@@ -5,9 +5,9 @@ const require_GenericSelect = require('./GenericSelect.cjs');
5
5
  const require_chatEmbed = require('./chatEmbed.cjs');
6
6
  let react = require("react");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
8
9
  let jotai = require("jotai");
9
10
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
10
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
11
11
  let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
12
12
  let classnames = require("classnames");
13
13
  classnames = require_rolldown_runtime.__toESM(classnames);
@@ -15,9 +15,12 @@ let __envive_ai_react_hooks_application_commerce_api = require("@envive-ai/react
15
15
  __envive_ai_react_hooks_application_commerce_api = require_rolldown_runtime.__toESM(__envive_ai_react_hooks_application_commerce_api);
16
16
  let __envive_ai_react_hooks_atoms_envive_enviveConfig = require("@envive-ai/react-hooks/atoms/envive/enviveConfig");
17
17
  let __envive_ai_react_hooks_application_utils = require("@envive-ai/react-hooks/application/utils");
18
+ let __envive_ai_react_hooks_application_logging = require("@envive-ai/react-hooks/application/logging");
19
+ __envive_ai_react_hooks_application_logging = require_rolldown_runtime.__toESM(__envive_ai_react_hooks_application_logging);
18
20
 
19
21
  //#region src/debug/reportIssue.tsx
20
22
  var import_dist = require_index.default;
23
+ const logger = new __envive_ai_react_hooks_application_logging.default("reportIssue");
21
24
  const messageContent = (m) => {
22
25
  if (m.type === __envive_ai_react_hooks_application_models.MessageType.Text) return m.metadata.content;
23
26
  if (m.type === __envive_ai_react_hooks_application_models.MessageType.Product) return `PRODUCT ID: ${m.metadata?.id}`;
@@ -39,7 +42,7 @@ const ReportHeader = ({ onClose }) => {
39
42
  try {
40
43
  await navigator.clipboard.writeText(userId);
41
44
  } catch (err) {
42
- console.error("Failed to copy to clipboard:", err);
45
+ logger.logError("Failed to copy to clipboard", err);
43
46
  }
44
47
  }, [userId]);
45
48
  const headerTitleClassnames = (0, classnames.default)({
@@ -431,11 +434,11 @@ const ReportIssue = () => {
431
434
  turn_info: turnInfo,
432
435
  report_type: reportType
433
436
  };
434
- console.info("Submitting report", request);
437
+ logger.logInfo("Submitting report", request);
435
438
  await __envive_ai_react_hooks_application_commerce_api.default.reportSession(request);
436
439
  onClose();
437
440
  } catch (error) {
438
- console.error("Error sending report", error);
441
+ logger.logError("Error sending report", error);
439
442
  setErrorMessage("There was an error sending the report. Please try again or contact Envive Support.");
440
443
  } finally {
441
444
  setIsReporting(false);
@@ -3,17 +3,19 @@ import { GenericSelect } from "./GenericSelect.js";
3
3
  import chatEmbed_default from "./chatEmbed.js";
4
4
  import { useCallback, useEffect, useState } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
6
7
  import { useAtomValue } from "jotai";
7
8
  import { MessageType } from "@envive-ai/react-hooks/application/models";
8
- import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
9
9
  import { userIdAtom } from "@envive-ai/react-hooks/atoms/app";
10
10
  import { ReportSessionRequestReportPriorityEnum, ReportSessionRequestReportTypeEnum } from "@spiffy-ai/commerce-api-client";
11
11
  import classNames from "classnames";
12
12
  import CommerceApiClient from "@envive-ai/react-hooks/application/commerce-api";
13
13
  import { orgShortNameAtom } from "@envive-ai/react-hooks/atoms/envive/enviveConfig";
14
14
  import { StringUtils, validateEmail } from "@envive-ai/react-hooks/application/utils";
15
+ import Logger from "@envive-ai/react-hooks/application/logging";
15
16
 
16
17
  //#region src/debug/reportIssue.tsx
18
+ const logger = new Logger("reportIssue");
17
19
  const messageContent = (m) => {
18
20
  if (m.type === MessageType.Text) return m.metadata.content;
19
21
  if (m.type === MessageType.Product) return `PRODUCT ID: ${m.metadata?.id}`;
@@ -35,7 +37,7 @@ const ReportHeader = ({ onClose }) => {
35
37
  try {
36
38
  await navigator.clipboard.writeText(userId);
37
39
  } catch (err) {
38
- console.error("Failed to copy to clipboard:", err);
40
+ logger.logError("Failed to copy to clipboard", err);
39
41
  }
40
42
  }, [userId]);
41
43
  const headerTitleClassnames = classNames({
@@ -427,11 +429,11 @@ const ReportIssue = () => {
427
429
  turn_info: turnInfo,
428
430
  report_type: reportType
429
431
  };
430
- console.info("Submitting report", request);
432
+ logger.logInfo("Submitting report", request);
431
433
  await CommerceApiClient.reportSession(request);
432
434
  onClose();
433
435
  } catch (error) {
434
- console.error("Error sending report", error);
436
+ logger.logError("Error sending report", error);
435
437
  setErrorMessage("There was an error sending the report. Please try again or contact Envive Support.");
436
438
  } finally {
437
439
  setIsReporting(false);
@@ -22,7 +22,10 @@ function withBaseWidget(Widget, options) {
22
22
  const { getWidgetConfig, isLoading: isWidgetConfigLoading } = (0, __envive_ai_react_hooks_contexts_widgetConfigContext.useWidgetConfig)();
23
23
  const [uiConfig, setUiConfig] = (0, react.useState)(void 0);
24
24
  const { getUiConfig, isLoading: isUiConfigLoading } = (0, __envive_ai_react_hooks_contexts_uiConfigContext.useUiConfig)();
25
- const isLoading = isHardcopyLoading || isPageLoading || isWidgetConfigLoading || isUiConfigLoading;
25
+ const [hardcopySettled, setHardcopySettled] = (0, react.useState)(false);
26
+ const [widgetConfigSettled, setWidgetConfigSettled] = (0, react.useState)(false);
27
+ const [uiConfigSettled, setUiConfigSettled] = (0, react.useState)(false);
28
+ const isLoading = !(hardcopySettled && widgetConfigSettled && uiConfigSettled) && (isHardcopyLoading || isPageLoading || isWidgetConfigLoading || isUiConfigLoading);
26
29
  const { isVisible } = (0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(widgetRef, {
27
30
  widget_config_id: widgetConfigId,
28
31
  widget_type: widgetType,
@@ -42,7 +45,9 @@ function withBaseWidget(Widget, options) {
42
45
  getHardcopy({
43
46
  widgetType,
44
47
  userEvent
45
- }).then(setHardcopyContent).catch(() => {});
48
+ }).then(setHardcopyContent).catch(() => {}).finally(() => {
49
+ setHardcopySettled(true);
50
+ });
46
51
  }, [
47
52
  startLoading,
48
53
  widgetType,
@@ -52,7 +57,9 @@ function withBaseWidget(Widget, options) {
52
57
  ]);
53
58
  (0, react.useEffect)(() => {
54
59
  if (!startLoading) return;
55
- getUiConfig().then(setUiConfig).catch(() => {});
60
+ getUiConfig().then(setUiConfig).catch(() => {}).finally(() => {
61
+ setUiConfigSettled(true);
62
+ });
56
63
  }, [
57
64
  startLoading,
58
65
  getUiConfig,
@@ -64,7 +71,9 @@ function withBaseWidget(Widget, options) {
64
71
  getWidgetConfig({
65
72
  widgetConfigId,
66
73
  widgetType
67
- }).then(setWidgetConfig).catch(() => {});
74
+ }).then(setWidgetConfig).catch(() => {}).finally(() => {
75
+ setWidgetConfigSettled(true);
76
+ });
68
77
  }, [
69
78
  startLoading,
70
79
  widgetConfigId,
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.cjs";
2
- import * as react_jsx_runtime8 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/hocs/withBaseWidget/withBaseWidget.d.ts
5
5
  declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
6
- (props: P): react_jsx_runtime8.JSX.Element;
6
+ (props: P): react_jsx_runtime0.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps, WithBaseWidgetOptions } from "./types.js";
2
- import * as react_jsx_runtime17 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/hocs/withBaseWidget/withBaseWidget.d.ts
5
5
  declare function withBaseWidget<P extends BaseWidgetProps>(Widget: React.ComponentType<P>, options?: WithBaseWidgetOptions): {
6
- (props: P): react_jsx_runtime17.JSX.Element;
6
+ (props: P): react_jsx_runtime13.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  //#endregion
@@ -21,7 +21,10 @@ function withBaseWidget(Widget, options) {
21
21
  const { getWidgetConfig, isLoading: isWidgetConfigLoading } = useWidgetConfig();
22
22
  const [uiConfig, setUiConfig] = useState(void 0);
23
23
  const { getUiConfig, isLoading: isUiConfigLoading } = useUiConfig();
24
- const isLoading = isHardcopyLoading || isPageLoading || isWidgetConfigLoading || isUiConfigLoading;
24
+ const [hardcopySettled, setHardcopySettled] = useState(false);
25
+ const [widgetConfigSettled, setWidgetConfigSettled] = useState(false);
26
+ const [uiConfigSettled, setUiConfigSettled] = useState(false);
27
+ const isLoading = !(hardcopySettled && widgetConfigSettled && uiConfigSettled) && (isHardcopyLoading || isPageLoading || isWidgetConfigLoading || isUiConfigLoading);
25
28
  const { isVisible } = useTrackComponentVisibleEvent(widgetRef, {
26
29
  widget_config_id: widgetConfigId,
27
30
  widget_type: widgetType,
@@ -41,7 +44,9 @@ function withBaseWidget(Widget, options) {
41
44
  getHardcopy({
42
45
  widgetType,
43
46
  userEvent
44
- }).then(setHardcopyContent).catch(() => {});
47
+ }).then(setHardcopyContent).catch(() => {}).finally(() => {
48
+ setHardcopySettled(true);
49
+ });
45
50
  }, [
46
51
  startLoading,
47
52
  widgetType,
@@ -51,7 +56,9 @@ function withBaseWidget(Widget, options) {
51
56
  ]);
52
57
  useEffect(() => {
53
58
  if (!startLoading) return;
54
- getUiConfig().then(setUiConfig).catch(() => {});
59
+ getUiConfig().then(setUiConfig).catch(() => {}).finally(() => {
60
+ setUiConfigSettled(true);
61
+ });
55
62
  }, [
56
63
  startLoading,
57
64
  getUiConfig,
@@ -63,7 +70,9 @@ function withBaseWidget(Widget, options) {
63
70
  getWidgetConfig({
64
71
  widgetConfigId,
65
72
  widgetType
66
- }).then(setWidgetConfig).catch(() => {});
73
+ }).then(setWidgetConfig).catch(() => {}).finally(() => {
74
+ setWidgetConfigSettled(true);
75
+ });
67
76
  }, [
68
77
  startLoading,
69
78
  widgetConfigId,
@@ -5,19 +5,19 @@ const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/Ch
5
5
  let react = require("react");
6
6
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
9
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
8
10
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
11
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
9
12
  let jotai = require("jotai");
10
13
  let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
11
14
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
12
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
13
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
14
- let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
15
- let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
16
- let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
17
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
18
15
  let __envive_ai_react_hooks_atoms_app = require("@envive-ai/react-hooks/atoms/app");
19
16
  let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
17
+ let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
20
18
  let __envive_ai_react_toolkit_v3_ChatPreviewComparison = require("@envive-ai/react-toolkit-v3/ChatPreviewComparison");
19
+ let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
20
+ let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
21
21
 
22
22
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
23
23
  const ChatPreviewComparisonWidgetHandler = (props) => {
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime11 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime16 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.d.ts
5
5
  declare const ChatPreviewComparisonWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime16.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewComparisonWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewComparisonWidgetProps {
12
12
  declare const ChatPreviewComparisonWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewComparisonWidgetProps): react_jsx_runtime11.JSX.Element;
15
+ }: ChatPreviewComparisonWidgetProps): react_jsx_runtime16.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -4,19 +4,19 @@ import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWid
4
4
  import { useCallback, useMemo } from "react";
5
5
  import { EnviveMetricsEventName } from "@envive-ai/react-hooks/contexts/amplitudeContext";
6
6
  import { jsx } from "react/jsx-runtime";
7
+ import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
8
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
7
9
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
10
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
8
11
  import { useAtomValue } from "jotai";
9
12
  import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
10
13
  import { ChatElementDisplayLocationV3, FeatureGates, VariantTypeEnum } from "@envive-ai/react-hooks/application/models";
11
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
12
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
13
- import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
14
- import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
15
- import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
16
- import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
17
14
  import { variantInfoAtom } from "@envive-ai/react-hooks/atoms/app";
18
15
  import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
16
+ import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
19
17
  import { ChatPreviewComparison } from "@envive-ai/react-toolkit-v3/ChatPreviewComparison";
18
+ import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
19
+ import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
20
20
 
21
21
  //#region src/widgets/ChatPreviewComparisonWidget/ChatPreviewComparisonWidget.tsx
22
22
  const ChatPreviewComparisonWidgetHandler = (props) => {
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime6 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime6.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewLoadingWidgetProps {
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
11
11
  }
12
12
  declare const ChatPreviewLoadingWidget: ({
13
13
  widgetConfigId
14
- }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime6.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime13.JSX.Element;
15
15
  //#endregion
16
16
  export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.js";
2
- import * as react_jsx_runtime15 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewLoadingWidget/ChatPreviewLoadingWidget.d.ts
5
5
  declare const ChatPreviewLoadingWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime15.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime14.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewLoadingWidgetProps {
@@ -11,6 +11,6 @@ interface ChatPreviewLoadingWidgetProps {
11
11
  }
12
12
  declare const ChatPreviewLoadingWidget: ({
13
13
  widgetConfigId
14
- }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime15.JSX.Element;
14
+ }: ChatPreviewLoadingWidgetProps) => react_jsx_runtime14.JSX.Element;
15
15
  //#endregion
16
16
  export { ChatPreviewLoadingWidget, ChatPreviewLoadingWidgetProps, ChatPreviewLoadingWidgetWithBaseWidget };
@@ -5,17 +5,17 @@ const require_ChatPreviewLoadingWidget = require('../ChatPreviewLoadingWidget/Ch
5
5
  let react = require("react");
6
6
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
9
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
8
10
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
11
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
9
12
  let jotai = require("jotai");
10
13
  let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
11
14
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
12
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
13
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
15
+ let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
14
16
  let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
15
17
  let __envive_ai_react_toolkit_v3_PromptCarousel = require("@envive-ai/react-toolkit-v3/PromptCarousel");
16
18
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
17
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
18
- let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
19
19
  let __envive_ai_react_toolkit_v3_ChatPreview = require("@envive-ai/react-toolkit-v3/ChatPreview");
20
20
 
21
21
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
@@ -1,9 +1,9 @@
1
1
  import { BaseWidgetProps } from "../../hocs/withBaseWidget/types.cjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime10 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime0.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime10.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
12
12
  declare const ChatPreviewWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewWidgetProps): react_jsx_runtime0.JSX.Element;
15
+ }: ChatPreviewWidgetProps): 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_runtime13 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime11 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.d.ts
5
5
  declare const ChatPreviewWidgetWithBaseWidget: {
6
- (props: BaseWidgetProps): react_jsx_runtime13.JSX.Element;
6
+ (props: BaseWidgetProps): react_jsx_runtime11.JSX.Element;
7
7
  displayName: string;
8
8
  };
9
9
  interface ChatPreviewWidgetProps {
@@ -12,7 +12,7 @@ interface ChatPreviewWidgetProps {
12
12
  declare const ChatPreviewWidget: {
13
13
  ({
14
14
  widgetConfigId
15
- }: ChatPreviewWidgetProps): react_jsx_runtime13.JSX.Element;
15
+ }: ChatPreviewWidgetProps): react_jsx_runtime11.JSX.Element;
16
16
  displayName: string;
17
17
  };
18
18
  //#endregion
@@ -4,17 +4,17 @@ import { ChatPreviewLoadingWidgetWithBaseWidget } from "../ChatPreviewLoadingWid
4
4
  import { useCallback, useMemo } from "react";
5
5
  import { EnviveMetricsEventName, useAmplitude } from "@envive-ai/react-hooks/contexts/amplitudeContext";
6
6
  import { jsx } from "react/jsx-runtime";
7
+ import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
8
+ import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
7
9
  import { WidgetTypeV3 } from "@envive-ai/react-hooks/contexts/typesV3";
10
+ import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
8
11
  import { useAtomValue } from "jotai";
9
12
  import { useFeatureFlagService } from "@envive-ai/react-hooks/contexts/featureFlagServiceContext";
10
13
  import { ChatElementDisplayLocationV3, FeatureGates } from "@envive-ai/react-hooks/application/models";
11
- import { useSalesAgent } from "@envive-ai/react-hooks/contexts/salesAgentContext";
12
- import { useChatToggle } from "@envive-ai/react-hooks/hooks/ChatToggle";
14
+ import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
13
15
  import { WidgetInteractionComponent, WidgetInteractionType } from "@envive-ai/react-hooks/hooks/WidgetInteraction/types";
14
16
  import { usePromptCarouselAnalytics } from "@envive-ai/react-toolkit-v3/PromptCarousel";
15
17
  import { Theme } from "@envive-ai/react-toolkit-v3/Tokens";
16
- import { chatAtom, lastAssistantMessageAtom } from "@envive-ai/react-hooks/atoms/chat";
17
- import { useWidgetInteraction } from "@envive-ai/react-hooks/hooks/WidgetInteraction";
18
18
  import { ChatPreview } from "@envive-ai/react-toolkit-v3/ChatPreview";
19
19
 
20
20
  //#region src/widgets/ChatPreviewWidget/ChatPreviewWidget.tsx
@@ -13,14 +13,12 @@ let react = require("react");
13
13
  let __envive_ai_react_hooks_contexts_amplitudeContext = require("@envive-ai/react-hooks/contexts/amplitudeContext");
14
14
  let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
15
15
  let react_jsx_runtime = require("react/jsx-runtime");
16
+ let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
16
17
  let __envive_ai_react_hooks_contexts_typesV3 = require("@envive-ai/react-hooks/contexts/typesV3");
18
+ let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
17
19
  let __envive_ai_react_hooks_contexts_featureFlagServiceContext = require("@envive-ai/react-hooks/contexts/featureFlagServiceContext");
18
20
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
19
- let __envive_ai_react_hooks_contexts_salesAgentContext = require("@envive-ai/react-hooks/contexts/salesAgentContext");
20
- let __envive_ai_react_hooks_hooks_ChatToggle = require("@envive-ai/react-hooks/hooks/ChatToggle");
21
- let __envive_ai_react_hooks_hooks_WidgetInteraction_types = require("@envive-ai/react-hooks/hooks/WidgetInteraction/types");
22
21
  let __envive_ai_react_toolkit_v3_Tokens = require("@envive-ai/react-toolkit-v3/Tokens");
23
- let __envive_ai_react_hooks_hooks_WidgetInteraction = require("@envive-ai/react-hooks/hooks/WidgetInteraction");
24
22
  let __envive_ai_react_toolkit_v3_FloatingButton = require("@envive-ai/react-toolkit-v3/FloatingButton");
25
23
 
26
24
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.tsx
@@ -47,7 +45,6 @@ const CXButtonProvider = ({ provider, enabled, suppressMerchantButton, onSwitchT
47
45
  const FloatingChatWidgetHandler = (props) => {
48
46
  const { previewButtonOnly, previewChatAlwaysOpen, previewCXButtonsEnabled, previewDisclaimer } = props;
49
47
  const salesAgentData = (0, __envive_ai_react_hooks_contexts_salesAgentContext.useSalesAgent)();
50
- const { trackWidgetInteraction } = (0, __envive_ai_react_hooks_hooks_WidgetInteraction.useWidgetInteraction)();
51
48
  const { userHasInteractedValue } = require_useGetWidgetStatus.default();
52
49
  const { uiConfig, isUiConfigLoading, hardcopyContent } = props;
53
50
  const { customerServiceIntegration, floatingButton, floatingChat } = uiConfig ?? {};
@@ -65,16 +62,6 @@ const FloatingChatWidgetHandler = (props) => {
65
62
  (0, react.useEffect)(() => {
66
63
  if (isOpen) setIsCXOpen(false);
67
64
  }, [isOpen]);
68
- const handleClose = (type) => {
69
- trackWidgetInteraction({
70
- eventName: __envive_ai_react_hooks_contexts_amplitudeContext.EnviveMetricsEventName.WidgetInteraction,
71
- trigger: {
72
- widget: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionComponent.FLOATING_CHAT,
73
- widget_interaction: __envive_ai_react_hooks_hooks_WidgetInteraction_types.WidgetInteractionType.WIDGET_COLLAPSED,
74
- widget_interaction_data: { widget_collapsed: type }
75
- }
76
- });
77
- };
78
65
  const { shouldShowFloatingButton } = require_useFloatingButtonVisibility.useFloatingButtonVisibility({
79
66
  floatingButtonShowConfig: floatingButton?.showOption,
80
67
  isChatOpen: isOpen,
@@ -102,10 +89,7 @@ const FloatingChatWidgetHandler = (props) => {
102
89
  children: ({ isSwitchEnabled, toggle }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [!previewButtonOnly && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FloatingChatOverlay.FloatingChatOverlay, {
103
90
  isOpened: effectiveIsOpen,
104
91
  isResultsModalOpen,
105
- onClose: previewChatAlwaysOpen ? () => {} : () => {
106
- closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY);
107
- handleClose({ collapse_source: "body_click" });
108
- },
92
+ onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_OVERLAY, void 0, "body_click"),
109
93
  previewMode: !!previewChatAlwaysOpen,
110
94
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FloatingChat, {
111
95
  setIsResultsModalOpen,
@@ -118,14 +102,8 @@ const FloatingChatWidgetHandler = (props) => {
118
102
  isFloatingChatOpen: effectiveIsOpen,
119
103
  onToggleCXButton: toggle,
120
104
  debugBar: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_debugBar.DebugBar, {}),
121
- onSwipeClose: previewChatAlwaysOpen ? () => {} : () => {
122
- closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
123
- handleClose({ collapse_source: "swipe" });
124
- },
125
- onClose: previewChatAlwaysOpen ? () => {} : () => {
126
- closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON);
127
- handleClose({ collapse_source: "close_button" });
128
- }
105
+ onSwipeClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON, void 0, "swipe"),
106
+ onClose: previewChatAlwaysOpen ? () => {} : () => closeChat(__envive_ai_react_hooks_application_models.ChatElementDisplayLocationV3.FLOATING_CHAT_CLOSE_BUTTON, void 0, "close_button")
129
107
  }) })
130
108
  }), buttonShouldRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_v3_FloatingButton.FloatingButton, {
131
109
  containerRef: floatingButtonVisibilityRef,
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime14 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime15 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
4
4
  interface FloatingChatWidgetProps {
@@ -13,7 +13,7 @@ declare const FloatingChatWidget: {
13
13
  previewChatAlwaysOpen,
14
14
  previewCXButtonsEnabled,
15
15
  previewDisclaimer
16
- }?: FloatingChatWidgetProps): react_jsx_runtime14.JSX.Element;
16
+ }?: FloatingChatWidgetProps): react_jsx_runtime15.JSX.Element;
17
17
  displayName: string;
18
18
  };
19
19
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime8 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/widgets/FloatingChatWidget/FloatingChatWidget.d.ts
4
4
  interface FloatingChatWidgetProps {
@@ -13,7 +13,7 @@ declare const FloatingChatWidget: {
13
13
  previewChatAlwaysOpen,
14
14
  previewCXButtonsEnabled,
15
15
  previewDisclaimer
16
- }?: FloatingChatWidgetProps): react_jsx_runtime8.JSX.Element;
16
+ }?: FloatingChatWidgetProps): react_jsx_runtime4.JSX.Element;
17
17
  displayName: string;
18
18
  };
19
19
  //#endregion