|
@@ -5,6 +5,7 @@ import type {
|
|
|
ApprovalFlowItem,
|
|
ApprovalFlowItem,
|
|
|
AutoReplyRule,
|
|
AutoReplyRule,
|
|
|
ChatChannel,
|
|
ChatChannel,
|
|
|
|
|
+ ChatLogItem,
|
|
|
ChatMessage,
|
|
ChatMessage,
|
|
|
ChatSession,
|
|
ChatSession,
|
|
|
ChannelItem,
|
|
ChannelItem,
|
|
@@ -249,6 +250,7 @@ export const api = {
|
|
|
request<void>(`/api/supplier/suppliers/${id}`, { method: 'DELETE' }),
|
|
request<void>(`/api/supplier/suppliers/${id}`, { method: 'DELETE' }),
|
|
|
|
|
|
|
|
/* Supply Capabilities */
|
|
/* Supply Capabilities */
|
|
|
|
|
+ getSupplyCapabilities: () => request<{ items: SupplyCapabilityItem[] }>('/api/supplier/capabilities'),
|
|
|
getSupplyCapabilitiesBySupplier: (supplierId: number) => request<{ items: SupplyCapabilityItem[] }>(`/api/supplier/${supplierId}/capabilities`),
|
|
getSupplyCapabilitiesBySupplier: (supplierId: number) => request<{ items: SupplyCapabilityItem[] }>(`/api/supplier/${supplierId}/capabilities`),
|
|
|
getSupplyCapabilitiesBySku: (skuId: number) => request<{ items: SupplyCapabilityItem[] }>(`/api/supplier/sku/${skuId}/capabilities`),
|
|
getSupplyCapabilitiesBySku: (skuId: number) => request<{ items: SupplyCapabilityItem[] }>(`/api/supplier/sku/${skuId}/capabilities`),
|
|
|
getSupplyCapability: (id: number) => request<SupplyCapabilityItem>(`/api/supplier/capability/${id}`),
|
|
getSupplyCapability: (id: number) => request<SupplyCapabilityItem>(`/api/supplier/capability/${id}`),
|
|
@@ -684,10 +686,15 @@ export const api = {
|
|
|
testAutoReplyRuleLegacy: (id: string, testMessage: string) =>
|
|
testAutoReplyRuleLegacy: (id: string, testMessage: string) =>
|
|
|
request<{ response: string }>(`/api/crm/auto-reply/rules/${id}/test`, { method: 'POST', body: JSON.stringify({ message: testMessage }) }),
|
|
request<{ response: string }>(`/api/crm/auto-reply/rules/${id}/test`, { method: 'POST', body: JSON.stringify({ message: testMessage }) }),
|
|
|
|
|
|
|
|
- /* CRM: Chat Log (legacy) */
|
|
|
|
|
- getChatLogsLegacy: () => request<{ items: ChatSession[] }>('/api/crm/chat-logs'),
|
|
|
|
|
- getChatLogDetailLegacy: (id: string) => request<ChatSession>(`/api/crm/chat-logs/${id}`),
|
|
|
|
|
- markChatLogLegacy: (id: string, tag: string) =>
|
|
|
|
|
|
|
+ /* CRM: Chat Log */
|
|
|
|
|
+ getChatLogs: () => request<{ items: ChatLogItem[] }>('/api/crm/chat-logs'),
|
|
|
|
|
+ getChatLog: (id: number) => request<ChatLogItem>(`/api/crm/chat-logs/${id}`),
|
|
|
|
|
+ createChatLog: (data: Partial<ChatLogItem>) =>
|
|
|
|
|
+ request<ChatLogItem>('/api/crm/chat-logs', { method: 'POST', body: JSON.stringify(data) }),
|
|
|
|
|
+ updateChatLog: (id: number, data: Partial<ChatLogItem>) =>
|
|
|
|
|
+ request<ChatLogItem>(`/api/crm/chat-logs/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
|
|
|
+ deleteChatLog: (id: number) => request<void>(`/api/crm/chat-logs/${id}`, { method: 'DELETE' }),
|
|
|
|
|
+ markChatLog: (id: number, tag: string) =>
|
|
|
request<{ success: boolean }>(`/api/crm/chat-logs/${id}/mark`, { method: 'POST', body: JSON.stringify({ tag }) }),
|
|
request<{ success: boolean }>(`/api/crm/chat-logs/${id}/mark`, { method: 'POST', body: JSON.stringify({ tag }) }),
|
|
|
|
|
|
|
|
/* CRM: Service Performance (legacy) */
|
|
/* CRM: Service Performance (legacy) */
|
|
@@ -702,28 +709,56 @@ export const api = {
|
|
|
request<ChatChannel>(`/api/crm/channels/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
request<ChatChannel>(`/api/crm/channels/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
|
deleteChatChannelLegacy: (id: string) => request<{ success: boolean }>(`/api/crm/channels/${id}`, { method: 'DELETE' }),
|
|
deleteChatChannelLegacy: (id: string) => request<{ success: boolean }>(`/api/crm/channels/${id}`, { method: 'DELETE' }),
|
|
|
|
|
|
|
|
- /* Reports (legacy) */
|
|
|
|
|
|
|
+ /* Reports */
|
|
|
getReports: () => request<{ items: ReportItem[] }>('/api/reports'),
|
|
getReports: () => request<{ items: ReportItem[] }>('/api/reports'),
|
|
|
- getReportData: () => request<{ items: ReportDataItem[] }>('/api/report-data'),
|
|
|
|
|
-
|
|
|
|
|
- /* Pricing Rules (legacy - path unclear) */
|
|
|
|
|
|
|
+ getReport: (id: number) => request<ReportItem>(`/api/reports/${id}`),
|
|
|
|
|
+ createReport: (data: Partial<ReportItem>) =>
|
|
|
|
|
+ request<ReportItem>('/api/reports', { method: 'POST', body: JSON.stringify(data) }),
|
|
|
|
|
+ updateReport: (id: number, data: Partial<ReportItem>) =>
|
|
|
|
|
+ request<ReportItem>(`/api/reports/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
|
|
|
+ deleteReport: (id: number) => request<void>(`/api/reports/${id}`, { method: 'DELETE' }),
|
|
|
|
|
+ generateReport: (id: number) => request<ReportItem>(`/api/reports/${id}/generate`, { method: 'POST' }),
|
|
|
|
|
+
|
|
|
|
|
+ getReportData: (reportId?: number) =>
|
|
|
|
|
+ reportId ? request<{ items: ReportDataItem[] }>(`/api/report-data?reportId=${reportId}`) : request<{ items: ReportDataItem[] }>('/api/report-data'),
|
|
|
|
|
+ getReportDataById: (id: number) => request<ReportDataItem>(`/api/report-data/${id}`),
|
|
|
|
|
+ createReportData: (data: Partial<ReportDataItem>) =>
|
|
|
|
|
+ request<ReportDataItem>('/api/report-data', { method: 'POST', body: JSON.stringify(data) }),
|
|
|
|
|
+ updateReportData: (id: number, data: Partial<ReportDataItem>) =>
|
|
|
|
|
+ request<ReportDataItem>(`/api/report-data/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
|
|
|
+ deleteReportData: (id: number) => request<void>(`/api/report-data/${id}`, { method: 'DELETE' }),
|
|
|
|
|
+
|
|
|
|
|
+ /* Pricing Rules */
|
|
|
getPricingRules: () => request<{ items: PricingRuleItem[] }>('/api/pricing-rules'),
|
|
getPricingRules: () => request<{ items: PricingRuleItem[] }>('/api/pricing-rules'),
|
|
|
- createPricingRule: (data: any) =>
|
|
|
|
|
|
|
+ getPricingRule: (id: number) => request<PricingRuleItem>(`/api/pricing-rules/${id}`),
|
|
|
|
|
+ createPricingRule: (data: Partial<PricingRuleItem>) =>
|
|
|
request<PricingRuleItem>('/api/pricing-rules', { method: 'POST', body: JSON.stringify(data) }),
|
|
request<PricingRuleItem>('/api/pricing-rules', { method: 'POST', body: JSON.stringify(data) }),
|
|
|
- updatePricingRule: (id: string, data: any) =>
|
|
|
|
|
|
|
+ updatePricingRule: (id: number, data: Partial<PricingRuleItem>) =>
|
|
|
request<PricingRuleItem>(`/api/pricing-rules/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
request<PricingRuleItem>(`/api/pricing-rules/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
|
|
|
+ deletePricingRule: (id: number) => request<void>(`/api/pricing-rules/${id}`, { method: 'DELETE' }),
|
|
|
|
|
|
|
|
- /* CRM: Ticket (legacy) */
|
|
|
|
|
|
|
+ /* CRM: Ticket */
|
|
|
getTickets: () => request<{ items: TicketItem[] }>('/api/crm/tickets'),
|
|
getTickets: () => request<{ items: TicketItem[] }>('/api/crm/tickets'),
|
|
|
- createTicket: (data: any) =>
|
|
|
|
|
|
|
+ getTicket: (id: number) => request<TicketItem>(`/api/crm/tickets/${id}`),
|
|
|
|
|
+ createTicket: (data: Partial<TicketItem>) =>
|
|
|
request<TicketItem>('/api/crm/tickets', { method: 'POST', body: JSON.stringify(data) }),
|
|
request<TicketItem>('/api/crm/tickets', { method: 'POST', body: JSON.stringify(data) }),
|
|
|
- updateTicket: (id: string, data: any) =>
|
|
|
|
|
|
|
+ updateTicket: (id: number, data: Partial<TicketItem>) =>
|
|
|
request<TicketItem>(`/api/crm/tickets/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
request<TicketItem>(`/api/crm/tickets/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
|
|
|
+ assignTicket: (id: number, assignedTo: number, assignedName: string) =>
|
|
|
|
|
+ request<TicketItem>(`/api/crm/tickets/${id}/assign`, { method: 'POST', body: JSON.stringify({ assignedTo, assignedName }) }),
|
|
|
|
|
+ resolveTicket: (id: number, resolution: string) =>
|
|
|
|
|
+ request<TicketItem>(`/api/crm/tickets/${id}/resolve`, { method: 'POST', body: JSON.stringify({ resolution }) }),
|
|
|
|
|
+ deleteTicket: (id: number) => request<void>(`/api/crm/tickets/${id}`, { method: 'DELETE' }),
|
|
|
|
|
|
|
|
- /* CRM: Satisfaction (legacy) */
|
|
|
|
|
|
|
+ /* CRM: Satisfaction */
|
|
|
getSatisfactions: () => request<{ items: SatisfactionItem[] }>('/api/crm/satisfactions'),
|
|
getSatisfactions: () => request<{ items: SatisfactionItem[] }>('/api/crm/satisfactions'),
|
|
|
- updateSatisfaction: (id: string, data: any) =>
|
|
|
|
|
|
|
+ getSatisfaction: (id: number) => request<SatisfactionItem>(`/api/crm/satisfactions/${id}`),
|
|
|
|
|
+ createSatisfaction: (data: Partial<SatisfactionItem>) =>
|
|
|
|
|
+ request<SatisfactionItem>('/api/crm/satisfactions', { method: 'POST', body: JSON.stringify(data) }),
|
|
|
|
|
+ updateSatisfaction: (id: number, data: Partial<SatisfactionItem>) =>
|
|
|
request<SatisfactionItem>(`/api/crm/satisfactions/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
request<SatisfactionItem>(`/api/crm/satisfactions/${id}`, { method: 'PUT', body: JSON.stringify(data) }),
|
|
|
|
|
+ deleteSatisfaction: (id: number) => request<void>(`/api/crm/satisfactions/${id}`, { method: 'DELETE' }),
|
|
|
|
|
+ getSatisfactionAverageScore: () => request<{ averageScore: number }>('/api/crm/satisfactions/average-score'),
|
|
|
|
|
|
|
|
/* System: Logs (legacy) */
|
|
/* System: Logs (legacy) */
|
|
|
getLogs: () => request<{ items: LogItem[] }>('/api/system/operation-logs')
|
|
getLogs: () => request<{ items: LogItem[] }>('/api/system/operation-logs')
|