@tapcart/mobile-components 0.7.7 → 0.7.9
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-nosto-recommendation.d.ts +8 -0
- package/dist/components/hooks/use-nosto-recommendation.d.ts.map +1 -0
- package/dist/components/hooks/use-nosto-recommendation.js +105 -0
- package/dist/components/hooks/use-products.d.ts.map +1 -1
- package/dist/components/hooks/use-products.js +2 -1
- package/dist/components/hooks/use-reviews.d.ts +1 -1
- package/dist/components/hooks/use-reviews.d.ts.map +1 -1
- package/dist/components/hooks/use-reviews.js +32 -10
- package/dist/components/hooks/use-style-utils.d.ts +69 -0
- package/dist/components/hooks/use-style-utils.d.ts.map +1 -0
- package/dist/components/hooks/use-style-utils.js +77 -0
- package/dist/components/ui/ProductCard/utils.d.ts +94 -0
- package/dist/components/ui/ProductCard/utils.d.ts.map +1 -0
- package/dist/components/ui/ProductCard/utils.js +148 -0
- package/dist/components/ui/button.d.ts +1 -0
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +6 -2
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +3 -2
- package/dist/components/ui/drawer.d.ts +3 -5
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +8 -7
- package/dist/components/ui/favorite.js +1 -1
- package/dist/components/ui/image.js +2 -2
- package/dist/components/ui/tap.d.ts +12 -0
- package/dist/components/ui/tap.d.ts.map +1 -0
- package/dist/components/{hooks/use-tap.js → ui/tap.js} +37 -3
- package/dist/components/ui/video-enhanced.d.ts +18 -0
- package/dist/components/ui/video-enhanced.d.ts.map +1 -0
- package/dist/components/ui/video-enhanced.js +171 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/lib/block-utils.d.ts +97 -0
- package/dist/lib/block-utils.d.ts.map +1 -0
- package/dist/lib/block-utils.js +77 -0
- package/dist/lib/price.d.ts +29 -0
- package/dist/lib/price.d.ts.map +1 -0
- package/dist/lib/price.js +66 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +35 -6
- package/dist/styles.css +49 -11
- package/dist/tests/utils.test.d.ts +2 -0
- package/dist/tests/utils.test.d.ts.map +1 -0
- package/dist/tests/utils.test.js +34 -0
- package/package.json +10 -4
- package/dist/components/hooks/use-tap.d.ts +0 -8
- package/dist/components/hooks/use-tap.d.ts.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Integrations } from "app-studio-types";
|
|
2
|
+
export declare function useNostoRecommendations(integrations: Integrations, baseURL: string, slotId?: null): {
|
|
3
|
+
recommendations: import("app-studio-types").Product[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: any;
|
|
6
|
+
isEmpty: boolean;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=use-nosto-recommendation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-nosto-recommendation.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-nosto-recommendation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AA+E/C,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,MAAM,EACf,MAAM,OAAO;;;;;EA4Cd"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1C,KAAK,GAAG,GAAG,MAAM,CAAA;AACjB,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AACxD,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,OAAO,EAAE,GAAG,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAC1E,UAAU,CAAC,EAAE,cAAc,EAAE,CAAA;CAC9B,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CAyD7E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import useSWR from "swr";
|
|
3
|
+
import { getProductGidsFromIds } from "../../lib/utils";
|
|
3
4
|
export function useProducts(props) {
|
|
4
5
|
let url = null;
|
|
5
6
|
let body = null;
|
|
@@ -7,7 +8,7 @@ export function useProducts(props) {
|
|
|
7
8
|
const { baseURL, productIds, productHandles, metafields, collection, queryVariables, } = props;
|
|
8
9
|
let queryParams = new URLSearchParams();
|
|
9
10
|
if ((productIds === null || productIds === void 0 ? void 0 : productIds.length) > 0) {
|
|
10
|
-
queryParams.set("ids", productIds.join(","));
|
|
11
|
+
queryParams.set("ids", getProductGidsFromIds(productIds).join(","));
|
|
11
12
|
}
|
|
12
13
|
if ((productHandles === null || productHandles === void 0 ? void 0 : productHandles.length) > 0) {
|
|
13
14
|
queryParams.set("handles", productHandles.join(","));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-reviews.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-reviews.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGtF,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC;IACjF,SAAS,EAAE,OAAO,CAAC;IACnB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AAK,IAAI,CAAC;CACtC,CAAA;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,wBAAwB,CA0H1F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback, useEffect } from "react";
|
|
2
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
3
|
import useSWR from "swr";
|
|
4
4
|
import useSWRInfinite from "swr/infinite";
|
|
5
5
|
import { useInView } from 'react-intersection-observer';
|
|
@@ -52,13 +52,13 @@ export function useReviews(props) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
export function useReviewsInfinite(props) {
|
|
55
|
-
var _a
|
|
55
|
+
var _a;
|
|
56
56
|
let url = null;
|
|
57
57
|
const { ref, inView } = useInView({ rootMargin: "800px" });
|
|
58
58
|
let baseURL = "";
|
|
59
59
|
let queryParams = new URLSearchParams();
|
|
60
60
|
if (props) {
|
|
61
|
-
const { productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage } = props;
|
|
61
|
+
const { productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage } = props;
|
|
62
62
|
baseURL = props.baseURL;
|
|
63
63
|
if (productId.length > 0) {
|
|
64
64
|
queryParams.set("id", productId);
|
|
@@ -92,12 +92,29 @@ export function useReviewsInfinite(props) {
|
|
|
92
92
|
url = `${baseURL}/reviews/by-id?${queryParams.toString()}`;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
const isEndReached = useRef(false);
|
|
95
96
|
const getKey = (pageIndex, previousPageData) => {
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
97
|
+
var _a, _b;
|
|
98
|
+
if ((props === null || props === void 0 ? void 0 : props.provider) === "yotpo") {
|
|
99
|
+
const dataType = queryParams.get("dataType") === "null" ? null : queryParams.get("dataType");
|
|
100
|
+
if (dataType == null) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
if (previousPageData && previousPageData.pagination) {
|
|
104
|
+
const { perPage, total } = previousPageData.pagination;
|
|
105
|
+
isEndReached.current = (((pageIndex + 1) * perPage) >= total);
|
|
106
|
+
}
|
|
107
|
+
return `${baseURL}/reviews/by-id?${queryParams.toString()}&page=${pageIndex + 1}`;
|
|
108
|
+
}
|
|
109
|
+
if ((props === null || props === void 0 ? void 0 : props.provider) === "okendo") {
|
|
110
|
+
if (pageIndex === 0)
|
|
111
|
+
return `${baseURL}/reviews/by-id?${queryParams.toString()}`;
|
|
112
|
+
if (!((_a = previousPageData === null || previousPageData === void 0 ? void 0 : previousPageData.pagination) === null || _a === void 0 ? void 0 : _a.nextUrl)) {
|
|
113
|
+
isEndReached.current = true;
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return `${baseURL}/reviews/by-id?${queryParams.toString()}&nextUrl=${((_b = previousPageData === null || previousPageData === void 0 ? void 0 : previousPageData.pagination) === null || _b === void 0 ? void 0 : _b.nextUrl) || null}`;
|
|
99
117
|
}
|
|
100
|
-
return `${baseURL}/reviews/by-id?${queryParams.toString()}&page=${pageIndex + 1}`;
|
|
101
118
|
};
|
|
102
119
|
const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || ((url) => fetch(url).then((res) => res.json()));
|
|
103
120
|
const { data: dataInfinite, error: errorInfinite, size, setSize, isLoading, isValidating, } = useSWRInfinite(getKey, fetcher);
|
|
@@ -110,17 +127,22 @@ export function useReviewsInfinite(props) {
|
|
|
110
127
|
pagination: (dataInfinite === null || dataInfinite === void 0 ? void 0 : dataInfinite.length) ? dataInfinite[0].pagination : null,
|
|
111
128
|
reviews: mergedReviews
|
|
112
129
|
};
|
|
113
|
-
|
|
130
|
+
if ((props === null || props === void 0 ? void 0 : props.provider) === "yotpo") {
|
|
131
|
+
isEndReached.current = (mergedReviews === null || mergedReviews === void 0 ? void 0 : mergedReviews.length) === ((_a = searchResponse.pagination) === null || _a === void 0 ? void 0 : _a.total);
|
|
132
|
+
}
|
|
114
133
|
const loadMore = useCallback(() => {
|
|
115
|
-
if (!isLoading && !isValidating && !
|
|
134
|
+
if (!isLoading && !isValidating && !isEndReached.current) {
|
|
116
135
|
setSize(size + 1);
|
|
117
136
|
}
|
|
118
|
-
}, [isLoading, isValidating, setSize, size
|
|
137
|
+
}, [isLoading, isValidating, setSize, size]);
|
|
119
138
|
useEffect(() => {
|
|
120
139
|
if (inView) {
|
|
121
140
|
loadMore();
|
|
122
141
|
}
|
|
123
142
|
}, [inView, loadMore]);
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
isEndReached.current = false;
|
|
145
|
+
}, [props]);
|
|
124
146
|
return {
|
|
125
147
|
data: searchResponse || {},
|
|
126
148
|
error: errorInfinite,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
type BorderSide = "all" | "top" | "bottom" | "left" | "right";
|
|
2
|
+
type BorderSides = BorderSide[];
|
|
3
|
+
declare const getBorderSidesStyle: (borderSides: BorderSides) => {
|
|
4
|
+
borderWidth: string;
|
|
5
|
+
borderTopWidth?: undefined;
|
|
6
|
+
borderBottomWidth?: undefined;
|
|
7
|
+
borderLeftWidth?: undefined;
|
|
8
|
+
borderRightWidth?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
borderTopWidth: string | number;
|
|
11
|
+
borderBottomWidth: string | number;
|
|
12
|
+
borderLeftWidth: string | number;
|
|
13
|
+
borderRightWidth: string | number;
|
|
14
|
+
borderWidth?: undefined;
|
|
15
|
+
};
|
|
16
|
+
type VerticalAlignment = "top" | "middle" | "bottom";
|
|
17
|
+
type Spacing = {
|
|
18
|
+
top: number;
|
|
19
|
+
bottom: number;
|
|
20
|
+
left: number;
|
|
21
|
+
right: number;
|
|
22
|
+
};
|
|
23
|
+
interface AlignmentAndSpacing {
|
|
24
|
+
alignment: VerticalAlignment;
|
|
25
|
+
spacing: Spacing;
|
|
26
|
+
}
|
|
27
|
+
declare const getVerticalAlignmentStyle: (alignmentAndSpacing: AlignmentAndSpacing) => {
|
|
28
|
+
bottom: string;
|
|
29
|
+
top: string;
|
|
30
|
+
transform?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
top: string;
|
|
33
|
+
transform: string;
|
|
34
|
+
bottom?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
bottom?: undefined;
|
|
37
|
+
top?: undefined;
|
|
38
|
+
transform?: undefined;
|
|
39
|
+
};
|
|
40
|
+
type BackgroundAndPadding = {
|
|
41
|
+
backgroundColor?: ColorOption;
|
|
42
|
+
borderSides?: BorderSides;
|
|
43
|
+
borderColor?: ColorOption;
|
|
44
|
+
cornerRadius?: number;
|
|
45
|
+
padding?: Partial<Spacing>;
|
|
46
|
+
};
|
|
47
|
+
type ColorOption = {
|
|
48
|
+
type: "brand-kit" | "custom";
|
|
49
|
+
value: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
declare const getColor: (colorOption: ColorOption) => string | undefined;
|
|
52
|
+
type BackgroundAndSpacing = AlignmentAndSpacing & {
|
|
53
|
+
backgroundColor?: ColorOption;
|
|
54
|
+
borderColor?: ColorOption;
|
|
55
|
+
backgroundCorners?: number;
|
|
56
|
+
};
|
|
57
|
+
type TextStyle = {
|
|
58
|
+
font: {
|
|
59
|
+
family: string;
|
|
60
|
+
weight: number | string;
|
|
61
|
+
};
|
|
62
|
+
size: number | string;
|
|
63
|
+
color: ColorOption;
|
|
64
|
+
uppercase: boolean;
|
|
65
|
+
textAlignment: "left" | "center" | "right" | "justify";
|
|
66
|
+
};
|
|
67
|
+
type Headline = TextStyle;
|
|
68
|
+
type Subtext = TextStyle;
|
|
69
|
+
//# sourceMappingURL=use-style-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-style-utils.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-style-utils.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU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ClB,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;CACvD,CAAA;AAED,KAAK,QAAQ,GAAG,SAAS,CAAA;AACzB,KAAK,OAAO,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const getBorderSidesStyle = (borderSides) => {
|
|
3
|
+
const style = borderSides.includes("all")
|
|
4
|
+
? { borderWidth: "1px" }
|
|
5
|
+
: {
|
|
6
|
+
borderTopWidth: borderSides.includes("top") ? "1px" : 0,
|
|
7
|
+
borderBottomWidth: borderSides.includes("bottom") ? "1px" : 0,
|
|
8
|
+
borderLeftWidth: borderSides.includes("left") ? "1px" : 0,
|
|
9
|
+
borderRightWidth: borderSides.includes("right") ? "1px" : 0,
|
|
10
|
+
};
|
|
11
|
+
return style;
|
|
12
|
+
};
|
|
13
|
+
const getVerticalAlignmentStyle = (alignmentAndSpacing) => {
|
|
14
|
+
const { alignment, spacing } = alignmentAndSpacing;
|
|
15
|
+
switch (alignment) {
|
|
16
|
+
case "bottom":
|
|
17
|
+
return { bottom: `${spacing.bottom}px`, top: "auto" };
|
|
18
|
+
case "middle":
|
|
19
|
+
return { top: "50%", transform: "translateY(-50%)" };
|
|
20
|
+
case "top":
|
|
21
|
+
return { top: `${spacing.top}px`, bottom: "auto" };
|
|
22
|
+
default:
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const getColor = (colorOption) => {
|
|
27
|
+
return colorOption
|
|
28
|
+
? colorOption.type === "brand-kit"
|
|
29
|
+
? `var(--${colorOption.value})`
|
|
30
|
+
: colorOption.value
|
|
31
|
+
: undefined;
|
|
32
|
+
};
|
|
33
|
+
function getBackgroundAndPaddingStyle(backgroundAndPadding) {
|
|
34
|
+
const { backgroundColor, borderSides, borderColor, cornerRadius, padding } = backgroundAndPadding;
|
|
35
|
+
return {
|
|
36
|
+
backgroundColor: getColor(backgroundColor),
|
|
37
|
+
borderColor: getColor(borderColor),
|
|
38
|
+
borderTopWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("top")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
39
|
+
? "1px"
|
|
40
|
+
: undefined,
|
|
41
|
+
borderBottomWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("bottom")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
42
|
+
? "1px"
|
|
43
|
+
: undefined,
|
|
44
|
+
borderLeftWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("left")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
45
|
+
? "1px"
|
|
46
|
+
: undefined,
|
|
47
|
+
borderRightWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("right")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
48
|
+
? "1px"
|
|
49
|
+
: undefined,
|
|
50
|
+
paddingTop: (padding === null || padding === void 0 ? void 0 : padding.top) !== undefined ? `${padding.top}px` : undefined,
|
|
51
|
+
paddingBottom: (padding === null || padding === void 0 ? void 0 : padding.bottom) !== undefined ? `${padding.bottom}px` : undefined,
|
|
52
|
+
paddingLeft: (padding === null || padding === void 0 ? void 0 : padding.left) !== undefined ? `${padding.left}px` : undefined,
|
|
53
|
+
paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
|
|
54
|
+
borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined,
|
|
55
|
+
borderRadius: cornerRadius !== undefined ? `${cornerRadius}px` : undefined,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function getBackgroundAndSpacingStyle(backgroundAndSpacing) {
|
|
59
|
+
const { spacing, borderColor, backgroundColor, backgroundCorners } = backgroundAndSpacing;
|
|
60
|
+
return {
|
|
61
|
+
padding: `${spacing.top}px ${spacing.right}px ${spacing.bottom}px ${spacing.left}px`,
|
|
62
|
+
borderColor: borderColor ? borderColor.value : "transparent",
|
|
63
|
+
backgroundColor: getColor(backgroundColor) || "transparent",
|
|
64
|
+
borderRadius: `${backgroundCorners !== null && backgroundCorners !== void 0 ? backgroundCorners : 0}px`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function getTextStyle(textStyle) {
|
|
68
|
+
const { font, size, color, uppercase, textAlignment } = textStyle;
|
|
69
|
+
return {
|
|
70
|
+
fontFamily: font.family,
|
|
71
|
+
fontWeight: font.weight,
|
|
72
|
+
fontSize: size,
|
|
73
|
+
color: getColor(color),
|
|
74
|
+
textTransform: uppercase ? "uppercase" : "none",
|
|
75
|
+
textAlign: textAlignment,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;YACZ,UAAU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geVariantsFn(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 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
|
+
}
|
|
@@ -17,6 +17,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
17
17
|
iconStrokeColor?: string;
|
|
18
18
|
iconClassName?: string;
|
|
19
19
|
iconPosition?: "left" | "right";
|
|
20
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
20
21
|
}
|
|
21
22
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
22
23
|
declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAGL,KAAK,EAEL,SAAS,EAET,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAGL,KAAK,EAEL,SAAS,EAET,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAMxB,QAAA,MAAM,cAAc;;;mFAgCnB,CAAA;AAwCD,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IAC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