@tapcart/mobile-components 0.7.1 → 0.7.4

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 (33) hide show
  1. package/dist/components/hooks/use-nosto-recommendation.d.ts +8 -0
  2. package/dist/components/hooks/use-nosto-recommendation.d.ts.map +1 -0
  3. package/dist/components/hooks/use-nosto-recommendation.js +105 -0
  4. package/dist/components/hooks/use-products.d.ts.map +1 -1
  5. package/dist/components/hooks/use-products.js +2 -1
  6. package/dist/components/templates/ProductCard/utils.d.ts +78 -0
  7. package/dist/components/templates/ProductCard/utils.d.ts.map +1 -0
  8. package/dist/components/templates/ProductCard/utils.js +128 -0
  9. package/dist/components/templates/ProductGrid/index.d.ts +1 -0
  10. package/dist/components/templates/ProductGrid/index.d.ts.map +1 -0
  11. package/dist/components/templates/ProductGrid/index.js +1 -0
  12. package/dist/components/ui/ProductCard/utils.d.ts +94 -0
  13. package/dist/components/ui/ProductCard/utils.d.ts.map +1 -0
  14. package/dist/components/ui/ProductCard/utils.js +148 -0
  15. package/dist/components/ui/ProductGrid/index.d.ts +1 -0
  16. package/dist/components/ui/ProductGrid/index.d.ts.map +1 -0
  17. package/dist/components/ui/ProductGrid/index.js +1 -0
  18. package/dist/components/ui/carousel.d.ts.map +1 -1
  19. package/dist/components/ui/carousel.js +1 -0
  20. package/dist/components/ui/favorite.d.ts.map +1 -1
  21. package/dist/components/ui/favorite.js +1 -1
  22. package/dist/components/ui/image.js +2 -2
  23. package/dist/index.d.ts +5 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +5 -1
  26. package/dist/lib/price.d.ts +29 -0
  27. package/dist/lib/price.d.ts.map +1 -0
  28. package/dist/lib/price.js +66 -0
  29. package/dist/lib/utils.d.ts +2 -0
  30. package/dist/lib/utils.d.ts.map +1 -1
  31. package/dist/lib/utils.js +28 -3
  32. package/dist/tapcart-mobile-components.umd.js +44 -0
  33. package/package.json +2 -2
@@ -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;AAE1C,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
+ {"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(","));
@@ -0,0 +1,78 @@
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
@@ -0,0 +1 @@
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;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,2BAA2B,CACzC,MAAM,GAAE,OAAO,CAAC,sBAAsB,CAAM;;;;oFAgC7C;AAED,UAAU,yBAAyB;IACjC,QAAQ,EAAE;QACR,YAAY,EAAE;YACZ,UAAU,EAAE,MAAM,CAAA;YAClB,WAAW,EAAE,MAAM,CAAA;YACnB,aAAa,EAAE,MAAM,CAAA;YACrB,cAAc,EAAE,MAAM,CAAA;YACtB,sBAAsB,EAAE,MAAM,CAAA;SAC/B,CAAA;QACD,uBAAuB,EAAE;YACvB,KAAK,EAAE,MAAM,CAAA;YACb,GAAG,EAAE,MAAM,CAAA;YACX,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,qBAAqB,EAAE;YACrB,GAAG,EAAE,MAAM,CAAA;YACX,MAAM,EAAE,MAAM,CAAA;YACd,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;SACd,CAAA;QACD,gBAAgB,EAAE;YAChB,IAAI,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"}
@@ -0,0 +1,128 @@
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
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/templates/ProductGrid/index.tsx"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -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;Y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AgB,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,gCAAgC,CAC9C,MAAM,GAAE,OAAO,CAAC,yBAAyB,CAAM;;;;;;;oFAuGhD;AAED,KAAK,SAAS,GAAG;IAAE,YAAY,EAAE,YAAY,GAAG,QAAQ,CAAA;CAAE,CAAA;AAE1D,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;EAuBrC"}
@@ -0,0 +1,148 @@
1
+ import { cva } from "../../../lib/utils";
2
+ export function getProductCardBadgeVariantsFn(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
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/ui/ProductGrid/index.tsx"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAA;AAS7B,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;AAC1C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAChE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAC/C,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAE9C,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EA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IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAA;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;CAC/C,CAAA;AA0BD,QAAA,MAAM,QAAQ,6HAuIb,CAAA;AAGD,QAAA,MAAM,eAAe,6GAmBnB,CAAA;AAGF,QAAA,MAAM,YAAY,6GAmBhB,CAAA;AAGF,QAAA,MAAM,gBAAgB,kLA0BpB,CAAA;AAGF,QAAA,MAAM,YAAY,kLA0BhB,CAAA;AAGF,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,QAAA,MAAM,YAAY,iIAqDjB,CAAA;AA8DD,OAAO,EACL,KAAK,WAAW,EAChB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,CAAA"}
@@ -90,6 +90,7 @@ const Carousel = React.forwardRef((_a, ref) => {
90
90
  .on("reInit", setTweenFactor)
91
91
  .on("reInit", tweenScale)
92
92
  .on("scroll", tweenScale)
93
+ // @ts-ignore
93
94
  .on("slideFocus", tweenScale);
94
95
  }, [api, tweenScale]);
95
96
  return (_jsx(CarouselContext.Provider, Object.assign({ value: {
@@ -1 +1 @@
1
- {"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../components/ui/favorite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAGL,OAAO,EAER,MAAM,iB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BpB,CAAA;AAEF,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EACP,sBAAsB,GACtB,WAAW,GACX,UAAU,GACV,aAAa,GACb,cAAc,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CACjC;AAED,QAAA,MAAM,QAAQ,yFA2Db,CAAA;AAGD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
@@ -48,7 +48,7 @@ const Favorite = React.forwardRef((_a, forwardedRef) => {
48
48
  size,
49
49
  showBackgroundShadow,
50
50
  layoutType,
51
- }), className), style: Object.assign({}, (showBackground && Object.assign(Object.assign({ borderRadius: `${cornerRadius}px`, backgroundColor: backgroundColor, borderColor: borderColorStyle }, getBorderSidesStyle(borderSides)), getPaddingStyle(borderPadding)))) }, props, { children: _jsx(Icon, { url: iconUrl, color: selected ? "stateColors-favorites" : "stateColors-disabled", size: size === "small" ? "xs" : "sm", fillColor: selected ? favoriteFillColor : disabledFillColor, style: {
51
+ }), className), style: Object.assign({}, (showBackground && Object.assign(Object.assign({ borderRadius: `${cornerRadius}px`, backgroundColor: backgroundColor, borderColor: borderColorStyle }, getBorderSidesStyle(borderSides)), getPaddingStyle(borderPadding)))) }, props, { children: _jsx(Icon, { url: iconUrl, size: size === "small" ? "xs" : "sm", color: selected ? favoriteFillColor : disabledFillColor, style: {
52
52
  opacity: isPressed ? 0.7 : 1,
53
53
  } }) })));
54
54
  });