@pubflow/react 0.1.0

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.
Files changed (38) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +539 -0
  3. package/dist/index.d.ts +1908 -0
  4. package/dist/index.esm.js +9922 -0
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/index.js +9954 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/types/components/AdvancedFilter.d.ts +113 -0
  9. package/dist/types/components/BridgeForm/index.d.ts +6 -0
  10. package/dist/types/components/BridgeForm/styles.d.ts +62 -0
  11. package/dist/types/components/BridgeForm/types.d.ts +128 -0
  12. package/dist/types/components/BridgeForm/utils.d.ts +60 -0
  13. package/dist/types/components/BridgeList.d.ts +157 -0
  14. package/dist/types/components/BridgeTable.d.ts +110 -0
  15. package/dist/types/components/BridgeView.d.ts +39 -0
  16. package/dist/types/components/OfflineIndicator.d.ts +58 -0
  17. package/dist/types/components/auth/AccountCreationForm.d.ts +60 -0
  18. package/dist/types/components/auth/LoginForm.d.ts +76 -0
  19. package/dist/types/components/auth/PasswordResetForm.d.ts +60 -0
  20. package/dist/types/components/auth/index.d.ts +8 -0
  21. package/dist/types/components/theme/ThemeProvider.d.ts +255 -0
  22. package/dist/types/components/theme/index.d.ts +6 -0
  23. package/dist/types/context/PubflowProvider.d.ts +100 -0
  24. package/dist/types/hooks/useAuth.d.ts +32 -0
  25. package/dist/types/hooks/useBridgeApi.d.ts +14 -0
  26. package/dist/types/hooks/useBridgeApiRaw.d.ts +91 -0
  27. package/dist/types/hooks/useBridgeCrud.d.ts +193 -0
  28. package/dist/types/hooks/useBridgeMutation.d.ts +69 -0
  29. package/dist/types/hooks/useBridgeQuery.d.ts +44 -0
  30. package/dist/types/hooks/useSearchQueryBuilder.d.ts +152 -0
  31. package/dist/types/hooks/useServerAuth.d.ts +45 -0
  32. package/dist/types/index.d.ts +26 -0
  33. package/dist/types/storage/BrowserStorageAdapter.d.ts +112 -0
  34. package/dist/types/test/setup.d.ts +4 -0
  35. package/dist/types/utils/auth-utils.d.ts +37 -0
  36. package/dist/types/utils/index.d.ts +5 -0
  37. package/dist/types/utils/persistent-cache.d.ts +57 -0
  38. package/package.json +70 -0
@@ -0,0 +1,1908 @@
1
+ import * as _pubflow_core from '@pubflow/core';
2
+ import { EntityData, BridgeApiService, EntityConfig, FilterOperator, FilterDefinition, PubflowInstanceConfig, ApiClient, AuthService, User, QueryParams, SearchParams, StorageAdapter } from '@pubflow/core';
3
+ export * from '@pubflow/core';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import React, { CSSProperties, ReactNode } from 'react';
6
+ import { z } from 'zod';
7
+ import { SWRConfiguration } from 'swr';
8
+
9
+ /**
10
+ * Bridge View props
11
+ */
12
+ interface BridgeViewProps {
13
+ /**
14
+ * Content to render if conditions are met
15
+ */
16
+ children: React.ReactNode;
17
+ /**
18
+ * User types allowed to view the content
19
+ */
20
+ allowedTypes?: string | string[];
21
+ /**
22
+ * Content to render if conditions are not met
23
+ */
24
+ fallback?: React.ReactNode;
25
+ /**
26
+ * Loading component
27
+ */
28
+ loadingComponent?: React.ReactNode;
29
+ /**
30
+ * Callback when user is not authorized
31
+ */
32
+ onUnauthorized?: () => void;
33
+ /**
34
+ * Pubflow instance ID
35
+ */
36
+ instanceId?: string;
37
+ }
38
+ /**
39
+ * Component for conditional rendering based on authentication and user type
40
+ */
41
+ declare function BridgeView({ children, allowedTypes, fallback, loadingComponent, onUnauthorized, instanceId }: BridgeViewProps): react_jsx_runtime.JSX.Element;
42
+
43
+ /**
44
+ * Bridge Mutation Hook for React
45
+ *
46
+ * Provides a hook for mutating data using Bridge API
47
+ */
48
+
49
+ /**
50
+ * Mutation types
51
+ */
52
+ type MutationType = 'create' | 'update' | 'delete';
53
+ /**
54
+ * Mutation parameters
55
+ */
56
+ type MutationParams<T, M> = M extends 'create' ? Partial<T> : M extends 'update' ? {
57
+ id: string;
58
+ data: Partial<T>;
59
+ } : M extends 'delete' ? string : never;
60
+ /**
61
+ * Mutation result
62
+ */
63
+ type MutationResult<T, M> = M extends 'create' ? T : M extends 'update' ? T : M extends 'delete' ? void : never;
64
+ /**
65
+ * Mutation options
66
+ */
67
+ interface MutationOptions {
68
+ /**
69
+ * Whether to invalidate queries after mutation
70
+ */
71
+ invalidateQueries?: boolean;
72
+ /**
73
+ * Success message
74
+ */
75
+ successMessage?: string;
76
+ /**
77
+ * Error message
78
+ */
79
+ errorMessage?: string;
80
+ /**
81
+ * Success callback
82
+ */
83
+ onSuccess?: (data: any) => void;
84
+ /**
85
+ * Error callback
86
+ */
87
+ onError?: (error: Error) => void;
88
+ /**
89
+ * Whether to show alerts for success/error
90
+ */
91
+ showAlerts?: boolean;
92
+ }
93
+ /**
94
+ * Bridge mutation hook result
95
+ */
96
+ interface UseBridgeMutationResult<T, M extends MutationType> {
97
+ mutate: (params: MutationParams<T, M>, options?: MutationOptions) => Promise<MutationResult<T, M>>;
98
+ isLoading: boolean;
99
+ error: Error | null;
100
+ reset: () => void;
101
+ }
102
+ /**
103
+ * Hook for mutating data using Bridge API
104
+ *
105
+ * @param service Bridge API service
106
+ * @param type Mutation type
107
+ * @param defaultOptions Default mutation options
108
+ * @returns Mutation result
109
+ */
110
+ declare function useBridgeMutation<T extends EntityData, M extends MutationType>(service: BridgeApiService<T>, type: M, defaultOptions?: MutationOptions): UseBridgeMutationResult<T, M>;
111
+
112
+ /**
113
+ * Bridge CRUD Hook for React
114
+ *
115
+ * Provides a hook for CRUD operations using Bridge API
116
+ */
117
+
118
+ /**
119
+ * Search configuration
120
+ */
121
+ interface SearchConfig {
122
+ /**
123
+ * Initial search term
124
+ */
125
+ initialSearchTerm?: string;
126
+ /**
127
+ * Initial filters
128
+ */
129
+ initialFilters?: Array<{
130
+ field: string;
131
+ operator: FilterOperator | string;
132
+ value: any;
133
+ }>;
134
+ /**
135
+ * Initial sort
136
+ */
137
+ initialSort?: {
138
+ field: string;
139
+ direction: 'asc' | 'desc';
140
+ };
141
+ /**
142
+ * Initial page
143
+ */
144
+ initialPage?: number;
145
+ /**
146
+ * Initial limit
147
+ */
148
+ initialLimit?: number;
149
+ /**
150
+ * Fields to search
151
+ */
152
+ searchFields?: string[];
153
+ /**
154
+ * Debounce time in milliseconds
155
+ */
156
+ debounceMs?: number;
157
+ /**
158
+ * Whether to search automatically
159
+ */
160
+ autoSearch?: boolean;
161
+ }
162
+ /**
163
+ * Entity schemas
164
+ */
165
+ interface EntitySchemas<T, U, V> {
166
+ /**
167
+ * Schema for the complete entity
168
+ */
169
+ entity?: any;
170
+ /**
171
+ * Schema for creating an entity
172
+ */
173
+ create?: any;
174
+ /**
175
+ * Schema for updating an entity
176
+ */
177
+ update?: any;
178
+ }
179
+ /**
180
+ * Success messages
181
+ */
182
+ interface SuccessMessages {
183
+ /**
184
+ * Success message for create operation
185
+ */
186
+ create?: string;
187
+ /**
188
+ * Success message for update operation
189
+ */
190
+ update?: string;
191
+ /**
192
+ * Success message for delete operation
193
+ */
194
+ delete?: string;
195
+ }
196
+ /**
197
+ * Error messages
198
+ */
199
+ interface ErrorMessages {
200
+ /**
201
+ * Error message for create operation
202
+ */
203
+ create?: string;
204
+ /**
205
+ * Error message for update operation
206
+ */
207
+ update?: string;
208
+ /**
209
+ * Error message for delete operation
210
+ */
211
+ delete?: string;
212
+ /**
213
+ * Error message for fetch operation
214
+ */
215
+ fetch?: string;
216
+ }
217
+ /**
218
+ * Bridge CRUD hook options
219
+ */
220
+ interface UseBridgeCrudOptions<T extends EntityData, U = Partial<T>, V = Partial<T>> {
221
+ /**
222
+ * Entity configuration
223
+ */
224
+ entityConfig: EntityConfig;
225
+ /**
226
+ * Pubflow instance ID
227
+ */
228
+ instanceId?: string;
229
+ /**
230
+ * Entity schemas
231
+ */
232
+ schemas?: EntitySchemas<T, U, V>;
233
+ /**
234
+ * Search configuration
235
+ */
236
+ searchConfig?: SearchConfig;
237
+ /**
238
+ * Success messages
239
+ */
240
+ successMessages?: SuccessMessages;
241
+ /**
242
+ * Error messages
243
+ */
244
+ errorMessages?: ErrorMessages;
245
+ /**
246
+ * Notification configuration
247
+ */
248
+ notificationConfig?: {
249
+ /**
250
+ * Whether to show notifications automatically
251
+ */
252
+ autoNotify?: boolean;
253
+ /**
254
+ * Function to show notifications
255
+ */
256
+ showNotification?: (message: string, type: 'success' | 'error') => void;
257
+ };
258
+ }
259
+ /**
260
+ * Bridge CRUD hook result
261
+ */
262
+ interface UseBridgeCrudResult<T extends EntityData> {
263
+ items: T[];
264
+ selectedItem: T | null;
265
+ totalItems: number;
266
+ loading: boolean;
267
+ creating: boolean;
268
+ updating: boolean;
269
+ deleting: boolean;
270
+ error: Error | null;
271
+ validationErrors: Record<string, string[]> | null;
272
+ page: number;
273
+ limit: number;
274
+ hasMore: boolean;
275
+ setPage: (page: number) => void;
276
+ setLimit: (limit: number) => void;
277
+ orderBy: string | undefined;
278
+ orderDir: 'asc' | 'desc' | undefined;
279
+ setSort: (field: string, direction?: 'asc' | 'desc') => void;
280
+ searchTerm: string;
281
+ setSearchTerm: (term: string) => void;
282
+ filters: Array<{
283
+ field: string;
284
+ operator: FilterOperator | string;
285
+ value: any;
286
+ }>;
287
+ addFilter: (field: string, operator: FilterOperator | string, value: any) => void;
288
+ removeFilter: (field: string) => void;
289
+ resetFilters: () => void;
290
+ getItem: (id: string) => Promise<T>;
291
+ createItem: (data: Partial<T>, options?: MutationOptions) => Promise<T>;
292
+ updateItem: (id: string, data: Partial<T>, options?: MutationOptions) => Promise<T>;
293
+ deleteItem: (id: string, options?: MutationOptions) => Promise<void>;
294
+ refresh: () => Promise<void>;
295
+ selectItem: (item: T | null) => void;
296
+ }
297
+ /**
298
+ * Hook for CRUD operations using Bridge API
299
+ *
300
+ * @param options Hook options
301
+ * @returns CRUD hook result
302
+ */
303
+ declare function useBridgeCrud<T extends EntityData, U = Partial<T>, V = Partial<T>>(options: UseBridgeCrudOptions<T, U, V>): UseBridgeCrudResult<T>;
304
+
305
+ /**
306
+ * Column definition
307
+ */
308
+ interface ColumnDef<T> {
309
+ /**
310
+ * Column key
311
+ */
312
+ key: string;
313
+ /**
314
+ * Column header
315
+ */
316
+ header: React.ReactNode;
317
+ /**
318
+ * Cell renderer
319
+ */
320
+ cell?: (item: T, index: number) => React.ReactNode;
321
+ /**
322
+ * Whether the column is sortable
323
+ */
324
+ sortable?: boolean;
325
+ /**
326
+ * Whether the column is filterable
327
+ */
328
+ filterable?: boolean;
329
+ /**
330
+ * Column width
331
+ */
332
+ width?: string | number;
333
+ /**
334
+ * Column alignment
335
+ */
336
+ align?: 'left' | 'center' | 'right';
337
+ }
338
+ /**
339
+ * Bridge Table props
340
+ */
341
+ interface BridgeTableProps<T extends EntityData> extends UseBridgeCrudOptions<T> {
342
+ /**
343
+ * Column definitions
344
+ */
345
+ columns: ColumnDef<T>[];
346
+ /**
347
+ * Whether to show pagination
348
+ */
349
+ showPagination?: boolean;
350
+ /**
351
+ * Whether to show search
352
+ */
353
+ showSearch?: boolean;
354
+ /**
355
+ * Whether to show filters
356
+ */
357
+ showFilters?: boolean;
358
+ /**
359
+ * Row key function
360
+ */
361
+ rowKey?: (item: T) => string;
362
+ /**
363
+ * Row click handler
364
+ */
365
+ onRowClick?: (item: T) => void;
366
+ /**
367
+ * Table class name
368
+ */
369
+ className?: string;
370
+ /**
371
+ * Loading component
372
+ */
373
+ loadingComponent?: React.ReactNode;
374
+ /**
375
+ * Empty component
376
+ */
377
+ emptyComponent?: React.ReactNode;
378
+ /**
379
+ * Error component
380
+ */
381
+ errorComponent?: React.ReactNode;
382
+ /**
383
+ * Pagination component
384
+ */
385
+ paginationComponent?: React.ReactNode;
386
+ /**
387
+ * Search component
388
+ */
389
+ searchComponent?: React.ReactNode;
390
+ /**
391
+ * Filter component
392
+ */
393
+ filterComponent?: React.ReactNode;
394
+ /**
395
+ * Search placeholder
396
+ */
397
+ searchPlaceholder?: string;
398
+ /**
399
+ * Actions renderer
400
+ */
401
+ actions?: (item: T) => React.ReactNode;
402
+ }
403
+ /**
404
+ * Component for displaying data in a table with sorting, filtering, and pagination
405
+ */
406
+ declare function BridgeTable<T extends EntityData>({ columns, showPagination, showSearch, showFilters, rowKey, onRowClick, className, loadingComponent, emptyComponent, errorComponent, paginationComponent, searchComponent, filterComponent, searchPlaceholder, actions, ...crudOptions }: BridgeTableProps<T>): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element;
407
+
408
+ /**
409
+ * Types for BridgeForm component
410
+ */
411
+
412
+ /**
413
+ * Field configuration for BridgeForm
414
+ */
415
+ interface FieldConfig {
416
+ /** Field name (must exist in the schema) */
417
+ name: string;
418
+ /** Custom label (defaults to formatted field name) */
419
+ label?: string;
420
+ /** Placeholder text */
421
+ placeholder?: string;
422
+ /** Help text description */
423
+ description?: string;
424
+ /** Field type */
425
+ type?: 'text' | 'number' | 'email' | 'password' | 'select' | 'checkbox' | 'radio' | 'date' | 'textarea' | 'file' | 'color' | 'range' | 'hidden';
426
+ /** Options for select/radio fields */
427
+ options?: Array<{
428
+ value: any;
429
+ label: string;
430
+ }>;
431
+ /** Field width (%, px, etc.) */
432
+ width?: string;
433
+ /** Whether the field should be hidden */
434
+ hidden?: boolean;
435
+ /** Whether the field should be disabled */
436
+ disabled?: boolean;
437
+ /** Default value */
438
+ defaultValue?: any;
439
+ /** Whether the field should have autofocus */
440
+ autoFocus?: boolean;
441
+ /** Custom CSS class */
442
+ className?: string;
443
+ /** Inline styles */
444
+ style?: CSSProperties;
445
+ /** Custom render function */
446
+ render?: (props: FieldRenderProps) => ReactNode;
447
+ }
448
+ /**
449
+ * Props for custom field rendering
450
+ */
451
+ interface FieldRenderProps {
452
+ /** Field configuration */
453
+ field: FieldConfig;
454
+ /** Current field value */
455
+ value: any;
456
+ /** Function to change value */
457
+ onChange: (value: any) => void;
458
+ /** Function for blur event */
459
+ onBlur: () => void;
460
+ /** Validation error if any */
461
+ error?: string;
462
+ /** Whether the field is required */
463
+ required: boolean;
464
+ /** Whether the field is disabled */
465
+ disabled: boolean;
466
+ /** Whether dark mode is active */
467
+ isDarkMode: boolean;
468
+ }
469
+ /**
470
+ * BridgeForm component props
471
+ */
472
+ interface BridgeFormProps<T extends Record<string, any>> {
473
+ /** Zod schema for validation */
474
+ schema: z.ZodType<T>;
475
+ /** Form mode */
476
+ mode: 'create' | 'update' | 'partial';
477
+ /** Entity configuration for BridgeApi */
478
+ entityConfig: EntityConfig;
479
+ /** Pubflow instance ID */
480
+ instanceId?: string;
481
+ /** Initial data (for update/partial mode) */
482
+ initialData?: Partial<T>;
483
+ /** Record ID (for update/partial mode) */
484
+ id?: string;
485
+ /** Fields to display (all schema fields by default) */
486
+ fields?: FieldConfig[];
487
+ /** Layout configuration */
488
+ layout?: {
489
+ /** Number of columns or responsive configuration */
490
+ columns?: number | {
491
+ sm?: number;
492
+ md?: number;
493
+ lg?: number;
494
+ };
495
+ /** Gap between fields */
496
+ gap?: string;
497
+ };
498
+ /** Success callback */
499
+ onSuccess?: (data: T) => void;
500
+ /** Error callback */
501
+ onError?: (error: Error) => void;
502
+ /** Cancel callback */
503
+ onCancel?: () => void;
504
+ /** Custom labels */
505
+ labels?: {
506
+ /** Submit button text */
507
+ submit?: string;
508
+ /** Cancel button text */
509
+ cancel?: string;
510
+ /** Required field indicator text */
511
+ required?: string;
512
+ };
513
+ /** Theme */
514
+ theme?: 'light' | 'dark' | 'auto';
515
+ /** Main color for the form (buttons, focus rings, etc.) */
516
+ mainColor?: string;
517
+ /** Custom CSS class */
518
+ className?: string;
519
+ /** Inline styles */
520
+ style?: CSSProperties;
521
+ /** Custom styles for form elements */
522
+ customStyles?: {
523
+ form?: string;
524
+ field?: string;
525
+ label?: string;
526
+ input?: string;
527
+ select?: string;
528
+ checkbox?: string;
529
+ radio?: string;
530
+ button?: string;
531
+ error?: string;
532
+ };
533
+ }
534
+
535
+ /**
536
+ * BridgeForm component
537
+ */
538
+ declare function BridgeForm<T extends Record<string, any>>({ schema, mode, entityConfig, instanceId, initialData, id, fields, layout, onSuccess, onError, onCancel, labels, theme, mainColor, className, style, customStyles }: BridgeFormProps<T>): react_jsx_runtime.JSX.Element;
539
+
540
+ /**
541
+ * Filter field definition
542
+ */
543
+ interface FilterField {
544
+ /**
545
+ * Field name
546
+ */
547
+ name: string;
548
+ /**
549
+ * Display label
550
+ */
551
+ label: string;
552
+ /**
553
+ * Field type
554
+ */
555
+ type: 'text' | 'number' | 'date' | 'boolean' | 'select';
556
+ /**
557
+ * Options for select type
558
+ */
559
+ options?: {
560
+ label: string;
561
+ value: any;
562
+ }[];
563
+ /**
564
+ * Allowed operators
565
+ */
566
+ operators?: FilterOperator[];
567
+ }
568
+ /**
569
+ * Advanced filter texts
570
+ */
571
+ interface AdvancedFilterTexts {
572
+ title?: string;
573
+ addFilter?: string;
574
+ resetFilters?: string;
575
+ apply?: string;
576
+ cancel?: string;
577
+ field?: string;
578
+ operator?: string;
579
+ value?: string;
580
+ filterButton?: string;
581
+ activeFilters?: string;
582
+ noActiveFilters?: string;
583
+ selectField?: string;
584
+ selectOperator?: string;
585
+ enterValue?: string;
586
+ }
587
+ /**
588
+ * Advanced filter colors
589
+ */
590
+ interface AdvancedFilterColors {
591
+ primary?: string;
592
+ secondary?: string;
593
+ background?: string;
594
+ surface?: string;
595
+ text?: string;
596
+ textSecondary?: string;
597
+ border?: string;
598
+ error?: string;
599
+ success?: string;
600
+ }
601
+ /**
602
+ * Advanced filter props
603
+ */
604
+ interface AdvancedFilterProps {
605
+ /**
606
+ * Available filter fields
607
+ */
608
+ fields: FilterField[];
609
+ /**
610
+ * Current filters
611
+ */
612
+ filters: FilterDefinition[];
613
+ /**
614
+ * Add filter callback
615
+ */
616
+ onAddFilter: (filter: FilterDefinition) => void;
617
+ /**
618
+ * Remove filter callback
619
+ */
620
+ onRemoveFilter: (index: number) => void;
621
+ /**
622
+ * Reset filters callback
623
+ */
624
+ onResetFilters: () => void;
625
+ /**
626
+ * Container style
627
+ */
628
+ style?: React.CSSProperties;
629
+ /**
630
+ * Custom texts
631
+ */
632
+ texts?: AdvancedFilterTexts;
633
+ /**
634
+ * Custom colors
635
+ */
636
+ colors?: AdvancedFilterColors;
637
+ /**
638
+ * Custom CSS class
639
+ */
640
+ className?: string;
641
+ }
642
+ /**
643
+ * Advanced Filter component
644
+ */
645
+ declare function AdvancedFilter({ fields, filters, onAddFilter, onRemoveFilter, onResetFilters, style, texts, colors, className }: AdvancedFilterProps): react_jsx_runtime.JSX.Element;
646
+
647
+ /**
648
+ * Bridge List render item props
649
+ */
650
+ interface BridgeListRenderItemProps<T> {
651
+ item: T;
652
+ index: number;
653
+ isSelected: boolean;
654
+ onSelect: () => void;
655
+ }
656
+ /**
657
+ * Bridge List texts
658
+ */
659
+ interface BridgeListTexts {
660
+ searchPlaceholder?: string;
661
+ offlineText?: string;
662
+ noResults?: string;
663
+ loading?: string;
664
+ error?: string;
665
+ loadMore?: string;
666
+ showingResults?: string;
667
+ of?: string;
668
+ results?: string;
669
+ }
670
+ /**
671
+ * Bridge List colors
672
+ */
673
+ interface BridgeListColors {
674
+ primary?: string;
675
+ secondary?: string;
676
+ background?: string;
677
+ surface?: string;
678
+ text?: string;
679
+ textSecondary?: string;
680
+ border?: string;
681
+ error?: string;
682
+ success?: string;
683
+ }
684
+ /**
685
+ * Bridge List layout configuration
686
+ */
687
+ interface BridgeListLayout {
688
+ advancedFilterWidth?: number;
689
+ contentWidth?: number;
690
+ }
691
+ /**
692
+ * Bridge List props
693
+ */
694
+ interface BridgeListProps<T extends EntityData> {
695
+ /**
696
+ * Function to render each item
697
+ */
698
+ renderItem: (props: BridgeListRenderItemProps<T>) => React.ReactNode;
699
+ /**
700
+ * Entity configuration
701
+ */
702
+ entityConfig: EntityConfig;
703
+ /**
704
+ * Show pagination
705
+ */
706
+ showPagination?: boolean;
707
+ /**
708
+ * Show search
709
+ */
710
+ showSearch?: boolean;
711
+ /**
712
+ * Show filters
713
+ */
714
+ showFilters?: boolean;
715
+ /**
716
+ * Show advanced filters
717
+ */
718
+ showAdvancedFilters?: boolean;
719
+ /**
720
+ * Advanced filter fields
721
+ */
722
+ advancedFilterFields?: FilterField[];
723
+ /**
724
+ * Layout configuration
725
+ */
726
+ layout?: BridgeListLayout;
727
+ /**
728
+ * Key extractor function
729
+ */
730
+ keyExtractor?: (item: T) => string;
731
+ /**
732
+ * Item press handler
733
+ */
734
+ onItemPress?: (item: T) => void;
735
+ /**
736
+ * Container style
737
+ */
738
+ style?: React.CSSProperties;
739
+ /**
740
+ * Loading component
741
+ */
742
+ loadingComponent?: React.ReactNode;
743
+ /**
744
+ * Empty component
745
+ */
746
+ emptyComponent?: React.ReactNode;
747
+ /**
748
+ * Error component
749
+ */
750
+ errorComponent?: React.ReactNode;
751
+ /**
752
+ * Pagination component
753
+ */
754
+ paginationComponent?: React.ReactNode;
755
+ /**
756
+ * Search component
757
+ */
758
+ searchComponent?: React.ReactNode;
759
+ /**
760
+ * Filter component
761
+ */
762
+ filterComponent?: React.ReactNode;
763
+ /**
764
+ * Advanced filter component
765
+ */
766
+ advancedFilterComponent?: React.ReactNode;
767
+ /**
768
+ * Custom texts
769
+ */
770
+ texts?: BridgeListTexts;
771
+ /**
772
+ * Custom colors
773
+ */
774
+ colors?: BridgeListColors;
775
+ /**
776
+ * Show offline indicator
777
+ */
778
+ showOfflineIndicator?: boolean;
779
+ /**
780
+ * Pubflow instance ID
781
+ */
782
+ instanceId?: string;
783
+ /**
784
+ * Custom CSS class
785
+ */
786
+ className?: string;
787
+ limit?: number;
788
+ orderBy?: string;
789
+ orderDir?: 'asc' | 'desc';
790
+ initialFilters?: FilterDefinition[];
791
+ }
792
+ /**
793
+ * Component for displaying data in a list with sorting, filtering, and pagination
794
+ */
795
+ declare function BridgeList<T extends EntityData>({ renderItem, showPagination, showSearch, showFilters, showAdvancedFilters, advancedFilterFields, layout, keyExtractor, onItemPress, style, loadingComponent, emptyComponent, errorComponent, paginationComponent, searchComponent, filterComponent, advancedFilterComponent, texts, colors, showOfflineIndicator, className, ...crudOptions }: BridgeListProps<T>): react_jsx_runtime.JSX.Element;
796
+
797
+ /**
798
+ * Offline Indicator props
799
+ */
800
+ interface OfflineIndicatorProps {
801
+ /**
802
+ * Text to display when offline
803
+ */
804
+ offlineText?: string;
805
+ /**
806
+ * Text to display when back online
807
+ */
808
+ onlineText?: string;
809
+ /**
810
+ * Duration to show the online message (in ms)
811
+ */
812
+ onlineDuration?: number;
813
+ /**
814
+ * Style for the container
815
+ */
816
+ style?: React.CSSProperties;
817
+ /**
818
+ * Style for the offline text
819
+ */
820
+ offlineTextStyle?: React.CSSProperties;
821
+ /**
822
+ * Style for the online text
823
+ */
824
+ onlineTextStyle?: React.CSSProperties;
825
+ /**
826
+ * Whether to show the indicator
827
+ */
828
+ visible?: boolean;
829
+ /**
830
+ * Position of the indicator
831
+ */
832
+ position?: 'top' | 'bottom';
833
+ /**
834
+ * Custom CSS class
835
+ */
836
+ className?: string;
837
+ }
838
+ /**
839
+ * Component for displaying an offline indicator
840
+ */
841
+ declare function OfflineIndicator({ offlineText, onlineText, onlineDuration, style, offlineTextStyle, onlineTextStyle, visible, position, className }: OfflineIndicatorProps): react_jsx_runtime.JSX.Element | null;
842
+ /**
843
+ * Hook to get network status
844
+ */
845
+ declare function useNetworkStatus(): {
846
+ isOnline: boolean;
847
+ isOffline: boolean;
848
+ };
849
+
850
+ /**
851
+ * Login form configuration
852
+ */
853
+ interface LoginFormConfig {
854
+ /**
855
+ * Primary color for branding
856
+ */
857
+ primaryColor?: string;
858
+ /**
859
+ * Secondary color for accents
860
+ */
861
+ secondaryColor?: string;
862
+ /**
863
+ * Application name
864
+ */
865
+ appName?: string;
866
+ /**
867
+ * Logo URL or component
868
+ */
869
+ logo?: string | React.ReactNode;
870
+ /**
871
+ * Show password reset link
872
+ */
873
+ showPasswordReset?: boolean;
874
+ /**
875
+ * Show account creation link
876
+ */
877
+ showAccountCreation?: boolean;
878
+ /**
879
+ * Custom styling
880
+ */
881
+ className?: string;
882
+ /**
883
+ * Redirect path after successful login
884
+ */
885
+ redirectPath?: string;
886
+ }
887
+ /**
888
+ * Login form props
889
+ */
890
+ interface LoginFormProps {
891
+ /**
892
+ * Configuration options
893
+ */
894
+ config?: LoginFormConfig;
895
+ /**
896
+ * Success callback
897
+ */
898
+ onSuccess?: (user: any) => void;
899
+ /**
900
+ * Error callback
901
+ */
902
+ onError?: (error: string) => void;
903
+ /**
904
+ * Password reset callback
905
+ */
906
+ onPasswordReset?: () => void;
907
+ /**
908
+ * Account creation callback
909
+ */
910
+ onAccountCreation?: () => void;
911
+ /**
912
+ * Pubflow instance ID
913
+ */
914
+ instanceId?: string;
915
+ }
916
+ /**
917
+ * Professional login form component
918
+ */
919
+ declare function LoginForm({ config, onSuccess, onError, onPasswordReset, onAccountCreation, instanceId }: LoginFormProps): react_jsx_runtime.JSX.Element;
920
+
921
+ /**
922
+ * Password reset form configuration
923
+ */
924
+ interface PasswordResetFormConfig {
925
+ /**
926
+ * Primary color for branding
927
+ */
928
+ primaryColor?: string;
929
+ /**
930
+ * Application name
931
+ */
932
+ appName?: string;
933
+ /**
934
+ * Logo URL or component
935
+ */
936
+ logo?: string | React.ReactNode;
937
+ /**
938
+ * API base URL
939
+ */
940
+ apiBaseUrl?: string;
941
+ /**
942
+ * Custom styling
943
+ */
944
+ className?: string;
945
+ }
946
+ /**
947
+ * Password reset form props
948
+ */
949
+ interface PasswordResetFormProps {
950
+ /**
951
+ * Configuration options
952
+ */
953
+ config?: PasswordResetFormConfig;
954
+ /**
955
+ * Success callback
956
+ */
957
+ onSuccess?: () => void;
958
+ /**
959
+ * Error callback
960
+ */
961
+ onError?: (error: string) => void;
962
+ /**
963
+ * Back to login callback
964
+ */
965
+ onBackToLogin?: () => void;
966
+ /**
967
+ * Reset token from URL (for reset step)
968
+ */
969
+ resetToken?: string;
970
+ }
971
+ /**
972
+ * Professional password reset form component
973
+ */
974
+ declare function PasswordResetForm({ config, onSuccess, onError, onBackToLogin, resetToken }: PasswordResetFormProps): react_jsx_runtime.JSX.Element;
975
+
976
+ /**
977
+ * Account creation form configuration
978
+ */
979
+ interface AccountCreationFormConfig {
980
+ /**
981
+ * Primary color for branding
982
+ */
983
+ primaryColor?: string;
984
+ /**
985
+ * Application name
986
+ */
987
+ appName?: string;
988
+ /**
989
+ * Logo URL or component
990
+ */
991
+ logo?: string | React.ReactNode;
992
+ /**
993
+ * API base URL
994
+ */
995
+ apiBaseUrl?: string;
996
+ /**
997
+ * Custom styling
998
+ */
999
+ className?: string;
1000
+ /**
1001
+ * Required fields
1002
+ */
1003
+ requiredFields?: string[];
1004
+ }
1005
+ /**
1006
+ * Account creation form props
1007
+ */
1008
+ interface AccountCreationFormProps {
1009
+ /**
1010
+ * Configuration options
1011
+ */
1012
+ config?: AccountCreationFormConfig;
1013
+ /**
1014
+ * Success callback
1015
+ */
1016
+ onSuccess?: () => void;
1017
+ /**
1018
+ * Error callback
1019
+ */
1020
+ onError?: (error: string) => void;
1021
+ /**
1022
+ * Back to login callback
1023
+ */
1024
+ onBackToLogin?: () => void;
1025
+ }
1026
+ /**
1027
+ * Professional account creation form component
1028
+ */
1029
+ declare function AccountCreationForm({ config, onSuccess, onError, onBackToLogin }: AccountCreationFormProps): react_jsx_runtime.JSX.Element;
1030
+
1031
+ /**
1032
+ * Theme configuration interface
1033
+ */
1034
+ interface ThemeConfig {
1035
+ /**
1036
+ * Primary color for branding
1037
+ */
1038
+ primaryColor: string;
1039
+ /**
1040
+ * Secondary color for accents
1041
+ */
1042
+ secondaryColor: string;
1043
+ /**
1044
+ * Application name
1045
+ */
1046
+ appName: string;
1047
+ /**
1048
+ * Logo URL or component
1049
+ */
1050
+ logo?: string | ReactNode;
1051
+ /**
1052
+ * Success color
1053
+ */
1054
+ successColor: string;
1055
+ /**
1056
+ * Error color
1057
+ */
1058
+ errorColor: string;
1059
+ /**
1060
+ * Warning color
1061
+ */
1062
+ warningColor: string;
1063
+ /**
1064
+ * Background colors
1065
+ */
1066
+ backgroundColor: string;
1067
+ surfaceColor: string;
1068
+ /**
1069
+ * Text colors
1070
+ */
1071
+ textPrimary: string;
1072
+ textSecondary: string;
1073
+ textMuted: string;
1074
+ /**
1075
+ * Border colors
1076
+ */
1077
+ borderColor: string;
1078
+ borderColorFocus: string;
1079
+ /**
1080
+ * Shadow colors
1081
+ */
1082
+ shadowColor: string;
1083
+ /**
1084
+ * Font family
1085
+ */
1086
+ fontFamily: string;
1087
+ /**
1088
+ * Border radius
1089
+ */
1090
+ borderRadius: {
1091
+ small: string;
1092
+ medium: string;
1093
+ large: string;
1094
+ };
1095
+ /**
1096
+ * Spacing
1097
+ */
1098
+ spacing: {
1099
+ xs: string;
1100
+ sm: string;
1101
+ md: string;
1102
+ lg: string;
1103
+ xl: string;
1104
+ };
1105
+ }
1106
+ /**
1107
+ * Theme provider props
1108
+ */
1109
+ interface ThemeProviderProps {
1110
+ children: ReactNode;
1111
+ theme?: Partial<ThemeConfig>;
1112
+ }
1113
+ /**
1114
+ * Theme provider component
1115
+ */
1116
+ declare function ThemeProvider({ children, theme }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
1117
+ /**
1118
+ * Hook to use theme
1119
+ */
1120
+ declare function useTheme(): ThemeConfig;
1121
+ /**
1122
+ * Generate CSS variables from theme
1123
+ */
1124
+ declare function generateCSSVariables(theme: ThemeConfig): Record<string, string>;
1125
+ /**
1126
+ * CSS-in-JS style generator
1127
+ */
1128
+ declare function createStyles(theme: ThemeConfig): {
1129
+ container: {
1130
+ maxWidth: string;
1131
+ margin: string;
1132
+ padding: string;
1133
+ backgroundColor: string;
1134
+ borderRadius: string;
1135
+ boxShadow: string;
1136
+ border: string;
1137
+ fontFamily: string;
1138
+ };
1139
+ logoSection: {
1140
+ textAlign: "center";
1141
+ marginBottom: string;
1142
+ };
1143
+ logo: {
1144
+ maxWidth: string;
1145
+ height: string;
1146
+ marginBottom: string;
1147
+ };
1148
+ title: {
1149
+ fontSize: string;
1150
+ fontWeight: string;
1151
+ color: string;
1152
+ marginBottom: string;
1153
+ letterSpacing: string;
1154
+ };
1155
+ subtitle: {
1156
+ fontSize: string;
1157
+ color: string;
1158
+ fontWeight: string;
1159
+ marginBottom: string;
1160
+ };
1161
+ inputGroup: {
1162
+ marginBottom: string;
1163
+ };
1164
+ inputLabel: {
1165
+ fontSize: string;
1166
+ fontWeight: string;
1167
+ color: string;
1168
+ marginBottom: string;
1169
+ letterSpacing: string;
1170
+ display: string;
1171
+ };
1172
+ inputContainer: {
1173
+ position: "relative";
1174
+ display: string;
1175
+ alignItems: string;
1176
+ backgroundColor: string;
1177
+ borderRadius: string;
1178
+ border: string;
1179
+ padding: string;
1180
+ height: string;
1181
+ boxShadow: string;
1182
+ transition: string;
1183
+ };
1184
+ inputContainerFocus: {
1185
+ borderColor: string;
1186
+ };
1187
+ input: {
1188
+ flex: number;
1189
+ fontSize: string;
1190
+ color: string;
1191
+ border: string;
1192
+ outline: string;
1193
+ backgroundColor: string;
1194
+ fontWeight: string;
1195
+ };
1196
+ button: {
1197
+ width: string;
1198
+ borderRadius: string;
1199
+ height: string;
1200
+ backgroundColor: string;
1201
+ color: string;
1202
+ fontSize: string;
1203
+ fontWeight: string;
1204
+ border: string;
1205
+ cursor: string;
1206
+ marginTop: string;
1207
+ boxShadow: string;
1208
+ letterSpacing: string;
1209
+ display: string;
1210
+ alignItems: string;
1211
+ justifyContent: string;
1212
+ gap: string;
1213
+ transition: string;
1214
+ };
1215
+ buttonSecondary: {
1216
+ backgroundColor: string;
1217
+ boxShadow: string;
1218
+ };
1219
+ buttonDisabled: {
1220
+ opacity: number;
1221
+ cursor: string;
1222
+ };
1223
+ linkButton: {
1224
+ background: string;
1225
+ border: string;
1226
+ color: string;
1227
+ fontSize: string;
1228
+ fontWeight: string;
1229
+ cursor: string;
1230
+ textDecoration: string;
1231
+ padding: string;
1232
+ textAlign: "center";
1233
+ };
1234
+ errorContainer: {
1235
+ display: string;
1236
+ alignItems: string;
1237
+ backgroundColor: string;
1238
+ padding: string;
1239
+ borderRadius: string;
1240
+ marginBottom: string;
1241
+ border: string;
1242
+ };
1243
+ successContainer: {
1244
+ display: string;
1245
+ alignItems: string;
1246
+ backgroundColor: string;
1247
+ padding: string;
1248
+ borderRadius: string;
1249
+ marginBottom: string;
1250
+ border: string;
1251
+ };
1252
+ warningContainer: {
1253
+ display: string;
1254
+ alignItems: string;
1255
+ backgroundColor: string;
1256
+ padding: string;
1257
+ borderRadius: string;
1258
+ marginBottom: string;
1259
+ border: string;
1260
+ };
1261
+ errorText: {
1262
+ color: string;
1263
+ fontSize: string;
1264
+ marginLeft: string;
1265
+ fontWeight: string;
1266
+ };
1267
+ successText: {
1268
+ color: string;
1269
+ fontSize: string;
1270
+ marginLeft: string;
1271
+ fontWeight: string;
1272
+ };
1273
+ warningText: {
1274
+ color: string;
1275
+ fontSize: string;
1276
+ marginLeft: string;
1277
+ fontWeight: string;
1278
+ };
1279
+ };
1280
+
1281
+ /**
1282
+ * Pubflow context value
1283
+ */
1284
+ interface PubflowContextValue {
1285
+ instances: Record<string, PubflowInstance>;
1286
+ defaultInstance: string;
1287
+ }
1288
+ /**
1289
+ * Pubflow instance
1290
+ */
1291
+ interface PubflowInstance {
1292
+ config: PubflowInstanceConfig;
1293
+ apiClient: ApiClient;
1294
+ authService: AuthService;
1295
+ user: User | null | undefined;
1296
+ isAuthenticated: boolean;
1297
+ isLoading: boolean;
1298
+ login: (credentials: {
1299
+ email?: string;
1300
+ userName?: string;
1301
+ password: string;
1302
+ }) => Promise<any>;
1303
+ logout: () => Promise<void>;
1304
+ validateSession: () => Promise<{
1305
+ isValid: boolean;
1306
+ expiresAt?: string;
1307
+ user?: User;
1308
+ }>;
1309
+ }
1310
+ /**
1311
+ * Create Pubflow context
1312
+ */
1313
+ declare const PubflowContext: React.Context<PubflowContextValue>;
1314
+ /**
1315
+ * Persistent cache configuration
1316
+ */
1317
+ interface PersistentCacheConfig {
1318
+ /**
1319
+ * Whether to enable persistent cache
1320
+ */
1321
+ enabled: boolean;
1322
+ /**
1323
+ * Cache provider function
1324
+ */
1325
+ provider?: () => Map<any, any>;
1326
+ /**
1327
+ * Cache options
1328
+ */
1329
+ options?: any;
1330
+ }
1331
+ /**
1332
+ * Pubflow provider props
1333
+ */
1334
+ interface PubflowProviderProps {
1335
+ children: React.ReactNode;
1336
+ config?: PubflowInstanceConfig;
1337
+ instances?: PubflowInstanceConfig[];
1338
+ defaultInstance?: string;
1339
+ onSessionExpired?: () => void;
1340
+ onSessionRefreshed?: () => void;
1341
+ showSessionAlerts?: boolean;
1342
+ /**
1343
+ * Persistent cache configuration
1344
+ */
1345
+ persistentCache?: PersistentCacheConfig;
1346
+ /**
1347
+ * Login redirect path (for automatic redirects)
1348
+ */
1349
+ loginRedirectPath?: string;
1350
+ /**
1351
+ * Public paths that don't require authentication
1352
+ */
1353
+ publicPaths?: string[];
1354
+ /**
1355
+ * Enable debug tools
1356
+ * When enabled, debug utilities will be available
1357
+ * Default: false
1358
+ */
1359
+ enableDebugTools?: boolean;
1360
+ /**
1361
+ * Theme configuration
1362
+ */
1363
+ theme?: {
1364
+ primaryColor?: string;
1365
+ secondaryColor?: string;
1366
+ appName?: string;
1367
+ logo?: string | React.ReactNode;
1368
+ };
1369
+ }
1370
+ /**
1371
+ * Pubflow provider for React
1372
+ */
1373
+ declare function PubflowProvider({ children, config, instances, defaultInstance, onSessionExpired, onSessionRefreshed, showSessionAlerts, persistentCache, loginRedirectPath, publicPaths, enableDebugTools, theme }: PubflowProviderProps): react_jsx_runtime.JSX.Element | null;
1374
+
1375
+ /**
1376
+ * Authentication Hook for React
1377
+ *
1378
+ * Provides a hook for accessing authentication functionality
1379
+ */
1380
+
1381
+ /**
1382
+ * Authentication hook result
1383
+ */
1384
+ interface UseAuthResult {
1385
+ user: User | null;
1386
+ isAuthenticated: boolean;
1387
+ isLoading: boolean;
1388
+ login: (credentials: {
1389
+ email?: string;
1390
+ userName?: string;
1391
+ password: string;
1392
+ }) => Promise<any>;
1393
+ logout: () => Promise<void>;
1394
+ validateSession: () => Promise<{
1395
+ isValid: boolean;
1396
+ expiresAt?: string;
1397
+ }>;
1398
+ refreshUser: () => Promise<User | null>;
1399
+ }
1400
+ /**
1401
+ * Hook for accessing authentication functionality
1402
+ *
1403
+ * @param instanceId Pubflow instance ID
1404
+ * @returns Authentication hook result
1405
+ */
1406
+ declare function useAuth(instanceId?: string): UseAuthResult;
1407
+
1408
+ /**
1409
+ * Bridge API Hook for React
1410
+ *
1411
+ * Provides a hook for accessing Bridge API functionality
1412
+ */
1413
+
1414
+ /**
1415
+ * Hook for accessing Bridge API functionality
1416
+ *
1417
+ * @param config Entity configuration
1418
+ * @param instanceId Pubflow instance ID
1419
+ * @returns Bridge API service
1420
+ */
1421
+ declare function useBridgeApi<T extends EntityData>(config: EntityConfig, instanceId?: string): BridgeApiService<T>;
1422
+
1423
+ /**
1424
+ * Bridge API Raw Hook for React
1425
+ *
1426
+ * Provides raw API access for custom operations
1427
+ */
1428
+ /**
1429
+ * Raw API request options
1430
+ */
1431
+ interface RawApiRequestOptions {
1432
+ /**
1433
+ * HTTP method
1434
+ */
1435
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
1436
+ /**
1437
+ * Request headers
1438
+ */
1439
+ headers?: Record<string, string>;
1440
+ /**
1441
+ * Request body
1442
+ */
1443
+ body?: any;
1444
+ /**
1445
+ * Whether to include session in request
1446
+ */
1447
+ includeSession?: boolean;
1448
+ /**
1449
+ * Request timeout in milliseconds
1450
+ */
1451
+ timeout?: number;
1452
+ }
1453
+ /**
1454
+ * Raw API response
1455
+ */
1456
+ interface RawApiResponse<T = any> {
1457
+ /**
1458
+ * Response data
1459
+ */
1460
+ data: T;
1461
+ /**
1462
+ * Response status
1463
+ */
1464
+ status: number;
1465
+ /**
1466
+ * Response headers
1467
+ */
1468
+ headers: Record<string, string>;
1469
+ /**
1470
+ * Whether the request was successful
1471
+ */
1472
+ success: boolean;
1473
+ /**
1474
+ * Error message if any
1475
+ */
1476
+ error?: string;
1477
+ }
1478
+ /**
1479
+ * Bridge API Raw hook result
1480
+ */
1481
+ interface UseBridgeApiRawResult {
1482
+ /**
1483
+ * Make a raw API request
1484
+ */
1485
+ request: <T = any>(endpoint: string, options?: RawApiRequestOptions) => Promise<RawApiResponse<T>>;
1486
+ /**
1487
+ * GET request shorthand
1488
+ */
1489
+ get: <T = any>(endpoint: string, options?: Omit<RawApiRequestOptions, 'method'>) => Promise<RawApiResponse<T>>;
1490
+ /**
1491
+ * POST request shorthand
1492
+ */
1493
+ post: <T = any>(endpoint: string, body?: any, options?: Omit<RawApiRequestOptions, 'method' | 'body'>) => Promise<RawApiResponse<T>>;
1494
+ /**
1495
+ * PUT request shorthand
1496
+ */
1497
+ put: <T = any>(endpoint: string, body?: any, options?: Omit<RawApiRequestOptions, 'method' | 'body'>) => Promise<RawApiResponse<T>>;
1498
+ /**
1499
+ * DELETE request shorthand
1500
+ */
1501
+ delete: <T = any>(endpoint: string, options?: Omit<RawApiRequestOptions, 'method'>) => Promise<RawApiResponse<T>>;
1502
+ /**
1503
+ * PATCH request shorthand
1504
+ */
1505
+ patch: <T = any>(endpoint: string, body?: any, options?: Omit<RawApiRequestOptions, 'method' | 'body'>) => Promise<RawApiResponse<T>>;
1506
+ }
1507
+ /**
1508
+ * Hook for raw Bridge API access
1509
+ *
1510
+ * @param instanceId Pubflow instance ID
1511
+ * @returns Raw API hook result
1512
+ */
1513
+ declare function useBridgeApiRaw(instanceId?: string): UseBridgeApiRawResult;
1514
+
1515
+ /**
1516
+ * Bridge Query Hook for React
1517
+ *
1518
+ * Provides a hook for querying data using Bridge API with SWR
1519
+ */
1520
+
1521
+ /**
1522
+ * Bridge query types
1523
+ */
1524
+ type QueryType = 'list' | 'get' | 'search';
1525
+ /**
1526
+ * Bridge query parameters
1527
+ */
1528
+ type BridgeQueryParams<T> = T extends 'list' ? QueryParams : T extends 'get' ? {
1529
+ id: string;
1530
+ params?: QueryParams;
1531
+ } : T extends 'search' ? SearchParams : never;
1532
+ /**
1533
+ * Bridge query hook result
1534
+ */
1535
+ interface UseBridgeQueryResult<T extends EntityData, Q extends QueryType> {
1536
+ data: Q extends 'list' | 'search' ? T[] : T | null;
1537
+ meta: Q extends 'list' | 'search' ? {
1538
+ page: number;
1539
+ limit: number;
1540
+ total: number;
1541
+ hasMore: boolean;
1542
+ } : null;
1543
+ isLoading: boolean;
1544
+ error: Error | null;
1545
+ refetch: () => Promise<void>;
1546
+ }
1547
+ /**
1548
+ * Hook for querying data using Bridge API with SWR
1549
+ *
1550
+ * @param service Bridge API service
1551
+ * @param type Query type
1552
+ * @param params Query parameters
1553
+ * @param config SWR configuration
1554
+ * @returns Query result
1555
+ */
1556
+ declare function useBridgeQuery<T extends EntityData, Q extends QueryType>(service: BridgeApiService<T>, type: Q, params: BridgeQueryParams<Q>, config?: SWRConfiguration): UseBridgeQueryResult<T, Q>;
1557
+
1558
+ /**
1559
+ * Server Authentication Hook for React
1560
+ *
1561
+ * Provides a hook for handling authentication with automatic redirects
1562
+ */
1563
+ /**
1564
+ * Server authentication hook options
1565
+ */
1566
+ interface UseServerAuthOptions {
1567
+ /**
1568
+ * Path to redirect to when not authenticated
1569
+ */
1570
+ loginRedirectPath?: string;
1571
+ /**
1572
+ * User types allowed to access the page
1573
+ */
1574
+ allowedTypes?: string[];
1575
+ /**
1576
+ * Whether to validate the session on mount
1577
+ */
1578
+ validateOnMount?: boolean;
1579
+ /**
1580
+ * Pubflow instance ID
1581
+ */
1582
+ instanceId?: string;
1583
+ /**
1584
+ * Custom redirect function
1585
+ */
1586
+ onRedirect?: (path: string) => void;
1587
+ }
1588
+ /**
1589
+ * Hook for handling authentication with automatic redirects
1590
+ *
1591
+ * @param options Hook options
1592
+ * @returns Authentication hook result
1593
+ */
1594
+ declare function useServerAuth({ loginRedirectPath, allowedTypes, validateOnMount, instanceId, onRedirect }?: UseServerAuthOptions): {
1595
+ user: _pubflow_core.User | null;
1596
+ isAuthenticated: boolean;
1597
+ isLoading: boolean;
1598
+ validateSession: () => Promise<{
1599
+ isValid: boolean;
1600
+ expiresAt?: string;
1601
+ }>;
1602
+ };
1603
+
1604
+ /**
1605
+ * Search Query Builder Hook for React
1606
+ *
1607
+ * Provides utilities for building complex search queries
1608
+ */
1609
+
1610
+ /**
1611
+ * Search field definition
1612
+ */
1613
+ interface SearchField {
1614
+ /**
1615
+ * Field name
1616
+ */
1617
+ name: string;
1618
+ /**
1619
+ * Display label
1620
+ */
1621
+ label: string;
1622
+ /**
1623
+ * Field type
1624
+ */
1625
+ type: 'text' | 'number' | 'date' | 'boolean' | 'select';
1626
+ /**
1627
+ * Whether the field is searchable
1628
+ */
1629
+ searchable?: boolean;
1630
+ /**
1631
+ * Whether the field is filterable
1632
+ */
1633
+ filterable?: boolean;
1634
+ /**
1635
+ * Whether the field is sortable
1636
+ */
1637
+ sortable?: boolean;
1638
+ /**
1639
+ * Options for select type
1640
+ */
1641
+ options?: {
1642
+ label: string;
1643
+ value: any;
1644
+ }[];
1645
+ /**
1646
+ * Default operator for this field
1647
+ */
1648
+ defaultOperator?: FilterOperator;
1649
+ }
1650
+ /**
1651
+ * Search query state
1652
+ */
1653
+ interface SearchQueryState {
1654
+ /**
1655
+ * Search term
1656
+ */
1657
+ searchTerm: string;
1658
+ /**
1659
+ * Active filters
1660
+ */
1661
+ filters: FilterDefinition[];
1662
+ /**
1663
+ * Sort field
1664
+ */
1665
+ sortField?: string;
1666
+ /**
1667
+ * Sort direction
1668
+ */
1669
+ sortDirection?: 'asc' | 'desc';
1670
+ /**
1671
+ * Current page
1672
+ */
1673
+ page: number;
1674
+ /**
1675
+ * Items per page
1676
+ */
1677
+ limit: number;
1678
+ }
1679
+ /**
1680
+ * Search query builder hook result
1681
+ */
1682
+ interface UseSearchQueryBuilderResult {
1683
+ /**
1684
+ * Current query state
1685
+ */
1686
+ queryState: SearchQueryState;
1687
+ /**
1688
+ * Set search term
1689
+ */
1690
+ setSearchTerm: (term: string) => void;
1691
+ /**
1692
+ * Add a filter
1693
+ */
1694
+ addFilter: (filter: FilterDefinition) => void;
1695
+ /**
1696
+ * Remove a filter by index
1697
+ */
1698
+ removeFilter: (index: number) => void;
1699
+ /**
1700
+ * Update a filter
1701
+ */
1702
+ updateFilter: (index: number, filter: FilterDefinition) => void;
1703
+ /**
1704
+ * Clear all filters
1705
+ */
1706
+ clearFilters: () => void;
1707
+ /**
1708
+ * Set sort
1709
+ */
1710
+ setSort: (field: string, direction: 'asc' | 'desc') => void;
1711
+ /**
1712
+ * Clear sort
1713
+ */
1714
+ clearSort: () => void;
1715
+ /**
1716
+ * Set page
1717
+ */
1718
+ setPage: (page: number) => void;
1719
+ /**
1720
+ * Set limit
1721
+ */
1722
+ setLimit: (limit: number) => void;
1723
+ /**
1724
+ * Reset query to initial state
1725
+ */
1726
+ resetQuery: () => void;
1727
+ /**
1728
+ * Build query string for API
1729
+ */
1730
+ buildQueryString: () => string;
1731
+ /**
1732
+ * Build query object for API
1733
+ */
1734
+ buildQueryObject: () => Record<string, any>;
1735
+ /**
1736
+ * Get searchable fields
1737
+ */
1738
+ getSearchableFields: () => SearchField[];
1739
+ /**
1740
+ * Get filterable fields
1741
+ */
1742
+ getFilterableFields: () => SearchField[];
1743
+ /**
1744
+ * Get sortable fields
1745
+ */
1746
+ getSortableFields: () => SearchField[];
1747
+ }
1748
+ /**
1749
+ * Hook for building search queries
1750
+ *
1751
+ * @param fields Available search fields
1752
+ * @param initialState Initial query state
1753
+ * @returns Search query builder result
1754
+ */
1755
+ declare function useSearchQueryBuilder(fields: SearchField[], initialState?: Partial<SearchQueryState>): UseSearchQueryBuilderResult;
1756
+
1757
+ /**
1758
+ * Browser Storage Adapter for React
1759
+ *
1760
+ * Provides a storage adapter for React applications using localStorage
1761
+ */
1762
+
1763
+ /**
1764
+ * Options for the browser storage adapter
1765
+ */
1766
+ interface BrowserStorageOptions {
1767
+ /**
1768
+ * Prefix for storage keys
1769
+ */
1770
+ prefix?: string;
1771
+ /**
1772
+ * Whether to use sessionStorage instead of localStorage
1773
+ */
1774
+ useSessionStorage?: boolean;
1775
+ /**
1776
+ * Whether to use cookies as fallback when localStorage/sessionStorage is not available
1777
+ */
1778
+ useCookieFallback?: boolean;
1779
+ /**
1780
+ * Cookie options when using cookie fallback
1781
+ */
1782
+ cookieOptions?: {
1783
+ /**
1784
+ * Cookie expiration in days
1785
+ */
1786
+ maxAge?: number;
1787
+ /**
1788
+ * Cookie path
1789
+ */
1790
+ path?: string;
1791
+ /**
1792
+ * Whether the cookie should be secure
1793
+ */
1794
+ secure?: boolean;
1795
+ /**
1796
+ * Whether the cookie should be HTTP only
1797
+ */
1798
+ httpOnly?: boolean;
1799
+ /**
1800
+ * SameSite attribute for the cookie
1801
+ */
1802
+ sameSite?: 'strict' | 'lax' | 'none';
1803
+ };
1804
+ }
1805
+ /**
1806
+ * Browser storage adapter for React
1807
+ * Uses localStorage or sessionStorage with cookie fallback
1808
+ */
1809
+ declare class BrowserStorageAdapter implements StorageAdapter {
1810
+ private prefix;
1811
+ private useSessionStorage;
1812
+ private useCookieFallback;
1813
+ private cookieOptions;
1814
+ /**
1815
+ * Create a new browser storage adapter
1816
+ *
1817
+ * @param options Storage options
1818
+ */
1819
+ constructor(options?: BrowserStorageOptions);
1820
+ /**
1821
+ * Get a value from storage
1822
+ *
1823
+ * @param key Storage key
1824
+ * @returns Stored value or null
1825
+ */
1826
+ getItem(key: string): Promise<string | null>;
1827
+ /**
1828
+ * Save a value to storage
1829
+ *
1830
+ * @param key Storage key
1831
+ * @param value Value to store
1832
+ */
1833
+ setItem(key: string, value: string): Promise<void>;
1834
+ /**
1835
+ * Remove a value from storage
1836
+ *
1837
+ * @param key Storage key
1838
+ */
1839
+ removeItem(key: string): Promise<void>;
1840
+ /**
1841
+ * Clear all values with the current prefix
1842
+ */
1843
+ clear(): Promise<void>;
1844
+ /**
1845
+ * Get a cookie value
1846
+ *
1847
+ * @param key Cookie key
1848
+ * @returns Cookie value or null
1849
+ */
1850
+ private getCookie;
1851
+ /**
1852
+ * Set a cookie value
1853
+ *
1854
+ * @param key Cookie key
1855
+ * @param value Cookie value
1856
+ */
1857
+ private setCookie;
1858
+ /**
1859
+ * Remove a cookie
1860
+ *
1861
+ * @param key Cookie key
1862
+ */
1863
+ private removeCookie;
1864
+ /**
1865
+ * Clear all cookies with the current prefix
1866
+ */
1867
+ private clearCookies;
1868
+ }
1869
+
1870
+ /**
1871
+ * Authentication Utilities for React
1872
+ *
1873
+ * Provides utilities for authentication in React applications
1874
+ */
1875
+ /**
1876
+ * Options for the useRequireAuth hook
1877
+ */
1878
+ interface UseRequireAuthOptions {
1879
+ /**
1880
+ * User types allowed to access the route
1881
+ */
1882
+ allowedTypes?: string | string[];
1883
+ /**
1884
+ * Redirect function
1885
+ */
1886
+ redirectFn?: (path: string) => void;
1887
+ /**
1888
+ * Redirect path when not authenticated
1889
+ */
1890
+ redirectTo?: string;
1891
+ /**
1892
+ * Pubflow instance ID
1893
+ */
1894
+ instanceId?: string;
1895
+ }
1896
+ /**
1897
+ * Hook for requiring authentication
1898
+ *
1899
+ * @param options Authentication options
1900
+ * @returns Authentication result
1901
+ */
1902
+ declare function useRequireAuth(options?: UseRequireAuthOptions): {
1903
+ user: _pubflow_core.User | null;
1904
+ isAuthenticated: boolean;
1905
+ isLoading: boolean;
1906
+ };
1907
+
1908
+ export { AccountCreationForm, AccountCreationFormConfig, AccountCreationFormProps, AdvancedFilter, AdvancedFilterColors, AdvancedFilterProps, AdvancedFilterTexts, BridgeForm, BridgeFormProps, BridgeList, BridgeListColors, BridgeListLayout, BridgeListProps, BridgeListRenderItemProps, BridgeListTexts, BridgeTable, BridgeTableProps, BridgeView, BridgeViewProps, BrowserStorageAdapter, BrowserStorageOptions, ColumnDef, FieldConfig, FieldRenderProps, FilterField, LoginForm, LoginFormConfig, LoginFormProps, MutationOptions, OfflineIndicator, OfflineIndicatorProps, PasswordResetForm, PasswordResetFormConfig, PasswordResetFormProps, PersistentCacheConfig, PubflowContext, PubflowContextValue, PubflowInstance, PubflowProvider, PubflowProviderProps, RawApiRequestOptions, RawApiResponse, SearchField, SearchQueryState, ThemeConfig, ThemeProvider, ThemeProviderProps, UseAuthResult, UseBridgeApiRawResult, UseBridgeMutationResult, UseBridgeQueryResult, UseRequireAuthOptions, UseSearchQueryBuilderResult, UseServerAuthOptions, createStyles, generateCSSVariables, useAuth, useBridgeApi, useBridgeApiRaw, useBridgeCrud, useBridgeMutation, useBridgeQuery, useNetworkStatus, useRequireAuth, useSearchQueryBuilder, useServerAuth, useTheme };