funuicss 3.8.7 → 3.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/fun.css +702 -87
- package/index.d.ts +3 -0
- package/index.js +8 -2
- package/package.json +1 -1
- package/ui/button/Button.d.ts +6 -5
- package/ui/button/Button.js +190 -84
- package/ui/div/Div.d.ts +3 -1
- package/ui/div/Div.js +2 -2
- package/ui/feature/Feature.d.ts +9 -38
- package/ui/feature/Feature.js +62 -147
- package/ui/flex/Flex.d.ts +11 -10
- package/ui/flex/Flex.js +102 -6
- package/ui/form/Form.d.ts +77 -0
- package/ui/form/Form.js +724 -0
- package/ui/input/FileUpload.js +370 -21
- package/ui/input/Input.d.ts +44 -15
- package/ui/input/Input.js +1145 -369
- package/ui/products/CartModal.d.ts +0 -2
- package/ui/products/CartModal.js +59 -39
- package/ui/products/ProductCard.js +9 -22
- package/ui/products/ProductDetail.js +136 -97
- package/ui/products/ProductLoader.d.ts +3 -0
- package/ui/products/ProductLoader.js +22 -0
- package/ui/products/Store.d.ts +32 -7
- package/ui/products/Store.js +393 -94
- package/ui/progress/Bar.js +2 -2
- package/ui/sidebar/SideBar.js +1 -2
- package/ui/specials/CircleGroup.d.ts +2 -1
- package/ui/specials/CircleGroup.js +3 -3
- package/ui/theme/theme.d.ts +4 -0
- package/ui/theme/theme.js +336 -133
package/ui/products/Store.js
CHANGED
|
@@ -66,25 +66,58 @@ var Input_1 = __importDefault(require("../input/Input"));
|
|
|
66
66
|
var Div_1 = __importDefault(require("../div/Div"));
|
|
67
67
|
var sl_1 = require("react-icons/sl");
|
|
68
68
|
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
69
|
-
var Select_1 = __importDefault(require("../select/Select"));
|
|
70
69
|
var ProductCard_1 = __importDefault(require("./ProductCard"));
|
|
71
70
|
var CartModal_1 = __importDefault(require("./CartModal"));
|
|
72
71
|
var ProductDetail_1 = __importDefault(require("./ProductDetail"));
|
|
73
72
|
var theme_1 = require("../theme/theme");
|
|
74
73
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
75
74
|
var Empty_1 = __importDefault(require("../empty/Empty"));
|
|
76
|
-
var
|
|
75
|
+
var Modal_1 = __importDefault(require("../modal/Modal"));
|
|
76
|
+
var Accordion_1 = __importDefault(require("../accordion/Accordion"));
|
|
77
|
+
var View_1 = __importDefault(require("../view/View"));
|
|
78
|
+
var getCssVariable_1 = require("../../utils/getCssVariable");
|
|
79
|
+
var ProductLoader_1 = __importDefault(require("./ProductLoader"));
|
|
77
80
|
var Store = function (localProps) {
|
|
78
81
|
// Use component configuration with variant
|
|
79
82
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Store', localProps.variant).mergeWithLocal;
|
|
80
83
|
var final = mergeWithLocal(localProps).props;
|
|
81
84
|
// Destructure props from final merged configuration
|
|
82
|
-
var _a = final.products, products = _a === void 0 ? [] : _a, bucket = final.bucket, _b = final.bucketPage, bucketPage = _b === void 0 ? 1 : _b, _c = final.bucketSize, bucketSize = _c === void 0 ? 50 : _c, _d = final.title, title = _d === void 0 ? 'Products' : _d, _e = final.
|
|
85
|
+
var _a = final.products, products = _a === void 0 ? [] : _a, bucket = final.bucket, _b = final.bucketPage, bucketPage = _b === void 0 ? 1 : _b, _c = final.bucketSize, bucketSize = _c === void 0 ? 50 : _c, _d = final.title, title = _d === void 0 ? 'Products' : _d, _e = final.heroTitle, heroTitle = _e === void 0 ? 'Our Products' : _e, _f = final.heroDescription, heroDescription = _f === void 0 ? 'Discover our amazing collection of products' : _f, _g = final.heroBackgroundImage, heroBackgroundImage = _g === void 0 ? '' : _g, _h = final.overlayColor, overlayColor = _h === void 0 ? 'primary' : _h, _j = final.overlayOpacity, overlayOpacity = _j === void 0 ? 0.6 : _j, _k = final.overlayGradient, overlayGradient = _k === void 0 ? false : _k, _l = final.gradientDirection, gradientDirection = _l === void 0 ? 'to-bottom' : _l, _m = final.invertGradient, invertGradient = _m === void 0 ? false : _m, _o = final.showHeader, showHeader = _o === void 0 ? true : _o, _p = final.showSearch, showSearch = _p === void 0 ? true : _p, _q = final.showFilters, showFilters = _q === void 0 ? true : _q, _r = final.showCart, showCart = _r === void 0 ? true : _r, _s = final.showHero, showHero = _s === void 0 ? true : _s, _t = final.titleSize, titleSize = _t === void 0 ? 'big' : _t, _u = final.titleColor, titleColor = _u === void 0 ? 'white' : _u, _v = final.descriptionSize, descriptionSize = _v === void 0 ? 'lg' : _v, _w = final.descriptionColor, descriptionColor = _w === void 0 ? 'white' : _w, _x = final.descriptionOpacity, descriptionOpacity = _x === void 0 ? 0.8 : _x, _y = final.cartBadgeColor, cartBadgeColor = _y === void 0 ? 'error' : _y, cartBadgeText = final.cartBadgeText, _z = final.checkoutText, checkoutText = _z === void 0 ? 'Checkout' : _z, checkoutIcon = final.checkoutIcon, _0 = final.currency, currency = _0 === void 0 ? '$' : _0, _1 = final.persistCart, persistCart = _1 === void 0 ? true : _1, _2 = final.storageKey, storageKey = _2 === void 0 ? 'funui_cart' : _2, whatsappOrderNumber = final.whatsappOrderNumber, otherInfo = final.otherInfo, onAddToCart = final.onAddToCart, onRemoveFromCart = final.onRemoveFromCart, onUpdateQuantity = final.onUpdateQuantity, onCheckout = final.onCheckout, onProductClick = final.onProductClick, _3 = final.className, className = _3 === void 0 ? '' : _3, _4 = final.gridClassName, gridClassName = _4 === void 0 ? '' : _4, children = final.children, id = final.id, _5 = final.heroAlign, heroAlign = _5 === void 0 ? 'center' : _5, _6 = final.funcss, funcss = _6 === void 0 ? '' : _6, _7 = final.heroHeight, heroHeight = _7 === void 0 ? '400px' : _7, _8 = final.fullWidth, fullWidth = _8 === void 0 ? false : _8, _9 = final.itemsPerPage, itemsPerPage = _9 === void 0 ? 10 : _9;
|
|
86
|
+
// Mobile state
|
|
87
|
+
var _10 = (0, react_1.useState)(false), isMobile = _10[0], setIsMobile = _10[1];
|
|
88
|
+
var _11 = (0, react_1.useState)(false), showMobileFilters = _11[0], setShowMobileFilters = _11[1];
|
|
89
|
+
// Check screen size
|
|
90
|
+
(0, react_1.useEffect)(function () {
|
|
91
|
+
var checkMobile = function () {
|
|
92
|
+
setIsMobile(window.innerWidth < 768);
|
|
93
|
+
};
|
|
94
|
+
checkMobile();
|
|
95
|
+
window.addEventListener('resize', checkMobile);
|
|
96
|
+
return function () { return window.removeEventListener('resize', checkMobile); };
|
|
97
|
+
}, []);
|
|
98
|
+
// Parse otherInfo
|
|
99
|
+
var parsedOtherInfo = (0, react_1.useMemo)(function () {
|
|
100
|
+
if (!otherInfo)
|
|
101
|
+
return [];
|
|
102
|
+
try {
|
|
103
|
+
if (typeof otherInfo === 'string') {
|
|
104
|
+
return JSON.parse(otherInfo);
|
|
105
|
+
}
|
|
106
|
+
return otherInfo;
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error('Error parsing otherInfo:', error);
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
}, [otherInfo]);
|
|
113
|
+
// Checkout state
|
|
114
|
+
var _12 = (0, react_1.useState)(false), showCheckoutModal = _12[0], setShowCheckoutModal = _12[1];
|
|
115
|
+
var _13 = (0, react_1.useState)({}), userInfoData = _13[0], setUserInfoData = _13[1];
|
|
116
|
+
var _14 = (0, react_1.useState)(false), checkoutLoading = _14[0], setCheckoutLoading = _14[1];
|
|
83
117
|
// Loading state - track bucket loading and initial load
|
|
84
|
-
var
|
|
118
|
+
var _15 = (0, react_1.useState)(true), isInitialLoading = _15[0], setIsInitialLoading = _15[1];
|
|
85
119
|
// Use bucket data if bucket prop is provided
|
|
86
|
-
var
|
|
87
|
-
bucketPage, bucketSize), bucketRecords = _x.records, bucketLoading = _x.loading;
|
|
120
|
+
var _16 = (0, theme_1.usePaginatedRecords)(bucket || '', bucketPage, bucketSize), bucketRecords = _16.records, bucketLoading = _16.loading;
|
|
88
121
|
// Function to calculate discount price
|
|
89
122
|
var calculateDiscountedPrice = (0, react_1.useCallback)(function (price, discount) {
|
|
90
123
|
if (discount && discount > 0 && discount <= 100) {
|
|
@@ -103,18 +136,14 @@ var Store = function (localProps) {
|
|
|
103
136
|
var applyDiscounts = (0, react_1.useCallback)(function (products) {
|
|
104
137
|
return products.map(function (product) {
|
|
105
138
|
var _a, _b;
|
|
106
|
-
// Check if product has variants
|
|
107
139
|
if (product.variants && product.variants.length > 0) {
|
|
108
140
|
var discountedVariants = product.variants.map(function (variant) {
|
|
109
141
|
var _a = calculateDiscountedPrice(variant.price, variant.discount), finalPrice = _a.finalPrice, originalPrice = _a.originalPrice;
|
|
110
142
|
return __assign(__assign({}, variant), { price: finalPrice, comparePrice: originalPrice });
|
|
111
143
|
});
|
|
112
|
-
return __assign(__assign({}, product), { variants: discountedVariants,
|
|
113
|
-
// Use the first variant's price as the main product price
|
|
114
|
-
price: ((_a = discountedVariants[0]) === null || _a === void 0 ? void 0 : _a.price) || product.price, comparePrice: ((_b = discountedVariants[0]) === null || _b === void 0 ? void 0 : _b.comparePrice) || product.comparePrice });
|
|
144
|
+
return __assign(__assign({}, product), { variants: discountedVariants, price: ((_a = discountedVariants[0]) === null || _a === void 0 ? void 0 : _a.price) || product.price, comparePrice: ((_b = discountedVariants[0]) === null || _b === void 0 ? void 0 : _b.comparePrice) || product.comparePrice });
|
|
115
145
|
}
|
|
116
146
|
else {
|
|
117
|
-
// Apply discount to main product
|
|
118
147
|
var _c = calculateDiscountedPrice(product.price, product.discount), finalPrice = _c.finalPrice, originalPrice = _c.originalPrice;
|
|
119
148
|
return __assign(__assign({}, product), { price: finalPrice, comparePrice: originalPrice !== finalPrice ? originalPrice : product.comparePrice });
|
|
120
149
|
}
|
|
@@ -126,7 +155,6 @@ var Store = function (localProps) {
|
|
|
126
155
|
return null;
|
|
127
156
|
var mappedProducts = bucketRecords.map(function (record) {
|
|
128
157
|
var values = record.values || record;
|
|
129
|
-
// Extract discount from record - could be in various fields
|
|
130
158
|
var discount = values.discount || values.salePercentage || values.discountPercentage;
|
|
131
159
|
return {
|
|
132
160
|
id: values.id || record.id || "bucket_".concat(Math.random().toString(36).substr(2, 9)),
|
|
@@ -150,8 +178,7 @@ var Store = function (localProps) {
|
|
|
150
178
|
rating: parseFloat(values.rating) || undefined,
|
|
151
179
|
isNew: values.isNew || values.newArrival || false,
|
|
152
180
|
isSale: values.isSale || values.onSale || false,
|
|
153
|
-
variants: values.variants ? values.variants.map(function (variant) { return (__assign(__assign({}, variant), { discount: variant.discount || discount
|
|
154
|
-
})); }) : [],
|
|
181
|
+
variants: values.variants ? values.variants.map(function (variant) { return (__assign(__assign({}, variant), { discount: variant.discount || discount })); }) : [],
|
|
155
182
|
manufacturer: values.manufacturer || '',
|
|
156
183
|
countryOfOrigin: values.countryOfOrigin || '',
|
|
157
184
|
warranty: values.warranty || '',
|
|
@@ -161,16 +188,14 @@ var Store = function (localProps) {
|
|
|
161
188
|
});
|
|
162
189
|
return applyDiscounts(mappedProducts);
|
|
163
190
|
}, [bucketRecords, bucket, currency, applyDiscounts]);
|
|
164
|
-
// Parse and process products
|
|
191
|
+
// Parse and process products
|
|
165
192
|
var parsedProducts = react_1.default.useMemo(function () {
|
|
166
193
|
var productList;
|
|
167
|
-
// Use bucket products if bucket prop is provided and we have bucket data
|
|
168
194
|
if (bucket && bucketProducts) {
|
|
169
195
|
console.log("Using ".concat(bucketProducts.length, " products from bucket: ").concat(bucket));
|
|
170
196
|
productList = bucketProducts.map(function (product, index) { return (__assign(__assign({}, product), { id: product.id || "bucket_product_".concat(index, "_").concat(Date.now()) })); });
|
|
171
197
|
}
|
|
172
198
|
else {
|
|
173
|
-
// Fall back to local products prop
|
|
174
199
|
if (typeof products === 'string') {
|
|
175
200
|
try {
|
|
176
201
|
var parsed = JSON.parse(products);
|
|
@@ -184,18 +209,14 @@ var Store = function (localProps) {
|
|
|
184
209
|
else {
|
|
185
210
|
productList = products || [];
|
|
186
211
|
}
|
|
187
|
-
// Apply discounts to locally provided products
|
|
188
212
|
productList = applyDiscounts(productList);
|
|
189
213
|
}
|
|
190
|
-
// Ensure each product has a unique ID
|
|
191
214
|
return productList.map(function (product, index) { return (__assign(__assign({}, product), { id: product.id || "product_".concat(index, "_").concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9)) })); });
|
|
192
215
|
}, [products, bucket, bucketProducts, applyDiscounts]);
|
|
193
216
|
// Handle loading state separately
|
|
194
217
|
(0, react_1.useEffect)(function () {
|
|
195
218
|
if (bucket) {
|
|
196
|
-
// For bucket data, loading is based on bucketLoading state
|
|
197
219
|
if (!bucketLoading && bucketProducts !== undefined) {
|
|
198
|
-
// Small delay for better UX
|
|
199
220
|
var timer_1 = setTimeout(function () {
|
|
200
221
|
setIsInitialLoading(false);
|
|
201
222
|
}, 300);
|
|
@@ -203,14 +224,13 @@ var Store = function (localProps) {
|
|
|
203
224
|
}
|
|
204
225
|
}
|
|
205
226
|
else {
|
|
206
|
-
// For local data, loading is immediate after parsing
|
|
207
227
|
setIsInitialLoading(false);
|
|
208
228
|
}
|
|
209
229
|
}, [bucket, bucketLoading, bucketProducts]);
|
|
210
230
|
// Combined loading state
|
|
211
231
|
var showLoading = isInitialLoading || (bucket && bucketLoading);
|
|
212
232
|
// Initialize cart from localStorage with discount handling
|
|
213
|
-
var
|
|
233
|
+
var _17 = (0, react_1.useState)(function () {
|
|
214
234
|
if (!persistCart)
|
|
215
235
|
return [];
|
|
216
236
|
try {
|
|
@@ -218,9 +238,7 @@ var Store = function (localProps) {
|
|
|
218
238
|
if (stored) {
|
|
219
239
|
var parsed = JSON.parse(stored);
|
|
220
240
|
if (parsed.items && Array.isArray(parsed.items)) {
|
|
221
|
-
return parsed.items.map(function (item) { return (__assign(__assign({}, item), { product: __assign(__assign({}, item.product), { id: item.product.id || "restored_".concat(Date.now()) }),
|
|
222
|
-
// Ensure original price is preserved
|
|
223
|
-
originalPrice: item.originalPrice || item.product.comparePrice || item.product.price })); });
|
|
241
|
+
return parsed.items.map(function (item) { return (__assign(__assign({}, item), { product: __assign(__assign({}, item.product), { id: item.product.id || "restored_".concat(Date.now()) }), originalPrice: item.originalPrice || item.product.comparePrice || item.product.price })); });
|
|
224
242
|
}
|
|
225
243
|
}
|
|
226
244
|
}
|
|
@@ -228,7 +246,7 @@ var Store = function (localProps) {
|
|
|
228
246
|
console.error('Error loading cart from localStorage:', error);
|
|
229
247
|
}
|
|
230
248
|
return [];
|
|
231
|
-
}), cart =
|
|
249
|
+
}), cart = _17[0], setCart = _17[1];
|
|
232
250
|
// Save cart to localStorage
|
|
233
251
|
(0, react_1.useEffect)(function () {
|
|
234
252
|
if (persistCart) {
|
|
@@ -244,14 +262,14 @@ var Store = function (localProps) {
|
|
|
244
262
|
}
|
|
245
263
|
}
|
|
246
264
|
}, [cart, persistCart, storageKey]);
|
|
247
|
-
var
|
|
248
|
-
var
|
|
249
|
-
var
|
|
250
|
-
var
|
|
251
|
-
var
|
|
252
|
-
var
|
|
253
|
-
var
|
|
254
|
-
var
|
|
265
|
+
var _18 = (0, react_1.useState)(false), isCartOpen = _18[0], setIsCartOpen = _18[1];
|
|
266
|
+
var _19 = (0, react_1.useState)(false), isProductModalOpen = _19[0], setIsProductModalOpen = _19[1];
|
|
267
|
+
var _20 = (0, react_1.useState)(null), selectedProduct = _20[0], setSelectedProduct = _20[1];
|
|
268
|
+
var _21 = (0, react_1.useState)(''), searchQuery = _21[0], setSearchQuery = _21[1];
|
|
269
|
+
var _22 = (0, react_1.useState)('all'), selectedCategory = _22[0], setSelectedCategory = _22[1];
|
|
270
|
+
var _23 = (0, react_1.useState)('all'), selectedColor = _23[0], setSelectedColor = _23[1];
|
|
271
|
+
var _24 = (0, react_1.useState)('all'), selectedBrand = _24[0], setSelectedBrand = _24[1];
|
|
272
|
+
var _25 = (0, react_1.useState)(1), currentPage = _25[0], setCurrentPage = _25[1];
|
|
255
273
|
// Get unique categories
|
|
256
274
|
var categories = (0, react_1.useMemo)(function () {
|
|
257
275
|
if (showLoading)
|
|
@@ -262,21 +280,35 @@ var Store = function (localProps) {
|
|
|
262
280
|
var uniqueCategories = Array.from(new Set(allCategories));
|
|
263
281
|
return __spreadArray(['all'], uniqueCategories, true);
|
|
264
282
|
}, [parsedProducts, showLoading]);
|
|
265
|
-
// Get
|
|
283
|
+
// Get brands based on selected category
|
|
266
284
|
var brands = (0, react_1.useMemo)(function () {
|
|
267
285
|
if (showLoading)
|
|
268
286
|
return ['all'];
|
|
269
|
-
var
|
|
287
|
+
var filteredProducts = parsedProducts;
|
|
288
|
+
// If a category is selected, filter by it
|
|
289
|
+
if (selectedCategory !== 'all') {
|
|
290
|
+
filteredProducts = parsedProducts.filter(function (p) { return p.category === selectedCategory; });
|
|
291
|
+
}
|
|
292
|
+
var allBrands = filteredProducts
|
|
270
293
|
.map(function (p) { return p.brand; })
|
|
271
294
|
.filter(function (brand) { return typeof brand === 'string' && brand.trim() !== ''; });
|
|
272
295
|
return __spreadArray(['all'], Array.from(new Set(allBrands)), true);
|
|
273
|
-
}, [parsedProducts, showLoading]);
|
|
274
|
-
// Get
|
|
296
|
+
}, [parsedProducts, selectedCategory, showLoading]);
|
|
297
|
+
// Get colors based on selected category and brand
|
|
275
298
|
var colors = (0, react_1.useMemo)(function () {
|
|
276
299
|
if (showLoading)
|
|
277
300
|
return ['all'];
|
|
301
|
+
var filteredProducts = parsedProducts;
|
|
302
|
+
// If a category is selected, filter by it
|
|
303
|
+
if (selectedCategory !== 'all') {
|
|
304
|
+
filteredProducts = filteredProducts.filter(function (p) { return p.category === selectedCategory; });
|
|
305
|
+
}
|
|
306
|
+
// If a brand is selected, filter by it
|
|
307
|
+
if (selectedBrand !== 'all') {
|
|
308
|
+
filteredProducts = filteredProducts.filter(function (p) { return p.brand === selectedBrand; });
|
|
309
|
+
}
|
|
278
310
|
var allColors = [];
|
|
279
|
-
|
|
311
|
+
filteredProducts.forEach(function (product) {
|
|
280
312
|
var _a;
|
|
281
313
|
(_a = product.colors) === null || _a === void 0 ? void 0 : _a.forEach(function (color) {
|
|
282
314
|
if (!allColors.includes(color.name)) {
|
|
@@ -285,7 +317,7 @@ var Store = function (localProps) {
|
|
|
285
317
|
});
|
|
286
318
|
});
|
|
287
319
|
return __spreadArray(['all'], allColors, true);
|
|
288
|
-
}, [parsedProducts, showLoading]);
|
|
320
|
+
}, [parsedProducts, selectedCategory, selectedBrand, showLoading]);
|
|
289
321
|
// Filter products
|
|
290
322
|
var filteredProducts = (0, react_1.useMemo)(function () {
|
|
291
323
|
if (showLoading)
|
|
@@ -314,6 +346,18 @@ var Store = function (localProps) {
|
|
|
314
346
|
}
|
|
315
347
|
return filtered;
|
|
316
348
|
}, [parsedProducts, searchQuery, selectedCategory, selectedBrand, selectedColor, showLoading]);
|
|
349
|
+
// Reset dependent filters when parent filter changes
|
|
350
|
+
(0, react_1.useEffect)(function () {
|
|
351
|
+
if (selectedCategory === 'all') {
|
|
352
|
+
setSelectedBrand('all');
|
|
353
|
+
setSelectedColor('all');
|
|
354
|
+
}
|
|
355
|
+
}, [selectedCategory]);
|
|
356
|
+
(0, react_1.useEffect)(function () {
|
|
357
|
+
if (selectedBrand === 'all') {
|
|
358
|
+
setSelectedColor('all');
|
|
359
|
+
}
|
|
360
|
+
}, [selectedBrand]);
|
|
317
361
|
// Pagination
|
|
318
362
|
var totalPages = Math.ceil(filteredProducts.length / itemsPerPage);
|
|
319
363
|
var startIndex = (currentPage - 1) * itemsPerPage;
|
|
@@ -429,15 +473,121 @@ var Store = function (localProps) {
|
|
|
429
473
|
localStorage.removeItem(storageKey);
|
|
430
474
|
}
|
|
431
475
|
}, [persistCart, storageKey]);
|
|
476
|
+
// Create WhatsApp message
|
|
477
|
+
var createWhatsAppMessage = (0, react_1.useCallback)(function (cartItems, userInfo) {
|
|
478
|
+
if (userInfo === void 0) { userInfo = {}; }
|
|
479
|
+
var lines = [];
|
|
480
|
+
// Order summary header
|
|
481
|
+
lines.push('🛒 *ORDER SUMMARY*');
|
|
482
|
+
lines.push('');
|
|
483
|
+
// List products
|
|
484
|
+
cartItems.forEach(function (item, index) {
|
|
485
|
+
var _a;
|
|
486
|
+
var productName = item.product.name;
|
|
487
|
+
var variantInfo = item.variant ? " (".concat(item.variant.name, ")") : '';
|
|
488
|
+
var options = [];
|
|
489
|
+
if (item.selectedColor)
|
|
490
|
+
options.push("Color: ".concat(item.selectedColor));
|
|
491
|
+
if (item.selectedSize)
|
|
492
|
+
options.push("Size: ".concat(item.selectedSize));
|
|
493
|
+
var optionsText = options.length > 0 ? " [".concat(options.join(', '), "]") : '';
|
|
494
|
+
var price = ((_a = item.variant) === null || _a === void 0 ? void 0 : _a.price) || item.product.price;
|
|
495
|
+
var total = price * item.quantity;
|
|
496
|
+
lines.push("".concat(index + 1, ". ").concat(productName).concat(variantInfo).concat(optionsText));
|
|
497
|
+
lines.push(" Quantity: ".concat(item.quantity));
|
|
498
|
+
lines.push(" Price: ".concat(currency).concat(price.toFixed(2), " each"));
|
|
499
|
+
lines.push(" Total: ".concat(currency).concat(total.toFixed(2)));
|
|
500
|
+
lines.push('');
|
|
501
|
+
});
|
|
502
|
+
// Cart totals
|
|
503
|
+
var subtotal = cartItems.reduce(function (sum, item) {
|
|
504
|
+
var _a;
|
|
505
|
+
var price = ((_a = item.variant) === null || _a === void 0 ? void 0 : _a.price) || item.product.price;
|
|
506
|
+
return sum + (price * item.quantity);
|
|
507
|
+
}, 0);
|
|
508
|
+
lines.push('---');
|
|
509
|
+
lines.push("*Subtotal:* ".concat(currency).concat(subtotal.toFixed(2)));
|
|
510
|
+
lines.push("*Total Items:* ".concat(cartItems.reduce(function (sum, item) { return sum + item.quantity; }, 0)));
|
|
511
|
+
lines.push('');
|
|
512
|
+
// User information
|
|
513
|
+
if (Object.keys(userInfo).length > 0) {
|
|
514
|
+
lines.push('👤 *CUSTOMER INFORMATION*');
|
|
515
|
+
lines.push('');
|
|
516
|
+
Object.entries(userInfo).forEach(function (_a) {
|
|
517
|
+
var key = _a[0], value = _a[1];
|
|
518
|
+
if (value.trim()) {
|
|
519
|
+
var label = key.charAt(0).toUpperCase() + key.slice(1);
|
|
520
|
+
lines.push("*".concat(label, ":* ").concat(value));
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
lines.push('');
|
|
524
|
+
}
|
|
525
|
+
// Footer
|
|
526
|
+
lines.push('Thank you for your order!');
|
|
527
|
+
return encodeURIComponent(lines.join('\n'));
|
|
528
|
+
}, [currency]);
|
|
529
|
+
// Handle checkout
|
|
432
530
|
var handleCheckout = (0, react_1.useCallback)(function () {
|
|
531
|
+
if (cart.length === 0)
|
|
532
|
+
return;
|
|
533
|
+
// If there's otherInfo to collect, show modal
|
|
534
|
+
if (parsedOtherInfo.length > 0) {
|
|
535
|
+
setShowCheckoutModal(true);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
// No additional info needed, proceed directly
|
|
539
|
+
proceedToWhatsAppOrCallback({});
|
|
540
|
+
}
|
|
541
|
+
}, [cart, parsedOtherInfo]);
|
|
542
|
+
// Proceed with checkout (either to WhatsApp or callback)
|
|
543
|
+
var proceedToWhatsAppOrCallback = (0, react_1.useCallback)(function (userInfo) {
|
|
544
|
+
var checkoutData = {
|
|
545
|
+
cartItems: cart,
|
|
546
|
+
totalAmount: subtotal,
|
|
547
|
+
userInfo: userInfo
|
|
548
|
+
};
|
|
549
|
+
// Call the onCheckout callback if provided
|
|
433
550
|
if (onCheckout) {
|
|
434
|
-
onCheckout(
|
|
551
|
+
onCheckout(checkoutData);
|
|
435
552
|
}
|
|
553
|
+
// If WhatsApp number is provided, create WhatsApp message
|
|
554
|
+
if (whatsappOrderNumber) {
|
|
555
|
+
var message = createWhatsAppMessage(cart, userInfo);
|
|
556
|
+
var whatsappUrl = "https://wa.me/".concat(whatsappOrderNumber, "?text=").concat(message);
|
|
557
|
+
window.open(whatsappUrl, '_blank');
|
|
558
|
+
}
|
|
559
|
+
// Clear cart and close modals
|
|
436
560
|
if (persistCart) {
|
|
437
561
|
clearCart();
|
|
438
562
|
}
|
|
563
|
+
setShowCheckoutModal(false);
|
|
439
564
|
setIsCartOpen(false);
|
|
440
|
-
|
|
565
|
+
setUserInfoData({});
|
|
566
|
+
}, [cart, subtotal, onCheckout, whatsappOrderNumber, createWhatsAppMessage, persistCart, clearCart]);
|
|
567
|
+
// Handle user info form submission
|
|
568
|
+
var handleUserInfoSubmit = (0, react_1.useCallback)(function () {
|
|
569
|
+
setCheckoutLoading(true);
|
|
570
|
+
// Validate required fields
|
|
571
|
+
var missingFields = parsedOtherInfo
|
|
572
|
+
.filter(function (field) { var _a; return field.required && !((_a = userInfoData[field.infoName]) === null || _a === void 0 ? void 0 : _a.trim()); })
|
|
573
|
+
.map(function (field) { return field.label || field.infoName; });
|
|
574
|
+
if (missingFields.length > 0) {
|
|
575
|
+
alert("Please fill in the following required fields: ".concat(missingFields.join(', ')));
|
|
576
|
+
setCheckoutLoading(false);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
setTimeout(function () {
|
|
580
|
+
proceedToWhatsAppOrCallback(userInfoData);
|
|
581
|
+
setCheckoutLoading(false);
|
|
582
|
+
}, 500);
|
|
583
|
+
}, [parsedOtherInfo, userInfoData, proceedToWhatsAppOrCallback]);
|
|
584
|
+
// Update user info
|
|
585
|
+
var handleUserInfoChange = (0, react_1.useCallback)(function (fieldName, value) {
|
|
586
|
+
setUserInfoData(function (prev) {
|
|
587
|
+
var _a;
|
|
588
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[fieldName] = value, _a)));
|
|
589
|
+
});
|
|
590
|
+
}, []);
|
|
441
591
|
// Product modal
|
|
442
592
|
var openProductModal = (0, react_1.useCallback)(function (product) {
|
|
443
593
|
if (onProductClick) {
|
|
@@ -459,57 +609,206 @@ var Store = function (localProps) {
|
|
|
459
609
|
setCurrentPage(page);
|
|
460
610
|
}
|
|
461
611
|
}, [totalPages]);
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
(
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
612
|
+
// Helper function to get color with opacity
|
|
613
|
+
var getColorWithOpacity = (0, react_1.useCallback)(function (color, opacity) {
|
|
614
|
+
// Try to get CSS variable value first
|
|
615
|
+
var cssVariableValue = (0, getCssVariable_1.getCssVariableValue)(color);
|
|
616
|
+
// If getCssVariableValue returns a different value than input,
|
|
617
|
+
// it means the color was a CSS variable (like "primary", "dark", etc.)
|
|
618
|
+
var colorValue = cssVariableValue && cssVariableValue !== color ? cssVariableValue : color;
|
|
619
|
+
// Check if color is already in rgba format
|
|
620
|
+
var rgbaMatch = colorValue.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)/);
|
|
621
|
+
if (rgbaMatch) {
|
|
622
|
+
var r = rgbaMatch[1], g = rgbaMatch[2], b = rgbaMatch[3];
|
|
623
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(opacity, ")");
|
|
624
|
+
}
|
|
625
|
+
// Check if color is in rgb format
|
|
626
|
+
var rgbMatch = colorValue.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
627
|
+
if (rgbMatch) {
|
|
628
|
+
var r = rgbMatch[1], g = rgbMatch[2], b = rgbMatch[3];
|
|
629
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(opacity, ")");
|
|
630
|
+
}
|
|
631
|
+
// Check if color is hex format
|
|
632
|
+
if (colorValue.startsWith('#')) {
|
|
633
|
+
var hex = colorValue.replace('#', '');
|
|
634
|
+
var r = void 0, g = void 0, b = void 0;
|
|
635
|
+
if (hex.length === 3) {
|
|
636
|
+
r = parseInt(hex[0] + hex[0], 16);
|
|
637
|
+
g = parseInt(hex[1] + hex[1], 16);
|
|
638
|
+
b = parseInt(hex[2] + hex[2], 16);
|
|
639
|
+
}
|
|
640
|
+
else if (hex.length === 6) {
|
|
641
|
+
r = parseInt(hex.substring(0, 2), 16);
|
|
642
|
+
g = parseInt(hex.substring(2, 4), 16);
|
|
643
|
+
b = parseInt(hex.substring(4, 6), 16);
|
|
644
|
+
}
|
|
645
|
+
if (r !== undefined && g !== undefined && b !== undefined) {
|
|
646
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(opacity, ")");
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// For named colors that don't match patterns above, return as-is
|
|
650
|
+
// CSS will handle the opacity via the opacity property
|
|
651
|
+
return colorValue;
|
|
652
|
+
}, []);
|
|
653
|
+
// Create overlay style based on gradient settings
|
|
654
|
+
// Create overlay style based on gradient settings
|
|
655
|
+
var getOverlayStyle = (0, react_1.useCallback)(function () {
|
|
656
|
+
// Get the actual color value (resolve CSS variables)
|
|
657
|
+
var cssVariableValue = (0, getCssVariable_1.getCssVariableValue)(overlayColor);
|
|
658
|
+
var resolvedColor = cssVariableValue && cssVariableValue !== overlayColor
|
|
659
|
+
? cssVariableValue
|
|
660
|
+
: overlayColor;
|
|
661
|
+
if (!overlayGradient) {
|
|
662
|
+
// Solid overlay
|
|
663
|
+
return {
|
|
664
|
+
backgroundColor: resolvedColor,
|
|
665
|
+
opacity: overlayOpacity,
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
// For gradient overlay, create color with opacity
|
|
669
|
+
var colorWithOpacity = getColorWithOpacity(resolvedColor, overlayOpacity);
|
|
670
|
+
// Build gradient direction
|
|
671
|
+
var direction = gradientDirection.replace('to-', 'to ');
|
|
672
|
+
if (invertGradient) {
|
|
673
|
+
// From transparent to color
|
|
674
|
+
return {
|
|
675
|
+
background: "linear-gradient(".concat(direction, ", transparent 0%, ").concat(colorWithOpacity, " 100%)"),
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
// From color to transparent
|
|
680
|
+
return {
|
|
681
|
+
background: "linear-gradient(".concat(direction, ", ").concat(colorWithOpacity, " 0%, transparent 100%)"),
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
}, [overlayGradient, gradientDirection, invertGradient, overlayColor, overlayOpacity, getColorWithOpacity]);
|
|
685
|
+
// Create accordion items for filters
|
|
686
|
+
var filterAccordionItems = (0, react_1.useMemo)(function () { return [
|
|
687
|
+
{
|
|
688
|
+
icon: react_1.default.createElement(pi_1.PiList, { className: 'text-primary', size: 20 }),
|
|
689
|
+
title: 'Categories',
|
|
690
|
+
content: (react_1.default.createElement(Div_1.default, { funcss: "filter-options" }, categories.map(function (cat) { return (react_1.default.createElement("div", { key: cat, className: "filter-option ".concat(selectedCategory === cat ? 'primary100 text-primary' : ''), onClick: function () {
|
|
691
|
+
setSelectedCategory(cat);
|
|
692
|
+
if (cat === 'all') {
|
|
693
|
+
setSelectedBrand('all');
|
|
694
|
+
setSelectedColor('all');
|
|
695
|
+
}
|
|
696
|
+
} }, cat === 'all' ? 'All Categories' : cat)); }))),
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
icon: react_1.default.createElement(pi_1.PiUserCircle, { className: 'text-primary', size: 20 }),
|
|
700
|
+
title: 'Brands',
|
|
701
|
+
content: (react_1.default.createElement(Div_1.default, { funcss: "filter-options" }, brands.map(function (brand) { return (react_1.default.createElement("div", { key: brand, className: "filter-option ".concat(selectedBrand === brand ? 'primary100 text-primary' : ''), onClick: function () {
|
|
702
|
+
setSelectedBrand(brand);
|
|
703
|
+
if (brand === 'all') {
|
|
704
|
+
setSelectedColor('all');
|
|
705
|
+
}
|
|
706
|
+
}, style: {
|
|
707
|
+
opacity: selectedCategory === 'all' && brand !== 'all' ? 0.5 : 1,
|
|
708
|
+
pointerEvents: selectedCategory === 'all' && brand !== 'all' ? 'none' : 'auto'
|
|
709
|
+
} },
|
|
710
|
+
brand === 'all' ? 'All Brands' : brand,
|
|
711
|
+
selectedCategory === 'all' && brand !== 'all' && (react_1.default.createElement("small", { className: "text-muted", style: { fontSize: '0.7rem', display: 'block' } }, "(Select category first)")))); }))),
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
icon: react_1.default.createElement(pi_1.PiHandTap, { className: 'text-primary', size: 20 }),
|
|
715
|
+
title: 'Colors',
|
|
716
|
+
content: (react_1.default.createElement(Div_1.default, { funcss: "filter-options" }, colors.map(function (color) { return (react_1.default.createElement("div", { key: color, className: "filter-option ".concat(selectedColor === color ? 'primary100 text-primary' : ''), onClick: function () { return setSelectedColor(color); }, style: {
|
|
717
|
+
opacity: (selectedCategory === 'all' || selectedBrand === 'all') && color !== 'all' ? 0.5 : 1,
|
|
718
|
+
pointerEvents: (selectedCategory === 'all' || selectedBrand === 'all') && color !== 'all' ? 'none' : 'auto'
|
|
719
|
+
} },
|
|
720
|
+
color === 'all' ? 'All Colors' : color,
|
|
721
|
+
(selectedCategory === 'all' || selectedBrand === 'all') && color !== 'all' && (react_1.default.createElement("small", { className: "text-muted", style: { fontSize: '0.7rem', display: 'block' } }, "(Select category & brand first)")))); }))),
|
|
722
|
+
},
|
|
723
|
+
]; }, [categories, brands, colors, selectedCategory, selectedBrand, selectedColor]);
|
|
724
|
+
// Clear all filters
|
|
725
|
+
var clearFilters = (0, react_1.useCallback)(function () {
|
|
726
|
+
setSelectedCategory('all');
|
|
727
|
+
setSelectedBrand('all');
|
|
728
|
+
setSelectedColor('all');
|
|
729
|
+
setSearchQuery('');
|
|
730
|
+
}, []);
|
|
731
|
+
return (react_1.default.createElement(Div_1.default, { funcss: "".concat(className, " ").concat(funcss), id: id },
|
|
732
|
+
showHero && (react_1.default.createElement(Div_1.default, { funcss: "store-hero-section", customStyle: {
|
|
733
|
+
backgroundImage: heroBackgroundImage ? "url(".concat(heroBackgroundImage, ")") : 'none',
|
|
734
|
+
backgroundColor: heroBackgroundImage ? undefined : 'var(--lighter)',
|
|
735
|
+
height: heroHeight,
|
|
736
|
+
position: 'relative',
|
|
737
|
+
display: 'flex',
|
|
738
|
+
alignItems: 'center',
|
|
739
|
+
justifyContent: 'center',
|
|
740
|
+
overflow: 'hidden',
|
|
741
|
+
} },
|
|
742
|
+
react_1.default.createElement("div", { className: "hero-overlay fit", style: __assign({ position: 'absolute', top: 0, left: 0 }, getOverlayStyle()) }),
|
|
743
|
+
react_1.default.createElement("div", { className: "hero-content text-".concat(heroAlign || 'center', " relative z-10"), style: {
|
|
744
|
+
padding: '2rem',
|
|
745
|
+
width: '100%',
|
|
746
|
+
} },
|
|
747
|
+
react_1.default.createElement(Text_1.default, { text: heroTitle || title, size: titleSize, color: titleColor, block: true, bold: true }),
|
|
748
|
+
react_1.default.createElement(Text_1.default, { text: heroDescription, size: descriptionSize, color: descriptionColor, opacity: descriptionOpacity })))),
|
|
749
|
+
react_1.default.createElement(View_1.default, { funcss: "pt-10 pl-5 pr-5 center", fit: true, style: {
|
|
750
|
+
maxWidth: "1500px"
|
|
751
|
+
} },
|
|
752
|
+
react_1.default.createElement(Flex_1.default, { width: '100%', justify: 'center', gap: 2 },
|
|
753
|
+
showFilters && !isMobile && (react_1.default.createElement(View_1.default, { funcss: "w-200" },
|
|
754
|
+
react_1.default.createElement(RowFlex_1.default, { justify: "space-between", funcss: 'bb mb', alignItems: "center" },
|
|
755
|
+
react_1.default.createElement(Text_1.default, { text: "Filters", size: "h5" }),
|
|
756
|
+
react_1.default.createElement(Button_1.default, { text: "Clear", onClick: clearFilters, small: true, bg: "lighter", startIcon: react_1.default.createElement(pi_1.PiX, null) })),
|
|
757
|
+
react_1.default.createElement(Accordion_1.default, { border: false, funcss: 'bg borderless', items: filterAccordionItems, allowMultiple: true, titleClass: "text-sm", contentClass: "text-sm" }))),
|
|
758
|
+
react_1.default.createElement("div", { className: 'col fit' },
|
|
759
|
+
showFilters && isMobile && (react_1.default.createElement(Div_1.default, { funcss: "mobile-filters-button mb-4" },
|
|
760
|
+
react_1.default.createElement(Button_1.default, { startIcon: react_1.default.createElement(pi_1.PiFunnel, null), text: "Filters", onClick: function () { return setShowMobileFilters(true); }, bg: "light", color: "text", raised: true, funcss: "w-full" }))),
|
|
761
|
+
react_1.default.createElement(Flex_1.default, { gap: 1, width: '100%', funcss: 'mb-4', justify: 'space-between' },
|
|
762
|
+
showSearch && (react_1.default.createElement("div", { className: "w-400" },
|
|
763
|
+
react_1.default.createElement(Input_1.default, { label: "Search products...", value: searchQuery, onChange: function (e) { return setSearchQuery(e.target.value); }, startIcon: react_1.default.createElement(pi_1.PiMagnifyingGlass, null), borderless: true }))),
|
|
764
|
+
showCart && (react_1.default.createElement("button", { onClick: function () { return setIsCartOpen(true); }, className: "cart-icon relative", type: "button", "aria-label": "Shopping cart (".concat(totalItems, " items)"), disabled: showLoading },
|
|
765
|
+
react_1.default.createElement(sl_1.SlHandbag, { size: 30 }),
|
|
766
|
+
totalItems > 0 && (react_1.default.createElement("div", { className: "cart-badge error", style: { backgroundColor: cartBadgeColor } }, cartBadgeText || (totalItems > 99 ? '99+' : totalItems)))))),
|
|
767
|
+
showLoading ? (react_1.default.createElement(Div_1.default, { funcss: "\r\n funui_products_grid grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4\r\n " }, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map(function (index) { return (react_1.default.createElement("div", { key: index },
|
|
768
|
+
react_1.default.createElement(ProductLoader_1.default, null))); }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
769
|
+
currentProducts.length === 0 ? (react_1.default.createElement(Div_1.default, { funcss: "" },
|
|
770
|
+
react_1.default.createElement(Empty_1.default, { title: 'No products found', ctaIcon: react_1.default.createElement(pi_1.PiSpinnerGap, null), ctaText: 'Reset Filters', ctaOnClick: clearFilters }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
771
|
+
react_1.default.createElement(Div_1.default, { margin: '2rem 0', funcss: "funui_products_grid grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 ".concat(gridClassName) }, currentProducts.map(function (product) { return (react_1.default.createElement(ProductCard_1.default, { key: product.id, product: product, currency: currency, onClick: function () { return openProductModal(product); }, onAddToCart: function () { return addToCart(product); }, showBadges: true })); })),
|
|
772
|
+
totalPages > 1 && (react_1.default.createElement(Flex_1.default, { width: '100%', justify: 'center', gap: 0.5, funcss: "mt-8" },
|
|
773
|
+
react_1.default.createElement(Button_1.default, { startIcon: react_1.default.createElement(pi_1.PiCaretLeft, null), onClick: function () { return goToPage(currentPage - 1); }, disabled: currentPage === 1, text: "Prev", small: true }),
|
|
774
|
+
react_1.default.createElement(Div_1.default, { funcss: "pagination-numbers" },
|
|
775
|
+
Array.from({ length: Math.min(5, totalPages) }, function (_, i) {
|
|
776
|
+
var pageNum;
|
|
777
|
+
if (totalPages <= 5) {
|
|
778
|
+
pageNum = i + 1;
|
|
779
|
+
}
|
|
780
|
+
else if (currentPage <= 3) {
|
|
781
|
+
pageNum = i + 1;
|
|
782
|
+
}
|
|
783
|
+
else if (currentPage >= totalPages - 2) {
|
|
784
|
+
pageNum = totalPages - 4 + i;
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
pageNum = currentPage - 2 + i;
|
|
788
|
+
}
|
|
789
|
+
return (react_1.default.createElement(Button_1.default, { key: pageNum, text: pageNum.toString(), onClick: function () { return goToPage(pageNum); }, bg: currentPage === pageNum ? 'primary' : undefined, color: currentPage === pageNum ? 'white' : 'text', small: true }));
|
|
790
|
+
}),
|
|
791
|
+
totalPages > 5 && currentPage < totalPages - 2 && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
792
|
+
react_1.default.createElement(Text_1.default, { text: "...", color: "text-light" }),
|
|
793
|
+
react_1.default.createElement(Button_1.default, { text: totalPages.toString(), onClick: function () { return goToPage(totalPages); }, small: true })))),
|
|
794
|
+
react_1.default.createElement(Button_1.default, { endIcon: react_1.default.createElement(pi_1.PiCaretRight, null), onClick: function () { return goToPage(currentPage + 1); }, disabled: currentPage === totalPages, text: "Next", small: true }))))),
|
|
795
|
+
children))))),
|
|
796
|
+
showFilters && isMobile && (react_1.default.createElement(Modal_1.default, { animation: "slideUp", open: showMobileFilters, setOpen: setShowMobileFilters, title: react_1.default.createElement(RowFlex_1.default, { justify: "space-between", alignItems: "center" },
|
|
797
|
+
react_1.default.createElement(Text_1.default, { text: "Filters", size: "h5" }),
|
|
798
|
+
react_1.default.createElement(Button_1.default, { text: "Clear All", onClick: clearFilters, small: true, bg: "transparent", color: "text-light" })), body: react_1.default.createElement(Div_1.default, { funcss: "p-4" },
|
|
799
|
+
react_1.default.createElement(Accordion_1.default, { items: filterAccordionItems, allowMultiple: true, titleClass: "text-sm", contentClass: "text-xs", activeClass: "", funcss: 'card' })), footer: react_1.default.createElement(Div_1.default, { funcss: "p-4" },
|
|
800
|
+
react_1.default.createElement(Button_1.default, { text: "Apply Filters", onClick: function () { return setShowMobileFilters(false); }, bg: "primary", color: "white", raised: true, funcss: "w-full" })) })),
|
|
801
|
+
showCart && (react_1.default.createElement(CartModal_1.default, { cart: cart, isOpen: isCartOpen, setIsOpen: setIsCartOpen, currency: currency, updateQuantity: updateQuantity, removeFromCart: removeFromCart, clearCart: clearCart, handleCheckout: handleCheckout, cartBadgeColor: cartBadgeColor, checkoutText: checkoutText, checkoutIcon: checkoutIcon, persistCart: persistCart })),
|
|
802
|
+
showCheckoutModal && (react_1.default.createElement(Modal_1.default, { animation: "fadeIn", open: showCheckoutModal, setOpen: setShowCheckoutModal, maxWidth: '550px', title: react_1.default.createElement(react_1.default.Fragment, null, whatsappOrderNumber ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
803
|
+
react_1.default.createElement(Text_1.default, { text: "Complete Your Order", size: "xl", block: true }),
|
|
804
|
+
react_1.default.createElement(Text_1.default, { text: "Please provide the following information to complete your order:", size: "sm" }))) : (react_1.default.createElement(Text_1.default, { text: "Order Information", size: "xkl" }))), body: react_1.default.createElement(Div_1.default, { funcss: "p-8" }, parsedOtherInfo.map(function (field, index) { return (react_1.default.createElement(Div_1.default, { key: index, funcss: "section" },
|
|
805
|
+
react_1.default.createElement(Input_1.default, { label: "".concat(field.label || field.infoName).concat(field.required ? ' *' : ''), type: field.type === 'textarea' ? 'text' : field.type, multiline: field.type === 'textarea', rows: field.type === 'textarea' ? 3 : undefined, value: userInfoData[field.infoName] || '', onChange: function (e) { return handleUserInfoChange(field.infoName, e.target.value); }, bordered: true, fullWidth: true }))); })), footer: react_1.default.createElement(Div_1.default, { funcss: "" },
|
|
806
|
+
react_1.default.createElement(RowFlex_1.default, { justify: "center", alignItems: "center" },
|
|
807
|
+
react_1.default.createElement(Button_1.default, { prefix: react_1.default.createElement(pi_1.PiX, null), text: "Cancel", onClick: function () {
|
|
808
|
+
setShowCheckoutModal(false);
|
|
809
|
+
setUserInfoData({});
|
|
810
|
+
}, bg: "error-light", color: "error" }),
|
|
811
|
+
react_1.default.createElement(Button_1.default, { text: whatsappOrderNumber ? "Send via WhatsApp" : "Complete Order", bg: "primary", raised: true, onClick: handleUserInfoSubmit, funcss: "padding-x-30", startIcon: whatsappOrderNumber ? react_1.default.createElement(pi_1.PiWhatsappLogo, null) : checkoutIcon, isLoading: checkoutLoading, disabled: checkoutLoading }))) })),
|
|
513
812
|
selectedProduct && (react_1.default.createElement(ProductDetail_1.default, { product: selectedProduct, open: isProductModalOpen, setOpen: setIsProductModalOpen, currency: currency, onAddToCart: handleAddFromModal }))));
|
|
514
813
|
};
|
|
515
814
|
exports.default = Store;
|