@webority/support-react 0.149.0 → 0.152.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.
Files changed (46) hide show
  1. package/README.md +0 -6
  2. package/dist/guidance.json +1 -1
  3. package/dist/support-react.js +1 -1
  4. package/dist/types/ReportIssue.d.ts +23 -24
  5. package/dist/types/ReportIssue.meta.d.ts +2 -54
  6. package/dist/types/SupportCenter.d.ts +17 -18
  7. package/dist/types/SupportCenter.meta.d.ts +2 -58
  8. package/dist/types/SupportContact.d.ts +4 -6
  9. package/dist/types/SupportContact.meta.d.ts +2 -25
  10. package/dist/types/SupportProvider.d.ts +16 -16
  11. package/dist/types/agent/SupportAgentProvider.d.ts +14 -12
  12. package/dist/types/agent/SupportAgentTicket.d.ts +6 -7
  13. package/dist/types/agent/SupportQueue.d.ts +18 -18
  14. package/dist/types/agent/SupportQueue.meta.d.ts +1 -1
  15. package/dist/types/agent/client.d.ts +228 -98
  16. package/dist/types/agent/context.d.ts +37 -66
  17. package/dist/types/agent/labels.d.ts +80 -79
  18. package/dist/types/client.d.ts +241 -174
  19. package/dist/types/components/AttachmentField.d.ts +7 -13
  20. package/dist/types/components/AttachmentThumb.d.ts +6 -12
  21. package/dist/types/components/MessageThread.d.ts +6 -13
  22. package/dist/types/components/NewTicketModal.d.ts +14 -18
  23. package/dist/types/components/RatingPanel.d.ts +14 -15
  24. package/dist/types/components/ReplyBox.d.ts +11 -11
  25. package/dist/types/components/SuggestedAnswers.d.ts +6 -9
  26. package/dist/types/components/SupportTime.d.ts +8 -10
  27. package/dist/types/components/TicketDetail.d.ts +11 -12
  28. package/dist/types/components/TicketForm.d.ts +31 -39
  29. package/dist/types/components/TicketList.d.ts +31 -25
  30. package/dist/types/context.d.ts +32 -51
  31. package/dist/types/helpCentre/HelpArticle.d.ts +11 -9
  32. package/dist/types/helpCentre/HelpArticle.meta.d.ts +2 -34
  33. package/dist/types/helpCentre/HelpCentre.d.ts +11 -9
  34. package/dist/types/helpCentre/HelpCentre.meta.d.ts +2 -33
  35. package/dist/types/helpCentre/client.d.ts +25 -59
  36. package/dist/types/helpCentre/labels.d.ts +19 -19
  37. package/dist/types/helpCentre/useHelpCentre.d.ts +8 -20
  38. package/dist/types/index.d.ts +18 -15
  39. package/dist/types/labels.d.ts +8 -8
  40. package/dist/types/lib/errors.d.ts +4 -4
  41. package/dist/types/lib/files.d.ts +43 -31
  42. package/dist/types/lib/status.d.ts +8 -3
  43. package/dist/types/lib/subject.d.ts +3 -3
  44. package/dist/types/lib/url.d.ts +4 -4
  45. package/dist/types/lib/useDebouncedValue.d.ts +3 -3
  46. package/package.json +10 -10
@@ -2,219 +2,286 @@
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 {string} code Machine-readable reason from the API, or "network" when no response arrived.
9
- * @param {string} message The sentence to show the person.
10
- * @param {number} [status] HTTP status, when a response arrived.
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: any): Promise<SupportApiError>;
15
- export declare function call(request: any): Promise<any>;
16
- export declare function appendFiles(form: any, name: any, files: any, fallbackName: any): void;
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: any): boolean;
19
- export type SupportHttp = {
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: any;
46
+ data: unknown;
22
47
  }>;
23
- post: (url: string, data?: any, config?: object) => Promise<{
24
- data: any;
48
+ post: (url: string, data?: unknown, config?: object) => Promise<{
49
+ data: unknown;
25
50
  }>;
26
- };
27
- export type NewTicketInput = {
51
+ }
52
+ export interface NewTicketInput {
28
53
  category: string;
29
54
  subject: string;
30
55
  body: string;
31
56
  pageUrl?: string;
32
- userAgent?: string;
33
- appVersion?: string;
34
- /**
35
- * Files the person picked, pasted or dropped.
36
- */
57
+ userAgent?: string | undefined;
58
+ appVersion?: string | undefined;
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 type ReplyInput = {
63
+ }
64
+ export interface ReplyInput {
44
65
  body: string;
45
66
  files?: Blob[];
46
67
  screenshots?: Blob[];
47
- };
48
- export type RatingInput = {
49
- satisfaction: "Satisfied" | "Unsatisfied";
68
+ }
69
+ export interface RatingInput {
70
+ satisfaction: SupportSatisfaction;
50
71
  comment?: string;
51
- };
52
- export type TicketStatus = "Open" | "InProgress" | "WaitingOnCustomer" | "Resolved" | "Closed" | "Cancelled";
53
- export type SupportCustomerStatus = "Open" | "NeedsReply" | "Resolved" | "Withdrawn";
54
- export type TicketListQuery = {
55
- /**
56
- * Only tickets in this customer status; every status when left out.
57
- */
58
- status?: SupportCustomerStatus;
59
- /**
60
- * Matches the subject or the ticket number.
61
- */
62
- search?: string;
63
- /**
64
- * Only tickets in this queue key.
65
- */
66
- queue?: string;
67
- /**
68
- * 1-based. The API defaults to 1.
69
- */
70
- page?: number;
71
- /**
72
- * The API defaults to 20 and allows up to 100.
73
- */
74
- pageSize?: number;
75
- };
76
- export type TicketPage = {
77
- items: any[];
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. */
95
+ status?: SupportCustomerStatus | undefined;
96
+ /** Matches the subject or the ticket number. */
97
+ search?: string | undefined;
98
+ /** Only tickets in this queue key. */
99
+ queue?: string | undefined;
100
+ /** 1-based. The API defaults to 1. */
101
+ page?: number | undefined;
102
+ /** The API defaults to 20 and allows up to 100. */
103
+ pageSize?: number | undefined;
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
+ }
124
+ /** One row of the customer's ticket list. C# record Webority.Support.SupportTicketSummary. */
125
+ export interface SupportTicketSummary {
126
+ id: string;
127
+ number: string;
128
+ category: string;
129
+ subject: string;
130
+ status: TicketStatus;
131
+ statusLabel: string;
132
+ messageCount: number;
133
+ awaitingCustomer: boolean;
134
+ createdDateTimeUtc: string;
135
+ updatedDateTimeUtc: string;
136
+ queue: string;
137
+ }
138
+ /** A file on a message; the bytes are fetched by `id`. C# record Webority.Support.SupportAttachmentView. */
139
+ export interface SupportAttachment {
140
+ id: string;
141
+ fileName: string;
142
+ contentType: string;
143
+ sizeBytes: number;
144
+ kind: SupportAttachmentKind;
145
+ }
146
+ /** One entry on a ticket's thread. C# record Webority.Support.SupportMessageView. */
147
+ export interface SupportMessage {
148
+ id: string;
149
+ authorKind: SupportMessageAuthorKind;
150
+ authorName: string | null;
151
+ body: string;
152
+ isInternal: boolean;
153
+ /** How a person's message arrived; null for a lifecycle event. */
154
+ channel: SupportMessageChannel | null;
155
+ createdDateTimeUtc: string;
156
+ attachments: readonly SupportAttachment[];
157
+ /** Agent views only: left out of the customer API's JSON. */
158
+ screenRecommendation?: SupportScreenRecommendation | undefined;
159
+ /** Agent views only: left out of the customer API's JSON. */
160
+ escalationJudgedDateTimeUtc?: string | undefined;
161
+ }
162
+ /** A ticket another ticket was merged into, or one merged into it. C# record Webority.Support.SupportTicketLink. */
163
+ export interface SupportTicketLink {
164
+ id: string;
165
+ number: string;
166
+ subject: string;
167
+ }
168
+ /**
169
+ * A ticket with its thread. C# record Webority.Support.SupportTicketDetail. The members the C# record marks
170
+ * `JsonIgnore(WhenWritingNull)` are absent from the JSON when null, so they are optional here.
171
+ */
172
+ export interface SupportTicket {
173
+ id: string;
174
+ number: string;
175
+ realm: string | null;
176
+ accountId: number | null;
177
+ category: string;
178
+ categorySource: SupportFieldSource | null;
179
+ subject: string;
180
+ status: TicketStatus;
181
+ statusLabel: string;
182
+ priority: SupportTicketPriority | null;
183
+ prioritySource: SupportFieldSource | null;
184
+ reporterName: string;
185
+ reporterEmail: string | null;
186
+ assignedAgentUserId: number | null;
187
+ assignedAgentName: string | null;
188
+ replyDueDateTimeUtc: string | null;
189
+ isOverdue: boolean;
190
+ resolutionDueDateTimeUtc: string | null;
191
+ isResolutionOverdue: boolean;
192
+ pageUrl: string | null;
193
+ userAgent: string | null;
194
+ appVersion: string | null;
195
+ chatConversationReference: string | null;
196
+ satisfaction: SupportSatisfaction | null;
197
+ satisfactionComment: string | null;
198
+ canReopen: boolean;
199
+ canRate: boolean;
200
+ canCancel: boolean;
201
+ createdDateTimeUtc: string;
202
+ updatedDateTimeUtc: string;
203
+ resolvedDateTimeUtc: string | null;
204
+ closedDateTimeUtc: string | null;
205
+ messages: readonly SupportMessage[];
206
+ version: string | null;
207
+ subjectKind: string | null;
208
+ subjectReference: string | null;
209
+ queue: string | null;
210
+ subjectScreenRecommendation?: SupportScreenRecommendation | undefined;
211
+ serviceLevel?: string | undefined;
212
+ dueClockPausedDateTimeUtc?: string | undefined;
213
+ escalatedDateTimeUtc?: string | undefined;
214
+ /** The ticket this one was merged into. */
215
+ mergedInto?: SupportTicketLink | undefined;
216
+ /** The tickets merged into this one. */
217
+ mergedTickets?: readonly SupportTicketLink[] | undefined;
218
+ raisedDateTimeUtc?: string | undefined;
219
+ accountName?: string | undefined;
220
+ /** Where the reporter works; absent when none. */
221
+ reporterPlace?: string | undefined;
222
+ }
223
+ /**
224
+ * One page of the customer's tickets, most recently updated first.
225
+ * C# record Webority.Support.SupportPage of SupportTicketSummary.
226
+ */
227
+ export interface TicketPage {
228
+ items: readonly SupportTicketSummary[];
78
229
  page: number;
79
230
  pageSize: number;
80
231
  totalCount: number;
81
232
  totalPages: number;
82
- };
83
- export type TicketCounts = {
233
+ }
234
+ /** How many of the customer's tickets are in each customer status. C# record Webority.Support.SupportTicketCounts. */
235
+ export interface TicketCounts {
84
236
  open: number;
85
237
  needsReply: number;
86
238
  resolved: number;
87
239
  withdrawn: number;
88
240
  total: number;
89
- /**
90
- * When the customer last wrote on the longest-waiting ticket the team owes a reply on; null when none.
91
- */
241
+ /** When the customer last wrote on the longest-waiting ticket the team owes a reply on; null when none. */
92
242
  oldestAwaitingAgentDateTimeUtc: string | null;
93
- };
94
- export type SupportSuggestedArticle = {
243
+ }
244
+ /** A known answer to a subject, from approved resolution notes. C# record Webority.Support.SupportSuggestedArticle. */
245
+ export interface SupportSuggestedArticle {
95
246
  title: string;
96
247
  summary: string;
97
- };
98
- export type SupportClient = {
99
- getConfig: () => Promise<any>;
248
+ }
249
+ export declare function parseSupportConfig(value: unknown, path?: string): SupportConfig;
250
+ export declare function parseSupportTicketSummary(value: unknown, path?: string): SupportTicketSummary;
251
+ export declare function parseSupportAttachment(value: unknown, path?: string): SupportAttachment;
252
+ export declare function parseSupportMessage(value: unknown, path?: string): SupportMessage;
253
+ export declare function parseSupportTicketLink(value: unknown, path?: string): SupportTicketLink;
254
+ export declare function parseSupportTicket(value: unknown, path?: string): SupportTicket;
255
+ export declare function parseTicketPage(value: unknown, path?: string): TicketPage;
256
+ export declare function parseTicketCounts(value: unknown, path?: string): TicketCounts;
257
+ export declare function parseSupportSuggestedArticle(value: unknown, path?: string): SupportSuggestedArticle;
258
+ export declare function parseSupportSuggestedArticles(value: unknown, path?: string): SupportSuggestedArticle[];
259
+ export interface SupportClient {
260
+ getConfig: () => Promise<SupportConfig>;
100
261
  listTickets: (query?: TicketListQuery) => Promise<TicketPage>;
101
262
  getTicketCounts: () => Promise<TicketCounts>;
102
- getTicket: (id: string) => Promise<any>;
103
- /**
104
- * A retry of the same message reuses its key.
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
- */
263
+ getTicket: (id: string) => Promise<SupportTicket>;
264
+ /** A retry of the same message reuses its key. */
265
+ createTicket: (input: NewTicketInput) => Promise<SupportTicket>;
266
+ /** Known answers for a subject the person is about to raise; resolves to none when the server predates the route. */
110
267
  getSuggestions: (subject: string, options?: {
111
268
  signal?: AbortSignal;
112
- }) => Promise<SupportSuggestedArticle[]>;
113
- /**
114
- * A retry of the same message reuses its key.
115
- */
116
- reply: (id: string, input: ReplyInput) => Promise<any>;
117
- reopen: (id: string) => Promise<any>;
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>;
269
+ }) => Promise<readonly SupportSuggestedArticle[]>;
270
+ /** A retry of the same message reuses its key. */
271
+ reply: (id: string, input: ReplyInput) => Promise<SupportTicket>;
272
+ reopen: (id: string) => Promise<SupportTicket>;
273
+ /** Withdraws the ticket; resolves to the updated ticket. */
274
+ cancel: (id: string) => Promise<SupportTicket>;
275
+ rate: (id: string, input: RatingInput) => Promise<SupportTicket>;
123
276
  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
- */
277
+ }
210
278
  /**
211
279
  * Binds the support HTTP contract to the product's own authenticated client.
212
280
  *
213
- * @param {SupportHttp} http The product's axios-like instance (bearer token and refresh already wired).
214
- * @param {string | { base?: string }} [options="/api/support"] The prefix the API maps the support endpoints
215
- * under, as a string or as `{ base }`.
216
- * @returns {SupportClient}
281
+ * @param http The product's axios-like instance (bearer token and refresh already wired).
282
+ * @param options The prefix the API maps the support endpoints under, as a string or as `{ base }`.
217
283
  */
218
284
  export declare function createSupportClient(http: SupportHttp, options?: string | {
219
285
  base?: string;
220
286
  }): SupportClient;
287
+ 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 default function AttachmentField({ id, label, files, onChange, config, error }: {
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[];
24
- } | null;
25
- error?: string;
26
- }): import("react").JSX.Element;
16
+ allowedContentTypes?: readonly string[];
17
+ } | null | undefined;
18
+ error?: string | undefined;
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
- * The New ticket dialog.
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
- onCreated: (ticket: any) => void;
17
- config: any;
18
- defaultCategory?: string;
19
- appVersion?: string;
5
+ /** Receives the new ticket. */
6
+ onCreated: (ticket: SupportTicket) => void;
7
+ config: SupportConfig | null | undefined;
8
+ defaultCategory?: string | undefined;
9
+ /** Recorded on the ticket so support knows which build you were on. */
10
+ appVersion?: string | undefined;
11
+ /** False when the desk does not reply by email. */
20
12
  emailEnabled?: boolean;
21
- }): import("react").JSX.Element;
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
- * Asks whether a settled ticket solved the problem, or shows the answer already given.
3
- *
4
- * @param {object} props
5
- * @param {"Satisfied"|"Unsatisfied"|null} [props.satisfaction] The rating already given, if any.
6
- * @param {string|null} [props.comment] The comment given with it.
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;
15
- commentMaxLength?: number;
9
+ /** From the support config. */
10
+ commentMaxLength?: number | undefined;
16
11
  onRate: (input: {
17
- satisfaction: "Satisfied" | "Unsatisfied";
12
+ satisfaction: SupportSatisfaction;
18
13
  comment: string;
19
14
  }) => Promise<unknown>;
20
- }): import("react").JSX.Element | null;
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;