@envive-ai/react-toolkit 0.1.1 → 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.
- package/dist/AppliedFiltersScrollbar-BlcyhZkZ.cjs +53 -0
- package/dist/AppliedFiltersScrollbar-DFGzRemu.js +44 -0
- package/dist/ButtonBase-C1rsL9gO.js +60 -0
- package/dist/ButtonBase-a8uj6c2f.cjs +69 -0
- package/dist/DynamicFiltersScrollbar-B2Rr1KnJ.cjs +41 -0
- package/dist/DynamicFiltersScrollbar-Dys6geP0.js +32 -0
- package/dist/Headline-L7w3BsBF.cjs +72 -0
- package/dist/Headline-ro_Nigw5.js +64 -0
- package/dist/ImageWithFallback-CfmkC58B.js +42 -0
- package/dist/ImageWithFallback-P3AjyL2Y.cjs +51 -0
- package/dist/ProductCard-Btg8tHGc.js +172 -0
- package/dist/ProductCard-CS6DZAwO.cjs +193 -0
- package/dist/ProductCardSkeleton-BPfp6IOp.js +38 -0
- package/dist/ProductCardSkeleton-BgvDlaty.cjs +46 -0
- package/dist/ProductGrid-B7QZfW-v.cjs +77 -0
- package/dist/ProductGrid-DB_Uq5F-.js +69 -0
- package/dist/SearchAutocomplete-C5FL82xC.js +51 -0
- package/dist/SearchAutocomplete-wr18dJ8L.cjs +62 -0
- package/dist/SearchFilter-D-2IdBKS.js +62 -0
- package/dist/SearchFilter-D0IzBlG5.cjs +70 -0
- package/dist/SearchFilterHeader-BQT0-ssS.js +37 -0
- package/dist/SearchFilterHeader-C3EklfoO.cjs +45 -0
- package/dist/SearchFilterItem-BodtWLoP.js +26 -0
- package/dist/SearchFilterItem-DmMkiqNC.cjs +34 -0
- package/dist/SearchInput-BrcAgcvI.js +89 -0
- package/dist/SearchInput-DSB9CwIq.cjs +106 -0
- package/dist/SparkleAnimation-BpLwrEqM.cjs +96 -0
- package/dist/SparkleAnimation-CXs58sFd.js +85 -0
- package/dist/Spinner-BZ-kTOpm.js +38 -0
- package/dist/Spinner-CfQ85Ajl.cjs +46 -0
- package/dist/Text-Bdv7F5-u.js +42 -0
- package/dist/Text-C04c4Z93.cjs +50 -0
- package/dist/TextInput-BO80ixsV.cjs +40 -0
- package/dist/TextInput-CEGWfdPC.js +31 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/colorsConfig-TCONYTQ7.cjs +38 -0
- package/dist/colorsConfig-l0ODUVhu.js +26 -0
- package/dist/common/ButtonBase/ButtonBase.cjs +5 -0
- package/dist/common/ButtonBase/ButtonBase.d.cts +35 -0
- package/dist/common/ButtonBase/ButtonBase.d.ts +35 -0
- package/dist/common/ButtonBase/ButtonBase.js +5 -0
- package/dist/common/Headline/Headline.cjs +4 -0
- package/dist/common/Headline/Headline.d.cts +21 -0
- package/dist/common/Headline/Headline.d.ts +21 -0
- package/dist/common/Headline/Headline.js +4 -0
- package/dist/common/ImageWithFallback/ImageWithFallback.cjs +3 -0
- package/dist/common/ImageWithFallback/ImageWithFallback.d.cts +26 -0
- package/dist/common/ImageWithFallback/ImageWithFallback.d.ts +26 -0
- package/dist/common/ImageWithFallback/ImageWithFallback.js +3 -0
- package/dist/common/ProductCard/ProductCard.cjs +11 -0
- package/dist/common/ProductCard/ProductCard.d.cts +91 -0
- package/dist/common/ProductCard/ProductCard.d.ts +91 -0
- package/dist/common/ProductCard/ProductCard.js +9 -0
- package/dist/common/ProductCard/ProductCardSkeleton.cjs +4 -0
- package/dist/common/ProductCard/ProductCardSkeleton.d.cts +12 -0
- package/dist/common/ProductCard/ProductCardSkeleton.d.ts +12 -0
- package/dist/common/ProductCard/ProductCardSkeleton.js +4 -0
- package/dist/common/ProductGrid/ProductGrid.cjs +11 -0
- package/dist/common/ProductGrid/ProductGrid.d.cts +26 -0
- package/dist/common/ProductGrid/ProductGrid.d.ts +26 -0
- package/dist/common/ProductGrid/ProductGrid.js +11 -0
- package/dist/common/SparkleAnimation/SparkleAnimation.cjs +3 -0
- package/dist/common/SparkleAnimation/SparkleAnimation.d.cts +15 -0
- package/dist/common/SparkleAnimation/SparkleAnimation.d.ts +15 -0
- package/dist/common/SparkleAnimation/SparkleAnimation.js +3 -0
- package/dist/common/Spinner/Spinner.cjs +3 -0
- package/dist/common/Spinner/Spinner.d.cts +11 -0
- package/dist/common/Spinner/Spinner.d.ts +11 -0
- package/dist/common/Spinner/Spinner.js +3 -0
- package/dist/common/SuggestionButton/SuggestionButton.cjs +188 -0
- package/dist/common/SuggestionButton/SuggestionButton.d.cts +35 -0
- package/dist/common/SuggestionButton/SuggestionButton.d.ts +35 -0
- package/dist/common/SuggestionButton/SuggestionButton.js +180 -0
- package/dist/common/Text/Text.cjs +4 -0
- package/dist/common/Text/Text.d.cts +28 -0
- package/dist/common/Text/Text.d.ts +28 -0
- package/dist/common/Text/Text.js +4 -0
- package/dist/common/TextInput/TextInput.cjs +4 -0
- package/dist/common/TextInput/TextInput.d.cts +98 -0
- package/dist/common/TextInput/TextInput.d.ts +98 -0
- package/dist/common/TextInput/TextInput.js +4 -0
- package/dist/productCardVariants-C_QIZ-KF.js +45 -0
- package/dist/productCardVariants-Dd-wrJKP.cjs +69 -0
- package/dist/productGridVariants-CxCKx5Fq.js +20 -0
- package/dist/productGridVariants-DVzvjK9i.cjs +26 -0
- package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.cjs +5 -0
- package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.d.cts +22 -0
- package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.d.ts +22 -0
- package/dist/search/FilterScrollbar/AppliedFiltersScrollbar.js +5 -0
- package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.cjs +5 -0
- package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.d.cts +28 -0
- package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.d.ts +28 -0
- package/dist/search/FilterScrollbar/DynamicFiltersScrollbar.js +5 -0
- package/dist/search/SearchFilter/SearchFilter.cjs +7 -0
- package/dist/search/SearchFilter/SearchFilter.d.cts +18 -0
- package/dist/search/SearchFilter/SearchFilter.d.ts +18 -0
- package/dist/search/SearchFilter/SearchFilter.js +7 -0
- package/dist/search/SearchFilter/SearchFilterHeader.cjs +5 -0
- package/dist/search/SearchFilter/SearchFilterHeader.d.cts +12 -0
- package/dist/search/SearchFilter/SearchFilterHeader.d.ts +12 -0
- package/dist/search/SearchFilter/SearchFilterHeader.js +5 -0
- package/dist/search/SearchFilter/SearchFilterItem.cjs +5 -0
- package/dist/search/SearchFilter/SearchFilterItem.d.cts +13 -0
- package/dist/search/SearchFilter/SearchFilterItem.d.ts +13 -0
- package/dist/search/SearchFilter/SearchFilterItem.js +5 -0
- package/dist/search/SearchInput/SearchInput.cjs +6 -0
- package/dist/search/SearchInput/SearchInput.d.cts +20 -0
- package/dist/search/SearchInput/SearchInput.d.ts +20 -0
- package/dist/search/SearchInput/SearchInput.js +6 -0
- package/dist/search/SearchInputAutocomplete/SearchAutocomplete.cjs +3 -0
- package/dist/search/SearchInputAutocomplete/SearchAutocomplete.d.cts +13 -0
- package/dist/search/SearchInputAutocomplete/SearchAutocomplete.d.ts +13 -0
- package/dist/search/SearchInputAutocomplete/SearchAutocomplete.js +3 -0
- package/dist/search/SearchInputForm/SearchInputForm.cjs +38 -0
- package/dist/search/SearchInputForm/SearchInputForm.d.cts +32 -0
- package/dist/search/SearchInputForm/SearchInputForm.d.ts +32 -0
- package/dist/search/SearchInputForm/SearchInputForm.js +36 -0
- package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.cjs +52 -0
- package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.d.cts +28 -0
- package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.d.ts +28 -0
- package/dist/search/SearchResultsFilterSidebar/SearchResultsFilter.js +49 -0
- package/dist/search/SearchResultsStates/NoSearchResultsFound.cjs +30 -0
- package/dist/search/SearchResultsStates/NoSearchResultsFound.d.cts +17 -0
- package/dist/search/SearchResultsStates/NoSearchResultsFound.d.ts +17 -0
- package/dist/search/SearchResultsStates/NoSearchResultsFound.js +26 -0
- package/dist/search/SearchResultsStates/SearchResultsGrid.cjs +66 -0
- package/dist/search/SearchResultsStates/SearchResultsGrid.d.cts +41 -0
- package/dist/search/SearchResultsStates/SearchResultsGrid.d.ts +41 -0
- package/dist/search/SearchResultsStates/SearchResultsGrid.js +62 -0
- package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.cjs +52 -0
- package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.d.cts +15 -0
- package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.d.ts +15 -0
- package/dist/search/SearchResultsStates/SearchResultsLoadingGrid.js +49 -0
- package/dist/searchFilterSidebarVariants-GfFbQzGf.cjs +39 -0
- package/dist/searchFilterSidebarVariants-lJVVZT_2.js +34 -0
- package/dist/textVariantClasses-5t3OricK.js +101 -0
- package/dist/textVariantClasses-Bhf4VY5z.cjs +125 -0
- package/dist/types-53zIialA.d.ts +35 -0
- package/dist/types-B4BGZSlV.d.cts +4 -0
- package/dist/types-BQNqA5xL.d.ts +46 -0
- package/dist/types-BRLWwGMI.d.ts +4 -0
- package/dist/types-CImLkcNh.d.cts +46 -0
- package/dist/types-Cph97xkm.d.ts +6 -0
- package/dist/types-CpiJO5UH.d.ts +4 -0
- package/dist/types-DFetqNL2.d.ts +8 -0
- package/dist/types-DaSkJnT_.d.cts +8 -0
- package/dist/types-Dy4_w6Cf.d.cts +4 -0
- package/dist/types-TYhhwWZw.d.cts +6 -0
- package/dist/types-aa4flfRE.d.cts +35 -0
- package/package.json +8 -8
- package/src/components/common/ButtonBase/ButtonBase.tsx +2 -2
- package/src/components/common/ButtonBase/types.ts +2 -3
- package/dist/src/atoms/search/types.d.ts +0 -5
- package/dist/src/atoms/search/types.js +0 -1
- package/dist/src/components/common/ButtonBase/ButtonBase.d.ts +0 -2
- package/dist/src/components/common/ButtonBase/ButtonBase.js +0 -41
- package/dist/src/components/common/ButtonBase/types.d.ts +0 -24
- package/dist/src/components/common/ButtonBase/types.js +0 -6
- package/dist/src/components/common/Headline/Headline.d.ts +0 -10
- package/dist/src/components/common/Headline/Headline.js +0 -34
- package/dist/src/components/common/ImageWithFallback/ImageWithFallback.d.ts +0 -12
- package/dist/src/components/common/ImageWithFallback/ImageWithFallback.js +0 -26
- package/dist/src/components/common/ProductCard/ProductCard.d.ts +0 -39
- package/dist/src/components/common/ProductCard/ProductCard.js +0 -84
- package/dist/src/components/common/ProductCard/ProductCardSkeleton.d.ts +0 -9
- package/dist/src/components/common/ProductCard/ProductCardSkeleton.js +0 -15
- package/dist/src/components/common/ProductCard/productCardVariants.d.ts +0 -8
- package/dist/src/components/common/ProductCard/productCardVariants.js +0 -50
- package/dist/src/components/common/ProductCard/types.d.ts +0 -39
- package/dist/src/components/common/ProductCard/types.js +0 -10
- package/dist/src/components/common/ProductGrid/ProductGrid.d.ts +0 -14
- package/dist/src/components/common/ProductGrid/ProductGrid.js +0 -13
- package/dist/src/components/common/ProductGrid/productGridVariants.d.ts +0 -10
- package/dist/src/components/common/ProductGrid/productGridVariants.js +0 -16
- package/dist/src/components/common/SparkleAnimation/SparkleAnimation.d.ts +0 -7
- package/dist/src/components/common/SparkleAnimation/SparkleAnimation.js +0 -40
- package/dist/src/components/common/SparkleAnimation/types.d.ts +0 -6
- package/dist/src/components/common/SparkleAnimation/types.js +0 -7
- package/dist/src/components/common/Spinner/Spinner.d.ts +0 -5
- package/dist/src/components/common/Spinner/Spinner.js +0 -16
- package/dist/src/components/common/SuggestionButton/SuggestionButton.d.ts +0 -18
- package/dist/src/components/common/SuggestionButton/SuggestionButton.js +0 -210
- package/dist/src/components/common/SuggestionButton/types.d.ts +0 -1
- package/dist/src/components/common/SuggestionButton/types.js +0 -1
- package/dist/src/components/common/Text/Text.d.ts +0 -12
- package/dist/src/components/common/Text/Text.js +0 -26
- package/dist/src/components/common/Text/textVariantClasses.d.ts +0 -171
- package/dist/src/components/common/Text/textVariantClasses.js +0 -103
- package/dist/src/components/common/Text/types.d.ts +0 -16
- package/dist/src/components/common/Text/types.js +0 -6
- package/dist/src/components/common/TextInput/TextInput.d.ts +0 -8
- package/dist/src/components/common/TextInput/TextInput.js +0 -25
- package/dist/src/components/models/colorsConfig.d.ts +0 -26
- package/dist/src/components/models/colorsConfig.js +0 -23
- package/dist/src/components/search/FilterScrollbar/AppliedFiltersScrollbar.d.ts +0 -11
- package/dist/src/components/search/FilterScrollbar/AppliedFiltersScrollbar.js +0 -18
- package/dist/src/components/search/FilterScrollbar/DynamicFiltersScrollbar.d.ts +0 -15
- package/dist/src/components/search/FilterScrollbar/DynamicFiltersScrollbar.js +0 -15
- package/dist/src/components/search/SearchFilter/SearchFilter.d.ts +0 -2
- package/dist/src/components/search/SearchFilter/SearchFilter.js +0 -24
- package/dist/src/components/search/SearchFilter/SearchFilterHeader.d.ts +0 -2
- package/dist/src/components/search/SearchFilter/SearchFilterHeader.js +0 -9
- package/dist/src/components/search/SearchFilter/SearchFilterItem.d.ts +0 -2
- package/dist/src/components/search/SearchFilter/SearchFilterItem.js +0 -13
- package/dist/src/components/search/SearchFilter/types.d.ts +0 -42
- package/dist/src/components/search/SearchFilter/types.js +0 -1
- package/dist/src/components/search/SearchInput/SearchInput.d.ts +0 -16
- package/dist/src/components/search/SearchInput/SearchInput.js +0 -38
- package/dist/src/components/search/SearchInput/searchInputVariants.d.ts +0 -13
- package/dist/src/components/search/SearchInput/searchInputVariants.js +0 -12
- package/dist/src/components/search/SearchInputAutocomplete/SearchAutocomplete.d.ts +0 -10
- package/dist/src/components/search/SearchInputAutocomplete/SearchAutocomplete.js +0 -14
- package/dist/src/components/search/SearchInputForm/SearchInputForm.d.ts +0 -16
- package/dist/src/components/search/SearchInputForm/SearchInputForm.js +0 -13
- package/dist/src/components/search/SearchInputForm/types.d.ts +0 -1
- package/dist/src/components/search/SearchInputForm/types.js +0 -1
- package/dist/src/components/search/SearchResultsFilterSidebar/SearchResultsFilter.d.ts +0 -14
- package/dist/src/components/search/SearchResultsFilterSidebar/SearchResultsFilter.js +0 -15
- package/dist/src/components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants.d.ts +0 -16
- package/dist/src/components/search/SearchResultsFilterSidebar/searchFilterSidebarVariants.js +0 -29
- package/dist/src/components/search/SearchResultsFilterSidebar/types.d.ts +0 -2
- package/dist/src/components/search/SearchResultsFilterSidebar/types.js +0 -1
- package/dist/src/components/search/SearchResultsStates/NoSearchResultsFound.d.ts +0 -8
- package/dist/src/components/search/SearchResultsStates/NoSearchResultsFound.js +0 -10
- package/dist/src/components/search/SearchResultsStates/SearchResultsGrid.d.ts +0 -24
- package/dist/src/components/search/SearchResultsStates/SearchResultsGrid.js +0 -19
- package/dist/src/components/search/SearchResultsStates/SearchResultsLoadingGrid.d.ts +0 -6
- package/dist/src/components/search/SearchResultsStates/SearchResultsLoadingGrid.js +0 -10
- package/dist/src/components/search/types.d.ts +0 -5
- package/dist/src/components/search/types.js +0 -6
- package/dist/src/components/test/types.d.ts +0 -3
- package/dist/src/components/test/types.js +0 -1
- package/dist/src/config/chatElementDisplayLocation.d.ts +0 -21
- package/dist/src/config/chatElementDisplayLocation.js +0 -23
- package/dist/src/index.d.ts +0 -45
- package/dist/src/index.js +0 -49
- package/dist/src/logging/logger.d.ts +0 -7
- package/dist/src/logging/logger.js +0 -16
- package/dist/src/types/external.d.ts +0 -21
- package/dist/src/types/external.js +0 -5
- package/dist/src/util/camelCase.d.ts +0 -65
- package/dist/src/util/camelCase.js +0 -2
- package/dist/src/util/camelCasedPropertiesDeep.d.ts +0 -53
- package/dist/src/util/camelCasedPropertiesDeep.js +0 -1
- package/dist/src/util/formatPrice.d.ts +0 -1
- package/dist/src/util/formatPrice.js +0 -11
- package/dist/src/util/internal.d.ts +0 -27
- package/dist/src/util/internal.js +0 -4
- package/dist/src/util/primitive.d.ts +0 -6
- package/dist/src/util/primitive.js +0 -2
- package/dist/src/util/splitWords.d.ts +0 -55
- package/dist/src/util/splitWords.js +0 -2
- package/dist/src/util/trim.d.ts +0 -24
- package/dist/src/util/trim.js +0 -2
- package/dist/src/util/unknownArray.d.ts +0 -25
- package/dist/src/util/unknownArray.js +0 -1
- package/src/index.ts +0 -59
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Text } from "./Text-Bdv7F5-u.js";
|
|
2
|
+
import { Headline } from "./Headline-ro_Nigw5.js";
|
|
3
|
+
import { ImageWithFallback } from "./ImageWithFallback-CfmkC58B.js";
|
|
4
|
+
import { productCardLayoutVariantClasses, variantClassMap, variantHoverClassMap, variantTitleColorMap } from "./productCardVariants-C_QIZ-KF.js";
|
|
5
|
+
import { Spinner } from "./Spinner-BZ-kTOpm.js";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { MdStar } from "react-icons/md";
|
|
9
|
+
|
|
10
|
+
//#region src/logging/logger.ts
|
|
11
|
+
var Logger = class {
|
|
12
|
+
static logInfo(message, ...args) {
|
|
13
|
+
console.info(`INFO: ${message}`, ...args);
|
|
14
|
+
}
|
|
15
|
+
static logDebug(message, ...args) {
|
|
16
|
+
console.debug(`DEBUG: ${message}`, ...args);
|
|
17
|
+
}
|
|
18
|
+
static logError(message, error, ...args) {
|
|
19
|
+
console.error(`ERROR: ${message} error=${error}`, args);
|
|
20
|
+
}
|
|
21
|
+
static logWarn(message, error, ...args) {
|
|
22
|
+
console.warn(`WARN: ${message} error=${error}`, args);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var logger_default = Logger;
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/util/formatPrice.ts
|
|
29
|
+
const formatPrice = (price, currency = "$") => {
|
|
30
|
+
if (price == null) return "";
|
|
31
|
+
const options = {};
|
|
32
|
+
if (!Number.isInteger(price)) {
|
|
33
|
+
options.minimumFractionDigits = 2;
|
|
34
|
+
options.maximumFractionDigits = 2;
|
|
35
|
+
}
|
|
36
|
+
return `${currency}${price.toLocaleString("en-US", options)}`;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/components/common/ProductCard/ProductCard.tsx
|
|
41
|
+
const formatReviews = (stars) => String(Number(stars).toLocaleString("en-US", {
|
|
42
|
+
minimumFractionDigits: 1,
|
|
43
|
+
maximumFractionDigits: 1
|
|
44
|
+
}));
|
|
45
|
+
const RatingSummary = ({ stars, reviewCount, className }) => {
|
|
46
|
+
const group = classNames("spiffy-product-card-rating", "spiffy-product-card-text-color", "spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-items-center", "spiffy-tw-gap-1", "spiffy-tw-text-[--spiffy-colors-text-primary]", "spiffy-tw-tracking-[0.8px]");
|
|
47
|
+
const starClassnames = classNames("spiffy-product-card-rating-star-color", "spiffy-tw-fill-[--spiffy-colors-accent-primary]", "spiffy-tw-w-[14px]", "spiffy-tw-h-[14px]");
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className,
|
|
50
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
51
|
+
className: group,
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx(MdStar, { className: starClassnames }),
|
|
54
|
+
/* @__PURE__ */ jsx(Text, {
|
|
55
|
+
variant: "body3",
|
|
56
|
+
children: formatReviews(stars)
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
59
|
+
variant: "body3",
|
|
60
|
+
children: [
|
|
61
|
+
"(",
|
|
62
|
+
reviewCount,
|
|
63
|
+
")"
|
|
64
|
+
]
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const PriceSection = ({ originalPrice, salePrice, pricePrefix }) => {
|
|
71
|
+
if (!originalPrice) return null;
|
|
72
|
+
const priceClassName = classNames("spiffy-product-card-price", "spiffy-product-card-text-color", "spiffy-tw-font-regular", "spiffy-tw-flex", "spiffy-tw-flex-wrap", "spiffy-tw-gap-1", "spiffy-tw-text-sm", "spiffy-tw-font-[400]", "spiffy-tw-leading-[100%]", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-text-[--spiffy-colors-text-primary]");
|
|
73
|
+
const showSalePrice = salePrice && originalPrice !== salePrice;
|
|
74
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
75
|
+
className: priceClassName,
|
|
76
|
+
children: [
|
|
77
|
+
pricePrefix && /* @__PURE__ */ jsx(Text, { children: pricePrefix }),
|
|
78
|
+
showSalePrice && /* @__PURE__ */ jsx(Text, { children: salePrice }),
|
|
79
|
+
/* @__PURE__ */ jsx(Text, {
|
|
80
|
+
className: showSalePrice ? "spiffy-tw-line-through" : "",
|
|
81
|
+
children: originalPrice
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const ProductCard = ({ productCardConfig, merchantShortName, imageUrl, title, url, originalPrice, averageRating, numberReviews, salePrice, variant, hoverVariant, dataTestId, layoutVariant = "normal", zoomOnHover = false, aspectRatio = "none", growWithContainer = false, handleClick }) => {
|
|
87
|
+
const finalVariant = variant ?? productCardConfig?.variant ?? "filled";
|
|
88
|
+
const finalHoverVariant = hoverVariant ?? productCardConfig?.hoverVariant ?? "backgroundDark";
|
|
89
|
+
const finalLayoutVariant = layoutVariant ?? productCardConfig?.layoutVariant ?? "normal";
|
|
90
|
+
const pricePrefix = productCardConfig?.pricePrefix;
|
|
91
|
+
if (productCardConfig == null) {
|
|
92
|
+
logger_default.logError("[ProductCard] productCardConfig is null", void 0, { merchant: merchantShortName });
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const layoutClasses = productCardLayoutVariantClasses[finalLayoutVariant];
|
|
96
|
+
const containerClassnames = classNames("spiffy-tw-cursor-pointer", "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-overflow-hidden", {
|
|
97
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
98
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
99
|
+
"spiffy-tw-max-w-full": growWithContainer
|
|
100
|
+
}, !growWithContainer && layoutClasses.container, variantClassMap.get(finalVariant) ?? [], variantHoverClassMap.get(finalHoverVariant) ?? []);
|
|
101
|
+
const verticalContainerVariantClasses = productCardLayoutVariantClasses[layoutVariant].verticalContainer;
|
|
102
|
+
const verticalContainerClassnames = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", {
|
|
103
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
104
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
105
|
+
"spiffy-tw-flex-1": growWithContainer
|
|
106
|
+
}, ...!growWithContainer && layoutVariant ? verticalContainerVariantClasses : []);
|
|
107
|
+
const linkClassnames = classNames({
|
|
108
|
+
"spiffy-tw-w-full": true,
|
|
109
|
+
"spiffy-tw-h-full": true,
|
|
110
|
+
"spiffy-tw-overflow-hidden": true,
|
|
111
|
+
"spiffy-tw-select-none": true
|
|
112
|
+
});
|
|
113
|
+
const imageClipContainerClassnames = classNames("spiffy-tw-w-full", "spiffy-tw-overflow-hidden", {
|
|
114
|
+
"spiffy-tw-flex-shrink-0": growWithContainer,
|
|
115
|
+
"spiffy-tw-tw-h-full": !growWithContainer
|
|
116
|
+
}, aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "");
|
|
117
|
+
const imageContainerClassnames = classNames(linkClassnames, zoomOnHover ? [
|
|
118
|
+
"spiffy-tw-transition-transform",
|
|
119
|
+
"spiffy-tw-duration-200",
|
|
120
|
+
"spiffy-tw-origin-top",
|
|
121
|
+
"hover:spiffy-tw-scale-105"
|
|
122
|
+
] : []);
|
|
123
|
+
const contentClassnames = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-p-2", "spiffy-tw-pr-2", "spiffy-tw-items-start", "spiffy-tw-justify-end", { "spiffy-tw-flex-grow-0": layoutVariant === "tall" || layoutVariant === "square" });
|
|
124
|
+
const productTitleClassnames = classNames("spiffy-tw-line-clamp-2", "spiffy-tw-overflow-clip", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-whitespace-normal", "spiffy-tw-normal-case", variantTitleColorMap.get(finalVariant) ?? "spiffy-tw-text-[--spiffy-colors-text-primary]", ...layoutClasses.productTitle);
|
|
125
|
+
const priceAndRatingContainerClassnames = classNames("spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-justify-between", "spiffy-tw-items-center", "spiffy-tw-w-full", "spiffy-tw-pt-2", "spiffy-tw-gap-2");
|
|
126
|
+
const imageClassnames = classNames("spiffy-tw-bg-transparent", "spiffy-tw-w-full", "spiffy-tw-h-full", "spiffy-tw-object-cover", "spiffy-tw-object-top", "spiffy-tw-select-none", "spiffy-tw-pointer-events-none");
|
|
127
|
+
return /* @__PURE__ */ jsx("div", {
|
|
128
|
+
className: containerClassnames,
|
|
129
|
+
"data-testid": dataTestId,
|
|
130
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
131
|
+
href: url,
|
|
132
|
+
onClick: () => handleClick(url || ""),
|
|
133
|
+
target: "_self",
|
|
134
|
+
draggable: false,
|
|
135
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
136
|
+
className: verticalContainerClassnames,
|
|
137
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
138
|
+
className: imageClipContainerClassnames,
|
|
139
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: imageContainerClassnames,
|
|
141
|
+
children: imageUrl && /* @__PURE__ */ jsx(ImageWithFallback, {
|
|
142
|
+
src: imageUrl,
|
|
143
|
+
alt: title,
|
|
144
|
+
fallback: /* @__PURE__ */ jsx(Spinner, { className: "spiffy-tw-w-6 spiffy-tw-h-6" }),
|
|
145
|
+
imageClassnames
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
149
|
+
className: contentClassnames,
|
|
150
|
+
children: [/* @__PURE__ */ jsx(Headline, {
|
|
151
|
+
variant: "h4",
|
|
152
|
+
className: productTitleClassnames,
|
|
153
|
+
children: title
|
|
154
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
155
|
+
className: priceAndRatingContainerClassnames,
|
|
156
|
+
children: [(originalPrice || salePrice) && /* @__PURE__ */ jsx(PriceSection, {
|
|
157
|
+
originalPrice: formatPrice(originalPrice),
|
|
158
|
+
salePrice: formatPrice(salePrice),
|
|
159
|
+
pricePrefix
|
|
160
|
+
}), averageRating && numberReviews && /* @__PURE__ */ jsx(RatingSummary, {
|
|
161
|
+
stars: averageRating,
|
|
162
|
+
reviewCount: numberReviews
|
|
163
|
+
})]
|
|
164
|
+
})]
|
|
165
|
+
})]
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
export { PriceSection, ProductCard, RatingSummary };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_Text = require('./Text-C04c4Z93.cjs');
|
|
3
|
+
const require_Headline = require('./Headline-L7w3BsBF.cjs');
|
|
4
|
+
const require_ImageWithFallback = require('./ImageWithFallback-P3AjyL2Y.cjs');
|
|
5
|
+
const require_productCardVariants = require('./productCardVariants-Dd-wrJKP.cjs');
|
|
6
|
+
const require_Spinner = require('./Spinner-CfQ85Ajl.cjs');
|
|
7
|
+
let classnames = require("classnames");
|
|
8
|
+
classnames = require_chunk.__toESM(classnames);
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
11
|
+
let react_icons_md = require("react-icons/md");
|
|
12
|
+
react_icons_md = require_chunk.__toESM(react_icons_md);
|
|
13
|
+
|
|
14
|
+
//#region src/logging/logger.ts
|
|
15
|
+
var Logger = class {
|
|
16
|
+
static logInfo(message, ...args) {
|
|
17
|
+
console.info(`INFO: ${message}`, ...args);
|
|
18
|
+
}
|
|
19
|
+
static logDebug(message, ...args) {
|
|
20
|
+
console.debug(`DEBUG: ${message}`, ...args);
|
|
21
|
+
}
|
|
22
|
+
static logError(message, error, ...args) {
|
|
23
|
+
console.error(`ERROR: ${message} error=${error}`, args);
|
|
24
|
+
}
|
|
25
|
+
static logWarn(message, error, ...args) {
|
|
26
|
+
console.warn(`WARN: ${message} error=${error}`, args);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var logger_default = Logger;
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/util/formatPrice.ts
|
|
33
|
+
const formatPrice = (price, currency = "$") => {
|
|
34
|
+
if (price == null) return "";
|
|
35
|
+
const options = {};
|
|
36
|
+
if (!Number.isInteger(price)) {
|
|
37
|
+
options.minimumFractionDigits = 2;
|
|
38
|
+
options.maximumFractionDigits = 2;
|
|
39
|
+
}
|
|
40
|
+
return `${currency}${price.toLocaleString("en-US", options)}`;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components/common/ProductCard/ProductCard.tsx
|
|
45
|
+
const formatReviews = (stars) => String(Number(stars).toLocaleString("en-US", {
|
|
46
|
+
minimumFractionDigits: 1,
|
|
47
|
+
maximumFractionDigits: 1
|
|
48
|
+
}));
|
|
49
|
+
const RatingSummary = ({ stars, reviewCount, className }) => {
|
|
50
|
+
const group = (0, classnames.default)("spiffy-product-card-rating", "spiffy-product-card-text-color", "spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-items-center", "spiffy-tw-gap-1", "spiffy-tw-text-[--spiffy-colors-text-primary]", "spiffy-tw-tracking-[0.8px]");
|
|
51
|
+
const starClassnames = (0, classnames.default)("spiffy-product-card-rating-star-color", "spiffy-tw-fill-[--spiffy-colors-accent-primary]", "spiffy-tw-w-[14px]", "spiffy-tw-h-[14px]");
|
|
52
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
53
|
+
className,
|
|
54
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
55
|
+
className: group,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_icons_md.MdStar, { className: starClassnames }),
|
|
58
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
59
|
+
variant: "body3",
|
|
60
|
+
children: formatReviews(stars)
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Text.Text, {
|
|
63
|
+
variant: "body3",
|
|
64
|
+
children: [
|
|
65
|
+
"(",
|
|
66
|
+
reviewCount,
|
|
67
|
+
")"
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const PriceSection = ({ originalPrice, salePrice, pricePrefix }) => {
|
|
75
|
+
if (!originalPrice) return null;
|
|
76
|
+
const priceClassName = (0, classnames.default)("spiffy-product-card-price", "spiffy-product-card-text-color", "spiffy-tw-font-regular", "spiffy-tw-flex", "spiffy-tw-flex-wrap", "spiffy-tw-gap-1", "spiffy-tw-text-sm", "spiffy-tw-font-[400]", "spiffy-tw-leading-[100%]", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-text-[--spiffy-colors-text-primary]");
|
|
77
|
+
const showSalePrice = salePrice && originalPrice !== salePrice;
|
|
78
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
79
|
+
className: priceClassName,
|
|
80
|
+
children: [
|
|
81
|
+
pricePrefix && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, { children: pricePrefix }),
|
|
82
|
+
showSalePrice && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, { children: salePrice }),
|
|
83
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
84
|
+
className: showSalePrice ? "spiffy-tw-line-through" : "",
|
|
85
|
+
children: originalPrice
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
const ProductCard = ({ productCardConfig, merchantShortName, imageUrl, title, url, originalPrice, averageRating, numberReviews, salePrice, variant, hoverVariant, dataTestId, layoutVariant = "normal", zoomOnHover = false, aspectRatio = "none", growWithContainer = false, handleClick }) => {
|
|
91
|
+
const finalVariant = variant ?? productCardConfig?.variant ?? "filled";
|
|
92
|
+
const finalHoverVariant = hoverVariant ?? productCardConfig?.hoverVariant ?? "backgroundDark";
|
|
93
|
+
const finalLayoutVariant = layoutVariant ?? productCardConfig?.layoutVariant ?? "normal";
|
|
94
|
+
const pricePrefix = productCardConfig?.pricePrefix;
|
|
95
|
+
if (productCardConfig == null) {
|
|
96
|
+
logger_default.logError("[ProductCard] productCardConfig is null", void 0, { merchant: merchantShortName });
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const layoutClasses = require_productCardVariants.productCardLayoutVariantClasses[finalLayoutVariant];
|
|
100
|
+
const containerClassnames = (0, classnames.default)("spiffy-tw-cursor-pointer", "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-overflow-hidden", {
|
|
101
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
102
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
103
|
+
"spiffy-tw-max-w-full": growWithContainer
|
|
104
|
+
}, !growWithContainer && layoutClasses.container, require_productCardVariants.variantClassMap.get(finalVariant) ?? [], require_productCardVariants.variantHoverClassMap.get(finalHoverVariant) ?? []);
|
|
105
|
+
const verticalContainerVariantClasses = require_productCardVariants.productCardLayoutVariantClasses[layoutVariant].verticalContainer;
|
|
106
|
+
const verticalContainerClassnames = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", {
|
|
107
|
+
"spiffy-tw-h-full": growWithContainer,
|
|
108
|
+
"spiffy-tw-w-full": growWithContainer,
|
|
109
|
+
"spiffy-tw-flex-1": growWithContainer
|
|
110
|
+
}, ...!growWithContainer && layoutVariant ? verticalContainerVariantClasses : []);
|
|
111
|
+
const linkClassnames = (0, classnames.default)({
|
|
112
|
+
"spiffy-tw-w-full": true,
|
|
113
|
+
"spiffy-tw-h-full": true,
|
|
114
|
+
"spiffy-tw-overflow-hidden": true,
|
|
115
|
+
"spiffy-tw-select-none": true
|
|
116
|
+
});
|
|
117
|
+
const imageClipContainerClassnames = (0, classnames.default)("spiffy-tw-w-full", "spiffy-tw-overflow-hidden", {
|
|
118
|
+
"spiffy-tw-flex-shrink-0": growWithContainer,
|
|
119
|
+
"spiffy-tw-tw-h-full": !growWithContainer
|
|
120
|
+
}, aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "");
|
|
121
|
+
const imageContainerClassnames = (0, classnames.default)(linkClassnames, zoomOnHover ? [
|
|
122
|
+
"spiffy-tw-transition-transform",
|
|
123
|
+
"spiffy-tw-duration-200",
|
|
124
|
+
"spiffy-tw-origin-top",
|
|
125
|
+
"hover:spiffy-tw-scale-105"
|
|
126
|
+
] : []);
|
|
127
|
+
const contentClassnames = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-p-2", "spiffy-tw-pr-2", "spiffy-tw-items-start", "spiffy-tw-justify-end", { "spiffy-tw-flex-grow-0": layoutVariant === "tall" || layoutVariant === "square" });
|
|
128
|
+
const productTitleClassnames = (0, classnames.default)("spiffy-tw-line-clamp-2", "spiffy-tw-overflow-clip", "spiffy-tw-tracking-[0.8px]", "spiffy-tw-whitespace-normal", "spiffy-tw-normal-case", require_productCardVariants.variantTitleColorMap.get(finalVariant) ?? "spiffy-tw-text-[--spiffy-colors-text-primary]", ...layoutClasses.productTitle);
|
|
129
|
+
const priceAndRatingContainerClassnames = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-row", "spiffy-tw-justify-between", "spiffy-tw-items-center", "spiffy-tw-w-full", "spiffy-tw-pt-2", "spiffy-tw-gap-2");
|
|
130
|
+
const imageClassnames = (0, classnames.default)("spiffy-tw-bg-transparent", "spiffy-tw-w-full", "spiffy-tw-h-full", "spiffy-tw-object-cover", "spiffy-tw-object-top", "spiffy-tw-select-none", "spiffy-tw-pointer-events-none");
|
|
131
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
132
|
+
className: containerClassnames,
|
|
133
|
+
"data-testid": dataTestId,
|
|
134
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
135
|
+
href: url,
|
|
136
|
+
onClick: () => handleClick(url || ""),
|
|
137
|
+
target: "_self",
|
|
138
|
+
draggable: false,
|
|
139
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
140
|
+
className: verticalContainerClassnames,
|
|
141
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
142
|
+
className: imageClipContainerClassnames,
|
|
143
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
144
|
+
className: imageContainerClassnames,
|
|
145
|
+
children: imageUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ImageWithFallback.ImageWithFallback, {
|
|
146
|
+
src: imageUrl,
|
|
147
|
+
alt: title,
|
|
148
|
+
fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Spinner.Spinner, { className: "spiffy-tw-w-6 spiffy-tw-h-6" }),
|
|
149
|
+
imageClassnames
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
153
|
+
className: contentClassnames,
|
|
154
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Headline.Headline, {
|
|
155
|
+
variant: "h4",
|
|
156
|
+
className: productTitleClassnames,
|
|
157
|
+
children: title
|
|
158
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
159
|
+
className: priceAndRatingContainerClassnames,
|
|
160
|
+
children: [(originalPrice || salePrice) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PriceSection, {
|
|
161
|
+
originalPrice: formatPrice(originalPrice),
|
|
162
|
+
salePrice: formatPrice(salePrice),
|
|
163
|
+
pricePrefix
|
|
164
|
+
}), averageRating && numberReviews && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RatingSummary, {
|
|
165
|
+
stars: averageRating,
|
|
166
|
+
reviewCount: numberReviews
|
|
167
|
+
})]
|
|
168
|
+
})]
|
|
169
|
+
})]
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
//#endregion
|
|
176
|
+
Object.defineProperty(exports, 'PriceSection', {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function () {
|
|
179
|
+
return PriceSection;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, 'ProductCard', {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function () {
|
|
185
|
+
return ProductCard;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
Object.defineProperty(exports, 'RatingSummary', {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function () {
|
|
191
|
+
return RatingSummary;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { productCardLayoutVariantClasses } from "./productCardVariants-C_QIZ-KF.js";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/common/ProductCard/types.ts
|
|
6
|
+
let ProductCardSkeletonOverrides = /* @__PURE__ */ function(ProductCardSkeletonOverrides$1) {
|
|
7
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON_CONTAINER"] = "spiffy-product-card-skeleton-container";
|
|
8
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON"] = "spiffy-product-card-skeleton";
|
|
9
|
+
return ProductCardSkeletonOverrides$1;
|
|
10
|
+
}({});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/common/ProductCard/ProductCardSkeleton.tsx
|
|
14
|
+
const ProductCardSkeleton = ({ layoutVariant, aspectRatio, growWithContainer = false }) => {
|
|
15
|
+
const layoutClasses = productCardLayoutVariantClasses[layoutVariant || "normal"];
|
|
16
|
+
const containerClasses = classNames(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON_CONTAINER, "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-bg-transparent", !growWithContainer ? layoutClasses.container : "");
|
|
17
|
+
const verticalContainerClasses = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", !growWithContainer ? layoutClasses.verticalContainer : "");
|
|
18
|
+
const imageClipContainerClasses = classNames("spiffy-tw-w-full", aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "", "spiffy-tw-overflow-hidden");
|
|
19
|
+
const imageSkeletonClasses = classNames("spiffy-tw-bg-[#F4F4F6]", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-w-full", "spiffy-tw-h-full");
|
|
20
|
+
const contentContainerClasses = classNames("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-2", "spiffy-tw-w-full", "spiffy-tw-p-2");
|
|
21
|
+
const textSkeletonClasses = classNames(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON, "spiffy-tw-h-[15px]", "spiffy-tw-block", "spiffy-tw-rounded-sm", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-bg-[#F4F4F6]");
|
|
22
|
+
return /* @__PURE__ */ jsx("div", {
|
|
23
|
+
className: containerClasses,
|
|
24
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
25
|
+
className: verticalContainerClasses,
|
|
26
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: imageClipContainerClasses,
|
|
28
|
+
children: /* @__PURE__ */ jsx("div", { className: imageSkeletonClasses })
|
|
29
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: contentContainerClasses,
|
|
31
|
+
children: [/* @__PURE__ */ jsx("div", { className: classNames(textSkeletonClasses, "spiffy-tw-w-full") }), /* @__PURE__ */ jsx("div", { className: classNames(textSkeletonClasses, "spiffy-tw-w-[60%]") })]
|
|
32
|
+
})]
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ProductCardSkeleton };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_productCardVariants = require('./productCardVariants-Dd-wrJKP.cjs');
|
|
3
|
+
let classnames = require("classnames");
|
|
4
|
+
classnames = require_chunk.__toESM(classnames);
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
7
|
+
|
|
8
|
+
//#region src/components/common/ProductCard/types.ts
|
|
9
|
+
let ProductCardSkeletonOverrides = /* @__PURE__ */ function(ProductCardSkeletonOverrides$1) {
|
|
10
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON_CONTAINER"] = "spiffy-product-card-skeleton-container";
|
|
11
|
+
ProductCardSkeletonOverrides$1["PRODUCT_CARD_SKELETON"] = "spiffy-product-card-skeleton";
|
|
12
|
+
return ProductCardSkeletonOverrides$1;
|
|
13
|
+
}({});
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/common/ProductCard/ProductCardSkeleton.tsx
|
|
17
|
+
const ProductCardSkeleton = ({ layoutVariant, aspectRatio, growWithContainer = false }) => {
|
|
18
|
+
const layoutClasses = require_productCardVariants.productCardLayoutVariantClasses[layoutVariant || "normal"];
|
|
19
|
+
const containerClasses = (0, classnames.default)(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON_CONTAINER, "spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-inherit", "spiffy-tw-bg-transparent", !growWithContainer ? layoutClasses.container : "");
|
|
20
|
+
const verticalContainerClasses = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-overflow-hidden", "spiffy-tw-gap-inherit", !growWithContainer ? layoutClasses.verticalContainer : "");
|
|
21
|
+
const imageClipContainerClasses = (0, classnames.default)("spiffy-tw-w-full", aspectRatio === "3:4" ? "spiffy-tw-aspect-[3/4]" : "", aspectRatio === "square" ? "spiffy-tw-aspect-square" : "", "spiffy-tw-overflow-hidden");
|
|
22
|
+
const imageSkeletonClasses = (0, classnames.default)("spiffy-tw-bg-[#F4F4F6]", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-w-full", "spiffy-tw-h-full");
|
|
23
|
+
const contentContainerClasses = (0, classnames.default)("spiffy-tw-flex", "spiffy-tw-flex-col", "spiffy-tw-gap-2", "spiffy-tw-w-full", "spiffy-tw-p-2");
|
|
24
|
+
const textSkeletonClasses = (0, classnames.default)(ProductCardSkeletonOverrides.PRODUCT_CARD_SKELETON, "spiffy-tw-h-[15px]", "spiffy-tw-block", "spiffy-tw-rounded-sm", "spiffy-tw-animate-pulse", "spiffy-tw-opacity-70", "spiffy-tw-bg-[#F4F4F6]");
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
26
|
+
className: containerClasses,
|
|
27
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
28
|
+
className: verticalContainerClasses,
|
|
29
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
30
|
+
className: imageClipContainerClasses,
|
|
31
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: imageSkeletonClasses })
|
|
32
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
33
|
+
className: contentContainerClasses,
|
|
34
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, classnames.default)(textSkeletonClasses, "spiffy-tw-w-full") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, classnames.default)(textSkeletonClasses, "spiffy-tw-w-[60%]") })]
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
Object.defineProperty(exports, 'ProductCardSkeleton', {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return ProductCardSkeleton;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_ProductCard = require('./ProductCard-CS6DZAwO.cjs');
|
|
3
|
+
const require_productGridVariants = require('./productGridVariants-DVzvjK9i.cjs');
|
|
4
|
+
let classnames = require("classnames");
|
|
5
|
+
classnames = require_chunk.__toESM(classnames);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
react_jsx_runtime = require_chunk.__toESM(react_jsx_runtime);
|
|
8
|
+
|
|
9
|
+
//#region src/config/chatElementDisplayLocation.ts
|
|
10
|
+
let ChatElementDisplayLocation = /* @__PURE__ */ function(ChatElementDisplayLocation$1) {
|
|
11
|
+
ChatElementDisplayLocation$1["IN_CHAT"] = "in_chat";
|
|
12
|
+
ChatElementDisplayLocation$1["CHAT_PREVIEW"] = "chat_preview";
|
|
13
|
+
ChatElementDisplayLocation$1["FLOATING_BUTTON"] = "floating_button";
|
|
14
|
+
ChatElementDisplayLocation$1["HELP_ME_CHOOSE"] = "help_me_choose";
|
|
15
|
+
ChatElementDisplayLocation$1["PLP_IMAGE_BANNER"] = "plp_image_banner";
|
|
16
|
+
ChatElementDisplayLocation$1["TOP_REVIEWS_SNIPPET"] = "top_reviews_snippet";
|
|
17
|
+
ChatElementDisplayLocation$1["BOTTOM_REVIEWS_SNIPPET"] = "bottom_reviews_snippet";
|
|
18
|
+
ChatElementDisplayLocation$1["BLOCK_BACK_BUTTON"] = "block_back_button";
|
|
19
|
+
ChatElementDisplayLocation$1["SWITCH_TO_AGENT"] = "switch_to_agent";
|
|
20
|
+
ChatElementDisplayLocation$1["CONVERSATIONAL_SEARCH"] = "conversational_search";
|
|
21
|
+
ChatElementDisplayLocation$1["GLOBAL_SEARCH_ENTRYPOINT"] = "global_search_entrypoint";
|
|
22
|
+
ChatElementDisplayLocation$1["SEARCH_NAV_ENTRYPOINT"] = "search_nav_entrypoint";
|
|
23
|
+
ChatElementDisplayLocation$1["SEARCH_PROMPT"] = "search_prompt";
|
|
24
|
+
ChatElementDisplayLocation$1["SEARCH_PROMPT_BUTTON"] = "search_prompt_button";
|
|
25
|
+
ChatElementDisplayLocation$1["PRODUCT_GRID"] = "product_grid";
|
|
26
|
+
ChatElementDisplayLocation$1["UNSPECIFIED"] = "unspecified";
|
|
27
|
+
ChatElementDisplayLocation$1["FILTER_MODAL"] = "filter_modal";
|
|
28
|
+
ChatElementDisplayLocation$1["PROMPT_CARD"] = "prompt_card";
|
|
29
|
+
ChatElementDisplayLocation$1["WINDOW_API_CALL"] = "window_api_call";
|
|
30
|
+
return ChatElementDisplayLocation$1;
|
|
31
|
+
}({});
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/common/ProductGrid/ProductGrid.tsx
|
|
35
|
+
const ProductGrid = ({ productList, productGridVariant, productGridClasses, productCardConfig, merchantShortName, searchResponseId, cardsGrowWithContainer = true, handleClick }) => {
|
|
36
|
+
const { productCardVariant, productCardHoverVariant, productCardLayoutVariant, productCardImageAspectRatio, zoomOnHover } = require_productGridVariants.productGridVariantClasses[productGridVariant];
|
|
37
|
+
const cardContainerClasses = (0, classnames.default)({
|
|
38
|
+
"spiffy-tw-w-full": cardsGrowWithContainer,
|
|
39
|
+
"spiffy-tw-h-full": cardsGrowWithContainer
|
|
40
|
+
});
|
|
41
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
42
|
+
className: productGridClasses,
|
|
43
|
+
children: productList.map((product, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
44
|
+
className: cardContainerClasses,
|
|
45
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ProductCard.ProductCard, {
|
|
46
|
+
productCardConfig,
|
|
47
|
+
merchantShortName,
|
|
48
|
+
imageUrl: product.imageUrl,
|
|
49
|
+
searchResponseId,
|
|
50
|
+
productResponseId: product.responseId,
|
|
51
|
+
title: product.title,
|
|
52
|
+
url: product.url,
|
|
53
|
+
originalPrice: product.originalPrice,
|
|
54
|
+
salePrice: product.salePrice,
|
|
55
|
+
averageRating: product.averageRating,
|
|
56
|
+
numberReviews: product.numberReviews,
|
|
57
|
+
cardDisplayLocation: ChatElementDisplayLocation.PRODUCT_GRID,
|
|
58
|
+
layoutVariant: productCardLayoutVariant,
|
|
59
|
+
variant: productCardVariant,
|
|
60
|
+
hoverVariant: productCardHoverVariant,
|
|
61
|
+
zoomOnHover,
|
|
62
|
+
aspectRatio: productCardImageAspectRatio,
|
|
63
|
+
clickPosition: index,
|
|
64
|
+
growWithContainer: cardsGrowWithContainer,
|
|
65
|
+
handleClick
|
|
66
|
+
}, product.id)
|
|
67
|
+
}, product.id))
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
Object.defineProperty(exports, 'ProductGrid', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return ProductGrid;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ProductCard } from "./ProductCard-Btg8tHGc.js";
|
|
2
|
+
import { productGridVariantClasses } from "./productGridVariants-CxCKx5Fq.js";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/config/chatElementDisplayLocation.ts
|
|
7
|
+
let ChatElementDisplayLocation = /* @__PURE__ */ function(ChatElementDisplayLocation$1) {
|
|
8
|
+
ChatElementDisplayLocation$1["IN_CHAT"] = "in_chat";
|
|
9
|
+
ChatElementDisplayLocation$1["CHAT_PREVIEW"] = "chat_preview";
|
|
10
|
+
ChatElementDisplayLocation$1["FLOATING_BUTTON"] = "floating_button";
|
|
11
|
+
ChatElementDisplayLocation$1["HELP_ME_CHOOSE"] = "help_me_choose";
|
|
12
|
+
ChatElementDisplayLocation$1["PLP_IMAGE_BANNER"] = "plp_image_banner";
|
|
13
|
+
ChatElementDisplayLocation$1["TOP_REVIEWS_SNIPPET"] = "top_reviews_snippet";
|
|
14
|
+
ChatElementDisplayLocation$1["BOTTOM_REVIEWS_SNIPPET"] = "bottom_reviews_snippet";
|
|
15
|
+
ChatElementDisplayLocation$1["BLOCK_BACK_BUTTON"] = "block_back_button";
|
|
16
|
+
ChatElementDisplayLocation$1["SWITCH_TO_AGENT"] = "switch_to_agent";
|
|
17
|
+
ChatElementDisplayLocation$1["CONVERSATIONAL_SEARCH"] = "conversational_search";
|
|
18
|
+
ChatElementDisplayLocation$1["GLOBAL_SEARCH_ENTRYPOINT"] = "global_search_entrypoint";
|
|
19
|
+
ChatElementDisplayLocation$1["SEARCH_NAV_ENTRYPOINT"] = "search_nav_entrypoint";
|
|
20
|
+
ChatElementDisplayLocation$1["SEARCH_PROMPT"] = "search_prompt";
|
|
21
|
+
ChatElementDisplayLocation$1["SEARCH_PROMPT_BUTTON"] = "search_prompt_button";
|
|
22
|
+
ChatElementDisplayLocation$1["PRODUCT_GRID"] = "product_grid";
|
|
23
|
+
ChatElementDisplayLocation$1["UNSPECIFIED"] = "unspecified";
|
|
24
|
+
ChatElementDisplayLocation$1["FILTER_MODAL"] = "filter_modal";
|
|
25
|
+
ChatElementDisplayLocation$1["PROMPT_CARD"] = "prompt_card";
|
|
26
|
+
ChatElementDisplayLocation$1["WINDOW_API_CALL"] = "window_api_call";
|
|
27
|
+
return ChatElementDisplayLocation$1;
|
|
28
|
+
}({});
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/components/common/ProductGrid/ProductGrid.tsx
|
|
32
|
+
const ProductGrid = ({ productList, productGridVariant, productGridClasses, productCardConfig, merchantShortName, searchResponseId, cardsGrowWithContainer = true, handleClick }) => {
|
|
33
|
+
const { productCardVariant, productCardHoverVariant, productCardLayoutVariant, productCardImageAspectRatio, zoomOnHover } = productGridVariantClasses[productGridVariant];
|
|
34
|
+
const cardContainerClasses = classNames({
|
|
35
|
+
"spiffy-tw-w-full": cardsGrowWithContainer,
|
|
36
|
+
"spiffy-tw-h-full": cardsGrowWithContainer
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: productGridClasses,
|
|
40
|
+
children: productList.map((product, index) => /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: cardContainerClasses,
|
|
42
|
+
children: /* @__PURE__ */ jsx(ProductCard, {
|
|
43
|
+
productCardConfig,
|
|
44
|
+
merchantShortName,
|
|
45
|
+
imageUrl: product.imageUrl,
|
|
46
|
+
searchResponseId,
|
|
47
|
+
productResponseId: product.responseId,
|
|
48
|
+
title: product.title,
|
|
49
|
+
url: product.url,
|
|
50
|
+
originalPrice: product.originalPrice,
|
|
51
|
+
salePrice: product.salePrice,
|
|
52
|
+
averageRating: product.averageRating,
|
|
53
|
+
numberReviews: product.numberReviews,
|
|
54
|
+
cardDisplayLocation: ChatElementDisplayLocation.PRODUCT_GRID,
|
|
55
|
+
layoutVariant: productCardLayoutVariant,
|
|
56
|
+
variant: productCardVariant,
|
|
57
|
+
hoverVariant: productCardHoverVariant,
|
|
58
|
+
zoomOnHover,
|
|
59
|
+
aspectRatio: productCardImageAspectRatio,
|
|
60
|
+
clickPosition: index,
|
|
61
|
+
growWithContainer: cardsGrowWithContainer,
|
|
62
|
+
handleClick
|
|
63
|
+
}, product.id)
|
|
64
|
+
}, product.id))
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ProductGrid };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { motion } from "framer-motion";
|
|
5
|
+
import OutlinedStar from "@envive-ai/react-icons/src/OutlinedStar";
|
|
6
|
+
|
|
7
|
+
//#region src/components/search/SearchInputAutocomplete/SearchAutocomplete.tsx
|
|
8
|
+
const SearchAutocomplete = ({ id, results, focusedIndex, onSuggestionSelect, iconColor }) => {
|
|
9
|
+
if (results.length === 0) return null;
|
|
10
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
11
|
+
className: "spiffy-tw-h-full",
|
|
12
|
+
initial: {
|
|
13
|
+
opacity: 0,
|
|
14
|
+
y: -10
|
|
15
|
+
},
|
|
16
|
+
animate: {
|
|
17
|
+
opacity: 1,
|
|
18
|
+
y: 0
|
|
19
|
+
},
|
|
20
|
+
exit: {
|
|
21
|
+
opacity: 0,
|
|
22
|
+
y: -10
|
|
23
|
+
},
|
|
24
|
+
transition: { duration: .2 },
|
|
25
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
26
|
+
id,
|
|
27
|
+
role: "listbox",
|
|
28
|
+
className: "spiffy-tw-mt-4 spiffy-tw-space-y-2",
|
|
29
|
+
children: results.map((result, index) => /* @__PURE__ */ jsxs("li", {
|
|
30
|
+
id: `option-${index}`,
|
|
31
|
+
role: "option",
|
|
32
|
+
"aria-selected": index === focusedIndex,
|
|
33
|
+
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"),
|
|
34
|
+
onClick: () => onSuggestionSelect(result, index),
|
|
35
|
+
onKeyDown: (event) => {
|
|
36
|
+
if (event.key === "Enter" || event.keyCode === 13) onSuggestionSelect(result, index);
|
|
37
|
+
},
|
|
38
|
+
children: [/* @__PURE__ */ jsx(OutlinedStar, {
|
|
39
|
+
className: "spiffy-tw-w-[16px] spiffy-tw-h-[16px] spiffy-tw-mr-2",
|
|
40
|
+
fill: iconColor
|
|
41
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "spiffy-tw-font-bold",
|
|
43
|
+
children: result
|
|
44
|
+
})]
|
|
45
|
+
}, index))
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { SearchAutocomplete };
|