@tapcart/mobile-components 0.7.50 → 0.7.52
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-block-conditional-rendering.d.ts.map +1 -1
- package/dist/components/hooks/use-block-conditional-rendering.js +36 -55
- package/dist/components/hooks/use-debug-dependencies.d.ts +10 -0
- package/dist/components/hooks/use-debug-dependencies.d.ts.map +1 -0
- package/dist/components/hooks/use-debug-dependencies.js +18 -0
- package/dist/components/hooks/use-layout.d.ts +13 -0
- package/dist/components/hooks/use-layout.d.ts.map +1 -0
- package/dist/components/hooks/use-layout.js +23 -0
- package/dist/components/hooks/use-order-details.d.ts.map +1 -1
- package/dist/components/hooks/use-order-details.js +4 -2
- package/dist/components/ui/selectors.d.ts +1 -0
- package/dist/components/ui/selectors.d.ts.map +1 -1
- package/dist/components/ui/selectors.js +2 -2
- package/dist/components/ui/wishlist.d.ts +2 -0
- package/dist/components/ui/wishlist.d.ts.map +1 -1
- package/dist/components/ui/wishlist.js +9 -5
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +0 -54
- package/dist/styles.css +6 -3
- package/package.json +1 -1
- package/dist/components/ThemeProvider.d.ts +0 -3
- package/dist/components/ThemeProvider.d.ts.map +0 -1
- package/dist/components/ThemeProvider.js +0 -18
- package/dist/components/ThemeToggle.d.ts +0 -2
- package/dist/components/ThemeToggle.d.ts.map +0 -1
- package/dist/components/ThemeToggle.js +0 -8
- package/dist/components/hooks/use-block-conditionals.d.ts +0 -2
- package/dist/components/hooks/use-block-conditionals.d.ts.map +0 -1
- package/dist/components/hooks/use-block-conditionals.js +0 -2
- package/dist/components/hooks/use-tap.d.ts +0 -8
- package/dist/components/hooks/use-tap.d.ts.map +0 -1
- package/dist/components/hooks/use-tap.js +0 -100
- package/dist/components/ui/input.d.ts +0 -17
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/input.js +0 -35
- package/dist/components/ui/product-grid.d.ts +0 -15
- package/dist/components/ui/product-grid.d.ts.map +0 -1
- package/dist/components/ui/product-grid.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-block-conditional-rendering.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-block-conditional-rendering.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EAGb,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"use-block-conditional-rendering.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-block-conditional-rendering.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EAGb,MAAM,kBAAkB,CAAA;AAezB,eAAO,MAAM,4BAA4B,WAC/B;IACN,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,UACO,YAAY;;;CAyJrB,CAAA"}
|
|
@@ -16,11 +16,11 @@ import { useCollection } from "./use-collection";
|
|
|
16
16
|
import { useSearchParams } from "next/navigation";
|
|
17
17
|
//@ts-expect-error
|
|
18
18
|
import { useVariables } from "@tapcart/webbridge-react";
|
|
19
|
-
import { gidFromId, countNumberOfTagsInState, getEnvState, shouldShowBlock,
|
|
19
|
+
import { gidFromId, countNumberOfTagsInState, getEnvState, shouldShowBlock, } from "../../lib/utils";
|
|
20
20
|
export const useBlockConditionalRendering = (_props, _block) => {
|
|
21
|
-
var _a, _b, _c, _d, _e;
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
var _a, _b, _c, _d, _e, _f;
|
|
22
|
+
const _g = ((_a = _block === null || _block === void 0 ? void 0 : _block.visibilityConditions) === null || _a === void 0 ? void 0 : _a.conditions) || {}, { enabled: isEnabled = false, exclude: isInverse = false } = _g, restOfProps = __rest(_g, ["enabled", "exclude"]);
|
|
23
|
+
let shouldShow = true;
|
|
24
24
|
const blockState = restOfProps;
|
|
25
25
|
const { appId = "", apiUrl = "" } = _props;
|
|
26
26
|
const searchParams = useSearchParams();
|
|
@@ -29,7 +29,7 @@ export const useBlockConditionalRendering = (_props, _block) => {
|
|
|
29
29
|
const customerVariables = variables === null || variables === void 0 ? void 0 : variables.customer;
|
|
30
30
|
// locale is provided in this form en_US
|
|
31
31
|
const [language, country] = ((_b = deviceVariables === null || deviceVariables === void 0 ? void 0 : deviceVariables.locale) === null || _b === void 0 ? void 0 : _b.split("_")) || [];
|
|
32
|
-
const productId = (_c = searchParams
|
|
32
|
+
const productId = (_c = searchParams.get("productId")) !== null && _c !== void 0 ? _c : undefined;
|
|
33
33
|
const location = {
|
|
34
34
|
country: country || "US",
|
|
35
35
|
language: language || "en",
|
|
@@ -45,7 +45,7 @@ export const useBlockConditionalRendering = (_props, _block) => {
|
|
|
45
45
|
};
|
|
46
46
|
}), [blockProductMetafields]);
|
|
47
47
|
// Fetch product if productId is present
|
|
48
|
-
const { products, error: useProductsError, isLoading:
|
|
48
|
+
const { products, error: useProductsError, isLoading: useProductsLoading, } = useProducts(productId !== undefined && isEnabled
|
|
49
49
|
? {
|
|
50
50
|
productIds: [gidFromId(productId)],
|
|
51
51
|
baseURL: apiUrl,
|
|
@@ -68,9 +68,9 @@ export const useBlockConditionalRendering = (_props, _block) => {
|
|
|
68
68
|
.map((m) => `${m.namespace}.${m.key}`)
|
|
69
69
|
.join(",")
|
|
70
70
|
: undefined, [collectionMetafieldsQuery]);
|
|
71
|
-
const collectionId = (_d = searchParams
|
|
72
|
-
const collectionHandle = (_e = searchParams
|
|
73
|
-
const { specificCollection = {}, error: useCollectionError, loading:
|
|
71
|
+
const collectionId = (_d = searchParams.get("collectionId")) !== null && _d !== void 0 ? _d : undefined;
|
|
72
|
+
const collectionHandle = (_e = searchParams.get("collectionHandle")) !== null && _e !== void 0 ? _e : undefined;
|
|
73
|
+
const { specificCollection = {}, error: useCollectionError, loading: useCollectionLoading, } = useCollection({
|
|
74
74
|
appId,
|
|
75
75
|
apiUrl,
|
|
76
76
|
collectionId,
|
|
@@ -78,61 +78,42 @@ export const useBlockConditionalRendering = (_props, _block) => {
|
|
|
78
78
|
language: location === null || location === void 0 ? void 0 : location.language,
|
|
79
79
|
metafields: memoizedMetafields,
|
|
80
80
|
});
|
|
81
|
-
// Combine loading states
|
|
82
|
-
const isLoading = isProductsLoading || isCollectionLoading;
|
|
83
81
|
if (useProductsError || useCollectionError) {
|
|
84
82
|
console.error("Unable to load products in conditional block rendering hook: ", useProductsError !== null && useProductsError !== void 0 ? useProductsError : useCollectionError);
|
|
85
83
|
}
|
|
86
|
-
// Build context for condition evaluation
|
|
87
|
-
const context = {
|
|
88
|
-
location,
|
|
89
|
-
products,
|
|
90
|
-
collection: specificCollection,
|
|
91
|
-
customer: customerVariables,
|
|
92
|
-
blockState,
|
|
93
|
-
};
|
|
94
|
-
console.log({ context, blockState, conditions });
|
|
95
|
-
let shouldShow = true;
|
|
96
|
-
const blockConditionalsIsEnabled = conditionalsV1IsEnabled || conditionalsV2IsEnabled;
|
|
97
|
-
const blockHasTags = countNumberOfTagsInState(blockState) > 0;
|
|
98
|
-
const product = products.length === 1 ? products[0] : undefined;
|
|
99
|
-
const envState = getEnvState({
|
|
100
|
-
location,
|
|
101
|
-
product,
|
|
102
|
-
collection: specificCollection,
|
|
103
|
-
customer: customerVariables,
|
|
104
|
-
});
|
|
105
84
|
try {
|
|
106
|
-
if
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
85
|
+
// if block has tags
|
|
86
|
+
if (((_f = _block.visibilityConditions) === null || _f === void 0 ? void 0 : _f.conditions) !== undefined && isEnabled) {
|
|
87
|
+
const blockHasTags = countNumberOfTagsInState(blockState) > 0;
|
|
88
|
+
if (blockHasTags) {
|
|
89
|
+
const product = products.length === 1 ? products[0] : undefined;
|
|
90
|
+
const envState = getEnvState({
|
|
91
|
+
location,
|
|
92
|
+
product,
|
|
93
|
+
collection: specificCollection,
|
|
94
|
+
customer: customerVariables,
|
|
95
|
+
});
|
|
96
|
+
//@ts-expect-errors
|
|
97
|
+
const shouldShowPreInverse = shouldShowBlock(envState, blockState);
|
|
98
|
+
// TODO: Currently negation of properties is not available but is required for migration of certain merchants
|
|
99
|
+
// This code is to be removed and updated when inverse feature is available for all blocks
|
|
100
|
+
// If exclude tag is applied then block should show inversely
|
|
101
|
+
if (isInverse) {
|
|
102
|
+
shouldShow = !shouldShowPreInverse;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
shouldShow = shouldShowPreInverse;
|
|
125
106
|
}
|
|
126
107
|
}
|
|
127
108
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
shouldShow
|
|
109
|
+
// if conditionals is disabled, show the block.
|
|
110
|
+
if (!isEnabled) {
|
|
111
|
+
return { shouldShow: true, isLoading: false };
|
|
131
112
|
}
|
|
113
|
+
return { shouldShow, isLoading: useProductsLoading || useCollectionLoading };
|
|
132
114
|
}
|
|
133
115
|
catch (e) {
|
|
134
|
-
console.error("
|
|
135
|
-
shouldShow
|
|
116
|
+
console.error("conditionals error: ", e);
|
|
117
|
+
return { shouldShow: true, isLoading: false };
|
|
136
118
|
}
|
|
137
|
-
return { shouldShow, isLoading };
|
|
138
119
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to debug dependency changes.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* useDebugDependencies([dependencyA, dependencyB]);
|
|
6
|
+
*
|
|
7
|
+
* @param {Array} deps - Array of dependencies to monitor for changes.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDebugDependencies(deps: any[]): void;
|
|
10
|
+
//# sourceMappingURL=use-debug-dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-debug-dependencies.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-debug-dependencies.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,QAU/C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook to debug dependency changes.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* useDebugDependencies([dependencyA, dependencyB]);
|
|
8
|
+
*
|
|
9
|
+
* @param {Array} deps - Array of dependencies to monitor for changes.
|
|
10
|
+
*/
|
|
11
|
+
export function useDebugDependencies(deps) {
|
|
12
|
+
const prevDeps = useRef(deps);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const changedDeps = deps.map((dep, i) => dep !== prevDeps.current[i] ? dep : null);
|
|
15
|
+
console.log("Changed dependencies:", changedDeps);
|
|
16
|
+
prevDeps.current = deps;
|
|
17
|
+
}, [deps]);
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PhoenixLayout } from "lib/tapcart/types";
|
|
2
|
+
type UseLayoutProps = {
|
|
3
|
+
appId: string;
|
|
4
|
+
layoutId: string;
|
|
5
|
+
};
|
|
6
|
+
type UseLayoutReturn = {
|
|
7
|
+
layout: PhoenixLayout | null;
|
|
8
|
+
error: any;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function useLayout({ appId, layoutId, }: UseLayoutProps): UseLayoutReturn;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=use-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-layout.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-layout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGjD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,aAAa,GAAG,IAAI,CAAA;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,GAAG,eAAe,CAYlC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 useSWR from "swr";
|
|
12
|
+
import { fetchLayoutById } from "apps/tapcart-ssr-app/lib/tapcart/index";
|
|
13
|
+
export function useLayout({ appId, layoutId, }) {
|
|
14
|
+
const fetcher = (appId, layoutId) => __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
return fetchLayoutById(appId, layoutId);
|
|
16
|
+
});
|
|
17
|
+
const { data, error } = useSWR([appId, layoutId], fetcher);
|
|
18
|
+
return {
|
|
19
|
+
layout: data || null,
|
|
20
|
+
error,
|
|
21
|
+
isLoading: !data && !error,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAMA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;
|
|
1
|
+
{"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAMA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;AA2JD,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAY,GACb,EAAE,oBAAoB,GAAG,iBAAiB,CA0C1C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { getIdFromGid } from "../../lib/utils";
|
|
3
3
|
import { useProducts } from "./use-products";
|
|
4
4
|
import { useEffect, useMemo, useState } from "react";
|
|
5
|
-
const getSellingPlan = (lineItems, productGid) => {
|
|
5
|
+
const getSellingPlan = (lineItems = [], productGid) => {
|
|
6
6
|
var _a, _b;
|
|
7
7
|
const productId = getIdFromGid(productGid);
|
|
8
8
|
const item = lineItems.find((item) => { var _a, _b; return ((_b = (_a = item === null || item === void 0 ? void 0 : item.variant) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.id) === productId; });
|
|
@@ -40,7 +40,9 @@ const updateLineDetails = (line, products, checkoutData) => {
|
|
|
40
40
|
return;
|
|
41
41
|
line.title = product.title;
|
|
42
42
|
line.vendor = product.vendor;
|
|
43
|
-
|
|
43
|
+
if (checkoutData && checkoutData.lineItems) {
|
|
44
|
+
line.sellingPlan = getSellingPlan(checkoutData.lineItems, line.productId);
|
|
45
|
+
}
|
|
44
46
|
const productVariant = findVariantById(product.variants, line.merchandiseId);
|
|
45
47
|
if (productVariant) {
|
|
46
48
|
updateLineWithVariantDetails(line, productVariant);
|
|
@@ -26,6 +26,7 @@ declare const Selectors: React.ForwardRefExoticComponent<Omit<React.DetailedHTML
|
|
|
26
26
|
type SelectorContainerProps = {
|
|
27
27
|
children: React.ReactElement<SelectorsProps>[] | React.ReactElement<SelectorsProps>;
|
|
28
28
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
29
|
+
height?: string;
|
|
29
30
|
className?: string;
|
|
30
31
|
};
|
|
31
32
|
declare const SelectorContainer: React.FC<SelectorContainerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../components/ui/selectors.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,iBAAiB;;;mFAiBtB,CAAA;AACD,KAAK,cAAc,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAC5D,YAAY,CAAC,OAAO,iBAAiB,CAAC,GAAG;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC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,CAAC,iBAAiB,CAAC,GAAG,SAAS;2CA2CpE,CAAA;AACD,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EACJ,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,GACpC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;IACtC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA8CvD,CAAA;AAID,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -38,7 +38,7 @@ const Selectors = React.forwardRef((_a, ref) => {
|
|
|
38
38
|
disabled,
|
|
39
39
|
}), "group", className), ref: ref }, props, { children: children ? (children) : (_jsx(Text, Object.assign({ type: "body-primary", color: "text-textColors-primaryColor" }, { children: label }))) })));
|
|
40
40
|
});
|
|
41
|
-
const SelectorContainer = ({ children, containerRef, className, }) => {
|
|
41
|
+
const SelectorContainer = ({ children, containerRef, className, height = "42px", }) => {
|
|
42
42
|
const [showFadeLeft, setShowFadeLeft] = React.useState(false);
|
|
43
43
|
const [showFadeRight, setShowFadeRight] = React.useState(false);
|
|
44
44
|
const checkOverflow = () => {
|
|
@@ -55,7 +55,7 @@ const SelectorContainer = ({ children, containerRef, className, }) => {
|
|
|
55
55
|
React.useEffect(() => {
|
|
56
56
|
checkOverflow();
|
|
57
57
|
}, [children]);
|
|
58
|
-
return (_jsx("div", Object.assign({ className: "relative no-scrollbar" }, { children: _jsxs("div", Object.assign({ className: cn(
|
|
58
|
+
return (_jsx("div", Object.assign({ className: "relative no-scrollbar" }, { children: _jsxs("div", Object.assign({ className: cn(`flex gap-2 px-1 h-[${height}] items-center overflow-x-auto overflow-y-hidden no-scrollbar`, className), onScroll: checkOverflow, ref: containerRef }, { children: [children, showFadeLeft && (_jsx("div", { className: "absolute top-0 left-0 w-8 h-full pointer-events-none bg-fade-left" })), showFadeRight && (_jsx("div", { className: "absolute top-0 right-0 w-8 h-full pointer-events-none bg-fade-right" }))] })) })));
|
|
59
59
|
};
|
|
60
60
|
Selectors.displayName = "Selectors";
|
|
61
61
|
export { SelectorContainer, Selectors, selectorsVariants };
|
|
@@ -11,6 +11,8 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
11
11
|
objectFit?: "none" | "fit" | "fill" | "cover" | "contain" | "scale-down";
|
|
12
12
|
isTrigger?: boolean;
|
|
13
13
|
translations: Translations;
|
|
14
|
+
nameStyle?: React.CSSProperties;
|
|
15
|
+
amountStyle?: React.CSSProperties;
|
|
14
16
|
}
|
|
15
17
|
declare const PlaceholderIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
declare const Wishlist: React.ForwardRefExoticComponent<WishlistProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wishlist.d.ts","sourceRoot":"","sources":["../../../components/ui/wishlist.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SA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,12 +15,16 @@ import * as React from "react";
|
|
|
15
15
|
import { Text } from "./text";
|
|
16
16
|
import { cn } from "../../lib/utils";
|
|
17
17
|
import { Icon } from "./icon";
|
|
18
|
-
const PlaceholderIcon = () => (_jsx("div", Object.assign({ className: "flex
|
|
18
|
+
const PlaceholderIcon = () => (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm", style: {
|
|
19
|
+
flex: "0 1 auto",
|
|
20
|
+
} }, { children: _jsx(Icon, { name: "heart-filled", size: "sm", color: "coreColors-secondaryIcon" }) })));
|
|
19
21
|
const Wishlist = React.forwardRef((_a, ref) => {
|
|
20
|
-
var { selected = false, onClick, className, name, amount, imgUrl, aspectRatio, objectFit, isTrigger, translations } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "aspectRatio", "objectFit", "isTrigger", "translations"]);
|
|
21
|
-
return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full ", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("div", Object.assign({ className: "
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
var { selected = false, onClick, className, name, amount, imgUrl, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle"]);
|
|
23
|
+
return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full ", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("div", Object.assign({ className: "h-10 w-10 border border-coreColors-dividingLines rounded-sm overflow-hidden", style: {
|
|
24
|
+
flex: "0 1 auto",
|
|
25
|
+
} }, { children: _jsx("img", { alt: "wishlist-image", src: `${imgUrl}?width=40`, width: 40, height: 40, className: cn("rounded-sm w-full h-full", objectFit === "contain" ? "object-contain" : "object-cover") }) }))) : (_jsx(PlaceholderIcon, {})), _jsxs("div", Object.assign({ className: "flex flex-col flex-1 items-start mx-2 space-y-1 overflow-hidden" }, { children: [isTrigger && _jsx(Text, Object.assign({ type: "body-secondary" }, { children: "Wishlists" })), _jsx(Text, Object.assign({ type: "body-primary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: nameStyle }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: amountStyle }, { children: `${amount} ${amount !== 1
|
|
26
|
+
? translations["checkout-summary-items"]
|
|
27
|
+
: translations["checkout-summary-item"]}` })))] }))] })));
|
|
24
28
|
});
|
|
25
29
|
Wishlist.displayName = "Wishlist";
|
|
26
30
|
const CreateNew = React.forwardRef((_a, ref) => {
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -247,6 +247,4 @@ export declare const isMetafield: (obj: any) => obj is ConditionalSelectorMetafi
|
|
|
247
247
|
export declare const isArrayOfUserSelectedTags: (arr: any[]) => arr is UserSelectedTag[];
|
|
248
248
|
export declare const isArrayOfMetafields: (arr: any[]) => arr is ConditionalSelectorMetafield[];
|
|
249
249
|
export declare const shouldShowBlock: (envState: ConditionalSelectorValues, blockState: ConditionalSelectorValues) => boolean;
|
|
250
|
-
export declare const evaluateConditions: (group: any, context: any) => boolean;
|
|
251
|
-
export declare const evaluateSingleCondition: (condition: any, context: any) => boolean;
|
|
252
250
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,4BAA4B,EAC5B,yBAAyB,EACzB,UAAU,EACV,eAAe,EACf,OAAO,EACP,QAAQ,EACR,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE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kBAAkB,yBAE5C,MAAM,WAAW,kBAAkB,yBAO/B,MAAM,WAAW,kBAAkB,yBAEhC,MAAM,WAAW,kBAAkB,yBAS3D,CAAA;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,YAOlD;AAED,eAAO,MAAM,wBAAwB,gBACtB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,2BAQpE,CAAA;AAED,eAAO,MAAM,4BAA4B,yCAOxC,CAAA;AAED,eAAO,MAAM,SAAS,SACd,MAAM,UACJ,MAAM,cACF,OAAO,WAGpB,CAAA;AAED,eAAO,MAAM,4BAA4B,oBAAqB,SAAS;;;;;;;CAetE,CAAA;AAKD,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,UAGnC;AAED,eAAO,MAAM,wBAAwB,UAAW,yBAAyB,WAOxE,CAAA;AAkHD,KAAK,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,eAAO,MAAM,WAAW;cAMZ,QAAQ;;;;;;;;;;;;;;;;;;;;;;;CAuDnB,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAS,GAAG,2BAC+B,CAAA;AAEzE,eAAO,MAAM,WAAW,QAAS,GAAG,wCACO,CAAA;AAE3C,eAAO,MAAM,yBAAyB,QAC/B,GAAG,EAAE,6BAGX,CAAA;AAED,eAAO,MAAM,mBAAmB,QACzB,GAAG,EAAE,0CAGX,CAAA;AA6BD,eAAO,MAAM,eAAe,aAChB,yBAAyB,cACvB,yBAAyB,YAoDtC,CAAA"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -480,58 +480,4 @@ export const shouldShowBlock = (envState, blockState) => {
|
|
|
480
480
|
}
|
|
481
481
|
return hasMatchingMetafields || hasMatchingTags;
|
|
482
482
|
};
|
|
483
|
-
// Helper to evaluate v2 conditions
|
|
484
|
-
export const evaluateConditions = (group, context) => {
|
|
485
|
-
const { logic = "OR", conditions = [] } = group;
|
|
486
|
-
console.log("Evaluating group:", { logic, conditions });
|
|
487
|
-
const results = conditions.map((condition) => {
|
|
488
|
-
if (condition.logic) {
|
|
489
|
-
return evaluateConditions(condition, context); // Nested group
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
const result = evaluateSingleCondition(condition, context);
|
|
493
|
-
console.log("Evaluated condition:", { condition, result });
|
|
494
|
-
return result;
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
console.log("Results:", { results, logic });
|
|
498
|
-
switch (logic) {
|
|
499
|
-
case "AND":
|
|
500
|
-
return results.every(Boolean);
|
|
501
|
-
case "OR":
|
|
502
|
-
return results.some(Boolean);
|
|
503
|
-
case "NOT":
|
|
504
|
-
return !results.some(Boolean);
|
|
505
|
-
default:
|
|
506
|
-
throw new Error(`Unsupported logic operator: ${logic}`);
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
// Helper to evaluate a single condition
|
|
510
|
-
export const evaluateSingleCondition = (condition, context) => {
|
|
511
|
-
const { type, operator, value } = condition;
|
|
512
|
-
const contextValue = context[type];
|
|
513
|
-
if (!contextValue) {
|
|
514
|
-
return false; // If the context doesn't have the required type, return false
|
|
515
|
-
}
|
|
516
|
-
switch (operator) {
|
|
517
|
-
case "equals":
|
|
518
|
-
if (Array.isArray(contextValue)) {
|
|
519
|
-
// Handle arrays of UserSelectedTag or ConditionalSelectorMetafield
|
|
520
|
-
return contextValue.some((item) => item.value === value);
|
|
521
|
-
}
|
|
522
|
-
else {
|
|
523
|
-
return contextValue === value;
|
|
524
|
-
}
|
|
525
|
-
case "contains":
|
|
526
|
-
if (Array.isArray(contextValue)) {
|
|
527
|
-
// Handle arrays of UserSelectedTag or ConditionalSelectorMetafield
|
|
528
|
-
return contextValue.some((item) => item.value === value);
|
|
529
|
-
}
|
|
530
|
-
else {
|
|
531
|
-
return contextValue.includes(value);
|
|
532
|
-
}
|
|
533
|
-
default:
|
|
534
|
-
throw new Error(`Unsupported operator: ${operator}`);
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
483
|
// --- End (Block conditional rendering util functions) ----
|
package/dist/styles.css
CHANGED
|
@@ -993,12 +993,12 @@ video {
|
|
|
993
993
|
.h-\[40px\] {
|
|
994
994
|
height: 40px;
|
|
995
995
|
}
|
|
996
|
-
.h-\[42px\] {
|
|
997
|
-
height: 42px;
|
|
998
|
-
}
|
|
999
996
|
.h-\[4px\] {
|
|
1000
997
|
height: 4px;
|
|
1001
998
|
}
|
|
999
|
+
.h-\[80vh\] {
|
|
1000
|
+
height: 80vh;
|
|
1001
|
+
}
|
|
1002
1002
|
.h-auto {
|
|
1003
1003
|
height: auto;
|
|
1004
1004
|
}
|
|
@@ -1092,6 +1092,9 @@ video {
|
|
|
1092
1092
|
.w-\[40px\] {
|
|
1093
1093
|
width: 40px;
|
|
1094
1094
|
}
|
|
1095
|
+
.w-\[45vw\] {
|
|
1096
|
+
width: 45vw;
|
|
1097
|
+
}
|
|
1095
1098
|
.w-auto {
|
|
1096
1099
|
width: auto;
|
|
1097
1100
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../components/ThemeProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE3D,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CAEvE"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
15
|
-
export function ThemeProvider(_a) {
|
|
16
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
17
|
-
return _jsx(NextThemesProvider, Object.assign({}, props, { children: children }));
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../components/ThemeToggle.tsx"],"names":[],"mappings":"AAOA,wBAAgB,WAAW,4CAc1B"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useTheme } from "next-themes";
|
|
4
|
-
import { Button } from "../components/ui/button";
|
|
5
|
-
export function ThemeToggle() {
|
|
6
|
-
const { setTheme, theme } = useTheme();
|
|
7
|
-
return (_jsxs(Button, Object.assign({ variant: "ghost", size: "sm", onClick: () => setTheme(theme === "light" ? "dark" : "light") }, { children: [_jsx("div", { className: "rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" }), _jsx("div", { className: "absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Toggle theme" }))] })));
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-block-conditionals.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-block-conditionals.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare const useTap: (tapThreshold?: number) => {
|
|
3
|
-
onTap: (handler: (event: any) => void) => (event: any) => void;
|
|
4
|
-
isPressed: boolean;
|
|
5
|
-
ref: React.MutableRefObject<null>;
|
|
6
|
-
};
|
|
7
|
-
export { useTap };
|
|
8
|
-
//# sourceMappingURL=use-tap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-tap.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-tap.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAuFvE,QAAA,MAAM,MAAM;6BAuBkC,GAAG,KAAK,IAAI,aACvC,GAAG;;;CAerB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState, useEffect, useCallback, useRef } from "react";
|
|
3
|
-
// Shared manager for all instances of the hook
|
|
4
|
-
const tapManager = (() => {
|
|
5
|
-
const elements = new Map();
|
|
6
|
-
let isListening = false;
|
|
7
|
-
const startListening = () => {
|
|
8
|
-
if (isListening)
|
|
9
|
-
return;
|
|
10
|
-
const handleTouchStart = (e) => {
|
|
11
|
-
const touch = e.touches[0];
|
|
12
|
-
elements.forEach((data, el) => {
|
|
13
|
-
if (el.contains(touch.target)) {
|
|
14
|
-
data.touchStarted = true;
|
|
15
|
-
data.touchMoved = false;
|
|
16
|
-
data.startPosition = { x: touch.clientX, y: touch.clientY };
|
|
17
|
-
// Don't set isPressed here, wait to determine if it's a tap or drag
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
const handleTouchMove = (e) => {
|
|
22
|
-
const touch = e.touches[0];
|
|
23
|
-
elements.forEach((data, el) => {
|
|
24
|
-
if (data.touchStarted) {
|
|
25
|
-
const deltaX = Math.abs(touch.clientX - data.startPosition.x);
|
|
26
|
-
const deltaY = Math.abs(touch.clientY - data.startPosition.y);
|
|
27
|
-
if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
|
|
28
|
-
data.touchMoved = true;
|
|
29
|
-
data.setIsPressed(false);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
const handleTouchEnd = () => {
|
|
35
|
-
elements.forEach((data) => {
|
|
36
|
-
if (data.touchStarted) {
|
|
37
|
-
data.touchStarted = false;
|
|
38
|
-
if (!data.touchMoved) {
|
|
39
|
-
// It's a tap, set isPressed briefly
|
|
40
|
-
data.setIsPressed(true);
|
|
41
|
-
setTimeout(() => data.setIsPressed(false), 100);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
document.addEventListener("touchstart", (e) => handleTouchStart(e), { passive: true });
|
|
47
|
-
document.addEventListener("touchmove", (e) => handleTouchMove(e), { passive: true });
|
|
48
|
-
document.addEventListener("touchend", () => handleTouchEnd(), {
|
|
49
|
-
passive: true,
|
|
50
|
-
});
|
|
51
|
-
isListening = true;
|
|
52
|
-
};
|
|
53
|
-
return {
|
|
54
|
-
register: (el, data) => {
|
|
55
|
-
elements.set(el, data);
|
|
56
|
-
startListening();
|
|
57
|
-
},
|
|
58
|
-
unregister: (el) => {
|
|
59
|
-
elements.delete(el);
|
|
60
|
-
},
|
|
61
|
-
elements,
|
|
62
|
-
};
|
|
63
|
-
})();
|
|
64
|
-
const useTap = (tapThreshold = 10) => {
|
|
65
|
-
const [isPressed, setIsPressed] = useState(false);
|
|
66
|
-
const elementRef = useRef(null);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
const element = elementRef.current;
|
|
69
|
-
if (!element)
|
|
70
|
-
return;
|
|
71
|
-
const data = {
|
|
72
|
-
touchStarted: false,
|
|
73
|
-
touchMoved: false,
|
|
74
|
-
startPosition: { x: 0, y: 0 },
|
|
75
|
-
setIsPressed,
|
|
76
|
-
tapThreshold,
|
|
77
|
-
};
|
|
78
|
-
tapManager.register(element, data);
|
|
79
|
-
return () => {
|
|
80
|
-
tapManager.unregister(element);
|
|
81
|
-
};
|
|
82
|
-
}, [tapThreshold]);
|
|
83
|
-
const onTap = useCallback((handler) => {
|
|
84
|
-
return (event) => {
|
|
85
|
-
const data = tapManager.elements.get(elementRef.current);
|
|
86
|
-
if (!data)
|
|
87
|
-
return;
|
|
88
|
-
if (event.type === "touchend" && !data.touchMoved) {
|
|
89
|
-
handler(event);
|
|
90
|
-
}
|
|
91
|
-
else if (event.type === "click" && !data.touchStarted) {
|
|
92
|
-
handler(event);
|
|
93
|
-
setIsPressed(true);
|
|
94
|
-
setTimeout(() => setIsPressed(false), 100);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}, []);
|
|
98
|
-
return { onTap, isPressed, ref: elementRef };
|
|
99
|
-
};
|
|
100
|
-
export { useTap };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
declare const inputVariants: (props?: ({
|
|
4
|
-
error?: boolean | null | undefined;
|
|
5
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
-
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange">, VariantProps<typeof inputVariants> {
|
|
7
|
-
id: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
icon?: string;
|
|
10
|
-
asChild?: boolean;
|
|
11
|
-
value: string;
|
|
12
|
-
placeholder: string;
|
|
13
|
-
onChange: (_: string) => void;
|
|
14
|
-
}
|
|
15
|
-
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
-
export { Input };
|
|
17
|
-
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../components/ui/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,QAAA,MAAM,aAAa;;mFAalB,CAAA;AAED,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,EACnE,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAED,QAAA,MAAM,KAAK,qFAkDV,CAAA;AAGD,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
15
|
-
import { cva } from "class-variance-authority";
|
|
16
|
-
import { cn } from "../../lib/utils";
|
|
17
|
-
import { Icon } from "./icon";
|
|
18
|
-
const inputVariants = cva("flex h-14 w-full rounded border border-coreColors-dividingLines bg-coreColors-inputBackground px-4 pt-5 pb-2 placeholder-shown:p-4 text-textColors-primaryColor text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-textColors-secondaryColor focus-visible:outline-none focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 focus:border-coreColors-brandColorPrimary peer data-[icon=true]:pr-10", {
|
|
19
|
-
variants: {
|
|
20
|
-
error: {
|
|
21
|
-
true: "border-stateColors-error text-stateColors-error placeholder:text-stateColors-error focus:border-stateColors-error [&+label]:text-stateColors-error",
|
|
22
|
-
false: "",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
error: false,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
const Input = React.forwardRef((_a, ref) => {
|
|
30
|
-
var { className, error = false, id, type, label, icon, asChild, value, placeholder, onChange } = _a, props = __rest(_a, ["className", "error", "id", "type", "label", "icon", "asChild", "value", "placeholder", "onChange"]);
|
|
31
|
-
const Comp = asChild ? Slot : "div";
|
|
32
|
-
return (_jsxs(Comp, Object.assign({ className: "relative group" }, { children: [_jsx("input", Object.assign({ placeholder: placeholder, value: value, onChange: (e) => onChange(e.target.value), id: id, type: type, className: cn(inputVariants({ error }), className), "data-icon": !!icon, ref: ref }, props)), label ? (_jsx("label", Object.assign({ htmlFor: id, className: "absolute text-[10px] text-textColors-secondaryColor group-active:text-coreColors-brandColorPrimary top-2 z-10 h-4 origin-[0] start-4 opacity-100 peer-placeholder-shown:opacity-0" }, { children: label }))) : null, icon ? (_jsx(Icon, { name: icon, "data-error": error, size: "sm", className: "absolute w-5 aspect-square fill-current text-textColors-secondaryColor top-[18px] z-10 origin-[0] end-4 peer-pr-8 icon data-[error=true]:text-stateColors-error" })) : null] })));
|
|
33
|
-
});
|
|
34
|
-
Input.displayName = "Input";
|
|
35
|
-
export { Input };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type Product = any;
|
|
2
|
-
interface PageData {
|
|
3
|
-
products: Product[];
|
|
4
|
-
cursorBlob?: string;
|
|
5
|
-
filtersData: any;
|
|
6
|
-
}
|
|
7
|
-
interface ProductGridItemsProps {
|
|
8
|
-
initialData: PageData;
|
|
9
|
-
loadMoreProducts: (params: any) => Promise<PageData>;
|
|
10
|
-
queryVariables: Record<string, any>;
|
|
11
|
-
config: Record<string, any>;
|
|
12
|
-
}
|
|
13
|
-
declare function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }: ProductGridItemsProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export { ProductGrid };
|
|
15
|
-
//# sourceMappingURL=product-grid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/product-grid.tsx"],"names":[],"mappings":"AAkBA,KAAK,OAAO,GAAG,GAAG,CAAA;AAClB,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,GAAG,CAAA;CACjB;AAED,UAAU,qBAAqB;IAC7B,WAAW,EAAE,QAAQ,CAAA;IACrB,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACpD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B;AAED,iBAAS,WAAW,CAAC,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,MAAM,GACP,EAAE,qBAAqB,2CAmCvB;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useInfiniteScroll } from "../hooks/use-infinite-scroll";
|
|
4
|
-
import { ProductCard } from "./product-card";
|
|
5
|
-
const Loader = () => (_jsx("div", Object.assign({ className: "grid-cols-2 lg:grid-cols-3" }, { children: Array(4)
|
|
6
|
-
.fill(0)
|
|
7
|
-
.map((_, index) => (_jsx("div", { className: "aspect-[2/3] animate-pulse bg-neutral-100 dark:bg-neutral-900" }, index))) })));
|
|
8
|
-
function ProductGrid({ loadMoreProducts, initialData, queryVariables, config, }) {
|
|
9
|
-
const { data, error, isLoadingInitialData, isLoadingMore, isEmpty, isReachingEnd, ref, products, } = useInfiniteScroll({
|
|
10
|
-
initialData,
|
|
11
|
-
loadMoreProducts,
|
|
12
|
-
queryVariables,
|
|
13
|
-
});
|
|
14
|
-
if (error)
|
|
15
|
-
return _jsx("div", { children: "Failed to load data" });
|
|
16
|
-
if (isLoadingInitialData)
|
|
17
|
-
return _jsx(Loader, {});
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "grid-cols-2 lg:grid-cols-3" }, { children: products.map((product, i) => (_jsx(ProductCard, {
|
|
19
|
-
// @ts-expect-error
|
|
20
|
-
product: product, config: config, isLoading: false }, product.handle))) })), isLoadingMore ? _jsx(Loader, {}) : _jsx("div", { ref: ref })] }));
|
|
21
|
-
}
|
|
22
|
-
export { ProductGrid };
|