@webority/support-react 0.20.0 → 0.22.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 CHANGED
@@ -60,6 +60,12 @@ the customer side, and its `version` is for support staff only; the components u
60
60
  | `reopen(id)` | `POST {base}/tickets/{id}/reopen` |
61
61
  | `rate(id, { satisfaction, comment })` | `POST {base}/tickets/{id}/rating`, JSON |
62
62
  | `fetchAttachment(id)` | `GET {base}/attachments/{id}`, returns a `Blob` |
63
+ | `confirmAction(token)` | `POST {base}/actions/confirm`, JSON `{ token }`, returns the ticket |
64
+
65
+ `confirmAction` is the person's yes to a support action an assistant prepared: raise a ticket,
66
+ reply on one, or reopen one. Only this call completes the action. It resolves to the ticket it
67
+ acted on (with `id` and `number`), and an expired or unknown token rejects with the code
68
+ `action_expired`. `@webority/chat-react`'s `ActionCard` takes it as its `confirmAction`.
63
69
 
64
70
  ## Components
65
71
 
@@ -69,7 +69,8 @@ function ee(e, t = "/api/support") {
69
69
  let a = { satisfaction: n };
70
70
  return i != null && i.trim() !== "" && (a.comment = i.trim()), L(() => e.post(`${r(t)}/rating`, a));
71
71
  },
72
- fetchAttachment: (t) => L(() => e.get(`${n}/attachments/${encodeURIComponent(t)}`, { responseType: "blob" }))
72
+ fetchAttachment: (t) => L(() => e.get(`${n}/attachments/${encodeURIComponent(t)}`, { responseType: "blob" })),
73
+ confirmAction: (t) => L(() => e.post(`${n}/actions/confirm`, { token: t }))
73
74
  };
74
75
  }
75
76
  //#endregion
@@ -87,6 +87,11 @@ export type SupportClient = {
87
87
  reopen: (id: string) => Promise<any>;
88
88
  rate: (id: string, input: RatingInput) => Promise<any>;
89
89
  fetchAttachment: (id: string) => Promise<Blob>;
90
+ /**
91
+ * The person's yes to a support action an
92
+ * assistant prepared (raise a ticket, reply on one, reopen one). Resolves to the ticket it acted on.
93
+ */
94
+ confirmAction: (token: string) => Promise<any>;
90
95
  };
91
96
  /**
92
97
  * @typedef {object} SupportHttp An axios-like HTTP client that already carries the bearer token.
@@ -152,6 +157,8 @@ export type SupportClient = {
152
157
  * @property {(id: string) => Promise<any>} reopen
153
158
  * @property {(id: string, input: RatingInput) => Promise<any>} rate
154
159
  * @property {(id: string) => Promise<Blob>} fetchAttachment
160
+ * @property {(token: string) => Promise<any>} confirmAction The person's yes to a support action an
161
+ * assistant prepared (raise a ticket, reply on one, reopen one). Resolves to the ticket it acted on.
155
162
  */
156
163
  /**
157
164
  * Binds the support HTTP contract to the product's own authenticated client.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/support-react",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "Webority customer support for React portals: ticket centre, report-an-issue with a page screenshot, and support contact details, built on @webority/ui-react.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "react": "^19.0.0",
33
33
  "react-bootstrap": "^2.10.0",
34
34
  "react-dom": "^19.0.0",
35
- "@webority/ui-react": "0.20.0"
35
+ "@webority/ui-react": "0.22.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@testing-library/dom": "10.4.2",
@@ -50,7 +50,7 @@
50
50
  "typescript": "^7.0.2",
51
51
  "vite": "^8.0.12",
52
52
  "vitest": "5.0.1",
53
- "@webority/ui-react": "0.20.0"
53
+ "@webority/ui-react": "0.22.0"
54
54
  },
55
55
  "dependencies": {
56
56
  "html-to-image": "^1.11.13"