@consilioweb/payload-support 2.0.0 → 3.0.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.
- package/README.md +656 -355
- package/dist/components/RichTextEditor/index.d.ts +19 -0
- package/dist/components/TicketConversation/RewriteDropdown.d.ts +6 -0
- package/dist/components/TicketConversation/SkeletonText.d.ts +4 -0
- package/dist/components/TicketConversation/components/AISummaryPanel.d.ts +14 -0
- package/dist/components/TicketConversation/components/ActionPanels.d.ts +47 -0
- package/dist/components/TicketConversation/components/ActivityLog.d.ts +5 -0
- package/dist/components/TicketConversation/components/ClientBar.d.ts +5 -0
- package/dist/components/TicketConversation/components/ClientHistory.d.ts +24 -0
- package/dist/components/TicketConversation/components/CodeBlock.d.ts +26 -0
- package/dist/components/TicketConversation/components/CodeBlockInserter.d.ts +12 -0
- package/dist/components/TicketConversation/components/QuickActions.d.ts +32 -0
- package/dist/components/TicketConversation/components/TicketHeader.d.ts +19 -0
- package/dist/components/TicketConversation/components/TimeTrackingPanel.d.ts +24 -0
- package/dist/components/TicketConversation/config.d.ts +10 -0
- package/dist/components/TicketConversation/config.js +1 -40
- package/dist/components/TicketConversation/constants.d.ts +56 -0
- package/dist/components/TicketConversation/context.d.ts +53 -0
- package/dist/components/TicketConversation/hooks/useAI.d.ts +21 -0
- package/dist/components/TicketConversation/hooks/useDocumentIdFromUrl.d.ts +3 -0
- package/dist/components/TicketConversation/hooks/useFeatures.d.ts +23 -0
- package/dist/components/TicketConversation/hooks/useFeatures.js +61 -0
- package/dist/components/TicketConversation/hooks/useMessageActions.d.ts +20 -0
- package/dist/components/TicketConversation/hooks/useReply.d.ts +27 -0
- package/dist/components/TicketConversation/hooks/useTicketActions.d.ts +58 -0
- package/dist/components/TicketConversation/hooks/useTimeTracking.d.ts +18 -0
- package/dist/components/TicketConversation/hooks/useTranslation.d.ts +33 -0
- package/dist/components/TicketConversation/hooks/useTranslation.js +22 -3
- package/dist/components/TicketConversation/index.d.ts +4 -0
- package/dist/components/TicketConversation/index.js +2 -2
- package/dist/components/TicketConversation/types.d.ts +56 -0
- package/dist/components/TicketConversation/utils.d.ts +2 -0
- package/dist/index.cjs +392 -320
- package/dist/index.d.cts +100 -3
- package/dist/index.d.ts +100 -3
- package/dist/index.js +388 -321
- package/dist/utils/features.d.ts +123 -0
- package/dist/utils/features.js +147 -0
- package/dist/views/BillingView/client.d.ts +2 -0
- package/dist/views/BillingView/index.d.ts +4 -0
- package/dist/views/ChatView/client.d.ts +2 -0
- package/dist/views/ChatView/client.js +9 -9
- package/dist/views/ChatView/index.d.ts +4 -0
- package/dist/views/CrmView/client.d.ts +2 -0
- package/dist/views/CrmView/client.js +6 -9
- package/dist/views/CrmView/index.d.ts +4 -0
- package/dist/views/EmailTrackingView/client.d.ts +2 -0
- package/dist/views/EmailTrackingView/index.d.ts +4 -0
- package/dist/views/ImportConversationView/client.d.ts +2 -0
- package/dist/views/ImportConversationView/index.d.ts +4 -0
- package/dist/views/LogsView/client.d.ts +2 -0
- package/dist/views/LogsView/index.d.ts +4 -0
- package/dist/views/NewTicketView/client.d.ts +2 -0
- package/dist/views/NewTicketView/index.d.ts +4 -0
- package/dist/views/PendingEmailsView/client.d.ts +2 -0
- package/dist/views/PendingEmailsView/index.d.ts +4 -0
- package/dist/views/SupportDashboardView/client.d.ts +2 -0
- package/dist/views/SupportDashboardView/client.js +1 -1
- package/dist/views/SupportDashboardView/index.d.ts +4 -0
- package/dist/views/TicketDetailView/NextActionItem.d.ts +6 -0
- package/dist/views/TicketDetailView/RewriteDropdown.d.ts +7 -0
- package/dist/views/TicketDetailView/client.d.ts +2 -0
- package/dist/views/TicketDetailView/client.js +2 -2
- package/dist/views/TicketDetailView/constants.d.ts +13 -0
- package/dist/views/TicketDetailView/helpers.d.ts +2 -0
- package/dist/views/TicketDetailView/index.d.ts +4 -0
- package/dist/views/TicketDetailView/types.d.ts +40 -0
- package/dist/views/TicketInboxView/client.d.ts +2 -0
- package/dist/views/TicketInboxView/client.js +5 -5
- package/dist/views/TicketInboxView/index.d.ts +4 -0
- package/dist/views/TicketingSettingsView/client.d.ts +2 -0
- package/dist/views/TicketingSettingsView/client.js +6 -5
- package/dist/views/TicketingSettingsView/index.d.ts +4 -0
- package/dist/views/TimeDashboardView/client.d.ts +2 -0
- package/dist/views/TimeDashboardView/index.d.ts +4 -0
- package/dist/views/shared/AdminViewHeader.d.ts +13 -0
- package/dist/views/shared/ErrorBoundary.d.ts +17 -0
- package/dist/views/shared/Skeleton.d.ts +21 -0
- package/dist/views/shared/StatusPill.d.ts +8 -0
- package/dist/views/shared/adminTokens.d.ts +19 -0
- package/dist/views/shared/config.d.ts +8 -0
- package/dist/views/shared/config.js +1 -40
- package/dist/views/shared/dateLocale.d.ts +5 -0
- package/dist/views/shared/index.d.ts +12 -0
- package/dist/views/shared/index.js +2 -1
- package/dist/views/shared/locales/en.json +708 -0
- package/dist/views/shared/locales/fr.json +708 -0
- package/dist/views/shared/sla.d.ts +14 -0
- package/dist/views.d.ts +13 -13
- package/package.json +26 -41
- package/src/collections/SupportClients.ts +29 -0
- package/src/collections/TicketCollaborators.ts +6 -1
- package/src/collections/TicketMessages.ts +46 -24
- package/src/collections/Tickets.ts +117 -79
- package/src/collections/TimeEntries.ts +57 -32
- package/src/components/TicketConversation/config.ts +16 -80
- package/src/components/TicketConversation/hooks/useFeatures.ts +109 -0
- package/src/components/TicketConversation/hooks/useTranslation.ts +38 -4
- package/src/components/TicketConversation/index.tsx +2 -2
- package/src/endpoints/ai.ts +2 -1
- package/src/endpoints/client-intelligence.ts +2 -1
- package/src/endpoints/process-scheduled.ts +13 -8
- package/src/endpoints/round-robin-config.ts +30 -20
- package/src/endpoints/settings.ts +28 -77
- package/src/index.ts +6 -2
- package/src/portal/LiveChat.tsx +33 -22
- package/src/portal/auth/tickets/detail/TicketPolling.tsx +5 -1
- package/src/types/lucide-react.d.ts +10 -2
- package/src/utils/aiAgent.ts +2 -1
- package/src/utils/aiProvider.ts +21 -0
- package/src/utils/features.ts +297 -0
- package/src/utils/fireWebhooks.ts +6 -0
- package/src/utils/generateTicketSynthesis.ts +2 -1
- package/src/utils/index.ts +4 -2
- package/src/utils/readSettings.ts +82 -9
- package/src/utils/webhookDispatcher.ts +19 -7
- package/src/views/ChatView/client.tsx +13 -9
- package/src/views/CrmView/client.tsx +10 -11
- package/src/views/SupportDashboardView/client.tsx +1 -1
- package/src/views/TicketDetailView/client.tsx +2 -2
- package/src/views/TicketInboxView/client.tsx +10 -5
- package/src/views/TicketingSettingsView/client.tsx +9 -7
- package/src/views/shared/config.ts +14 -80
- package/src/views/shared/index.ts +3 -1
- package/src/views/shared/locales/en.json +2 -2
- package/src/views/shared/locales/fr.json +2 -2
- package/dist/components/RichTextEditor/index.cjs +0 -279
- package/dist/components/TicketConversation/RewriteDropdown.cjs +0 -98
- package/dist/components/TicketConversation/SkeletonText.cjs +0 -21
- package/dist/components/TicketConversation/components/AISummaryPanel.cjs +0 -85
- package/dist/components/TicketConversation/components/ActionPanels.cjs +0 -193
- package/dist/components/TicketConversation/components/ActivityLog.cjs +0 -24
- package/dist/components/TicketConversation/components/ClientBar.cjs +0 -43
- package/dist/components/TicketConversation/components/ClientHistory.cjs +0 -138
- package/dist/components/TicketConversation/components/CodeBlock.cjs +0 -171
- package/dist/components/TicketConversation/components/CodeBlockInserter.cjs +0 -156
- package/dist/components/TicketConversation/components/QuickActions.cjs +0 -87
- package/dist/components/TicketConversation/components/TicketHeader.cjs +0 -93
- package/dist/components/TicketConversation/components/TimeTrackingPanel.cjs +0 -134
- package/dist/components/TicketConversation/config.cjs +0 -44
- package/dist/components/TicketConversation/constants.cjs +0 -127
- package/dist/components/TicketConversation/context.cjs +0 -13
- package/dist/components/TicketConversation/hooks/useAI.cjs +0 -196
- package/dist/components/TicketConversation/hooks/useDocumentIdFromUrl.cjs +0 -20
- package/dist/components/TicketConversation/hooks/useMessageActions.cjs +0 -136
- package/dist/components/TicketConversation/hooks/useReply.cjs +0 -188
- package/dist/components/TicketConversation/hooks/useTicketActions.cjs +0 -290
- package/dist/components/TicketConversation/hooks/useTimeTracking.cjs +0 -123
- package/dist/components/TicketConversation/hooks/useTranslation.cjs +0 -78
- package/dist/components/TicketConversation/index.cjs +0 -1114
- package/dist/components/TicketConversation/types.cjs +0 -2
- package/dist/components/TicketConversation/utils.cjs +0 -27
- package/dist/views/BillingView/client.cjs +0 -469
- package/dist/views/BillingView/index.cjs +0 -34
- package/dist/views/ChatView/client.cjs +0 -301
- package/dist/views/ChatView/index.cjs +0 -34
- package/dist/views/CrmView/client.cjs +0 -458
- package/dist/views/CrmView/index.cjs +0 -34
- package/dist/views/EmailTrackingView/client.cjs +0 -171
- package/dist/views/EmailTrackingView/index.cjs +0 -34
- package/dist/views/ImportConversationView/client.cjs +0 -238
- package/dist/views/ImportConversationView/index.cjs +0 -34
- package/dist/views/LogsView/client.cjs +0 -148
- package/dist/views/LogsView/index.cjs +0 -32
- package/dist/views/NewTicketView/client.cjs +0 -213
- package/dist/views/NewTicketView/index.cjs +0 -32
- package/dist/views/PendingEmailsView/client.cjs +0 -471
- package/dist/views/PendingEmailsView/index.cjs +0 -34
- package/dist/views/SupportDashboardView/client.cjs +0 -437
- package/dist/views/SupportDashboardView/index.cjs +0 -34
- package/dist/views/TicketDetailView/NextActionItem.cjs +0 -40
- package/dist/views/TicketDetailView/RewriteDropdown.cjs +0 -80
- package/dist/views/TicketDetailView/client.cjs +0 -1412
- package/dist/views/TicketDetailView/constants.cjs +0 -20
- package/dist/views/TicketDetailView/helpers.cjs +0 -23
- package/dist/views/TicketDetailView/index.cjs +0 -34
- package/dist/views/TicketDetailView/types.cjs +0 -2
- package/dist/views/TicketInboxView/client.cjs +0 -359
- package/dist/views/TicketInboxView/index.cjs +0 -32
- package/dist/views/TicketingSettingsView/client.cjs +0 -740
- package/dist/views/TicketingSettingsView/index.cjs +0 -34
- package/dist/views/TimeDashboardView/client.cjs +0 -180
- package/dist/views/TimeDashboardView/index.cjs +0 -34
- package/dist/views/shared/AdminViewHeader.cjs +0 -68
- package/dist/views/shared/ErrorBoundary.cjs +0 -55
- package/dist/views/shared/Skeleton.cjs +0 -77
- package/dist/views/shared/StatusPill.cjs +0 -47
- package/dist/views/shared/adminTokens.cjs +0 -34
- package/dist/views/shared/config.cjs +0 -44
- package/dist/views/shared/dateLocale.cjs +0 -5
- package/dist/views/shared/index.cjs +0 -72
- package/dist/views/shared/sla.cjs +0 -37
- package/dist/views.cjs +0 -86
- package/dist/views.d.cts +0 -13
- package/src/__tests__/aiSummaryRendering.test.ts +0 -21
- package/src/__tests__/authResponses.test.ts +0 -69
- package/src/__tests__/capabilities.test.ts +0 -71
- package/src/__tests__/generateTrackingToken.test.ts +0 -67
- package/src/__tests__/integration/ai-agent.test.ts +0 -46
- package/src/__tests__/integration/auth.test.ts +0 -43
- package/src/__tests__/integration/automation-rules.test.ts +0 -68
- package/src/__tests__/integration/buildTestPayload.ts +0 -52
- package/src/__tests__/integration/channels.test.ts +0 -52
- package/src/__tests__/integration/core-behaviors.test.ts +0 -81
- package/src/__tests__/integration/dashboard-volume.test.ts +0 -31
- package/src/__tests__/integration/digest.test.ts +0 -48
- package/src/__tests__/integration/invoice-pdf.test.ts +0 -30
- package/src/__tests__/integration/isolation.test.ts +0 -81
- package/src/__tests__/integration/mentions-invoice.test.ts +0 -50
- package/src/__tests__/integration/nps.test.ts +0 -37
- package/src/__tests__/integration/per-team-sla.test.ts +0 -44
- package/src/__tests__/integration/push.test.ts +0 -75
- package/src/__tests__/integration/sanitization.test.ts +0 -35
- package/src/__tests__/integration/sla-pause.test.ts +0 -39
- package/src/__tests__/integration/smoke.test.ts +0 -26
- package/src/__tests__/integration/snooze.test.ts +0 -68
- package/src/__tests__/integration/teams.test.ts +0 -38
- package/src/__tests__/rateLimiter.test.ts +0 -83
- package/src/__tests__/sanitizeHtml.test.ts +0 -165
- package/src/__tests__/sla.test.ts +0 -258
- package/src/__tests__/trackOpenEndpoint.test.ts +0 -54
- package/src/__tests__/webhookSecurity.test.ts +0 -58
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type Locale = 'fr' | 'en';
|
|
2
|
+
declare const LOCALE_STORAGE_KEY = "support_locale";
|
|
3
|
+
declare const DEFAULT_LOCALE: Locale;
|
|
4
|
+
declare const translations: Record<Locale, Record<string, unknown>>;
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a dot-notation key from a nested object.
|
|
7
|
+
* e.g. getNestedValue(obj, 'ticket.status.open') => 'Ouvert'
|
|
8
|
+
*/
|
|
9
|
+
export declare function getNestedValue(obj: Record<string, unknown>, path: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Hook providing i18n translation capabilities for the support module.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const { t, locale, setLocale } = useTranslation()
|
|
16
|
+
*
|
|
17
|
+
* // Simple key
|
|
18
|
+
* t('common.save') // => 'Sauvegarder' (fr) or 'Save' (en)
|
|
19
|
+
*
|
|
20
|
+
* // With interpolation
|
|
21
|
+
* t('inbox.selected', { count: '3' }) // => '3 sélectionné(s)'
|
|
22
|
+
*
|
|
23
|
+
* // Switch locale
|
|
24
|
+
* setLocale('en')
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function useTranslation(): {
|
|
28
|
+
t: (key: string, vars?: Record<string, string | number>) => string;
|
|
29
|
+
locale: Locale;
|
|
30
|
+
setLocale: (newLocale: Locale) => void;
|
|
31
|
+
};
|
|
32
|
+
export type { Locale };
|
|
33
|
+
export { DEFAULT_LOCALE, LOCALE_STORAGE_KEY, translations };
|
|
@@ -2,12 +2,31 @@
|
|
|
2
2
|
import { useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import frTranslations from '../locales/fr.json';
|
|
4
4
|
import enTranslations from '../locales/en.json';
|
|
5
|
+
import frViewTranslations from '../../../views/shared/locales/fr.json';
|
|
6
|
+
import enViewTranslations from '../../../views/shared/locales/en.json';
|
|
5
7
|
|
|
6
8
|
const LOCALE_STORAGE_KEY = "support_locale";
|
|
7
9
|
const DEFAULT_LOCALE = "fr";
|
|
10
|
+
function mergeTranslations(base, supplement) {
|
|
11
|
+
const merged = { ...base };
|
|
12
|
+
for (const [key, value] of Object.entries(supplement)) {
|
|
13
|
+
const current = merged[key];
|
|
14
|
+
if (current != null && value != null && typeof current === "object" && typeof value === "object" && !Array.isArray(current) && !Array.isArray(value)) {
|
|
15
|
+
merged[key] = mergeTranslations(
|
|
16
|
+
current,
|
|
17
|
+
value
|
|
18
|
+
);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (current === void 0 || typeof current !== "object" && typeof value === "object") {
|
|
22
|
+
merged[key] = value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return merged;
|
|
26
|
+
}
|
|
8
27
|
const translations = {
|
|
9
|
-
fr: frTranslations,
|
|
10
|
-
en: enTranslations
|
|
28
|
+
fr: mergeTranslations(frTranslations, frViewTranslations),
|
|
29
|
+
en: mergeTranslations(enTranslations, enViewTranslations)
|
|
11
30
|
};
|
|
12
31
|
function getNestedValue(obj, path) {
|
|
13
32
|
const keys = path.split(".");
|
|
@@ -67,4 +86,4 @@ function useTranslation() {
|
|
|
67
86
|
return { t, locale, setLocale };
|
|
68
87
|
}
|
|
69
88
|
|
|
70
|
-
export { DEFAULT_LOCALE, LOCALE_STORAGE_KEY, useTranslation };
|
|
89
|
+
export { DEFAULT_LOCALE, LOCALE_STORAGE_KEY, getNestedValue, translations, useTranslation };
|
|
@@ -19,14 +19,14 @@ import { useTicketActions } from './hooks/useTicketActions.js';
|
|
|
19
19
|
import { useReply } from './hooks/useReply.js';
|
|
20
20
|
import { useAI } from './hooks/useAI.js';
|
|
21
21
|
import { useDocumentIdFromUrl } from './hooks/useDocumentIdFromUrl.js';
|
|
22
|
-
import {
|
|
22
|
+
import { useFeatures } from './hooks/useFeatures.js';
|
|
23
23
|
import { SkeletonText } from './SkeletonText.js';
|
|
24
24
|
import { RewriteDropdown } from './RewriteDropdown.js';
|
|
25
25
|
import '../../styles/theme.css';
|
|
26
26
|
|
|
27
27
|
const TicketConversation = () => {
|
|
28
28
|
const { id } = useDocumentIdFromUrl();
|
|
29
|
-
const
|
|
29
|
+
const { features } = useFeatures();
|
|
30
30
|
const [messages, setMessages] = useState([]);
|
|
31
31
|
const [timeEntries, setTimeEntries] = useState([]);
|
|
32
32
|
const [client, setClient] = useState(null);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface Attachment {
|
|
2
|
+
file: {
|
|
3
|
+
id: number;
|
|
4
|
+
url?: string;
|
|
5
|
+
filename?: string;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
sizes?: Record<string, {
|
|
8
|
+
url?: string;
|
|
9
|
+
}>;
|
|
10
|
+
} | number;
|
|
11
|
+
}
|
|
12
|
+
export interface Message {
|
|
13
|
+
id: string | number;
|
|
14
|
+
body: string;
|
|
15
|
+
bodyHtml?: string;
|
|
16
|
+
authorType: 'client' | 'admin' | 'email';
|
|
17
|
+
isInternal?: boolean;
|
|
18
|
+
isSolution?: boolean;
|
|
19
|
+
attachments?: Attachment[];
|
|
20
|
+
createdAt: string;
|
|
21
|
+
fromChat?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface TimeEntry {
|
|
24
|
+
id: string | number;
|
|
25
|
+
duration: number;
|
|
26
|
+
description?: string;
|
|
27
|
+
date: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ClientInfo {
|
|
30
|
+
id: number;
|
|
31
|
+
company: string;
|
|
32
|
+
firstName: string;
|
|
33
|
+
lastName: string;
|
|
34
|
+
email: string;
|
|
35
|
+
phone?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CannedResponse {
|
|
38
|
+
id: string | number;
|
|
39
|
+
title: string;
|
|
40
|
+
body: string;
|
|
41
|
+
category?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ActivityEntry {
|
|
44
|
+
id: string | number;
|
|
45
|
+
action: string;
|
|
46
|
+
detail?: string;
|
|
47
|
+
actorType?: string;
|
|
48
|
+
actorEmail?: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface SatisfactionSurvey {
|
|
52
|
+
id: string | number;
|
|
53
|
+
rating: number;
|
|
54
|
+
comment?: string;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
}
|