@tapcart/mobile-components 0.7.4 → 0.7.6

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 (42) hide show
  1. package/dist/components/hooks/use-products.d.ts.map +1 -1
  2. package/dist/components/hooks/use-products.js +1 -2
  3. package/dist/components/ui/Input/input.d.ts.map +1 -1
  4. package/dist/components/ui/Input/input.js +3 -7
  5. package/dist/components/ui/badge.d.ts.map +1 -1
  6. package/dist/components/ui/badge.js +3 -3
  7. package/dist/components/ui/button.d.ts.map +1 -1
  8. package/dist/components/ui/button.js +2 -2
  9. package/dist/components/ui/carousel.d.ts.map +1 -1
  10. package/dist/components/ui/carousel.js +2 -2
  11. package/dist/components/ui/drawer.d.ts +19 -10
  12. package/dist/components/ui/drawer.d.ts.map +1 -1
  13. package/dist/components/ui/drawer.js +11 -8
  14. package/dist/components/ui/favorite.js +2 -1
  15. package/dist/components/ui/image.js +2 -2
  16. package/dist/index.d.ts +1 -5
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -5
  19. package/dist/lib/utils.d.ts +5 -2
  20. package/dist/lib/utils.d.ts.map +1 -1
  21. package/dist/lib/utils.js +8 -25
  22. package/dist/styles.css +6 -33
  23. package/package.json +2 -2
  24. package/dist/components/hooks/use-nosto-recommendation.d.ts +0 -8
  25. package/dist/components/hooks/use-nosto-recommendation.d.ts.map +0 -1
  26. package/dist/components/hooks/use-nosto-recommendation.js +0 -105
  27. package/dist/components/templates/ProductCard/utils.d.ts +0 -78
  28. package/dist/components/templates/ProductCard/utils.d.ts.map +0 -1
  29. package/dist/components/templates/ProductCard/utils.js +0 -128
  30. package/dist/components/templates/ProductGrid/index.d.ts +0 -1
  31. package/dist/components/templates/ProductGrid/index.d.ts.map +0 -1
  32. package/dist/components/templates/ProductGrid/index.js +0 -1
  33. package/dist/components/ui/ProductCard/utils.d.ts +0 -94
  34. package/dist/components/ui/ProductCard/utils.d.ts.map +0 -1
  35. package/dist/components/ui/ProductCard/utils.js +0 -148
  36. package/dist/components/ui/ProductGrid/index.d.ts +0 -1
  37. package/dist/components/ui/ProductGrid/index.d.ts.map +0 -1
  38. package/dist/components/ui/ProductGrid/index.js +0 -1
  39. package/dist/lib/price.d.ts +0 -29
  40. package/dist/lib/price.d.ts.map +0 -1
  41. package/dist/lib/price.js +0 -66
  42. package/dist/tapcart-mobile-components.umd.js +0 -44
@@ -1,105 +0,0 @@
1
- "use client";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- import { useState, useEffect } from "react";
12
- import { useProducts } from "./use-products";
13
- const getRecommendations = (integrations, slotId = null) => __awaiter(void 0, void 0, void 0, function* () {
14
- if (!Array.isArray(integrations))
15
- return [];
16
- const nosto = integrations.find((integration) => integration.name === "nosto");
17
- const url = "https://api.nosto.com/v1/graphql";
18
- const headers = new Headers({
19
- "Content-Type": "application/json",
20
- Authorization: "Basic " + btoa(":" + (nosto === null || nosto === void 0 ? void 0 : nosto.key)),
21
- });
22
- // Fetch sessionId
23
- const sessionBody = JSON.stringify({
24
- query: `mutation { newSession }`,
25
- });
26
- const sessionResponse = yield fetch(url, {
27
- method: "POST",
28
- headers: headers,
29
- body: sessionBody,
30
- });
31
- const sessionData = yield sessionResponse.json();
32
- const sessionId = sessionData.data.newSession;
33
- // Main recommendation query
34
- const body = JSON.stringify({
35
- query: `
36
- mutation {
37
- updateSession(
38
- by: BY_CID
39
- id: "${sessionId}"
40
- params: {
41
- event: { type: VIEWED_PAGE, target: "home" }
42
- }
43
- ) {
44
- pages {
45
- forFrontPage(
46
- params: {
47
- isPreview: false
48
- imageVersion: VERSION_8_400_400
49
- ${slotId ? `slotIds: ["${slotId}"]` : ""}
50
- }
51
- ) {
52
- primary {
53
- productId
54
- }
55
- }
56
- }
57
- }
58
- }
59
- `,
60
- });
61
- const response = yield fetch(url, {
62
- method: "POST",
63
- headers: headers,
64
- mode: "cors",
65
- body,
66
- });
67
- const json = yield response.json();
68
- return json;
69
- });
70
- export function useNostoRecommendations(integrations, baseURL, slotId = null) {
71
- var _a, _b, _c, _d;
72
- const [nostoData, setNostoData] = useState(null);
73
- const [isLoading, setIsLoading] = useState(true);
74
- const [error, setError] = useState(null);
75
- useEffect(() => {
76
- function fetchNostoData() {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- try {
79
- const result = yield getRecommendations(integrations, slotId);
80
- setNostoData(result);
81
- }
82
- catch (err) {
83
- console.error("Error fetching recommendations:", err);
84
- setError(err);
85
- }
86
- finally {
87
- setIsLoading(false);
88
- }
89
- });
90
- }
91
- fetchNostoData();
92
- }, [integrations, slotId]);
93
- const productIds = ((_d = (_c = (_b = (_a = nostoData === null || nostoData === void 0 ? void 0 : nostoData.data) === null || _a === void 0 ? void 0 : _a.updateSession) === null || _b === void 0 ? void 0 : _b.pages) === null || _c === void 0 ? void 0 : _c.forFrontPage) === null || _d === void 0 ? void 0 : _d.flatMap((page) => page.primary).filter((item) => item && item.productId).map((item) => item.productId)) || [];
94
- const { products, error: productsError, isLoading: productsLoading, } = useProducts({
95
- productIds,
96
- baseURL,
97
- productHandles: [],
98
- });
99
- return {
100
- recommendations: products,
101
- isLoading: isLoading || productsLoading,
102
- error: error || productsError,
103
- isEmpty: products.length === 0,
104
- };
105
- }
@@ -1,78 +0,0 @@
1
- interface ProductCardBadgeConfig {
2
- variants: {
3
- horizontalPosition: {
4
- start: string;
5
- end: string;
6
- center: string;
7
- };
8
- verticalPosition: {
9
- top: string;
10
- bottom: string;
11
- below: string;
12
- };
13
- imageSwipeEnabled: {
14
- true: string;
15
- false: string;
16
- };
17
- };
18
- compoundVariants: Array<{
19
- verticalPosition: "bottom";
20
- imageSwipeEnabled: true;
21
- class: string;
22
- }>;
23
- }
24
- export declare function getProductCardBadgeVariants(config?: Partial<ProductCardBadgeConfig>): (props?: ({
25
- horizontalPosition?: "center" | "start" | "end" | null | undefined;
26
- verticalPosition?: "top" | "bottom" | "below" | null | undefined;
27
- imageSwipeEnabled?: boolean | null | undefined;
28
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
29
- interface ProductCardFavoriteConfig {
30
- variants: {
31
- iconPosition: {
32
- "top-left": string;
33
- "top-right": string;
34
- "bottom-left": string;
35
- "bottom-right": string;
36
- "below-image-on-right": string;
37
- };
38
- badgeHorizontalPosition: {
39
- start: string;
40
- end: string;
41
- center: string;
42
- };
43
- badgeVerticalPosition: {
44
- top: string;
45
- bottom: string;
46
- below: string;
47
- };
48
- isSoldOut: {
49
- true: string;
50
- false: string;
51
- };
52
- showSoldOutBadge: {
53
- true: string;
54
- false: string;
55
- };
56
- imageSwipeEnabled: {
57
- true: string;
58
- false: string;
59
- };
60
- };
61
- compoundVariants: Array<{
62
- [key: string]: any;
63
- class: string;
64
- }>;
65
- defaultVariants: {
66
- iconPosition: "below-image-on-right";
67
- };
68
- }
69
- export declare function getProductCardFavoriteVariants(config?: Partial<ProductCardFavoriteConfig>): (props?: ({
70
- iconPosition?: "below-image-on-right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | null | undefined;
71
- badgeHorizontalPosition?: "center" | "start" | "end" | null | undefined;
72
- badgeVerticalPosition?: "top" | "bottom" | "below" | null | undefined;
73
- isSoldOut?: boolean | null | undefined;
74
- showSoldOutBadge?: boolean | null | undefined;
75
- imageSwipeEnabled?: boolean | null | undefined;
76
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
77
- export {};
78
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","source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I,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;KACF,CAAA;IACD,gBAAgB,EAAE,KAAK,CAAC;QACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;KACd,CAAC,CAAA;IACF,eAAe,EAAE;QACf,YAAY,EAAE,sBAAsB,CAAA;KACrC,CAAA;CACF;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,GAAE,OAAO,CAAC,yBAAyB,CAAM;;;;;;;oFAuGhD"}
@@ -1,128 +0,0 @@
1
- import { cva } from "../../../lib/utils";
2
- export function getProductCardBadgeVariants(config = {}) {
3
- const defaultConfig = {
4
- variants: {
5
- horizontalPosition: {
6
- start: "left-0",
7
- end: "right-0",
8
- center: "",
9
- },
10
- verticalPosition: {
11
- top: "top-0 mt-2",
12
- bottom: "bottom-0 mb-2",
13
- below: "",
14
- },
15
- imageSwipeEnabled: {
16
- true: "",
17
- false: "",
18
- },
19
- },
20
- compoundVariants: [
21
- {
22
- verticalPosition: "bottom",
23
- imageSwipeEnabled: true,
24
- class: "bottom-[18px]",
25
- },
26
- ],
27
- };
28
- return cva("absolute truncate pointer-events-none", Object.assign(Object.assign({}, defaultConfig), config));
29
- }
30
- export function getProductCardFavoriteVariants(config = {}) {
31
- const defaultConfig = {
32
- variants: {
33
- iconPosition: {
34
- "top-left": "top-0 left-2 mt-2",
35
- "top-right": "top-0 right-2 mt-2",
36
- "bottom-left": "bottom-0 left-2 mb-2",
37
- "bottom-right": "bottom-0 right-2 mb-2",
38
- "below-image-on-right": "",
39
- },
40
- badgeHorizontalPosition: {
41
- start: "",
42
- end: "",
43
- center: "",
44
- },
45
- badgeVerticalPosition: {
46
- top: "",
47
- bottom: "",
48
- below: "",
49
- },
50
- isSoldOut: {
51
- true: "",
52
- false: "",
53
- },
54
- showSoldOutBadge: {
55
- true: "",
56
- false: "",
57
- },
58
- imageSwipeEnabled: {
59
- true: "",
60
- false: "",
61
- },
62
- },
63
- compoundVariants: [
64
- {
65
- iconPosition: "top-left",
66
- badgeHorizontalPosition: ["start", "center"],
67
- badgeVerticalPosition: "top",
68
- showSoldOutBadge: false,
69
- class: "top-10",
70
- },
71
- {
72
- iconPosition: "top-right",
73
- badgeHorizontalPosition: ["end", "center"],
74
- badgeVerticalPosition: "top",
75
- class: "top-10",
76
- },
77
- {
78
- iconPosition: "bottom-left",
79
- badgeHorizontalPosition: ["start", "center"],
80
- badgeVerticalPosition: "bottom",
81
- class: "bottom-10",
82
- },
83
- {
84
- iconPosition: "bottom-right",
85
- badgeHorizontalPosition: ["end", "center"],
86
- badgeVerticalPosition: "bottom",
87
- class: "bottom-10",
88
- },
89
- {
90
- iconPosition: "bottom-left",
91
- showSoldOutBadge: true,
92
- class: "bottom-10",
93
- },
94
- {
95
- iconPosition: ["bottom-left", "bottom-right"],
96
- imageSwipeEnabled: true,
97
- class: "bottom-[18px]",
98
- },
99
- {
100
- iconPosition: "bottom-left",
101
- badgeHorizontalPosition: ["start", "center"],
102
- badgeVerticalPosition: "bottom",
103
- isSoldOut: false,
104
- showSoldOutBadge: false,
105
- imageSwipeEnabled: true,
106
- class: "bottom-[58px]",
107
- },
108
- {
109
- iconPosition: "bottom-right",
110
- badgeHorizontalPosition: ["end", "center"],
111
- badgeVerticalPosition: "bottom",
112
- showSoldOutBadge: false,
113
- imageSwipeEnabled: true,
114
- class: "bottom-[58px]",
115
- },
116
- {
117
- iconPosition: "bottom-left",
118
- showSoldOutBadge: true,
119
- imageSwipeEnabled: true,
120
- class: "bottom-[58px]",
121
- },
122
- ],
123
- defaultVariants: {
124
- iconPosition: "below-image-on-right",
125
- },
126
- };
127
- return cva("absolute ", Object.assign(Object.assign({}, defaultConfig), config));
128
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/templates/ProductGrid/index.tsx"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,94 +0,0 @@
1
- interface ProductCardBadgeConfig {
2
- variants: {
3
- horizontalPosition: {
4
- start: string;
5
- end: string;
6
- center: string;
7
- };
8
- verticalPosition: {
9
- top: string;
10
- bottom: string;
11
- below: string;
12
- };
13
- imageSwipeEnabled: {
14
- true: string;
15
- false: string;
16
- };
17
- };
18
- compoundVariants: Array<{
19
- verticalPosition: "bottom";
20
- imageSwipeEnabled: true;
21
- class: string;
22
- }>;
23
- }
24
- export declare function getProductCardBadgeVariantsFn(config?: Partial<ProductCardBadgeConfig>): (props?: ({
25
- horizontalPosition?: "center" | "end" | "start" | null | undefined;
26
- verticalPosition?: "top" | "bottom" | "below" | null | undefined;
27
- imageSwipeEnabled?: boolean | null | undefined;
28
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
29
- interface ProductCardFavoriteConfig {
30
- variants: {
31
- iconPosition: {
32
- "top-left": string;
33
- "top-right": string;
34
- "bottom-left": string;
35
- "bottom-right": string;
36
- "below-image-on-right": string;
37
- };
38
- badgeHorizontalPosition: {
39
- start: string;
40
- end: string;
41
- center: string;
42
- };
43
- badgeVerticalPosition: {
44
- top: string;
45
- bottom: string;
46
- below: string;
47
- };
48
- isSoldOut: {
49
- true: string;
50
- false: string;
51
- };
52
- showSoldOutBadge: {
53
- true: string;
54
- false: string;
55
- };
56
- imageSwipeEnabled: {
57
- true: string;
58
- false: string;
59
- };
60
- };
61
- compoundVariants: Array<{
62
- [key: string]: any;
63
- class: string;
64
- }>;
65
- defaultVariants: {
66
- iconPosition: "below-image-on-right";
67
- };
68
- }
69
- export declare function getProductCardFavoriteVariantsFn(config?: Partial<ProductCardFavoriteConfig>): (props?: ({
70
- iconPosition?: "below-image-on-right" | "top-right" | "top-left" | "bottom-left" | "bottom-right" | null | undefined;
71
- badgeHorizontalPosition?: "center" | "end" | "start" | null | undefined;
72
- badgeVerticalPosition?: "top" | "bottom" | "below" | null | undefined;
73
- isSoldOut?: boolean | null | undefined;
74
- showSoldOutBadge?: boolean | null | undefined;
75
- imageSwipeEnabled?: boolean | null | undefined;
76
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
77
- type PageState = {
78
- pageViewType: "collection" | "search";
79
- };
80
- export declare function getProductCardTranslationsFn(pageState: PageState, translations: Record<string, string>): {
81
- gridTranslations: {
82
- title: string;
83
- description: string;
84
- buttonLabel: string;
85
- };
86
- productCardTranslations: {
87
- quickAdd: string;
88
- soldOut: string;
89
- addToBag: string;
90
- viewItem: string;
91
- };
92
- };
93
- export {};
94
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../components/ui/ProductCard/utils.ts"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC9B,QAAQ,EAAE;QACR,kBAAkB,EAAE;YAClB,KAAK,EAAE,MAAM,CAAA;YACb,GAAG,EAAE,MAAM,CAAA;YACX,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,gBAAgB,EAAE;YAChB,GAAG,EAAE,MAAM,CAAA;YACX,MAAM,EAAE,MAAM,CAAA;YACd,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;KACF,CAAA;IACD,gBAAgB,EAAE,KAAK,CAAC;QACtB,gBAAgB,EAAE,QAAQ,CAAA;QAC1B,iBAAiB,EAAE,IAAI,CAAA;QACvB,KAAK,EAAE,MAAM,CAAA;KACd,CAAC,CAAA;CACH;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,GAAE,OAAO,CAAC,sBAAsB,CAAM;;;;oFAgC7C;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE;QACR,YAAY,EAAE;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{}) {
3
- const defaultConfig = {
4
- variants: {
5
- horizontalPosition: {
6
- start: "left-0",
7
- end: "right-0",
8
- center: "",
9
- },
10
- verticalPosition: {
11
- top: "top-0 mt-2",
12
- bottom: "bottom-0 mb-2",
13
- below: "",
14
- },
15
- imageSwipeEnabled: {
16
- true: "",
17
- false: "",
18
- },
19
- },
20
- compoundVariants: [
21
- {
22
- verticalPosition: "bottom",
23
- imageSwipeEnabled: true,
24
- class: "bottom-[18px]",
25
- },
26
- ],
27
- };
28
- return cva("absolute truncate pointer-events-none", Object.assign(Object.assign({}, defaultConfig), config));
29
- }
30
- export function getProductCardFavoriteVariantsFn(config = {}) {
31
- const defaultConfig = {
32
- variants: {
33
- iconPosition: {
34
- "top-left": "top-0 left-2 mt-2",
35
- "top-right": "top-0 right-2 mt-2",
36
- "bottom-left": "bottom-0 left-2 mb-2",
37
- "bottom-right": "bottom-0 right-2 mb-2",
38
- "below-image-on-right": "",
39
- },
40
- badgeHorizontalPosition: {
41
- start: "",
42
- end: "",
43
- center: "",
44
- },
45
- badgeVerticalPosition: {
46
- top: "",
47
- bottom: "",
48
- below: "",
49
- },
50
- isSoldOut: {
51
- true: "",
52
- false: "",
53
- },
54
- showSoldOutBadge: {
55
- true: "",
56
- false: "",
57
- },
58
- imageSwipeEnabled: {
59
- true: "",
60
- false: "",
61
- },
62
- },
63
- compoundVariants: [
64
- {
65
- iconPosition: "top-left",
66
- badgeHorizontalPosition: ["start", "center"],
67
- badgeVerticalPosition: "top",
68
- showSoldOutBadge: false,
69
- class: "top-10",
70
- },
71
- {
72
- iconPosition: "top-right",
73
- badgeHorizontalPosition: ["end", "center"],
74
- badgeVerticalPosition: "top",
75
- class: "top-10",
76
- },
77
- {
78
- iconPosition: "bottom-left",
79
- badgeHorizontalPosition: ["start", "center"],
80
- badgeVerticalPosition: "bottom",
81
- class: "bottom-10",
82
- },
83
- {
84
- iconPosition: "bottom-right",
85
- badgeHorizontalPosition: ["end", "center"],
86
- badgeVerticalPosition: "bottom",
87
- class: "bottom-10",
88
- },
89
- {
90
- iconPosition: "bottom-left",
91
- showSoldOutBadge: true,
92
- class: "bottom-10",
93
- },
94
- {
95
- iconPosition: ["bottom-left", "bottom-right"],
96
- imageSwipeEnabled: true,
97
- class: "bottom-[18px]",
98
- },
99
- {
100
- iconPosition: "bottom-left",
101
- badgeHorizontalPosition: ["start", "center"],
102
- badgeVerticalPosition: "bottom",
103
- isSoldOut: false,
104
- showSoldOutBadge: false,
105
- imageSwipeEnabled: true,
106
- class: "bottom-[58px]",
107
- },
108
- {
109
- iconPosition: "bottom-right",
110
- badgeHorizontalPosition: ["end", "center"],
111
- badgeVerticalPosition: "bottom",
112
- showSoldOutBadge: false,
113
- imageSwipeEnabled: true,
114
- class: "bottom-[58px]",
115
- },
116
- {
117
- iconPosition: "bottom-left",
118
- showSoldOutBadge: true,
119
- imageSwipeEnabled: true,
120
- class: "bottom-[58px]",
121
- },
122
- ],
123
- defaultVariants: {
124
- iconPosition: "below-image-on-right",
125
- },
126
- };
127
- return cva("absolute ", Object.assign(Object.assign({}, defaultConfig), config));
128
- }
129
- export function getProductCardTranslationsFn(pageState, translations) {
130
- const gridTranslations = pageState.pageViewType === "collection"
131
- ? {
132
- title: translations["collection-empty-title"],
133
- description: translations["collection-empty-message"],
134
- buttonLabel: translations["collection-empty-button"],
135
- }
136
- : {
137
- title: translations["product-search-empty-title"],
138
- description: translations["product-search-empty-message"],
139
- buttonLabel: translations["product-search-empty-button"],
140
- };
141
- const productCardTranslations = {
142
- quickAdd: translations["collection-product-quick-add"],
143
- soldOut: translations["collection-product-sold-out"],
144
- addToBag: translations["quick-add-add"],
145
- viewItem: translations["quick-add-view"],
146
- };
147
- return { gridTranslations, productCardTranslations };
148
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/ui/ProductGrid/index.tsx"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,29 +0,0 @@
1
- import { ProductVariant, Product } from "app-studio-types";
2
- type Badge = {
3
- verticalPosition: "below" | "bottom" | "top";
4
- priority: number;
5
- tags: string[];
6
- excludeTags: string[];
7
- text?: string;
8
- color?: string;
9
- backgroundColor?: string;
10
- };
11
- type BadgeConfig = {
12
- [key in "below" | "bottom" | "top"]?: Badge[];
13
- };
14
- export declare const getCheapestProductFromVariantsFn: (productVariants: ProductVariant[]) => ProductVariant;
15
- export declare const getBadgeForProductFn: (badgeConfig?: BadgeConfig, productTags?: string[]) => Badge | undefined;
16
- export declare function getPriceRangesFn(product: Product): {
17
- price: number;
18
- isSale: boolean;
19
- priceHigh?: number | undefined;
20
- compareAtPrice?: number | undefined;
21
- compareAtPriceHigh?: number | undefined;
22
- };
23
- export declare function getPriceFn(product: Product): {
24
- price: number;
25
- compareAtPrice: number;
26
- isSale: boolean;
27
- };
28
- export {};
29
- //# sourceMappingURL=price.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../lib/price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1D,KAAK,KAAK,GAAG;IACX,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAC5C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,WAAW,EAAE,MAAM,EAAE,CAAA;IAErB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAGD,KAAK,WAAW,GAAG;KAChB,GAAG,IAAI,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE;CAC9C,CAAA;AAGD,eAAO,MAAM,gCAAgC,oBAC1B,cAAc,EAAE,mBAelC,CAAA;AAED,eAAO,MAAM,oBAAoB,iBAClB,WAAW,gBACX,MAAM,EAAE,KACpB,KAAK,GAAG,SAqBV,CAAA;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO;WAsBtC,MAAM;YACL,OAAO;;;;EAclB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO;;;;EAQ1C"}