@envive-ai/react-widgets 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/SearchResults/SearchResults.cjs +82 -0
  2. package/dist/SearchResults/SearchResults.js +80 -0
  3. package/dist/SearchResults/SearchResultsWidget.cjs +34 -0
  4. package/dist/SearchResults/SearchResultsWidget.d.ts +6 -0
  5. package/dist/SearchResults/SearchResultsWidget.js +33 -0
  6. package/dist/SearchResults/index.cjs +2 -122
  7. package/dist/SearchResults/index.d.cts +2 -0
  8. package/dist/SearchResults/index.d.ts +2 -0
  9. package/dist/SearchResults/index.js +1 -119
  10. package/dist/SearchResults/withSearchResults.cjs +18 -0
  11. package/dist/SearchResults/withSearchResults.js +17 -0
  12. package/dist/SearchZeroState/SearchIcon.cjs +47 -0
  13. package/dist/SearchZeroState/SearchIcon.js +44 -0
  14. package/dist/SearchZeroState/SearchOverlay.cjs +42 -0
  15. package/dist/SearchZeroState/SearchOverlay.js +39 -0
  16. package/dist/SearchZeroState/SearchZeroState.cjs +169 -0
  17. package/dist/SearchZeroState/SearchZeroState.d.cts +7 -0
  18. package/dist/SearchZeroState/SearchZeroState.d.ts +7 -0
  19. package/dist/SearchZeroState/SearchZeroState.js +167 -0
  20. package/dist/SearchZeroState/SearchZeroStateWidget.cjs +23 -0
  21. package/dist/SearchZeroState/SearchZeroStateWidget.d.cts +15 -0
  22. package/dist/SearchZeroState/SearchZeroStateWidget.d.ts +15 -0
  23. package/dist/SearchZeroState/SearchZeroStateWidget.js +22 -0
  24. package/dist/SearchZeroState/components/RecommendedProducts.cjs +72 -0
  25. package/dist/SearchZeroState/components/RecommendedProducts.js +70 -0
  26. package/dist/SearchZeroState/index.cjs +4 -3070
  27. package/dist/SearchZeroState/index.d.cts +5 -0
  28. package/dist/SearchZeroState/index.d.ts +5 -0
  29. package/dist/SearchZeroState/index.js +2 -3065
  30. package/dist/SearchZeroState/overlay/overlayHostLocator.cjs +21 -0
  31. package/dist/SearchZeroState/overlay/overlayHostLocator.js +20 -0
  32. package/dist/SearchZeroState/types.d.cts +10 -0
  33. package/dist/SearchZeroState/types.d.ts +10 -0
  34. package/dist/SearchZeroState/zeroStateSearchVariants.cjs +21 -0
  35. package/dist/SearchZeroState/zeroStateSearchVariants.js +20 -0
  36. package/dist/SuggestionBar/SuggestionBar.cjs +74 -0
  37. package/dist/SuggestionBar/{index-DZU9kbWS.d.cts → SuggestionBar.d.cts} +5 -10
  38. package/dist/SuggestionBar/{index-DyXd4-b7.d.ts → SuggestionBar.d.ts} +5 -10
  39. package/dist/{SuggestionBar-BHAXhgcd.js → SuggestionBar/SuggestionBar.js} +6 -58
  40. package/dist/SuggestionBar/index.cjs +3 -3
  41. package/dist/SuggestionBar/index.d.cts +3 -0
  42. package/dist/SuggestionBar/index.d.ts +3 -0
  43. package/dist/SuggestionBar/index.js +2 -2
  44. package/dist/SuggestionBar/types.cjs +10 -0
  45. package/dist/SuggestionBar/types.d.cts +7 -0
  46. package/dist/SuggestionBar/types.d.ts +7 -0
  47. package/dist/SuggestionBar/types.js +9 -0
  48. package/dist/{SuggestionButtonContainer-Dm38gJiJ.cjs → SuggestionButtonContainer/SuggestionButtonContainer.cjs} +4 -102
  49. package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.cts +6 -0
  50. package/dist/SuggestionButtonContainer/SuggestionButtonContainer.d.ts +6 -0
  51. package/dist/{SuggestionButtonContainer-s2e9YGW_.js → SuggestionButtonContainer/SuggestionButtonContainer.js} +3 -96
  52. package/dist/SuggestionButtonContainer/index.cjs +1 -1
  53. package/dist/SuggestionButtonContainer/index.d.cts +3 -0
  54. package/dist/SuggestionButtonContainer/index.d.ts +3 -0
  55. package/dist/SuggestionButtonContainer/index.js +1 -1
  56. package/dist/SuggestionButtonContainer/{index-B_X537jw.d.cts → types.d.cts} +3 -6
  57. package/dist/SuggestionButtonContainer/{index-vwelzDzM.d.ts → types.d.ts} +3 -6
  58. package/dist/{chunk-DSlc6foC.cjs → _virtual/rolldown_runtime.cjs} +2 -12
  59. package/dist/hooks/dist/contexts/types.d.cts +52 -0
  60. package/dist/hooks/dist/types/test-types.d.cts +8 -0
  61. package/dist/{SuggestionBar-CK5aU2bb.cjs → node_modules/react-indiana-drag-scroll/dist/index.cjs} +6 -132
  62. package/dist/node_modules/uuid/dist/native.js +6 -0
  63. package/dist/node_modules/uuid/dist/rng.js +13 -0
  64. package/dist/node_modules/uuid/dist/stringify.js +9 -0
  65. package/dist/node_modules/uuid/dist/v4.js +27 -0
  66. package/dist/node_modules/uuid/dist-node/native.cjs +8 -0
  67. package/dist/node_modules/uuid/dist-node/rng.cjs +16 -0
  68. package/dist/node_modules/uuid/dist-node/stringify.cjs +10 -0
  69. package/dist/node_modules/uuid/dist-node/v4.cjs +27 -0
  70. package/dist/packages/hooks/dist/contexts/types.d.ts +52 -0
  71. package/dist/packages/hooks/dist/types/test-types.d.ts +8 -0
  72. package/dist/packages/icons/dist/AiSearchBold.cjs +38 -0
  73. package/dist/packages/icons/dist/AiSearchBold.js +38 -0
  74. package/dist/packages/icons/dist/AiSearchThin.cjs +35 -0
  75. package/dist/packages/icons/dist/AiSearchThin.js +35 -0
  76. package/dist/packages/icons/dist/IconCloseVariant.cjs +22 -0
  77. package/dist/packages/icons/dist/IconCloseVariant.js +22 -0
  78. package/dist/packages/icons/dist/Sparkles.cjs +43 -0
  79. package/dist/packages/icons/dist/Sparkles.js +43 -0
  80. package/dist/packages/icons/dist/_virtual/rolldown_runtime.cjs +29 -0
  81. package/dist/packages/icons/dist/_virtual/rolldown_runtime.js +27 -0
  82. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +696 -0
  83. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.development.js +696 -0
  84. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs +43 -0
  85. package/dist/packages/icons/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +43 -0
  86. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.cjs +1528 -0
  87. package/dist/packages/icons/dist/node_modules/react/cjs/react.development.js +1528 -0
  88. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.cjs +329 -0
  89. package/dist/packages/icons/dist/node_modules/react/cjs/react.production.min.js +329 -0
  90. package/dist/packages/icons/dist/node_modules/react/index.cjs +13 -0
  91. package/dist/packages/icons/dist/node_modules/react/index.js +13 -0
  92. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.cjs +13 -0
  93. package/dist/packages/icons/dist/node_modules/react/jsx-runtime.js +13 -0
  94. package/dist/util/useHorizontalScrollAnimation.cjs +88 -0
  95. package/dist/util/useHorizontalScrollAnimation.js +87 -0
  96. package/dist/util/useReducedMotionWithOverride.cjs +15 -0
  97. package/dist/util/useReducedMotionWithOverride.js +14 -0
  98. package/package.json +5 -5
  99. package/src/SearchZeroState/SearchZeroState.tsx +1 -1
  100. package/src/SuggestionBar/SuggestionBar.tsx +2 -2
  101. package/dist/SearchResults/index-DCTxvwmv.d.cts +0 -6
  102. package/dist/SearchZeroState/index-DSFtalZR.d.ts +0 -27
  103. package/dist/SearchZeroState/index-bEcxYOSF.d.cts +0 -27
  104. /package/dist/SearchResults/{index-CYPV3XE0.d.ts → SearchResultsWidget.d.cts} +0 -0
@@ -0,0 +1,21 @@
1
+
2
+ //#region src/SearchZeroState/overlay/overlayHostLocator.ts
3
+ const SEARCH_OVERLAY_ENTRYPOINT_ID = "spiffy-ai-search-overlay-entrypoint";
4
+ const SEARCH_OVERLAY_PORTAL_ID = "spiffy-ai-search-overlay-portal";
5
+ /**
6
+ * Find the portal target inside the overlay host's ShadowRoot.
7
+ */
8
+ function getOverlayPortalTarget(hostId = SEARCH_OVERLAY_ENTRYPOINT_ID) {
9
+ const bareMount = document.getElementById(SEARCH_OVERLAY_PORTAL_ID);
10
+ if (bareMount) return bareMount;
11
+ const host = document.getElementById(hostId);
12
+ if (!host) throw new Error(`[Overlay] Host #${hostId} not found`);
13
+ const sr = host.shadowRoot;
14
+ if (!sr) throw new Error("[Overlay] Host has no shadowRoot (was it initialized?)");
15
+ const mount = sr.getElementById(SEARCH_OVERLAY_PORTAL_ID);
16
+ if (!mount) throw new Error("[Overlay] Portal mount missing inside ShadowRoot");
17
+ return mount;
18
+ }
19
+
20
+ //#endregion
21
+ exports.getOverlayPortalTarget = getOverlayPortalTarget;
@@ -0,0 +1,20 @@
1
+ //#region src/SearchZeroState/overlay/overlayHostLocator.ts
2
+ const SEARCH_OVERLAY_ENTRYPOINT_ID = "spiffy-ai-search-overlay-entrypoint";
3
+ const SEARCH_OVERLAY_PORTAL_ID = "spiffy-ai-search-overlay-portal";
4
+ /**
5
+ * Find the portal target inside the overlay host's ShadowRoot.
6
+ */
7
+ function getOverlayPortalTarget(hostId = SEARCH_OVERLAY_ENTRYPOINT_ID) {
8
+ const bareMount = document.getElementById(SEARCH_OVERLAY_PORTAL_ID);
9
+ if (bareMount) return bareMount;
10
+ const host = document.getElementById(hostId);
11
+ if (!host) throw new Error(`[Overlay] Host #${hostId} not found`);
12
+ const sr = host.shadowRoot;
13
+ if (!sr) throw new Error("[Overlay] Host has no shadowRoot (was it initialized?)");
14
+ const mount = sr.getElementById(SEARCH_OVERLAY_PORTAL_ID);
15
+ if (!mount) throw new Error("[Overlay] Portal mount missing inside ShadowRoot");
16
+ return mount;
17
+ }
18
+
19
+ //#endregion
20
+ export { getOverlayPortalTarget };
@@ -0,0 +1,10 @@
1
+ import { SearchEntryPointWidgetConfig, SearchInputVariant } from "../hooks/dist/contexts/types.cjs";
2
+
3
+ //#region src/SearchZeroState/types.d.ts
4
+ interface SearchZeroStateProps {
5
+ widgetConfig: SearchEntryPointWidgetConfig;
6
+ initialIsOpen?: boolean;
7
+ entryPointRef?: React.Ref<HTMLButtonElement>;
8
+ }
9
+ //#endregion
10
+ export { SearchZeroStateProps };
@@ -0,0 +1,10 @@
1
+ import { SearchEntryPointWidgetConfig, SearchInputVariant } from "../packages/hooks/dist/contexts/types.js";
2
+
3
+ //#region src/SearchZeroState/types.d.ts
4
+ interface SearchZeroStateProps {
5
+ widgetConfig: SearchEntryPointWidgetConfig;
6
+ initialIsOpen?: boolean;
7
+ entryPointRef?: React.Ref<HTMLButtonElement>;
8
+ }
9
+ //#endregion
10
+ export { SearchZeroStateProps };
@@ -0,0 +1,21 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __envive_ai_react_hooks_contexts_types = require("@envive-ai/react-hooks/contexts/types");
3
+
4
+ //#region src/SearchZeroState/zeroStateSearchVariants.ts
5
+ const searchZeroStateVariantClasses = {
6
+ backgroundTertiary: {
7
+ overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-tertiary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
8
+ sparklesIconColor: (0, __envive_ai_react_hooks_contexts_types.colorVar)(__envive_ai_react_hooks_contexts_types.ColorNames.AccentPrimary)
9
+ },
10
+ backgroundDark: {
11
+ overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
12
+ sparklesIconColor: (0, __envive_ai_react_hooks_contexts_types.colorVar)(__envive_ai_react_hooks_contexts_types.ColorNames.AccentPrimary)
13
+ },
14
+ backgroundPrimary: {
15
+ overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-primary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
16
+ sparklesIconColor: (0, __envive_ai_react_hooks_contexts_types.colorVar)(__envive_ai_react_hooks_contexts_types.ColorNames.AccentPrimary)
17
+ }
18
+ };
19
+
20
+ //#endregion
21
+ exports.searchZeroStateVariantClasses = searchZeroStateVariantClasses;
@@ -0,0 +1,20 @@
1
+ import { ColorNames, colorVar } from "@envive-ai/react-hooks/contexts/types";
2
+
3
+ //#region src/SearchZeroState/zeroStateSearchVariants.ts
4
+ const searchZeroStateVariantClasses = {
5
+ backgroundTertiary: {
6
+ overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-tertiary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
7
+ sparklesIconColor: colorVar(ColorNames.AccentPrimary)
8
+ },
9
+ backgroundDark: {
10
+ overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
11
+ sparklesIconColor: colorVar(ColorNames.AccentPrimary)
12
+ },
13
+ backgroundPrimary: {
14
+ overlayBackgroundClasses: "spiffy-tw-bg-[--spiffy-colors-background-primary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20",
15
+ sparklesIconColor: colorVar(ColorNames.AccentPrimary)
16
+ }
17
+ };
18
+
19
+ //#endregion
20
+ export { searchZeroStateVariantClasses };
@@ -0,0 +1,74 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_index = require('../node_modules/react-indiana-drag-scroll/dist/index.cjs');
3
+ const require_v4 = require('../node_modules/uuid/dist-node/v4.cjs');
4
+ const require_types = require('./types.cjs');
5
+ const require_SuggestionButtonContainer = require('../SuggestionButtonContainer/SuggestionButtonContainer.cjs');
6
+ require('../SuggestionButtonContainer/index.cjs');
7
+ let react = require("react");
8
+ let jotai = require("jotai");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
11
+ let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
12
+ let __envive_ai_react_hooks_config = require("@envive-ai/react-hooks/config");
13
+ let __envive_ai_react_hooks_hooks_IsSmallScreen = require("@envive-ai/react-hooks/hooks/IsSmallScreen");
14
+ let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
15
+
16
+ //#region src/SuggestionBar/SuggestionBar.tsx
17
+ var import_dist = require_index.default;
18
+ function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, hoverButtonVariation, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", handleReply, dataTestId }) {
19
+ const componentVisibleTriggerRef = (0, react.useRef)(null);
20
+ const containerRef = (0, react.useRef)(null);
21
+ const { ref } = (0, import_dist.useScrollContainer)();
22
+ const isSmallScreen = (0, __envive_ai_react_hooks_hooks_IsSmallScreen.useIsSmallScreen)();
23
+ const logPerfMetric = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat.logPerfMetricAtom);
24
+ const isAnimated = animationSpeed !== "none";
25
+ (0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(__envive_ai_react_hooks_application_models.SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, { animated: isAnimated });
26
+ const handleClickSuggestion = (0, react.useCallback)((buttonText) => {
27
+ handleReply({
28
+ id: require_v4.default(),
29
+ role: __envive_ai_react_hooks_application_models.MessageRole.User,
30
+ type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
31
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
32
+ metadata: { content: buttonText }
33
+ });
34
+ }, [handleReply]);
35
+ const setRefs = (0, react.useCallback)((el) => {
36
+ if (typeof ref === "function") ref(el);
37
+ containerRef.current = el;
38
+ }, [ref]);
39
+ const handleContainerRef = (0, react.useCallback)((el) => {
40
+ if (el) logPerfMetric(locationForMetrics === require_types.SuggestionBarLocationForMetrics.SUGGESTION_BAR_TOP ? __envive_ai_react_hooks_atoms_chat.PerfMetricsEvents.TopSuggestionsBarRendered : __envive_ai_react_hooks_atoms_chat.PerfMetricsEvents.BottomSuggestionsBarRendered);
41
+ setRefs(el);
42
+ }, [
43
+ locationForMetrics,
44
+ logPerfMetric,
45
+ setRefs
46
+ ]);
47
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
48
+ id,
49
+ className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
50
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
51
+ className: `spiffy-tw-no-scrollbar spiffy-tw-relative spiffy-tw-w-full spiffy-tw-overflow-y-hidden spiffy-tw-overflow-x-scroll ${twoRowsOnMobile && isSmallScreen ? "spiffy-tw-h-20" : "spiffy-tw-h-9"} `,
52
+ ref: handleContainerRef,
53
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
54
+ className: "spiffy-tw-relative spiffy-tw-inline-block spiffy-tw-whitespace-nowrap",
55
+ ref: componentVisibleTriggerRef,
56
+ "data-testid": dataTestId || __envive_ai_react_hooks_config.SUGGESTION_BAR_TESTID,
57
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionButtonContainer.SuggestionButtonContainer, {
58
+ buttonVariation,
59
+ hoverButtonVariation,
60
+ buttonTexts,
61
+ onButtonClick: handleClickSuggestion,
62
+ scrollContainerRef: containerRef,
63
+ boldFirstButton,
64
+ twoRowsOnMobile,
65
+ animationSpeed,
66
+ buttonBorderRadius
67
+ })
68
+ })
69
+ })
70
+ });
71
+ }
72
+
73
+ //#endregion
74
+ exports.SuggestionBar = SuggestionBar;
@@ -1,16 +1,10 @@
1
+ import { SuggestionButtonVariant } from "../hooks/dist/contexts/types.cjs";
2
+ import { SuggestionBarLocationForMetrics } from "./types.cjs";
1
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
2
- import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
3
- import { TestProps } from "@envive-ai/react-hooks/types";
4
4
  import { Message } from "postcss";
5
5
 
6
- //#region src/SuggestionBar/types.d.ts
7
- declare enum SuggestionBarLocationForMetrics {
8
- SUGGESTION_BAR_TOP = "top",
9
- SUGGESTION_BAR_BOTTOM = "bottom",
10
- }
11
- //#endregion
12
6
  //#region src/SuggestionBar/SuggestionBar.d.ts
13
- interface SuggestionBarProps extends TestProps {
7
+ interface SuggestionBarProps {
14
8
  id: string;
15
9
  locationForMetrics: SuggestionBarLocationForMetrics;
16
10
  buttonTexts: string[];
@@ -21,6 +15,7 @@ interface SuggestionBarProps extends TestProps {
21
15
  twoRowsOnMobile?: boolean | undefined;
22
16
  animationSpeed?: 'standard' | 'slow' | 'none';
23
17
  buttonBorderRadius?: 'sm' | 'md' | 'lg';
18
+ dataTestId?: string;
24
19
  }
25
20
  declare function SuggestionBar({
26
21
  id,
@@ -36,4 +31,4 @@ declare function SuggestionBar({
36
31
  dataTestId
37
32
  }: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
38
33
  //#endregion
39
- export { SuggestionBar, SuggestionBarLocationForMetrics };
34
+ export { SuggestionBar };
@@ -1,16 +1,10 @@
1
+ import { SuggestionButtonVariant } from "../packages/hooks/dist/contexts/types.js";
2
+ import { SuggestionBarLocationForMetrics } from "./types.js";
1
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
2
- import { TestProps } from "@envive-ai/react-hooks/types";
3
- import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
4
4
  import { Message } from "postcss";
5
5
 
6
- //#region src/SuggestionBar/types.d.ts
7
- declare enum SuggestionBarLocationForMetrics {
8
- SUGGESTION_BAR_TOP = "top",
9
- SUGGESTION_BAR_BOTTOM = "bottom",
10
- }
11
- //#endregion
12
6
  //#region src/SuggestionBar/SuggestionBar.d.ts
13
- interface SuggestionBarProps extends TestProps {
7
+ interface SuggestionBarProps {
14
8
  id: string;
15
9
  locationForMetrics: SuggestionBarLocationForMetrics;
16
10
  buttonTexts: string[];
@@ -21,6 +15,7 @@ interface SuggestionBarProps extends TestProps {
21
15
  twoRowsOnMobile?: boolean | undefined;
22
16
  animationSpeed?: 'standard' | 'slow' | 'none';
23
17
  buttonBorderRadius?: 'sm' | 'md' | 'lg';
18
+ dataTestId?: string;
24
19
  }
25
20
  declare function SuggestionBar({
26
21
  id,
@@ -36,4 +31,4 @@ declare function SuggestionBar({
36
31
  dataTestId
37
32
  }: Readonly<SuggestionBarProps>): react_jsx_runtime0.JSX.Element;
38
33
  //#endregion
39
- export { SuggestionBar, SuggestionBarLocationForMetrics };
34
+ export { SuggestionBar };
@@ -1,69 +1,17 @@
1
- import { t as SuggestionButtonContainer } from "./SuggestionButtonContainer-s2e9YGW_.js";
1
+ import v4_default from "../node_modules/uuid/dist/v4.js";
2
+ import { SuggestionBarLocationForMetrics } from "./types.js";
3
+ import { SuggestionButtonContainer } from "../SuggestionButtonContainer/SuggestionButtonContainer.js";
4
+ import "../SuggestionButtonContainer/index.js";
2
5
  import { useCallback, useRef } from "react";
3
6
  import { useSetAtom } from "jotai";
4
7
  import { jsx } from "react/jsx-runtime";
5
- import { MessageRole, MessageType, SpiffyWidgets } from "@envive-ai/react-hooks/application/models";
6
8
  import { useScrollContainer } from "react-indiana-drag-scroll";
9
+ import { MessageRole, MessageType, SpiffyWidgets } from "@envive-ai/react-hooks/application/models";
7
10
  import { PerfMetricsEvents, logPerfMetricAtom } from "@envive-ai/react-hooks/atoms/chat";
8
11
  import { SUGGESTION_BAR_TESTID } from "@envive-ai/react-hooks/config";
9
12
  import { useIsSmallScreen } from "@envive-ai/react-hooks/hooks/IsSmallScreen";
10
13
  import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
11
14
 
12
- //#region ../../node_modules/uuid/dist/stringify.js
13
- const byteToHex = [];
14
- for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
15
- function unsafeStringify(arr, offset = 0) {
16
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
17
- }
18
-
19
- //#endregion
20
- //#region ../../node_modules/uuid/dist/rng.js
21
- let getRandomValues;
22
- const rnds8 = new Uint8Array(16);
23
- function rng() {
24
- if (!getRandomValues) {
25
- if (typeof crypto === "undefined" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
26
- getRandomValues = crypto.getRandomValues.bind(crypto);
27
- }
28
- return getRandomValues(rnds8);
29
- }
30
-
31
- //#endregion
32
- //#region ../../node_modules/uuid/dist/native.js
33
- const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
34
- var native_default = { randomUUID };
35
-
36
- //#endregion
37
- //#region ../../node_modules/uuid/dist/v4.js
38
- function _v4(options, buf, offset) {
39
- options = options || {};
40
- const rnds = options.random ?? options.rng?.() ?? rng();
41
- if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
42
- rnds[6] = rnds[6] & 15 | 64;
43
- rnds[8] = rnds[8] & 63 | 128;
44
- if (buf) {
45
- offset = offset || 0;
46
- if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
47
- for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
48
- return buf;
49
- }
50
- return unsafeStringify(rnds);
51
- }
52
- function v4(options, buf, offset) {
53
- if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
54
- return _v4(options, buf, offset);
55
- }
56
- var v4_default = v4;
57
-
58
- //#endregion
59
- //#region src/SuggestionBar/types.ts
60
- let SuggestionBarLocationForMetrics = /* @__PURE__ */ function(SuggestionBarLocationForMetrics$1) {
61
- SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_TOP"] = "top";
62
- SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_BOTTOM"] = "bottom";
63
- return SuggestionBarLocationForMetrics$1;
64
- }({});
65
-
66
- //#endregion
67
15
  //#region src/SuggestionBar/SuggestionBar.tsx
68
16
  function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, hoverButtonVariation, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", handleReply, dataTestId }) {
69
17
  const componentVisibleTriggerRef = useRef(null);
@@ -121,4 +69,4 @@ function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, h
121
69
  }
122
70
 
123
71
  //#endregion
124
- export { SuggestionBarLocationForMetrics as n, SuggestionBar as t };
72
+ export { SuggestionBar };
@@ -1,5 +1,5 @@
1
- const require_SuggestionBar = require('../SuggestionBar-CK5aU2bb.cjs');
2
- require('../SuggestionButtonContainer-Dm38gJiJ.cjs');
1
+ const require_types = require('./types.cjs');
2
+ const require_SuggestionBar = require('./SuggestionBar.cjs');
3
3
 
4
4
  exports.SuggestionBar = require_SuggestionBar.SuggestionBar;
5
- exports.SuggestionBarLocationForMetrics = require_SuggestionBar.SuggestionBarLocationForMetrics;
5
+ exports.SuggestionBarLocationForMetrics = require_types.SuggestionBarLocationForMetrics;
@@ -0,0 +1,3 @@
1
+ import { SuggestionBarLocationForMetrics } from "./types.cjs";
2
+ import { SuggestionBar } from "./SuggestionBar.cjs";
3
+ export { SuggestionBar, SuggestionBarLocationForMetrics };
@@ -0,0 +1,3 @@
1
+ import { SuggestionBarLocationForMetrics } from "./types.js";
2
+ import { SuggestionBar } from "./SuggestionBar.js";
3
+ export { SuggestionBar, SuggestionBarLocationForMetrics };
@@ -1,4 +1,4 @@
1
- import { n as SuggestionBarLocationForMetrics, t as SuggestionBar } from "../SuggestionBar-BHAXhgcd.js";
2
- import "../SuggestionButtonContainer-s2e9YGW_.js";
1
+ import { SuggestionBarLocationForMetrics } from "./types.js";
2
+ import { SuggestionBar } from "./SuggestionBar.js";
3
3
 
4
4
  export { SuggestionBar, SuggestionBarLocationForMetrics };
@@ -0,0 +1,10 @@
1
+
2
+ //#region src/SuggestionBar/types.ts
3
+ let SuggestionBarLocationForMetrics = /* @__PURE__ */ function(SuggestionBarLocationForMetrics$1) {
4
+ SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_TOP"] = "top";
5
+ SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_BOTTOM"] = "bottom";
6
+ return SuggestionBarLocationForMetrics$1;
7
+ }({});
8
+
9
+ //#endregion
10
+ exports.SuggestionBarLocationForMetrics = SuggestionBarLocationForMetrics;
@@ -0,0 +1,7 @@
1
+ //#region src/SuggestionBar/types.d.ts
2
+ declare enum SuggestionBarLocationForMetrics {
3
+ SUGGESTION_BAR_TOP = "top",
4
+ SUGGESTION_BAR_BOTTOM = "bottom",
5
+ }
6
+ //#endregion
7
+ export { SuggestionBarLocationForMetrics };
@@ -0,0 +1,7 @@
1
+ //#region src/SuggestionBar/types.d.ts
2
+ declare enum SuggestionBarLocationForMetrics {
3
+ SUGGESTION_BAR_TOP = "top",
4
+ SUGGESTION_BAR_BOTTOM = "bottom",
5
+ }
6
+ //#endregion
7
+ export { SuggestionBarLocationForMetrics };
@@ -0,0 +1,9 @@
1
+ //#region src/SuggestionBar/types.ts
2
+ let SuggestionBarLocationForMetrics = /* @__PURE__ */ function(SuggestionBarLocationForMetrics$1) {
3
+ SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_TOP"] = "top";
4
+ SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_BOTTOM"] = "bottom";
5
+ return SuggestionBarLocationForMetrics$1;
6
+ }({});
7
+
8
+ //#endregion
9
+ export { SuggestionBarLocationForMetrics };
@@ -1,106 +1,13 @@
1
- const require_chunk = require('./chunk-DSlc6foC.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_useHorizontalScrollAnimation = require('../util/useHorizontalScrollAnimation.cjs');
2
3
  let react = require("react");
3
4
  let react_jsx_runtime = require("react/jsx-runtime");
4
- let framer_motion = require("framer-motion");
5
5
  let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
6
6
  let __envive_ai_react_hooks_config = require("@envive-ai/react-hooks/config");
7
7
  let __envive_ai_react_hooks_hooks_IsSmallScreen = require("@envive-ai/react-hooks/hooks/IsSmallScreen");
8
8
  let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
9
9
  let __envive_ai_react_toolkit_SuggestionButton = require("@envive-ai/react-toolkit/SuggestionButton");
10
10
 
11
- //#region src/util/useReducedMotionWithOverride.ts
12
- const useReducedMotionWithOverride = () => {
13
- const reducedMotionConfig = (0, framer_motion.useReducedMotionConfig)();
14
- return (0, react.useMemo)(() => {
15
- if (window?._spiffy?.reducedMotionOverride) return window?._spiffy?.reducedMotionOverride;
16
- return reducedMotionConfig;
17
- }, [reducedMotionConfig]);
18
- };
19
-
20
- //#endregion
21
- //#region src/util/useHorizontalScrollAnimation.ts
22
- function useHorizontalScrollAnimation({ scrollContainerRef, animationSpeed = "standard" }) {
23
- const reducedMotion = useReducedMotionWithOverride();
24
- const resumeTimeoutRef = (0, react.useRef)(null);
25
- const scrollAnimationRef = (0, react.useRef)(null);
26
- const pauseOnHover = true;
27
- let PIXELS_PER_SECOND = 40;
28
- switch (animationSpeed) {
29
- case "standard":
30
- PIXELS_PER_SECOND = 40;
31
- break;
32
- case "slow":
33
- PIXELS_PER_SECOND = 25;
34
- break;
35
- case "none":
36
- PIXELS_PER_SECOND = 0;
37
- break;
38
- default: PIXELS_PER_SECOND = 40;
39
- }
40
- const RESUME_DELAY_MS = 2e3;
41
- const isAnimated = animationSpeed !== "none";
42
- (0, react.useEffect)(() => {
43
- if (!isAnimated || reducedMotion || !scrollContainerRef) return () => {};
44
- const container = scrollContainerRef.current;
45
- if (!container) return () => {};
46
- if (container.scrollWidth <= container.clientWidth) return () => {};
47
- let isPaused = false;
48
- let lastTimestamp = null;
49
- let accumulatedScroll = 0;
50
- const step = (timestamp) => {
51
- if (lastTimestamp === null) lastTimestamp = timestamp;
52
- if (!isPaused) {
53
- const delta = timestamp - lastTimestamp;
54
- lastTimestamp = timestamp;
55
- accumulatedScroll += PIXELS_PER_SECOND * (delta / 1e3);
56
- const pixelsToScroll = Math.floor(accumulatedScroll);
57
- if (pixelsToScroll > 0) {
58
- container.scrollLeft += pixelsToScroll;
59
- accumulatedScroll -= pixelsToScroll;
60
- if (Math.ceil(container.scrollLeft) >= container.scrollWidth - container.clientWidth) {
61
- container.scrollLeft = 0;
62
- accumulatedScroll = 0;
63
- }
64
- }
65
- }
66
- scrollAnimationRef.current = requestAnimationFrame(step);
67
- };
68
- scrollAnimationRef.current = requestAnimationFrame(step);
69
- const pauseAnimation = () => {
70
- isPaused = true;
71
- if (resumeTimeoutRef.current) {
72
- clearTimeout(resumeTimeoutRef.current);
73
- resumeTimeoutRef.current = null;
74
- }
75
- };
76
- const scheduleResumeAnimation = () => {
77
- resumeTimeoutRef.current = setTimeout(() => {
78
- isPaused = false;
79
- lastTimestamp = null;
80
- }, RESUME_DELAY_MS);
81
- };
82
- container.addEventListener("mouseenter", pauseAnimation);
83
- container.addEventListener("mouseleave", scheduleResumeAnimation);
84
- container.addEventListener("touchstart", pauseAnimation);
85
- container.addEventListener("touchend", scheduleResumeAnimation);
86
- return function cleanup() {
87
- if (scrollAnimationRef.current) cancelAnimationFrame(scrollAnimationRef.current);
88
- container.removeEventListener("mouseenter", pauseAnimation);
89
- container.removeEventListener("mouseleave", scheduleResumeAnimation);
90
- container.removeEventListener("touchstart", pauseAnimation);
91
- container.removeEventListener("touchend", scheduleResumeAnimation);
92
- if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
93
- };
94
- }, [
95
- isAnimated,
96
- reducedMotion,
97
- PIXELS_PER_SECOND,
98
- pauseOnHover,
99
- scrollContainerRef
100
- ]);
101
- }
102
-
103
- //#endregion
104
11
  //#region src/SuggestionButtonContainer/SuggestionButtonContainer.tsx
105
12
  function ButtonContainer({ children }) {
106
13
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -110,7 +17,7 @@ function ButtonContainer({ children }) {
110
17
  }
111
18
  const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, buttonTexts, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", scrollContainerRef, onButtonClick }) => {
112
19
  const componentVisibleTriggerRef = (0, react.useRef)(null);
113
- useHorizontalScrollAnimation({
20
+ require_useHorizontalScrollAnimation.useHorizontalScrollAnimation({
114
21
  scrollContainerRef,
115
22
  animationSpeed
116
23
  });
@@ -165,9 +72,4 @@ const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, butt
165
72
  };
166
73
 
167
74
  //#endregion
168
- Object.defineProperty(exports, 'SuggestionButtonContainer', {
169
- enumerable: true,
170
- get: function () {
171
- return SuggestionButtonContainer;
172
- }
173
- });
75
+ exports.SuggestionButtonContainer = SuggestionButtonContainer;
@@ -0,0 +1,6 @@
1
+ import { SuggestionButtonContainerProps } from "./types.cjs";
2
+
3
+ //#region src/SuggestionButtonContainer/SuggestionButtonContainer.d.ts
4
+ declare const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps>;
5
+ //#endregion
6
+ export { SuggestionButtonContainer };
@@ -0,0 +1,6 @@
1
+ import { SuggestionButtonContainerProps } from "./types.js";
2
+
3
+ //#region src/SuggestionButtonContainer/SuggestionButtonContainer.d.ts
4
+ declare const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps>;
5
+ //#endregion
6
+ export { SuggestionButtonContainer };