@webority/support-react 0.148.0 → 0.150.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 +0 -6
- package/dist/guidance.json +1 -1
- package/dist/support-react.js +1 -1
- package/dist/types/ReportIssue.d.ts +23 -24
- package/dist/types/ReportIssue.meta.d.ts +2 -54
- package/dist/types/SupportCenter.d.ts +17 -18
- package/dist/types/SupportCenter.meta.d.ts +2 -58
- package/dist/types/SupportContact.d.ts +4 -6
- package/dist/types/SupportContact.meta.d.ts +2 -25
- package/dist/types/SupportProvider.d.ts +16 -16
- package/dist/types/agent/SupportAgentProvider.d.ts +14 -12
- package/dist/types/agent/SupportAgentTicket.d.ts +6 -7
- package/dist/types/agent/SupportQueue.d.ts +18 -18
- package/dist/types/agent/SupportQueue.meta.d.ts +1 -1
- package/dist/types/agent/client.d.ts +213 -83
- package/dist/types/agent/context.d.ts +36 -65
- package/dist/types/agent/labels.d.ts +80 -79
- package/dist/types/client.d.ts +242 -167
- package/dist/types/components/AttachmentField.d.ts +5 -11
- package/dist/types/components/AttachmentThumb.d.ts +6 -12
- package/dist/types/components/MessageThread.d.ts +6 -13
- package/dist/types/components/NewTicketModal.d.ts +12 -16
- package/dist/types/components/RatingPanel.d.ts +13 -14
- package/dist/types/components/ReplyBox.d.ts +11 -11
- package/dist/types/components/SuggestedAnswers.d.ts +6 -9
- package/dist/types/components/SupportTime.d.ts +8 -10
- package/dist/types/components/TicketDetail.d.ts +11 -12
- package/dist/types/components/TicketForm.d.ts +31 -39
- package/dist/types/components/TicketList.d.ts +31 -25
- package/dist/types/context.d.ts +30 -49
- package/dist/types/helpCentre/HelpArticle.d.ts +11 -9
- package/dist/types/helpCentre/HelpArticle.meta.d.ts +2 -34
- package/dist/types/helpCentre/HelpCentre.d.ts +11 -9
- package/dist/types/helpCentre/HelpCentre.meta.d.ts +2 -33
- package/dist/types/helpCentre/client.d.ts +25 -59
- package/dist/types/helpCentre/labels.d.ts +19 -19
- package/dist/types/helpCentre/useHelpCentre.d.ts +8 -20
- package/dist/types/index.d.ts +18 -15
- package/dist/types/labels.d.ts +8 -8
- package/dist/types/lib/errors.d.ts +4 -4
- package/dist/types/lib/files.d.ts +43 -31
- package/dist/types/lib/status.d.ts +8 -3
- package/dist/types/lib/subject.d.ts +3 -3
- package/dist/types/lib/url.d.ts +4 -4
- package/dist/types/lib/useDebouncedValue.d.ts +3 -3
- package/package.json +9 -8
package/dist/types/client.d.ts
CHANGED
|
@@ -2,219 +2,294 @@
|
|
|
2
2
|
* A failed support request. `message` is written for the person and is safe to show as-is.
|
|
3
3
|
*/
|
|
4
4
|
export declare class SupportApiError extends Error {
|
|
5
|
-
code: string;
|
|
6
|
-
status: number | undefined;
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly status: number | undefined;
|
|
7
7
|
/**
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
8
|
+
* @param code Machine-readable reason from the API, or "network" when no response arrived.
|
|
9
|
+
* @param message The sentence to show the person.
|
|
10
|
+
* @param status HTTP status, when a response arrived.
|
|
11
11
|
*/
|
|
12
12
|
constructor(code: string, message: string, status?: number);
|
|
13
13
|
}
|
|
14
|
-
export declare function normaliseError(error:
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export declare function normaliseError(error: unknown): Promise<SupportApiError>;
|
|
15
|
+
/**
|
|
16
|
+
* Runs one request and returns its reply parsed into the type the endpoint's C# record maps to.
|
|
17
|
+
* A reply the parse refuses throws an Error that names the endpoint and the bad field.
|
|
18
|
+
*/
|
|
19
|
+
export declare function call<T>(endpoint: string, request: () => Promise<{
|
|
20
|
+
data: unknown;
|
|
21
|
+
}>, parse: (data: unknown) => T): Promise<T>;
|
|
22
|
+
type JsonObject = Record<string, unknown>;
|
|
23
|
+
export type FieldReader<T> = (object: JsonObject, key: string, path: string) => T;
|
|
24
|
+
export type ValueParser<T> = (value: unknown, path: string) => T;
|
|
25
|
+
export declare function readObject(value: unknown, path: string): JsonObject;
|
|
26
|
+
export declare function readString(object: JsonObject, key: string, path: string): string;
|
|
27
|
+
export declare function readNumber(object: JsonObject, key: string, path: string): number;
|
|
28
|
+
export declare function readBoolean(object: JsonObject, key: string, path: string): boolean;
|
|
29
|
+
/** A field that is always sent and is null when it has no value. */
|
|
30
|
+
export declare function readNullable<T>(object: JsonObject, key: string, path: string, read: FieldReader<T>): T | null;
|
|
31
|
+
/** A field the server leaves out when it has no value. */
|
|
32
|
+
export declare function readOptional<T>(object: JsonObject, key: string, path: string, read: FieldReader<T>): T | undefined;
|
|
33
|
+
export declare function oneOf<T extends string>(allowed: readonly T[]): FieldReader<T>;
|
|
34
|
+
export declare function nested<T>(parse: ValueParser<T>): FieldReader<T>;
|
|
35
|
+
export declare function parseList<T>(value: unknown, path: string, parseItem: ValueParser<T>): T[];
|
|
36
|
+
export declare function readList<T>(object: JsonObject, key: string, path: string, parseItem: ValueParser<T>): T[];
|
|
37
|
+
export declare function parseText(value: unknown, path: string): string;
|
|
38
|
+
export declare function readStrings(object: JsonObject, key: string, path: string): string[];
|
|
39
|
+
export declare function parseBlob(value: unknown, path?: string): Blob;
|
|
40
|
+
export declare function appendFiles(form: FormData, name: string, files: Blob[] | undefined, fallbackName: string): void;
|
|
17
41
|
/** A refusal the server gave on purpose (a 4xx other than 408 and 429): repeating the same request cannot change it. */
|
|
18
|
-
export declare function isDefinitive(error:
|
|
19
|
-
|
|
42
|
+
export declare function isDefinitive(error: unknown): boolean;
|
|
43
|
+
/** An axios-like HTTP client that already carries the bearer token. */
|
|
44
|
+
export interface SupportHttp {
|
|
20
45
|
get: (url: string, config?: object) => Promise<{
|
|
21
|
-
data:
|
|
46
|
+
data: unknown;
|
|
22
47
|
}>;
|
|
23
|
-
post: (url: string, data?:
|
|
24
|
-
data:
|
|
48
|
+
post: (url: string, data?: unknown, config?: object) => Promise<{
|
|
49
|
+
data: unknown;
|
|
25
50
|
}>;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
51
|
+
}
|
|
52
|
+
export interface NewTicketInput {
|
|
28
53
|
category: string;
|
|
29
54
|
subject: string;
|
|
30
55
|
body: string;
|
|
31
56
|
pageUrl?: string;
|
|
32
57
|
userAgent?: string;
|
|
33
58
|
appVersion?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Files the person picked, pasted or dropped.
|
|
36
|
-
*/
|
|
59
|
+
/** Files the person picked, pasted or dropped. */
|
|
37
60
|
files?: Blob[];
|
|
38
|
-
/**
|
|
39
|
-
* Page captures taken by the report-an-issue widget.
|
|
40
|
-
*/
|
|
61
|
+
/** Page captures taken by the report-an-issue widget. */
|
|
41
62
|
screenshots?: Blob[];
|
|
42
|
-
}
|
|
43
|
-
export
|
|
63
|
+
}
|
|
64
|
+
export interface ReplyInput {
|
|
44
65
|
body: string;
|
|
45
66
|
files?: Blob[];
|
|
46
67
|
screenshots?: Blob[];
|
|
47
|
-
}
|
|
48
|
-
export
|
|
49
|
-
satisfaction:
|
|
68
|
+
}
|
|
69
|
+
export interface RatingInput {
|
|
70
|
+
satisfaction: SupportSatisfaction;
|
|
50
71
|
comment?: string;
|
|
51
|
-
}
|
|
52
|
-
export
|
|
53
|
-
export type
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
}
|
|
73
|
+
export declare const SUPPORT_SATISFACTIONS: readonly ["Satisfied", "Unsatisfied"];
|
|
74
|
+
export type SupportSatisfaction = (typeof SUPPORT_SATISFACTIONS)[number];
|
|
75
|
+
/** A ticket's status as the platform names it. C# enum Webority.Support.SupportTicketStatus. */
|
|
76
|
+
export declare const TICKET_STATUSES: readonly ["Open", "InProgress", "WaitingOnCustomer", "Resolved", "Closed", "Cancelled"];
|
|
77
|
+
export type TicketStatus = (typeof TICKET_STATUSES)[number];
|
|
78
|
+
export declare const SUPPORT_TICKET_PRIORITIES: readonly ["Low", "Normal", "High", "Urgent"];
|
|
79
|
+
export type SupportTicketPriority = (typeof SUPPORT_TICKET_PRIORITIES)[number];
|
|
80
|
+
export declare const SUPPORT_FIELD_SOURCES: readonly ["Default", "Customer", "Triage", "Agent"];
|
|
81
|
+
export type SupportFieldSource = (typeof SUPPORT_FIELD_SOURCES)[number];
|
|
82
|
+
export declare const SUPPORT_SCREEN_RECOMMENDATIONS: readonly ["Pass", "Review", "Block", "Skip"];
|
|
83
|
+
export type SupportScreenRecommendation = (typeof SUPPORT_SCREEN_RECOMMENDATIONS)[number];
|
|
84
|
+
export declare const SUPPORT_MESSAGE_AUTHOR_KINDS: readonly ["Customer", "Agent", "System", "Assistant"];
|
|
85
|
+
export type SupportMessageAuthorKind = (typeof SUPPORT_MESSAGE_AUTHOR_KINDS)[number];
|
|
86
|
+
export declare const SUPPORT_MESSAGE_CHANNELS: readonly ["Portal", "Email", "Chat", "Team"];
|
|
87
|
+
export type SupportMessageChannel = (typeof SUPPORT_MESSAGE_CHANNELS)[number];
|
|
88
|
+
export declare const SUPPORT_ATTACHMENT_KINDS: readonly ["Screenshot", "File"];
|
|
89
|
+
export type SupportAttachmentKind = (typeof SUPPORT_ATTACHMENT_KINDS)[number];
|
|
90
|
+
/** A ticket's status as the customer reads it. C# enum Webority.Support.SupportCustomerStatus. */
|
|
91
|
+
export declare const SUPPORT_CUSTOMER_STATUSES: readonly ["Open", "NeedsReply", "Resolved", "Withdrawn"];
|
|
92
|
+
export type SupportCustomerStatus = (typeof SUPPORT_CUSTOMER_STATUSES)[number];
|
|
93
|
+
export interface TicketListQuery {
|
|
94
|
+
/** Only tickets in this customer status; every status when left out. */
|
|
58
95
|
status?: SupportCustomerStatus;
|
|
59
|
-
/**
|
|
60
|
-
* Matches the subject or the ticket number.
|
|
61
|
-
*/
|
|
96
|
+
/** Matches the subject or the ticket number. */
|
|
62
97
|
search?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Only tickets in this queue key.
|
|
65
|
-
*/
|
|
98
|
+
/** Only tickets in this queue key. */
|
|
66
99
|
queue?: string;
|
|
67
|
-
/**
|
|
68
|
-
* 1-based. The API defaults to 1.
|
|
69
|
-
*/
|
|
100
|
+
/** 1-based. The API defaults to 1. */
|
|
70
101
|
page?: number;
|
|
71
|
-
/**
|
|
72
|
-
* The API defaults to 20 and allows up to 100.
|
|
73
|
-
*/
|
|
102
|
+
/** The API defaults to 20 and allows up to 100. */
|
|
74
103
|
pageSize?: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* What a customer needs before raising a ticket: how to reach support and what may be sent.
|
|
107
|
+
* C# record Webority.Support.SupportContactInfo, served by GET {base}/settings.
|
|
108
|
+
*/
|
|
109
|
+
export interface SupportConfig {
|
|
110
|
+
productName: string;
|
|
111
|
+
supportEmail: string;
|
|
112
|
+
supportName: string;
|
|
113
|
+
supportPhone: string | null;
|
|
114
|
+
supportHours: string | null;
|
|
115
|
+
categories: readonly string[];
|
|
116
|
+
maxAttachmentBytes: number;
|
|
117
|
+
maxAttachmentsPerMessage: number;
|
|
118
|
+
allowedContentTypes: readonly string[];
|
|
119
|
+
subjectMaxLength: number;
|
|
120
|
+
bodyMaxLength: number;
|
|
121
|
+
satisfactionCommentMaxLength: number;
|
|
122
|
+
emailEnabled: boolean;
|
|
123
|
+
queues: readonly SupportContactQueue[];
|
|
124
|
+
}
|
|
125
|
+
/** A queue the signed-in reporter may raise a ticket into. C# record Webority.Support.SupportContactQueue. */
|
|
126
|
+
export interface SupportContactQueue {
|
|
127
|
+
key: string;
|
|
128
|
+
label: string;
|
|
129
|
+
categories: readonly string[];
|
|
130
|
+
}
|
|
131
|
+
/** One row of the customer's ticket list. C# record Webority.Support.SupportTicketSummary. */
|
|
132
|
+
export interface SupportTicketSummary {
|
|
133
|
+
id: string;
|
|
134
|
+
number: string;
|
|
135
|
+
category: string;
|
|
136
|
+
subject: string;
|
|
137
|
+
status: TicketStatus;
|
|
138
|
+
statusLabel: string;
|
|
139
|
+
messageCount: number;
|
|
140
|
+
awaitingCustomer: boolean;
|
|
141
|
+
createdDateTimeUtc: string;
|
|
142
|
+
updatedDateTimeUtc: string;
|
|
143
|
+
queue: string;
|
|
144
|
+
}
|
|
145
|
+
/** A file on a message; the bytes are fetched by `id`. C# record Webority.Support.SupportAttachmentView. */
|
|
146
|
+
export interface SupportAttachment {
|
|
147
|
+
id: string;
|
|
148
|
+
fileName: string;
|
|
149
|
+
contentType: string;
|
|
150
|
+
sizeBytes: number;
|
|
151
|
+
kind: SupportAttachmentKind;
|
|
152
|
+
}
|
|
153
|
+
/** One entry on a ticket's thread. C# record Webority.Support.SupportMessageView. */
|
|
154
|
+
export interface SupportMessage {
|
|
155
|
+
id: string;
|
|
156
|
+
authorKind: SupportMessageAuthorKind;
|
|
157
|
+
authorName: string | null;
|
|
158
|
+
body: string;
|
|
159
|
+
isInternal: boolean;
|
|
160
|
+
/** How a person's message arrived; null for a lifecycle event. */
|
|
161
|
+
channel: SupportMessageChannel | null;
|
|
162
|
+
createdDateTimeUtc: string;
|
|
163
|
+
attachments: readonly SupportAttachment[];
|
|
164
|
+
/** Agent views only: left out of the customer API's JSON. */
|
|
165
|
+
screenRecommendation?: SupportScreenRecommendation;
|
|
166
|
+
/** Agent views only: left out of the customer API's JSON. */
|
|
167
|
+
escalationJudgedDateTimeUtc?: string;
|
|
168
|
+
}
|
|
169
|
+
/** A ticket another ticket was merged into, or one merged into it. C# record Webority.Support.SupportTicketLink. */
|
|
170
|
+
export interface SupportTicketLink {
|
|
171
|
+
id: string;
|
|
172
|
+
number: string;
|
|
173
|
+
subject: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A ticket with its thread. C# record Webority.Support.SupportTicketDetail. The members the C# record marks
|
|
177
|
+
* `JsonIgnore(WhenWritingNull)` are absent from the JSON when null, so they are optional here.
|
|
178
|
+
*/
|
|
179
|
+
export interface SupportTicket {
|
|
180
|
+
id: string;
|
|
181
|
+
number: string;
|
|
182
|
+
realm: string | null;
|
|
183
|
+
accountId: number | null;
|
|
184
|
+
category: string;
|
|
185
|
+
categorySource: SupportFieldSource | null;
|
|
186
|
+
subject: string;
|
|
187
|
+
status: TicketStatus;
|
|
188
|
+
statusLabel: string;
|
|
189
|
+
priority: SupportTicketPriority | null;
|
|
190
|
+
prioritySource: SupportFieldSource | null;
|
|
191
|
+
reporterName: string;
|
|
192
|
+
reporterEmail: string | null;
|
|
193
|
+
assignedAgentUserId: number | null;
|
|
194
|
+
assignedAgentName: string | null;
|
|
195
|
+
replyDueDateTimeUtc: string | null;
|
|
196
|
+
isOverdue: boolean;
|
|
197
|
+
resolutionDueDateTimeUtc: string | null;
|
|
198
|
+
isResolutionOverdue: boolean;
|
|
199
|
+
pageUrl: string | null;
|
|
200
|
+
userAgent: string | null;
|
|
201
|
+
appVersion: string | null;
|
|
202
|
+
chatConversationReference: string | null;
|
|
203
|
+
satisfaction: SupportSatisfaction | null;
|
|
204
|
+
satisfactionComment: string | null;
|
|
205
|
+
canReopen: boolean;
|
|
206
|
+
canRate: boolean;
|
|
207
|
+
canCancel: boolean;
|
|
208
|
+
createdDateTimeUtc: string;
|
|
209
|
+
updatedDateTimeUtc: string;
|
|
210
|
+
resolvedDateTimeUtc: string | null;
|
|
211
|
+
closedDateTimeUtc: string | null;
|
|
212
|
+
messages: readonly SupportMessage[];
|
|
213
|
+
version: string | null;
|
|
214
|
+
subjectKind: string | null;
|
|
215
|
+
subjectReference: string | null;
|
|
216
|
+
queue: string | null;
|
|
217
|
+
subjectScreenRecommendation?: SupportScreenRecommendation;
|
|
218
|
+
serviceLevel?: string;
|
|
219
|
+
dueClockPausedDateTimeUtc?: string;
|
|
220
|
+
escalatedDateTimeUtc?: string;
|
|
221
|
+
/** The ticket this one was merged into. */
|
|
222
|
+
mergedInto?: SupportTicketLink;
|
|
223
|
+
/** The tickets merged into this one. */
|
|
224
|
+
mergedTickets?: readonly SupportTicketLink[];
|
|
225
|
+
raisedDateTimeUtc?: string;
|
|
226
|
+
accountName?: string;
|
|
227
|
+
/** Where the reporter works; absent when none. */
|
|
228
|
+
reporterPlace?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* One page of the customer's tickets, most recently updated first.
|
|
232
|
+
* C# record Webority.Support.SupportPage of SupportTicketSummary.
|
|
233
|
+
*/
|
|
234
|
+
export interface TicketPage {
|
|
235
|
+
items: readonly SupportTicketSummary[];
|
|
78
236
|
page: number;
|
|
79
237
|
pageSize: number;
|
|
80
238
|
totalCount: number;
|
|
81
239
|
totalPages: number;
|
|
82
|
-
}
|
|
83
|
-
|
|
240
|
+
}
|
|
241
|
+
/** How many of the customer's tickets are in each customer status. C# record Webority.Support.SupportTicketCounts. */
|
|
242
|
+
export interface TicketCounts {
|
|
84
243
|
open: number;
|
|
85
244
|
needsReply: number;
|
|
86
245
|
resolved: number;
|
|
87
246
|
withdrawn: number;
|
|
88
247
|
total: number;
|
|
89
|
-
/**
|
|
90
|
-
* When the customer last wrote on the longest-waiting ticket the team owes a reply on; null when none.
|
|
91
|
-
*/
|
|
248
|
+
/** When the customer last wrote on the longest-waiting ticket the team owes a reply on; null when none. */
|
|
92
249
|
oldestAwaitingAgentDateTimeUtc: string | null;
|
|
93
|
-
}
|
|
94
|
-
|
|
250
|
+
}
|
|
251
|
+
/** A known answer to a subject, from approved resolution notes. C# record Webority.Support.SupportSuggestedArticle. */
|
|
252
|
+
export interface SupportSuggestedArticle {
|
|
95
253
|
title: string;
|
|
96
254
|
summary: string;
|
|
97
|
-
}
|
|
98
|
-
export
|
|
99
|
-
|
|
255
|
+
}
|
|
256
|
+
export declare function parseSupportContactQueue(value: unknown, path?: string): SupportContactQueue;
|
|
257
|
+
export declare function parseSupportConfig(value: unknown, path?: string): SupportConfig;
|
|
258
|
+
export declare function parseSupportTicketSummary(value: unknown, path?: string): SupportTicketSummary;
|
|
259
|
+
export declare function parseSupportAttachment(value: unknown, path?: string): SupportAttachment;
|
|
260
|
+
export declare function parseSupportMessage(value: unknown, path?: string): SupportMessage;
|
|
261
|
+
export declare function parseSupportTicketLink(value: unknown, path?: string): SupportTicketLink;
|
|
262
|
+
export declare function parseSupportTicket(value: unknown, path?: string): SupportTicket;
|
|
263
|
+
export declare function parseTicketPage(value: unknown, path?: string): TicketPage;
|
|
264
|
+
export declare function parseTicketCounts(value: unknown, path?: string): TicketCounts;
|
|
265
|
+
export declare function parseSupportSuggestedArticle(value: unknown, path?: string): SupportSuggestedArticle;
|
|
266
|
+
export declare function parseSupportSuggestedArticles(value: unknown, path?: string): SupportSuggestedArticle[];
|
|
267
|
+
export interface SupportClient {
|
|
268
|
+
getConfig: () => Promise<SupportConfig>;
|
|
100
269
|
listTickets: (query?: TicketListQuery) => Promise<TicketPage>;
|
|
101
270
|
getTicketCounts: () => Promise<TicketCounts>;
|
|
102
|
-
getTicket: (id: string) => Promise<
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
createTicket: (input: NewTicketInput) => Promise<any>;
|
|
107
|
-
/**
|
|
108
|
-
* Known answers for a subject the person is about to raise; resolves to none when the server predates the route.
|
|
109
|
-
*/
|
|
271
|
+
getTicket: (id: string) => Promise<SupportTicket>;
|
|
272
|
+
/** A retry of the same message reuses its key. */
|
|
273
|
+
createTicket: (input: NewTicketInput) => Promise<SupportTicket>;
|
|
274
|
+
/** Known answers for a subject the person is about to raise; resolves to none when the server predates the route. */
|
|
110
275
|
getSuggestions: (subject: string, options?: {
|
|
111
276
|
signal?: AbortSignal;
|
|
112
|
-
}) => Promise<SupportSuggestedArticle[]>;
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
* Withdraws the ticket; resolves to the updated ticket.
|
|
120
|
-
*/
|
|
121
|
-
cancel: (id: string) => Promise<any>;
|
|
122
|
-
rate: (id: string, input: RatingInput) => Promise<any>;
|
|
277
|
+
}) => Promise<readonly SupportSuggestedArticle[]>;
|
|
278
|
+
/** A retry of the same message reuses its key. */
|
|
279
|
+
reply: (id: string, input: ReplyInput) => Promise<SupportTicket>;
|
|
280
|
+
reopen: (id: string) => Promise<SupportTicket>;
|
|
281
|
+
/** Withdraws the ticket; resolves to the updated ticket. */
|
|
282
|
+
cancel: (id: string) => Promise<SupportTicket>;
|
|
283
|
+
rate: (id: string, input: RatingInput) => Promise<SupportTicket>;
|
|
123
284
|
fetchAttachment: (id: string) => Promise<Blob>;
|
|
124
|
-
|
|
125
|
-
* The person's yes to a support action an
|
|
126
|
-
* assistant prepared (raise a ticket, reply on one, reopen one). Resolves to the ticket it acted on.
|
|
127
|
-
*/
|
|
128
|
-
confirmAction: (token: string) => Promise<any>;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* @typedef {object} SupportHttp An axios-like HTTP client that already carries the bearer token.
|
|
132
|
-
* @property {(url: string, config?: object) => Promise<{ data: any }>} get
|
|
133
|
-
* @property {(url: string, data?: any, config?: object) => Promise<{ data: any }>} post
|
|
134
|
-
*/
|
|
135
|
-
/**
|
|
136
|
-
* @typedef {object} NewTicketInput
|
|
137
|
-
* @property {string} category
|
|
138
|
-
* @property {string} subject
|
|
139
|
-
* @property {string} body
|
|
140
|
-
* @property {string} [pageUrl]
|
|
141
|
-
* @property {string} [userAgent]
|
|
142
|
-
* @property {string} [appVersion]
|
|
143
|
-
* @property {Blob[]} [files] Files the person picked, pasted or dropped.
|
|
144
|
-
* @property {Blob[]} [screenshots] Page captures taken by the report-an-issue widget.
|
|
145
|
-
*/
|
|
146
|
-
/**
|
|
147
|
-
* @typedef {object} ReplyInput
|
|
148
|
-
* @property {string} body
|
|
149
|
-
* @property {Blob[]} [files]
|
|
150
|
-
* @property {Blob[]} [screenshots]
|
|
151
|
-
*/
|
|
152
|
-
/**
|
|
153
|
-
* @typedef {object} RatingInput
|
|
154
|
-
* @property {"Satisfied"|"Unsatisfied"} satisfaction
|
|
155
|
-
* @property {string} [comment]
|
|
156
|
-
*/
|
|
157
|
-
/**
|
|
158
|
-
* @typedef {"Open"|"InProgress"|"WaitingOnCustomer"|"Resolved"|"Closed"|"Cancelled"} TicketStatus
|
|
159
|
-
*/
|
|
160
|
-
/**
|
|
161
|
-
* @typedef {"Open"|"NeedsReply"|"Resolved"|"Withdrawn"} SupportCustomerStatus A ticket's status as the customer reads it.
|
|
162
|
-
*/
|
|
163
|
-
/**
|
|
164
|
-
* @typedef {object} TicketListQuery
|
|
165
|
-
* @property {SupportCustomerStatus} [status] Only tickets in this customer status; every status when left out.
|
|
166
|
-
* @property {string} [search] Matches the subject or the ticket number.
|
|
167
|
-
* @property {string} [queue] Only tickets in this queue key.
|
|
168
|
-
* @property {number} [page] 1-based. The API defaults to 1.
|
|
169
|
-
* @property {number} [pageSize] The API defaults to 20 and allows up to 100.
|
|
170
|
-
*/
|
|
171
|
-
/**
|
|
172
|
-
* @typedef {object} TicketPage One page of the customer's tickets, most recently updated first.
|
|
173
|
-
* @property {any[]} items
|
|
174
|
-
* @property {number} page
|
|
175
|
-
* @property {number} pageSize
|
|
176
|
-
* @property {number} totalCount
|
|
177
|
-
* @property {number} totalPages
|
|
178
|
-
*/
|
|
179
|
-
/**
|
|
180
|
-
* @typedef {object} TicketCounts How many of the customer's tickets are in each customer status.
|
|
181
|
-
* @property {number} open
|
|
182
|
-
* @property {number} needsReply
|
|
183
|
-
* @property {number} resolved
|
|
184
|
-
* @property {number} withdrawn
|
|
185
|
-
* @property {number} total
|
|
186
|
-
* @property {string|null} oldestAwaitingAgentDateTimeUtc When the customer last wrote on the longest-waiting ticket the team owes a reply on; null when none.
|
|
187
|
-
*/
|
|
188
|
-
/**
|
|
189
|
-
* @typedef {object} SupportSuggestedArticle A known answer to a subject, from approved resolution notes.
|
|
190
|
-
* @property {string} title
|
|
191
|
-
* @property {string} summary
|
|
192
|
-
*/
|
|
193
|
-
/**
|
|
194
|
-
* @typedef {object} SupportClient
|
|
195
|
-
* @property {() => Promise<any>} getConfig
|
|
196
|
-
* @property {(query?: TicketListQuery) => Promise<TicketPage>} listTickets
|
|
197
|
-
* @property {() => Promise<TicketCounts>} getTicketCounts
|
|
198
|
-
* @property {(id: string) => Promise<any>} getTicket
|
|
199
|
-
* @property {(input: NewTicketInput) => Promise<any>} createTicket A retry of the same message reuses its key.
|
|
200
|
-
* @property {(subject: string, options?: { signal?: AbortSignal }) => Promise<SupportSuggestedArticle[]>} getSuggestions
|
|
201
|
-
* Known answers for a subject the person is about to raise; resolves to none when the server predates the route.
|
|
202
|
-
* @property {(id: string, input: ReplyInput) => Promise<any>} reply A retry of the same message reuses its key.
|
|
203
|
-
* @property {(id: string) => Promise<any>} reopen
|
|
204
|
-
* @property {(id: string) => Promise<any>} cancel Withdraws the ticket; resolves to the updated ticket.
|
|
205
|
-
* @property {(id: string, input: RatingInput) => Promise<any>} rate
|
|
206
|
-
* @property {(id: string) => Promise<Blob>} fetchAttachment
|
|
207
|
-
* @property {(token: string) => Promise<any>} confirmAction The person's yes to a support action an
|
|
208
|
-
* assistant prepared (raise a ticket, reply on one, reopen one). Resolves to the ticket it acted on.
|
|
209
|
-
*/
|
|
285
|
+
}
|
|
210
286
|
/**
|
|
211
287
|
* Binds the support HTTP contract to the product's own authenticated client.
|
|
212
288
|
*
|
|
213
|
-
* @param
|
|
214
|
-
* @param
|
|
215
|
-
* under, as a string or as `{ base }`.
|
|
216
|
-
* @returns {SupportClient}
|
|
289
|
+
* @param http The product's axios-like instance (bearer token and refresh already wired).
|
|
290
|
+
* @param options The prefix the API maps the support endpoints under, as a string or as `{ base }`.
|
|
217
291
|
*/
|
|
218
292
|
export declare function createSupportClient(http: SupportHttp, options?: string | {
|
|
219
293
|
base?: string;
|
|
220
294
|
}): SupportClient;
|
|
295
|
+
export {};
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
1
2
|
/**
|
|
2
3
|
* Picked, dropped or pasted files for a message, limited to what the support config allows.
|
|
3
4
|
* The caller checks every file against the config and passes the one message through `error`,
|
|
4
5
|
* so the field's own check stays off and a rejected pick never shows two messages.
|
|
5
6
|
* A limit the config leaves open (no types listed, a size of 0) is passed as open, so the
|
|
6
7
|
* field accepts any file and its hint names only the limits that exist.
|
|
7
|
-
*
|
|
8
|
-
* @param {object} props
|
|
9
|
-
* @param {string} [props.id]
|
|
10
|
-
* @param {string} [props.label="Attachments"]
|
|
11
|
-
* @param {File[]} props.files
|
|
12
|
-
* @param {(files: File[]) => void} props.onChange
|
|
13
|
-
* @param {{ maxAttachmentBytes?: number, allowedContentTypes?: string[] }|null} [props.config]
|
|
14
|
-
* @param {string} [props.error]
|
|
15
8
|
*/
|
|
16
|
-
export
|
|
9
|
+
export interface AttachmentFieldProps {
|
|
17
10
|
id?: string;
|
|
18
11
|
label?: string;
|
|
19
12
|
files: File[];
|
|
20
13
|
onChange: (files: File[]) => void;
|
|
21
14
|
config?: {
|
|
22
15
|
maxAttachmentBytes?: number;
|
|
23
|
-
allowedContentTypes?: string[];
|
|
16
|
+
allowedContentTypes?: readonly string[];
|
|
24
17
|
} | null;
|
|
25
18
|
error?: string;
|
|
26
|
-
}
|
|
19
|
+
}
|
|
20
|
+
export default function AttachmentField({ id, label, files, onChange, config, error }: AttachmentFieldProps): ReactElement;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import type { SupportAttachment } from "../client.ts";
|
|
3
|
+
export interface AttachmentChipProps {
|
|
4
|
+
attachment: SupportAttachment;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* One attachment on a message, as a chip. Nothing is fetched until it is pressed: the bytes need the
|
|
3
8
|
* bearer token, so the press fetches them through the support client and opens them in a new tab, or
|
|
4
9
|
* downloads them when the type is not one the browser shows inline.
|
|
5
|
-
*
|
|
6
|
-
* @param {object} props
|
|
7
|
-
* @param {{ id: string, fileName: string, contentType: string, sizeBytes: number, kind: string }} props.attachment
|
|
8
10
|
*/
|
|
9
|
-
export default function AttachmentChip({ attachment }:
|
|
10
|
-
attachment: {
|
|
11
|
-
id: string;
|
|
12
|
-
fileName: string;
|
|
13
|
-
contentType: string;
|
|
14
|
-
sizeBytes: number;
|
|
15
|
-
kind: string;
|
|
16
|
-
};
|
|
17
|
-
}): import("react").JSX.Element;
|
|
11
|
+
export default function AttachmentChip({ attachment }: AttachmentChipProps): ReactElement;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { SupportMessage } from "../client.ts";
|
|
3
|
+
export interface MessageThreadProps {
|
|
4
|
+
messages: readonly SupportMessage[];
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* A ticket's conversation as reply rows: each reply carries its author's avatar, name, the
|
|
3
8
|
* support badge for the team, its time with the zone, and its body. Status or assignment events
|
|
4
9
|
* show as small centred lines.
|
|
5
|
-
*
|
|
6
|
-
* @param {object} props
|
|
7
|
-
* @param {{ id: string, authorKind: string, authorName: string|null, body: string, createdDateTimeUtc: string, attachments: any[] }[]} props.messages
|
|
8
10
|
*/
|
|
9
|
-
export default function MessageThread({ messages }:
|
|
10
|
-
messages: {
|
|
11
|
-
id: string;
|
|
12
|
-
authorKind: string;
|
|
13
|
-
authorName: string | null;
|
|
14
|
-
body: string;
|
|
15
|
-
createdDateTimeUtc: string;
|
|
16
|
-
attachments: any[];
|
|
17
|
-
}[];
|
|
18
|
-
}): import("react").JSX.Element;
|
|
11
|
+
export default function MessageThread({ messages }: MessageThreadProps): ReactNode;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* @param {object} props
|
|
5
|
-
* @param {boolean} props.open
|
|
6
|
-
* @param {() => void} props.onClose
|
|
7
|
-
* @param {(ticket: any) => void} props.onCreated Receives the new ticket.
|
|
8
|
-
* @param {any} props.config
|
|
9
|
-
* @param {string} [props.defaultCategory]
|
|
10
|
-
* @param {string} [props.appVersion] Recorded on the ticket so support knows which build you were on.
|
|
11
|
-
* @param {boolean} [props.emailEnabled=true] False when the desk does not reply by email.
|
|
12
|
-
*/
|
|
13
|
-
export default function NewTicketModal({ open, onClose, onCreated, config, defaultCategory, appVersion, emailEnabled }: {
|
|
1
|
+
import type { SupportConfig, SupportTicket } from "../client.ts";
|
|
2
|
+
export interface NewTicketModalProps {
|
|
14
3
|
open: boolean;
|
|
15
4
|
onClose: () => void;
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
/** Receives the new ticket. */
|
|
6
|
+
onCreated: (ticket: SupportTicket) => void;
|
|
7
|
+
config: SupportConfig | null | undefined;
|
|
18
8
|
defaultCategory?: string;
|
|
9
|
+
/** Recorded on the ticket so support knows which build you were on. */
|
|
19
10
|
appVersion?: string;
|
|
11
|
+
/** False when the desk does not reply by email. */
|
|
20
12
|
emailEnabled?: boolean;
|
|
21
|
-
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The New ticket dialog.
|
|
16
|
+
*/
|
|
17
|
+
export default function NewTicketModal({ open, onClose, onCreated, config, defaultCategory, appVersion, emailEnabled, }: NewTicketModalProps): import("react").JSX.Element;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @param {boolean} [props.canRate=false]
|
|
8
|
-
* @param {number} [props.commentMaxLength] From the support config.
|
|
9
|
-
* @param {(input: { satisfaction: "Satisfied"|"Unsatisfied", comment: string }) => Promise<unknown>} props.onRate
|
|
10
|
-
*/
|
|
11
|
-
export default function RatingPanel({ satisfaction, comment, canRate, commentMaxLength, onRate }: {
|
|
12
|
-
satisfaction?: "Satisfied" | "Unsatisfied" | null;
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { SupportSatisfaction } from "../client.ts";
|
|
3
|
+
export interface RatingPanelProps {
|
|
4
|
+
/** The rating already given, if any. */
|
|
5
|
+
satisfaction?: SupportSatisfaction | null;
|
|
6
|
+
/** The comment given with it. */
|
|
13
7
|
comment?: string | null;
|
|
14
8
|
canRate?: boolean;
|
|
9
|
+
/** From the support config. */
|
|
15
10
|
commentMaxLength?: number;
|
|
16
11
|
onRate: (input: {
|
|
17
|
-
satisfaction:
|
|
12
|
+
satisfaction: SupportSatisfaction;
|
|
18
13
|
comment: string;
|
|
19
14
|
}) => Promise<unknown>;
|
|
20
|
-
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Asks whether a settled ticket solved the problem, or shows the answer already given.
|
|
18
|
+
*/
|
|
19
|
+
export default function RatingPanel({ satisfaction, comment, canRate, commentMaxLength, onRate }: RatingPanelProps): ReactNode;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import type { SupportConfig } from "../client.ts";
|
|
2
|
+
export interface ReplyBoxProps {
|
|
3
|
+
/** Rejects with a SupportApiError on failure. */
|
|
4
|
+
onSend: (input: {
|
|
5
|
+
body: string;
|
|
6
|
+
files: File[];
|
|
7
|
+
}) => Promise<unknown>;
|
|
8
|
+
/** The support config, for the text and attachment limits. */
|
|
9
|
+
config?: Partial<Pick<SupportConfig, "bodyMaxLength" | "maxAttachmentBytes" | "maxAttachmentsPerMessage" | "allowedContentTypes">> | null;
|
|
10
|
+
}
|
|
1
11
|
/**
|
|
2
12
|
* The customer's reply to a ticket, with attachments picked from the Attach files button or pasted as images.
|
|
3
13
|
* A file already on the reply is skipped, and only as many files as the limit leaves room for are
|
|
4
14
|
* kept, with one sentence saying which.
|
|
5
|
-
*
|
|
6
|
-
* @param {object} props
|
|
7
|
-
* @param {(input: { body: string, files: File[] }) => Promise<unknown>} props.onSend Rejects with a SupportApiError on failure.
|
|
8
|
-
* @param {any} [props.config] The support config, for the text and attachment limits.
|
|
9
15
|
*/
|
|
10
|
-
export default function ReplyBox({ onSend, config }:
|
|
11
|
-
onSend: (input: {
|
|
12
|
-
body: string;
|
|
13
|
-
files: File[];
|
|
14
|
-
}) => Promise<unknown>;
|
|
15
|
-
config?: any;
|
|
16
|
-
}): import("react").JSX.Element;
|
|
16
|
+
export default function ReplyBox({ onSend, config }: ReplyBoxProps): import("react").JSX.Element;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { SupportSuggestedArticle } from "../client.ts";
|
|
3
|
+
export interface SuggestedAnswersProps {
|
|
4
|
+
items: readonly SupportSuggestedArticle[];
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* Known answers shown under the subject of a new ticket. Plain text only: titles and summaries
|
|
3
8
|
* come from the support team's notes and render as text, never as markup.
|
|
4
|
-
*
|
|
5
|
-
* @param {object} props
|
|
6
|
-
* @param {{ title: string, summary: string }[]} props.items
|
|
7
9
|
*/
|
|
8
|
-
export default function SuggestedAnswers({ items }:
|
|
9
|
-
items: {
|
|
10
|
-
title: string;
|
|
11
|
-
summary: string;
|
|
12
|
-
}[];
|
|
13
|
-
}): import("react").JSX.Element | null;
|
|
10
|
+
export default function SuggestedAnswers({ items }: SuggestedAnswersProps): ReactNode;
|