@tapcart/mobile-components 0.7.51 → 0.7.53
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/ThemeProvider.d.ts +3 -0
- package/dist/components/ThemeProvider.d.ts.map +1 -0
- package/dist/components/ThemeProvider.js +18 -0
- package/dist/components/ThemeToggle.d.ts +2 -0
- package/dist/components/ThemeToggle.d.ts.map +1 -0
- package/dist/components/ThemeToggle.js +8 -0
- package/dist/components/hooks/use-block-conditional-rendering.d.ts.map +1 -1
- package/dist/components/hooks/use-block-conditional-rendering.js +46 -38
- package/dist/components/hooks/use-block-conditionals.d.ts +2 -0
- package/dist/components/hooks/use-block-conditionals.d.ts.map +1 -0
- package/dist/components/hooks/use-block-conditionals.js +2 -0
- package/dist/components/hooks/use-nosto-recommendation.test.js +118 -25
- package/dist/components/ui/input.d.ts +17 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +35 -0
- package/dist/components/ui/product-grid.d.ts +15 -0
- package/dist/components/ui/product-grid.d.ts.map +1 -0
- package/dist/components/ui/product-grid.js +22 -0
- 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/text.d.ts +9 -1
- package/dist/components/ui/text.d.ts.map +1 -1
- package/dist/components/ui/text.js +39 -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 +2 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +50 -0
- package/dist/styles.css +188 -162
- package/package.json +9 -7
- package/dist/components/hooks/use-customer.d.ts +0 -10
- package/dist/components/hooks/use-customer.d.ts.map +0 -1
- package/dist/components/hooks/use-customer.js +0 -24
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../components/ThemeToggle.tsx"],"names":[],"mappings":"AAOA,wBAAgB,WAAW,4CAc1B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 +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;AAgBzB,eAAO,MAAM,4BAA4B,WAC/B;IACN,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,UACO,YAAY;;;CA6KrB,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, } from "../../lib/utils";
|
|
19
|
+
import { gidFromId, countNumberOfTagsInState, getEnvState, shouldShowBlock, evaluateConditions, } 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;
|
|
22
|
+
const _f = ((_a = _block === null || _block === void 0 ? void 0 : _block.visibilityConditions) === null || _a === void 0 ? void 0 : _a.conditions) || {}, { enabled: conditionalsV1IsEnabled = false, exclude: isInverse = false } = _f, restOfProps = __rest(_f, ["enabled", "exclude"]);
|
|
23
|
+
const { _version = 1, conditions, enabled: conditionalsV2IsEnabled = false, } = (_block === null || _block === void 0 ? void 0 : _block.visibilityConditions) || {};
|
|
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.get("productId")) !== null && _c !== void 0 ? _c : undefined;
|
|
32
|
+
const productId = (_c = searchParams === null || searchParams === void 0 ? void 0 : 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: isProductsLoading, } = useProducts(productId !== undefined && conditionalsV1IsEnabled
|
|
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.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:
|
|
71
|
+
const collectionId = (_d = searchParams === null || searchParams === void 0 ? void 0 : searchParams.get("collectionId")) !== null && _d !== void 0 ? _d : undefined;
|
|
72
|
+
const collectionHandle = (_e = searchParams === null || searchParams === void 0 ? void 0 : searchParams.get("collectionHandle")) !== null && _e !== void 0 ? _e : undefined;
|
|
73
|
+
const { specificCollection = {}, error: useCollectionError, loading: isCollectionLoading, } = useCollection({
|
|
74
74
|
appId,
|
|
75
75
|
apiUrl,
|
|
76
76
|
collectionId,
|
|
@@ -78,42 +78,50 @@ export const useBlockConditionalRendering = (_props, _block) => {
|
|
|
78
78
|
language: location === null || location === void 0 ? void 0 : location.language,
|
|
79
79
|
metafields: memoizedMetafields,
|
|
80
80
|
});
|
|
81
|
+
const isLoading = isProductsLoading || isCollectionLoading;
|
|
81
82
|
if (useProductsError || useCollectionError) {
|
|
82
83
|
console.error("Unable to load products in conditional block rendering hook: ", useProductsError !== null && useProductsError !== void 0 ? useProductsError : useCollectionError);
|
|
83
84
|
}
|
|
85
|
+
let shouldShow = true;
|
|
86
|
+
const blockConditionalsIsEnabled = conditionalsV1IsEnabled || conditionalsV2IsEnabled;
|
|
87
|
+
const blockHasTags = countNumberOfTagsInState(blockState) > 0;
|
|
88
|
+
const product = products.length === 1 ? products[0] : undefined;
|
|
89
|
+
const envState = getEnvState({
|
|
90
|
+
location,
|
|
91
|
+
product,
|
|
92
|
+
collection: specificCollection,
|
|
93
|
+
customer: customerVariables,
|
|
94
|
+
});
|
|
95
|
+
const evaluateV1Conditions = () => {
|
|
96
|
+
if (!blockHasTags) {
|
|
97
|
+
// No tags configured - default to showing
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
//@ts-expect-error: envState typing mismatch
|
|
101
|
+
const shouldShowPreInverse = shouldShowBlock(envState, blockState);
|
|
102
|
+
// TODO: Remove when inverse is available for all blocks
|
|
103
|
+
return isInverse ? !shouldShowPreInverse : shouldShowPreInverse;
|
|
104
|
+
};
|
|
105
|
+
const evaluateV2Conditions = () => {
|
|
106
|
+
return evaluateConditions(conditions, envState);
|
|
107
|
+
};
|
|
84
108
|
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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;
|
|
106
|
-
}
|
|
109
|
+
if (blockConditionalsIsEnabled) {
|
|
110
|
+
switch (_version) {
|
|
111
|
+
case 2:
|
|
112
|
+
shouldShow = evaluateV2Conditions();
|
|
113
|
+
break;
|
|
114
|
+
case 1:
|
|
115
|
+
default:
|
|
116
|
+
// Handles v1 and any unexpected versions
|
|
117
|
+
shouldShow = evaluateV1Conditions();
|
|
118
|
+
break;
|
|
107
119
|
}
|
|
108
120
|
}
|
|
109
|
-
// if conditionals is disabled, show the block.
|
|
110
|
-
if (!isEnabled) {
|
|
111
|
-
return { shouldShow: true, isLoading: false };
|
|
112
|
-
}
|
|
113
|
-
return { shouldShow, isLoading: useProductsLoading || useCollectionLoading };
|
|
114
121
|
}
|
|
115
122
|
catch (e) {
|
|
116
|
-
console.error("
|
|
117
|
-
|
|
123
|
+
console.error("Error evaluating block visibility conditions:", e);
|
|
124
|
+
shouldShow = true; // Fail-safe to show block
|
|
118
125
|
}
|
|
126
|
+
return { shouldShow, isLoading };
|
|
119
127
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-block-conditionals.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-block-conditionals.ts"],"names":[],"mappings":""}
|
|
@@ -7,7 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { renderHook } from "@testing-library/react
|
|
10
|
+
import { renderHook } from "@testing-library/react";
|
|
11
|
+
import { act } from "react-dom/test-utils";
|
|
11
12
|
import { NostoRecommendationsType, useNostoRecommendations, } from "./use-nosto-recommendation";
|
|
12
13
|
import { useProducts } from "./use-products";
|
|
13
14
|
jest.mock("./use-products", () => ({
|
|
@@ -111,8 +112,14 @@ describe("useNostoRecommendations", () => {
|
|
|
111
112
|
});
|
|
112
113
|
it("should return front page recommendations if productIds is empty and slotId is provided", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
114
|
const slotId = "mockSlotId";
|
|
114
|
-
const { result
|
|
115
|
-
|
|
115
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, slotId, undefined, undefined, undefined));
|
|
116
|
+
// Initial state check
|
|
117
|
+
expect(result.current.isLoading).toBe(true);
|
|
118
|
+
// Wait for all promises with act
|
|
119
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
121
|
+
}));
|
|
122
|
+
// Check final state
|
|
116
123
|
expect(result.current.isLoading).toBe(false);
|
|
117
124
|
expect(result.current.error).toBe(null);
|
|
118
125
|
expect(useProducts).toHaveBeenCalledWith({
|
|
@@ -127,8 +134,15 @@ describe("useNostoRecommendations", () => {
|
|
|
127
134
|
}));
|
|
128
135
|
it("should return best sellers recommendations if productIds is empty and slotId is not provided", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
136
|
const slotId = "";
|
|
130
|
-
const { result
|
|
131
|
-
|
|
137
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, slotId, undefined, undefined));
|
|
138
|
+
// Initial state check
|
|
139
|
+
expect(result.current.isLoading).toBe(true);
|
|
140
|
+
// Wait for all promises with act
|
|
141
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
142
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
143
|
+
}));
|
|
144
|
+
// Check final state
|
|
145
|
+
expect(result.current.isLoading).toBe(false);
|
|
132
146
|
expect(result.current.error).toBe(null);
|
|
133
147
|
expect(useProducts).toHaveBeenCalledWith({
|
|
134
148
|
productIds: ["best-seller-1"],
|
|
@@ -143,8 +157,15 @@ describe("useNostoRecommendations", () => {
|
|
|
143
157
|
it("should return best sellers recommendations if productIds is not empty, Best Sellers is the recommendation type and slotId is not provided", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
158
|
const slotId = "";
|
|
145
159
|
const productIds = ["mockProductId"];
|
|
146
|
-
const { result
|
|
147
|
-
|
|
160
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, slotId, NostoRecommendationsType.BEST_SELLERS, productIds));
|
|
161
|
+
// Initial state check
|
|
162
|
+
expect(result.current.isLoading).toBe(true);
|
|
163
|
+
// Wait for all promises with act
|
|
164
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
165
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
166
|
+
}));
|
|
167
|
+
// Check final state
|
|
168
|
+
expect(result.current.isLoading).toBe(false);
|
|
148
169
|
expect(result.current.error).toBe(null);
|
|
149
170
|
expect(useProducts).toHaveBeenCalledWith({
|
|
150
171
|
productIds: ["best-seller-1"],
|
|
@@ -158,8 +179,15 @@ describe("useNostoRecommendations", () => {
|
|
|
158
179
|
}));
|
|
159
180
|
it("should return default front page recommendations if slotId is provided but layoutType is not", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
160
181
|
const slotId = "mockSlotId";
|
|
161
|
-
const { result
|
|
162
|
-
|
|
182
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, slotId));
|
|
183
|
+
// Initial state check
|
|
184
|
+
expect(result.current.isLoading).toBe(true);
|
|
185
|
+
// Wait for all promises with act
|
|
186
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
187
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
188
|
+
}));
|
|
189
|
+
// Check final state
|
|
190
|
+
expect(result.current.isLoading).toBe(false);
|
|
163
191
|
expect(result.current.error).toBe(null);
|
|
164
192
|
expect(useProducts).toHaveBeenCalledWith({
|
|
165
193
|
productIds: ["front-page-id-1"],
|
|
@@ -172,8 +200,15 @@ describe("useNostoRecommendations", () => {
|
|
|
172
200
|
});
|
|
173
201
|
}));
|
|
174
202
|
it("should return the correct recommendations for best sellers", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
175
|
-
const { result
|
|
176
|
-
|
|
203
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, "", NostoRecommendationsType.BEST_SELLERS, undefined, undefined));
|
|
204
|
+
// Initial state check
|
|
205
|
+
expect(result.current.isLoading).toBe(true);
|
|
206
|
+
// Wait for all promises with act
|
|
207
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
209
|
+
}));
|
|
210
|
+
// Check final state
|
|
211
|
+
expect(result.current.isLoading).toBe(false);
|
|
177
212
|
expect(result.current.error).toBe(null);
|
|
178
213
|
expect(useProducts).toHaveBeenCalledWith({
|
|
179
214
|
productIds: ["best-seller-1"],
|
|
@@ -187,8 +222,15 @@ describe("useNostoRecommendations", () => {
|
|
|
187
222
|
}));
|
|
188
223
|
it("should return the related recommendations when only productIds and a recommendation type are provided on a non-home layout", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
189
224
|
const productIds = ["mockProductId"];
|
|
190
|
-
const { result
|
|
191
|
-
|
|
225
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, "", NostoRecommendationsType.VIEWED_TOGETHER, productIds, undefined));
|
|
226
|
+
// Initial state check
|
|
227
|
+
expect(result.current.isLoading).toBe(true);
|
|
228
|
+
// Wait for all promises with act
|
|
229
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
230
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
231
|
+
}));
|
|
232
|
+
// Check final state
|
|
233
|
+
expect(result.current.isLoading).toBe(false);
|
|
192
234
|
expect(result.current.error).toBe(null);
|
|
193
235
|
expect(useProducts).toHaveBeenCalledWith({
|
|
194
236
|
productIds: ["related-1"],
|
|
@@ -203,8 +245,15 @@ describe("useNostoRecommendations", () => {
|
|
|
203
245
|
it("should return the correct recommendations when productIds and slotIds are provided", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
204
246
|
const slotId = "mockSlotId";
|
|
205
247
|
const productIds = ["mockProductId"];
|
|
206
|
-
const { result
|
|
207
|
-
|
|
248
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, slotId, NostoRecommendationsType.VIEWED_TOGETHER, productIds, undefined));
|
|
249
|
+
// Initial state check
|
|
250
|
+
expect(result.current.isLoading).toBe(true);
|
|
251
|
+
// Wait for all promises with act
|
|
252
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
253
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
254
|
+
}));
|
|
255
|
+
// Check final state
|
|
256
|
+
expect(result.current.isLoading).toBe(false);
|
|
208
257
|
expect(result.current.error).toBe(null);
|
|
209
258
|
expect(useProducts).toHaveBeenCalledWith({
|
|
210
259
|
productIds: ["product-page-id-1"],
|
|
@@ -218,8 +267,15 @@ describe("useNostoRecommendations", () => {
|
|
|
218
267
|
}));
|
|
219
268
|
it("should return the related products fallback recommendations when productIds are provided and no slotId and a type other than viewed_category and best_sellers is provided", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
220
269
|
const productIds = ["mockProductId"];
|
|
221
|
-
const { result
|
|
222
|
-
|
|
270
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, "", NostoRecommendationsType.VIEWED_TOGETHER, productIds, undefined));
|
|
271
|
+
// Initial state check
|
|
272
|
+
expect(result.current.isLoading).toBe(true);
|
|
273
|
+
// Wait for all promises with act
|
|
274
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
275
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
276
|
+
}));
|
|
277
|
+
// Check final state
|
|
278
|
+
expect(result.current.isLoading).toBe(false);
|
|
223
279
|
expect(result.current.error).toBe(null);
|
|
224
280
|
expect(useProducts).toHaveBeenCalledWith({
|
|
225
281
|
productIds: ["related-1"],
|
|
@@ -233,8 +289,15 @@ describe("useNostoRecommendations", () => {
|
|
|
233
289
|
}));
|
|
234
290
|
it("should return the category fallback recommendations when no slotId, productIds are provided and a recommendation type of viewed_category is provided", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
235
291
|
const productIds = ["mockProductId"];
|
|
236
|
-
const { result
|
|
237
|
-
|
|
292
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, "", NostoRecommendationsType.VIEWED_CATEGORY, productIds, undefined));
|
|
293
|
+
// Initial state check
|
|
294
|
+
expect(result.current.isLoading).toBe(true);
|
|
295
|
+
// Wait for all promises with act
|
|
296
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
297
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
298
|
+
}));
|
|
299
|
+
// Check final state
|
|
300
|
+
expect(result.current.isLoading).toBe(false);
|
|
238
301
|
expect(result.current.error).toBe(null);
|
|
239
302
|
expect(useProducts).toHaveBeenCalledWith({
|
|
240
303
|
productIds: ["category-page-id-1"],
|
|
@@ -248,7 +311,15 @@ describe("useNostoRecommendations", () => {
|
|
|
248
311
|
}));
|
|
249
312
|
it("should handle loading state", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
250
313
|
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, ""));
|
|
314
|
+
// Check initial loading state
|
|
251
315
|
expect(result.current.isLoading).toBe(true);
|
|
316
|
+
// Wait for all state updates to complete
|
|
317
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
318
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
319
|
+
}));
|
|
320
|
+
// Verify loading has finished
|
|
321
|
+
expect(result.current.isLoading).toBe(false);
|
|
322
|
+
expect(result.current.error).toBe(null);
|
|
252
323
|
}));
|
|
253
324
|
it("should handle error state", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
254
325
|
const mockError = () => "Failed to fetch products";
|
|
@@ -257,14 +328,29 @@ describe("useNostoRecommendations", () => {
|
|
|
257
328
|
isLoading: false,
|
|
258
329
|
error: mockError,
|
|
259
330
|
});
|
|
260
|
-
const { result
|
|
261
|
-
|
|
331
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL));
|
|
332
|
+
// Initial state check
|
|
333
|
+
expect(result.current.isLoading).toBe(true);
|
|
334
|
+
// Wait for all promises and state updates to resolve
|
|
335
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
336
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
337
|
+
}));
|
|
338
|
+
// Verify final error state
|
|
339
|
+
expect(result.current.isLoading).toBe(false);
|
|
262
340
|
expect(result.current.error).toBe(mockError);
|
|
341
|
+
expect(result.current.recommendations).toEqual([]);
|
|
263
342
|
}));
|
|
264
343
|
it("should default to best sellers if productIds are empty but a recommendation type other than Best Sellers is used", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
265
344
|
const productIds = [];
|
|
266
|
-
const { result
|
|
267
|
-
|
|
345
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, "", NostoRecommendationsType.VIEWED_TOGETHER, productIds, undefined));
|
|
346
|
+
// Initial state check
|
|
347
|
+
expect(result.current.isLoading).toBe(true);
|
|
348
|
+
// Wait for all promises with act
|
|
349
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
350
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
351
|
+
}));
|
|
352
|
+
// Check final state
|
|
353
|
+
expect(result.current.isLoading).toBe(false);
|
|
268
354
|
expect(result.current.error).toBe(null);
|
|
269
355
|
expect(useProducts).toHaveBeenCalledWith({
|
|
270
356
|
productIds: ["best-seller-1"],
|
|
@@ -277,8 +363,15 @@ describe("useNostoRecommendations", () => {
|
|
|
277
363
|
});
|
|
278
364
|
}));
|
|
279
365
|
it("should return an empty array if skip is true", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
280
|
-
const { result
|
|
281
|
-
|
|
366
|
+
const { result } = renderHook(() => useNostoRecommendations(mockIntegrations, mockBaseURL, "", NostoRecommendationsType.BEST_SELLERS, undefined, true));
|
|
367
|
+
// Initial state check
|
|
368
|
+
expect(result.current.isLoading).toBe(true);
|
|
369
|
+
// Wait for all promises with act
|
|
370
|
+
yield act(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
371
|
+
yield new Promise((resolve) => setTimeout(resolve, 0));
|
|
372
|
+
}));
|
|
373
|
+
// Check final state
|
|
374
|
+
expect(result.current.isLoading).toBe(false);
|
|
282
375
|
expect(useProducts).toHaveBeenCalledWith({
|
|
283
376
|
productIds: [],
|
|
284
377
|
baseURL: mockBaseURL,
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 };
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 };
|
|
@@ -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,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;CAClE,CAAA;AAEH,QAAA,MAAM,SAAS;;;;;;;;;eAHA,MAAM,iBAAiB,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,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AACD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
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,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;CAClE,CAAA;AAEH,QAAA,MAAM,SAAS;;;;;;;;;eAHA,MAAM,iBAAiB,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 };
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
type Injections = Record<string, {
|
|
4
|
+
payload: string;
|
|
5
|
+
currencyMetadata?: {
|
|
6
|
+
currency: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
3
10
|
declare const textVariants: (props?: ({
|
|
4
11
|
type?: "h1" | "h2" | "label" | "body-primary" | "body-secondary" | null | undefined;
|
|
5
12
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
13
|
export interface TextProps extends React.HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof textVariants> {
|
|
7
14
|
fontColor?: string | null;
|
|
15
|
+
injections?: Injections;
|
|
8
16
|
children?: React.ReactNode;
|
|
9
17
|
}
|
|
10
|
-
declare function Text({ className, type, fontColor, children, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function Text({ className, type, fontColor, injections, children, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
11
19
|
export { Text, textVariants };
|
|
12
20
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../components/ui/text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../components/ui/text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAQjE,KAAK,UAAU,GAAG,MAAM,CACtB,MAAM,EACN;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAC7E,CAAA;AAmDD,QAAA,MAAM,YAAY;;mFAgBhB,CAAA;AAEF,MAAM,WAAW,SACf,SAAQ,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC,EAChD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,SAAS,EACT,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAoBX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA"}
|