@23blocks/react 7.5.8 → 7.5.10

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/README.md CHANGED
@@ -224,6 +224,7 @@ export function ProductList() {
224
224
  |------|-------------|
225
225
  | `useSearch()` | Search with state management |
226
226
  | `useFavorites()` | Favorites management |
227
+ | `useContentSeries()` | Content series management |
227
228
  | `useUsers()` | User management (admin) |
228
229
  | `useMfa()` | Multi-factor authentication |
229
230
  | `useOAuth()` | OAuth operations |
@@ -449,6 +450,194 @@ export function FavoriteButton({ itemId, itemType }: Props) {
449
450
  }
450
451
  ```
451
452
 
453
+ ### useContentSeries
454
+
455
+ Manage content series (collections of ordered posts like tutorials or courses).
456
+
457
+ ```tsx
458
+ 'use client';
459
+
460
+ import { useContentSeries } from '@23blocks/react';
461
+ import { useEffect } from 'react';
462
+
463
+ export function SeriesList() {
464
+ const {
465
+ series,
466
+ totalRecords,
467
+ isLoading,
468
+ error,
469
+ listSeries,
470
+ createSeries,
471
+ likeSeries,
472
+ } = useContentSeries();
473
+
474
+ useEffect(() => {
475
+ listSeries({ page: 1, perPage: 10 });
476
+ }, [listSeries]);
477
+
478
+ if (isLoading) return <div>Loading...</div>;
479
+ if (error) return <div>Error: {error.message}</div>;
480
+
481
+ return (
482
+ <div>
483
+ <p>Total: {totalRecords} series</p>
484
+ <ul>
485
+ {series.map((s) => (
486
+ <li key={s.uniqueId}>
487
+ <h3>{s.title}</h3>
488
+ <p>{s.description}</p>
489
+ <span>Posts: {s.postsCount} | Likes: {s.likes}</span>
490
+ <button onClick={() => likeSeries(s.uniqueId)}>Like</button>
491
+ </li>
492
+ ))}
493
+ </ul>
494
+ </div>
495
+ );
496
+ }
497
+ ```
498
+
499
+ #### Create a Series
500
+
501
+ ```tsx
502
+ 'use client';
503
+
504
+ import { useContentSeries } from '@23blocks/react';
505
+
506
+ export function CreateSeriesForm() {
507
+ const { createSeries, isLoading, error } = useContentSeries();
508
+
509
+ const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
510
+ e.preventDefault();
511
+ const formData = new FormData(e.currentTarget);
512
+
513
+ const newSeries = await createSeries({
514
+ title: formData.get('title') as string,
515
+ description: formData.get('description') as string,
516
+ visibility: 'public',
517
+ completionStatus: 'ongoing',
518
+ });
519
+
520
+ console.log('Created series:', newSeries.uniqueId);
521
+ };
522
+
523
+ return (
524
+ <form onSubmit={handleSubmit}>
525
+ <input name="title" placeholder="Series Title" required />
526
+ <textarea name="description" placeholder="Description" />
527
+ <button type="submit" disabled={isLoading}>
528
+ {isLoading ? 'Creating...' : 'Create Series'}
529
+ </button>
530
+ {error && <p>Error: {error.message}</p>}
531
+ </form>
532
+ );
533
+ }
534
+ ```
535
+
536
+ #### Manage Series Posts
537
+
538
+ ```tsx
539
+ 'use client';
540
+
541
+ import { useContentSeries } from '@23blocks/react';
542
+ import { useEffect } from 'react';
543
+
544
+ export function SeriesPostManager({ seriesId }: { seriesId: string }) {
545
+ const {
546
+ posts,
547
+ currentSeries,
548
+ getSeries,
549
+ getSeriesPosts,
550
+ addSeriesPost,
551
+ removeSeriesPost,
552
+ reorderSeriesPosts,
553
+ isLoading,
554
+ } = useContentSeries();
555
+
556
+ useEffect(() => {
557
+ getSeries(seriesId);
558
+ getSeriesPosts(seriesId);
559
+ }, [seriesId, getSeries, getSeriesPosts]);
560
+
561
+ const handleAddPost = async (postId: string) => {
562
+ await addSeriesPost(seriesId, postId);
563
+ await getSeriesPosts(seriesId); // Refresh
564
+ };
565
+
566
+ const handleRemovePost = async (postId: string) => {
567
+ await removeSeriesPost(seriesId, postId);
568
+ };
569
+
570
+ const handleReorder = async () => {
571
+ await reorderSeriesPosts(seriesId, {
572
+ posts: posts.map((p, idx) => ({
573
+ postUniqueId: p.uniqueId,
574
+ sequence: idx + 1,
575
+ })),
576
+ });
577
+ };
578
+
579
+ return (
580
+ <div>
581
+ <h2>{currentSeries?.title}</h2>
582
+ <p>{posts.length} posts in this series</p>
583
+ <ul>
584
+ {posts.map((post, idx) => (
585
+ <li key={post.uniqueId}>
586
+ {idx + 1}. {post.title}
587
+ <button onClick={() => handleRemovePost(post.uniqueId)}>
588
+ Remove
589
+ </button>
590
+ </li>
591
+ ))}
592
+ </ul>
593
+ <button onClick={handleReorder} disabled={isLoading}>
594
+ Save Order
595
+ </button>
596
+ </div>
597
+ );
598
+ }
599
+ ```
600
+
601
+ #### useContentSeries Return Type
602
+
603
+ ```typescript
604
+ interface UseContentSeriesReturn {
605
+ // State
606
+ series: Series[]; // List of series
607
+ currentSeries: Series | null; // Currently loaded series
608
+ posts: Post[]; // Posts in current series
609
+ totalRecords: number; // Total series count
610
+ isLoading: boolean; // Loading state
611
+ error: Error | null; // Error state
612
+
613
+ // CRUD Operations
614
+ listSeries(params?: ListSeriesParams): Promise<PageResult<Series>>;
615
+ querySeries(params: QuerySeriesParams): Promise<PageResult<Series>>;
616
+ getSeries(uniqueId: string): Promise<Series>;
617
+ createSeries(data: CreateSeriesRequest): Promise<Series>;
618
+ updateSeries(uniqueId: string, data: UpdateSeriesRequest): Promise<Series>;
619
+ deleteSeries(uniqueId: string): Promise<void>;
620
+
621
+ // Social Actions
622
+ likeSeries(uniqueId: string): Promise<Series>;
623
+ dislikeSeries(uniqueId: string): Promise<Series>;
624
+ followSeries(uniqueId: string): Promise<Series>;
625
+ unfollowSeries(uniqueId: string): Promise<void>;
626
+ saveSeries(uniqueId: string): Promise<Series>;
627
+ unsaveSeries(uniqueId: string): Promise<void>;
628
+
629
+ // Post Management
630
+ getSeriesPosts(uniqueId: string): Promise<Post[]>;
631
+ addSeriesPost(seriesId: string, postId: string, sequence?: number): Promise<void>;
632
+ removeSeriesPost(seriesId: string, postId: string): Promise<void>;
633
+ reorderSeriesPosts(uniqueId: string, data: ReorderPostsRequest): Promise<Series>;
634
+
635
+ // State Management
636
+ clearSeries(): void;
637
+ clearError(): void;
638
+ }
639
+ ```
640
+
452
641
  ## Server-Side Rendering (SSR)
453
642
 
454
643
  ### Handling Client-Only Code
package/dist/index.esm.js CHANGED
@@ -2417,4 +2417,389 @@ function useUniversityBlock() {
2417
2417
  };
2418
2418
  }
2419
2419
 
2420
- export { Blocks23Provider, Provider, SimpleBlocks23Provider, use23Blocks, useAssetsBlock, useAuth, useAuthenticationBlock, useAvatars, useCampaignsBlock, useClient, useCompanyBlock, useContentBlock, useConversationsBlock, useCrmBlock, useFavorites, useFilesBlock, useFormsBlock, useGeolocationBlock, useJarvisBlock, useMfa, useOAuth, useOnboardingBlock, useProductsBlock, useRewardsBlock, useSalesBlock, useSearch, useSearchBlock, useSimpleAuth, useSimpleBlocks23, useTenants, useUniversityBlock, useUser, useUsers, useWalletBlock };
2420
+ // ─────────────────────────────────────────────────────────────────────────────
2421
+ // Hook
2422
+ // ─────────────────────────────────────────────────────────────────────────────
2423
+ /**
2424
+ * Hook for content series operations with state management.
2425
+ *
2426
+ * @example
2427
+ * ```tsx
2428
+ * function SeriesPage() {
2429
+ * const { series, listSeries, isLoading } = useContentSeries();
2430
+ *
2431
+ * useEffect(() => {
2432
+ * listSeries({ page: 1, perPage: 10 });
2433
+ * }, [listSeries]);
2434
+ *
2435
+ * if (isLoading) return <div>Loading...</div>;
2436
+ *
2437
+ * return (
2438
+ * <ul>
2439
+ * {series.map(s => (
2440
+ * <li key={s.uniqueId}>{s.title}</li>
2441
+ * ))}
2442
+ * </ul>
2443
+ * );
2444
+ * }
2445
+ * ```
2446
+ */ function useContentSeries() {
2447
+ const block = useContentBlock();
2448
+ const [series, setSeries] = useState([]);
2449
+ const [currentSeries, setCurrentSeries] = useState(null);
2450
+ const [posts, setPosts] = useState([]);
2451
+ const [totalRecords, setTotalRecords] = useState(0);
2452
+ const [isLoading, setIsLoading] = useState(false);
2453
+ const [error, setError] = useState(null);
2454
+ // ─────────────────────────────────────────────────────────────────────────
2455
+ // CRUD Operations
2456
+ // ─────────────────────────────────────────────────────────────────────────
2457
+ const listSeries = useCallback(async (params)=>{
2458
+ setIsLoading(true);
2459
+ setError(null);
2460
+ try {
2461
+ const response = await block.series.list(params);
2462
+ setSeries(response.data);
2463
+ setTotalRecords(response.meta.totalRecords);
2464
+ return response;
2465
+ } catch (err) {
2466
+ const error = err instanceof Error ? err : new Error(String(err));
2467
+ setError(error);
2468
+ throw error;
2469
+ } finally{
2470
+ setIsLoading(false);
2471
+ }
2472
+ }, [
2473
+ block.series
2474
+ ]);
2475
+ const querySeries = useCallback(async (params)=>{
2476
+ setIsLoading(true);
2477
+ setError(null);
2478
+ try {
2479
+ const response = await block.series.query(params);
2480
+ setSeries(response.data);
2481
+ setTotalRecords(response.meta.totalRecords);
2482
+ return response;
2483
+ } catch (err) {
2484
+ const error = err instanceof Error ? err : new Error(String(err));
2485
+ setError(error);
2486
+ throw error;
2487
+ } finally{
2488
+ setIsLoading(false);
2489
+ }
2490
+ }, [
2491
+ block.series
2492
+ ]);
2493
+ const getSeries = useCallback(async (uniqueId)=>{
2494
+ setIsLoading(true);
2495
+ setError(null);
2496
+ try {
2497
+ const result = await block.series.get(uniqueId);
2498
+ setCurrentSeries(result);
2499
+ return result;
2500
+ } catch (err) {
2501
+ const error = err instanceof Error ? err : new Error(String(err));
2502
+ setError(error);
2503
+ throw error;
2504
+ } finally{
2505
+ setIsLoading(false);
2506
+ }
2507
+ }, [
2508
+ block.series
2509
+ ]);
2510
+ const createSeries = useCallback(async (data)=>{
2511
+ setIsLoading(true);
2512
+ setError(null);
2513
+ try {
2514
+ const result = await block.series.create(data);
2515
+ setSeries((prev)=>[
2516
+ ...prev,
2517
+ result
2518
+ ]);
2519
+ return result;
2520
+ } catch (err) {
2521
+ const error = err instanceof Error ? err : new Error(String(err));
2522
+ setError(error);
2523
+ throw error;
2524
+ } finally{
2525
+ setIsLoading(false);
2526
+ }
2527
+ }, [
2528
+ block.series
2529
+ ]);
2530
+ const updateSeries = useCallback(async (uniqueId, data)=>{
2531
+ setIsLoading(true);
2532
+ setError(null);
2533
+ try {
2534
+ const result = await block.series.update(uniqueId, data);
2535
+ setSeries((prev)=>prev.map((s)=>s.uniqueId === uniqueId ? result : s));
2536
+ if ((currentSeries == null ? void 0 : currentSeries.uniqueId) === uniqueId) {
2537
+ setCurrentSeries(result);
2538
+ }
2539
+ return result;
2540
+ } catch (err) {
2541
+ const error = err instanceof Error ? err : new Error(String(err));
2542
+ setError(error);
2543
+ throw error;
2544
+ } finally{
2545
+ setIsLoading(false);
2546
+ }
2547
+ }, [
2548
+ block.series,
2549
+ currentSeries == null ? void 0 : currentSeries.uniqueId
2550
+ ]);
2551
+ const deleteSeries = useCallback(async (uniqueId)=>{
2552
+ setIsLoading(true);
2553
+ setError(null);
2554
+ try {
2555
+ await block.series.delete(uniqueId);
2556
+ setSeries((prev)=>prev.filter((s)=>s.uniqueId !== uniqueId));
2557
+ if ((currentSeries == null ? void 0 : currentSeries.uniqueId) === uniqueId) {
2558
+ setCurrentSeries(null);
2559
+ }
2560
+ } catch (err) {
2561
+ const error = err instanceof Error ? err : new Error(String(err));
2562
+ setError(error);
2563
+ throw error;
2564
+ } finally{
2565
+ setIsLoading(false);
2566
+ }
2567
+ }, [
2568
+ block.series,
2569
+ currentSeries == null ? void 0 : currentSeries.uniqueId
2570
+ ]);
2571
+ // ─────────────────────────────────────────────────────────────────────────
2572
+ // Social Actions
2573
+ // ─────────────────────────────────────────────────────────────────────────
2574
+ const likeSeries = useCallback(async (uniqueId)=>{
2575
+ setIsLoading(true);
2576
+ setError(null);
2577
+ try {
2578
+ const result = await block.series.like(uniqueId);
2579
+ setSeries((prev)=>prev.map((s)=>s.uniqueId === uniqueId ? result : s));
2580
+ if ((currentSeries == null ? void 0 : currentSeries.uniqueId) === uniqueId) {
2581
+ setCurrentSeries(result);
2582
+ }
2583
+ return result;
2584
+ } catch (err) {
2585
+ const error = err instanceof Error ? err : new Error(String(err));
2586
+ setError(error);
2587
+ throw error;
2588
+ } finally{
2589
+ setIsLoading(false);
2590
+ }
2591
+ }, [
2592
+ block.series,
2593
+ currentSeries == null ? void 0 : currentSeries.uniqueId
2594
+ ]);
2595
+ const dislikeSeries = useCallback(async (uniqueId)=>{
2596
+ setIsLoading(true);
2597
+ setError(null);
2598
+ try {
2599
+ const result = await block.series.dislike(uniqueId);
2600
+ setSeries((prev)=>prev.map((s)=>s.uniqueId === uniqueId ? result : s));
2601
+ if ((currentSeries == null ? void 0 : currentSeries.uniqueId) === uniqueId) {
2602
+ setCurrentSeries(result);
2603
+ }
2604
+ return result;
2605
+ } catch (err) {
2606
+ const error = err instanceof Error ? err : new Error(String(err));
2607
+ setError(error);
2608
+ throw error;
2609
+ } finally{
2610
+ setIsLoading(false);
2611
+ }
2612
+ }, [
2613
+ block.series,
2614
+ currentSeries == null ? void 0 : currentSeries.uniqueId
2615
+ ]);
2616
+ const followSeries = useCallback(async (uniqueId)=>{
2617
+ setIsLoading(true);
2618
+ setError(null);
2619
+ try {
2620
+ const result = await block.series.follow(uniqueId);
2621
+ setSeries((prev)=>prev.map((s)=>s.uniqueId === uniqueId ? result : s));
2622
+ if ((currentSeries == null ? void 0 : currentSeries.uniqueId) === uniqueId) {
2623
+ setCurrentSeries(result);
2624
+ }
2625
+ return result;
2626
+ } catch (err) {
2627
+ const error = err instanceof Error ? err : new Error(String(err));
2628
+ setError(error);
2629
+ throw error;
2630
+ } finally{
2631
+ setIsLoading(false);
2632
+ }
2633
+ }, [
2634
+ block.series,
2635
+ currentSeries == null ? void 0 : currentSeries.uniqueId
2636
+ ]);
2637
+ const unfollowSeries = useCallback(async (uniqueId)=>{
2638
+ setIsLoading(true);
2639
+ setError(null);
2640
+ try {
2641
+ await block.series.unfollow(uniqueId);
2642
+ } catch (err) {
2643
+ const error = err instanceof Error ? err : new Error(String(err));
2644
+ setError(error);
2645
+ throw error;
2646
+ } finally{
2647
+ setIsLoading(false);
2648
+ }
2649
+ }, [
2650
+ block.series
2651
+ ]);
2652
+ const saveSeries = useCallback(async (uniqueId)=>{
2653
+ setIsLoading(true);
2654
+ setError(null);
2655
+ try {
2656
+ const result = await block.series.save(uniqueId);
2657
+ setSeries((prev)=>prev.map((s)=>s.uniqueId === uniqueId ? result : s));
2658
+ if ((currentSeries == null ? void 0 : currentSeries.uniqueId) === uniqueId) {
2659
+ setCurrentSeries(result);
2660
+ }
2661
+ return result;
2662
+ } catch (err) {
2663
+ const error = err instanceof Error ? err : new Error(String(err));
2664
+ setError(error);
2665
+ throw error;
2666
+ } finally{
2667
+ setIsLoading(false);
2668
+ }
2669
+ }, [
2670
+ block.series,
2671
+ currentSeries == null ? void 0 : currentSeries.uniqueId
2672
+ ]);
2673
+ const unsaveSeries = useCallback(async (uniqueId)=>{
2674
+ setIsLoading(true);
2675
+ setError(null);
2676
+ try {
2677
+ await block.series.unsave(uniqueId);
2678
+ } catch (err) {
2679
+ const error = err instanceof Error ? err : new Error(String(err));
2680
+ setError(error);
2681
+ throw error;
2682
+ } finally{
2683
+ setIsLoading(false);
2684
+ }
2685
+ }, [
2686
+ block.series
2687
+ ]);
2688
+ // ─────────────────────────────────────────────────────────────────────────
2689
+ // Post Management
2690
+ // ─────────────────────────────────────────────────────────────────────────
2691
+ const getSeriesPosts = useCallback(async (uniqueId)=>{
2692
+ setIsLoading(true);
2693
+ setError(null);
2694
+ try {
2695
+ const result = await block.series.getPosts(uniqueId);
2696
+ setPosts(result);
2697
+ return result;
2698
+ } catch (err) {
2699
+ const error = err instanceof Error ? err : new Error(String(err));
2700
+ setError(error);
2701
+ throw error;
2702
+ } finally{
2703
+ setIsLoading(false);
2704
+ }
2705
+ }, [
2706
+ block.series
2707
+ ]);
2708
+ const addSeriesPost = useCallback(async (seriesUniqueId, postUniqueId, sequence)=>{
2709
+ setIsLoading(true);
2710
+ setError(null);
2711
+ try {
2712
+ await block.series.addPost(seriesUniqueId, postUniqueId, sequence);
2713
+ } catch (err) {
2714
+ const error = err instanceof Error ? err : new Error(String(err));
2715
+ setError(error);
2716
+ throw error;
2717
+ } finally{
2718
+ setIsLoading(false);
2719
+ }
2720
+ }, [
2721
+ block.series
2722
+ ]);
2723
+ const removeSeriesPost = useCallback(async (seriesUniqueId, postUniqueId)=>{
2724
+ setIsLoading(true);
2725
+ setError(null);
2726
+ try {
2727
+ await block.series.removePost(seriesUniqueId, postUniqueId);
2728
+ setPosts((prev)=>prev.filter((p)=>p.uniqueId !== postUniqueId));
2729
+ } catch (err) {
2730
+ const error = err instanceof Error ? err : new Error(String(err));
2731
+ setError(error);
2732
+ throw error;
2733
+ } finally{
2734
+ setIsLoading(false);
2735
+ }
2736
+ }, [
2737
+ block.series
2738
+ ]);
2739
+ const reorderSeriesPosts = useCallback(async (uniqueId, data)=>{
2740
+ setIsLoading(true);
2741
+ setError(null);
2742
+ try {
2743
+ const result = await block.series.reorderPosts(uniqueId, data);
2744
+ setSeries((prev)=>prev.map((s)=>s.uniqueId === uniqueId ? result : s));
2745
+ if ((currentSeries == null ? void 0 : currentSeries.uniqueId) === uniqueId) {
2746
+ setCurrentSeries(result);
2747
+ }
2748
+ return result;
2749
+ } catch (err) {
2750
+ const error = err instanceof Error ? err : new Error(String(err));
2751
+ setError(error);
2752
+ throw error;
2753
+ } finally{
2754
+ setIsLoading(false);
2755
+ }
2756
+ }, [
2757
+ block.series,
2758
+ currentSeries == null ? void 0 : currentSeries.uniqueId
2759
+ ]);
2760
+ // ─────────────────────────────────────────────────────────────────────────
2761
+ // State Management
2762
+ // ─────────────────────────────────────────────────────────────────────────
2763
+ const clearSeries = useCallback(()=>{
2764
+ setSeries([]);
2765
+ setCurrentSeries(null);
2766
+ setPosts([]);
2767
+ setTotalRecords(0);
2768
+ }, []);
2769
+ const clearError = useCallback(()=>{
2770
+ setError(null);
2771
+ }, []);
2772
+ return {
2773
+ // State
2774
+ series,
2775
+ currentSeries,
2776
+ posts,
2777
+ totalRecords,
2778
+ isLoading,
2779
+ error,
2780
+ // CRUD Operations
2781
+ listSeries,
2782
+ querySeries,
2783
+ getSeries,
2784
+ createSeries,
2785
+ updateSeries,
2786
+ deleteSeries,
2787
+ // Social Actions
2788
+ likeSeries,
2789
+ dislikeSeries,
2790
+ followSeries,
2791
+ unfollowSeries,
2792
+ saveSeries,
2793
+ unsaveSeries,
2794
+ // Post Management
2795
+ getSeriesPosts,
2796
+ addSeriesPost,
2797
+ removeSeriesPost,
2798
+ reorderSeriesPosts,
2799
+ // State Management
2800
+ clearSeries,
2801
+ clearError
2802
+ };
2803
+ }
2804
+
2805
+ export { Blocks23Provider, Provider, SimpleBlocks23Provider, use23Blocks, useAssetsBlock, useAuth, useAuthenticationBlock, useAvatars, useCampaignsBlock, useClient, useCompanyBlock, useContentBlock, useContentSeries, useConversationsBlock, useCrmBlock, useFavorites, useFilesBlock, useFormsBlock, useGeolocationBlock, useJarvisBlock, useMfa, useOAuth, useOnboardingBlock, useProductsBlock, useRewardsBlock, useSalesBlock, useSearch, useSearchBlock, useSimpleAuth, useSimpleBlocks23, useTenants, useUniversityBlock, useUser, useUsers, useWalletBlock };
@@ -6,4 +6,5 @@ export { useAvatars, type UseAvatarsReturn, type UseAvatarsState, type UseAvatar
6
6
  export { useTenants, type UseTenantsReturn, type UseTenantsState, type UseTenantsActions } from './use-tenants.js';
7
7
  export { useSearch, type UseSearchReturn, type UseSearchState, type UseSearchActions } from './use-search.js';
8
8
  export { useFavorites, type UseFavoritesReturn, type UseFavoritesState, type UseFavoritesActions } from './use-favorites.js';
9
+ export { useContentSeries, type UseContentSeriesReturn, type UseContentSeriesState, type UseContentSeriesActions } from './use-content-series.js';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/hooks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,MAAM,EAAE,KAAK,YA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E,UAAU,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGnH,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG7H,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,KAAK,qBAAqB,EAAE,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { PageResult } from '@23blocks/contracts';
2
+ import type { Series, CreateSeriesRequest, UpdateSeriesRequest, ListSeriesParams, QuerySeriesParams, ReorderPostsRequest, Post } from '@23blocks/block-content';
3
+ export interface UseContentSeriesState {
4
+ series: Series[];
5
+ currentSeries: Series | null;
6
+ posts: Post[];
7
+ totalRecords: number;
8
+ isLoading: boolean;
9
+ error: Error | null;
10
+ }
11
+ export interface UseContentSeriesActions {
12
+ listSeries: (params?: ListSeriesParams) => Promise<PageResult<Series>>;
13
+ querySeries: (params: QuerySeriesParams) => Promise<PageResult<Series>>;
14
+ getSeries: (uniqueId: string) => Promise<Series>;
15
+ createSeries: (data: CreateSeriesRequest) => Promise<Series>;
16
+ updateSeries: (uniqueId: string, data: UpdateSeriesRequest) => Promise<Series>;
17
+ deleteSeries: (uniqueId: string) => Promise<void>;
18
+ likeSeries: (uniqueId: string) => Promise<Series>;
19
+ dislikeSeries: (uniqueId: string) => Promise<Series>;
20
+ followSeries: (uniqueId: string) => Promise<Series>;
21
+ unfollowSeries: (uniqueId: string) => Promise<void>;
22
+ saveSeries: (uniqueId: string) => Promise<Series>;
23
+ unsaveSeries: (uniqueId: string) => Promise<void>;
24
+ getSeriesPosts: (uniqueId: string) => Promise<Post[]>;
25
+ addSeriesPost: (seriesUniqueId: string, postUniqueId: string, sequence?: number) => Promise<void>;
26
+ removeSeriesPost: (seriesUniqueId: string, postUniqueId: string) => Promise<void>;
27
+ reorderSeriesPosts: (uniqueId: string, data: ReorderPostsRequest) => Promise<Series>;
28
+ clearSeries: () => void;
29
+ clearError: () => void;
30
+ }
31
+ export type UseContentSeriesReturn = UseContentSeriesState & UseContentSeriesActions;
32
+ /**
33
+ * Hook for content series operations with state management.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * function SeriesPage() {
38
+ * const { series, listSeries, isLoading } = useContentSeries();
39
+ *
40
+ * useEffect(() => {
41
+ * listSeries({ page: 1, perPage: 10 });
42
+ * }, [listSeries]);
43
+ *
44
+ * if (isLoading) return <div>Loading...</div>;
45
+ *
46
+ * return (
47
+ * <ul>
48
+ * {series.map(s => (
49
+ * <li key={s.uniqueId}>{s.title}</li>
50
+ * ))}
51
+ * </ul>
52
+ * );
53
+ * }
54
+ * ```
55
+ */
56
+ export declare function useContentSeries(): UseContentSeriesReturn;
57
+ //# sourceMappingURL=use-content-series.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-content-series.d.ts","sourceRoot":"","sources":["../../../../src/lib/hooks/use-content-series.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,IAAI,EACL,MAAM,yBAAyB,CAAC;AAOjC,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,MAA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AAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClG,gBAAgB,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAGrF,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAMrF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CA6VzD"}
@@ -1,4 +1,4 @@
1
1
  export { Provider, useClient, useAuth, useUser, type ProviderProps, type ClientContext, type ServiceUrls, type AuthMode, type StorageType, type TokenManager, type AsyncStorageInterface, type UseUserReturn, SimpleBlocks23Provider, useSimpleBlocks23, useSimpleAuth, type SimpleBlocks23ProviderProps, type SimpleBlocks23Context, } from './simple-provider.js';
2
2
  export { Blocks23Provider, use23Blocks, useAuthenticationBlock, useSearchBlock, useProductsBlock, useCrmBlock, useContentBlock, useGeolocationBlock, useConversationsBlock, useFilesBlock, useFormsBlock, useAssetsBlock, useCampaignsBlock, useCompanyBlock, useRewardsBlock, useSalesBlock, useWalletBlock, useJarvisBlock, useOnboardingBlock, useUniversityBlock, type Blocks23ProviderProps, type Blocks23Context, } from './context.js';
3
- export { useUsers, type UseUsersReturn, type UseUsersState, type UseUsersActions, useMfa, type UseMfaReturn, type UseMfaState, type UseMfaActions, useOAuth, type UseOAuthReturn, type UseOAuthState, type UseOAuthActions, useAvatars, type UseAvatarsReturn, type UseAvatarsState, type UseAvatarsActions, useTenants, type UseTenantsReturn, type UseTenantsState, type UseTenantsActions, useSearch, useFavorites, type UseSearchReturn, type UseSearchState, type UseSearchActions, type UseFavoritesReturn, type UseFavoritesState, type UseFavoritesActions, } from './hooks/index.js';
3
+ export { useUsers, type UseUsersReturn, type UseUsersState, type UseUsersActions, useMfa, type UseMfaReturn, type UseMfaState, type UseMfaActions, useOAuth, type UseOAuthReturn, type UseOAuthState, type UseOAuthActions, useAvatars, type UseAvatarsReturn, type UseAvatarsState, type UseAvatarsActions, useTenants, type UseTenantsReturn, type UseTenantsState, type UseTenantsActions, useSearch, useFavorites, type UseSearchReturn, type UseSearchState, type UseSearchActions, type UseFavoritesReturn, type UseFavoritesState, type UseFavoritesActions, useContentSeries, type UseContentSeriesReturn, type UseContentSeriesState, type UseContentSeriesActions, } from './hooks/index.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAGlB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EAGpB,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAGlB,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EAGpB,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAGtB,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAGtB,SAAS,EACT,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAGlB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EAGpB,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAGlB,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EAGpB,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAGtB,UAAU,EACV,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAGtB,SAAS,EACT,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAGxB,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@23blocks/react",
3
- "version": "7.5.8",
3
+ "version": "7.5.10",
4
4
  "description": "React bindings for 23blocks SDK - hooks and context providers",
5
5
  "license": "MIT",
6
6
  "author": "23blocks <hello@23blocks.com>",