@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.
- package/dist/config.cjs +1 -1
- package/dist/config.js +1 -1
- package/dist/hooks.cjs +398 -334
- package/dist/hooks.d.cts +6 -2
- package/dist/hooks.d.ts +6 -2
- package/dist/hooks.js +356 -291
- package/dist/i18n.cjs +72 -72
- package/dist/i18n.js +73 -73
- package/dist/index-D-xo66K9.d.cts +862 -0
- package/dist/index-D-xo66K9.d.ts +863 -0
- package/dist/index-Dov7pn8Z.d.ts +2 -1
- package/dist/index-rR_XqXq1.d.cts +838 -0
- package/dist/index-rR_XqXq1.d.ts +838 -0
- package/dist/index.cjs +398 -334
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +356 -291
- package/package.json +8 -8
- package/src/adapters/api.ts +4 -5
- package/src/adapters/demo.ts +2 -1
- package/src/api/generated/ext_support/_utils/fetchers/ext_support__support.ts +4 -4
- package/src/api/generated/ext_support/_utils/hooks/ext_support__support.ts +2 -2
- package/src/api/generated/ext_support/_utils/schemas/Ticket.schema.ts +1 -1
- package/src/api/generated/ext_support/_utils/schemas/TicketRequest.schema.ts +1 -1
- package/src/api/generated/ext_support/enums.ts +0 -30
- package/src/api/generated/ext_support/ext_support__support/client.ts +6 -6
- package/src/api/generated/ext_support/ext_support__support/models.ts +2 -2
- package/src/api/generated/ext_support/schema.json +36 -0
- package/src/components/CreateTicketSheet.tsx +7 -12
- package/src/components/SupportHero.tsx +35 -47
- package/src/components/TicketItem.tsx +28 -74
- package/src/components/TicketList.tsx +30 -23
- package/src/components/TicketSheet.tsx +246 -162
- package/src/contexts/SupportExtensionProvider.tsx +4 -4
- package/src/contexts/types.ts +2 -2
- package/src/i18n/useSupportT.ts +3 -3
- package/src/utils/status.ts +44 -0
- package/src/utils/time.ts +88 -0
package/src/contexts/types.ts
CHANGED
|
@@ -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';
|
package/src/i18n/useSupportT.ts
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { useLocale } from 'next-intl';
|
|
10
|
-
import {
|
|
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
|
+
}
|