@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
@@ -1,105 +1,12 @@
1
- import { useEffect, useMemo, useRef } from "react";
1
+ import { useHorizontalScrollAnimation } from "../util/useHorizontalScrollAnimation.js";
2
+ import { useRef } from "react";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useReducedMotionConfig } from "framer-motion";
4
4
  import { SpiffyWidgets } from "@envive-ai/react-hooks/application/models";
5
5
  import { SUGGESTION_BAR_BUTTON_TESTID } from "@envive-ai/react-hooks/config";
6
6
  import { useIsSmallScreen } from "@envive-ai/react-hooks/hooks/IsSmallScreen";
7
7
  import { useTrackComponentVisibleEvent } from "@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent";
8
8
  import { SuggestionButton } from "@envive-ai/react-toolkit/SuggestionButton";
9
9
 
10
- //#region src/util/useReducedMotionWithOverride.ts
11
- const useReducedMotionWithOverride = () => {
12
- const reducedMotionConfig = useReducedMotionConfig();
13
- return useMemo(() => {
14
- if (window?._spiffy?.reducedMotionOverride) return window?._spiffy?.reducedMotionOverride;
15
- return reducedMotionConfig;
16
- }, [reducedMotionConfig]);
17
- };
18
-
19
- //#endregion
20
- //#region src/util/useHorizontalScrollAnimation.ts
21
- function useHorizontalScrollAnimation({ scrollContainerRef, animationSpeed = "standard" }) {
22
- const reducedMotion = useReducedMotionWithOverride();
23
- const resumeTimeoutRef = useRef(null);
24
- const scrollAnimationRef = useRef(null);
25
- const pauseOnHover = true;
26
- let PIXELS_PER_SECOND = 40;
27
- switch (animationSpeed) {
28
- case "standard":
29
- PIXELS_PER_SECOND = 40;
30
- break;
31
- case "slow":
32
- PIXELS_PER_SECOND = 25;
33
- break;
34
- case "none":
35
- PIXELS_PER_SECOND = 0;
36
- break;
37
- default: PIXELS_PER_SECOND = 40;
38
- }
39
- const RESUME_DELAY_MS = 2e3;
40
- const isAnimated = animationSpeed !== "none";
41
- useEffect(() => {
42
- if (!isAnimated || reducedMotion || !scrollContainerRef) return () => {};
43
- const container = scrollContainerRef.current;
44
- if (!container) return () => {};
45
- if (container.scrollWidth <= container.clientWidth) return () => {};
46
- let isPaused = false;
47
- let lastTimestamp = null;
48
- let accumulatedScroll = 0;
49
- const step = (timestamp) => {
50
- if (lastTimestamp === null) lastTimestamp = timestamp;
51
- if (!isPaused) {
52
- const delta = timestamp - lastTimestamp;
53
- lastTimestamp = timestamp;
54
- accumulatedScroll += PIXELS_PER_SECOND * (delta / 1e3);
55
- const pixelsToScroll = Math.floor(accumulatedScroll);
56
- if (pixelsToScroll > 0) {
57
- container.scrollLeft += pixelsToScroll;
58
- accumulatedScroll -= pixelsToScroll;
59
- if (Math.ceil(container.scrollLeft) >= container.scrollWidth - container.clientWidth) {
60
- container.scrollLeft = 0;
61
- accumulatedScroll = 0;
62
- }
63
- }
64
- }
65
- scrollAnimationRef.current = requestAnimationFrame(step);
66
- };
67
- scrollAnimationRef.current = requestAnimationFrame(step);
68
- const pauseAnimation = () => {
69
- isPaused = true;
70
- if (resumeTimeoutRef.current) {
71
- clearTimeout(resumeTimeoutRef.current);
72
- resumeTimeoutRef.current = null;
73
- }
74
- };
75
- const scheduleResumeAnimation = () => {
76
- resumeTimeoutRef.current = setTimeout(() => {
77
- isPaused = false;
78
- lastTimestamp = null;
79
- }, RESUME_DELAY_MS);
80
- };
81
- container.addEventListener("mouseenter", pauseAnimation);
82
- container.addEventListener("mouseleave", scheduleResumeAnimation);
83
- container.addEventListener("touchstart", pauseAnimation);
84
- container.addEventListener("touchend", scheduleResumeAnimation);
85
- return function cleanup() {
86
- if (scrollAnimationRef.current) cancelAnimationFrame(scrollAnimationRef.current);
87
- container.removeEventListener("mouseenter", pauseAnimation);
88
- container.removeEventListener("mouseleave", scheduleResumeAnimation);
89
- container.removeEventListener("touchstart", pauseAnimation);
90
- container.removeEventListener("touchend", scheduleResumeAnimation);
91
- if (resumeTimeoutRef.current) clearTimeout(resumeTimeoutRef.current);
92
- };
93
- }, [
94
- isAnimated,
95
- reducedMotion,
96
- PIXELS_PER_SECOND,
97
- pauseOnHover,
98
- scrollContainerRef
99
- ]);
100
- }
101
-
102
- //#endregion
103
10
  //#region src/SuggestionButtonContainer/SuggestionButtonContainer.tsx
104
11
  function ButtonContainer({ children }) {
105
12
  return /* @__PURE__ */ jsx("div", {
@@ -164,4 +71,4 @@ const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, butt
164
71
  };
165
72
 
166
73
  //#endregion
167
- export { SuggestionButtonContainer as t };
74
+ export { SuggestionButtonContainer };
@@ -1,3 +1,3 @@
1
- const require_SuggestionButtonContainer = require('../SuggestionButtonContainer-Dm38gJiJ.cjs');
1
+ const require_SuggestionButtonContainer = require('./SuggestionButtonContainer.cjs');
2
2
 
3
3
  exports.SuggestionButtonContainer = require_SuggestionButtonContainer.SuggestionButtonContainer;
@@ -0,0 +1,3 @@
1
+ import { SuggestionButtonContainerProps } from "./types.cjs";
2
+ import { SuggestionButtonContainer } from "./SuggestionButtonContainer.cjs";
3
+ export { SuggestionButtonContainer, SuggestionButtonContainerProps };
@@ -0,0 +1,3 @@
1
+ import { SuggestionButtonContainerProps } from "./types.js";
2
+ import { SuggestionButtonContainer } from "./SuggestionButtonContainer.js";
3
+ export { SuggestionButtonContainer, SuggestionButtonContainerProps };
@@ -1,3 +1,3 @@
1
- import { t as SuggestionButtonContainer } from "../SuggestionButtonContainer-s2e9YGW_.js";
1
+ import { SuggestionButtonContainer } from "./SuggestionButtonContainer.js";
2
2
 
3
3
  export { SuggestionButtonContainer };
@@ -1,5 +1,5 @@
1
- import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
2
- import { TestProps } from "@envive-ai/react-hooks/types";
1
+ import { TestProps } from "../hooks/dist/types/test-types.cjs";
2
+ import { SuggestionButtonVariant } from "../hooks/dist/contexts/types.cjs";
3
3
 
4
4
  //#region src/SuggestionButtonContainer/types.d.ts
5
5
  interface SuggestionButtonContainerProps extends TestProps {
@@ -14,7 +14,4 @@ interface SuggestionButtonContainerProps extends TestProps {
14
14
  buttonBorderRadius?: 'sm' | 'md' | 'lg';
15
15
  }
16
16
  //#endregion
17
- //#region src/SuggestionButtonContainer/SuggestionButtonContainer.d.ts
18
- declare const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps>;
19
- //#endregion
20
- export { SuggestionButtonContainer, SuggestionButtonContainerProps };
17
+ export { SuggestionButtonContainerProps };
@@ -1,5 +1,5 @@
1
- import { TestProps } from "@envive-ai/react-hooks/types";
2
- import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
1
+ import { TestProps } from "../packages/hooks/dist/types/test-types.js";
2
+ import { SuggestionButtonVariant } from "../packages/hooks/dist/contexts/types.js";
3
3
 
4
4
  //#region src/SuggestionButtonContainer/types.d.ts
5
5
  interface SuggestionButtonContainerProps extends TestProps {
@@ -14,7 +14,4 @@ interface SuggestionButtonContainerProps extends TestProps {
14
14
  buttonBorderRadius?: 'sm' | 'md' | 'lg';
15
15
  }
16
16
  //#endregion
17
- //#region src/SuggestionButtonContainer/SuggestionButtonContainer.d.ts
18
- declare const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps>;
19
- //#endregion
20
- export { SuggestionButtonContainer, SuggestionButtonContainerProps };
17
+ export { SuggestionButtonContainerProps };
@@ -29,15 +29,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
 
30
30
  //#endregion
31
31
 
32
- Object.defineProperty(exports, '__commonJS', {
33
- enumerable: true,
34
- get: function () {
35
- return __commonJS;
36
- }
37
- });
38
- Object.defineProperty(exports, '__toESM', {
39
- enumerable: true,
40
- get: function () {
41
- return __toESM;
42
- }
43
- });
32
+ exports.__commonJS = __commonJS;
33
+ exports.__toESM = __toESM;
@@ -0,0 +1,52 @@
1
+ //#region ../hooks/dist/contexts/types.d.ts
2
+
3
+ type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
4
+ interface SuggestionButtonConfig {
5
+ variant?: SuggestionButtonVariant;
6
+ hoverVariant?: SuggestionButtonVariant;
7
+ answerVariant?: SuggestionButtonVariant;
8
+ borderRadius?: 'sm' | 'md' | 'lg';
9
+ }
10
+ type SearchZeroStateVariant = 'backgroundTertiary' | 'backgroundDark' | 'backgroundPrimary';
11
+ type SearchZeroStateLayout = 'input' | 'icon';
12
+ type SearchInputVariant = 'standard';
13
+ type SearchIconVariant = 'thin' | 'bold';
14
+ declare enum WidgetType {
15
+ ChatPreview = "ChatPreview",
16
+ SocialProofV2 = "SocialProofV2",
17
+ ChatPreviewV2 = "ChatPreviewV2",
18
+ ChatPreviewIsLoading = "ChatPreviewIsLoading",
19
+ ChatPreviewPostInteraction = "ChatPreviewPostInteraction",
20
+ ChatPreviewProductComparison = "ChatPreviewProductComparison",
21
+ SuggestionBar = "SuggestionBar",
22
+ SuggestionBarV2 = "SuggestionBarV2",
23
+ ImagePromptCard = "ImagePromptCard",
24
+ ImageBanner = "ImageBanner",
25
+ SingleImagePrompt = "SingleImagePrompt",
26
+ SearchPrompt = "SearchPrompt",
27
+ SearchZeroStateEntryPoint = "SearchZeroStateEntryPoint",
28
+ SearchResultsEntryPoint = "SearchResultsEntryPoint",
29
+ SearchOverlayHost = "SearchOverlayHost",
30
+ NoOp = "NoOp",
31
+ }
32
+ interface BaseWidgetConfig<T extends WidgetType> {
33
+ widgetConfigId: string;
34
+ type: T;
35
+ contentId?: string;
36
+ }
37
+ interface SearchEntryPointWidgetConfig extends BaseWidgetConfig<WidgetType.SearchZeroStateEntryPoint> {
38
+ searchZeroStateVariant: SearchZeroStateVariant;
39
+ searchInputVariant: SearchInputVariant;
40
+ searchIconVariant?: SearchIconVariant;
41
+ searchIconSize?: number;
42
+ suggestionButtonConfig: SuggestionButtonConfig;
43
+ layout: SearchZeroStateLayout;
44
+ searchBoxPlaceholder: string;
45
+ animationSpeed?: 'standard' | 'slow' | 'none';
46
+ compactLabel?: string;
47
+ initialSuggestions?: string[];
48
+ usingPortal?: boolean;
49
+ includeSubtitle?: boolean;
50
+ }
51
+ //#endregion
52
+ export { type SearchEntryPointWidgetConfig, SearchInputVariant, type SuggestionButtonVariant };
@@ -0,0 +1,8 @@
1
+ //#region ../hooks/dist/types/test-types.d.ts
2
+ //#region src/types/test-types.d.ts
3
+ interface TestProps {
4
+ dataTestId?: string;
5
+ }
6
+ //#endregion
7
+ //#endregion
8
+ export { TestProps };
@@ -1,17 +1,9 @@
1
- const require_chunk = require('./chunk-DSlc6foC.cjs');
2
- const require_SuggestionButtonContainer = require('./SuggestionButtonContainer-Dm38gJiJ.cjs');
3
- let react = require("react");
4
- let jotai = require("jotai");
5
- let react_jsx_runtime = require("react/jsx-runtime");
6
- let __envive_ai_react_hooks_application_models = require("@envive-ai/react-hooks/application/models");
7
- let node_crypto = require("node:crypto");
8
- let __envive_ai_react_hooks_atoms_chat = require("@envive-ai/react-hooks/atoms/chat");
9
- let __envive_ai_react_hooks_config = require("@envive-ai/react-hooks/config");
10
- let __envive_ai_react_hooks_hooks_IsSmallScreen = require("@envive-ai/react-hooks/hooks/IsSmallScreen");
11
- let __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent = require("@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent");
1
+ "use strict";
2
+
3
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
12
4
 
13
5
  //#region ../../node_modules/react-indiana-drag-scroll/dist/index.js
14
- var require_dist = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modules/react-indiana-drag-scroll/dist/index.js": ((exports) => {
6
+ var require_dist = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/react-indiana-drag-scroll/dist/index.js": ((exports) => {
15
7
  Object.defineProperty(exports, "__esModule", { value: !0 });
16
8
  var e = require("react");
17
9
  function t(e$1) {
@@ -320,127 +312,9 @@ var require_dist = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_module
320
312
  }) });
321
313
 
322
314
  //#endregion
323
- //#region ../../node_modules/uuid/dist-node/stringify.js
324
- const byteToHex = [];
325
- for (let i$1 = 0; i$1 < 256; ++i$1) byteToHex.push((i$1 + 256).toString(16).slice(1));
326
- function unsafeStringify(arr, offset = 0) {
327
- 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();
328
- }
329
-
330
- //#endregion
331
- //#region ../../node_modules/uuid/dist-node/rng.js
332
- const rnds8Pool = new Uint8Array(256);
333
- let poolPtr = rnds8Pool.length;
334
- function rng() {
335
- if (poolPtr > rnds8Pool.length - 16) {
336
- (0, node_crypto.randomFillSync)(rnds8Pool);
337
- poolPtr = 0;
338
- }
339
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
340
- }
341
-
342
- //#endregion
343
- //#region ../../node_modules/uuid/dist-node/native.js
344
- var native_default = { randomUUID: node_crypto.randomUUID };
345
-
346
- //#endregion
347
- //#region ../../node_modules/uuid/dist-node/v4.js
348
- function _v4(options, buf, offset) {
349
- options = options || {};
350
- const rnds = options.random ?? options.rng?.() ?? rng();
351
- if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
352
- rnds[6] = rnds[6] & 15 | 64;
353
- rnds[8] = rnds[8] & 63 | 128;
354
- if (buf) {
355
- offset = offset || 0;
356
- if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
357
- for (let i$1 = 0; i$1 < 16; ++i$1) buf[offset + i$1] = rnds[i$1];
358
- return buf;
359
- }
360
- return unsafeStringify(rnds);
361
- }
362
- function v4(options, buf, offset) {
363
- if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
364
- return _v4(options, buf, offset);
365
- }
366
- var v4_default = v4;
367
-
368
- //#endregion
369
- //#region src/SuggestionBar/types.ts
370
- let SuggestionBarLocationForMetrics = /* @__PURE__ */ function(SuggestionBarLocationForMetrics$1) {
371
- SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_TOP"] = "top";
372
- SuggestionBarLocationForMetrics$1["SUGGESTION_BAR_BOTTOM"] = "bottom";
373
- return SuggestionBarLocationForMetrics$1;
374
- }({});
375
-
376
- //#endregion
377
- //#region src/SuggestionBar/SuggestionBar.tsx
378
- var import_dist = require_dist();
379
- function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, hoverButtonVariation, boldFirstButton = false, twoRowsOnMobile = false, animationSpeed = "none", buttonBorderRadius = "lg", handleReply, dataTestId }) {
380
- const componentVisibleTriggerRef = (0, react.useRef)(null);
381
- const containerRef = (0, react.useRef)(null);
382
- const { ref } = (0, import_dist.useScrollContainer)();
383
- const isSmallScreen = (0, __envive_ai_react_hooks_hooks_IsSmallScreen.useIsSmallScreen)();
384
- const logPerfMetric = (0, jotai.useSetAtom)(__envive_ai_react_hooks_atoms_chat.logPerfMetricAtom);
385
- const isAnimated = animationSpeed !== "none";
386
- (0, __envive_ai_react_hooks_hooks_TrackComponentVisibleEvent.useTrackComponentVisibleEvent)(__envive_ai_react_hooks_application_models.SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, { animated: isAnimated });
387
- const handleClickSuggestion = (0, react.useCallback)((buttonText) => {
388
- handleReply({
389
- id: v4_default(),
390
- role: __envive_ai_react_hooks_application_models.MessageRole.User,
391
- type: __envive_ai_react_hooks_application_models.MessageType.QueryTyped,
392
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
393
- metadata: { content: buttonText }
394
- });
395
- }, [handleReply]);
396
- const setRefs = (0, react.useCallback)((el) => {
397
- if (typeof ref === "function") ref(el);
398
- containerRef.current = el;
399
- }, [ref]);
400
- const handleContainerRef = (0, react.useCallback)((el) => {
401
- if (el) logPerfMetric(locationForMetrics === SuggestionBarLocationForMetrics.SUGGESTION_BAR_TOP ? __envive_ai_react_hooks_atoms_chat.PerfMetricsEvents.TopSuggestionsBarRendered : __envive_ai_react_hooks_atoms_chat.PerfMetricsEvents.BottomSuggestionsBarRendered);
402
- setRefs(el);
403
- }, [
404
- locationForMetrics,
405
- logPerfMetric,
406
- setRefs
407
- ]);
408
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
409
- id,
410
- className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
411
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
412
- 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"} `,
413
- ref: handleContainerRef,
414
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
415
- className: "spiffy-tw-relative spiffy-tw-inline-block spiffy-tw-whitespace-nowrap",
416
- ref: componentVisibleTriggerRef,
417
- "data-testid": dataTestId || __envive_ai_react_hooks_config.SUGGESTION_BAR_TESTID,
418
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SuggestionButtonContainer.SuggestionButtonContainer, {
419
- buttonVariation,
420
- hoverButtonVariation,
421
- buttonTexts,
422
- onButtonClick: handleClickSuggestion,
423
- scrollContainerRef: containerRef,
424
- boldFirstButton,
425
- twoRowsOnMobile,
426
- animationSpeed,
427
- buttonBorderRadius
428
- })
429
- })
430
- })
431
- });
432
- }
433
-
434
- //#endregion
435
- Object.defineProperty(exports, 'SuggestionBar', {
436
- enumerable: true,
437
- get: function () {
438
- return SuggestionBar;
439
- }
440
- });
441
- Object.defineProperty(exports, 'SuggestionBarLocationForMetrics', {
315
+ Object.defineProperty(exports, 'default', {
442
316
  enumerable: true,
443
317
  get: function () {
444
- return SuggestionBarLocationForMetrics;
318
+ return require_dist();
445
319
  }
446
320
  });
@@ -0,0 +1,6 @@
1
+ //#region ../../node_modules/uuid/dist/native.js
2
+ const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
3
+ var native_default = { randomUUID };
4
+
5
+ //#endregion
6
+ export { native_default as default };
@@ -0,0 +1,13 @@
1
+ //#region ../../node_modules/uuid/dist/rng.js
2
+ let getRandomValues;
3
+ const rnds8 = new Uint8Array(16);
4
+ function rng() {
5
+ if (!getRandomValues) {
6
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
7
+ getRandomValues = crypto.getRandomValues.bind(crypto);
8
+ }
9
+ return getRandomValues(rnds8);
10
+ }
11
+
12
+ //#endregion
13
+ export { rng as default };
@@ -0,0 +1,9 @@
1
+ //#region ../../node_modules/uuid/dist/stringify.js
2
+ const byteToHex = [];
3
+ for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
4
+ function unsafeStringify(arr, offset = 0) {
5
+ 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();
6
+ }
7
+
8
+ //#endregion
9
+ export { unsafeStringify };
@@ -0,0 +1,27 @@
1
+ import { unsafeStringify } from "./stringify.js";
2
+ import rng from "./rng.js";
3
+ import native_default from "./native.js";
4
+
5
+ //#region ../../node_modules/uuid/dist/v4.js
6
+ function _v4(options, buf, offset) {
7
+ options = options || {};
8
+ const rnds = options.random ?? options.rng?.() ?? rng();
9
+ if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
10
+ rnds[6] = rnds[6] & 15 | 64;
11
+ rnds[8] = rnds[8] & 63 | 128;
12
+ if (buf) {
13
+ offset = offset || 0;
14
+ if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
15
+ for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
16
+ return buf;
17
+ }
18
+ return unsafeStringify(rnds);
19
+ }
20
+ function v4(options, buf, offset) {
21
+ if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
22
+ return _v4(options, buf, offset);
23
+ }
24
+ var v4_default = v4;
25
+
26
+ //#endregion
27
+ export { v4_default as default };
@@ -0,0 +1,8 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let node_crypto = require("node:crypto");
3
+
4
+ //#region ../../node_modules/uuid/dist-node/native.js
5
+ var native_default = { randomUUID: node_crypto.randomUUID };
6
+
7
+ //#endregion
8
+ exports.default = native_default;
@@ -0,0 +1,16 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let node_crypto = require("node:crypto");
3
+
4
+ //#region ../../node_modules/uuid/dist-node/rng.js
5
+ const rnds8Pool = new Uint8Array(256);
6
+ let poolPtr = rnds8Pool.length;
7
+ function rng() {
8
+ if (poolPtr > rnds8Pool.length - 16) {
9
+ (0, node_crypto.randomFillSync)(rnds8Pool);
10
+ poolPtr = 0;
11
+ }
12
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
13
+ }
14
+
15
+ //#endregion
16
+ exports.default = rng;
@@ -0,0 +1,10 @@
1
+
2
+ //#region ../../node_modules/uuid/dist-node/stringify.js
3
+ const byteToHex = [];
4
+ for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
5
+ function unsafeStringify(arr, offset = 0) {
6
+ 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();
7
+ }
8
+
9
+ //#endregion
10
+ exports.unsafeStringify = unsafeStringify;
@@ -0,0 +1,27 @@
1
+ const require_stringify = require('./stringify.cjs');
2
+ const require_rng = require('./rng.cjs');
3
+ const require_native = require('./native.cjs');
4
+
5
+ //#region ../../node_modules/uuid/dist-node/v4.js
6
+ function _v4(options, buf, offset) {
7
+ options = options || {};
8
+ const rnds = options.random ?? options.rng?.() ?? require_rng.default();
9
+ if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
10
+ rnds[6] = rnds[6] & 15 | 64;
11
+ rnds[8] = rnds[8] & 63 | 128;
12
+ if (buf) {
13
+ offset = offset || 0;
14
+ if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
15
+ for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
16
+ return buf;
17
+ }
18
+ return require_stringify.unsafeStringify(rnds);
19
+ }
20
+ function v4(options, buf, offset) {
21
+ if (require_native.default.randomUUID && !buf && !options) return require_native.default.randomUUID();
22
+ return _v4(options, buf, offset);
23
+ }
24
+ var v4_default = v4;
25
+
26
+ //#endregion
27
+ exports.default = v4_default;
@@ -0,0 +1,52 @@
1
+ //#region ../hooks/dist/contexts/types.d.ts
2
+
3
+ type SuggestionButtonVariant = 'outlined' | 'outlinedLight' | 'primary' | 'secondary' | 'tertiary' | 'dark' | 'darkAccent' | 'darkPrimary' | 'secondaryDark' | 'secondaryAccent' | 'transparent' | 'transparentDark' | 'lightDark';
4
+ interface SuggestionButtonConfig {
5
+ variant?: SuggestionButtonVariant;
6
+ hoverVariant?: SuggestionButtonVariant;
7
+ answerVariant?: SuggestionButtonVariant;
8
+ borderRadius?: 'sm' | 'md' | 'lg';
9
+ }
10
+ type SearchZeroStateVariant = 'backgroundTertiary' | 'backgroundDark' | 'backgroundPrimary';
11
+ type SearchZeroStateLayout = 'input' | 'icon';
12
+ type SearchInputVariant = 'standard';
13
+ type SearchIconVariant = 'thin' | 'bold';
14
+ declare enum WidgetType {
15
+ ChatPreview = "ChatPreview",
16
+ SocialProofV2 = "SocialProofV2",
17
+ ChatPreviewV2 = "ChatPreviewV2",
18
+ ChatPreviewIsLoading = "ChatPreviewIsLoading",
19
+ ChatPreviewPostInteraction = "ChatPreviewPostInteraction",
20
+ ChatPreviewProductComparison = "ChatPreviewProductComparison",
21
+ SuggestionBar = "SuggestionBar",
22
+ SuggestionBarV2 = "SuggestionBarV2",
23
+ ImagePromptCard = "ImagePromptCard",
24
+ ImageBanner = "ImageBanner",
25
+ SingleImagePrompt = "SingleImagePrompt",
26
+ SearchPrompt = "SearchPrompt",
27
+ SearchZeroStateEntryPoint = "SearchZeroStateEntryPoint",
28
+ SearchResultsEntryPoint = "SearchResultsEntryPoint",
29
+ SearchOverlayHost = "SearchOverlayHost",
30
+ NoOp = "NoOp",
31
+ }
32
+ interface BaseWidgetConfig<T extends WidgetType> {
33
+ widgetConfigId: string;
34
+ type: T;
35
+ contentId?: string;
36
+ }
37
+ interface SearchEntryPointWidgetConfig extends BaseWidgetConfig<WidgetType.SearchZeroStateEntryPoint> {
38
+ searchZeroStateVariant: SearchZeroStateVariant;
39
+ searchInputVariant: SearchInputVariant;
40
+ searchIconVariant?: SearchIconVariant;
41
+ searchIconSize?: number;
42
+ suggestionButtonConfig: SuggestionButtonConfig;
43
+ layout: SearchZeroStateLayout;
44
+ searchBoxPlaceholder: string;
45
+ animationSpeed?: 'standard' | 'slow' | 'none';
46
+ compactLabel?: string;
47
+ initialSuggestions?: string[];
48
+ usingPortal?: boolean;
49
+ includeSubtitle?: boolean;
50
+ }
51
+ //#endregion
52
+ export { type SearchEntryPointWidgetConfig, SearchInputVariant, type SuggestionButtonVariant };
@@ -0,0 +1,8 @@
1
+ //#region ../hooks/dist/types/test-types.d.ts
2
+ //#region src/types/test-types.d.ts
3
+ interface TestProps {
4
+ dataTestId?: string;
5
+ }
6
+ //#endregion
7
+ //#endregion
8
+ export { TestProps };
@@ -0,0 +1,38 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_jsx_runtime$1 = require('./node_modules/react/jsx-runtime.cjs');
3
+
4
+ //#region ../icons/dist/AiSearchBold.js
5
+ var import_jsx_runtime = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_jsx_runtime$1.require_jsx_runtime());
6
+ const SvgAiSearchBold = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
7
+ width: 32,
8
+ height: 32,
9
+ viewBox: "0 0 32 32",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ ...props,
13
+ children: [
14
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
15
+ d: "M25.3445 3.27148L26.448 6.14076C26.6275 6.60736 26.7172 6.84066 26.8568 7.0369C26.9804 7.21083 27.1324 7.36279 27.3063 7.48646C27.5026 7.626 27.7359 7.71573 28.2025 7.89519L31.0717 8.99876L28.2025 10.1023C27.7359 10.2818 27.5026 10.3715 27.3063 10.5111C27.1324 10.6347 26.9804 10.7867 26.8568 10.9606C26.7172 11.1569 26.6275 11.3902 26.448 11.8568L25.3445 14.726L24.2409 11.8568C24.0614 11.3902 23.9717 11.1569 23.8322 10.9606C23.7085 10.7867 23.5565 10.6347 23.3826 10.5111C23.1864 10.3715 22.9531 10.2818 22.4865 10.1023L19.6172 8.99876L22.4865 7.89519C22.9531 7.71573 23.1864 7.626 23.3826 7.48646C23.5565 7.36279 23.7085 7.21083 23.8322 7.0369C23.9717 6.84066 24.0614 6.60736 24.2409 6.14076L25.3445 3.27148Z",
16
+ fill: "#AB1212",
17
+ stroke: "#AB1212",
18
+ strokeLinecap: "round",
19
+ strokeLinejoin: "round"
20
+ }),
21
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
22
+ d: "M18.8072 5.46891C17.3865 4.5308 15.6938 3.96698 13.8663 3.92165C8.67511 3.79287 4.3624 7.89679 4.23363 13.088C4.10485 18.2792 8.20877 22.592 13.4 22.7207C17.8631 22.8314 21.6768 19.8136 22.7407 15.6659",
23
+ stroke: "#111111",
24
+ strokeWidth: 2,
25
+ strokeLinecap: "round"
26
+ }),
27
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
28
+ d: "M19.312 21.2498L24.1245 26.4999",
29
+ stroke: "#111111",
30
+ strokeWidth: 2,
31
+ strokeLinecap: "round"
32
+ })
33
+ ]
34
+ });
35
+ var AiSearchBold_default = SvgAiSearchBold;
36
+
37
+ //#endregion
38
+ exports.AiSearchBold_default = AiSearchBold_default;