@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
@@ -17,5 +17,5 @@ export type {
17
17
  PaginatedMessageList,
18
18
  } from '../api/generated/ext_support/_utils/schemas';
19
19
 
20
- // Enums
21
- export { TicketStatus } from '../api/generated/ext_support/enums';
20
+ // Enums - re-export with alias for backwards compatibility
21
+ export { PatchedTicketRequestStatus as TicketStatus } from '../api/generated/ext_support/enums';
@@ -7,13 +7,13 @@
7
7
  */
8
8
 
9
9
  import { useLocale } from 'next-intl';
10
- import { useMemo, useCallback } from 'react';
10
+ import { useCallback, useMemo } from 'react';
11
11
 
12
- import type { SupportTranslations, SupportLocalKeys } from './types';
13
12
  import { en } from './locales/en';
14
- import { ru } from './locales/ru';
15
13
  import { ko } from './locales/ko';
14
+ import { ru } from './locales/ru';
16
15
 
16
+ import type { SupportTranslations, SupportLocalKeys } from './types';
17
17
  const translations: Record<string, SupportTranslations> = { en, ru, ko };
18
18
 
19
19
  /**
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Ticket Status Configuration
3
+ *
4
+ * Centralized styling for ticket statuses following Apple HIG
5
+ */
6
+
7
+ export type TicketStatus =
8
+ | 'open'
9
+ | 'waiting_for_user'
10
+ | 'waiting_for_admin'
11
+ | 'resolved'
12
+ | 'closed';
13
+
14
+ export interface StatusConfig {
15
+ color: string;
16
+ bg: string;
17
+ }
18
+
19
+ export const ticketStatusConfig: Record<TicketStatus, StatusConfig> = {
20
+ open: {
21
+ color: 'text-blue-600 dark:text-blue-400',
22
+ bg: 'bg-blue-500/10',
23
+ },
24
+ waiting_for_user: {
25
+ color: 'text-orange-600 dark:text-orange-400',
26
+ bg: 'bg-orange-500/10',
27
+ },
28
+ waiting_for_admin: {
29
+ color: 'text-muted-foreground',
30
+ bg: 'bg-muted',
31
+ },
32
+ resolved: {
33
+ color: 'text-green-600 dark:text-green-400',
34
+ bg: 'bg-green-500/10',
35
+ },
36
+ closed: {
37
+ color: 'text-muted-foreground',
38
+ bg: 'bg-muted',
39
+ },
40
+ };
41
+
42
+ export function getStatusConfig(status: string): StatusConfig {
43
+ return ticketStatusConfig[status as TicketStatus] || ticketStatusConfig.open;
44
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Time Formatting Utilities
3
+ *
4
+ * Apple-style time formatting for messages and tickets
5
+ */
6
+
7
+ import moment from 'moment';
8
+
9
+ /**
10
+ * Format time for message display (e.g., "10:30 AM")
11
+ */
12
+ export function formatMessageTime(date: string | null | undefined): string {
13
+ if (!date) return '';
14
+ return moment.utc(date).local().format('h:mm A');
15
+ }
16
+
17
+ /**
18
+ * Format date separator for chat (e.g., "Today", "Yesterday", "Dec 15")
19
+ */
20
+ export function formatDateSeparator(date: string | null | undefined): string {
21
+ if (!date) return '';
22
+
23
+ const m = moment.utc(date).local();
24
+ const now = moment();
25
+ const today = now.clone().startOf('day');
26
+ const yesterday = now.clone().subtract(1, 'day').startOf('day');
27
+
28
+ if (m.isSame(today, 'day')) {
29
+ return 'Today';
30
+ }
31
+ if (m.isSame(yesterday, 'day')) {
32
+ return 'Yesterday';
33
+ }
34
+ if (m.isSame(now, 'year')) {
35
+ return m.format('MMM D');
36
+ }
37
+ return m.format('MMM D, YYYY');
38
+ }
39
+
40
+ /**
41
+ * Format relative time (e.g., "2h ago", "Just now")
42
+ */
43
+ export function formatRelativeTime(
44
+ date: string | null | undefined,
45
+ labels: {
46
+ justNow: string;
47
+ minutesAgo: string;
48
+ hoursAgo: string;
49
+ daysAgo: string;
50
+ }
51
+ ): string {
52
+ if (!date) return 'N/A';
53
+
54
+ const m = moment.utc(date).local();
55
+ const now = moment();
56
+ const diffInSeconds = now.diff(m, 'seconds');
57
+
58
+ if (diffInSeconds < 60) {
59
+ return labels.justNow;
60
+ }
61
+ if (diffInSeconds < 3600) {
62
+ return labels.minutesAgo.replace('{count}', String(Math.floor(diffInSeconds / 60)));
63
+ }
64
+ if (diffInSeconds < 86400) {
65
+ return labels.hoursAgo.replace('{count}', String(Math.floor(diffInSeconds / 3600)));
66
+ }
67
+ if (diffInSeconds < 604800) {
68
+ return labels.daysAgo.replace('{count}', String(Math.floor(diffInSeconds / 86400)));
69
+ }
70
+
71
+ return m.format('MMM D, YYYY');
72
+ }
73
+
74
+ /**
75
+ * Check if two dates are on the same day
76
+ */
77
+ export function isSameDay(date1: string | null | undefined, date2: string | null | undefined): boolean {
78
+ if (!date1 || !date2) return false;
79
+ return moment.utc(date1).format('YYYY-MM-DD') === moment.utc(date2).format('YYYY-MM-DD');
80
+ }
81
+
82
+ /**
83
+ * Format date for ticket header (e.g., "Dec 15, 2024")
84
+ */
85
+ export function formatTicketDate(date: string | null | undefined): string {
86
+ if (!date) return '';
87
+ return moment.utc(date).local().format('MMM D, YYYY');
88
+ }