@webority/support-react 0.13.1 → 0.13.4

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 CHANGED
@@ -42,10 +42,18 @@ export function App() {
42
42
  rejects with a `SupportApiError` carrying `code`, `status` and a `message` written for the
43
43
  person, which the components show as-is.
44
44
 
45
+ `listTickets` returns one page, most recently updated first, in the shape
46
+ `{ items, page, pageSize, totalCount, totalPages }`. Every query part is optional: `status` is one
47
+ of `Open`, `InProgress`, `Resolved` or `Closed`, `search` matches the subject or the ticket
48
+ number, `page` starts at 1, and the API caps `pageSize` at 100. `getTicketCounts` returns
49
+ `{ open, inProgress, resolved, closed, total }`. A ticket's `accountId` and `realm` are `null` on
50
+ the customer side, and its `version` is for support staff only; the components use none of them.
51
+
45
52
  | Method | Request |
46
53
  |---|---|
47
54
  | `getConfig()` | `GET {base}/settings` |
48
- | `listTickets()` | `GET {base}/tickets` |
55
+ | `listTickets({ status, search, page, pageSize })` | `GET {base}/tickets?status=&search=&page=&pageSize=`, one page |
56
+ | `getTicketCounts()` | `GET {base}/tickets/counts` |
49
57
  | `getTicket(id)` | `GET {base}/tickets/{id}` |
50
58
  | `createTicket({ category, subject, body, pageUrl, userAgent, appVersion, files, screenshots })` | `POST {base}/tickets`, multipart |
51
59
  | `reply(id, { body, files, screenshots })` | `POST {base}/tickets/{id}/replies`, multipart |
@@ -58,7 +66,10 @@ person, which the components show as-is.
58
66
  ### `<SupportCenter />`
59
67
 
60
68
  The support page: the customer's tickets with status tabs and a search box, one ticket's
61
- conversation, and a New ticket dialog.
69
+ conversation, and a New ticket dialog. The server filters, searches and pages the list, so it
70
+ stays quick however many tickets a customer has. The tabs are All, Open, In progress, Resolved
71
+ and Closed, each labelled with its count from `getTicketCounts`. All is chosen first. The search
72
+ asks the server once typing pauses, and a new tab or search starts again at page 1.
62
73
 
63
74
  ```jsx
64
75
  <SupportCenter appVersion={import.meta.env.VITE_APP_VERSION} defaultCategory="Question" />
@@ -74,7 +85,8 @@ Support emails link to the support page with `?ticket=<id>`. The centre opens th
74
85
  keeps the parameter in step as tickets open and close, so a refresh stays on the same ticket.
75
86
  In a ticket the customer can reply with files (pasting an image into the message attaches it),
76
87
  reopen a settled ticket, and say whether it solved their problem. Files are checked against the
77
- config's type, size and count limits before anything uploads.
88
+ config's type, size and count limits before anything uploads, and a file that breaks a limit gets
89
+ one message, in the package's words.
78
90
 
79
91
  ### `<ReportIssue />`
80
92
 
@@ -95,6 +107,17 @@ pasting them. The ticket records the page address, the browser and the product v
95
107
  | `getTicketHref(id)` | Shows a View ticket link to the new ticket. |
96
108
  | `onOpenTicket(ticket)` | Called by the View ticket button when there is no href. |
97
109
  | `onCreated(ticket)` | Called once the ticket is raised. |
110
+ | `className` | Added to the button's wrapper, floating or inline, to place it. |
111
+ | `style` | Merged over the wrapper's own style. |
112
+
113
+ Place the button with `className` or `style`. Both land on the wrapper that holds the button,
114
+ which is the element that floats. With `floating`, an inset moves it clear of other fixed controls
115
+ such as a chat launcher:
116
+
117
+ ```jsx
118
+ <ReportIssue floating style={{ bottom: "5rem" }} />
119
+ <ReportIssue className="ms-auto" />
120
+ ```
98
121
 
99
122
  The screenshot is taken before the dialog opens, and the button itself is left out of it.
100
123
  Anything else the page marks with `data-support-capture="exclude"` is left out too.
@@ -110,8 +133,11 @@ support config. A field the product has not set is left out, and nothing renders
110
133
 
111
134
  ## Hooks
112
135
 
113
- `useSupportConfig()`, `useSupportTickets()` and `useSupportTicket(id)` return the data with
114
- `loading`, `error` and `reload`. `useSupportTicket` also returns `reply`, `reopen` and `rate`,
136
+ `useSupportConfig()`, `useSupportTickets(query)`, `useSupportTicketCounts()` and
137
+ `useSupportTicket(id)` return the data with `loading`, `error` and `reload`.
138
+ `useSupportTickets` takes the same query as `listTickets` and returns `tickets` (the page's items),
139
+ `totalCount` and `totalPages`; it asks again whenever the query changes. `useSupportTicketCounts`
140
+ returns `counts`. `useSupportTicket` also returns `reply`, `reopen` and `rate`,
115
141
  each resolving to the updated ticket. `useSupportClient()` returns the client itself.
116
142
 
117
143
  ## Display rules