@djangocfg/ext-support 1.0.24 → 1.0.26

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/dist/config.cjs +1 -1
  2. package/dist/config.js +1 -1
  3. package/dist/hooks.cjs +398 -334
  4. package/dist/hooks.d.cts +6 -2
  5. package/dist/hooks.d.ts +6 -2
  6. package/dist/hooks.js +356 -291
  7. package/dist/i18n.cjs +72 -72
  8. package/dist/i18n.js +73 -73
  9. package/dist/index-D-xo66K9.d.cts +862 -0
  10. package/dist/index-D-xo66K9.d.ts +863 -0
  11. package/dist/index-Dov7pn8Z.d.ts +2 -1
  12. package/dist/index-rR_XqXq1.d.cts +838 -0
  13. package/dist/index-rR_XqXq1.d.ts +838 -0
  14. package/dist/index.cjs +398 -334
  15. package/dist/index.d.cts +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +356 -291
  18. package/package.json +8 -8
  19. package/src/adapters/api.ts +4 -5
  20. package/src/adapters/demo.ts +2 -1
  21. package/src/api/generated/ext_support/_utils/fetchers/ext_support__support.ts +4 -4
  22. package/src/api/generated/ext_support/_utils/hooks/ext_support__support.ts +2 -2
  23. package/src/api/generated/ext_support/_utils/schemas/Ticket.schema.ts +1 -1
  24. package/src/api/generated/ext_support/_utils/schemas/TicketRequest.schema.ts +1 -1
  25. package/src/api/generated/ext_support/enums.ts +0 -30
  26. package/src/api/generated/ext_support/ext_support__support/client.ts +6 -6
  27. package/src/api/generated/ext_support/ext_support__support/models.ts +2 -2
  28. package/src/api/generated/ext_support/schema.json +36 -0
  29. package/src/components/CreateTicketSheet.tsx +7 -12
  30. package/src/components/SupportHero.tsx +35 -47
  31. package/src/components/TicketItem.tsx +28 -74
  32. package/src/components/TicketList.tsx +30 -23
  33. package/src/components/TicketSheet.tsx +246 -162
  34. package/src/contexts/SupportExtensionProvider.tsx +4 -4
  35. package/src/contexts/types.ts +2 -2
  36. package/src/i18n/useSupportT.ts +3 -3
  37. package/src/utils/status.ts +44 -0
  38. package/src/utils/time.ts +88 -0
@@ -0,0 +1,863 @@
1
+ import { ConsolaInstance } from 'consola';
2
+ import { ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { z } from 'zod';
5
+
6
+ import * as _djangocfg_ext_base from '@djangocfg/ext-base';
7
+
8
+ /**
9
+ * * `open` - Open
10
+ * * `waiting_for_user` - Waiting for User
11
+ * * `waiting_for_admin` - Waiting for Admin
12
+ * * `resolved` - Resolved
13
+ * * `closed` - Closed
14
+ */
15
+ declare enum PatchedTicketRequestStatus {
16
+ OPEN = "open",
17
+ WAITING_FOR_USER = "waiting_for_user",
18
+ WAITING_FOR_ADMIN = "waiting_for_admin",
19
+ RESOLVED = "resolved",
20
+ CLOSED = "closed"
21
+ }
22
+ /**
23
+ * * `open` - Open
24
+ * * `waiting_for_user` - Waiting for User
25
+ * * `waiting_for_admin` - Waiting for Admin
26
+ * * `resolved` - Resolved
27
+ * * `closed` - Closed
28
+ */
29
+ declare enum TicketStatus {
30
+ OPEN = "open",
31
+ WAITING_FOR_USER = "waiting_for_user",
32
+ WAITING_FOR_ADMIN = "waiting_for_admin",
33
+ RESOLVED = "resolved",
34
+ CLOSED = "closed"
35
+ }
36
+ /**
37
+ * * `open` - Open
38
+ * * `waiting_for_user` - Waiting for User
39
+ * * `waiting_for_admin` - Waiting for Admin
40
+ * * `resolved` - Resolved
41
+ * * `closed` - Closed
42
+ */
43
+ declare enum TicketRequestStatus {
44
+ OPEN = "open",
45
+ WAITING_FOR_USER = "waiting_for_user",
46
+ WAITING_FOR_ADMIN = "waiting_for_admin",
47
+ RESOLVED = "resolved",
48
+ CLOSED = "closed"
49
+ }
50
+
51
+ /**
52
+ *
53
+ * Response model (includes read-only fields).
54
+ */
55
+ interface PaginatedTicketList$1 {
56
+ /** Total number of items across all pages */
57
+ count: number;
58
+ /** Current page number (1-based) */
59
+ page: number;
60
+ /** Total number of pages */
61
+ pages: number;
62
+ /** Number of items per page */
63
+ page_size: number;
64
+ /** Whether there is a next page */
65
+ has_next: boolean;
66
+ /** Whether there is a previous page */
67
+ has_previous: boolean;
68
+ /** Next page number (null if no next page) */
69
+ next_page?: number | null;
70
+ /** Previous page number (null if no previous page) */
71
+ previous_page?: number | null;
72
+ /** Array of items for current page */
73
+ results: Array<Ticket$1>;
74
+ }
75
+ /**
76
+ *
77
+ * Request model (no read-only fields).
78
+ */
79
+ interface TicketRequest$1 {
80
+ user: number;
81
+ subject: string;
82
+ /** * `open` - Open
83
+ * `waiting_for_user` - Waiting for User
84
+ * `waiting_for_admin` - Waiting for Admin
85
+ * `resolved` - Resolved
86
+ * `closed` - Closed */
87
+ status?: TicketRequestStatus;
88
+ }
89
+ /**
90
+ *
91
+ * Response model (includes read-only fields).
92
+ */
93
+ interface Ticket$1 {
94
+ uuid: string;
95
+ user: number;
96
+ subject: string;
97
+ /** * `open` - Open
98
+ * `waiting_for_user` - Waiting for User
99
+ * `waiting_for_admin` - Waiting for Admin
100
+ * `resolved` - Resolved
101
+ * `closed` - Closed */
102
+ status?: TicketStatus;
103
+ created_at: string;
104
+ /** Get count of unanswered messages for this specific ticket. */
105
+ unanswered_messages_count: number;
106
+ }
107
+ /**
108
+ *
109
+ * Response model (includes read-only fields).
110
+ */
111
+ interface PaginatedMessageList$1 {
112
+ /** Total number of items across all pages */
113
+ count: number;
114
+ /** Current page number (1-based) */
115
+ page: number;
116
+ /** Total number of pages */
117
+ pages: number;
118
+ /** Number of items per page */
119
+ page_size: number;
120
+ /** Whether there is a next page */
121
+ has_next: boolean;
122
+ /** Whether there is a previous page */
123
+ has_previous: boolean;
124
+ /** Next page number (null if no next page) */
125
+ next_page?: number | null;
126
+ /** Previous page number (null if no previous page) */
127
+ previous_page?: number | null;
128
+ /** Array of items for current page */
129
+ results: Array<Message$1>;
130
+ }
131
+ /**
132
+ *
133
+ * Request model (no read-only fields).
134
+ */
135
+ interface MessageCreateRequest$1 {
136
+ text: string;
137
+ }
138
+ /**
139
+ *
140
+ * Response model (includes read-only fields).
141
+ */
142
+ interface MessageCreate {
143
+ text: string;
144
+ }
145
+ /**
146
+ *
147
+ * Response model (includes read-only fields).
148
+ */
149
+ interface Message$1 {
150
+ uuid: string;
151
+ ticket: string;
152
+ sender: Sender;
153
+ /** Check if this message is from the ticket author. */
154
+ is_from_author: boolean;
155
+ text: string;
156
+ created_at: string;
157
+ }
158
+ /**
159
+ *
160
+ * Request model (no read-only fields).
161
+ */
162
+ interface MessageRequest$1 {
163
+ text: string;
164
+ }
165
+ /**
166
+ *
167
+ * Request model (no read-only fields).
168
+ */
169
+ interface PatchedMessageRequest$1 {
170
+ text?: string;
171
+ }
172
+ /**
173
+ *
174
+ * Request model (no read-only fields).
175
+ */
176
+ interface PatchedTicketRequest$1 {
177
+ user?: number;
178
+ subject?: string;
179
+ /** * `open` - Open
180
+ * `waiting_for_user` - Waiting for User
181
+ * `waiting_for_admin` - Waiting for Admin
182
+ * `resolved` - Resolved
183
+ * `closed` - Closed */
184
+ status?: PatchedTicketRequestStatus;
185
+ }
186
+ /**
187
+ *
188
+ * Response model (includes read-only fields).
189
+ */
190
+ interface Sender {
191
+ id: number;
192
+ /** Get formatted username for display. */
193
+ display_username: string;
194
+ email: string;
195
+ avatar?: string | null;
196
+ /** Get user's initials for avatar fallback. */
197
+ initials: string;
198
+ /** Designates whether the user can log into this admin site. */
199
+ is_staff: boolean;
200
+ /** Designates that this user has all permissions without explicitly assigning them. */
201
+ is_superuser: boolean;
202
+ }
203
+
204
+ /**
205
+ * API endpoints for Support.
206
+ */
207
+ declare class ExtSupportSupport {
208
+ private client;
209
+ constructor(client: any);
210
+ ticketsList(page?: number, page_size?: number): Promise<PaginatedTicketList$1>;
211
+ ticketsList(params?: {
212
+ page?: number;
213
+ page_size?: number;
214
+ }): Promise<PaginatedTicketList$1>;
215
+ /**
216
+ * ViewSet for managing support tickets. Requires authenticated user (JWT
217
+ * or Session). Staff users can see all tickets, regular users see only
218
+ * their own.
219
+ */
220
+ ticketsCreate(data: TicketRequest$1): Promise<Ticket$1>;
221
+ ticketsMessagesList(ticket_uuid: string, page?: number, page_size?: number): Promise<PaginatedMessageList$1>;
222
+ ticketsMessagesList(ticket_uuid: string, params?: {
223
+ page?: number;
224
+ page_size?: number;
225
+ }): Promise<PaginatedMessageList$1>;
226
+ /**
227
+ * ViewSet for managing support messages. Requires authenticated user (JWT
228
+ * or Session). Users can only access messages for their own tickets.
229
+ */
230
+ ticketsMessagesCreate(ticket_uuid: string, data: MessageCreateRequest$1): Promise<MessageCreate>;
231
+ /**
232
+ * ViewSet for managing support messages. Requires authenticated user (JWT
233
+ * or Session). Users can only access messages for their own tickets.
234
+ */
235
+ ticketsMessagesRetrieve(ticket_uuid: string, uuid: string): Promise<Message$1>;
236
+ /**
237
+ * ViewSet for managing support messages. Requires authenticated user (JWT
238
+ * or Session). Users can only access messages for their own tickets.
239
+ */
240
+ ticketsMessagesUpdate(ticket_uuid: string, uuid: string, data: MessageRequest$1): Promise<Message$1>;
241
+ /**
242
+ * ViewSet for managing support messages. Requires authenticated user (JWT
243
+ * or Session). Users can only access messages for their own tickets.
244
+ */
245
+ ticketsMessagesPartialUpdate(ticket_uuid: string, uuid: string, data?: PatchedMessageRequest$1): Promise<Message$1>;
246
+ /**
247
+ * ViewSet for managing support messages. Requires authenticated user (JWT
248
+ * or Session). Users can only access messages for their own tickets.
249
+ */
250
+ ticketsMessagesDestroy(ticket_uuid: string, uuid: string): Promise<void>;
251
+ /**
252
+ * ViewSet for managing support tickets. Requires authenticated user (JWT
253
+ * or Session). Staff users can see all tickets, regular users see only
254
+ * their own.
255
+ */
256
+ ticketsRetrieve(uuid: string): Promise<Ticket$1>;
257
+ /**
258
+ * ViewSet for managing support tickets. Requires authenticated user (JWT
259
+ * or Session). Staff users can see all tickets, regular users see only
260
+ * their own.
261
+ */
262
+ ticketsUpdate(uuid: string, data: TicketRequest$1): Promise<Ticket$1>;
263
+ /**
264
+ * ViewSet for managing support tickets. Requires authenticated user (JWT
265
+ * or Session). Staff users can see all tickets, regular users see only
266
+ * their own.
267
+ */
268
+ ticketsPartialUpdate(uuid: string, data?: PatchedTicketRequest$1): Promise<Ticket$1>;
269
+ /**
270
+ * ViewSet for managing support tickets. Requires authenticated user (JWT
271
+ * or Session). Staff users can see all tickets, regular users see only
272
+ * their own.
273
+ */
274
+ ticketsDestroy(uuid: string): Promise<void>;
275
+ }
276
+
277
+ /**
278
+ * API Logger with Consola
279
+ * Beautiful console logging for API requests and responses
280
+ *
281
+ * Installation:
282
+ * npm install consola
283
+ */
284
+
285
+ /**
286
+ * Logger configuration
287
+ */
288
+ interface LoggerConfig {
289
+ /** Enable logging */
290
+ enabled: boolean;
291
+ /** Log requests */
292
+ logRequests: boolean;
293
+ /** Log responses */
294
+ logResponses: boolean;
295
+ /** Log errors */
296
+ logErrors: boolean;
297
+ /** Log request/response bodies */
298
+ logBodies: boolean;
299
+ /** Log headers (excluding sensitive ones) */
300
+ logHeaders: boolean;
301
+ /** Custom consola instance */
302
+ consola?: ConsolaInstance;
303
+ }
304
+
305
+ /**
306
+ * Retry Configuration and Utilities
307
+ *
308
+ * Provides automatic retry logic for failed HTTP requests using p-retry.
309
+ * Retries only on network errors and server errors (5xx), not client errors (4xx).
310
+ */
311
+ /**
312
+ * Information about a failed retry attempt.
313
+ */
314
+ interface FailedAttemptInfo {
315
+ /** The error that caused the failure */
316
+ error: Error;
317
+ /** The attempt number (1-indexed) */
318
+ attemptNumber: number;
319
+ /** Number of retries left */
320
+ retriesLeft: number;
321
+ }
322
+ /**
323
+ * Retry configuration options.
324
+ *
325
+ * Uses exponential backoff with jitter by default to avoid thundering herd.
326
+ */
327
+ interface RetryConfig {
328
+ /**
329
+ * Maximum number of retry attempts.
330
+ * @default 3
331
+ */
332
+ retries?: number;
333
+ /**
334
+ * Exponential backoff factor.
335
+ * @default 2
336
+ */
337
+ factor?: number;
338
+ /**
339
+ * Minimum wait time between retries (ms).
340
+ * @default 1000
341
+ */
342
+ minTimeout?: number;
343
+ /**
344
+ * Maximum wait time between retries (ms).
345
+ * @default 60000
346
+ */
347
+ maxTimeout?: number;
348
+ /**
349
+ * Add randomness to wait times (jitter).
350
+ * Helps avoid thundering herd problem.
351
+ * @default true
352
+ */
353
+ randomize?: boolean;
354
+ /**
355
+ * Callback called on each failed attempt.
356
+ */
357
+ onFailedAttempt?: (info: FailedAttemptInfo) => void;
358
+ }
359
+
360
+ /**
361
+ * Storage adapters for cross-platform token storage.
362
+ *
363
+ * Supports:
364
+ * - LocalStorage (browser)
365
+ * - Cookies (SSR/browser)
366
+ * - Memory (Node.js/Electron/testing)
367
+ */
368
+
369
+ /**
370
+ * Storage adapter interface for cross-platform token storage.
371
+ */
372
+ interface StorageAdapter {
373
+ getItem(key: string): string | null;
374
+ setItem(key: string, value: string): void;
375
+ removeItem(key: string): void;
376
+ }
377
+
378
+ /**
379
+ * Zod schema for Message
380
+ *
381
+ * This schema provides runtime validation and type inference.
382
+ * */
383
+
384
+ declare const MessageSchema: z.ZodObject<{
385
+ uuid: z.ZodString;
386
+ ticket: z.ZodString;
387
+ sender: z.ZodObject<{
388
+ id: z.ZodInt;
389
+ display_username: z.ZodString;
390
+ email: z.ZodEmail;
391
+ avatar: z.ZodNullable<z.ZodString>;
392
+ initials: z.ZodString;
393
+ is_staff: z.ZodBoolean;
394
+ is_superuser: z.ZodBoolean;
395
+ }, z.core.$strip>;
396
+ is_from_author: z.ZodBoolean;
397
+ text: z.ZodString;
398
+ created_at: z.ZodString;
399
+ }, z.core.$strip>;
400
+ /**
401
+ * Infer TypeScript type from Zod schema
402
+ */
403
+ type Message = z.infer<typeof MessageSchema>;
404
+
405
+ /**
406
+ * Zod schema for MessageCreateRequest
407
+ *
408
+ * This schema provides runtime validation and type inference.
409
+ * */
410
+
411
+ declare const MessageCreateRequestSchema: z.ZodObject<{
412
+ text: z.ZodString;
413
+ }, z.core.$strip>;
414
+ /**
415
+ * Infer TypeScript type from Zod schema
416
+ */
417
+ type MessageCreateRequest = z.infer<typeof MessageCreateRequestSchema>;
418
+
419
+ /**
420
+ * Zod schema for MessageRequest
421
+ *
422
+ * This schema provides runtime validation and type inference.
423
+ * */
424
+
425
+ declare const MessageRequestSchema: z.ZodObject<{
426
+ text: z.ZodString;
427
+ }, z.core.$strip>;
428
+ /**
429
+ * Infer TypeScript type from Zod schema
430
+ */
431
+ type MessageRequest = z.infer<typeof MessageRequestSchema>;
432
+
433
+ /**
434
+ * Zod schema for PaginatedMessageList
435
+ *
436
+ * This schema provides runtime validation and type inference.
437
+ * */
438
+
439
+ declare const PaginatedMessageListSchema: z.ZodObject<{
440
+ count: z.ZodInt;
441
+ page: z.ZodInt;
442
+ pages: z.ZodInt;
443
+ page_size: z.ZodInt;
444
+ has_next: z.ZodBoolean;
445
+ has_previous: z.ZodBoolean;
446
+ next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
447
+ previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
448
+ results: z.ZodArray<z.ZodObject<{
449
+ uuid: z.ZodString;
450
+ ticket: z.ZodString;
451
+ sender: z.ZodObject<{
452
+ id: z.ZodInt;
453
+ display_username: z.ZodString;
454
+ email: z.ZodEmail;
455
+ avatar: z.ZodNullable<z.ZodString>;
456
+ initials: z.ZodString;
457
+ is_staff: z.ZodBoolean;
458
+ is_superuser: z.ZodBoolean;
459
+ }, z.core.$strip>;
460
+ is_from_author: z.ZodBoolean;
461
+ text: z.ZodString;
462
+ created_at: z.ZodString;
463
+ }, z.core.$strip>>;
464
+ }, z.core.$strip>;
465
+ /**
466
+ * Infer TypeScript type from Zod schema
467
+ */
468
+ type PaginatedMessageList = z.infer<typeof PaginatedMessageListSchema>;
469
+
470
+ declare const PaginatedTicketListSchema: z.ZodObject<{
471
+ count: z.ZodInt;
472
+ page: z.ZodInt;
473
+ pages: z.ZodInt;
474
+ page_size: z.ZodInt;
475
+ has_next: z.ZodBoolean;
476
+ has_previous: z.ZodBoolean;
477
+ next_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
478
+ previous_page: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
479
+ results: z.ZodArray<z.ZodObject<{
480
+ uuid: z.ZodString;
481
+ user: z.ZodInt;
482
+ subject: z.ZodString;
483
+ status: z.ZodOptional<z.ZodEnum<typeof TicketStatus>>;
484
+ created_at: z.ZodString;
485
+ unanswered_messages_count: z.ZodInt;
486
+ }, z.core.$strip>>;
487
+ }, z.core.$strip>;
488
+ /**
489
+ * Infer TypeScript type from Zod schema
490
+ */
491
+ type PaginatedTicketList = z.infer<typeof PaginatedTicketListSchema>;
492
+
493
+ /**
494
+ * Zod schema for PatchedMessageRequest
495
+ *
496
+ * This schema provides runtime validation and type inference.
497
+ * */
498
+
499
+ declare const PatchedMessageRequestSchema: z.ZodObject<{
500
+ text: z.ZodOptional<z.ZodString>;
501
+ }, z.core.$strip>;
502
+ /**
503
+ * Infer TypeScript type from Zod schema
504
+ */
505
+ type PatchedMessageRequest = z.infer<typeof PatchedMessageRequestSchema>;
506
+
507
+ /**
508
+ * Zod schema for PatchedTicketRequest
509
+ *
510
+ * This schema provides runtime validation and type inference.
511
+ * */
512
+
513
+ declare const PatchedTicketRequestSchema: z.ZodObject<{
514
+ user: z.ZodOptional<z.ZodInt>;
515
+ subject: z.ZodOptional<z.ZodString>;
516
+ status: z.ZodOptional<z.ZodEnum<typeof PatchedTicketRequestStatus>>;
517
+ }, z.core.$strip>;
518
+ /**
519
+ * Infer TypeScript type from Zod schema
520
+ */
521
+ type PatchedTicketRequest = z.infer<typeof PatchedTicketRequestSchema>;
522
+
523
+ /**
524
+ * Zod schema for Ticket
525
+ *
526
+ * This schema provides runtime validation and type inference.
527
+ * */
528
+
529
+ declare const TicketSchema: z.ZodObject<{
530
+ uuid: z.ZodString;
531
+ user: z.ZodInt;
532
+ subject: z.ZodString;
533
+ status: z.ZodOptional<z.ZodEnum<typeof TicketStatus>>;
534
+ created_at: z.ZodString;
535
+ unanswered_messages_count: z.ZodInt;
536
+ }, z.core.$strip>;
537
+ /**
538
+ * Infer TypeScript type from Zod schema
539
+ */
540
+ type Ticket = z.infer<typeof TicketSchema>;
541
+
542
+ /**
543
+ * Zod schema for TicketRequest
544
+ *
545
+ * This schema provides runtime validation and type inference.
546
+ * */
547
+
548
+ declare const TicketRequestSchema: z.ZodObject<{
549
+ user: z.ZodInt;
550
+ subject: z.ZodString;
551
+ status: z.ZodOptional<z.ZodEnum<typeof TicketRequestStatus>>;
552
+ }, z.core.$strip>;
553
+ /**
554
+ * Infer TypeScript type from Zod schema
555
+ */
556
+ type TicketRequest = z.infer<typeof TicketRequestSchema>;
557
+
558
+ /**
559
+ * Django CFG API - API Client with JWT Management
560
+ *
561
+ * Usage:
562
+ * ```typescript
563
+ * import { API } from './api';
564
+ *
565
+ * const api = new API('https://api.example.com');
566
+ *
567
+ * // Set JWT token
568
+ * api.setToken('your-jwt-token', 'refresh-token');
569
+ *
570
+ * // Use API
571
+ * const posts = await api.posts.list();
572
+ * const user = await api.users.retrieve(1);
573
+ *
574
+ * // Check authentication
575
+ * if (api.isAuthenticated()) {
576
+ * // ...
577
+ * }
578
+ *
579
+ * // Custom storage with logging (for Electron/Node.js)
580
+ * import { MemoryStorageAdapter, APILogger } from './storage';
581
+ * const logger = new APILogger({ enabled: true, logLevel: 'debug' });
582
+ * const api = new API('https://api.example.com', {
583
+ * storage: new MemoryStorageAdapter(logger),
584
+ * loggerConfig: { enabled: true, logLevel: 'debug' }
585
+ * });
586
+ *
587
+ * // Get OpenAPI schema
588
+ * const schema = api.getSchema();
589
+ * ```
590
+ */
591
+
592
+ interface APIOptions {
593
+ /** Custom storage adapter (defaults to LocalStorageAdapter) */
594
+ storage?: StorageAdapter;
595
+ /** Retry configuration for failed requests */
596
+ retryConfig?: RetryConfig;
597
+ /** Logger configuration */
598
+ loggerConfig?: Partial<LoggerConfig>;
599
+ }
600
+ declare class API {
601
+ private baseUrl;
602
+ private _client;
603
+ private _token;
604
+ private _refreshToken;
605
+ private storage;
606
+ private options?;
607
+ ext_support_support: ExtSupportSupport;
608
+ constructor(baseUrl: string, options?: APIOptions);
609
+ private _loadTokensFromStorage;
610
+ private _reinitClients;
611
+ private _injectAuthHeader;
612
+ /**
613
+ * Get current JWT token
614
+ */
615
+ getToken(): string | null;
616
+ /**
617
+ * Get current refresh token
618
+ */
619
+ getRefreshToken(): string | null;
620
+ /**
621
+ * Set JWT token and refresh token
622
+ * @param token - JWT access token
623
+ * @param refreshToken - JWT refresh token (optional)
624
+ */
625
+ setToken(token: string, refreshToken?: string): void;
626
+ /**
627
+ * Clear all tokens
628
+ */
629
+ clearTokens(): void;
630
+ /**
631
+ * Check if user is authenticated
632
+ */
633
+ isAuthenticated(): boolean;
634
+ /**
635
+ * Update base URL and reinitialize clients
636
+ * @param url - New base URL
637
+ */
638
+ setBaseUrl(url: string): void;
639
+ /**
640
+ * Get current base URL
641
+ */
642
+ getBaseUrl(): string;
643
+ /**
644
+ * Get OpenAPI schema path
645
+ * @returns Path to the OpenAPI schema JSON file
646
+ *
647
+ * Note: The OpenAPI schema is available in the schema.json file.
648
+ * You can load it dynamically using:
649
+ * ```typescript
650
+ * const schema = await fetch('./schema.json').then(r => r.json());
651
+ * // or using fs in Node.js:
652
+ * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
653
+ * ```
654
+ */
655
+ getSchemaPath(): string;
656
+ }
657
+
658
+ /**
659
+ * Support Extension API
660
+ *
661
+ * Pre-configured API instance with shared authentication
662
+ */
663
+
664
+ declare const apiSupport: API;
665
+
666
+ /**
667
+ * Support Page Component (Apple-style)
668
+ *
669
+ * Single page with support hero + ticket list.
670
+ * Uses adapter pattern - works with any SupportAdapter (API or Demo).
671
+ *
672
+ * Usage:
673
+ * // Production (with API)
674
+ * <SupportPage />
675
+ *
676
+ * // Demo (with mocks, no backend needed)
677
+ * <SupportPage isDemo />
678
+ */
679
+ declare const SupportContent: () => react_jsx_runtime.JSX.Element;
680
+ interface SupportPageProps {
681
+ /** Use demo adapter with mock data (no backend required) */
682
+ isDemo?: boolean;
683
+ }
684
+ /**
685
+ * Support Page - automatically selects adapter based on isDemo prop.
686
+ *
687
+ * @example
688
+ * // Production (with API)
689
+ * <SupportPage />
690
+ *
691
+ * @example
692
+ * // Demo (with mocks)
693
+ * <SupportPage isDemo />
694
+ */
695
+ declare function SupportPage({ isDemo }: SupportPageProps): react_jsx_runtime.JSX.Element;
696
+
697
+ /**
698
+ * Support Hero (Apple HIG)
699
+ *
700
+ * Clean header with stats pills and create action
701
+ */
702
+ interface SupportHeroProps {
703
+ onCreateTicket?: () => void;
704
+ className?: string;
705
+ }
706
+ declare function SupportHero({ onCreateTicket, className }: SupportHeroProps): react_jsx_runtime.JSX.Element;
707
+
708
+ /**
709
+ * Support Model Types
710
+ *
711
+ * Defines the abstract interface for support operations.
712
+ * Adapters (API, Demo) implement this interface.
713
+ */
714
+
715
+ interface CreateTicketInput {
716
+ subject: string;
717
+ message: string;
718
+ }
719
+ interface SendMessageInput {
720
+ ticketUuid: string;
721
+ text: string;
722
+ }
723
+ interface TicketsResult {
724
+ tickets: Ticket[];
725
+ isLoading: boolean;
726
+ isLoadingMore: boolean;
727
+ hasMore: boolean;
728
+ totalCount: number;
729
+ loadMore: () => void;
730
+ refresh: () => Promise<void>;
731
+ }
732
+ interface MessagesResult {
733
+ messages: Message[];
734
+ isLoading: boolean;
735
+ isLoadingMore: boolean;
736
+ hasMore: boolean;
737
+ totalCount: number;
738
+ loadMore: () => void;
739
+ refresh: () => Promise<void>;
740
+ addOptimistic: (message: Message) => void;
741
+ }
742
+ interface SupportModel {
743
+ useTickets: () => TicketsResult;
744
+ useMessages: (ticketUuid: string | null) => MessagesResult;
745
+ createTicket: (input: CreateTicketInput) => Promise<Ticket>;
746
+ sendMessage: (input: SendMessageInput) => Promise<Message>;
747
+ getUnreadCount: (tickets: Ticket[]) => number;
748
+ }
749
+ type SupportAdapter = SupportModel;
750
+
751
+ interface SupportContextValue {
752
+ adapter: SupportAdapter;
753
+ }
754
+ interface SupportProviderProps {
755
+ children: ReactNode;
756
+ adapter: SupportAdapter;
757
+ }
758
+ declare function SupportProvider({ children, adapter }: SupportProviderProps): react_jsx_runtime.JSX.Element;
759
+ /**
760
+ * Hook for tickets list with pagination
761
+ */
762
+ declare function useTickets(): TicketsResult;
763
+ /**
764
+ * Hook for messages of a specific ticket
765
+ */
766
+ declare function useMessages(ticketUuid: string | null): MessagesResult;
767
+ /**
768
+ * Hook for support operations (create ticket, send message)
769
+ */
770
+ declare function useSupport(): {
771
+ tickets: {
772
+ uuid: string;
773
+ user: number;
774
+ subject: string;
775
+ created_at: string;
776
+ unanswered_messages_count: number;
777
+ status?: TicketStatus;
778
+ }[];
779
+ isLoadingTickets: boolean;
780
+ refreshTickets: () => Promise<void>;
781
+ createTicket: (input: CreateTicketInput) => Promise<Ticket>;
782
+ sendMessage: (input: SendMessageInput) => Promise<Message>;
783
+ unreadCount: number;
784
+ };
785
+ /**
786
+ * Legacy hook - returns everything (for backwards compatibility)
787
+ * @deprecated Use useTickets, useMessages, useSupport separately
788
+ */
789
+ declare function useSupportAll(): {
790
+ createTicket: (input: CreateTicketInput) => Promise<Ticket>;
791
+ sendMessage: (input: SendMessageInput) => Promise<Message>;
792
+ unreadCount: number;
793
+ isLoading: boolean;
794
+ tickets: Ticket[];
795
+ isLoadingMore: boolean;
796
+ hasMore: boolean;
797
+ totalCount: number;
798
+ loadMore: () => void;
799
+ refresh: () => Promise<void>;
800
+ };
801
+
802
+ interface TicketListProps {
803
+ onTicketClick?: (ticket: Ticket) => void;
804
+ className?: string;
805
+ }
806
+ declare function TicketList({ onTicketClick, className }: TicketListProps): react_jsx_runtime.JSX.Element;
807
+
808
+ interface TicketItemProps {
809
+ ticket: Ticket;
810
+ onClick?: () => void;
811
+ }
812
+ declare function TicketItem({ ticket, onClick }: TicketItemProps): react_jsx_runtime.JSX.Element;
813
+
814
+ interface TicketSheetProps {
815
+ ticket: Ticket | null;
816
+ open: boolean;
817
+ onOpenChange: (open: boolean) => void;
818
+ }
819
+ declare function TicketSheet({ ticket, open, onOpenChange }: TicketSheetProps): react_jsx_runtime.JSX.Element;
820
+
821
+ interface CreateTicketSheetProps {
822
+ open: boolean;
823
+ onOpenChange: (open: boolean) => void;
824
+ onSuccess?: (ticket: Ticket) => void;
825
+ }
826
+ declare function CreateTicketSheet({ open, onOpenChange, onSuccess }: CreateTicketSheetProps): react_jsx_runtime.JSX.Element;
827
+
828
+ /**
829
+ * API Adapter
830
+ *
831
+ * Implements SupportModel using real API calls.
832
+ * This is the production adapter.
833
+ */
834
+
835
+ declare const apiAdapter: SupportAdapter;
836
+ /**
837
+ * Creates API adapter instance
838
+ * Note: Operations (createTicket, sendMessage) need hooks, so they're
839
+ * provided through the context layer
840
+ */
841
+ declare function createApiAdapter(): SupportAdapter;
842
+ /**
843
+ * Hook to get full API adapter with operations
844
+ * Must be used inside a component
845
+ */
846
+ declare function useApiAdapter(): SupportAdapter;
847
+
848
+ /**
849
+ * Demo Adapter
850
+ *
851
+ * Implements SupportModel using mock data.
852
+ * Used for demos without backend.
853
+ */
854
+
855
+ declare function createDemoAdapter(): SupportAdapter;
856
+ declare function resetDemoData(): void;
857
+
858
+ /**
859
+ * Support extension configuration
860
+ */
861
+ declare const extensionConfig: _djangocfg_ext_base.ExtensionMetadata;
862
+
863
+ export { API as A, apiAdapter as B, CreateTicketSheet as C, createDemoAdapter as D, resetDemoData as E, type PaginatedTicketList as F, type PaginatedMessageList as G, extensionConfig as H, type MessageCreateRequest as M, type PatchedMessageRequest as P, SupportProvider as S, type TicketRequest as T, type Ticket as a, type MessageRequest as b, type Message as c, type PatchedTicketRequest as d, useTickets as e, useMessages as f, apiSupport as g, SupportPage as h, SupportContent as i, type SupportPageProps as j, SupportHero as k, TicketList as l, TicketItem as m, TicketSheet as n, useSupportAll as o, type SupportContextValue as p, type SupportProviderProps as q, type SupportModel as r, type SupportAdapter as s, type CreateTicketInput as t, useSupport as u, type SendMessageInput as v, type TicketsResult as w, type MessagesResult as x, createApiAdapter as y, useApiAdapter as z };