@djangocfg/ext-support 1.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 +233 -0
- package/dist/chunk-AZ4LWZB7.js +2630 -0
- package/dist/hooks.cjs +2716 -0
- package/dist/hooks.d.cts +255 -0
- package/dist/hooks.d.ts +255 -0
- package/dist/hooks.js +1 -0
- package/dist/index.cjs +2693 -0
- package/dist/index.d.cts +1392 -0
- package/dist/index.d.ts +1392 -0
- package/dist/index.js +1 -0
- package/package.json +80 -0
- package/src/api/generated/ext_support/_utils/fetchers/ext_support__support.ts +642 -0
- package/src/api/generated/ext_support/_utils/fetchers/index.ts +28 -0
- package/src/api/generated/ext_support/_utils/hooks/ext_support__support.ts +237 -0
- package/src/api/generated/ext_support/_utils/hooks/index.ts +28 -0
- package/src/api/generated/ext_support/_utils/schemas/Message.schema.ts +21 -0
- package/src/api/generated/ext_support/_utils/schemas/MessageCreate.schema.ts +15 -0
- package/src/api/generated/ext_support/_utils/schemas/MessageCreateRequest.schema.ts +15 -0
- package/src/api/generated/ext_support/_utils/schemas/MessageRequest.schema.ts +15 -0
- package/src/api/generated/ext_support/_utils/schemas/PaginatedMessageList.schema.ts +24 -0
- package/src/api/generated/ext_support/_utils/schemas/PaginatedTicketList.schema.ts +24 -0
- package/src/api/generated/ext_support/_utils/schemas/PatchedMessageRequest.schema.ts +15 -0
- package/src/api/generated/ext_support/_utils/schemas/PatchedTicketRequest.schema.ts +18 -0
- package/src/api/generated/ext_support/_utils/schemas/Sender.schema.ts +21 -0
- package/src/api/generated/ext_support/_utils/schemas/Ticket.schema.ts +21 -0
- package/src/api/generated/ext_support/_utils/schemas/TicketRequest.schema.ts +18 -0
- package/src/api/generated/ext_support/_utils/schemas/index.ts +29 -0
- package/src/api/generated/ext_support/api-instance.ts +131 -0
- package/src/api/generated/ext_support/client.ts +301 -0
- package/src/api/generated/ext_support/enums.ts +45 -0
- package/src/api/generated/ext_support/errors.ts +116 -0
- package/src/api/generated/ext_support/ext_support__support/client.ts +151 -0
- package/src/api/generated/ext_support/ext_support__support/index.ts +2 -0
- package/src/api/generated/ext_support/ext_support__support/models.ts +165 -0
- package/src/api/generated/ext_support/http.ts +103 -0
- package/src/api/generated/ext_support/index.ts +273 -0
- package/src/api/generated/ext_support/logger.ts +259 -0
- package/src/api/generated/ext_support/retry.ts +175 -0
- package/src/api/generated/ext_support/schema.json +1049 -0
- package/src/api/generated/ext_support/storage.ts +161 -0
- package/src/api/generated/ext_support/validation-events.ts +133 -0
- package/src/api/index.ts +9 -0
- package/src/config.ts +20 -0
- package/src/contexts/SupportContext.tsx +250 -0
- package/src/contexts/SupportExtensionProvider.tsx +38 -0
- package/src/contexts/types.ts +26 -0
- package/src/hooks/index.ts +33 -0
- package/src/index.ts +39 -0
- package/src/layouts/SupportLayout/README.md +91 -0
- package/src/layouts/SupportLayout/SupportLayout.tsx +179 -0
- package/src/layouts/SupportLayout/components/CreateTicketDialog.tsx +155 -0
- package/src/layouts/SupportLayout/components/MessageInput.tsx +92 -0
- package/src/layouts/SupportLayout/components/MessageList.tsx +312 -0
- package/src/layouts/SupportLayout/components/TicketCard.tsx +96 -0
- package/src/layouts/SupportLayout/components/TicketList.tsx +153 -0
- package/src/layouts/SupportLayout/components/index.ts +6 -0
- package/src/layouts/SupportLayout/context/SupportLayoutContext.tsx +258 -0
- package/src/layouts/SupportLayout/context/index.ts +2 -0
- package/src/layouts/SupportLayout/events.ts +33 -0
- package/src/layouts/SupportLayout/hooks/index.ts +2 -0
- package/src/layouts/SupportLayout/hooks/useInfiniteMessages.ts +115 -0
- package/src/layouts/SupportLayout/hooks/useInfiniteTickets.ts +88 -0
- package/src/layouts/SupportLayout/index.ts +6 -0
- package/src/layouts/SupportLayout/types.ts +21 -0
- package/src/utils/logger.ts +14 -0
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed fetchers for Support
|
|
3
|
+
*
|
|
4
|
+
* Universal functions that work in any environment:
|
|
5
|
+
* - Next.js (App Router / Pages Router / Server Components)
|
|
6
|
+
* - React Native
|
|
7
|
+
* - Node.js backend
|
|
8
|
+
*
|
|
9
|
+
* These fetchers use Zod schemas for runtime validation.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Configure API once (in your app entry point)
|
|
14
|
+
* import { configureAPI } from '../../api-instance'
|
|
15
|
+
* configureAPI({ baseUrl: 'https://api.example.com' })
|
|
16
|
+
*
|
|
17
|
+
* // Then use fetchers anywhere
|
|
18
|
+
* const users = await getUsers({ page: 1 })
|
|
19
|
+
*
|
|
20
|
+
* // With SWR
|
|
21
|
+
* const { data } = useSWR(['users', params], () => getUsers(params))
|
|
22
|
+
*
|
|
23
|
+
* // With React Query
|
|
24
|
+
* const { data } = useQuery(['users', params], () => getUsers(params))
|
|
25
|
+
*
|
|
26
|
+
* // In Server Component or SSR (pass custom client)
|
|
27
|
+
* import { API } from '../../index'
|
|
28
|
+
* const api = new API('https://api.example.com')
|
|
29
|
+
* const users = await getUsers({ page: 1 }, api)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { consola } from 'consola'
|
|
33
|
+
import { MessageSchema, type Message } from '../schemas/Message.schema'
|
|
34
|
+
import { MessageCreateSchema, type MessageCreate } from '../schemas/MessageCreate.schema'
|
|
35
|
+
import { MessageCreateRequestSchema, type MessageCreateRequest } from '../schemas/MessageCreateRequest.schema'
|
|
36
|
+
import { MessageRequestSchema, type MessageRequest } from '../schemas/MessageRequest.schema'
|
|
37
|
+
import { PaginatedMessageListSchema, type PaginatedMessageList } from '../schemas/PaginatedMessageList.schema'
|
|
38
|
+
import { PaginatedTicketListSchema, type PaginatedTicketList } from '../schemas/PaginatedTicketList.schema'
|
|
39
|
+
import { PatchedMessageRequestSchema, type PatchedMessageRequest } from '../schemas/PatchedMessageRequest.schema'
|
|
40
|
+
import { PatchedTicketRequestSchema, type PatchedTicketRequest } from '../schemas/PatchedTicketRequest.schema'
|
|
41
|
+
import { TicketSchema, type Ticket } from '../schemas/Ticket.schema'
|
|
42
|
+
import { TicketRequestSchema, type TicketRequest } from '../schemas/TicketRequest.schema'
|
|
43
|
+
import { getAPIInstance } from '../../api-instance'
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* API operation
|
|
47
|
+
*
|
|
48
|
+
* @method GET
|
|
49
|
+
* @path /cfg/support/tickets/
|
|
50
|
+
*/
|
|
51
|
+
export async function getSupportTicketsList( params?: { page?: number; page_size?: number }, client?: any
|
|
52
|
+
): Promise<PaginatedTicketList> {
|
|
53
|
+
const api = client || getAPIInstance()
|
|
54
|
+
const response = await api.ext_support_support.ticketsList(params?.page, params?.page_size)
|
|
55
|
+
try {
|
|
56
|
+
return PaginatedTicketListSchema.parse(response)
|
|
57
|
+
} catch (error) {
|
|
58
|
+
// Zod validation error - log detailed information
|
|
59
|
+
consola.error('❌ Zod Validation Failed');
|
|
60
|
+
consola.box(`getSupportTicketsList\nPath: /cfg/support/tickets/\nMethod: GET`);
|
|
61
|
+
|
|
62
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
63
|
+
consola.error('Validation Issues:');
|
|
64
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
65
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
66
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
67
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
68
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
consola.error('Response data:', response);
|
|
73
|
+
|
|
74
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
75
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
76
|
+
try {
|
|
77
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
78
|
+
detail: {
|
|
79
|
+
operation: 'getSupportTicketsList',
|
|
80
|
+
path: '/cfg/support/tickets/',
|
|
81
|
+
method: 'GET',
|
|
82
|
+
error: error,
|
|
83
|
+
response: response,
|
|
84
|
+
timestamp: new Date(),
|
|
85
|
+
},
|
|
86
|
+
bubbles: true,
|
|
87
|
+
cancelable: false,
|
|
88
|
+
});
|
|
89
|
+
window.dispatchEvent(event);
|
|
90
|
+
} catch (eventError) {
|
|
91
|
+
// Silently fail - event dispatch should never crash the app
|
|
92
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Re-throw the error
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* API operation
|
|
104
|
+
*
|
|
105
|
+
* @method POST
|
|
106
|
+
* @path /cfg/support/tickets/
|
|
107
|
+
*/
|
|
108
|
+
export async function createSupportTicketsCreate( data: TicketRequest, client?: any
|
|
109
|
+
): Promise<Ticket> {
|
|
110
|
+
const api = client || getAPIInstance()
|
|
111
|
+
const response = await api.ext_support_support.ticketsCreate(data)
|
|
112
|
+
try {
|
|
113
|
+
return TicketSchema.parse(response)
|
|
114
|
+
} catch (error) {
|
|
115
|
+
// Zod validation error - log detailed information
|
|
116
|
+
consola.error('❌ Zod Validation Failed');
|
|
117
|
+
consola.box(`createSupportTicketsCreate\nPath: /cfg/support/tickets/\nMethod: POST`);
|
|
118
|
+
|
|
119
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
120
|
+
consola.error('Validation Issues:');
|
|
121
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
122
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
123
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
124
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
125
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
consola.error('Response data:', response);
|
|
130
|
+
|
|
131
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
132
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
133
|
+
try {
|
|
134
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
135
|
+
detail: {
|
|
136
|
+
operation: 'createSupportTicketsCreate',
|
|
137
|
+
path: '/cfg/support/tickets/',
|
|
138
|
+
method: 'POST',
|
|
139
|
+
error: error,
|
|
140
|
+
response: response,
|
|
141
|
+
timestamp: new Date(),
|
|
142
|
+
},
|
|
143
|
+
bubbles: true,
|
|
144
|
+
cancelable: false,
|
|
145
|
+
});
|
|
146
|
+
window.dispatchEvent(event);
|
|
147
|
+
} catch (eventError) {
|
|
148
|
+
// Silently fail - event dispatch should never crash the app
|
|
149
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Re-throw the error
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* API operation
|
|
161
|
+
*
|
|
162
|
+
* @method GET
|
|
163
|
+
* @path /cfg/support/tickets/{ticket_uuid}/messages/
|
|
164
|
+
*/
|
|
165
|
+
export async function getSupportTicketsMessagesList( ticket_uuid: string, params?: { page?: number; page_size?: number }, client?: any
|
|
166
|
+
): Promise<PaginatedMessageList> {
|
|
167
|
+
const api = client || getAPIInstance()
|
|
168
|
+
const response = await api.ext_support_support.ticketsMessagesList(ticket_uuid, params?.page, params?.page_size)
|
|
169
|
+
try {
|
|
170
|
+
return PaginatedMessageListSchema.parse(response)
|
|
171
|
+
} catch (error) {
|
|
172
|
+
// Zod validation error - log detailed information
|
|
173
|
+
consola.error('❌ Zod Validation Failed');
|
|
174
|
+
consola.box(`getSupportTicketsMessagesList\nPath: /cfg/support/tickets/{ticket_uuid}/messages/\nMethod: GET`);
|
|
175
|
+
|
|
176
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
177
|
+
consola.error('Validation Issues:');
|
|
178
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
179
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
180
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
181
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
182
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
consola.error('Response data:', response);
|
|
187
|
+
|
|
188
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
189
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
190
|
+
try {
|
|
191
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
192
|
+
detail: {
|
|
193
|
+
operation: 'getSupportTicketsMessagesList',
|
|
194
|
+
path: '/cfg/support/tickets/{ticket_uuid}/messages/',
|
|
195
|
+
method: 'GET',
|
|
196
|
+
error: error,
|
|
197
|
+
response: response,
|
|
198
|
+
timestamp: new Date(),
|
|
199
|
+
},
|
|
200
|
+
bubbles: true,
|
|
201
|
+
cancelable: false,
|
|
202
|
+
});
|
|
203
|
+
window.dispatchEvent(event);
|
|
204
|
+
} catch (eventError) {
|
|
205
|
+
// Silently fail - event dispatch should never crash the app
|
|
206
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Re-throw the error
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* API operation
|
|
218
|
+
*
|
|
219
|
+
* @method POST
|
|
220
|
+
* @path /cfg/support/tickets/{ticket_uuid}/messages/
|
|
221
|
+
*/
|
|
222
|
+
export async function createSupportTicketsMessagesCreate( ticket_uuid: string, data: MessageCreateRequest, client?: any
|
|
223
|
+
): Promise<MessageCreate> {
|
|
224
|
+
const api = client || getAPIInstance()
|
|
225
|
+
const response = await api.ext_support_support.ticketsMessagesCreate(ticket_uuid, data)
|
|
226
|
+
try {
|
|
227
|
+
return MessageCreateSchema.parse(response)
|
|
228
|
+
} catch (error) {
|
|
229
|
+
// Zod validation error - log detailed information
|
|
230
|
+
consola.error('❌ Zod Validation Failed');
|
|
231
|
+
consola.box(`createSupportTicketsMessagesCreate\nPath: /cfg/support/tickets/{ticket_uuid}/messages/\nMethod: POST`);
|
|
232
|
+
|
|
233
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
234
|
+
consola.error('Validation Issues:');
|
|
235
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
236
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
237
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
238
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
239
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
consola.error('Response data:', response);
|
|
244
|
+
|
|
245
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
246
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
247
|
+
try {
|
|
248
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
249
|
+
detail: {
|
|
250
|
+
operation: 'createSupportTicketsMessagesCreate',
|
|
251
|
+
path: '/cfg/support/tickets/{ticket_uuid}/messages/',
|
|
252
|
+
method: 'POST',
|
|
253
|
+
error: error,
|
|
254
|
+
response: response,
|
|
255
|
+
timestamp: new Date(),
|
|
256
|
+
},
|
|
257
|
+
bubbles: true,
|
|
258
|
+
cancelable: false,
|
|
259
|
+
});
|
|
260
|
+
window.dispatchEvent(event);
|
|
261
|
+
} catch (eventError) {
|
|
262
|
+
// Silently fail - event dispatch should never crash the app
|
|
263
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Re-throw the error
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* API operation
|
|
275
|
+
*
|
|
276
|
+
* @method GET
|
|
277
|
+
* @path /cfg/support/tickets/{ticket_uuid}/messages/{uuid}/
|
|
278
|
+
*/
|
|
279
|
+
export async function getSupportTicketsMessagesRetrieve( ticket_uuid: string, uuid: string, client?: any
|
|
280
|
+
): Promise<Message> {
|
|
281
|
+
const api = client || getAPIInstance()
|
|
282
|
+
const response = await api.ext_support_support.ticketsMessagesRetrieve(ticket_uuid, uuid)
|
|
283
|
+
try {
|
|
284
|
+
return MessageSchema.parse(response)
|
|
285
|
+
} catch (error) {
|
|
286
|
+
// Zod validation error - log detailed information
|
|
287
|
+
consola.error('❌ Zod Validation Failed');
|
|
288
|
+
consola.box(`getSupportTicketsMessagesRetrieve\nPath: /cfg/support/tickets/{ticket_uuid}/messages/{uuid}/\nMethod: GET`);
|
|
289
|
+
|
|
290
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
291
|
+
consola.error('Validation Issues:');
|
|
292
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
293
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
294
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
295
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
296
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
consola.error('Response data:', response);
|
|
301
|
+
|
|
302
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
303
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
304
|
+
try {
|
|
305
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
306
|
+
detail: {
|
|
307
|
+
operation: 'getSupportTicketsMessagesRetrieve',
|
|
308
|
+
path: '/cfg/support/tickets/{ticket_uuid}/messages/{uuid}/',
|
|
309
|
+
method: 'GET',
|
|
310
|
+
error: error,
|
|
311
|
+
response: response,
|
|
312
|
+
timestamp: new Date(),
|
|
313
|
+
},
|
|
314
|
+
bubbles: true,
|
|
315
|
+
cancelable: false,
|
|
316
|
+
});
|
|
317
|
+
window.dispatchEvent(event);
|
|
318
|
+
} catch (eventError) {
|
|
319
|
+
// Silently fail - event dispatch should never crash the app
|
|
320
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Re-throw the error
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* API operation
|
|
332
|
+
*
|
|
333
|
+
* @method PUT
|
|
334
|
+
* @path /cfg/support/tickets/{ticket_uuid}/messages/{uuid}/
|
|
335
|
+
*/
|
|
336
|
+
export async function updateSupportTicketsMessagesUpdate( ticket_uuid: string, uuid: string, data: MessageRequest, client?: any
|
|
337
|
+
): Promise<Message> {
|
|
338
|
+
const api = client || getAPIInstance()
|
|
339
|
+
const response = await api.ext_support_support.ticketsMessagesUpdate(ticket_uuid, uuid, data)
|
|
340
|
+
try {
|
|
341
|
+
return MessageSchema.parse(response)
|
|
342
|
+
} catch (error) {
|
|
343
|
+
// Zod validation error - log detailed information
|
|
344
|
+
consola.error('❌ Zod Validation Failed');
|
|
345
|
+
consola.box(`updateSupportTicketsMessagesUpdate\nPath: /cfg/support/tickets/{ticket_uuid}/messages/{uuid}/\nMethod: PUT`);
|
|
346
|
+
|
|
347
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
348
|
+
consola.error('Validation Issues:');
|
|
349
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
350
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
351
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
352
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
353
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
consola.error('Response data:', response);
|
|
358
|
+
|
|
359
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
360
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
361
|
+
try {
|
|
362
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
363
|
+
detail: {
|
|
364
|
+
operation: 'updateSupportTicketsMessagesUpdate',
|
|
365
|
+
path: '/cfg/support/tickets/{ticket_uuid}/messages/{uuid}/',
|
|
366
|
+
method: 'PUT',
|
|
367
|
+
error: error,
|
|
368
|
+
response: response,
|
|
369
|
+
timestamp: new Date(),
|
|
370
|
+
},
|
|
371
|
+
bubbles: true,
|
|
372
|
+
cancelable: false,
|
|
373
|
+
});
|
|
374
|
+
window.dispatchEvent(event);
|
|
375
|
+
} catch (eventError) {
|
|
376
|
+
// Silently fail - event dispatch should never crash the app
|
|
377
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// Re-throw the error
|
|
382
|
+
throw error;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* API operation
|
|
389
|
+
*
|
|
390
|
+
* @method PATCH
|
|
391
|
+
* @path /cfg/support/tickets/{ticket_uuid}/messages/{uuid}/
|
|
392
|
+
*/
|
|
393
|
+
export async function partialUpdateSupportTicketsMessagesPartialUpdate( ticket_uuid: string, uuid: string, data?: PatchedMessageRequest, client?: any
|
|
394
|
+
): Promise<Message> {
|
|
395
|
+
const api = client || getAPIInstance()
|
|
396
|
+
const response = await api.ext_support_support.ticketsMessagesPartialUpdate(ticket_uuid, uuid, data)
|
|
397
|
+
try {
|
|
398
|
+
return MessageSchema.parse(response)
|
|
399
|
+
} catch (error) {
|
|
400
|
+
// Zod validation error - log detailed information
|
|
401
|
+
consola.error('❌ Zod Validation Failed');
|
|
402
|
+
consola.box(`partialUpdateSupportTicketsMessagesPartialUpdate\nPath: /cfg/support/tickets/{ticket_uuid}/messages/{uuid}/\nMethod: PATCH`);
|
|
403
|
+
|
|
404
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
405
|
+
consola.error('Validation Issues:');
|
|
406
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
407
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
408
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
409
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
410
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
consola.error('Response data:', response);
|
|
415
|
+
|
|
416
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
417
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
418
|
+
try {
|
|
419
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
420
|
+
detail: {
|
|
421
|
+
operation: 'partialUpdateSupportTicketsMessagesPartialUpdate',
|
|
422
|
+
path: '/cfg/support/tickets/{ticket_uuid}/messages/{uuid}/',
|
|
423
|
+
method: 'PATCH',
|
|
424
|
+
error: error,
|
|
425
|
+
response: response,
|
|
426
|
+
timestamp: new Date(),
|
|
427
|
+
},
|
|
428
|
+
bubbles: true,
|
|
429
|
+
cancelable: false,
|
|
430
|
+
});
|
|
431
|
+
window.dispatchEvent(event);
|
|
432
|
+
} catch (eventError) {
|
|
433
|
+
// Silently fail - event dispatch should never crash the app
|
|
434
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// Re-throw the error
|
|
439
|
+
throw error;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* API operation
|
|
446
|
+
*
|
|
447
|
+
* @method DELETE
|
|
448
|
+
* @path /cfg/support/tickets/{ticket_uuid}/messages/{uuid}/
|
|
449
|
+
*/
|
|
450
|
+
export async function deleteSupportTicketsMessagesDestroy( ticket_uuid: string, uuid: string, client?: any
|
|
451
|
+
): Promise<void> {
|
|
452
|
+
const api = client || getAPIInstance()
|
|
453
|
+
const response = await api.ext_support_support.ticketsMessagesDestroy(ticket_uuid, uuid)
|
|
454
|
+
return response
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* API operation
|
|
460
|
+
*
|
|
461
|
+
* @method GET
|
|
462
|
+
* @path /cfg/support/tickets/{uuid}/
|
|
463
|
+
*/
|
|
464
|
+
export async function getSupportTicketsRetrieve( uuid: string, client?: any
|
|
465
|
+
): Promise<Ticket> {
|
|
466
|
+
const api = client || getAPIInstance()
|
|
467
|
+
const response = await api.ext_support_support.ticketsRetrieve(uuid)
|
|
468
|
+
try {
|
|
469
|
+
return TicketSchema.parse(response)
|
|
470
|
+
} catch (error) {
|
|
471
|
+
// Zod validation error - log detailed information
|
|
472
|
+
consola.error('❌ Zod Validation Failed');
|
|
473
|
+
consola.box(`getSupportTicketsRetrieve\nPath: /cfg/support/tickets/{uuid}/\nMethod: GET`);
|
|
474
|
+
|
|
475
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
476
|
+
consola.error('Validation Issues:');
|
|
477
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
478
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
479
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
480
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
481
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
consola.error('Response data:', response);
|
|
486
|
+
|
|
487
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
488
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
489
|
+
try {
|
|
490
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
491
|
+
detail: {
|
|
492
|
+
operation: 'getSupportTicketsRetrieve',
|
|
493
|
+
path: '/cfg/support/tickets/{uuid}/',
|
|
494
|
+
method: 'GET',
|
|
495
|
+
error: error,
|
|
496
|
+
response: response,
|
|
497
|
+
timestamp: new Date(),
|
|
498
|
+
},
|
|
499
|
+
bubbles: true,
|
|
500
|
+
cancelable: false,
|
|
501
|
+
});
|
|
502
|
+
window.dispatchEvent(event);
|
|
503
|
+
} catch (eventError) {
|
|
504
|
+
// Silently fail - event dispatch should never crash the app
|
|
505
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// Re-throw the error
|
|
510
|
+
throw error;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* API operation
|
|
517
|
+
*
|
|
518
|
+
* @method PUT
|
|
519
|
+
* @path /cfg/support/tickets/{uuid}/
|
|
520
|
+
*/
|
|
521
|
+
export async function updateSupportTicketsUpdate( uuid: string, data: TicketRequest, client?: any
|
|
522
|
+
): Promise<Ticket> {
|
|
523
|
+
const api = client || getAPIInstance()
|
|
524
|
+
const response = await api.ext_support_support.ticketsUpdate(uuid, data)
|
|
525
|
+
try {
|
|
526
|
+
return TicketSchema.parse(response)
|
|
527
|
+
} catch (error) {
|
|
528
|
+
// Zod validation error - log detailed information
|
|
529
|
+
consola.error('❌ Zod Validation Failed');
|
|
530
|
+
consola.box(`updateSupportTicketsUpdate\nPath: /cfg/support/tickets/{uuid}/\nMethod: PUT`);
|
|
531
|
+
|
|
532
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
533
|
+
consola.error('Validation Issues:');
|
|
534
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
535
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
536
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
537
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
538
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
consola.error('Response data:', response);
|
|
543
|
+
|
|
544
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
545
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
546
|
+
try {
|
|
547
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
548
|
+
detail: {
|
|
549
|
+
operation: 'updateSupportTicketsUpdate',
|
|
550
|
+
path: '/cfg/support/tickets/{uuid}/',
|
|
551
|
+
method: 'PUT',
|
|
552
|
+
error: error,
|
|
553
|
+
response: response,
|
|
554
|
+
timestamp: new Date(),
|
|
555
|
+
},
|
|
556
|
+
bubbles: true,
|
|
557
|
+
cancelable: false,
|
|
558
|
+
});
|
|
559
|
+
window.dispatchEvent(event);
|
|
560
|
+
} catch (eventError) {
|
|
561
|
+
// Silently fail - event dispatch should never crash the app
|
|
562
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// Re-throw the error
|
|
567
|
+
throw error;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* API operation
|
|
574
|
+
*
|
|
575
|
+
* @method PATCH
|
|
576
|
+
* @path /cfg/support/tickets/{uuid}/
|
|
577
|
+
*/
|
|
578
|
+
export async function partialUpdateSupportTicketsPartialUpdate( uuid: string, data?: PatchedTicketRequest, client?: any
|
|
579
|
+
): Promise<Ticket> {
|
|
580
|
+
const api = client || getAPIInstance()
|
|
581
|
+
const response = await api.ext_support_support.ticketsPartialUpdate(uuid, data)
|
|
582
|
+
try {
|
|
583
|
+
return TicketSchema.parse(response)
|
|
584
|
+
} catch (error) {
|
|
585
|
+
// Zod validation error - log detailed information
|
|
586
|
+
consola.error('❌ Zod Validation Failed');
|
|
587
|
+
consola.box(`partialUpdateSupportTicketsPartialUpdate\nPath: /cfg/support/tickets/{uuid}/\nMethod: PATCH`);
|
|
588
|
+
|
|
589
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
590
|
+
consola.error('Validation Issues:');
|
|
591
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
592
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
593
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
594
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
595
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
consola.error('Response data:', response);
|
|
600
|
+
|
|
601
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
602
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
603
|
+
try {
|
|
604
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
605
|
+
detail: {
|
|
606
|
+
operation: 'partialUpdateSupportTicketsPartialUpdate',
|
|
607
|
+
path: '/cfg/support/tickets/{uuid}/',
|
|
608
|
+
method: 'PATCH',
|
|
609
|
+
error: error,
|
|
610
|
+
response: response,
|
|
611
|
+
timestamp: new Date(),
|
|
612
|
+
},
|
|
613
|
+
bubbles: true,
|
|
614
|
+
cancelable: false,
|
|
615
|
+
});
|
|
616
|
+
window.dispatchEvent(event);
|
|
617
|
+
} catch (eventError) {
|
|
618
|
+
// Silently fail - event dispatch should never crash the app
|
|
619
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Re-throw the error
|
|
624
|
+
throw error;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* API operation
|
|
631
|
+
*
|
|
632
|
+
* @method DELETE
|
|
633
|
+
* @path /cfg/support/tickets/{uuid}/
|
|
634
|
+
*/
|
|
635
|
+
export async function deleteSupportTicketsDestroy( uuid: string, client?: any
|
|
636
|
+
): Promise<void> {
|
|
637
|
+
const api = client || getAPIInstance()
|
|
638
|
+
const response = await api.ext_support_support.ticketsDestroy(uuid)
|
|
639
|
+
return response
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed Fetchers - Universal API functions
|
|
3
|
+
*
|
|
4
|
+
* Auto-generated from OpenAPI specification.
|
|
5
|
+
* These functions work in any JavaScript environment.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Runtime validation with Zod
|
|
9
|
+
* - Type-safe parameters and responses
|
|
10
|
+
* - Works with any data-fetching library (SWR, React Query, etc)
|
|
11
|
+
* - Server Component compatible
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import * as fetchers from './fetchers'
|
|
16
|
+
*
|
|
17
|
+
* // Direct usage
|
|
18
|
+
* const user = await fetchers.getUser(1)
|
|
19
|
+
*
|
|
20
|
+
* // With SWR
|
|
21
|
+
* const { data } = useSWR('user-1', () => fetchers.getUser(1))
|
|
22
|
+
*
|
|
23
|
+
* // With React Query
|
|
24
|
+
* const { data } = useQuery(['user', 1], () => fetchers.getUser(1))
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export * from './ext_support__support'
|