@envive-ai/react-widgets 0.1.2-arthur-2 → 0.1.2

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 (32) hide show
  1. package/dist/SearchResults/index.cjs +1 -1
  2. package/dist/SearchZeroState/index.cjs +35 -13
  3. package/dist/SearchZeroState/index.js +34 -12
  4. package/dist/SuggestionBar/index.cjs +2 -2
  5. package/dist/SuggestionBar/index.js +2 -2
  6. package/dist/{SuggestionBar-DeMmAK4M.js → SuggestionBar-BHAXhgcd.js} +3 -10
  7. package/dist/{SuggestionBar-BOThXJvJ.cjs → SuggestionBar-CK5aU2bb.cjs} +4 -11
  8. package/dist/SuggestionButtonContainer/index.cjs +1 -1
  9. package/dist/SuggestionButtonContainer/index.js +1 -1
  10. package/dist/{SuggestionButtonContainer-BeWPpeQk.cjs → SuggestionButtonContainer-Dm38gJiJ.cjs} +3 -3
  11. package/dist/{SuggestionButtonContainer-CZhOkZaJ.js → SuggestionButtonContainer-s2e9YGW_.js} +2 -2
  12. package/dist/{chunk-DWy1uDak.cjs → chunk-DSlc6foC.cjs} +10 -6
  13. package/package.json +16 -8
  14. package/src/SearchResults/SearchResults.tsx +2 -4
  15. package/src/SearchResults/SearchResultsWidget.tsx +1 -1
  16. package/src/SearchResults/types.ts +0 -3
  17. package/src/SearchZeroState/SearchIcon.tsx +16 -9
  18. package/src/SearchZeroState/SearchOverlay.tsx +3 -2
  19. package/src/SearchZeroState/SearchZeroState.tsx +15 -18
  20. package/src/SearchZeroState/SearchZeroStateWidget.tsx +17 -8
  21. package/src/SearchZeroState/components/RecommendedProducts.tsx +8 -3
  22. package/src/SearchZeroState/overlay/overlayHostLocator.ts +2 -4
  23. package/src/SearchZeroState/types.ts +4 -1
  24. package/src/SearchZeroState/zeroStateSearchVariants.ts +14 -5
  25. package/src/SuggestionBar/SuggestionBar.tsx +10 -18
  26. package/src/SuggestionBar/types.ts +3 -3
  27. package/src/SuggestionButtonContainer/SuggestionButtonContainer.tsx +8 -17
  28. package/src/SuggestionButtonContainer/types.ts +3 -4
  29. package/src/stories/SearchResults.stories.tsx +1 -1
  30. package/src/stories/SearchZeroState.stories.tsx +10 -2
  31. package/src/stories/SuggestionBar.stories.tsx +1 -2
  32. package/src/util/useHorizontalScrollAnimation.ts +1 -1
@@ -1,4 +1,4 @@
1
- const require_chunk = require('../chunk-DWy1uDak.cjs');
1
+ const require_chunk = require('../chunk-DSlc6foC.cjs');
2
2
  let react = require("react");
3
3
  let jotai = require("jotai");
4
4
  let __envive_ai_react_hooks_atoms_globalSearch = require("@envive-ai/react-hooks/atoms/globalSearch");
@@ -1,6 +1,6 @@
1
- const require_chunk = require('../chunk-DWy1uDak.cjs');
2
- const require_SuggestionBar = require('../SuggestionBar-BOThXJvJ.cjs');
3
- require('../SuggestionButtonContainer-BeWPpeQk.cjs');
1
+ const require_chunk = require('../chunk-DSlc6foC.cjs');
2
+ const require_SuggestionBar = require('../SuggestionBar-CK5aU2bb.cjs');
3
+ require('../SuggestionButtonContainer-Dm38gJiJ.cjs');
4
4
  let react = require("react");
5
5
  react = require_chunk.__toESM(react);
6
6
  let __envive_ai_react_hooks_hooks_NewOrgConfig = require("@envive-ai/react-hooks/hooks/NewOrgConfig");
@@ -20,11 +20,30 @@ let react_dom = require("react-dom");
20
20
  let __envive_ai_react_hooks_contexts_types = require("@envive-ai/react-hooks/contexts/types");
21
21
  let __envive_ai_react_toolkit_ProductGrid = require("@envive-ai/react-toolkit/ProductGrid");
22
22
 
23
- //#region ../icons/dist/jsx-runtime-Dg2m6dxZ.js
23
+ //#region ../icons/dist/jsx-runtime-X3VJvQR_.js
24
+ var __create = Object.create;
25
+ var __defProp = Object.defineProperty;
26
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
24
27
  var __getOwnPropNames = Object.getOwnPropertyNames;
28
+ var __getProtoOf = Object.getPrototypeOf;
29
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
25
30
  var __commonJS = (cb, mod) => function() {
26
31
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27
32
  };
33
+ var __copyProps = (to, from, except, desc) => {
34
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n$2 = keys.length, key; i < n$2; i++) {
35
+ key = keys[i];
36
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
37
+ get: ((k$1) => from[k$1]).bind(null, key),
38
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
39
+ });
40
+ }
41
+ return to;
42
+ };
43
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
44
+ value: mod,
45
+ enumerable: true
46
+ }) : target, mod));
28
47
  /**
29
48
  * @license React
30
49
  * react.production.min.js
@@ -358,6 +377,7 @@ var require_react_production_min = /* @__PURE__ */ __commonJS({ "../../node_modu
358
377
  */
359
378
  var require_react_development = /* @__PURE__ */ __commonJS({ "../../node_modules/react/cjs/react.development.js": ((exports$1, module$1) => {
360
379
  if (process.env.NODE_ENV !== "production") (function() {
380
+ "use strict";
361
381
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(/* @__PURE__ */ new Error());
362
382
  var ReactVersion = "18.3.1";
363
383
  var REACT_ELEMENT_TYPE = Symbol.for("react.element");
@@ -1917,6 +1937,7 @@ var require_react_jsx_runtime_production_min = /* @__PURE__ */ __commonJS({ "../
1917
1937
  */
1918
1938
  var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJS({ "../../node_modules/react/cjs/react-jsx-runtime.development.js": ((exports$1) => {
1919
1939
  if (process.env.NODE_ENV !== "production") (function() {
1940
+ "use strict";
1920
1941
  var React$3 = require_react();
1921
1942
  var REACT_ELEMENT_TYPE = Symbol.for("react.element");
1922
1943
  var REACT_PORTAL_TYPE = Symbol.for("react.portal");
@@ -2600,7 +2621,7 @@ var require_jsx_runtime = /* @__PURE__ */ __commonJS({ "../../node_modules/react
2600
2621
 
2601
2622
  //#endregion
2602
2623
  //#region ../icons/dist/Sparkles.js
2603
- var import_jsx_runtime$3 = require_jsx_runtime();
2624
+ var import_jsx_runtime$3 = /* @__PURE__ */ __toESM(require_jsx_runtime());
2604
2625
  const SvgSparkles = (props) => /* @__PURE__ */ (0, import_jsx_runtime$3.jsxs)("svg", {
2605
2626
  width: 24,
2606
2627
  height: 24,
@@ -2639,7 +2660,7 @@ var Sparkles_default = SvgSparkles;
2639
2660
 
2640
2661
  //#endregion
2641
2662
  //#region ../icons/dist/IconCloseVariant.js
2642
- var import_jsx_runtime$2 = require_jsx_runtime();
2663
+ var import_jsx_runtime$2 = /* @__PURE__ */ __toESM(require_jsx_runtime());
2643
2664
  const SvgIconCloseVariant = (props) => /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("svg", {
2644
2665
  viewBox: "0 0 24 24",
2645
2666
  xmlns: "http://www.w3.org/2000/svg",
@@ -2703,6 +2724,7 @@ const SearchOverlay = react.default.forwardRef(({ children, className, dataTestI
2703
2724
  return node;
2704
2725
  }
2705
2726
  });
2727
+ SearchOverlay.displayName = "SearchOverlay";
2706
2728
 
2707
2729
  //#endregion
2708
2730
  //#region src/SearchZeroState/zeroStateSearchVariants.ts
@@ -2723,7 +2745,7 @@ const searchZeroStateVariantClasses = {
2723
2745
 
2724
2746
  //#endregion
2725
2747
  //#region ../icons/dist/AiSearchBold.js
2726
- var import_jsx_runtime$1 = require_jsx_runtime();
2748
+ var import_jsx_runtime$1 = /* @__PURE__ */ __toESM(require_jsx_runtime());
2727
2749
  const SvgAiSearchBold = (props) => /* @__PURE__ */ (0, import_jsx_runtime$1.jsxs)("svg", {
2728
2750
  width: 32,
2729
2751
  height: 32,
@@ -2757,7 +2779,7 @@ var AiSearchBold_default = SvgAiSearchBold;
2757
2779
 
2758
2780
  //#endregion
2759
2781
  //#region ../icons/dist/AiSearchThin.js
2760
- var import_jsx_runtime = require_jsx_runtime();
2782
+ var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
2761
2783
  const SvgAiSearchThin = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
2762
2784
  width: 26,
2763
2785
  height: 23,
@@ -2891,7 +2913,7 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2891
2913
  const { variant: suggestionButtonVariant, hoverVariant: suggestionButtonHoverVariant, borderRadius: suggestionButtonBorderRadius } = suggestionButtonConfig;
2892
2914
  const [isOpen, setIsOpen] = (0, react.useState)(!!initialIsOpen);
2893
2915
  const searchInputRef = (0, react.useRef)(null);
2894
- const searchInput = (0, __envive_ai_react_hooks_hooks_Search.useSearch)();
2916
+ const searchInput = (0, __envive_ai_react_hooks_hooks_Search.useSearch)({ allowRedirect: true });
2895
2917
  const { track } = (0, __envive_ai_react_hooks_hooks_AmplitudeOperations.useAmplitudeTracking)();
2896
2918
  const { recommendedProductsHeading, searchOverlayHeading, productCardConfig, merchantShortName, recommendedProducts, searchText, autocompleteResults, focusedIndex, focusedOptionId, shouldShowAutocomplete, onSearchInputChange, onSearchInputFocus, onSearchInputBlur, onKeyDown, onAutocompleteSelect, onSubmitSearch, resetSearch } = searchInput;
2897
2919
  const { overlayBackgroundClasses, sparklesIconColor } = searchZeroStateVariantClasses[searchZeroStateVariant && searchZeroStateVariantClasses[searchZeroStateVariant] ? searchZeroStateVariant : "backgroundTertiary"];
@@ -2952,7 +2974,7 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2952
2974
  variant: "t3",
2953
2975
  children: searchOverlayHeading
2954
2976
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sparkles_default, {
2955
- className: "sm:spiffy-tw-w-[36px] sm:spiffy-tw-h-[45px] spiffy-tw-w-[24px] spiffy-tw-h-[36px] spiffy-tw-ml-2",
2977
+ className: "spiffy-tw-ml-2 spiffy-tw-h-[36px] spiffy-tw-w-[24px] sm:spiffy-tw-h-[45px] sm:spiffy-tw-w-[36px]",
2956
2978
  color: sparklesIconColor,
2957
2979
  stroke: "2px"
2958
2980
  })]
@@ -2962,11 +2984,11 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2962
2984
  })]
2963
2985
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2964
2986
  onClick: handleClose,
2965
- className: "spiffy-tw-absolute spiffy-tw-top-4 spiffy-tw-right-4 sm:spiffy-tw-top-8 sm:spiffy-tw-right-8 ",
2987
+ className: "spiffy-tw-absolute spiffy-tw-right-4 spiffy-tw-top-4 sm:spiffy-tw-right-8 sm:spiffy-tw-top-8",
2966
2988
  "aria-label": "Close search",
2967
2989
  type: "button",
2968
2990
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCloseVariant_default, {
2969
- className: "spiffy-tw-w-[20px] spiffy-tw-h-[20px] sm:spiffy-tw-w-[28px] sm:spiffy-tw-h-[28px]",
2991
+ className: "spiffy-tw-h-[20px] spiffy-tw-w-[20px] sm:spiffy-tw-h-[28px] sm:spiffy-tw-w-[28px]",
2970
2992
  strokeWidth: "2px"
2971
2993
  })
2972
2994
  })] }),
@@ -2987,7 +3009,7 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2987
3009
  onSearchInputBlur
2988
3010
  }),
2989
3011
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.AnimatePresence, { children: [initialSuggestions && initialSuggestions.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
2990
- className: "spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden",
3012
+ className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
2991
3013
  initial: { opacity: 0 },
2992
3014
  animate: { opacity: 1 },
2993
3015
  exit: { opacity: 0 },
@@ -1,5 +1,5 @@
1
- import { t as SuggestionBar } from "../SuggestionBar-DeMmAK4M.js";
2
- import "../SuggestionButtonContainer-CZhOkZaJ.js";
1
+ import { t as SuggestionBar } from "../SuggestionBar-BHAXhgcd.js";
2
+ import "../SuggestionButtonContainer-s2e9YGW_.js";
3
3
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { useNewOrgConfig } from "@envive-ai/react-hooks/hooks/NewOrgConfig";
5
5
  import classNames from "classnames";
@@ -17,11 +17,30 @@ import { createPortal } from "react-dom";
17
17
  import { ColorNames, colorVar } from "@envive-ai/react-hooks/contexts/types";
18
18
  import { ProductGrid } from "@envive-ai/react-toolkit/ProductGrid";
19
19
 
20
- //#region ../icons/dist/jsx-runtime-Dg2m6dxZ.js
20
+ //#region ../icons/dist/jsx-runtime-X3VJvQR_.js
21
+ var __create = Object.create;
22
+ var __defProp = Object.defineProperty;
23
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
21
24
  var __getOwnPropNames = Object.getOwnPropertyNames;
25
+ var __getProtoOf = Object.getPrototypeOf;
26
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
22
27
  var __commonJS = (cb, mod) => function() {
23
28
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
29
  };
30
+ var __copyProps = (to, from, except, desc) => {
31
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n$2 = keys.length, key; i < n$2; i++) {
32
+ key = keys[i];
33
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
34
+ get: ((k$1) => from[k$1]).bind(null, key),
35
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
36
+ });
37
+ }
38
+ return to;
39
+ };
40
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
41
+ value: mod,
42
+ enumerable: true
43
+ }) : target, mod));
25
44
  /**
26
45
  * @license React
27
46
  * react.production.min.js
@@ -355,6 +374,7 @@ var require_react_production_min = /* @__PURE__ */ __commonJS({ "../../node_modu
355
374
  */
356
375
  var require_react_development = /* @__PURE__ */ __commonJS({ "../../node_modules/react/cjs/react.development.js": ((exports, module) => {
357
376
  if (process.env.NODE_ENV !== "production") (function() {
377
+ "use strict";
358
378
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(/* @__PURE__ */ new Error());
359
379
  var ReactVersion = "18.3.1";
360
380
  var REACT_ELEMENT_TYPE = Symbol.for("react.element");
@@ -1914,6 +1934,7 @@ var require_react_jsx_runtime_production_min = /* @__PURE__ */ __commonJS({ "../
1914
1934
  */
1915
1935
  var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJS({ "../../node_modules/react/cjs/react-jsx-runtime.development.js": ((exports) => {
1916
1936
  if (process.env.NODE_ENV !== "production") (function() {
1937
+ "use strict";
1917
1938
  var React$1 = require_react();
1918
1939
  var REACT_ELEMENT_TYPE = Symbol.for("react.element");
1919
1940
  var REACT_PORTAL_TYPE = Symbol.for("react.portal");
@@ -2597,7 +2618,7 @@ var require_jsx_runtime = /* @__PURE__ */ __commonJS({ "../../node_modules/react
2597
2618
 
2598
2619
  //#endregion
2599
2620
  //#region ../icons/dist/Sparkles.js
2600
- var import_jsx_runtime$3 = require_jsx_runtime();
2621
+ var import_jsx_runtime$3 = /* @__PURE__ */ __toESM(require_jsx_runtime());
2601
2622
  const SvgSparkles = (props) => /* @__PURE__ */ (0, import_jsx_runtime$3.jsxs)("svg", {
2602
2623
  width: 24,
2603
2624
  height: 24,
@@ -2636,7 +2657,7 @@ var Sparkles_default = SvgSparkles;
2636
2657
 
2637
2658
  //#endregion
2638
2659
  //#region ../icons/dist/IconCloseVariant.js
2639
- var import_jsx_runtime$2 = require_jsx_runtime();
2660
+ var import_jsx_runtime$2 = /* @__PURE__ */ __toESM(require_jsx_runtime());
2640
2661
  const SvgIconCloseVariant = (props) => /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("svg", {
2641
2662
  viewBox: "0 0 24 24",
2642
2663
  xmlns: "http://www.w3.org/2000/svg",
@@ -2700,6 +2721,7 @@ const SearchOverlay = React.forwardRef(({ children, className, dataTestId, role,
2700
2721
  return node;
2701
2722
  }
2702
2723
  });
2724
+ SearchOverlay.displayName = "SearchOverlay";
2703
2725
 
2704
2726
  //#endregion
2705
2727
  //#region src/SearchZeroState/zeroStateSearchVariants.ts
@@ -2720,7 +2742,7 @@ const searchZeroStateVariantClasses = {
2720
2742
 
2721
2743
  //#endregion
2722
2744
  //#region ../icons/dist/AiSearchBold.js
2723
- var import_jsx_runtime$1 = require_jsx_runtime();
2745
+ var import_jsx_runtime$1 = /* @__PURE__ */ __toESM(require_jsx_runtime());
2724
2746
  const SvgAiSearchBold = (props) => /* @__PURE__ */ (0, import_jsx_runtime$1.jsxs)("svg", {
2725
2747
  width: 32,
2726
2748
  height: 32,
@@ -2754,7 +2776,7 @@ var AiSearchBold_default = SvgAiSearchBold;
2754
2776
 
2755
2777
  //#endregion
2756
2778
  //#region ../icons/dist/AiSearchThin.js
2757
- var import_jsx_runtime = require_jsx_runtime();
2779
+ var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
2758
2780
  const SvgAiSearchThin = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
2759
2781
  width: 26,
2760
2782
  height: 23,
@@ -2888,7 +2910,7 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2888
2910
  const { variant: suggestionButtonVariant, hoverVariant: suggestionButtonHoverVariant, borderRadius: suggestionButtonBorderRadius } = suggestionButtonConfig;
2889
2911
  const [isOpen, setIsOpen] = useState(!!initialIsOpen);
2890
2912
  const searchInputRef = useRef(null);
2891
- const searchInput = useSearch();
2913
+ const searchInput = useSearch({ allowRedirect: true });
2892
2914
  const { track } = useAmplitudeTracking();
2893
2915
  const { recommendedProductsHeading, searchOverlayHeading, productCardConfig, merchantShortName, recommendedProducts, searchText, autocompleteResults, focusedIndex, focusedOptionId, shouldShowAutocomplete, onSearchInputChange, onSearchInputFocus, onSearchInputBlur, onKeyDown, onAutocompleteSelect, onSubmitSearch, resetSearch } = searchInput;
2894
2916
  const { overlayBackgroundClasses, sparklesIconColor } = searchZeroStateVariantClasses[searchZeroStateVariant && searchZeroStateVariantClasses[searchZeroStateVariant] ? searchZeroStateVariant : "backgroundTertiary"];
@@ -2949,7 +2971,7 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2949
2971
  variant: "t3",
2950
2972
  children: searchOverlayHeading
2951
2973
  }), /* @__PURE__ */ jsx(Sparkles_default, {
2952
- className: "sm:spiffy-tw-w-[36px] sm:spiffy-tw-h-[45px] spiffy-tw-w-[24px] spiffy-tw-h-[36px] spiffy-tw-ml-2",
2974
+ className: "spiffy-tw-ml-2 spiffy-tw-h-[36px] spiffy-tw-w-[24px] sm:spiffy-tw-h-[45px] sm:spiffy-tw-w-[36px]",
2953
2975
  color: sparklesIconColor,
2954
2976
  stroke: "2px"
2955
2977
  })]
@@ -2959,11 +2981,11 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2959
2981
  })]
2960
2982
  }), /* @__PURE__ */ jsx("button", {
2961
2983
  onClick: handleClose,
2962
- className: "spiffy-tw-absolute spiffy-tw-top-4 spiffy-tw-right-4 sm:spiffy-tw-top-8 sm:spiffy-tw-right-8 ",
2984
+ className: "spiffy-tw-absolute spiffy-tw-right-4 spiffy-tw-top-4 sm:spiffy-tw-right-8 sm:spiffy-tw-top-8",
2963
2985
  "aria-label": "Close search",
2964
2986
  type: "button",
2965
2987
  children: /* @__PURE__ */ jsx(IconCloseVariant_default, {
2966
- className: "spiffy-tw-w-[20px] spiffy-tw-h-[20px] sm:spiffy-tw-w-[28px] sm:spiffy-tw-h-[28px]",
2988
+ className: "spiffy-tw-h-[20px] spiffy-tw-w-[20px] sm:spiffy-tw-h-[28px] sm:spiffy-tw-w-[28px]",
2967
2989
  strokeWidth: "2px"
2968
2990
  })
2969
2991
  })] }),
@@ -2984,7 +3006,7 @@ const SearchZeroState = ({ widgetConfig, initialIsOpen, entryPointRef }) => {
2984
3006
  onSearchInputBlur
2985
3007
  }),
2986
3008
  /* @__PURE__ */ jsxs(AnimatePresence, { children: [initialSuggestions && initialSuggestions.length > 0 && /* @__PURE__ */ jsx(motion.div, {
2987
- className: "spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden",
3009
+ className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
2988
3010
  initial: { opacity: 0 },
2989
3011
  animate: { opacity: 1 },
2990
3012
  exit: { opacity: 0 },
@@ -1,5 +1,5 @@
1
- const require_SuggestionBar = require('../SuggestionBar-BOThXJvJ.cjs');
2
- require('../SuggestionButtonContainer-BeWPpeQk.cjs');
1
+ const require_SuggestionBar = require('../SuggestionBar-CK5aU2bb.cjs');
2
+ require('../SuggestionButtonContainer-Dm38gJiJ.cjs');
3
3
 
4
4
  exports.SuggestionBar = require_SuggestionBar.SuggestionBar;
5
5
  exports.SuggestionBarLocationForMetrics = require_SuggestionBar.SuggestionBarLocationForMetrics;
@@ -1,4 +1,4 @@
1
- import { n as SuggestionBarLocationForMetrics, t as SuggestionBar } from "../SuggestionBar-DeMmAK4M.js";
2
- import "../SuggestionButtonContainer-CZhOkZaJ.js";
1
+ import { n as SuggestionBarLocationForMetrics, t as SuggestionBar } from "../SuggestionBar-BHAXhgcd.js";
2
+ import "../SuggestionButtonContainer-s2e9YGW_.js";
3
3
 
4
4
  export { SuggestionBar, SuggestionBarLocationForMetrics };
@@ -1,4 +1,4 @@
1
- import { t as SuggestionButtonContainer } from "./SuggestionButtonContainer-CZhOkZaJ.js";
1
+ import { t as SuggestionButtonContainer } from "./SuggestionButtonContainer-s2e9YGW_.js";
2
2
  import { useCallback, useRef } from "react";
3
3
  import { useSetAtom } from "jotai";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -96,16 +96,9 @@ function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, h
96
96
  ]);
97
97
  return /* @__PURE__ */ jsx("div", {
98
98
  id,
99
- className: "spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden",
99
+ className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
100
100
  children: /* @__PURE__ */ jsx("div", {
101
- className: `
102
- spiffy-tw-relative
103
- spiffy-tw-w-full
104
- spiffy-tw-overflow-x-scroll
105
- spiffy-tw-overflow-y-hidden
106
- spiffy-tw-no-scrollbar
107
- ${twoRowsOnMobile && isSmallScreen ? "spiffy-tw-h-20" : "spiffy-tw-h-9"}
108
- `,
101
+ 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"} `,
109
102
  ref: handleContainerRef,
110
103
  children: /* @__PURE__ */ jsx("div", {
111
104
  className: "spiffy-tw-relative spiffy-tw-inline-block spiffy-tw-whitespace-nowrap",
@@ -1,5 +1,5 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
2
- const require_SuggestionButtonContainer = require('./SuggestionButtonContainer-BeWPpeQk.cjs');
1
+ const require_chunk = require('./chunk-DSlc6foC.cjs');
2
+ const require_SuggestionButtonContainer = require('./SuggestionButtonContainer-Dm38gJiJ.cjs');
3
3
  let react = require("react");
4
4
  let jotai = require("jotai");
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -407,16 +407,9 @@ function SuggestionBar({ id, locationForMetrics, buttonTexts, buttonVariation, h
407
407
  ]);
408
408
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
409
409
  id,
410
- className: "spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden",
410
+ className: "spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden",
411
411
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
412
- className: `
413
- spiffy-tw-relative
414
- spiffy-tw-w-full
415
- spiffy-tw-overflow-x-scroll
416
- spiffy-tw-overflow-y-hidden
417
- spiffy-tw-no-scrollbar
418
- ${twoRowsOnMobile && isSmallScreen ? "spiffy-tw-h-20" : "spiffy-tw-h-9"}
419
- `,
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"} `,
420
413
  ref: handleContainerRef,
421
414
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
422
415
  className: "spiffy-tw-relative spiffy-tw-inline-block spiffy-tw-whitespace-nowrap",
@@ -1,3 +1,3 @@
1
- const require_SuggestionButtonContainer = require('../SuggestionButtonContainer-BeWPpeQk.cjs');
1
+ const require_SuggestionButtonContainer = require('../SuggestionButtonContainer-Dm38gJiJ.cjs');
2
2
 
3
3
  exports.SuggestionButtonContainer = require_SuggestionButtonContainer.SuggestionButtonContainer;
@@ -1,3 +1,3 @@
1
- import { t as SuggestionButtonContainer } from "../SuggestionButtonContainer-CZhOkZaJ.js";
1
+ import { t as SuggestionButtonContainer } from "../SuggestionButtonContainer-s2e9YGW_.js";
2
2
 
3
3
  export { SuggestionButtonContainer };
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
1
+ const require_chunk = require('./chunk-DSlc6foC.cjs');
2
2
  let react = require("react");
3
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
4
  let framer_motion = require("framer-motion");
@@ -104,7 +104,7 @@ function useHorizontalScrollAnimation({ scrollContainerRef, animationSpeed = "st
104
104
  //#region src/SuggestionButtonContainer/SuggestionButtonContainer.tsx
105
105
  function ButtonContainer({ children }) {
106
106
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
107
- className: "spiffy-tw-flex \n spiffy-tw-flex-row\n spiffy-tw-items-center\n spiffy-tw-space-x-2\n spiffy-tw-h-full\n spiffy-tw-pl-0",
107
+ className: "spiffy-tw-pl-0 spiffy-tw-flex spiffy-tw-h-full spiffy-tw-flex-row spiffy-tw-items-center spiffy-tw-space-x-2",
108
108
  children
109
109
  });
110
110
  }
@@ -120,7 +120,7 @@ const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, butt
120
120
  const visibleButtonsFirstRow = buttonTexts.slice(0, twoRowsOnMobile && isSmallScreen ? Math.ceil((buttonTexts.length + 1) / 2) : void 0);
121
121
  const visibleButtonsSecondRow = buttonTexts.slice(Math.ceil((buttonTexts.length + 1) / 2), buttonTexts.length);
122
122
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
123
- className: "spiffy-tw-overflow-x-scroll spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-whitespace-nowrap",
123
+ className: "spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-overflow-x-scroll spiffy-tw-whitespace-nowrap",
124
124
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ButtonContainer, { children: [visibleButtonsFirstRow.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__envive_ai_react_toolkit_SuggestionButton.SuggestionButton, {
125
125
  variant: buttonVariation,
126
126
  hoverVariant: hoverButtonVariation,
@@ -103,7 +103,7 @@ function useHorizontalScrollAnimation({ scrollContainerRef, animationSpeed = "st
103
103
  //#region src/SuggestionButtonContainer/SuggestionButtonContainer.tsx
104
104
  function ButtonContainer({ children }) {
105
105
  return /* @__PURE__ */ jsx("div", {
106
- className: "spiffy-tw-flex \n spiffy-tw-flex-row\n spiffy-tw-items-center\n spiffy-tw-space-x-2\n spiffy-tw-h-full\n spiffy-tw-pl-0",
106
+ className: "spiffy-tw-pl-0 spiffy-tw-flex spiffy-tw-h-full spiffy-tw-flex-row spiffy-tw-items-center spiffy-tw-space-x-2",
107
107
  children
108
108
  });
109
109
  }
@@ -119,7 +119,7 @@ const SuggestionButtonContainer = ({ buttonVariation, hoverButtonVariation, butt
119
119
  const visibleButtonsFirstRow = buttonTexts.slice(0, twoRowsOnMobile && isSmallScreen ? Math.ceil((buttonTexts.length + 1) / 2) : void 0);
120
120
  const visibleButtonsSecondRow = buttonTexts.slice(Math.ceil((buttonTexts.length + 1) / 2), buttonTexts.length);
121
121
  return /* @__PURE__ */ jsxs("div", {
122
- className: "spiffy-tw-overflow-x-scroll spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-whitespace-nowrap",
122
+ className: "spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-overflow-x-scroll spiffy-tw-whitespace-nowrap",
123
123
  children: [/* @__PURE__ */ jsxs(ButtonContainer, { children: [visibleButtonsFirstRow.map((suggestion, i) => /* @__PURE__ */ jsx(SuggestionButton, {
124
124
  variant: buttonVariation,
125
125
  hoverVariant: hoverButtonVariation,
@@ -9,12 +9,16 @@ var __commonJS = (cb, mod) => function() {
9
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
- key = keys[i];
14
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ }
18
22
  }
19
23
  return to;
20
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envive-ai/react-widgets",
3
- "version": "0.1.2-arthur-2",
3
+ "version": "0.1.2",
4
4
  "description": "React widget library for Envive services.",
5
5
  "keywords": [
6
6
  "react",
@@ -23,17 +23,17 @@
23
23
  "scripts": {
24
24
  "build": "tsdown",
25
25
  "build:watch": "tsdown --watch",
26
+ "dev": "npm run get-merchants && storybook dev -p 6006",
26
27
  "prepublish": "npm run build",
27
- "typecheck": "tsc",
28
- "test": "vitest",
29
- "storybook": "npm run get-merchants && storybook dev -p 6006",
30
28
  "build-storybook": "npm run get-merchants && storybook build",
31
- "dev": "npm run get-merchants && storybook dev -p 6006",
32
- "get-merchants": "tsx ./.storybook/getMerchants.ts"
29
+ "storybook": "npm run get-merchants && storybook dev -p 6006",
30
+ "storybook:get-merchants": "tsx ./.storybook/getMerchants.ts",
31
+ "typecheck": "tsc",
32
+ "test": "vitest"
33
33
  },
34
34
  "dependencies": {
35
- "@envive-ai/react-hooks": "0.2.8",
36
- "@envive-ai/react-toolkit": "0.2.13-arthur-1",
35
+ "@envive-ai/react-hooks": "0.2.9",
36
+ "@envive-ai/react-toolkit": "*",
37
37
  "@tailwindcss/typography": "^0.5.15",
38
38
  "classnames": "^2.5.1",
39
39
  "framer-motion": "^12.23.24",
@@ -55,7 +55,12 @@
55
55
  "@storybook/react-vite": "^9.1.4",
56
56
  "@types/node": "^24.3.2",
57
57
  "@types/react": "^19.1.12",
58
+ "@vitejs/plugin-react": "^5.0.0",
59
+ "@vitest/browser": "^3.2.4",
60
+ "@vitest/coverage-v8": "^3.2.4",
61
+ "autoprefixer": "^10.4.21",
58
62
  "eslint-plugin-storybook": "^9.1.4",
63
+ "playwright": "^1.56.0",
59
64
  "postcss": "^8.5.6",
60
65
  "storybook": "^9.1.4",
61
66
  "tailwindcss": "^3.4.17",
@@ -64,6 +69,9 @@
64
69
  "vite-tsconfig-paths": "^5.1.4",
65
70
  "vitest": "^3.2.4"
66
71
  },
72
+ "optionalDependencies": {
73
+ "@rollup/rollup-linux-x64-gnu": "*"
74
+ },
67
75
  "exports": {
68
76
  "./SearchResults": {
69
77
  "import": "./dist/SearchResults/index.js",
@@ -3,13 +3,11 @@ import { useEffect } from 'react';
3
3
  import { SearchResultsContent } from '@envive-ai/react-toolkit/SearchResultsContent';
4
4
  import { SearchResultsFilterModal } from '@envive-ai/react-toolkit/SearchResultsFilterModal';
5
5
  import { SearchResultsToolbar } from '@envive-ai/react-toolkit/SearchResultsToolbar';
6
- import { useStickyVisibility } from '@envive-ai/react-toolkit/util'
6
+ import { useStickyVisibility } from '@envive-ai/react-toolkit/util';
7
7
  import { SearchResultsHocProps } from '@envive-ai/react-hooks/hooks/Search';
8
8
  import { SearchResultsEntryPointWidgetConfig } from './types';
9
9
  import { withSearchResults } from './withSearchResults';
10
10
 
11
-
12
-
13
11
  export interface SearchResultsProps extends SearchResultsHocProps {
14
12
  widgetConfig: SearchResultsEntryPointWidgetConfig;
15
13
  }
@@ -141,4 +139,4 @@ export const SearchResultsComponent = ({
141
139
  );
142
140
  };
143
141
 
144
- export const SearchResults = withSearchResults(SearchResultsComponent);
142
+ export const SearchResults = withSearchResults(SearchResultsComponent);
@@ -40,4 +40,4 @@ export const SearchResultsWidget = () => {
40
40
  }
41
41
 
42
42
  return <SearchResults widgetConfig={widgetConfig as SearchResultsEntryPointWidgetConfig} />;
43
- };
43
+ };
@@ -1,6 +1,3 @@
1
-
2
-
3
-
4
1
  import { SearchFilterSidebarVariant } from '@envive-ai/react-toolkit/SearchResultsFilterSidebar';
5
2
  import { ProductGridVariant } from '@envive-ai/react-toolkit/ProductCard';
6
3
  import { BaseWidgetConfig } from 'src/config/BaseWidgetConfig';
@@ -1,11 +1,11 @@
1
- import { SearchIconVariant } from "@envive-ai/react-hooks/contexts/types";
2
- import AiSearchBold from "@envive-ai/react-icons/AiSearchBold";
3
- import AiSearchThin from "@envive-ai/react-icons/AiSearchThin";
4
- import { Typography } from "@envive-ai/react-toolkit/Typography";
5
- import classNames from "classnames";
6
- import React from "react";
1
+ import { SearchIconVariant } from '@envive-ai/react-hooks/contexts/types';
2
+ import AiSearchBold from '@envive-ai/react-icons/AiSearchBold';
3
+ import AiSearchThin from '@envive-ai/react-icons/AiSearchThin';
4
+ import { Typography } from '@envive-ai/react-toolkit/Typography';
5
+ import classNames from 'classnames';
6
+ import React from 'react';
7
7
 
8
- const SEARCH_ENTRYPOINT_BUTTON_TESTID = "spiffy-search-entrypoint-button";
8
+ const SEARCH_ENTRYPOINT_BUTTON_TESTID = 'spiffy-search-entrypoint-button';
9
9
 
10
10
  interface SearchIconProps {
11
11
  size?: number; // in px
@@ -46,9 +46,16 @@ export const SearchIcon: React.FC<SearchIconProps> = ({
46
46
  data-testid={SEARCH_ENTRYPOINT_BUTTON_TESTID}
47
47
  ref={entryPointRef}
48
48
  >
49
- <IconComponent style={{ width: size, height: size }} fill={color} strokeWidth={iconStrokeWidth} />
49
+ <IconComponent
50
+ style={{ width: size, height: size }}
51
+ fill={color}
52
+ strokeWidth={iconStrokeWidth}
53
+ />
50
54
  {label && (
51
- <Typography variant="body3" className="spiffy-global-search-text">
55
+ <Typography
56
+ variant="body3"
57
+ className="spiffy-global-search-text"
58
+ >
52
59
  {label}
53
60
  </Typography>
54
61
  )}
@@ -65,10 +65,10 @@ export const SearchOverlay = React.forwardRef<HTMLDivElement, SearchOverlayProps
65
65
  }
66
66
 
67
67
  // If we are usingPortal, we need to create a portal widget in the orgConfig
68
- // so that we can properly identify the portal target. This is often used to
68
+ // so that we can properly identify the portal target. This is often used to
69
69
  // get around z-index context hell because it will move the overlay wherever
70
70
  // you need to insert it. In most cases, appending it as a child of body is
71
- // sufficient. Typically this is not needed, but look into how it's done in
71
+ // sufficient. Typically this is not needed, but look into how it's done in
72
72
  // Bandolier for more info.
73
73
  try {
74
74
  const target = getOverlayPortalTarget();
@@ -79,3 +79,4 @@ export const SearchOverlay = React.forwardRef<HTMLDivElement, SearchOverlayProps
79
79
  }
80
80
  },
81
81
  );
82
+ SearchOverlay.displayName = 'SearchOverlay';
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useCallback, useRef } from 'react';
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { AnimatePresence, motion } from 'framer-motion';
3
3
  import { useAmplitudeTracking } from '@envive-ai/react-hooks/hooks/AmplitudeOperations';
4
4
  import { useSearch } from '@envive-ai/react-hooks/hooks/Search';
@@ -20,7 +20,6 @@ import { searchZeroStateVariantClasses } from './zeroStateSearchVariants';
20
20
  import { SearchIcon } from './SearchIcon';
21
21
  import { RecommendedProducts } from './components/RecommendedProducts';
22
22
 
23
-
24
23
  const SEARCH_ENTRYPOINT_INPUT_TESTID = 'spiffy-search-entrypoint-input';
25
24
 
26
25
  export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
@@ -28,7 +27,6 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
28
27
  initialIsOpen,
29
28
  entryPointRef,
30
29
  }) => {
31
-
32
30
  // eslint-disable-next-line no-console
33
31
  console.log('SearchZeroState: widgetConfig', widgetConfig);
34
32
  const {
@@ -53,10 +51,10 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
53
51
  const [isOpen, setIsOpen] = useState(!!initialIsOpen);
54
52
  const searchInputRef = useRef<HTMLInputElement>(null);
55
53
 
56
- const searchInput = useSearch();
54
+ const searchInput = useSearch({ allowRedirect: true });
57
55
 
58
56
  const { track } = useAmplitudeTracking();
59
-
57
+
60
58
  const {
61
59
  recommendedProductsHeading,
62
60
  searchOverlayHeading,
@@ -86,8 +84,7 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
86
84
  const { overlayBackgroundClasses, sparklesIconColor } =
87
85
  searchZeroStateVariantClasses[validVariant];
88
86
 
89
- const { searchInputIconColor } =
90
- searchInputVariantClasses[searchInputVariant];
87
+ const { searchInputIconColor } = searchInputVariantClasses[searchInputVariant];
91
88
 
92
89
  const handleOpen = () => setIsOpen(true);
93
90
  const handleClose = () => setIsOpen(false);
@@ -105,7 +102,6 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
105
102
 
106
103
  useEffect(() => {
107
104
  if (isOpen) {
108
-
109
105
  resetSearch(); // Reset search state when opening
110
106
  searchInputRef.current?.focus();
111
107
  }
@@ -166,29 +162,30 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
166
162
  <>
167
163
  <div className="spiffy-tw-relative spiffy-tw-mb-4">
168
164
  <div className="spiffy-tw-flex spiffy-tw-items-center">
169
- <Typography id="global-search-title" variant="t3">
165
+ <Typography
166
+ id="global-search-title"
167
+ variant="t3"
168
+ >
170
169
  {searchOverlayHeading}
171
170
  </Typography>
172
171
  <Sparkles
173
- className="sm:spiffy-tw-w-[36px] sm:spiffy-tw-h-[45px] spiffy-tw-w-[24px] spiffy-tw-h-[36px] spiffy-tw-ml-2"
172
+ className="spiffy-tw-ml-2 spiffy-tw-h-[36px] spiffy-tw-w-[24px] sm:spiffy-tw-h-[45px] sm:spiffy-tw-w-[36px]"
174
173
  color={sparklesIconColor}
175
174
  stroke="2px"
176
175
  />
177
176
  </div>
178
- {
179
- includeSubtitle && (
180
- <Typography variant="body2">Go ahead, get as specific as you like...</Typography>
181
- )
182
- }
177
+ {includeSubtitle && (
178
+ <Typography variant="body2">Go ahead, get as specific as you like...</Typography>
179
+ )}
183
180
  </div>
184
181
  <button
185
182
  onClick={handleClose}
186
- className="spiffy-tw-absolute spiffy-tw-top-4 spiffy-tw-right-4 sm:spiffy-tw-top-8 sm:spiffy-tw-right-8 "
183
+ className="spiffy-tw-absolute spiffy-tw-right-4 spiffy-tw-top-4 sm:spiffy-tw-right-8 sm:spiffy-tw-top-8"
187
184
  aria-label="Close search"
188
185
  type="button"
189
186
  >
190
187
  <IconCloseVariant
191
- className="spiffy-tw-w-[20px] spiffy-tw-h-[20px] sm:spiffy-tw-w-[28px] sm:spiffy-tw-h-[28px]"
188
+ className="spiffy-tw-h-[20px] spiffy-tw-w-[20px] sm:spiffy-tw-h-[28px] sm:spiffy-tw-w-[28px]"
192
189
  strokeWidth="2px"
193
190
  />
194
191
  </button>
@@ -213,7 +210,7 @@ export const SearchZeroState: React.FC<SearchZeroStateProps> = ({
213
210
  {initialSuggestions &&
214
211
  initialSuggestions.length > 0 && ( // Conditionally render suggestions
215
212
  <motion.div
216
- className="spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden"
213
+ className="spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden"
217
214
  initial={{ opacity: 0 }}
218
215
  animate={{ opacity: 1 }}
219
216
  exit={{ opacity: 0 }}
@@ -1,16 +1,19 @@
1
- import { SearchEntryPointWidgetConfig } from "@envive-ai/react-hooks/contexts/types";
2
- import { useNewOrgConfig } from "@envive-ai/react-hooks/hooks/NewOrgConfig";
3
- import { useMemo } from "react";
4
- import { SearchZeroState } from "./SearchZeroState";
5
-
1
+ import { SearchEntryPointWidgetConfig } from '@envive-ai/react-hooks/contexts/types';
2
+ import { useNewOrgConfig } from '@envive-ai/react-hooks/hooks/NewOrgConfig';
3
+ import { useMemo } from 'react';
4
+ import { SearchZeroState } from './SearchZeroState';
6
5
 
7
6
  type SearchZeroStateWidgetProps = {
8
7
  initialIsOpen: boolean;
9
8
  widgetConfigId?: string;
10
9
  entryPointRef: React.Ref<HTMLButtonElement>;
11
- }
10
+ };
12
11
 
13
- export const SearchZeroStateWidget = ({ initialIsOpen, widgetConfigId = 'searchEntryPointIcon', entryPointRef }: SearchZeroStateWidgetProps) => {
12
+ export const SearchZeroStateWidget = ({
13
+ initialIsOpen,
14
+ widgetConfigId = 'searchEntryPointIcon',
15
+ entryPointRef,
16
+ }: SearchZeroStateWidgetProps) => {
14
17
  const newConfig = useNewOrgConfig();
15
18
 
16
19
  const widgetConfig = useMemo(() => {
@@ -29,5 +32,11 @@ export const SearchZeroStateWidget = ({ initialIsOpen, widgetConfigId = 'searchE
29
32
  return null;
30
33
  }
31
34
 
32
- return <SearchZeroState widgetConfig={widgetConfig as SearchEntryPointWidgetConfig} initialIsOpen={initialIsOpen} entryPointRef={entryPointRef} />;
35
+ return (
36
+ <SearchZeroState
37
+ widgetConfig={widgetConfig as SearchEntryPointWidgetConfig}
38
+ initialIsOpen={initialIsOpen}
39
+ entryPointRef={entryPointRef}
40
+ />
41
+ );
33
42
  };
@@ -6,7 +6,10 @@ import { useAmplitudeTracking } from '@envive-ai/react-hooks/hooks/AmplitudeOper
6
6
  import { SearchResponseProduct } from '@spiffy-ai/commerce-api-client';
7
7
  import { Typography } from '@envive-ai/react-toolkit/Typography';
8
8
  import { ProductCardConfig, ProductGridVariant } from '@envive-ai/react-hooks/contexts/types';
9
- import { ChatElementDisplayLocation, SearchResponseProductAttributes } from '@envive-ai/react-hooks/application/models';
9
+ import {
10
+ ChatElementDisplayLocation,
11
+ SearchResponseProductAttributes,
12
+ } from '@envive-ai/react-hooks/application/models';
10
13
  import { SpiffyMetricsEventName } from '@envive-ai/react-hooks/contexts/amplitudeContext';
11
14
 
12
15
  interface RecommendedProductsProps {
@@ -64,7 +67,6 @@ export const RecommendedProducts: React.FC<RecommendedProductsProps> = ({
64
67
  }
65
68
 
66
69
  const handleProductClick = (product: SearchResponseProduct, index: number) => {
67
-
68
70
  track(SpiffyMetricsEventName.ProductCardClicked, {
69
71
  eventProps: {
70
72
  url: product.url,
@@ -100,7 +102,10 @@ export const RecommendedProducts: React.FC<RecommendedProductsProps> = ({
100
102
  >
101
103
  {heading && (
102
104
  <div className={titleContainerClasses}>
103
- <Typography variant="h1" className="spiffy-tw-text-[--spiffy-colors-text-accent]">
105
+ <Typography
106
+ variant="h1"
107
+ className="spiffy-tw-text-[--spiffy-colors-text-accent]"
108
+ >
104
109
  {heading}
105
110
  </Typography>
106
111
  </div>
@@ -4,9 +4,7 @@ export const SEARCH_OVERLAY_PORTAL_ID = 'spiffy-ai-search-overlay-portal'; // Th
4
4
  /**
5
5
  * Find the portal target inside the overlay host's ShadowRoot.
6
6
  */
7
- export function getOverlayPortalTarget(
8
- hostId: string = SEARCH_OVERLAY_ENTRYPOINT_ID,
9
- ): HTMLElement {
7
+ export function getOverlayPortalTarget(hostId: string = SEARCH_OVERLAY_ENTRYPOINT_ID): HTMLElement {
10
8
  const bareMount = document.getElementById(SEARCH_OVERLAY_PORTAL_ID) as HTMLElement | null;
11
9
  if (bareMount) return bareMount;
12
10
  const host = document.getElementById(hostId);
@@ -16,4 +14,4 @@ export function getOverlayPortalTarget(
16
14
  const mount = sr.getElementById(SEARCH_OVERLAY_PORTAL_ID) as HTMLElement | null;
17
15
  if (!mount) throw new Error('[Overlay] Portal mount missing inside ShadowRoot');
18
16
  return mount;
19
- }
17
+ }
@@ -1,4 +1,7 @@
1
- import { SearchEntryPointWidgetConfig, SearchInputVariant } from "@envive-ai/react-hooks/contexts/types";
1
+ import {
2
+ SearchEntryPointWidgetConfig,
3
+ SearchInputVariant,
4
+ } from '@envive-ai/react-hooks/contexts/types';
2
5
 
3
6
  export type { SearchInputVariant, SearchEntryPointWidgetConfig };
4
7
 
@@ -1,17 +1,26 @@
1
- import { ColorNames, colorVar, SearchZeroStateVariant } from "@envive-ai/react-hooks/contexts/types";
1
+ import {
2
+ ColorNames,
3
+ SearchZeroStateVariant,
4
+ colorVar,
5
+ } from '@envive-ai/react-hooks/contexts/types';
2
6
 
3
7
  interface SearchZeroStateVariantClasses {
4
8
  overlayBackgroundClasses: string;
5
9
  sparklesIconColor: string;
6
10
  }
7
11
 
8
- export const searchZeroStateVariantClasses: Record<SearchZeroStateVariant, SearchZeroStateVariantClasses> = {
9
- backgroundTertiary: { // standard light mode
12
+ export const searchZeroStateVariantClasses: Record<
13
+ SearchZeroStateVariant,
14
+ SearchZeroStateVariantClasses
15
+ > = {
16
+ backgroundTertiary: {
17
+ // standard light mode
10
18
  overlayBackgroundClasses:
11
19
  'spiffy-tw-bg-[--spiffy-colors-background-tertiary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20',
12
20
  sparklesIconColor: colorVar(ColorNames.AccentPrimary),
13
21
  },
14
- backgroundDark: { // standard dark mode
22
+ backgroundDark: {
23
+ // standard dark mode
15
24
  overlayBackgroundClasses:
16
25
  'spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20',
17
26
  sparklesIconColor: colorVar(ColorNames.AccentPrimary),
@@ -19,6 +28,6 @@ export const searchZeroStateVariantClasses: Record<SearchZeroStateVariant, Searc
19
28
  backgroundPrimary: {
20
29
  overlayBackgroundClasses:
21
30
  'spiffy-tw-bg-[--spiffy-colors-background-primary] spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-bg-opacity-90 spiffy-tw-backdrop-blur-20',
22
- sparklesIconColor: colorVar(ColorNames.AccentPrimary)
31
+ sparklesIconColor: colorVar(ColorNames.AccentPrimary),
23
32
  },
24
33
  };
@@ -3,9 +3,8 @@ import { useScrollContainer } from 'react-indiana-drag-scroll';
3
3
  import { v4 as uuid } from 'uuid';
4
4
  import { useSetAtom } from 'jotai';
5
5
 
6
-
7
- import { SpiffyWidgets, MessageRole, MessageType } from '@envive-ai/react-hooks/application/models';
8
- import { logPerfMetricAtom, PerfMetricsEvents } from '@envive-ai/react-hooks/atoms/chat';
6
+ import { MessageRole, MessageType, SpiffyWidgets } from '@envive-ai/react-hooks/application/models';
7
+ import { PerfMetricsEvents, logPerfMetricAtom } from '@envive-ai/react-hooks/atoms/chat';
9
8
  import { SUGGESTION_BAR_TESTID } from '@envive-ai/react-hooks/config';
10
9
  import { useIsSmallScreen } from '@envive-ai/react-hooks/hooks/IsSmallScreen';
11
10
  import { useTrackComponentVisibleEvent } from '@envive-ai/react-hooks/hooks/TrackComponentVisibleEvent';
@@ -16,7 +15,6 @@ import { SuggestionButtonVariant } from '@envive-ai/react-hooks/contexts/types';
16
15
  import { SuggestionBarLocationForMetrics } from './types';
17
16
  import { SuggestionButtonContainer } from '../SuggestionButtonContainer';
18
17
 
19
-
20
18
  // SuggestionBarV2 Props
21
19
  interface SuggestionBarProps extends TestProps {
22
20
  id: string;
@@ -57,11 +55,9 @@ function SuggestionBar({
57
55
  const isAnimated = animationSpeed !== 'none';
58
56
 
59
57
  // Track component visibility
60
- useTrackComponentVisibleEvent(
61
- SpiffyWidgets.SuggestionBar,
62
- componentVisibleTriggerRef,
63
- { animated: isAnimated },
64
- );
58
+ useTrackComponentVisibleEvent(SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, {
59
+ animated: isAnimated,
60
+ });
65
61
 
66
62
  // Handle button click
67
63
  const handleClickSuggestion = useCallback(
@@ -102,16 +98,12 @@ function SuggestionBar({
102
98
  );
103
99
 
104
100
  return (
105
- <div id={id} className="spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden">
101
+ <div
102
+ id={id}
103
+ className="spiffy-tw-w-full spiffy-tw-justify-center spiffy-tw-overflow-hidden"
104
+ >
106
105
  <div
107
- className={`
108
- spiffy-tw-relative
109
- spiffy-tw-w-full
110
- spiffy-tw-overflow-x-scroll
111
- spiffy-tw-overflow-y-hidden
112
- spiffy-tw-no-scrollbar
113
- ${twoRowsOnMobile && isSmallScreen ? 'spiffy-tw-h-20' : 'spiffy-tw-h-9'}
114
- `}
106
+ 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'} `}
115
107
  ref={handleContainerRef}
116
108
  >
117
109
  <div
@@ -1,4 +1,4 @@
1
1
  export enum SuggestionBarLocationForMetrics {
2
- SUGGESTION_BAR_TOP = 'top',
3
- SUGGESTION_BAR_BOTTOM = 'bottom'
4
- }
2
+ SUGGESTION_BAR_TOP = 'top',
3
+ SUGGESTION_BAR_BOTTOM = 'bottom',
4
+ }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/no-array-index-key */
1
2
  import { useRef } from 'react';
2
3
  import { SuggestionButton } from '@envive-ai/react-toolkit/SuggestionButton';
3
4
  import { SpiffyWidgets } from '@envive-ai/react-hooks/application/models';
@@ -15,20 +16,12 @@ interface ButtonContainerProps {
15
16
  // ButtonContainer is reused twice within SuggestionBarV2, so we declare it as a seperate functional component
16
17
  function ButtonContainer({ children }: ButtonContainerProps) {
17
18
  return (
18
- <div
19
- className="spiffy-tw-flex
20
- spiffy-tw-flex-row
21
- spiffy-tw-items-center
22
- spiffy-tw-space-x-2
23
- spiffy-tw-h-full
24
- spiffy-tw-pl-0"
25
- >
19
+ <div className="spiffy-tw-pl-0 spiffy-tw-flex spiffy-tw-h-full spiffy-tw-flex-row spiffy-tw-items-center spiffy-tw-space-x-2">
26
20
  {children}
27
21
  </div>
28
22
  );
29
23
  }
30
24
 
31
-
32
25
  const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
33
26
  buttonVariation,
34
27
  hoverButtonVariation,
@@ -47,17 +40,15 @@ const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
47
40
  useHorizontalScrollAnimation({
48
41
  scrollContainerRef,
49
42
  animationSpeed,
50
- })
43
+ });
51
44
  const isSmallScreen = useIsSmallScreen();
52
45
 
53
46
  const isAnimated = animationSpeed !== 'none';
54
47
 
55
48
  // Track component visibility
56
- useTrackComponentVisibleEvent(
57
- SpiffyWidgets.SuggestionBar,
58
- componentVisibleTriggerRef,
59
- { animated: isAnimated },
60
- );
49
+ useTrackComponentVisibleEvent(SpiffyWidgets.SuggestionBar, componentVisibleTriggerRef, {
50
+ animated: isAnimated,
51
+ });
61
52
 
62
53
  const visibleButtonsFirstRow = buttonTexts.slice(
63
54
  0,
@@ -70,7 +61,7 @@ const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
70
61
  );
71
62
 
72
63
  return (
73
- <div className="spiffy-tw-overflow-x-scroll spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-whitespace-nowrap">
64
+ <div className="spiffy-tw-no-scrollbar spiffy-tw-w-full spiffy-tw-overflow-x-scroll spiffy-tw-whitespace-nowrap">
74
65
  <ButtonContainer>
75
66
  {visibleButtonsFirstRow.map((suggestion, i) => (
76
67
  <SuggestionButton
@@ -136,6 +127,6 @@ const SuggestionButtonContainer: React.FC<SuggestionButtonContainerProps> = ({
136
127
  )}
137
128
  </div>
138
129
  );
139
- }
130
+ };
140
131
 
141
132
  export { SuggestionButtonContainer };
@@ -1,6 +1,5 @@
1
- import { SuggestionButtonVariant } from "@envive-ai/react-hooks/contexts/types";
2
- import { TestProps } from "@envive-ai/react-hooks/types";
3
-
1
+ import { SuggestionButtonVariant } from '@envive-ai/react-hooks/contexts/types';
2
+ import { TestProps } from '@envive-ai/react-hooks/types';
4
3
 
5
4
  // SuggestionButtonContainer Props
6
5
  export interface SuggestionButtonContainerProps extends TestProps {
@@ -13,4 +12,4 @@ export interface SuggestionButtonContainerProps extends TestProps {
13
12
  twoRowsOnMobile?: boolean | undefined;
14
13
  animationSpeed?: 'standard' | 'slow' | 'none';
15
14
  buttonBorderRadius?: 'sm' | 'md' | 'lg';
16
- }
15
+ }
@@ -18,7 +18,7 @@ const meta = {
18
18
  productGridVariant: 'standard',
19
19
  searchBoxPlaceholder: '',
20
20
  widgetConfigId: '',
21
- type: WidgetType.SearchResultsEntryPoint
21
+ type: WidgetType.SearchResultsEntryPoint,
22
22
  },
23
23
  },
24
24
  } satisfies Meta<typeof SearchResults>;
@@ -30,11 +30,19 @@ const meta = {
30
30
  },
31
31
  searchZeroStateVariant: {
32
32
  control: 'select',
33
- options: ['backgroundTertiary', 'backgroundPrimary', 'backgroundSecondary', 'backgroundQuaternary'],
33
+ options: [
34
+ 'backgroundTertiary',
35
+ 'backgroundPrimary',
36
+ 'backgroundSecondary',
37
+ 'backgroundQuaternary',
38
+ ],
34
39
  },
35
40
  },
36
41
  render: (args: SearchEntryPointWidgetConfig & { initialIsOpen: boolean }) => (
37
- <SearchZeroState widgetConfig={{ ...args }} initialIsOpen={args.initialIsOpen} />
42
+ <SearchZeroState
43
+ widgetConfig={{ ...args }}
44
+ initialIsOpen={args.initialIsOpen}
45
+ />
38
46
  ),
39
47
  } satisfies Meta;
40
48
 
@@ -14,7 +14,7 @@ const meta: Meta<typeof SuggestionBar> = {
14
14
  options: ['none', 'standard', 'slow'],
15
15
  },
16
16
  },
17
- render: (args) => (
17
+ render: args => (
18
18
  <div style={{ width: '300px', height: '100px' }}>
19
19
  <SuggestionBar {...args} />
20
20
  </div>
@@ -35,7 +35,6 @@ export const Default: Story = {
35
35
  handleReply: () => {},
36
36
  boldFirstButton: false,
37
37
  },
38
-
39
38
  };
40
39
 
41
40
  export const Animated: Story = {
@@ -1,4 +1,4 @@
1
- import { useEffect, RefObject, useRef } from 'react';
1
+ import { RefObject, useEffect, useRef } from 'react';
2
2
  import { useReducedMotionWithOverride } from 'src/util/useReducedMotionWithOverride';
3
3
 
4
4
  // IMPORTANT: All refs passed to this hook must be mutable (not Readonly)