@weaver-apps/service-desk 0.0.0-stage → 0.1.3

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.
@@ -0,0 +1,348 @@
1
+ import { Plugin } from "@loomweaver/plugin-sdk";
2
+ import { InjectionToken, Provider } from "@angular/core";
3
+ interface ServiceDeskPluginOptions {
4
+ readonly railItem?: boolean;
5
+ }
6
+ export declare function createServiceDeskPlugin(options?: ServiceDeskPluginOptions): Plugin;
7
+ export declare const serviceDeskPlugin: Plugin;
8
+ export declare const deskListPath = "service-desk";
9
+ export declare function deskPath(deskId: string): string;
10
+ /**
11
+ * Generated by orval 🍺
12
+ * Do not edit manually.
13
+ * Weaver Apps
14
+ * OpenAPI spec version: 1.0.0
15
+ */
16
+ /**
17
+ * A desk of the caller's tenant.
18
+ */
19
+ interface DeskResponse {
20
+ /** The id the caller chose. */
21
+ id: string;
22
+ /** The display name. */
23
+ name: string;
24
+ /** When it was created. */
25
+ createdAt: string;
26
+ }
27
+ /**
28
+ * Generated by orval 🍺
29
+ * Do not edit manually.
30
+ * Weaver Apps
31
+ * OpenAPI spec version: 1.0.0
32
+ */
33
+ /**
34
+ * How a service request came about.
35
+ */
36
+ type ServiceRequestOrigin = typeof ServiceRequestOrigin[keyof typeof ServiceRequestOrigin];
37
+ declare const ServiceRequestOrigin: {
38
+ readonly manual: "manual";
39
+ readonly voiceChat: "voiceChat";
40
+ readonly textChat: "textChat";
41
+ readonly widget: "widget";
42
+ readonly email: "email";
43
+ readonly phone: "phone";
44
+ };
45
+ /**
46
+ * Generated by orval 🍺
47
+ * Do not edit manually.
48
+ * Weaver Apps
49
+ * OpenAPI spec version: 1.0.0
50
+ */
51
+ /**
52
+ * How urgent a service request is.
53
+ */
54
+ type ServiceRequestPriority = typeof ServiceRequestPriority[keyof typeof ServiceRequestPriority];
55
+ declare const ServiceRequestPriority: {
56
+ readonly low: "low";
57
+ readonly normal: "normal";
58
+ readonly high: "high";
59
+ readonly urgent: "urgent";
60
+ };
61
+ /**
62
+ * Generated by orval 🍺
63
+ * Do not edit manually.
64
+ * Weaver Apps
65
+ * OpenAPI spec version: 1.0.0
66
+ */
67
+ /**
68
+ * What kind of matter a service request is.
69
+ */
70
+ type ServiceRequestType = typeof ServiceRequestType[keyof typeof ServiceRequestType];
71
+ declare const ServiceRequestType: {
72
+ readonly inquiry: "inquiry";
73
+ readonly task: "task";
74
+ readonly callbackRequest: "callbackRequest";
75
+ readonly conversationSummary: "conversationSummary";
76
+ readonly complaint: "complaint";
77
+ readonly quote: "quote";
78
+ };
79
+ /**
80
+ * Raises a service request. Only the title is required.
81
+ */
82
+ interface NewServiceRequest {
83
+ /**
84
+ * What the request is about.
85
+ * @minLength 1
86
+ * @maxLength 200
87
+ */
88
+ title: string;
89
+ /**
90
+ * More about it.
91
+ * @minLength 0
92
+ * @maxLength 4000
93
+ * @nullable
94
+ */
95
+ description: string | null;
96
+ type: null | ServiceRequestType;
97
+ priority: null | ServiceRequestPriority;
98
+ origin: null | ServiceRequestOrigin;
99
+ /**
100
+ * Who it is for.
101
+ * @minLength 0
102
+ * @maxLength 200
103
+ * @nullable
104
+ */
105
+ contactName: string | null;
106
+ /**
107
+ * Their phone number.
108
+ * @minLength 0
109
+ * @maxLength 50
110
+ * @nullable
111
+ */
112
+ contactPhone: string | null;
113
+ /**
114
+ * Their email address.
115
+ * @minLength 0
116
+ * @maxLength 320
117
+ * @nullable
118
+ */
119
+ contactEmail: string | null;
120
+ /**
121
+ * Who works on it.
122
+ * @minLength 0
123
+ * @maxLength 200
124
+ * @nullable
125
+ */
126
+ assignee: string | null;
127
+ /**
128
+ * When it is due.
129
+ * @nullable
130
+ */
131
+ dueAt: string | null;
132
+ }
133
+ /**
134
+ * Generated by orval 🍺
135
+ * Do not edit manually.
136
+ * Weaver Apps
137
+ * OpenAPI spec version: 1.0.0
138
+ */
139
+ type ServiceDeskRequestsListParams = {
140
+ type?: string;
141
+ status?: string;
142
+ priority?: string;
143
+ contact?: string;
144
+ text?: string;
145
+ includeCancelled?: boolean;
146
+ sort?: string;
147
+ descending?: boolean;
148
+ /**
149
+ * @pattern ^-?(?:0|[1-9]\d*)$
150
+ */
151
+ offset?: number | string;
152
+ /**
153
+ * @pattern ^-?(?:0|[1-9]\d*)$
154
+ */
155
+ limit?: number | string;
156
+ };
157
+ /**
158
+ * Replaces what a service request says; its origin stays as it was raised.
159
+ */
160
+ interface ServiceRequestChanges {
161
+ /**
162
+ * What the request is about.
163
+ * @minLength 1
164
+ * @maxLength 200
165
+ */
166
+ title: string;
167
+ /**
168
+ * More about it.
169
+ * @minLength 0
170
+ * @maxLength 4000
171
+ * @nullable
172
+ */
173
+ description: string | null;
174
+ /** Its kind. */
175
+ type: ServiceRequestType;
176
+ /** How urgent it is. */
177
+ priority: ServiceRequestPriority;
178
+ /**
179
+ * Who it is for.
180
+ * @minLength 0
181
+ * @maxLength 200
182
+ * @nullable
183
+ */
184
+ contactName: string | null;
185
+ /**
186
+ * Their phone number.
187
+ * @minLength 0
188
+ * @maxLength 50
189
+ * @nullable
190
+ */
191
+ contactPhone: string | null;
192
+ /**
193
+ * Their email address.
194
+ * @minLength 0
195
+ * @maxLength 320
196
+ * @nullable
197
+ */
198
+ contactEmail: string | null;
199
+ /**
200
+ * Who works on it.
201
+ * @minLength 0
202
+ * @maxLength 200
203
+ * @nullable
204
+ */
205
+ assignee: string | null;
206
+ /**
207
+ * When it is due.
208
+ * @nullable
209
+ */
210
+ dueAt: string | null;
211
+ }
212
+ /**
213
+ * Generated by orval 🍺
214
+ * Do not edit manually.
215
+ * Weaver Apps
216
+ * OpenAPI spec version: 1.0.0
217
+ */
218
+ /**
219
+ * Where a service request stands.
220
+ */
221
+ type ServiceRequestStatus = typeof ServiceRequestStatus[keyof typeof ServiceRequestStatus];
222
+ declare const ServiceRequestStatus: {
223
+ readonly open: "open";
224
+ readonly inProgress: "inProgress";
225
+ readonly completed: "completed";
226
+ readonly cancelled: "cancelled";
227
+ };
228
+ /**
229
+ * A service request.
230
+ */
231
+ interface ServiceRequestResponse {
232
+ /** The request's id. */
233
+ id: string;
234
+ /** The desk it is on. */
235
+ deskId: string;
236
+ /** What it is about. */
237
+ title: string;
238
+ /**
239
+ * More about it.
240
+ * @nullable
241
+ */
242
+ description: string | null;
243
+ /** Its kind. */
244
+ type: ServiceRequestType;
245
+ /** How urgent it is. */
246
+ priority: ServiceRequestPriority;
247
+ /** Where it stands. */
248
+ status: ServiceRequestStatus;
249
+ /** How it came about. */
250
+ origin: ServiceRequestOrigin;
251
+ /**
252
+ * Who it is for.
253
+ * @nullable
254
+ */
255
+ contactName: string | null;
256
+ /**
257
+ * Their phone number.
258
+ * @nullable
259
+ */
260
+ contactPhone: string | null;
261
+ /**
262
+ * Their email address.
263
+ * @nullable
264
+ */
265
+ contactEmail: string | null;
266
+ /**
267
+ * Who works on it.
268
+ * @nullable
269
+ */
270
+ assignee: string | null;
271
+ /**
272
+ * When it is due.
273
+ * @nullable
274
+ */
275
+ dueAt: string | null;
276
+ /**
277
+ * Why it was cancelled, if it was and anyone said.
278
+ * @nullable
279
+ */
280
+ cancellationReason: string | null;
281
+ /** When it was raised. */
282
+ raisedAt: string;
283
+ /**
284
+ * When it was last changed.
285
+ * @nullable
286
+ */
287
+ changedAt: string | null;
288
+ /**
289
+ * When it was completed.
290
+ * @nullable
291
+ */
292
+ completedAt: string | null;
293
+ /**
294
+ * When it was cancelled.
295
+ * @nullable
296
+ */
297
+ cancelledAt: string | null;
298
+ }
299
+ /**
300
+ * One page of a listing.
301
+ */
302
+ interface ServiceRequestPage {
303
+ /** The requests on this page. */
304
+ items: ServiceRequestResponse[];
305
+ /**
306
+ * How many requests match, across every page.
307
+ * @pattern ^-?(?:0|[1-9]\d*)$
308
+ */
309
+ total: number | string;
310
+ }
311
+ type ServiceRequestOutcome = {
312
+ readonly kind: 'saved';
313
+ readonly request: ServiceRequestResponse;
314
+ } | {
315
+ readonly kind: 'closed';
316
+ } | {
317
+ readonly kind: 'changed';
318
+ } | {
319
+ readonly kind: 'invalid';
320
+ } | {
321
+ readonly kind: 'missing';
322
+ };
323
+ type ServiceRequestListing = ServiceDeskRequestsListParams;
324
+ interface ServiceDeskGateway {
325
+ desks(): Promise<readonly DeskResponse[]>;
326
+ desk(deskId: string): Promise<DeskResponse | null>;
327
+ saveDesk(deskId: string, name: string): Promise<DeskResponse>;
328
+ requests(deskId: string, listing: ServiceRequestListing, signal?: AbortSignal): Promise<ServiceRequestPage>;
329
+ raise(deskId: string, request: NewServiceRequest): Promise<ServiceRequestOutcome>;
330
+ edit(deskId: string, requestId: string, changes: ServiceRequestChanges): Promise<ServiceRequestOutcome>;
331
+ setStatus(deskId: string, requestId: string, status: ServiceRequestStatus): Promise<ServiceRequestOutcome>;
332
+ complete(deskId: string, requestId: string): Promise<ServiceRequestOutcome>;
333
+ cancel(deskId: string, requestId: string, reason: string | null): Promise<ServiceRequestOutcome>;
334
+ remove(deskId: string, requestId: string): Promise<void>;
335
+ }
336
+ export declare class ServiceDeskGatewayError extends Error {
337
+ readonly status: number;
338
+ constructor(status: number);
339
+ }
340
+ export declare const SERVICE_DESK_GATEWAY: InjectionToken<ServiceDeskGateway>;
341
+ export declare function provideServiceDeskGateway(gateway: ServiceDeskGateway): Provider;
342
+ interface HttpServiceDeskGatewayOptions {
343
+ readonly baseUrl: string;
344
+ readonly headers?: Readonly<Record<string, string>>;
345
+ readonly fetch?: typeof fetch;
346
+ }
347
+ export declare function createHttpServiceDeskGateway(options: HttpServiceDeskGatewayOptions): ServiceDeskGateway;
348
+ export type { DeskResponse, HttpServiceDeskGatewayOptions, NewServiceRequest, ServiceDeskGateway, ServiceDeskPluginOptions, ServiceRequestChanges, ServiceRequestListing, ServiceRequestOrigin, ServiceRequestOutcome, ServiceRequestPage, ServiceRequestPriority, ServiceRequestResponse, ServiceRequestStatus, ServiceRequestType };