@diffsome/react 1.2.0 → 1.2.1

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/index.mjs CHANGED
@@ -63,19 +63,33 @@ function DiffsomeProvider({ children, config = {} }) {
63
63
  }
64
64
  }, [client]);
65
65
  useEffect(() => {
66
- setIsReady(true);
67
- refreshCart();
68
- refreshWishlist();
69
- }, [refreshCart, refreshWishlist]);
70
- useEffect(() => {
71
- const handleAuthChange = () => {
72
- refreshWishlist();
66
+ let mounted = true;
67
+ const init = async () => {
68
+ if (!mounted) return;
69
+ setIsReady(true);
70
+ try {
71
+ const cartData = await client.shop.getCart();
72
+ if (mounted) setCart(cartData);
73
+ } catch (err) {
74
+ if (mounted) setCart(null);
75
+ } finally {
76
+ if (mounted) setCartLoading(false);
77
+ }
78
+ if (client.isAuthenticated()) {
79
+ try {
80
+ const response = await client.shop.getWishlist({ per_page: 100 });
81
+ if (mounted) setWishlistItems(response.data);
82
+ } catch (err) {
83
+ if (mounted) setWishlistItems([]);
84
+ }
85
+ }
86
+ if (mounted) setWishlistLoading(false);
73
87
  };
74
- if (typeof window !== "undefined") {
75
- window.addEventListener("storage", handleAuthChange);
76
- return () => window.removeEventListener("storage", handleAuthChange);
77
- }
78
- }, [refreshWishlist]);
88
+ init();
89
+ return () => {
90
+ mounted = false;
91
+ };
92
+ }, [client]);
79
93
  const value = useMemo(() => ({
80
94
  client,
81
95
  isReady,
@@ -102,15 +116,104 @@ function useClient() {
102
116
  return client;
103
117
  }
104
118
 
105
- // src/hooks/useAuth.ts
106
- import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2 } from "react";
107
- function useAuth() {
119
+ // src/hooks/useSite.ts
120
+ import { useState as useState2, useCallback as useCallback2, useEffect as useEffect2 } from "react";
121
+ var DEFAULT_CURRENCY = {
122
+ code: "KRW",
123
+ symbol: "\u20A9",
124
+ position: "before",
125
+ decimals: 0
126
+ };
127
+ function useSite() {
108
128
  const client = useClient();
109
- const [user, setUser] = useState2(null);
129
+ const [site, setSite] = useState2(null);
110
130
  const [loading, setLoading] = useState2(true);
111
131
  const [error, setError] = useState2(null);
132
+ const fetchSite = useCallback2(async () => {
133
+ setLoading(true);
134
+ setError(null);
135
+ try {
136
+ const data = await client.site.getInfo();
137
+ setSite(data);
138
+ } catch (err) {
139
+ setError(err instanceof Error ? err : new Error("Failed to fetch site info"));
140
+ } finally {
141
+ setLoading(false);
142
+ }
143
+ }, [client]);
144
+ useEffect2(() => {
145
+ fetchSite();
146
+ }, [fetchSite]);
147
+ const currency = site?.currency ?? null;
148
+ const formatPrice = useCallback2((amount) => {
149
+ const curr = currency ?? DEFAULT_CURRENCY;
150
+ const formatted = amount.toLocaleString(void 0, {
151
+ minimumFractionDigits: curr.decimals,
152
+ maximumFractionDigits: curr.decimals
153
+ });
154
+ if (curr.position === "after") {
155
+ return `${formatted}${curr.symbol}`;
156
+ }
157
+ return `${curr.symbol}${formatted}`;
158
+ }, [currency]);
159
+ return {
160
+ site,
161
+ loading,
162
+ error,
163
+ refresh: fetchSite,
164
+ currency,
165
+ formatPrice
166
+ };
167
+ }
168
+ function useCurrency() {
169
+ const client = useClient();
170
+ const [currency, setCurrency] = useState2(null);
171
+ const [loading, setLoading] = useState2(true);
172
+ const [error, setError] = useState2(null);
173
+ const fetchCurrency = useCallback2(async () => {
174
+ setLoading(true);
175
+ setError(null);
176
+ try {
177
+ const data = await client.site.getCurrency();
178
+ setCurrency(data);
179
+ } catch (err) {
180
+ setError(err instanceof Error ? err : new Error("Failed to fetch currency"));
181
+ } finally {
182
+ setLoading(false);
183
+ }
184
+ }, [client]);
185
+ useEffect2(() => {
186
+ fetchCurrency();
187
+ }, [fetchCurrency]);
188
+ const formatPrice = useCallback2((amount) => {
189
+ const curr = currency ?? DEFAULT_CURRENCY;
190
+ const formatted = amount.toLocaleString(void 0, {
191
+ minimumFractionDigits: curr.decimals,
192
+ maximumFractionDigits: curr.decimals
193
+ });
194
+ if (curr.position === "after") {
195
+ return `${formatted}${curr.symbol}`;
196
+ }
197
+ return `${curr.symbol}${formatted}`;
198
+ }, [currency]);
199
+ return {
200
+ currency,
201
+ loading,
202
+ error,
203
+ formatPrice,
204
+ refresh: fetchCurrency
205
+ };
206
+ }
207
+
208
+ // src/hooks/useAuth.ts
209
+ import { useState as useState3, useEffect as useEffect3, useCallback as useCallback3 } from "react";
210
+ function useAuth() {
211
+ const client = useClient();
212
+ const [user, setUser] = useState3(null);
213
+ const [loading, setLoading] = useState3(true);
214
+ const [error, setError] = useState3(null);
112
215
  const isAuthenticated = !!user && client.isAuthenticated();
113
- const fetchProfile = useCallback2(async () => {
216
+ const fetchProfile = useCallback3(async () => {
114
217
  if (!client.isAuthenticated()) {
115
218
  setUser(null);
116
219
  setLoading(false);
@@ -127,10 +230,10 @@ function useAuth() {
127
230
  setLoading(false);
128
231
  }
129
232
  }, [client]);
130
- useEffect2(() => {
233
+ useEffect3(() => {
131
234
  fetchProfile();
132
235
  }, [fetchProfile]);
133
- const login = useCallback2(async (credentials) => {
236
+ const login = useCallback3(async (credentials) => {
134
237
  setLoading(true);
135
238
  setError(null);
136
239
  try {
@@ -145,7 +248,7 @@ function useAuth() {
145
248
  setLoading(false);
146
249
  }
147
250
  }, [client]);
148
- const register = useCallback2(async (data) => {
251
+ const register = useCallback3(async (data) => {
149
252
  setLoading(true);
150
253
  setError(null);
151
254
  try {
@@ -160,7 +263,7 @@ function useAuth() {
160
263
  setLoading(false);
161
264
  }
162
265
  }, [client]);
163
- const logout = useCallback2(async () => {
266
+ const logout = useCallback3(async () => {
164
267
  setLoading(true);
165
268
  try {
166
269
  await client.auth.logout();
@@ -169,23 +272,23 @@ function useAuth() {
169
272
  setLoading(false);
170
273
  }
171
274
  }, [client]);
172
- const getProfile = useCallback2(async () => {
275
+ const getProfile = useCallback3(async () => {
173
276
  const profile = await client.auth.me();
174
277
  setUser(profile);
175
278
  return profile;
176
279
  }, [client]);
177
- const updateProfile = useCallback2(async (data) => {
280
+ const updateProfile = useCallback3(async (data) => {
178
281
  const profile = await client.auth.updateProfile(data);
179
282
  setUser(profile);
180
283
  return profile;
181
284
  }, [client]);
182
- const forgotPassword = useCallback2(async (email) => {
285
+ const forgotPassword = useCallback3(async (email) => {
183
286
  return await client.auth.forgotPassword({ email });
184
287
  }, [client]);
185
- const resetPassword = useCallback2(async (data) => {
288
+ const resetPassword = useCallback3(async (data) => {
186
289
  return await client.auth.resetPassword(data);
187
290
  }, [client]);
188
- const refresh = useCallback2(async () => {
291
+ const refresh = useCallback3(async () => {
189
292
  await fetchProfile();
190
293
  }, [fetchProfile]);
191
294
  return {
@@ -205,13 +308,13 @@ function useAuth() {
205
308
  }
206
309
 
207
310
  // src/hooks/useSocialAuth.ts
208
- import { useState as useState3, useEffect as useEffect3, useCallback as useCallback3 } from "react";
311
+ import { useState as useState4, useEffect as useEffect4, useCallback as useCallback4 } from "react";
209
312
  function useSocialAuth() {
210
313
  const client = useClient();
211
- const [providers, setProviders] = useState3([]);
212
- const [loading, setLoading] = useState3(true);
213
- const [error, setError] = useState3(null);
214
- const fetchProviders = useCallback3(async () => {
314
+ const [providers, setProviders] = useState4([]);
315
+ const [loading, setLoading] = useState4(true);
316
+ const [error, setError] = useState4(null);
317
+ const fetchProviders = useCallback4(async () => {
215
318
  setLoading(true);
216
319
  setError(null);
217
320
  try {
@@ -223,14 +326,14 @@ function useSocialAuth() {
223
326
  setLoading(false);
224
327
  }
225
328
  }, [client]);
226
- useEffect3(() => {
329
+ useEffect4(() => {
227
330
  fetchProviders();
228
331
  }, [fetchProviders]);
229
- const getAuthUrl = useCallback3(async (provider) => {
332
+ const getAuthUrl = useCallback4(async (provider) => {
230
333
  const result = await client.auth.getSocialAuthUrl(provider);
231
334
  return result.url;
232
335
  }, [client]);
233
- const handleCallback = useCallback3(async (provider, code) => {
336
+ const handleCallback = useCallback4(async (provider, code) => {
234
337
  return await client.auth.socialCallback(provider, code);
235
338
  }, [client]);
236
339
  return {
@@ -244,10 +347,10 @@ function useSocialAuth() {
244
347
  }
245
348
 
246
349
  // src/hooks/useCart.ts
247
- import { useCallback as useCallback4 } from "react";
350
+ import { useCallback as useCallback5 } from "react";
248
351
  function useCart() {
249
352
  const { client, cart, cartLoading, setCart, refreshCart } = useDiffsome();
250
- const addToCart = useCallback4(async (productId, quantity = 1, variantId, options) => {
353
+ const addToCart = useCallback5(async (productId, quantity = 1, variantId, options) => {
251
354
  const data = {
252
355
  product_id: productId,
253
356
  quantity,
@@ -258,27 +361,27 @@ function useCart() {
258
361
  setCart(updatedCart);
259
362
  return updatedCart;
260
363
  }, [client, setCart]);
261
- const updateItem = useCallback4(async (itemId, quantity) => {
364
+ const updateItem = useCallback5(async (itemId, quantity) => {
262
365
  const updatedCart = await client.shop.updateCartItem(itemId, { quantity });
263
366
  setCart(updatedCart);
264
367
  return updatedCart;
265
368
  }, [client, setCart]);
266
- const removeItem = useCallback4(async (itemId) => {
369
+ const removeItem = useCallback5(async (itemId) => {
267
370
  const updatedCart = await client.shop.removeFromCart(itemId);
268
371
  setCart(updatedCart);
269
372
  return updatedCart;
270
373
  }, [client, setCart]);
271
- const clearCart = useCallback4(async () => {
374
+ const clearCart = useCallback5(async () => {
272
375
  await client.shop.clearCart();
273
376
  setCart(null);
274
377
  }, [client, setCart]);
275
- const isInCart = useCallback4((productId, variantId) => {
378
+ const isInCart = useCallback5((productId, variantId) => {
276
379
  if (!cart?.items) return false;
277
380
  return cart.items.some(
278
381
  (item) => item.product_id === productId && (variantId === void 0 || item.variant_id === variantId)
279
382
  );
280
383
  }, [cart]);
281
- const getItemQuantity = useCallback4((productId, variantId) => {
384
+ const getItemQuantity = useCallback5((productId, variantId) => {
282
385
  if (!cart?.items) return 0;
283
386
  const item = cart.items.find(
284
387
  (item2) => item2.product_id === productId && (variantId === void 0 || item2.variant_id === variantId)
@@ -305,10 +408,10 @@ function useCart() {
305
408
  }
306
409
 
307
410
  // src/hooks/useWishlist.ts
308
- import { useState as useState4, useCallback as useCallback5, useMemo as useMemo2 } from "react";
411
+ import { useState as useState5, useCallback as useCallback6, useMemo as useMemo2 } from "react";
309
412
  function useWishlist() {
310
413
  const { client, wishlistItems, wishlistLoading, setWishlistItems, refreshWishlist, setCart } = useDiffsome();
311
- const [error, setError] = useState4(null);
414
+ const [error, setError] = useState5(null);
312
415
  const wishlistMap = useMemo2(() => {
313
416
  const map = {};
314
417
  wishlistItems.forEach((item) => {
@@ -317,11 +420,11 @@ function useWishlist() {
317
420
  });
318
421
  return map;
319
422
  }, [wishlistItems]);
320
- const isInWishlist = useCallback5((productId, variantId) => {
423
+ const isInWishlist = useCallback6((productId, variantId) => {
321
424
  const key = variantId ? `${productId}_${variantId}` : String(productId);
322
425
  return wishlistMap[key] || false;
323
426
  }, [wishlistMap]);
324
- const toggleWishlist = useCallback5(async (productId, variantId) => {
427
+ const toggleWishlist = useCallback6(async (productId, variantId) => {
325
428
  const result = await client.shop.toggleWishlist(productId, variantId);
326
429
  if (result.action === "added") {
327
430
  await refreshWishlist();
@@ -332,7 +435,7 @@ function useWishlist() {
332
435
  }
333
436
  return result;
334
437
  }, [client, refreshWishlist, setWishlistItems, wishlistItems]);
335
- const addToWishlist = useCallback5(async (productId, variantId, note) => {
438
+ const addToWishlist = useCallback6(async (productId, variantId, note) => {
336
439
  const item = await client.shop.addToWishlist({
337
440
  product_id: productId,
338
441
  variant_id: variantId,
@@ -341,23 +444,23 @@ function useWishlist() {
341
444
  await refreshWishlist();
342
445
  return item;
343
446
  }, [client, refreshWishlist]);
344
- const removeFromWishlist = useCallback5(async (wishlistId) => {
447
+ const removeFromWishlist = useCallback6(async (wishlistId) => {
345
448
  await client.shop.removeFromWishlist(wishlistId);
346
449
  setWishlistItems(wishlistItems.filter((i) => i.id !== wishlistId));
347
450
  }, [client, setWishlistItems, wishlistItems]);
348
- const moveToCart = useCallback5(async (wishlistIds) => {
451
+ const moveToCart = useCallback6(async (wishlistIds) => {
349
452
  const result = await client.shop.moveWishlistToCart(wishlistIds);
350
453
  await refreshWishlist();
351
454
  const cartData = await client.shop.getCart();
352
455
  setCart(cartData);
353
456
  return result;
354
457
  }, [client, refreshWishlist, setCart]);
355
- const updateNote = useCallback5(async (wishlistId, note) => {
458
+ const updateNote = useCallback6(async (wishlistId, note) => {
356
459
  const item = await client.shop.updateWishlistNote(wishlistId, note);
357
460
  setWishlistItems(wishlistItems.map((i) => i.id === wishlistId ? item : i));
358
461
  return item;
359
462
  }, [client, setWishlistItems, wishlistItems]);
360
- const getProductWishlistCount = useCallback5(async (productSlug) => {
463
+ const getProductWishlistCount = useCallback6(async (productSlug) => {
361
464
  return await client.shop.getProductWishlistCount(productSlug);
362
465
  }, [client]);
363
466
  return {
@@ -377,16 +480,16 @@ function useWishlist() {
377
480
  }
378
481
 
379
482
  // src/hooks/useProducts.ts
380
- import { useState as useState5, useEffect as useEffect4, useCallback as useCallback6 } from "react";
483
+ import { useState as useState6, useEffect as useEffect5, useCallback as useCallback7 } from "react";
381
484
  function useProducts(options = {}) {
382
485
  const { autoFetch = true, ...params } = options;
383
486
  const client = useClient();
384
- const [products, setProducts] = useState5([]);
385
- const [meta, setMeta] = useState5(null);
386
- const [loading, setLoading] = useState5(autoFetch);
387
- const [error, setError] = useState5(null);
388
- const [currentParams, setCurrentParams] = useState5(params);
389
- const fetchProducts = useCallback6(async (fetchParams, append = false) => {
487
+ const [products, setProducts] = useState6([]);
488
+ const [meta, setMeta] = useState6(null);
489
+ const [loading, setLoading] = useState6(autoFetch);
490
+ const [error, setError] = useState6(null);
491
+ const [currentParams, setCurrentParams] = useState6(params);
492
+ const fetchProducts = useCallback7(async (fetchParams, append = false) => {
390
493
  setLoading(true);
391
494
  setError(null);
392
495
  try {
@@ -403,22 +506,22 @@ function useProducts(options = {}) {
403
506
  setLoading(false);
404
507
  }
405
508
  }, [client]);
406
- useEffect4(() => {
509
+ useEffect5(() => {
407
510
  if (autoFetch) {
408
511
  fetchProducts(params);
409
512
  }
410
513
  }, []);
411
514
  const hasMore = meta ? meta.current_page < meta.last_page : false;
412
- const loadMore = useCallback6(async () => {
515
+ const loadMore = useCallback7(async () => {
413
516
  if (!hasMore || loading) return;
414
517
  const nextPage = (meta?.current_page ?? 0) + 1;
415
518
  await fetchProducts({ ...currentParams, page: nextPage }, true);
416
519
  }, [hasMore, loading, meta, currentParams, fetchProducts]);
417
- const refresh = useCallback6(async () => {
520
+ const refresh = useCallback7(async () => {
418
521
  setCurrentParams(params);
419
522
  await fetchProducts(params);
420
523
  }, [params, fetchProducts]);
421
- const search = useCallback6(async (query) => {
524
+ const search = useCallback7(async (query) => {
422
525
  const searchParams = { ...params, search: query, page: 1 };
423
526
  setCurrentParams(searchParams);
424
527
  await fetchProducts(searchParams);
@@ -436,10 +539,10 @@ function useProducts(options = {}) {
436
539
  }
437
540
  function useProduct(idOrSlug) {
438
541
  const client = useClient();
439
- const [product, setProduct] = useState5(null);
440
- const [loading, setLoading] = useState5(true);
441
- const [error, setError] = useState5(null);
442
- const fetchProduct = useCallback6(async () => {
542
+ const [product, setProduct] = useState6(null);
543
+ const [loading, setLoading] = useState6(true);
544
+ const [error, setError] = useState6(null);
545
+ const fetchProduct = useCallback7(async () => {
443
546
  setLoading(true);
444
547
  setError(null);
445
548
  try {
@@ -451,7 +554,7 @@ function useProduct(idOrSlug) {
451
554
  setLoading(false);
452
555
  }
453
556
  }, [client, idOrSlug]);
454
- useEffect4(() => {
557
+ useEffect5(() => {
455
558
  fetchProduct();
456
559
  }, [fetchProduct]);
457
560
  return {
@@ -463,10 +566,10 @@ function useProduct(idOrSlug) {
463
566
  }
464
567
  function useCategories() {
465
568
  const client = useClient();
466
- const [categories, setCategories] = useState5([]);
467
- const [loading, setLoading] = useState5(true);
468
- const [error, setError] = useState5(null);
469
- const fetchCategories = useCallback6(async () => {
569
+ const [categories, setCategories] = useState6([]);
570
+ const [loading, setLoading] = useState6(true);
571
+ const [error, setError] = useState6(null);
572
+ const fetchCategories = useCallback7(async () => {
470
573
  setLoading(true);
471
574
  setError(null);
472
575
  try {
@@ -478,7 +581,7 @@ function useCategories() {
478
581
  setLoading(false);
479
582
  }
480
583
  }, [client]);
481
- useEffect4(() => {
584
+ useEffect5(() => {
482
585
  fetchCategories();
483
586
  }, [fetchCategories]);
484
587
  return {
@@ -490,10 +593,10 @@ function useCategories() {
490
593
  }
491
594
  function useFeaturedProducts(limit = 8) {
492
595
  const client = useClient();
493
- const [products, setProducts] = useState5([]);
494
- const [loading, setLoading] = useState5(true);
495
- const [error, setError] = useState5(null);
496
- const fetchProducts = useCallback6(async () => {
596
+ const [products, setProducts] = useState6([]);
597
+ const [loading, setLoading] = useState6(true);
598
+ const [error, setError] = useState6(null);
599
+ const fetchProducts = useCallback7(async () => {
497
600
  setLoading(true);
498
601
  setError(null);
499
602
  try {
@@ -505,7 +608,7 @@ function useFeaturedProducts(limit = 8) {
505
608
  setLoading(false);
506
609
  }
507
610
  }, [client, limit]);
508
- useEffect4(() => {
611
+ useEffect5(() => {
509
612
  fetchProducts();
510
613
  }, [fetchProducts]);
511
614
  return {
@@ -517,11 +620,11 @@ function useFeaturedProducts(limit = 8) {
517
620
  }
518
621
  function useProductsByType(type, params) {
519
622
  const client = useClient();
520
- const [products, setProducts] = useState5([]);
521
- const [meta, setMeta] = useState5(null);
522
- const [loading, setLoading] = useState5(true);
523
- const [error, setError] = useState5(null);
524
- const fetchProducts = useCallback6(async () => {
623
+ const [products, setProducts] = useState6([]);
624
+ const [meta, setMeta] = useState6(null);
625
+ const [loading, setLoading] = useState6(true);
626
+ const [error, setError] = useState6(null);
627
+ const fetchProducts = useCallback7(async () => {
525
628
  setLoading(true);
526
629
  setError(null);
527
630
  try {
@@ -534,7 +637,7 @@ function useProductsByType(type, params) {
534
637
  setLoading(false);
535
638
  }
536
639
  }, [client, type, params]);
537
- useEffect4(() => {
640
+ useEffect5(() => {
538
641
  fetchProducts();
539
642
  }, [fetchProducts]);
540
643
  return {
@@ -556,10 +659,10 @@ function useBundleProducts(params) {
556
659
  }
557
660
  function useBundleItems(productSlug) {
558
661
  const client = useClient();
559
- const [bundle, setBundle] = useState5(null);
560
- const [loading, setLoading] = useState5(true);
561
- const [error, setError] = useState5(null);
562
- const fetchBundle = useCallback6(async () => {
662
+ const [bundle, setBundle] = useState6(null);
663
+ const [loading, setLoading] = useState6(true);
664
+ const [error, setError] = useState6(null);
665
+ const fetchBundle = useCallback7(async () => {
563
666
  setLoading(true);
564
667
  setError(null);
565
668
  try {
@@ -571,7 +674,7 @@ function useBundleItems(productSlug) {
571
674
  setLoading(false);
572
675
  }
573
676
  }, [client, productSlug]);
574
- useEffect4(() => {
677
+ useEffect5(() => {
575
678
  fetchBundle();
576
679
  }, [fetchBundle]);
577
680
  return {
@@ -583,14 +686,14 @@ function useBundleItems(productSlug) {
583
686
  }
584
687
 
585
688
  // src/hooks/useOrders.ts
586
- import { useState as useState6, useEffect as useEffect5, useCallback as useCallback7 } from "react";
689
+ import { useState as useState7, useEffect as useEffect6, useCallback as useCallback8 } from "react";
587
690
  function useOrders(params) {
588
691
  const client = useClient();
589
- const [orders, setOrders] = useState6([]);
590
- const [meta, setMeta] = useState6(null);
591
- const [loading, setLoading] = useState6(true);
592
- const [error, setError] = useState6(null);
593
- const fetchOrders = useCallback7(async (fetchParams, append = false) => {
692
+ const [orders, setOrders] = useState7([]);
693
+ const [meta, setMeta] = useState7(null);
694
+ const [loading, setLoading] = useState7(true);
695
+ const [error, setError] = useState7(null);
696
+ const fetchOrders = useCallback8(async (fetchParams, append = false) => {
594
697
  if (!client.isAuthenticated()) {
595
698
  setOrders([]);
596
699
  setLoading(false);
@@ -612,16 +715,16 @@ function useOrders(params) {
612
715
  setLoading(false);
613
716
  }
614
717
  }, [client]);
615
- useEffect5(() => {
718
+ useEffect6(() => {
616
719
  fetchOrders(params);
617
720
  }, []);
618
721
  const hasMore = meta ? meta.current_page < meta.last_page : false;
619
- const loadMore = useCallback7(async () => {
722
+ const loadMore = useCallback8(async () => {
620
723
  if (!hasMore || loading) return;
621
724
  const nextPage = (meta?.current_page ?? 0) + 1;
622
725
  await fetchOrders({ ...params, page: nextPage }, true);
623
726
  }, [hasMore, loading, meta, params, fetchOrders]);
624
- const refresh = useCallback7(async () => {
727
+ const refresh = useCallback8(async () => {
625
728
  await fetchOrders(params);
626
729
  }, [params, fetchOrders]);
627
730
  return {
@@ -636,10 +739,10 @@ function useOrders(params) {
636
739
  }
637
740
  function useOrder(idOrNumber) {
638
741
  const client = useClient();
639
- const [order, setOrder] = useState6(null);
640
- const [loading, setLoading] = useState6(true);
641
- const [error, setError] = useState6(null);
642
- const fetchOrder = useCallback7(async () => {
742
+ const [order, setOrder] = useState7(null);
743
+ const [loading, setLoading] = useState7(true);
744
+ const [error, setError] = useState7(null);
745
+ const fetchOrder = useCallback8(async () => {
643
746
  setLoading(true);
644
747
  setError(null);
645
748
  try {
@@ -651,10 +754,10 @@ function useOrder(idOrNumber) {
651
754
  setLoading(false);
652
755
  }
653
756
  }, [client, idOrNumber]);
654
- useEffect5(() => {
757
+ useEffect6(() => {
655
758
  fetchOrder();
656
759
  }, [fetchOrder]);
657
- const cancel = useCallback7(async () => {
760
+ const cancel = useCallback8(async () => {
658
761
  if (!order) throw new Error("Order not loaded");
659
762
  const cancelled = await client.shop.cancelOrder(order.id);
660
763
  setOrder(cancelled);
@@ -670,9 +773,9 @@ function useOrder(idOrNumber) {
670
773
  }
671
774
  function useCreateOrder() {
672
775
  const client = useClient();
673
- const [loading, setLoading] = useState6(false);
674
- const [error, setError] = useState6(null);
675
- const createOrder = useCallback7(async (data) => {
776
+ const [loading, setLoading] = useState7(false);
777
+ const [error, setError] = useState7(null);
778
+ const createOrder = useCallback8(async (data) => {
676
779
  setLoading(true);
677
780
  setError(null);
678
781
  try {
@@ -693,13 +796,19 @@ function useCreateOrder() {
693
796
  }
694
797
 
695
798
  // src/hooks/usePayment.ts
696
- import { useState as useState7, useCallback as useCallback8 } from "react";
799
+ import { useState as useState8, useCallback as useCallback9 } from "react";
800
+ var DEFAULT_CURRENCY2 = {
801
+ code: "KRW",
802
+ symbol: "\u20A9",
803
+ position: "before",
804
+ decimals: 0
805
+ };
697
806
  function usePaymentStatus() {
698
807
  const client = useClient();
699
- const [status, setStatus] = useState7(null);
700
- const [loading, setLoading] = useState7(true);
701
- const [error, setError] = useState7(null);
702
- const fetchStatus = useCallback8(async () => {
808
+ const [status, setStatus] = useState8(null);
809
+ const [loading, setLoading] = useState8(true);
810
+ const [error, setError] = useState8(null);
811
+ const fetchStatus = useCallback9(async () => {
703
812
  setLoading(true);
704
813
  setError(null);
705
814
  try {
@@ -711,11 +820,25 @@ function usePaymentStatus() {
711
820
  setLoading(false);
712
821
  }
713
822
  }, [client]);
823
+ const currency = status?.currency ?? null;
824
+ const formatPrice = useCallback9((amount) => {
825
+ const curr = currency ?? DEFAULT_CURRENCY2;
826
+ const formatted = amount.toLocaleString(void 0, {
827
+ minimumFractionDigits: curr.decimals,
828
+ maximumFractionDigits: curr.decimals
829
+ });
830
+ if (curr.position === "after") {
831
+ return `${formatted}${curr.symbol}`;
832
+ }
833
+ return `${curr.symbol}${formatted}`;
834
+ }, [currency]);
714
835
  return {
715
836
  status,
716
837
  loading,
717
838
  error,
718
839
  refresh: fetchStatus,
840
+ currency,
841
+ formatPrice,
719
842
  isTossAvailable: status?.toss?.available ?? false,
720
843
  isStripeAvailable: status?.stripe?.available ?? false,
721
844
  stripePublishableKey: status?.stripe?.publishable_key ?? null
@@ -723,9 +846,9 @@ function usePaymentStatus() {
723
846
  }
724
847
  function useTossPayment() {
725
848
  const client = useClient();
726
- const [loading, setLoading] = useState7(false);
727
- const [error, setError] = useState7(null);
728
- const preparePayment = useCallback8(async (orderNumber, successUrl, failUrl) => {
849
+ const [loading, setLoading] = useState8(false);
850
+ const [error, setError] = useState8(null);
851
+ const preparePayment = useCallback9(async (orderNumber, successUrl, failUrl) => {
729
852
  setLoading(true);
730
853
  setError(null);
731
854
  try {
@@ -742,7 +865,7 @@ function useTossPayment() {
742
865
  setLoading(false);
743
866
  }
744
867
  }, [client]);
745
- const confirmPayment = useCallback8(async (paymentKey, orderId, amount) => {
868
+ const confirmPayment = useCallback9(async (paymentKey, orderId, amount) => {
746
869
  setLoading(true);
747
870
  setError(null);
748
871
  try {
@@ -759,7 +882,7 @@ function useTossPayment() {
759
882
  setLoading(false);
760
883
  }
761
884
  }, [client]);
762
- const cancelPayment = useCallback8(async (orderNumber, reason, amount) => {
885
+ const cancelPayment = useCallback9(async (orderNumber, reason, amount) => {
763
886
  setLoading(true);
764
887
  setError(null);
765
888
  try {
@@ -782,9 +905,9 @@ function useTossPayment() {
782
905
  }
783
906
  function useStripePayment() {
784
907
  const client = useClient();
785
- const [loading, setLoading] = useState7(false);
786
- const [error, setError] = useState7(null);
787
- const createCheckout = useCallback8(async (orderNumber, successUrl, cancelUrl) => {
908
+ const [loading, setLoading] = useState8(false);
909
+ const [error, setError] = useState8(null);
910
+ const createCheckout = useCallback9(async (orderNumber, successUrl, cancelUrl) => {
788
911
  setLoading(true);
789
912
  setError(null);
790
913
  try {
@@ -801,7 +924,7 @@ function useStripePayment() {
801
924
  setLoading(false);
802
925
  }
803
926
  }, [client]);
804
- const verifyPayment = useCallback8(async (sessionId) => {
927
+ const verifyPayment = useCallback9(async (sessionId) => {
805
928
  setLoading(true);
806
929
  setError(null);
807
930
  try {
@@ -814,7 +937,7 @@ function useStripePayment() {
814
937
  setLoading(false);
815
938
  }
816
939
  }, [client]);
817
- const refund = useCallback8(async (orderNumber, reason, amount) => {
940
+ const refund = useCallback9(async (orderNumber, reason, amount) => {
818
941
  setLoading(true);
819
942
  setError(null);
820
943
  try {
@@ -837,13 +960,13 @@ function useStripePayment() {
837
960
  }
838
961
 
839
962
  // src/hooks/useCoupons.ts
840
- import { useState as useState8, useEffect as useEffect6, useCallback as useCallback9 } from "react";
963
+ import { useState as useState9, useEffect as useEffect7, useCallback as useCallback10 } from "react";
841
964
  function useCoupons() {
842
965
  const client = useClient();
843
- const [coupons, setCoupons] = useState8([]);
844
- const [loading, setLoading] = useState8(true);
845
- const [error, setError] = useState8(null);
846
- const fetchCoupons = useCallback9(async () => {
966
+ const [coupons, setCoupons] = useState9([]);
967
+ const [loading, setLoading] = useState9(true);
968
+ const [error, setError] = useState9(null);
969
+ const fetchCoupons = useCallback10(async () => {
847
970
  if (!client.isAuthenticated()) {
848
971
  setCoupons([]);
849
972
  setLoading(false);
@@ -860,7 +983,7 @@ function useCoupons() {
860
983
  setLoading(false);
861
984
  }
862
985
  }, [client]);
863
- useEffect6(() => {
986
+ useEffect7(() => {
864
987
  fetchCoupons();
865
988
  }, [fetchCoupons]);
866
989
  return {
@@ -872,10 +995,10 @@ function useCoupons() {
872
995
  }
873
996
  function useValidateCoupon() {
874
997
  const client = useClient();
875
- const [validation, setValidation] = useState8(null);
876
- const [loading, setLoading] = useState8(false);
877
- const [error, setError] = useState8(null);
878
- const validate = useCallback9(async (code, orderAmount) => {
998
+ const [validation, setValidation] = useState9(null);
999
+ const [loading, setLoading] = useState9(false);
1000
+ const [error, setError] = useState9(null);
1001
+ const validate = useCallback10(async (code, orderAmount) => {
879
1002
  setLoading(true);
880
1003
  setError(null);
881
1004
  try {
@@ -891,7 +1014,7 @@ function useValidateCoupon() {
891
1014
  setLoading(false);
892
1015
  }
893
1016
  }, [client]);
894
- const reset = useCallback9(() => {
1017
+ const reset = useCallback10(() => {
895
1018
  setValidation(null);
896
1019
  setError(null);
897
1020
  }, []);
@@ -905,13 +1028,13 @@ function useValidateCoupon() {
905
1028
  }
906
1029
 
907
1030
  // src/hooks/useSubscriptions.ts
908
- import { useState as useState9, useEffect as useEffect7, useCallback as useCallback10 } from "react";
1031
+ import { useState as useState10, useEffect as useEffect8, useCallback as useCallback11 } from "react";
909
1032
  function useSubscriptions() {
910
1033
  const client = useClient();
911
- const [subscriptions, setSubscriptions] = useState9([]);
912
- const [loading, setLoading] = useState9(true);
913
- const [error, setError] = useState9(null);
914
- const fetchSubscriptions = useCallback10(async () => {
1034
+ const [subscriptions, setSubscriptions] = useState10([]);
1035
+ const [loading, setLoading] = useState10(true);
1036
+ const [error, setError] = useState10(null);
1037
+ const fetchSubscriptions = useCallback11(async () => {
915
1038
  if (!client.isAuthenticated()) {
916
1039
  setSubscriptions([]);
917
1040
  setLoading(false);
@@ -928,7 +1051,7 @@ function useSubscriptions() {
928
1051
  setLoading(false);
929
1052
  }
930
1053
  }, [client]);
931
- useEffect7(() => {
1054
+ useEffect8(() => {
932
1055
  fetchSubscriptions();
933
1056
  }, [fetchSubscriptions]);
934
1057
  const activeSubscription = subscriptions.find((s) => s.is_active) ?? null;
@@ -944,10 +1067,10 @@ function useSubscriptions() {
944
1067
  }
945
1068
  function useSubscription(id) {
946
1069
  const client = useClient();
947
- const [subscription, setSubscription] = useState9(null);
948
- const [loading, setLoading] = useState9(true);
949
- const [error, setError] = useState9(null);
950
- const fetchSubscription = useCallback10(async () => {
1070
+ const [subscription, setSubscription] = useState10(null);
1071
+ const [loading, setLoading] = useState10(true);
1072
+ const [error, setError] = useState10(null);
1073
+ const fetchSubscription = useCallback11(async () => {
951
1074
  setLoading(true);
952
1075
  setError(null);
953
1076
  try {
@@ -959,20 +1082,20 @@ function useSubscription(id) {
959
1082
  setLoading(false);
960
1083
  }
961
1084
  }, [client, id]);
962
- useEffect7(() => {
1085
+ useEffect8(() => {
963
1086
  fetchSubscription();
964
1087
  }, [fetchSubscription]);
965
- const cancel = useCallback10(async (immediately = false) => {
1088
+ const cancel = useCallback11(async (immediately = false) => {
966
1089
  const updated = await client.shop.cancelSubscription(id, immediately);
967
1090
  setSubscription(updated);
968
1091
  return updated;
969
1092
  }, [client, id]);
970
- const pause = useCallback10(async () => {
1093
+ const pause = useCallback11(async () => {
971
1094
  const updated = await client.shop.pauseSubscription(id);
972
1095
  setSubscription(updated);
973
1096
  return updated;
974
1097
  }, [client, id]);
975
- const resume = useCallback10(async () => {
1098
+ const resume = useCallback11(async () => {
976
1099
  const updated = await client.shop.resumeSubscription(id);
977
1100
  setSubscription(updated);
978
1101
  return updated;
@@ -989,9 +1112,9 @@ function useSubscription(id) {
989
1112
  }
990
1113
  function useCreateSubscription() {
991
1114
  const client = useClient();
992
- const [loading, setLoading] = useState9(false);
993
- const [error, setError] = useState9(null);
994
- const createCheckout = useCallback10(async (planId, successUrl, cancelUrl) => {
1115
+ const [loading, setLoading] = useState10(false);
1116
+ const [error, setError] = useState10(null);
1117
+ const createCheckout = useCallback11(async (planId, successUrl, cancelUrl) => {
995
1118
  setLoading(true);
996
1119
  setError(null);
997
1120
  try {
@@ -1008,7 +1131,7 @@ function useCreateSubscription() {
1008
1131
  setLoading(false);
1009
1132
  }
1010
1133
  }, [client]);
1011
- const verifyCheckout = useCallback10(async (sessionId) => {
1134
+ const verifyCheckout = useCallback11(async (sessionId) => {
1012
1135
  setLoading(true);
1013
1136
  setError(null);
1014
1137
  try {
@@ -1022,7 +1145,7 @@ function useCreateSubscription() {
1022
1145
  setLoading(false);
1023
1146
  }
1024
1147
  }, [client]);
1025
- const createSetupIntent = useCallback10(async () => {
1148
+ const createSetupIntent = useCallback11(async () => {
1026
1149
  setLoading(true);
1027
1150
  setError(null);
1028
1151
  try {
@@ -1046,13 +1169,13 @@ function useCreateSubscription() {
1046
1169
  }
1047
1170
 
1048
1171
  // src/hooks/useDownloads.ts
1049
- import { useState as useState10, useEffect as useEffect8, useCallback as useCallback11 } from "react";
1172
+ import { useState as useState11, useEffect as useEffect9, useCallback as useCallback12 } from "react";
1050
1173
  function useDownloads() {
1051
1174
  const client = useClient();
1052
- const [downloads, setDownloads] = useState10([]);
1053
- const [loading, setLoading] = useState10(true);
1054
- const [error, setError] = useState10(null);
1055
- const fetchDownloads = useCallback11(async () => {
1175
+ const [downloads, setDownloads] = useState11([]);
1176
+ const [loading, setLoading] = useState11(true);
1177
+ const [error, setError] = useState11(null);
1178
+ const fetchDownloads = useCallback12(async () => {
1056
1179
  if (!client.isAuthenticated()) {
1057
1180
  setDownloads([]);
1058
1181
  setLoading(false);
@@ -1069,13 +1192,13 @@ function useDownloads() {
1069
1192
  setLoading(false);
1070
1193
  }
1071
1194
  }, [client]);
1072
- useEffect8(() => {
1195
+ useEffect9(() => {
1073
1196
  fetchDownloads();
1074
1197
  }, [fetchDownloads]);
1075
- const getDownloadUrl = useCallback11((token) => {
1198
+ const getDownloadUrl = useCallback12((token) => {
1076
1199
  return client.shop.getDownloadUrl(token);
1077
1200
  }, [client]);
1078
- const getDownloadInfo = useCallback11(async (token) => {
1201
+ const getDownloadInfo = useCallback12(async (token) => {
1079
1202
  return await client.shop.getDownloadInfo(token);
1080
1203
  }, [client]);
1081
1204
  return {
@@ -1089,10 +1212,10 @@ function useDownloads() {
1089
1212
  }
1090
1213
  function useOrderDownloads(orderNumber) {
1091
1214
  const client = useClient();
1092
- const [downloads, setDownloads] = useState10([]);
1093
- const [loading, setLoading] = useState10(true);
1094
- const [error, setError] = useState10(null);
1095
- const fetchDownloads = useCallback11(async () => {
1215
+ const [downloads, setDownloads] = useState11([]);
1216
+ const [loading, setLoading] = useState11(true);
1217
+ const [error, setError] = useState11(null);
1218
+ const fetchDownloads = useCallback12(async () => {
1096
1219
  if (!client.isAuthenticated()) {
1097
1220
  setDownloads([]);
1098
1221
  setLoading(false);
@@ -1109,13 +1232,13 @@ function useOrderDownloads(orderNumber) {
1109
1232
  setLoading(false);
1110
1233
  }
1111
1234
  }, [client, orderNumber]);
1112
- useEffect8(() => {
1235
+ useEffect9(() => {
1113
1236
  fetchDownloads();
1114
1237
  }, [fetchDownloads]);
1115
- const getDownloadUrl = useCallback11((token) => {
1238
+ const getDownloadUrl = useCallback12((token) => {
1116
1239
  return client.shop.getDownloadUrl(token);
1117
1240
  }, [client]);
1118
- const getDownloadInfo = useCallback11(async (token) => {
1241
+ const getDownloadInfo = useCallback12(async (token) => {
1119
1242
  return await client.shop.getDownloadInfo(token);
1120
1243
  }, [client]);
1121
1244
  return {
@@ -1129,15 +1252,15 @@ function useOrderDownloads(orderNumber) {
1129
1252
  }
1130
1253
 
1131
1254
  // src/hooks/useReviews.ts
1132
- import { useState as useState11, useEffect as useEffect9, useCallback as useCallback12 } from "react";
1255
+ import { useState as useState12, useEffect as useEffect10, useCallback as useCallback13 } from "react";
1133
1256
  function useProductReviews(productSlug, params) {
1134
1257
  const client = useClient();
1135
- const [reviews, setReviews] = useState11([]);
1136
- const [stats, setStats] = useState11(null);
1137
- const [meta, setMeta] = useState11(null);
1138
- const [loading, setLoading] = useState11(true);
1139
- const [error, setError] = useState11(null);
1140
- const fetchReviews = useCallback12(async () => {
1258
+ const [reviews, setReviews] = useState12([]);
1259
+ const [stats, setStats] = useState12(null);
1260
+ const [meta, setMeta] = useState12(null);
1261
+ const [loading, setLoading] = useState12(true);
1262
+ const [error, setError] = useState12(null);
1263
+ const fetchReviews = useCallback13(async () => {
1141
1264
  setLoading(true);
1142
1265
  setError(null);
1143
1266
  try {
@@ -1151,7 +1274,7 @@ function useProductReviews(productSlug, params) {
1151
1274
  setLoading(false);
1152
1275
  }
1153
1276
  }, [client, productSlug, params]);
1154
- useEffect9(() => {
1277
+ useEffect10(() => {
1155
1278
  fetchReviews();
1156
1279
  }, [fetchReviews]);
1157
1280
  return {
@@ -1165,11 +1288,11 @@ function useProductReviews(productSlug, params) {
1165
1288
  }
1166
1289
  function useCanReview(productSlug) {
1167
1290
  const client = useClient();
1168
- const [canReview, setCanReview] = useState11(false);
1169
- const [reason, setReason] = useState11(null);
1170
- const [loading, setLoading] = useState11(true);
1171
- const [error, setError] = useState11(null);
1172
- const check = useCallback12(async () => {
1291
+ const [canReview, setCanReview] = useState12(false);
1292
+ const [reason, setReason] = useState12(null);
1293
+ const [loading, setLoading] = useState12(true);
1294
+ const [error, setError] = useState12(null);
1295
+ const check = useCallback13(async () => {
1173
1296
  setLoading(true);
1174
1297
  setError(null);
1175
1298
  try {
@@ -1184,7 +1307,7 @@ function useCanReview(productSlug) {
1184
1307
  setLoading(false);
1185
1308
  }
1186
1309
  }, [client, productSlug]);
1187
- useEffect9(() => {
1310
+ useEffect10(() => {
1188
1311
  if (client.isAuthenticated()) {
1189
1312
  check();
1190
1313
  } else {
@@ -1203,9 +1326,9 @@ function useCanReview(productSlug) {
1203
1326
  }
1204
1327
  function useCreateReview() {
1205
1328
  const client = useClient();
1206
- const [loading, setLoading] = useState11(false);
1207
- const [error, setError] = useState11(null);
1208
- const createReview = useCallback12(async (productSlug, data) => {
1329
+ const [loading, setLoading] = useState12(false);
1330
+ const [error, setError] = useState12(null);
1331
+ const createReview = useCallback13(async (productSlug, data) => {
1209
1332
  setLoading(true);
1210
1333
  setError(null);
1211
1334
  try {
@@ -1226,11 +1349,11 @@ function useCreateReview() {
1226
1349
  }
1227
1350
  function useMyReviews(params) {
1228
1351
  const client = useClient();
1229
- const [reviews, setReviews] = useState11([]);
1230
- const [meta, setMeta] = useState11(null);
1231
- const [loading, setLoading] = useState11(true);
1232
- const [error, setError] = useState11(null);
1233
- const fetchReviews = useCallback12(async () => {
1352
+ const [reviews, setReviews] = useState12([]);
1353
+ const [meta, setMeta] = useState12(null);
1354
+ const [loading, setLoading] = useState12(true);
1355
+ const [error, setError] = useState12(null);
1356
+ const fetchReviews = useCallback13(async () => {
1234
1357
  if (!client.isAuthenticated()) {
1235
1358
  setReviews([]);
1236
1359
  setLoading(false);
@@ -1248,14 +1371,14 @@ function useMyReviews(params) {
1248
1371
  setLoading(false);
1249
1372
  }
1250
1373
  }, [client, params]);
1251
- useEffect9(() => {
1374
+ useEffect10(() => {
1252
1375
  fetchReviews();
1253
1376
  }, [fetchReviews]);
1254
- const deleteReview = useCallback12(async (reviewId) => {
1377
+ const deleteReview = useCallback13(async (reviewId) => {
1255
1378
  await client.shop.deleteReview(reviewId);
1256
1379
  setReviews((prev) => prev.filter((r) => r.id !== reviewId));
1257
1380
  }, [client]);
1258
- const updateReview = useCallback12(async (reviewId, data) => {
1381
+ const updateReview = useCallback13(async (reviewId, data) => {
1259
1382
  const updated = await client.shop.updateReview(reviewId, data);
1260
1383
  setReviews((prev) => prev.map((r) => r.id === reviewId ? updated : r));
1261
1384
  return updated;
@@ -1272,16 +1395,16 @@ function useMyReviews(params) {
1272
1395
  }
1273
1396
 
1274
1397
  // src/hooks/useBlog.ts
1275
- import { useState as useState12, useEffect as useEffect10, useCallback as useCallback13 } from "react";
1398
+ import { useState as useState13, useEffect as useEffect11, useCallback as useCallback14 } from "react";
1276
1399
  function useBlog(options = {}) {
1277
1400
  const { autoFetch = true, ...params } = options;
1278
1401
  const client = useClient();
1279
- const [posts, setPosts] = useState12([]);
1280
- const [meta, setMeta] = useState12(null);
1281
- const [loading, setLoading] = useState12(autoFetch);
1282
- const [error, setError] = useState12(null);
1283
- const [currentParams, setCurrentParams] = useState12(params);
1284
- const fetchPosts = useCallback13(async (fetchParams, append = false) => {
1402
+ const [posts, setPosts] = useState13([]);
1403
+ const [meta, setMeta] = useState13(null);
1404
+ const [loading, setLoading] = useState13(autoFetch);
1405
+ const [error, setError] = useState13(null);
1406
+ const [currentParams, setCurrentParams] = useState13(params);
1407
+ const fetchPosts = useCallback14(async (fetchParams, append = false) => {
1285
1408
  setLoading(true);
1286
1409
  setError(null);
1287
1410
  try {
@@ -1298,18 +1421,18 @@ function useBlog(options = {}) {
1298
1421
  setLoading(false);
1299
1422
  }
1300
1423
  }, [client]);
1301
- useEffect10(() => {
1424
+ useEffect11(() => {
1302
1425
  if (autoFetch) {
1303
1426
  fetchPosts(params);
1304
1427
  }
1305
1428
  }, []);
1306
1429
  const hasMore = meta ? meta.current_page < meta.last_page : false;
1307
- const loadMore = useCallback13(async () => {
1430
+ const loadMore = useCallback14(async () => {
1308
1431
  if (!hasMore || loading) return;
1309
1432
  const nextPage = (meta?.current_page ?? 0) + 1;
1310
1433
  await fetchPosts({ ...currentParams, page: nextPage }, true);
1311
1434
  }, [hasMore, loading, meta, currentParams, fetchPosts]);
1312
- const refresh = useCallback13(async () => {
1435
+ const refresh = useCallback14(async () => {
1313
1436
  setCurrentParams(params);
1314
1437
  await fetchPosts(params);
1315
1438
  }, [params, fetchPosts]);
@@ -1325,10 +1448,10 @@ function useBlog(options = {}) {
1325
1448
  }
1326
1449
  function useBlogPost(slug) {
1327
1450
  const client = useClient();
1328
- const [post, setPost] = useState12(null);
1329
- const [loading, setLoading] = useState12(true);
1330
- const [error, setError] = useState12(null);
1331
- const fetchPost = useCallback13(async () => {
1451
+ const [post, setPost] = useState13(null);
1452
+ const [loading, setLoading] = useState13(true);
1453
+ const [error, setError] = useState13(null);
1454
+ const fetchPost = useCallback14(async () => {
1332
1455
  setLoading(true);
1333
1456
  setError(null);
1334
1457
  try {
@@ -1340,7 +1463,7 @@ function useBlogPost(slug) {
1340
1463
  setLoading(false);
1341
1464
  }
1342
1465
  }, [client, slug]);
1343
- useEffect10(() => {
1466
+ useEffect11(() => {
1344
1467
  fetchPost();
1345
1468
  }, [fetchPost]);
1346
1469
  return {
@@ -1352,10 +1475,10 @@ function useBlogPost(slug) {
1352
1475
  }
1353
1476
  function useBlogCategories() {
1354
1477
  const client = useClient();
1355
- const [categories, setCategories] = useState12([]);
1356
- const [loading, setLoading] = useState12(true);
1357
- const [error, setError] = useState12(null);
1358
- const fetchCategories = useCallback13(async () => {
1478
+ const [categories, setCategories] = useState13([]);
1479
+ const [loading, setLoading] = useState13(true);
1480
+ const [error, setError] = useState13(null);
1481
+ const fetchCategories = useCallback14(async () => {
1359
1482
  setLoading(true);
1360
1483
  setError(null);
1361
1484
  try {
@@ -1367,7 +1490,7 @@ function useBlogCategories() {
1367
1490
  setLoading(false);
1368
1491
  }
1369
1492
  }, [client]);
1370
- useEffect10(() => {
1493
+ useEffect11(() => {
1371
1494
  fetchCategories();
1372
1495
  }, [fetchCategories]);
1373
1496
  return {
@@ -1379,10 +1502,10 @@ function useBlogCategories() {
1379
1502
  }
1380
1503
  function useBlogTags() {
1381
1504
  const client = useClient();
1382
- const [tags, setTags] = useState12([]);
1383
- const [loading, setLoading] = useState12(true);
1384
- const [error, setError] = useState12(null);
1385
- const fetchTags = useCallback13(async () => {
1505
+ const [tags, setTags] = useState13([]);
1506
+ const [loading, setLoading] = useState13(true);
1507
+ const [error, setError] = useState13(null);
1508
+ const fetchTags = useCallback14(async () => {
1386
1509
  setLoading(true);
1387
1510
  setError(null);
1388
1511
  try {
@@ -1394,7 +1517,7 @@ function useBlogTags() {
1394
1517
  setLoading(false);
1395
1518
  }
1396
1519
  }, [client]);
1397
- useEffect10(() => {
1520
+ useEffect11(() => {
1398
1521
  fetchTags();
1399
1522
  }, [fetchTags]);
1400
1523
  return {
@@ -1406,10 +1529,10 @@ function useBlogTags() {
1406
1529
  }
1407
1530
  function useFeaturedBlog(limit = 5) {
1408
1531
  const client = useClient();
1409
- const [posts, setPosts] = useState12([]);
1410
- const [loading, setLoading] = useState12(true);
1411
- const [error, setError] = useState12(null);
1412
- const fetchPosts = useCallback13(async () => {
1532
+ const [posts, setPosts] = useState13([]);
1533
+ const [loading, setLoading] = useState13(true);
1534
+ const [error, setError] = useState13(null);
1535
+ const fetchPosts = useCallback14(async () => {
1413
1536
  setLoading(true);
1414
1537
  setError(null);
1415
1538
  try {
@@ -1421,7 +1544,7 @@ function useFeaturedBlog(limit = 5) {
1421
1544
  setLoading(false);
1422
1545
  }
1423
1546
  }, [client, limit]);
1424
- useEffect10(() => {
1547
+ useEffect11(() => {
1425
1548
  fetchPosts();
1426
1549
  }, [fetchPosts]);
1427
1550
  return {
@@ -1433,11 +1556,11 @@ function useFeaturedBlog(limit = 5) {
1433
1556
  }
1434
1557
  function useBlogSearch() {
1435
1558
  const client = useClient();
1436
- const [posts, setPosts] = useState12([]);
1437
- const [meta, setMeta] = useState12(null);
1438
- const [loading, setLoading] = useState12(false);
1439
- const [error, setError] = useState12(null);
1440
- const search = useCallback13(async (query) => {
1559
+ const [posts, setPosts] = useState13([]);
1560
+ const [meta, setMeta] = useState13(null);
1561
+ const [loading, setLoading] = useState13(false);
1562
+ const [error, setError] = useState13(null);
1563
+ const search = useCallback14(async (query) => {
1441
1564
  setLoading(true);
1442
1565
  setError(null);
1443
1566
  try {
@@ -1460,13 +1583,13 @@ function useBlogSearch() {
1460
1583
  }
1461
1584
 
1462
1585
  // src/hooks/useBoards.ts
1463
- import { useState as useState13, useEffect as useEffect11, useCallback as useCallback14 } from "react";
1586
+ import { useState as useState14, useEffect as useEffect12, useCallback as useCallback15 } from "react";
1464
1587
  function useBoards(params) {
1465
1588
  const client = useClient();
1466
- const [boards, setBoards] = useState13([]);
1467
- const [loading, setLoading] = useState13(true);
1468
- const [error, setError] = useState13(null);
1469
- const fetchBoards = useCallback14(async () => {
1589
+ const [boards, setBoards] = useState14([]);
1590
+ const [loading, setLoading] = useState14(true);
1591
+ const [error, setError] = useState14(null);
1592
+ const fetchBoards = useCallback15(async () => {
1470
1593
  setLoading(true);
1471
1594
  setError(null);
1472
1595
  try {
@@ -1478,7 +1601,7 @@ function useBoards(params) {
1478
1601
  setLoading(false);
1479
1602
  }
1480
1603
  }, [client, params]);
1481
- useEffect11(() => {
1604
+ useEffect12(() => {
1482
1605
  fetchBoards();
1483
1606
  }, [fetchBoards]);
1484
1607
  return {
@@ -1490,10 +1613,10 @@ function useBoards(params) {
1490
1613
  }
1491
1614
  function useBoard(slug) {
1492
1615
  const client = useClient();
1493
- const [board, setBoard] = useState13(null);
1494
- const [loading, setLoading] = useState13(true);
1495
- const [error, setError] = useState13(null);
1496
- const fetchBoard = useCallback14(async () => {
1616
+ const [board, setBoard] = useState14(null);
1617
+ const [loading, setLoading] = useState14(true);
1618
+ const [error, setError] = useState14(null);
1619
+ const fetchBoard = useCallback15(async () => {
1497
1620
  setLoading(true);
1498
1621
  setError(null);
1499
1622
  try {
@@ -1505,7 +1628,7 @@ function useBoard(slug) {
1505
1628
  setLoading(false);
1506
1629
  }
1507
1630
  }, [client, slug]);
1508
- useEffect11(() => {
1631
+ useEffect12(() => {
1509
1632
  fetchBoard();
1510
1633
  }, [fetchBoard]);
1511
1634
  return {
@@ -1517,12 +1640,12 @@ function useBoard(slug) {
1517
1640
  }
1518
1641
  function useBoardPosts(boardSlug, params) {
1519
1642
  const client = useClient();
1520
- const [posts, setPosts] = useState13([]);
1521
- const [meta, setMeta] = useState13(null);
1522
- const [loading, setLoading] = useState13(true);
1523
- const [error, setError] = useState13(null);
1524
- const [currentParams, setCurrentParams] = useState13(params);
1525
- const fetchPosts = useCallback14(async (fetchParams, append = false) => {
1643
+ const [posts, setPosts] = useState14([]);
1644
+ const [meta, setMeta] = useState14(null);
1645
+ const [loading, setLoading] = useState14(true);
1646
+ const [error, setError] = useState14(null);
1647
+ const [currentParams, setCurrentParams] = useState14(params);
1648
+ const fetchPosts = useCallback15(async (fetchParams, append = false) => {
1526
1649
  setLoading(true);
1527
1650
  setError(null);
1528
1651
  try {
@@ -1539,16 +1662,16 @@ function useBoardPosts(boardSlug, params) {
1539
1662
  setLoading(false);
1540
1663
  }
1541
1664
  }, [client, boardSlug]);
1542
- useEffect11(() => {
1665
+ useEffect12(() => {
1543
1666
  fetchPosts(params);
1544
1667
  }, []);
1545
1668
  const hasMore = meta ? meta.current_page < meta.last_page : false;
1546
- const loadMore = useCallback14(async () => {
1669
+ const loadMore = useCallback15(async () => {
1547
1670
  if (!hasMore || loading) return;
1548
1671
  const nextPage = (meta?.current_page ?? 0) + 1;
1549
1672
  await fetchPosts({ ...currentParams, page: nextPage }, true);
1550
1673
  }, [hasMore, loading, meta, currentParams, fetchPosts]);
1551
- const refresh = useCallback14(async () => {
1674
+ const refresh = useCallback15(async () => {
1552
1675
  setCurrentParams(params);
1553
1676
  await fetchPosts(params);
1554
1677
  }, [params, fetchPosts]);
@@ -1564,10 +1687,10 @@ function useBoardPosts(boardSlug, params) {
1564
1687
  }
1565
1688
  function useBoardPost(postId) {
1566
1689
  const client = useClient();
1567
- const [post, setPost] = useState13(null);
1568
- const [loading, setLoading] = useState13(true);
1569
- const [error, setError] = useState13(null);
1570
- const fetchPost = useCallback14(async () => {
1690
+ const [post, setPost] = useState14(null);
1691
+ const [loading, setLoading] = useState14(true);
1692
+ const [error, setError] = useState14(null);
1693
+ const fetchPost = useCallback15(async () => {
1571
1694
  setLoading(true);
1572
1695
  setError(null);
1573
1696
  try {
@@ -1579,7 +1702,7 @@ function useBoardPost(postId) {
1579
1702
  setLoading(false);
1580
1703
  }
1581
1704
  }, [client, postId]);
1582
- useEffect11(() => {
1705
+ useEffect12(() => {
1583
1706
  fetchPost();
1584
1707
  }, [fetchPost]);
1585
1708
  return {
@@ -1591,9 +1714,9 @@ function useBoardPost(postId) {
1591
1714
  }
1592
1715
  function useCreateBoardPost() {
1593
1716
  const client = useClient();
1594
- const [loading, setLoading] = useState13(false);
1595
- const [error, setError] = useState13(null);
1596
- const createPost = useCallback14(async (data) => {
1717
+ const [loading, setLoading] = useState14(false);
1718
+ const [error, setError] = useState14(null);
1719
+ const createPost = useCallback15(async (data) => {
1597
1720
  setLoading(true);
1598
1721
  setError(null);
1599
1722
  try {
@@ -1614,15 +1737,15 @@ function useCreateBoardPost() {
1614
1737
  }
1615
1738
 
1616
1739
  // src/hooks/useComments.ts
1617
- import { useState as useState14, useEffect as useEffect12, useCallback as useCallback15 } from "react";
1740
+ import { useState as useState15, useEffect as useEffect13, useCallback as useCallback16 } from "react";
1618
1741
  function useComments(options) {
1619
1742
  const { type, target, page, per_page } = options;
1620
1743
  const client = useClient();
1621
- const [comments, setComments] = useState14([]);
1622
- const [meta, setMeta] = useState14(null);
1623
- const [loading, setLoading] = useState14(true);
1624
- const [error, setError] = useState14(null);
1625
- const fetchComments = useCallback15(async () => {
1744
+ const [comments, setComments] = useState15([]);
1745
+ const [meta, setMeta] = useState15(null);
1746
+ const [loading, setLoading] = useState15(true);
1747
+ const [error, setError] = useState15(null);
1748
+ const fetchComments = useCallback16(async () => {
1626
1749
  setLoading(true);
1627
1750
  setError(null);
1628
1751
  try {
@@ -1647,10 +1770,10 @@ function useComments(options) {
1647
1770
  setLoading(false);
1648
1771
  }
1649
1772
  }, [client, type, target, page, per_page]);
1650
- useEffect12(() => {
1773
+ useEffect13(() => {
1651
1774
  fetchComments();
1652
1775
  }, [fetchComments]);
1653
- const createComment = useCallback15(async (data) => {
1776
+ const createComment = useCallback16(async (data) => {
1654
1777
  let response;
1655
1778
  switch (type) {
1656
1779
  case "board":
@@ -1666,16 +1789,16 @@ function useComments(options) {
1666
1789
  await fetchComments();
1667
1790
  return response.data;
1668
1791
  }, [client, type, target, fetchComments]);
1669
- const updateComment = useCallback15(async (commentId, content) => {
1792
+ const updateComment = useCallback16(async (commentId, content) => {
1670
1793
  const response = await client.comments.update(commentId, { content });
1671
1794
  setComments((prev) => prev.map((c) => c.id === commentId ? response.data : c));
1672
1795
  return response.data;
1673
1796
  }, [client]);
1674
- const deleteComment = useCallback15(async (commentId, password) => {
1797
+ const deleteComment = useCallback16(async (commentId, password) => {
1675
1798
  await client.comments.delete(commentId, password ? { password } : void 0);
1676
1799
  setComments((prev) => prev.filter((c) => c.id !== commentId));
1677
1800
  }, [client]);
1678
- const likeComment = useCallback15(async (commentId) => {
1801
+ const likeComment = useCallback16(async (commentId) => {
1679
1802
  const response = await client.comments.like(commentId);
1680
1803
  setComments((prev) => prev.map(
1681
1804
  (c) => c.id === commentId ? { ...c, likes: response.data.likes } : c
@@ -1696,15 +1819,15 @@ function useComments(options) {
1696
1819
  }
1697
1820
 
1698
1821
  // src/hooks/useForms.ts
1699
- import { useState as useState15, useEffect as useEffect13, useCallback as useCallback16 } from "react";
1822
+ import { useState as useState16, useEffect as useEffect14, useCallback as useCallback17 } from "react";
1700
1823
  function useForm(formSlug) {
1701
1824
  const client = useClient();
1702
- const [form, setForm] = useState15(null);
1703
- const [loading, setLoading] = useState15(true);
1704
- const [error, setError] = useState15(null);
1705
- const [submitting, setSubmitting] = useState15(false);
1706
- const [submitted, setSubmitted] = useState15(false);
1707
- const fetchForm = useCallback16(async () => {
1825
+ const [form, setForm] = useState16(null);
1826
+ const [loading, setLoading] = useState16(true);
1827
+ const [error, setError] = useState16(null);
1828
+ const [submitting, setSubmitting] = useState16(false);
1829
+ const [submitted, setSubmitted] = useState16(false);
1830
+ const fetchForm = useCallback17(async () => {
1708
1831
  setLoading(true);
1709
1832
  setError(null);
1710
1833
  try {
@@ -1716,10 +1839,10 @@ function useForm(formSlug) {
1716
1839
  setLoading(false);
1717
1840
  }
1718
1841
  }, [client, formSlug]);
1719
- useEffect13(() => {
1842
+ useEffect14(() => {
1720
1843
  fetchForm();
1721
1844
  }, [fetchForm]);
1722
- const submit = useCallback16(async (data) => {
1845
+ const submit = useCallback17(async (data) => {
1723
1846
  setSubmitting(true);
1724
1847
  setError(null);
1725
1848
  try {
@@ -1734,7 +1857,7 @@ function useForm(formSlug) {
1734
1857
  setSubmitting(false);
1735
1858
  }
1736
1859
  }, [client, formSlug]);
1737
- const reset = useCallback16(() => {
1860
+ const reset = useCallback17(() => {
1738
1861
  setSubmitted(false);
1739
1862
  setError(null);
1740
1863
  }, []);
@@ -1750,13 +1873,13 @@ function useForm(formSlug) {
1750
1873
  }
1751
1874
 
1752
1875
  // src/hooks/useReservation.ts
1753
- import { useState as useState16, useEffect as useEffect14, useCallback as useCallback17 } from "react";
1876
+ import { useState as useState17, useEffect as useEffect15, useCallback as useCallback18 } from "react";
1754
1877
  function useReservationServices() {
1755
1878
  const client = useClient();
1756
- const [services, setServices] = useState16([]);
1757
- const [loading, setLoading] = useState16(true);
1758
- const [error, setError] = useState16(null);
1759
- const fetchServices = useCallback17(async () => {
1879
+ const [services, setServices] = useState17([]);
1880
+ const [loading, setLoading] = useState17(true);
1881
+ const [error, setError] = useState17(null);
1882
+ const fetchServices = useCallback18(async () => {
1760
1883
  setLoading(true);
1761
1884
  setError(null);
1762
1885
  try {
@@ -1768,7 +1891,7 @@ function useReservationServices() {
1768
1891
  setLoading(false);
1769
1892
  }
1770
1893
  }, [client]);
1771
- useEffect14(() => {
1894
+ useEffect15(() => {
1772
1895
  fetchServices();
1773
1896
  }, [fetchServices]);
1774
1897
  return {
@@ -1780,10 +1903,10 @@ function useReservationServices() {
1780
1903
  }
1781
1904
  function useReservationStaffs() {
1782
1905
  const client = useClient();
1783
- const [staffs, setStaffs] = useState16([]);
1784
- const [loading, setLoading] = useState16(true);
1785
- const [error, setError] = useState16(null);
1786
- const fetchStaffs = useCallback17(async () => {
1906
+ const [staffs, setStaffs] = useState17([]);
1907
+ const [loading, setLoading] = useState17(true);
1908
+ const [error, setError] = useState17(null);
1909
+ const fetchStaffs = useCallback18(async () => {
1787
1910
  setLoading(true);
1788
1911
  setError(null);
1789
1912
  try {
@@ -1795,7 +1918,7 @@ function useReservationStaffs() {
1795
1918
  setLoading(false);
1796
1919
  }
1797
1920
  }, [client]);
1798
- useEffect14(() => {
1921
+ useEffect15(() => {
1799
1922
  fetchStaffs();
1800
1923
  }, [fetchStaffs]);
1801
1924
  return {
@@ -1807,10 +1930,10 @@ function useReservationStaffs() {
1807
1930
  }
1808
1931
  function useAvailableSlots(serviceId, date, staffId) {
1809
1932
  const client = useClient();
1810
- const [slots, setSlots] = useState16([]);
1811
- const [loading, setLoading] = useState16(true);
1812
- const [error, setError] = useState16(null);
1813
- const fetchSlots = useCallback17(async () => {
1933
+ const [slots, setSlots] = useState17([]);
1934
+ const [loading, setLoading] = useState17(true);
1935
+ const [error, setError] = useState17(null);
1936
+ const fetchSlots = useCallback18(async () => {
1814
1937
  if (!serviceId || !date) {
1815
1938
  setSlots([]);
1816
1939
  setLoading(false);
@@ -1831,7 +1954,7 @@ function useAvailableSlots(serviceId, date, staffId) {
1831
1954
  setLoading(false);
1832
1955
  }
1833
1956
  }, [client, serviceId, date, staffId]);
1834
- useEffect14(() => {
1957
+ useEffect15(() => {
1835
1958
  fetchSlots();
1836
1959
  }, [fetchSlots]);
1837
1960
  return {
@@ -1843,11 +1966,11 @@ function useAvailableSlots(serviceId, date, staffId) {
1843
1966
  }
1844
1967
  function useMyReservations(params) {
1845
1968
  const client = useClient();
1846
- const [reservations, setReservations] = useState16([]);
1847
- const [meta, setMeta] = useState16(null);
1848
- const [loading, setLoading] = useState16(true);
1849
- const [error, setError] = useState16(null);
1850
- const fetchReservations = useCallback17(async () => {
1969
+ const [reservations, setReservations] = useState17([]);
1970
+ const [meta, setMeta] = useState17(null);
1971
+ const [loading, setLoading] = useState17(true);
1972
+ const [error, setError] = useState17(null);
1973
+ const fetchReservations = useCallback18(async () => {
1851
1974
  if (!client.isAuthenticated()) {
1852
1975
  setReservations([]);
1853
1976
  setLoading(false);
@@ -1865,7 +1988,7 @@ function useMyReservations(params) {
1865
1988
  setLoading(false);
1866
1989
  }
1867
1990
  }, [client, params]);
1868
- useEffect14(() => {
1991
+ useEffect15(() => {
1869
1992
  fetchReservations();
1870
1993
  }, [fetchReservations]);
1871
1994
  return {
@@ -1878,9 +2001,9 @@ function useMyReservations(params) {
1878
2001
  }
1879
2002
  function useCreateReservation() {
1880
2003
  const client = useClient();
1881
- const [loading, setLoading] = useState16(false);
1882
- const [error, setError] = useState16(null);
1883
- const createReservation = useCallback17(async (data) => {
2004
+ const [loading, setLoading] = useState17(false);
2005
+ const [error, setError] = useState17(null);
2006
+ const createReservation = useCallback18(async (data) => {
1884
2007
  setLoading(true);
1885
2008
  setError(null);
1886
2009
  try {
@@ -1902,10 +2025,10 @@ function useCreateReservation() {
1902
2025
  }
1903
2026
  function useReservationSettings() {
1904
2027
  const client = useClient();
1905
- const [settings, setSettings] = useState16(null);
1906
- const [loading, setLoading] = useState16(true);
1907
- const [error, setError] = useState16(null);
1908
- const fetchSettings = useCallback17(async () => {
2028
+ const [settings, setSettings] = useState17(null);
2029
+ const [loading, setLoading] = useState17(true);
2030
+ const [error, setError] = useState17(null);
2031
+ const fetchSettings = useCallback18(async () => {
1909
2032
  setLoading(true);
1910
2033
  setError(null);
1911
2034
  try {
@@ -1917,7 +2040,7 @@ function useReservationSettings() {
1917
2040
  setLoading(false);
1918
2041
  }
1919
2042
  }, [client]);
1920
- useEffect14(() => {
2043
+ useEffect15(() => {
1921
2044
  fetchSettings();
1922
2045
  }, [fetchSettings]);
1923
2046
  return {
@@ -1929,17 +2052,17 @@ function useReservationSettings() {
1929
2052
  }
1930
2053
 
1931
2054
  // src/hooks/useMedia.ts
1932
- import { useState as useState17, useEffect as useEffect15, useCallback as useCallback18 } from "react";
2055
+ import { useState as useState18, useEffect as useEffect16, useCallback as useCallback19 } from "react";
1933
2056
  function useMedia(options = {}) {
1934
2057
  const { type, page, per_page, autoFetch = true } = options;
1935
2058
  const client = useClient();
1936
- const [files, setFiles] = useState17([]);
1937
- const [meta, setMeta] = useState17(null);
1938
- const [loading, setLoading] = useState17(autoFetch);
1939
- const [error, setError] = useState17(null);
1940
- const [uploading, setUploading] = useState17(false);
1941
- const [uploadProgress, setUploadProgress] = useState17(0);
1942
- const fetchMedia = useCallback18(async () => {
2059
+ const [files, setFiles] = useState18([]);
2060
+ const [meta, setMeta] = useState18(null);
2061
+ const [loading, setLoading] = useState18(autoFetch);
2062
+ const [error, setError] = useState18(null);
2063
+ const [uploading, setUploading] = useState18(false);
2064
+ const [uploadProgress, setUploadProgress] = useState18(0);
2065
+ const fetchMedia = useCallback19(async () => {
1943
2066
  if (!client.isAuthenticated()) {
1944
2067
  setFiles([]);
1945
2068
  setLoading(false);
@@ -1957,12 +2080,12 @@ function useMedia(options = {}) {
1957
2080
  setLoading(false);
1958
2081
  }
1959
2082
  }, [client, type, page, per_page]);
1960
- useEffect15(() => {
2083
+ useEffect16(() => {
1961
2084
  if (autoFetch) {
1962
2085
  fetchMedia();
1963
2086
  }
1964
2087
  }, [autoFetch, fetchMedia]);
1965
- const upload = useCallback18(async (file) => {
2088
+ const upload = useCallback19(async (file) => {
1966
2089
  setUploading(true);
1967
2090
  setUploadProgress(0);
1968
2091
  setError(null);
@@ -1979,7 +2102,7 @@ function useMedia(options = {}) {
1979
2102
  setUploading(false);
1980
2103
  }
1981
2104
  }, [client]);
1982
- const uploadMultiple = useCallback18(async (filesToUpload) => {
2105
+ const uploadMultiple = useCallback19(async (filesToUpload) => {
1983
2106
  setUploading(true);
1984
2107
  setUploadProgress(0);
1985
2108
  setError(null);
@@ -2000,7 +2123,7 @@ function useMedia(options = {}) {
2000
2123
  setUploading(false);
2001
2124
  }
2002
2125
  }, [client]);
2003
- const deleteFile = useCallback18(async (mediaId) => {
2126
+ const deleteFile = useCallback19(async (mediaId) => {
2004
2127
  await client.media.delete(mediaId);
2005
2128
  setFiles((prev) => prev.filter((f) => f.id !== mediaId));
2006
2129
  }, [client]);
@@ -2019,13 +2142,13 @@ function useMedia(options = {}) {
2019
2142
  }
2020
2143
 
2021
2144
  // src/hooks/useEntities.ts
2022
- import { useState as useState18, useEffect as useEffect16, useCallback as useCallback19, useMemo as useMemo3 } from "react";
2145
+ import { useState as useState19, useEffect as useEffect17, useCallback as useCallback20, useMemo as useMemo3 } from "react";
2023
2146
  function useEntities() {
2024
2147
  const client = useClient();
2025
- const [entities, setEntities] = useState18([]);
2026
- const [loading, setLoading] = useState18(true);
2027
- const [error, setError] = useState18(null);
2028
- const fetchEntities = useCallback19(async () => {
2148
+ const [entities, setEntities] = useState19([]);
2149
+ const [loading, setLoading] = useState19(true);
2150
+ const [error, setError] = useState19(null);
2151
+ const fetchEntities = useCallback20(async () => {
2029
2152
  setLoading(true);
2030
2153
  setError(null);
2031
2154
  try {
@@ -2037,7 +2160,7 @@ function useEntities() {
2037
2160
  setLoading(false);
2038
2161
  }
2039
2162
  }, [client]);
2040
- useEffect16(() => {
2163
+ useEffect17(() => {
2041
2164
  fetchEntities();
2042
2165
  }, [fetchEntities]);
2043
2166
  return {
@@ -2049,10 +2172,10 @@ function useEntities() {
2049
2172
  }
2050
2173
  function useEntity(slug) {
2051
2174
  const client = useClient();
2052
- const [entity, setEntity] = useState18(null);
2053
- const [loading, setLoading] = useState18(true);
2054
- const [error, setError] = useState18(null);
2055
- const fetchEntity = useCallback19(async () => {
2175
+ const [entity, setEntity] = useState19(null);
2176
+ const [loading, setLoading] = useState19(true);
2177
+ const [error, setError] = useState19(null);
2178
+ const fetchEntity = useCallback20(async () => {
2056
2179
  setLoading(true);
2057
2180
  setError(null);
2058
2181
  try {
@@ -2064,7 +2187,7 @@ function useEntity(slug) {
2064
2187
  setLoading(false);
2065
2188
  }
2066
2189
  }, [client, slug]);
2067
- useEffect16(() => {
2190
+ useEffect17(() => {
2068
2191
  fetchEntity();
2069
2192
  }, [fetchEntity]);
2070
2193
  return {
@@ -2076,12 +2199,12 @@ function useEntity(slug) {
2076
2199
  }
2077
2200
  function useEntityRecords(slug, params) {
2078
2201
  const client = useClient();
2079
- const [records, setRecords] = useState18([]);
2080
- const [meta, setMeta] = useState18(null);
2081
- const [loading, setLoading] = useState18(true);
2082
- const [error, setError] = useState18(null);
2083
- const [currentParams, setCurrentParams] = useState18(params);
2084
- const fetchRecords = useCallback19(async (fetchParams, append = false) => {
2202
+ const [records, setRecords] = useState19([]);
2203
+ const [meta, setMeta] = useState19(null);
2204
+ const [loading, setLoading] = useState19(true);
2205
+ const [error, setError] = useState19(null);
2206
+ const [currentParams, setCurrentParams] = useState19(params);
2207
+ const fetchRecords = useCallback20(async (fetchParams, append = false) => {
2085
2208
  setLoading(true);
2086
2209
  setError(null);
2087
2210
  try {
@@ -2098,30 +2221,30 @@ function useEntityRecords(slug, params) {
2098
2221
  setLoading(false);
2099
2222
  }
2100
2223
  }, [client, slug]);
2101
- useEffect16(() => {
2224
+ useEffect17(() => {
2102
2225
  fetchRecords(params);
2103
2226
  }, []);
2104
2227
  const hasMore = meta ? meta.current_page < meta.last_page : false;
2105
- const loadMore = useCallback19(async () => {
2228
+ const loadMore = useCallback20(async () => {
2106
2229
  if (!hasMore || loading) return;
2107
2230
  const nextPage = (meta?.current_page ?? 0) + 1;
2108
2231
  await fetchRecords({ ...currentParams, page: nextPage }, true);
2109
2232
  }, [hasMore, loading, meta, currentParams, fetchRecords]);
2110
- const createRecord = useCallback19(async (data) => {
2233
+ const createRecord = useCallback20(async (data) => {
2111
2234
  const record = await client.entities.createRecord(slug, data);
2112
2235
  setRecords((prev) => [record, ...prev]);
2113
2236
  return record;
2114
2237
  }, [client, slug]);
2115
- const updateRecord = useCallback19(async (id, data) => {
2238
+ const updateRecord = useCallback20(async (id, data) => {
2116
2239
  const record = await client.entities.updateRecord(slug, id, data);
2117
2240
  setRecords((prev) => prev.map((r) => r.id === id ? record : r));
2118
2241
  return record;
2119
2242
  }, [client, slug]);
2120
- const deleteRecord = useCallback19(async (id) => {
2243
+ const deleteRecord = useCallback20(async (id) => {
2121
2244
  await client.entities.deleteRecord(slug, id);
2122
2245
  setRecords((prev) => prev.filter((r) => r.id !== id));
2123
2246
  }, [client, slug]);
2124
- const refresh = useCallback19(async () => {
2247
+ const refresh = useCallback20(async () => {
2125
2248
  setCurrentParams(params);
2126
2249
  await fetchRecords(params);
2127
2250
  }, [params, fetchRecords]);
@@ -2140,10 +2263,10 @@ function useEntityRecords(slug, params) {
2140
2263
  }
2141
2264
  function useEntityRecord(slug, id) {
2142
2265
  const client = useClient();
2143
- const [record, setRecord] = useState18(null);
2144
- const [loading, setLoading] = useState18(true);
2145
- const [error, setError] = useState18(null);
2146
- const fetchRecord = useCallback19(async () => {
2266
+ const [record, setRecord] = useState19(null);
2267
+ const [loading, setLoading] = useState19(true);
2268
+ const [error, setError] = useState19(null);
2269
+ const fetchRecord = useCallback20(async () => {
2147
2270
  setLoading(true);
2148
2271
  setError(null);
2149
2272
  try {
@@ -2155,10 +2278,10 @@ function useEntityRecord(slug, id) {
2155
2278
  setLoading(false);
2156
2279
  }
2157
2280
  }, [client, slug, id]);
2158
- useEffect16(() => {
2281
+ useEffect17(() => {
2159
2282
  fetchRecord();
2160
2283
  }, [fetchRecord]);
2161
- const update = useCallback19(async (data) => {
2284
+ const update = useCallback20(async (data) => {
2162
2285
  const updated = await client.entities.updateRecord(slug, id, data);
2163
2286
  setRecord(updated);
2164
2287
  return updated;
@@ -2226,6 +2349,7 @@ export {
2226
2349
  useCreateReservation,
2227
2350
  useCreateReview,
2228
2351
  useCreateSubscription,
2352
+ useCurrency,
2229
2353
  useDiffsome,
2230
2354
  useDigitalProducts,
2231
2355
  useDownloads,
@@ -2250,6 +2374,7 @@ export {
2250
2374
  useReservationServices,
2251
2375
  useReservationSettings,
2252
2376
  useReservationStaffs,
2377
+ useSite,
2253
2378
  useSocialAuth,
2254
2379
  useStripePayment,
2255
2380
  useSubscription,