@envive-ai/react-toolkit 0.1.0 → 0.1.1

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 (151) hide show
  1. package/LICENSE +2 -0
  2. package/package.json +10 -7
  3. package/src/atoms/search/types.ts +5 -0
  4. package/src/components/common/ButtonBase/ButtonBase.tsx +70 -0
  5. package/src/components/common/ButtonBase/types.ts +27 -0
  6. package/src/components/common/Headline/Headline.tsx +81 -0
  7. package/src/components/common/ImageWithFallback/ImageWithFallback.tsx +66 -0
  8. package/src/components/common/ProductCard/ProductCard.tsx +305 -0
  9. package/src/components/common/ProductCard/ProductCardSkeleton.tsx +83 -0
  10. package/src/components/common/ProductCard/productCardVariants.ts +63 -0
  11. package/src/components/common/ProductCard/types.ts +49 -0
  12. package/src/components/common/ProductGrid/ProductGrid.tsx +73 -0
  13. package/src/components/common/ProductGrid/productGridVariants.ts +31 -0
  14. package/src/components/common/SparkleAnimation/SparkleAnimation.tsx +105 -0
  15. package/src/components/common/SparkleAnimation/types.ts +6 -0
  16. package/src/components/common/Spinner/Spinner.tsx +30 -0
  17. package/src/components/common/SuggestionButton/SuggestionButton.tsx +258 -0
  18. package/src/components/common/SuggestionButton/types.ts +14 -0
  19. package/src/components/common/Text/Text.tsx +58 -0
  20. package/src/components/common/Text/textVariantClasses.ts +106 -0
  21. package/src/components/common/Text/types.ts +23 -0
  22. package/src/components/common/TextInput/TextInput.tsx +34 -0
  23. package/src/components/models/colorsConfig.ts +28 -0
  24. package/src/components/search/FilterScrollbar/AppliedFiltersScrollbar.tsx +70 -0
  25. package/src/components/search/FilterScrollbar/DynamicFiltersScrollbar.tsx +52 -0
  26. package/src/components/search/SearchFilter/SearchFilter.tsx +84 -0
  27. package/src/components/search/SearchFilter/SearchFilterHeader.tsx +42 -0
  28. package/src/components/search/SearchFilter/SearchFilterItem.tsx +42 -0
  29. package/src/components/search/SearchFilter/types.ts +48 -0
  30. package/src/components/search/SearchInput/SearchInput.tsx +135 -0
  31. package/src/components/search/SearchInput/searchInputVariants.ts +27 -0
  32. package/src/components/search/SearchInputAutocomplete/SearchAutocomplete.tsx +62 -0
  33. package/src/components/search/SearchInputForm/SearchInputForm.tsx +66 -0
  34. package/src/components/search/SearchResultsFilterSidebar/SearchResultsFilter.tsx +82 -0
  35. package/src/components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants.ts +45 -0
  36. package/{dist/packages/components/src/components/search/SearchResultsFilterSidebar/types.d.ts → src/components/search/SearchResultsFilterSidebar/types.ts} +1 -1
  37. package/src/components/search/SearchResultsStates/NoSearchResultsFound.tsx +41 -0
  38. package/src/components/search/SearchResultsStates/SearchResultsGrid.tsx +105 -0
  39. package/src/components/search/SearchResultsStates/SearchResultsLoadingGrid.tsx +50 -0
  40. package/src/components/search/types.ts +5 -0
  41. package/{dist/packages/components/src/components/test/types.d.ts → src/components/test/types.ts} +1 -1
  42. package/src/config/chatElementDisplayLocation.ts +22 -0
  43. package/{dist/packages/components/src/index.js → src/index.ts} +10 -0
  44. package/src/logging/logger.ts +21 -0
  45. package/src/types/external.ts +24 -0
  46. package/{dist/packages/components/src/util/camelCase.d.ts → src/util/camelCase.ts} +33 -11
  47. package/src/util/camelCasedPropertiesDeep.ts +81 -0
  48. package/src/util/formatPrice.ts +14 -0
  49. package/src/util/internal.ts +95 -0
  50. package/{dist/packages/components/src/util/primitive.d.ts → src/util/primitive.ts} +2 -0
  51. package/src/util/splitWords.ts +72 -0
  52. package/{dist/packages/components/src/util/trim.d.ts → src/util/trim.ts} +5 -1
  53. package/dist/packages/components/src/atoms/search/types.d.ts +0 -5
  54. package/dist/packages/components/src/atoms/search/types.js +0 -1
  55. package/dist/packages/components/src/components/common/ButtonBase/ButtonBase.d.ts +0 -2
  56. package/dist/packages/components/src/components/common/ButtonBase/ButtonBase.js +0 -41
  57. package/dist/packages/components/src/components/common/ButtonBase/types.d.ts +0 -24
  58. package/dist/packages/components/src/components/common/ButtonBase/types.js +0 -6
  59. package/dist/packages/components/src/components/common/Headline/Headline.d.ts +0 -10
  60. package/dist/packages/components/src/components/common/Headline/Headline.js +0 -34
  61. package/dist/packages/components/src/components/common/ImageWithFallback/ImageWithFallback.d.ts +0 -12
  62. package/dist/packages/components/src/components/common/ImageWithFallback/ImageWithFallback.js +0 -26
  63. package/dist/packages/components/src/components/common/ProductCard/ProductCard.d.ts +0 -39
  64. package/dist/packages/components/src/components/common/ProductCard/ProductCard.js +0 -83
  65. package/dist/packages/components/src/components/common/ProductCard/ProductCardSkeleton.d.ts +0 -9
  66. package/dist/packages/components/src/components/common/ProductCard/ProductCardSkeleton.js +0 -15
  67. package/dist/packages/components/src/components/common/ProductCard/productCardVariants.d.ts +0 -8
  68. package/dist/packages/components/src/components/common/ProductCard/productCardVariants.js +0 -50
  69. package/dist/packages/components/src/components/common/ProductCard/types.d.ts +0 -39
  70. package/dist/packages/components/src/components/common/ProductCard/types.js +0 -10
  71. package/dist/packages/components/src/components/common/ProductGrid/ProductGrid.d.ts +0 -14
  72. package/dist/packages/components/src/components/common/ProductGrid/ProductGrid.js +0 -13
  73. package/dist/packages/components/src/components/common/ProductGrid/productGridVariants.d.ts +0 -10
  74. package/dist/packages/components/src/components/common/ProductGrid/productGridVariants.js +0 -16
  75. package/dist/packages/components/src/components/common/SparkleAnimation/SparkleAnimation.d.ts +0 -7
  76. package/dist/packages/components/src/components/common/SparkleAnimation/SparkleAnimation.js +0 -40
  77. package/dist/packages/components/src/components/common/SparkleAnimation/types.d.ts +0 -6
  78. package/dist/packages/components/src/components/common/SparkleAnimation/types.js +0 -7
  79. package/dist/packages/components/src/components/common/Spinner/Spinner.d.ts +0 -5
  80. package/dist/packages/components/src/components/common/Spinner/Spinner.js +0 -16
  81. package/dist/packages/components/src/components/common/SuggestionButton/SuggestionButton.d.ts +0 -18
  82. package/dist/packages/components/src/components/common/SuggestionButton/SuggestionButton.js +0 -210
  83. package/dist/packages/components/src/components/common/SuggestionButton/types.d.ts +0 -1
  84. package/dist/packages/components/src/components/common/SuggestionButton/types.js +0 -1
  85. package/dist/packages/components/src/components/common/Text/Text.d.ts +0 -12
  86. package/dist/packages/components/src/components/common/Text/Text.js +0 -26
  87. package/dist/packages/components/src/components/common/Text/textVariantClasses.d.ts +0 -171
  88. package/dist/packages/components/src/components/common/Text/textVariantClasses.js +0 -103
  89. package/dist/packages/components/src/components/common/Text/types.d.ts +0 -16
  90. package/dist/packages/components/src/components/common/Text/types.js +0 -6
  91. package/dist/packages/components/src/components/common/TextInput/TextInput.d.ts +0 -8
  92. package/dist/packages/components/src/components/common/TextInput/TextInput.js +0 -25
  93. package/dist/packages/components/src/components/models/colorsConfig.d.ts +0 -26
  94. package/dist/packages/components/src/components/models/colorsConfig.js +0 -23
  95. package/dist/packages/components/src/components/search/FilterScrollbar/AppliedFiltersScrollbar.d.ts +0 -11
  96. package/dist/packages/components/src/components/search/FilterScrollbar/AppliedFiltersScrollbar.js +0 -18
  97. package/dist/packages/components/src/components/search/FilterScrollbar/DynamicFiltersScrollbar.d.ts +0 -15
  98. package/dist/packages/components/src/components/search/FilterScrollbar/DynamicFiltersScrollbar.js +0 -15
  99. package/dist/packages/components/src/components/search/SearchFilter/SearchFilter.d.ts +0 -2
  100. package/dist/packages/components/src/components/search/SearchFilter/SearchFilter.js +0 -24
  101. package/dist/packages/components/src/components/search/SearchFilter/SearchFilterHeader.d.ts +0 -2
  102. package/dist/packages/components/src/components/search/SearchFilter/SearchFilterHeader.js +0 -9
  103. package/dist/packages/components/src/components/search/SearchFilter/SearchFilterItem.d.ts +0 -2
  104. package/dist/packages/components/src/components/search/SearchFilter/SearchFilterItem.js +0 -13
  105. package/dist/packages/components/src/components/search/SearchFilter/types.d.ts +0 -42
  106. package/dist/packages/components/src/components/search/SearchFilter/types.js +0 -1
  107. package/dist/packages/components/src/components/search/SearchInput/SearchInput.d.ts +0 -16
  108. package/dist/packages/components/src/components/search/SearchInput/SearchInput.js +0 -38
  109. package/dist/packages/components/src/components/search/SearchInput/searchInputVariants.d.ts +0 -13
  110. package/dist/packages/components/src/components/search/SearchInput/searchInputVariants.js +0 -12
  111. package/dist/packages/components/src/components/search/SearchInputAutocomplete/SearchAutocomplete.d.ts +0 -10
  112. package/dist/packages/components/src/components/search/SearchInputAutocomplete/SearchAutocomplete.js +0 -14
  113. package/dist/packages/components/src/components/search/SearchInputForm/SearchInputForm.d.ts +0 -16
  114. package/dist/packages/components/src/components/search/SearchInputForm/SearchInputForm.js +0 -13
  115. package/dist/packages/components/src/components/search/SearchInputForm/types.js +0 -1
  116. package/dist/packages/components/src/components/search/SearchResultsFilterSidebar/SearchResultsFilter.d.ts +0 -14
  117. package/dist/packages/components/src/components/search/SearchResultsFilterSidebar/SearchResultsFilter.js +0 -15
  118. package/dist/packages/components/src/components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants.d.ts +0 -16
  119. package/dist/packages/components/src/components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants.js +0 -29
  120. package/dist/packages/components/src/components/search/SearchResultsFilterSidebar/types.js +0 -1
  121. package/dist/packages/components/src/components/search/SearchResultsStates/NoSearchResultsFound.d.ts +0 -8
  122. package/dist/packages/components/src/components/search/SearchResultsStates/NoSearchResultsFound.js +0 -10
  123. package/dist/packages/components/src/components/search/SearchResultsStates/SearchResultsGrid.d.ts +0 -24
  124. package/dist/packages/components/src/components/search/SearchResultsStates/SearchResultsGrid.js +0 -19
  125. package/dist/packages/components/src/components/search/SearchResultsStates/SearchResultsLoadingGrid.d.ts +0 -6
  126. package/dist/packages/components/src/components/search/SearchResultsStates/SearchResultsLoadingGrid.js +0 -10
  127. package/dist/packages/components/src/components/search/types.d.ts +0 -5
  128. package/dist/packages/components/src/components/search/types.js +0 -6
  129. package/dist/packages/components/src/components/test/types.js +0 -1
  130. package/dist/packages/components/src/config/chatElementDisplayLocation.d.ts +0 -21
  131. package/dist/packages/components/src/config/chatElementDisplayLocation.js +0 -23
  132. package/dist/packages/components/src/index.d.ts +0 -45
  133. package/dist/packages/components/src/logging/logger.d.ts +0 -7
  134. package/dist/packages/components/src/logging/logger.js +0 -16
  135. package/dist/packages/components/src/types/external.d.ts +0 -21
  136. package/dist/packages/components/src/types/external.js +0 -5
  137. package/dist/packages/components/src/util/camelCase.js +0 -2
  138. package/dist/packages/components/src/util/camelCasedPropertiesDeep.d.ts +0 -53
  139. package/dist/packages/components/src/util/camelCasedPropertiesDeep.js +0 -1
  140. package/dist/packages/components/src/util/formatPrice.d.ts +0 -1
  141. package/dist/packages/components/src/util/formatPrice.js +0 -11
  142. package/dist/packages/components/src/util/internal.d.ts +0 -27
  143. package/dist/packages/components/src/util/internal.js +0 -4
  144. package/dist/packages/components/src/util/primitive.js +0 -2
  145. package/dist/packages/components/src/util/splitWords.d.ts +0 -55
  146. package/dist/packages/components/src/util/splitWords.js +0 -2
  147. package/dist/packages/components/src/util/trim.js +0 -2
  148. package/dist/packages/components/src/util/unknownArray.js +0 -1
  149. package/dist/tsconfig.tsbuildinfo +0 -1
  150. /package/{dist/packages/components/src/components/search/SearchInputForm/types.d.ts → src/components/search/SearchInputForm/types.ts} +0 -0
  151. /package/{dist/packages/components/src/util/unknownArray.d.ts → src/util/unknownArray.ts} +0 -0
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useRef, useImperativeHandle } from 'react';
3
- import classNames from 'classnames';
4
- import MagnifyingGlassStarVariant from '@envive/icons/src/MagnifyingGlassStarVariant';
5
- import CloseIcon from '@envive/icons/src/IconClose';
6
- import { TextInput } from '../../../../../../src/components/common/TextInput/TextInput';
7
- import { searchInputVariantClasses } from './searchInputVariants';
8
- export const SearchInput = React.forwardRef(({ searchInputVariant = 'standard', value, placeholder, suggestions, className, dataTestId, ariaActivedescendant, onKeyDown, onChange, onFocus, onBlur, }, ref) => {
9
- const localInputRef = useRef(null);
10
- const { searchInputClasses: inputClassName, searchInputIconColor: iconColor, searchInputBorderColor: borderColor, searchInputCloseIconClasses: closeIconClasses, searchInputActiveStarClasses, placeholderVariant, } = searchInputVariantClasses[searchInputVariant];
11
- // Expose the local ref through the forwarded ref
12
- useImperativeHandle(ref, () => localInputRef.current, []);
13
- const magnifyingGlassClassesBase = [
14
- 'spiffy-tw-w-[24px]',
15
- 'spiffy-tw-h-[32px]',
16
- 'spiffy-tw-stroke-width-1',
17
- 'sm:spiffy-tw-w-[32px]',
18
- ];
19
- const magnifyingGlassClassesInactive = classNames(magnifyingGlassClassesBase);
20
- const magnifyingGlassClassesActive = classNames([
21
- ...magnifyingGlassClassesBase,
22
- searchInputActiveStarClasses,
23
- ]);
24
- const containerClasses = classNames('spiffy-global-search-input-container', 'spiffy-tw-relative spiffy-tw-flex spiffy-tw-items-center', className);
25
- const inputClasses = classNames('spiffy-global-search-input', 'spiffy-tw-flex-grow spiffy-tw-p-2 spiffy-tw-px-[42px] sm:spiffy-tw-p-3 sm:spiffy-tw-px-[48px]', 'spiffy-tw-border', 'spiffy-tw-text-base', inputClassName);
26
- const closeButtonIconClassName = classNames([
27
- 'spiffy-tw-w-[16px]',
28
- 'spiffy-tw-h-[16px]',
29
- 'sm:spiffy-tw-w-[24px]',
30
- 'sm:spiffy-tw-h-[24px]',
31
- 'spiffy-tw-cursor-pointer',
32
- closeIconClasses,
33
- ]);
34
- return (_jsxs("div", { className: containerClasses, "data-testid": dataTestId, children: [_jsx("div", { className: "spiffy-tw-absolute spiffy-tw-left-3 spiffy-tw-top-1/2 spiffy-tw--translate-y-1/2", children: _jsx(MagnifyingGlassStarVariant, { className: value.length > 0 ? magnifyingGlassClassesActive : magnifyingGlassClassesInactive, stroke: iconColor, strokeWidth: "1px" }) }), _jsx(TextInput, { value: value, onChange: (event) => onChange(event.target.value), onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, placeholder: placeholder, className: inputClasses, placeholderVariant: placeholderVariant, "aria-label": "Search", "aria-autocomplete": "list", "aria-expanded": !!suggestions && suggestions.length > 0, "aria-controls": "autocomplete-results", "aria-activedescendant": ariaActivedescendant, borderRadius: "xl", borderColorClass: borderColor, ref: localInputRef }), value && (_jsx("button", { onClick: () => {
35
- onChange('');
36
- localInputRef.current?.focus();
37
- }, className: "spiffy-tw-absolute spiffy-tw-right-5 spiffy-tw-top-1/2 spiffy-tw--translate-y-1/2 spiffy-tw-text-neutral-500 hover:spiffy-tw-text-neutral-700", "aria-label": "Clear search input", type: "button", children: _jsx(CloseIcon, { className: closeButtonIconClassName }) }))] }));
38
- });
@@ -1,13 +0,0 @@
1
- import type { TextStyleVariantMap } from '../../../../../../src/components/common/Text/textVariantClasses';
2
- import type { SearchInputVariant } from '../SearchInputForm/types';
3
- interface SearchInputVariantClasses {
4
- searchInputIconColor: string;
5
- searchInputBorderColor: string;
6
- searchInputCloseIconClasses: string;
7
- searchInputActiveStarClasses: string;
8
- autocompleteIconColor: string;
9
- searchInputClasses: string;
10
- placeholderVariant: keyof typeof TextStyleVariantMap;
11
- }
12
- export declare const searchInputVariantClasses: Record<SearchInputVariant, SearchInputVariantClasses>;
13
- export {};
@@ -1,12 +0,0 @@
1
- import { ColorNames, colorVar } from '../../../../../../src/components/models/colorsConfig';
2
- export const searchInputVariantClasses = {
3
- standard: {
4
- searchInputIconColor: 'transparent', // colorVar(ColorNames.TextSecondary),
5
- searchInputBorderColor: 'spiffy-tw-border-[--spiffy-colors-border-medium]',
6
- searchInputCloseIconClasses: '[&>circle]:spiffy-tw-fill-[--spiffy-colors-text-secondary] [&>path]:spiffy-tw-fill-[#fff]',
7
- searchInputActiveStarClasses: `first:[&>path]:spiffy-tw-stroke-[--spiffy-colors-accent-primary] first:[&>path]:spiffy-tw-fill-[--spiffy-colors-accent-primary]`,
8
- autocompleteIconColor: colorVar(ColorNames.BackgroundPrimary),
9
- searchInputClasses: 'spiffy-tw-text-[--spiffy-colors-text-primary] placeholder:spiffy-tw-text-[--spiffy-colors-text-secondary] spiffy-tw-text-[16px] spiffy-tw-font-normal spiffy-tw-leading-[148%] placeholder:spiffy-tw-font-medium placeholder:spiffy-tw-leading-[124%]',
10
- placeholderVariant: 'h2',
11
- },
12
- };
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- interface GlobalSearchAutocompleteProps {
3
- id: string;
4
- results: string[];
5
- focusedIndex: number;
6
- onSuggestionSelect: (suggestion: string, rankPosition: number) => void;
7
- iconColor?: string;
8
- }
9
- export declare const SearchAutocomplete: React.FC<GlobalSearchAutocompleteProps>;
10
- export {};
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { motion } from 'framer-motion';
3
- import classNames from 'classnames';
4
- import OutlinedStar from '@envive/icons/src/OutlinedStar';
5
- export const SearchAutocomplete = ({ id, results, focusedIndex, onSuggestionSelect, iconColor, }) => {
6
- if (results.length === 0) {
7
- return null;
8
- }
9
- return (_jsx(motion.div, { className: "spiffy-tw-h-full", initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -10 }, transition: { duration: 0.2 }, children: _jsx("ul", { id: id, role: "listbox", className: "spiffy-tw-mt-4 spiffy-tw-space-y-2", children: results.map((result, index) => (_jsxs("li", { id: `option-${index}`, role: "option", "aria-selected": index === focusedIndex, className: classNames('spiffy-tw-flex spiffy-tw-items-center spiffy-tw-cursor-pointer spiffy-tw-py-1', { 'spiffy-tw-bg-neutral-200': index === focusedIndex }, 'hover:spiffy-tw-bg-neutral-100'), onClick: () => onSuggestionSelect(result, index), onKeyDown: (event) => {
10
- if (event.key === 'Enter' || event.keyCode === 13) {
11
- onSuggestionSelect(result, index);
12
- }
13
- }, children: [_jsx(OutlinedStar, { className: "spiffy-tw-w-[16px] spiffy-tw-h-[16px] spiffy-tw-mr-2", fill: iconColor }), _jsx("span", { className: "spiffy-tw-font-bold", children: result })] }, index))) }) }));
14
- };
@@ -1,16 +0,0 @@
1
- import type { SearchInputVariant } from './types';
2
- interface SearchInputFormProps {
3
- searchInputVariant: SearchInputVariant;
4
- searchText: string;
5
- autocompleteResults: string[];
6
- searchBoxPlaceholder: string;
7
- focusedOptionId: string | undefined;
8
- isDirty: boolean;
9
- focusedIndex: number;
10
- onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
11
- onAutocompleteSelect: (suggestion: string) => void;
12
- onSearchInputChange: (value: string) => void;
13
- onSearchSubmit: () => void;
14
- }
15
- export declare const SearchInputForm: ({ searchInputVariant, searchText, autocompleteResults, searchBoxPlaceholder, focusedOptionId, isDirty, focusedIndex, onKeyDown, onAutocompleteSelect, onSearchInputChange, onSearchSubmit, }: SearchInputFormProps) => import("react/jsx-runtime").JSX.Element;
16
- export {};
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { SearchAutocomplete } from '../SearchInputAutocomplete/SearchAutocomplete';
3
- import { searchInputVariantClasses } from '../SearchInput/searchInputVariants';
4
- import { SearchInput } from '../SearchInput/SearchInput';
5
- export const SearchInputForm = ({ searchInputVariant, searchText, autocompleteResults, searchBoxPlaceholder, focusedOptionId, isDirty, focusedIndex, onKeyDown, onAutocompleteSelect, onSearchInputChange, onSearchSubmit, }) => {
6
- const { searchInputIconColor } = searchInputVariantClasses[searchInputVariant];
7
- return (_jsxs(_Fragment, { children: [_jsx("form", { onSubmit: (e) => {
8
- e.preventDefault();
9
- onSearchSubmit();
10
- }, className: "spiffy-tw-grow", children: _jsx(SearchInput, { value: searchText, placeholder: searchBoxPlaceholder, suggestions: autocompleteResults, ariaActivedescendant: focusedOptionId, searchInputVariant: searchInputVariant,
11
- // dataTestId={SEARCH_INPUT_TESTID}
12
- onKeyDown: onKeyDown, onChange: onSearchInputChange }) }), isDirty && (_jsx(SearchAutocomplete, { id: "autocomplete-results", results: autocompleteResults, focusedIndex: focusedIndex, iconColor: searchInputIconColor, onSuggestionSelect: onAutocompleteSelect }))] }));
13
- };
@@ -1,14 +0,0 @@
1
- import type { SearchFilter as SearchFilterType, SelectFilterItem } from '../SearchFilter/types';
2
- import type { SearchFilterSidebarVariant } from './types';
3
- export type SearchResultsFilterProps = {
4
- productCount: number;
5
- isOpen: boolean;
6
- setIsOpen: (isOpen: boolean) => void;
7
- searchFilters: SearchFilterType[];
8
- searchFilterSidebarVariant: SearchFilterSidebarVariant;
9
- searchText: string;
10
- onSelectFilterItem: SelectFilterItem;
11
- onClearAllFilters: () => void;
12
- filterButtonText: string;
13
- };
14
- export declare const SearchResultsFilter: ({ productCount, isOpen, setIsOpen, searchFilters, searchFilterSidebarVariant, onSelectFilterItem, onClearAllFilters, filterButtonText, }: SearchResultsFilterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback } from 'react';
3
- import { SearchFilter } from '../SearchFilter/SearchFilter';
4
- import { SearchFilterHeader } from '../SearchFilter/SearchFilterHeader';
5
- import { searchFilterSidebarVariantClasses } from './searchFilterSidebarVariants';
6
- import { ButtonBase } from '../../../../../../src/components/common/ButtonBase/ButtonBase';
7
- export const SearchResultsFilter = ({ productCount, isOpen, setIsOpen, searchFilters, searchFilterSidebarVariant, onSelectFilterItem, onClearAllFilters, filterButtonText, }) => {
8
- const { applyFiltersUnchangedClasses, applyFiltersChangedClasses, searchFilterHeaderClasses, radioButtonFillColor, radioButtonHoverColor, radioButtonUncheckedBorderColor, filterCloseIconVariant, } = searchFilterSidebarVariantClasses[searchFilterSidebarVariant];
9
- const openFilter = useCallback(() => {
10
- setIsOpen(true);
11
- }, [setIsOpen]);
12
- return (_jsxs(_Fragment, { children: [_jsx(SearchFilter, { isOpen: isOpen, setIsOpen: setIsOpen, filters: searchFilters, productCount: productCount, selectFilterItem: onSelectFilterItem, clearAllFilters: onClearAllFilters, applyFiltersUnchangedClasses: applyFiltersUnchangedClasses, applyFiltersChangedClasses: applyFiltersChangedClasses, filterButtonText: filterButtonText, radioButtonFillColor: radioButtonFillColor, radioButtonHoverColor: radioButtonHoverColor, radioButtonUncheckedBorderColor: radioButtonUncheckedBorderColor, filterCloseIconVariant: filterCloseIconVariant, headerContent: _jsx(SearchFilterHeader, { closeModal: () => setIsOpen(false), productCount: productCount, headerClassName: searchFilterHeaderClasses, filterCloseIconVariant: filterCloseIconVariant }) }), _jsx(ButtonBase, { onClick: openFilter,
13
- // icon={SettingsVariant} // Icon is handled by user
14
- iconClass: "spiffy-tw-w-[28px] spiffy-tw-h-[28px] spiffy-tw-object-center", text: filterButtonText, textClass: "spiffy-tw-uppercase spiffy-tw-text-[--spiffy-colors-text-primary] spiffy-tw-hidden md:spiffy-tw-block", buttonClass: "spiffy-tw-flex-row spiffy-tw-pl-[16px] sm:spiffy-tw-pl-0 sm:spiffy-tw-px-4 sm:spiffy-tw-gap-[8px]", disablePadding: true })] }));
15
- };
@@ -1,16 +0,0 @@
1
- import type { SearchFilterSidebarVariant, CloseIconVariant } from './types';
2
- interface SearchFilterSidebarVariantClasses {
3
- searchFilterHeaderClasses: string;
4
- radioButtonFillColor: string;
5
- radioButtonHoverColor: string;
6
- radioButtonUncheckedBorderColor: string;
7
- filterDefaultClasses: string;
8
- filterActiveClasses: string;
9
- filterHoverClasses: string;
10
- appliedFilterBackgroundClasses: string;
11
- applyFiltersUnchangedClasses: string;
12
- applyFiltersChangedClasses: string;
13
- filterCloseIconVariant: CloseIconVariant;
14
- }
15
- export declare const searchFilterSidebarVariantClasses: Record<SearchFilterSidebarVariant, SearchFilterSidebarVariantClasses>;
16
- export {};
@@ -1,29 +0,0 @@
1
- import { ColorNames, colorVar } from '../../../../../../src/components/models/colorsConfig';
2
- export const searchFilterSidebarVariantClasses = {
3
- darkButton: {
4
- radioButtonFillColor: colorVar(ColorNames.BackgroundDark),
5
- radioButtonHoverColor: colorVar(ColorNames.BackgroundSecondaryDark),
6
- radioButtonUncheckedBorderColor: colorVar(ColorNames.BorderMedium),
7
- searchFilterHeaderClasses: 'spiffy-tw-text-[--spiffy-colors-text-light]',
8
- filterDefaultClasses: 'spiffy-tw-border-[--spiffy-colors-border-medium] spiffy-tw-bg-[--spiffy-colors-background-light] spiffy-tw-text-[--spiffy-colors-text-secondary]',
9
- filterHoverClasses: 'hover:spiffy-tw-border-[--spiffy-colors-background-secondary-dark] hover:spiffy-tw-bg-[--spiffy-colors-background-secondary-dark] hover:spiffy-tw-text-[--spiffy-colors-text-primary]',
10
- filterActiveClasses: 'spiffy-tw-border-[--spiffy-colors-border-outline] spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light]',
11
- appliedFilterBackgroundClasses: 'spiffy-tw-bg-[--spiffy-colors-border-light]',
12
- applyFiltersUnchangedClasses: 'spiffy-tw-bg-[--spiffy-colors-border-light] spiffy-tw-text-[--spiffy-colors-text-secondary]',
13
- applyFiltersChangedClasses: 'spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light]',
14
- filterCloseIconVariant: 'light',
15
- },
16
- lightButton: {
17
- radioButtonFillColor: colorVar(ColorNames.BackgroundDark),
18
- radioButtonHoverColor: colorVar(ColorNames.BackgroundSecondaryDark),
19
- radioButtonUncheckedBorderColor: colorVar(ColorNames.BorderMedium),
20
- searchFilterHeaderClasses: 'spiffy-tw-text-[--spiffy-colors-text-primary]',
21
- filterDefaultClasses: 'spiffy-tw-border-[--spiffy-colors-border-medium] spiffy-tw-bg-[--spiffy-colors-background-light] spiffy-tw-text-[--spiffy-colors-text-secondary]',
22
- filterHoverClasses: 'hover:spiffy-tw-border-[--spiffy-colors-background-secondary-dark] hover:spiffy-tw-bg-[--spiffy-colors-background-secondary-dark] hover:spiffy-tw-text-[--spiffy-colors-text-primary]',
23
- filterActiveClasses: 'spiffy-tw-border-[--spiffy-colors-border-outline] spiffy-tw-bg-[--spiffy-colors-background-dark] spiffy-tw-text-[--spiffy-colors-text-light]',
24
- appliedFilterBackgroundClasses: 'spiffy-tw-bg-[--spiffy-colors-border-light]',
25
- applyFiltersUnchangedClasses: 'spiffy-tw-bg-[--spiffy-colors-border-light] spiffy-tw-text-[--spiffy-colors-text-secondary]',
26
- applyFiltersChangedClasses: 'spiffy-tw-bg-[--spiffy-colors-background-primary] spiffy-tw-text-[--spiffy-colors-text-link]',
27
- filterCloseIconVariant: 'dark',
28
- },
29
- };
@@ -1,8 +0,0 @@
1
- interface NoSearchResultsFoundProps {
2
- containerPaddingClasses: string;
3
- includeBottomMargin?: boolean;
4
- noResultsFoundText?: string;
5
- sparkleIconColor?: string;
6
- }
7
- export declare const NoSearchResultsFound: ({ containerPaddingClasses, includeBottomMargin, noResultsFoundText, sparkleIconColor, }: NoSearchResultsFoundProps) => import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import classNames from 'classnames';
3
- import Sparkles from '@envive/icons/src/Sparkles';
4
- import { Text } from '../../../../../../src/components/common/Text/Text';
5
- export const NoSearchResultsFound = ({ containerPaddingClasses, includeBottomMargin = false, noResultsFoundText, sparkleIconColor = 'var(--spiffy-colors-accent-primary)', }) => {
6
- const containerClasses = classNames(containerPaddingClasses, includeBottomMargin ? 'spiffy-tw-mb-[100vh]' : '', 'spiffy-tw-mt-6');
7
- const textPrompt = noResultsFoundText ||
8
- 'I’m sorry, I wasn’t able to find an exact match. Try changing your filters or adjusting your search query.';
9
- return (_jsx("div", { className: containerClasses, children: _jsxs("div", { className: "spiffy-tw-flex spiffy-tw-items-start spiffy-tw-gap-2", children: [_jsx("div", { children: _jsx(Sparkles, { className: "spiffy-tw-w-[24px] spiffy-tw-h-[24px]", style: { color: sparkleIconColor } }) }), _jsx(Text, { variant: "body2", children: textPrompt })] }) }));
10
- };
@@ -1,24 +0,0 @@
1
- import type { SelectedFilterOption } from '../../../../../../src/atoms/search/types';
2
- import type { SearchResponseProduct } from '../../../../../../src/types/external';
3
- import type { SearchFilterSidebarVariant } from '../SearchResultsFilterSidebar/types';
4
- import { ProductGridVariant } from '../../../../../../src/components/common/ProductCard/types';
5
- interface SearchResultsGridProps {
6
- productList: SearchResponseProduct[];
7
- availableDynamicFilters: {
8
- name: string;
9
- displayName: string;
10
- }[];
11
- searchFilterSidebarVariant: SearchFilterSidebarVariant;
12
- productGridVariant: ProductGridVariant;
13
- selectedFilterOptions: SelectedFilterOption[];
14
- searchResponseId: string;
15
- containerXPaddingClasses: string;
16
- productGridClasses: string;
17
- onRemoveFilter: (filter: SelectedFilterOption) => void;
18
- onToggleDynamicFilter: ({ filter, dynamicFilterDisplayName, }: {
19
- filter: string;
20
- dynamicFilterDisplayName: string;
21
- }) => void;
22
- }
23
- export declare const SearchResultsGrid: ({ productList, availableDynamicFilters, searchFilterSidebarVariant, productGridVariant, selectedFilterOptions, searchResponseId, containerXPaddingClasses, productGridClasses, onRemoveFilter, onToggleDynamicFilter, }: SearchResultsGridProps) => import("react/jsx-runtime").JSX.Element;
24
- export {};
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { motion } from 'framer-motion';
3
- import classNames from 'classnames';
4
- import { ProductGrid } from '../../../../../../src/components/common/ProductGrid/ProductGrid';
5
- import { AppliedFiltersScrollbar } from '../FilterScrollbar/AppliedFiltersScrollbar';
6
- import { DynamicFiltersScrollbar } from '../FilterScrollbar/DynamicFiltersScrollbar';
7
- import { searchFilterSidebarVariantClasses } from '../SearchResultsFilterSidebar/searchFilterSidebarVariants';
8
- export const SearchResultsGrid = ({ productList, availableDynamicFilters, searchFilterSidebarVariant, productGridVariant, selectedFilterOptions, searchResponseId, containerXPaddingClasses, productGridClasses, onRemoveFilter, onToggleDynamicFilter, }) => {
9
- const sharedFilterBarClasses = classNames('spiffy-suggestion-bar', 'spiffy-tw-no-scrollbar', 'spiffy-tw-flex', 'spiffy-tw-flex-row', 'spiffy-tw-gap-2', 'spiffy-tw-mb-[16px]', 'spiffy-tw-overflow-x-scroll', containerXPaddingClasses);
10
- const filterBarClasses = classNames(sharedFilterBarClasses, 'spiffy-tw-mt-[24px]');
11
- const appliedFilterBarClasses = classNames(sharedFilterBarClasses, 'spiffy-tw-mb-[32px]', 'spiffy-tw-mt-[8px]');
12
- const {
13
- // We may want to pull these into their own variant separated from the filter sidebar (but also used in it) In this case, we need them for dynamic filters
14
- filterDefaultClasses, filterHoverClasses, appliedFilterBackgroundClasses, } = searchFilterSidebarVariantClasses[searchFilterSidebarVariant];
15
- return (_jsxs(motion.div, { className: "spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: [_jsx(AppliedFiltersScrollbar, { selectedFilterOptions: selectedFilterOptions, filterBarClassNames: appliedFilterBarClasses, filterDefaultClasses: filterDefaultClasses, filterHoverClasses: filterHoverClasses, appliedFilterBackgroundClasses: appliedFilterBackgroundClasses, onRemoveFilter: onRemoveFilter }), _jsx(DynamicFiltersScrollbar, { availableDynamicFilters: availableDynamicFilters, filterBarClassNames: filterBarClasses, filterDefaultClasses: filterDefaultClasses, filterHoverClasses: filterHoverClasses, onToggleDynamicFilter: onToggleDynamicFilter }), _jsx(ProductGrid, { productList: productList, productGridVariant: productGridVariant, productGridClasses: productGridClasses, searchResponseId: searchResponseId, merchantShortName: '', handleClick: function (clickedUrl) {
16
- console.log(clickedUrl);
17
- throw new Error('Function not implemented.');
18
- } })] }));
19
- };
@@ -1,6 +0,0 @@
1
- import { ProductGridVariant } from '../../../../../../src/components/common/ProductCard/types';
2
- export declare const SearchResultsLoadingGrid: ({ productGridVariant, productGridClasses, sparkleIconColor, }: {
3
- productGridVariant: ProductGridVariant;
4
- productGridClasses: string;
5
- sparkleIconColor?: string;
6
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Text } from '../../../../../../src/components/common/Text/Text';
3
- import { SparkleAnimation } from '../../../../../../src/components/common/SparkleAnimation/SparkleAnimation';
4
- import { motion } from 'framer-motion';
5
- import { ProductCardSkeleton } from '../../../../../../src/components/common/ProductCard/ProductCardSkeleton';
6
- import { productGridVariantClasses } from '../../../../../../src/components/common/ProductGrid/productGridVariants';
7
- export const SearchResultsLoadingGrid = ({ productGridVariant, productGridClasses, sparkleIconColor = 'var(--spiffy-colors-accent-primary)', }) => {
8
- const { productCardLayoutVariant, productCardImageAspectRatio } = productGridVariantClasses[productGridVariant];
9
- return (_jsx(motion.div, { className: "spiffy-tw-justify-center spiffy-tw-w-full spiffy-tw-overflow-hidden", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: _jsxs("div", { className: "spiffy-tw-mt-6 spiffy-tw-w-full", children: [_jsx("div", { className: "spiffy-tw-flex spiffy-tw-items-center spiffy-tw-justify-between spiffy-tw-mb-4", children: _jsxs("div", { className: "spiffy-tw-flex spiffy-tw-items-center spiffy-tw-gap-2 spiffy-tw-ml-[16px] md:spiffy-tw-ml-[80px]", children: [_jsx("div", { className: "spiffy-tw-width-[24px]", children: _jsx(SparkleAnimation, { color: sparkleIconColor, animate: true }) }), _jsx(Text, { variant: "body2", children: "Finding the best options for you..." })] }) }), _jsx("div", { className: productGridClasses, children: Array.from({ length: 8 }).map((_, index) => (_jsx(ProductCardSkeleton, { layoutVariant: productCardLayoutVariant, aspectRatio: productCardImageAspectRatio, growWithContainer: true }, index))) })] }) }));
10
- };
@@ -1,5 +0,0 @@
1
- export declare enum SearchResultsState {
2
- NoResults = "noResults",
3
- Results = "results",
4
- Loading = "loading"
5
- }
@@ -1,6 +0,0 @@
1
- export var SearchResultsState;
2
- (function (SearchResultsState) {
3
- SearchResultsState["NoResults"] = "noResults";
4
- SearchResultsState["Results"] = "results";
5
- SearchResultsState["Loading"] = "loading";
6
- })(SearchResultsState || (SearchResultsState = {}));
@@ -1 +0,0 @@
1
- export {};
@@ -1,21 +0,0 @@
1
- export declare enum ChatElementDisplayLocation {
2
- IN_CHAT = "in_chat",
3
- CHAT_PREVIEW = "chat_preview",
4
- FLOATING_BUTTON = "floating_button",
5
- HELP_ME_CHOOSE = "help_me_choose",
6
- PLP_IMAGE_BANNER = "plp_image_banner",
7
- TOP_REVIEWS_SNIPPET = "top_reviews_snippet",
8
- BOTTOM_REVIEWS_SNIPPET = "bottom_reviews_snippet",
9
- BLOCK_BACK_BUTTON = "block_back_button",
10
- SWITCH_TO_AGENT = "switch_to_agent",
11
- CONVERSATIONAL_SEARCH = "conversational_search",
12
- GLOBAL_SEARCH_ENTRYPOINT = "global_search_entrypoint",
13
- SEARCH_NAV_ENTRYPOINT = "search_nav_entrypoint",
14
- SEARCH_PROMPT = "search_prompt",
15
- SEARCH_PROMPT_BUTTON = "search_prompt_button",
16
- PRODUCT_GRID = "product_grid",
17
- UNSPECIFIED = "unspecified",
18
- FILTER_MODAL = "filter_modal",
19
- PROMPT_CARD = "prompt_card",
20
- WINDOW_API_CALL = "window_api_call"
21
- }
@@ -1,23 +0,0 @@
1
- // Chat element display location enum
2
- export var ChatElementDisplayLocation;
3
- (function (ChatElementDisplayLocation) {
4
- ChatElementDisplayLocation["IN_CHAT"] = "in_chat";
5
- ChatElementDisplayLocation["CHAT_PREVIEW"] = "chat_preview";
6
- ChatElementDisplayLocation["FLOATING_BUTTON"] = "floating_button";
7
- ChatElementDisplayLocation["HELP_ME_CHOOSE"] = "help_me_choose";
8
- ChatElementDisplayLocation["PLP_IMAGE_BANNER"] = "plp_image_banner";
9
- ChatElementDisplayLocation["TOP_REVIEWS_SNIPPET"] = "top_reviews_snippet";
10
- ChatElementDisplayLocation["BOTTOM_REVIEWS_SNIPPET"] = "bottom_reviews_snippet";
11
- ChatElementDisplayLocation["BLOCK_BACK_BUTTON"] = "block_back_button";
12
- ChatElementDisplayLocation["SWITCH_TO_AGENT"] = "switch_to_agent";
13
- ChatElementDisplayLocation["CONVERSATIONAL_SEARCH"] = "conversational_search";
14
- ChatElementDisplayLocation["GLOBAL_SEARCH_ENTRYPOINT"] = "global_search_entrypoint";
15
- ChatElementDisplayLocation["SEARCH_NAV_ENTRYPOINT"] = "search_nav_entrypoint";
16
- ChatElementDisplayLocation["SEARCH_PROMPT"] = "search_prompt";
17
- ChatElementDisplayLocation["SEARCH_PROMPT_BUTTON"] = "search_prompt_button";
18
- ChatElementDisplayLocation["PRODUCT_GRID"] = "product_grid";
19
- ChatElementDisplayLocation["UNSPECIFIED"] = "unspecified";
20
- ChatElementDisplayLocation["FILTER_MODAL"] = "filter_modal";
21
- ChatElementDisplayLocation["PROMPT_CARD"] = "prompt_card";
22
- ChatElementDisplayLocation["WINDOW_API_CALL"] = "window_api_call";
23
- })(ChatElementDisplayLocation || (ChatElementDisplayLocation = {}));
@@ -1,45 +0,0 @@
1
- export { ButtonBase } from './components/common/ButtonBase/ButtonBase';
2
- export { Headline } from './components/common/Headline/Headline';
3
- export { ImageWithFallback } from './components/common/ImageWithFallback/ImageWithFallback';
4
- export { ProductCard } from './components/common/ProductCard/ProductCard';
5
- export { ProductCardSkeleton } from './components/common/ProductCard/ProductCardSkeleton';
6
- export { ProductGrid } from './components/common/ProductGrid/ProductGrid';
7
- export { SparkleAnimation } from './components/common/SparkleAnimation/SparkleAnimation';
8
- export { Spinner } from './components/common/Spinner/Spinner';
9
- export { SuggestionButton } from './components/common/SuggestionButton/SuggestionButton';
10
- export { Text } from './components/common/Text/Text';
11
- export { TextInput } from './components/common/TextInput/TextInput';
12
- export { AppliedFiltersScrollbar } from './components/search/FilterScrollbar/AppliedFiltersScrollbar';
13
- export { DynamicFiltersScrollbar } from './components/search/FilterScrollbar/DynamicFiltersScrollbar';
14
- export { SearchFilter } from './components/search/SearchFilter/SearchFilter';
15
- export { SearchFilterHeader } from './components/search/SearchFilter/SearchFilterHeader';
16
- export { SearchFilterItem } from './components/search/SearchFilter/SearchFilterItem';
17
- export { SearchInput } from './components/search/SearchInput/SearchInput';
18
- export { SearchAutocomplete } from './components/search/SearchInputAutocomplete/SearchAutocomplete';
19
- export { SearchInputForm } from './components/search/SearchInputForm/SearchInputForm';
20
- export { SearchResultsFilter } from './components/search/SearchResultsFilterSidebar/SearchResultsFilter';
21
- export { NoSearchResultsFound } from './components/search/SearchResultsStates/NoSearchResultsFound';
22
- export { SearchResultsGrid } from './components/search/SearchResultsStates/SearchResultsGrid';
23
- export { SearchResultsLoadingGrid } from './components/search/SearchResultsStates/SearchResultsLoadingGrid';
24
- export * from './util/camelCase';
25
- export * from './util/camelCasedPropertiesDeep';
26
- export * from './util/formatPrice';
27
- export * from './util/internal';
28
- export * from './util/primitive';
29
- export * from './util/splitWords';
30
- export * from './util/trim';
31
- export * from './util/unknownArray';
32
- export * from './components/common/ButtonBase/types';
33
- export * from './components/common/ProductCard/types';
34
- export * from './components/common/SparkleAnimation/types';
35
- export * from './components/common/SuggestionButton/types';
36
- export * from './components/common/Text/types';
37
- export type { HeadlineProps, HeadlineVariant } from './components/common/Text/types';
38
- export * from './components/search/types';
39
- export * from './components/search/SearchFilter/types';
40
- export * from './components/search/SearchInputForm/types';
41
- export type { SearchFilterSidebarVariant, CloseIconVariant as CloseIconVariantType, } from './components/search/SearchResultsFilterSidebar/types';
42
- export * from './atoms/search/types';
43
- export { ChatElementDisplayLocation } from './config/chatElementDisplayLocation';
44
- export { productGridVariantClasses } from './components/common/ProductGrid/productGridVariants';
45
- export { searchFilterSidebarVariantClasses } from './components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants';
@@ -1,7 +0,0 @@
1
- declare class Logger {
2
- static logInfo(message: string, ...args: unknown[]): void;
3
- static logDebug(message: string, ...args: unknown[]): void;
4
- static logError(message: string, error: unknown | undefined, ...args: unknown[]): void;
5
- static logWarn(message: string, error: unknown | undefined, ...args: unknown[]): void;
6
- }
7
- export default Logger;
@@ -1,16 +0,0 @@
1
- /* eslint-disable no-console */
2
- class Logger {
3
- static logInfo(message, ...args) {
4
- console.info(`INFO: ${message}`, ...args);
5
- }
6
- static logDebug(message, ...args) {
7
- console.debug(`DEBUG: ${message}`, ...args);
8
- }
9
- static logError(message, error, ...args) {
10
- console.error(`ERROR: ${message} error=${error}`, args);
11
- }
12
- static logWarn(message, error, ...args) {
13
- console.warn(`WARN: ${message} error=${error}`, args);
14
- }
15
- }
16
- export default Logger;
@@ -1,21 +0,0 @@
1
- export declare enum ResponseCategory {
2
- Product = "product"
3
- }
4
- export interface SearchResponseProduct {
5
- id: string;
6
- title: string;
7
- description?: string;
8
- price?: number;
9
- currency?: string;
10
- imageUrl?: string;
11
- brand?: string;
12
- category?: string;
13
- availability?: string;
14
- url?: string;
15
- responseId?: string;
16
- originalPrice?: number;
17
- salePrice?: number;
18
- averageRating?: number;
19
- numberReviews?: number;
20
- [key: string]: unknown;
21
- }
@@ -1,5 +0,0 @@
1
- // Local type definitions for external dependencies that may not be available
2
- export var ResponseCategory;
3
- (function (ResponseCategory) {
4
- ResponseCategory["Product"] = "product";
5
- })(ResponseCategory || (ResponseCategory = {}));
@@ -1,2 +0,0 @@
1
- // these types come from https://github.com/sindresorhus/type-fest/blob/main/source/camel-case.d.ts
2
- export {};
@@ -1,53 +0,0 @@
1
- import type { CamelCase, CamelCaseOptions } from './camelCase';
2
- import type { UnknownArray } from './unknownArray';
3
- /**
4
- * Convert object properties to camel case recursively.
5
- *
6
- * This can be useful when, for example, converting some API types from a different style.
7
- *
8
- * @see CamelCasedProperties
9
- * @see CamelCase
10
- *
11
- * @example
12
- * ```
13
- * import type {CamelCasedPropertiesDeep} from 'type-fest';
14
- *
15
- * interface User {
16
- * UserId: number;
17
- * UserName: string;
18
- * }
19
- *
20
- * interface UserWithFriends {
21
- * UserInfo: User;
22
- * UserFriends: User[];
23
- * }
24
- *
25
- * const result: CamelCasedPropertiesDeep<UserWithFriends> = {
26
- * userInfo: {
27
- * userId: 1,
28
- * userName: 'Tom',
29
- * },
30
- * userFriends: [
31
- * {
32
- * userId: 2,
33
- * userName: 'Jerry',
34
- * },
35
- * {
36
- * userId: 3,
37
- * userName: 'Spike',
38
- * },
39
- * ],
40
- * };
41
- * ```
42
- *
43
- * @category Change case
44
- * @category Template literal
45
- * @category Object
46
- */
47
- export type CamelCasedPropertiesDeep<Value, Options extends CamelCaseOptions = {
48
- preserveConsecutiveUppercase: true;
49
- }> = Value extends Function ? Value : Value extends UnknownArray ? CamelCasedPropertiesArrayDeep<Value> : Value extends Set<infer U> ? Set<CamelCasedPropertiesDeep<U, Options>> : {
50
- [K in keyof Value as CamelCase<K, Options>]: CamelCasedPropertiesDeep<Value[K], Options>;
51
- };
52
- type CamelCasedPropertiesArrayDeep<Value extends UnknownArray> = Value extends [] ? [] : Value extends [infer U, ...infer V] ? [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>] : Value extends readonly [infer U, ...infer V] ? readonly [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>] : Value extends readonly [...infer U, infer V] ? [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>] : Value extends readonly [...infer U, infer V] ? readonly [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>] : Value extends Array<infer U> ? Array<CamelCasedPropertiesDeep<U>> : Value extends ReadonlyArray<infer U> ? ReadonlyArray<CamelCasedPropertiesDeep<U>> : never;
53
- export {};
@@ -1 +0,0 @@
1
- export declare const formatPrice: (price?: number, currency?: string) => string;
@@ -1,11 +0,0 @@
1
- export const formatPrice = (price, currency = '$') => {
2
- if (price == null) {
3
- return '';
4
- }
5
- const options = {};
6
- if (!Number.isInteger(price)) {
7
- options.minimumFractionDigits = 2;
8
- options.maximumFractionDigits = 2;
9
- }
10
- return `${currency}${price.toLocaleString('en-US', options)}`;
11
- };
@@ -1,27 +0,0 @@
1
- import type { Primitive } from './primitive';
2
- import type { Trim } from './trim';
3
- /**
4
- * Matches any primitive, `void`, `Date`, or `RegExp` value.
5
- */
6
- export type BuiltIns = Primitive | void | Date | RegExp;
7
- /**
8
- * Matches non-recursive types.
9
- */
10
- export type NonRecursiveType = BuiltIns | Function | (new (...arguments_: any[]) => unknown);
11
- /**
12
- * Returns a boolean for whether the string is numeric.
13
- *
14
- * This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987).
15
- */
16
- export type IsNumeric<T extends string> = T extends `${number}` ? Trim<T> extends T ? true : false : false;
17
- /**
18
- * Returns a boolean for whether the string is lowercased.
19
- */
20
- export type IsLowerCase<T extends string> = T extends Lowercase<T> ? true : false;
21
- /**
22
- * Returns a boolean for whether the string is upper-cased.
23
- */
24
- export type IsUpperCase<T extends string> = T extends Uppercase<T> ? true : false;
25
- export type WordSeparators = '-' | '_' | Whitespace;
26
- export type Whitespace = '\u{9}' | '\u{A}' | '\u{B}' | '\u{C}' | '\u{D}' | '\u{20}' | '\u{85}' | '\u{A0}' | '\u{1680}' | '\u{2000}' | '\u{2001}' | '\u{2002}' | '\u{2003}' | '\u{2004}' | '\u{2005}' | '\u{2006}' | '\u{2007}' | '\u{2008}' | '\u{2009}' | '\u{200A}' | '\u{2028}' | '\u{2029}' | '\u{202F}' | '\u{205F}' | '\u{3000}' | '\u{FEFF}';
27
- export type UpperCaseCharacters = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
@@ -1,4 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-unsafe-function-type */
3
- // these types come from https://github.com/sindresorhus/type-fest/blob/main/source/internal.d.ts
4
- export {};
@@ -1,2 +0,0 @@
1
- // this type comes from https://github.com/sindresorhus/type-fest/blob/main/source/primitive.d.ts
2
- export {};