@tapcart/mobile-components 0.7.2 → 0.7.5
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/components/hooks/use-destination.d.ts +23 -0
- package/dist/components/hooks/use-destination.d.ts.map +1 -0
- package/dist/components/hooks/use-destination.js +13 -0
- package/dist/components/hooks/use-products.d.ts.map +1 -1
- package/dist/components/hooks/use-products.js +1 -2
- package/dist/components/ui/Input/input.d.ts.map +1 -1
- package/dist/components/ui/Input/input.js +3 -7
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +3 -3
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +2 -2
- package/dist/components/ui/favorite.d.ts.map +1 -1
- package/dist/components/ui/favorite.js +2 -1
- package/dist/components/ui/image.js +2 -2
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/lib/utils.d.ts +5 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +10 -27
- package/dist/styles.css +0 -27
- package/package.json +2 -2
- package/dist/components/hooks/use-nosto-recommendation.d.ts +0 -8
- package/dist/components/hooks/use-nosto-recommendation.d.ts.map +0 -1
- package/dist/components/hooks/use-nosto-recommendation.js +0 -105
- package/dist/components/templates/ProductCard/utils.d.ts +0 -78
- package/dist/components/templates/ProductCard/utils.d.ts.map +0 -1
- package/dist/components/templates/ProductCard/utils.js +0 -128
- package/dist/components/templates/ProductGrid/index.d.ts +0 -1
- package/dist/components/templates/ProductGrid/index.d.ts.map +0 -1
- package/dist/components/templates/ProductGrid/index.js +0 -1
- package/dist/components/ui/ProductCard/utils.d.ts +0 -94
- package/dist/components/ui/ProductCard/utils.d.ts.map +0 -1
- package/dist/components/ui/ProductCard/utils.js +0 -148
- package/dist/components/ui/ProductGrid/index.d.ts +0 -1
- package/dist/components/ui/ProductGrid/index.d.ts.map +0 -1
- package/dist/components/ui/ProductGrid/index.js +0 -1
- package/dist/lib/price.d.ts +0 -29
- package/dist/lib/price.d.ts.map +0 -1
- package/dist/lib/price.js +0 -66
- package/dist/tapcart-mobile-components.umd.js +0 -44
|
@@ -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","sourceRoot":"","sources":["../../../../components/templates/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;Q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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 getProductCardBadgeVariants(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 getProductCardFavoriteVariants(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 getProductCardTranslations(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,EA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AG,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;AAED,KAAK,SAAS,GAAG;IAAE,YAAY,EAAE,YAAY,GAAG,QAAQ,CAAA;CAAE,CAAA;AAE1D,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;EAuBrC"}
|
|
@@ -1,148 +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
|
-
}
|
|
129
|
-
export function getProductCardTranslations(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";
|
package/dist/lib/price.d.ts
DELETED
|
@@ -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 getCheapestProductFromVariants: (productVariants: ProductVariant[]) => ProductVariant;
|
|
15
|
-
export declare const getBadgeForProduct: (badgeConfig?: BadgeConfig, productTags?: string[]) => Badge | undefined;
|
|
16
|
-
export declare function getPriceRanges(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 getPrice(product: Product): {
|
|
24
|
-
price: number;
|
|
25
|
-
compareAtPrice: number;
|
|
26
|
-
isSale: boolean;
|
|
27
|
-
};
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=price.d.ts.map
|
package/dist/lib/price.d.ts.map
DELETED
|
@@ -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,8BAA8B,oBACxB,cAAc,EAAE,mBAelC,CAAA;AAED,eAAO,MAAM,kBAAkB,iBAChB,WAAW,gBACX,MAAM,EAAE,KACpB,KAAK,GAAG,SAqBV,CAAA;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO;WAsBpC,MAAM;YACL,OAAO;;;;EAclB;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO;;;;EAQxC"}
|
package/dist/lib/price.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Return the cheapest available variant for pricing details
|
|
2
|
-
export const getCheapestProductFromVariants = (productVariants) => {
|
|
3
|
-
const availableVariants = productVariants.filter((variant) => variant.availableForSale);
|
|
4
|
-
// Use pricing from in-stock variants only. If all are out of stock use all variants.
|
|
5
|
-
const activeVariants = availableVariants.length
|
|
6
|
-
? availableVariants
|
|
7
|
-
: productVariants;
|
|
8
|
-
return activeVariants.reduce((lowest, current) => {
|
|
9
|
-
return parseFloat(current.price.amount) < parseFloat(lowest.price.amount)
|
|
10
|
-
? current
|
|
11
|
-
: lowest;
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
export const getBadgeForProduct = (badgeConfig = {}, productTags = []) => {
|
|
15
|
-
const badgePositions = ["below", "bottom", "top"];
|
|
16
|
-
const badgesCombined = [];
|
|
17
|
-
const addBadgesToCombined = (badgePosition) => {
|
|
18
|
-
var _a;
|
|
19
|
-
return (_a = badgeConfig[badgePosition]) === null || _a === void 0 ? void 0 : _a.forEach((badge) => badgesCombined.push(Object.assign(Object.assign({}, badge), { verticalPosition: badgePosition })));
|
|
20
|
-
};
|
|
21
|
-
badgePositions.forEach(addBadgesToCombined);
|
|
22
|
-
badgesCombined.sort((a, b) => a.priority - b.priority);
|
|
23
|
-
let productBadge = badgesCombined.find((badge) => {
|
|
24
|
-
if (productTags.includes(badge.tags[0])) {
|
|
25
|
-
if (productTags.includes(badge.excludeTags[0]))
|
|
26
|
-
return false;
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
});
|
|
31
|
-
return productBadge;
|
|
32
|
-
};
|
|
33
|
-
export function getPriceRanges(product) {
|
|
34
|
-
const { minVariantPrice: minPrice, maxVariantPrice: maxPrice } = product.priceRange;
|
|
35
|
-
const { minVariantPrice: minCompareAt, maxVariantPrice: maxCompareAt } = product.compareAtPriceRange;
|
|
36
|
-
const floatMinPrice = parseFloat(minPrice.amount);
|
|
37
|
-
const floatMaxPrice = minPrice.amount !== maxPrice.amount && parseFloat(maxPrice.amount);
|
|
38
|
-
const floatMinCompareAt = minCompareAt && parseFloat(minCompareAt.amount);
|
|
39
|
-
const floatMaxCompareAt = minCompareAt.amount !== maxCompareAt.amount &&
|
|
40
|
-
parseFloat(maxCompareAt.amount);
|
|
41
|
-
const isSale = product.variants.some((variant) => {
|
|
42
|
-
return (variant.compareAtPrice &&
|
|
43
|
-
parseFloat(variant.price.amount) <
|
|
44
|
-
parseFloat(variant.compareAtPrice.amount));
|
|
45
|
-
});
|
|
46
|
-
const formattedPrice = {
|
|
47
|
-
price: floatMinPrice,
|
|
48
|
-
isSale,
|
|
49
|
-
};
|
|
50
|
-
if (floatMaxPrice)
|
|
51
|
-
formattedPrice.priceHigh = floatMaxPrice;
|
|
52
|
-
if (floatMinCompareAt)
|
|
53
|
-
formattedPrice.compareAtPrice = floatMinCompareAt;
|
|
54
|
-
if (floatMaxCompareAt)
|
|
55
|
-
formattedPrice.compareAtPriceHigh = floatMaxCompareAt;
|
|
56
|
-
return formattedPrice;
|
|
57
|
-
}
|
|
58
|
-
export function getPrice(product) {
|
|
59
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
60
|
-
return {
|
|
61
|
-
price: parseFloat((_b = (_a = product.variants[0]) === null || _a === void 0 ? void 0 : _a.price) === null || _b === void 0 ? void 0 : _b.amount),
|
|
62
|
-
compareAtPrice: parseFloat((_d = (_c = product.variants[0]) === null || _c === void 0 ? void 0 : _c.compareAtPrice) === null || _d === void 0 ? void 0 : _d.amount),
|
|
63
|
-
isSale: parseFloat((_f = (_e = product.variants[0]) === null || _e === void 0 ? void 0 : _e.price) === null || _f === void 0 ? void 0 : _f.amount) <
|
|
64
|
-
parseFloat((_h = (_g = product.variants[0]) === null || _g === void 0 ? void 0 : _g.compareAtPrice) === null || _h === void 0 ? void 0 : _h.amount),
|
|
65
|
-
};
|
|
66
|
-
}
|