@opencx/widget 3.0.86 → 3.0.87
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/dist/designs.cjs +23 -23
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +2817 -2760
- package/dist/designs.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +12 -11
- package/dist/src/designs/react/hooks/useCanvas.d.ts +3 -0
- package/dist/src/designs/react/hooks/useTheme.d.ts +6 -0
- package/dist/src/designs/react/screens/chat/ChatCanvas.d.ts +2 -0
- package/dist/src/headless/core/__tests__/test-utils.d.ts +2 -2
- package/dist/src/headless/core/api/api-caller.d.ts +2 -2
- package/dist/src/headless/core/api/schema.d.ts +176 -75
- package/dist/src/headless/core/context/session.ctx.d.ts +8 -0
- package/dist/src/headless/core/context/widget.ctx.d.ts +2 -0
- package/dist/src/headless/core/types/dtos.d.ts +3 -2
- package/dist/src/headless/core/types/widget-config.d.ts +7 -0
- package/dist/src/headless/react/hooks/useModes.d.ts +12 -0
- package/dist/src/headless/react/hooks/useSessions.d.ts +12 -0
- package/dist/src/headless/react/index.d.ts +1 -0
- package/dist/{useWidgetTrigger-Bplu_1C-.cjs → useModes-C5Jd3NZU.cjs} +4 -4
- package/dist/useModes-C5Jd3NZU.cjs.map +1 -0
- package/dist/{useWidgetTrigger-Bi12WVrs.js → useModes-CCwRYrkY.js} +234 -225
- package/dist/useModes-CCwRYrkY.js.map +1 -0
- package/dist/{widget.ctx-oIT8sGvJ.cjs → widget.ctx-BIrCsbNY.cjs} +3 -3
- package/dist/{widget.ctx-oIT8sGvJ.cjs.map → widget.ctx-BIrCsbNY.cjs.map} +1 -1
- package/dist/{widget.ctx-DFFwNHvy.js → widget.ctx-D-BdBFz5.js} +54 -51
- package/dist/{widget.ctx-DFFwNHvy.js.map → widget.ctx-D-BdBFz5.js.map} +1 -1
- package/dist-embed/script.js +83 -83
- package/dist-embed/script.js.map +1 -1
- package/package.json +1 -1
- package/dist/useWidgetTrigger-Bi12WVrs.js.map +0 -1
- package/dist/useWidgetTrigger-Bplu_1C-.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./widget.ctx-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./widget.ctx-BIrCsbNY.cjs"),e=require("./is-exhaustive-9o43S91P.cjs");exports.PrimitiveState=t.PrimitiveState;exports.WidgetCtx=t.WidgetCtx;exports.isExhaustive=e.isExhaustive;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useModes-C5Jd3NZU.cjs");function o(t,s,i){const{widgetCtx:{api:u}}=e.useWidget();return e._default(async r=>u.vote({action:r==="up"?"upvote":"downvote",messagePublicId:t,sessionId:s}).then(i),[u,t,s,i])}exports.WidgetProvider=e.WidgetProvider;exports.WidgetTriggerProvider=e.WidgetTriggerProvider;exports.useConfig=e.useConfig;exports.useContact=e.useContact;exports.useIsAwaitingBotReply=e.useIsAwaitingBotReply;exports.useMessages=e.useMessages;exports.useModes=e.useModes;exports.usePreludeData=e.usePreludeData;exports.usePrimitiveState=e.usePrimitiveState;exports.useSessions=e.useSessions;exports.useUploadFiles=e.useUploadFiles;exports.useWidget=e.useWidget;exports.useWidgetRouter=e.useWidgetRouter;exports.useWidgetTrigger=e.useWidgetTrigger;exports.useVote=o;
|
|
2
2
|
//# sourceMappingURL=react.cjs.map
|
package/dist/react.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.cjs","sources":["../src/headless/react/hooks/useVote.ts"],"sourcesContent":["import useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { useWidget } from '../WidgetProvider';\n\n/**\n * @param id\n * @param onSuccess\n * @returns\n */\nexport function useVote(id: string, sessionId: string, onSuccess?: () => void) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async (action: 'up' | 'down') => {\n return api\n .vote({\n action: action === 'up' ? 'upvote' : 'downvote',\n messagePublicId: id,\n sessionId,\n })\n .then(onSuccess);\n },\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useUpvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'upvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useDownvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'downvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n"],"names":["useVote","id","sessionId","onSuccess","api","useWidget","useAsyncFn","action"],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.cjs","sources":["../src/headless/react/hooks/useVote.ts"],"sourcesContent":["import useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { useWidget } from '../WidgetProvider';\n\n/**\n * @param id\n * @param onSuccess\n * @returns\n */\nexport function useVote(id: string, sessionId: string, onSuccess?: () => void) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async (action: 'up' | 'down') => {\n return api\n .vote({\n action: action === 'up' ? 'upvote' : 'downvote',\n messagePublicId: id,\n sessionId,\n })\n .then(onSuccess);\n },\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useUpvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'upvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n\n/**\n * @param id\n * @param onSuccess\n * @deprecated use useVote instead\n */\nexport function useDownvote(\n id: string,\n sessionId: string,\n onSuccess?: () => void,\n) {\n const {\n widgetCtx: { api },\n } = useWidget();\n return useAsyncFn(\n async () =>\n api\n .vote({ action: 'downvote', messagePublicId: id, sessionId })\n .then(onSuccess),\n [api, id, sessionId, onSuccess],\n );\n}\n"],"names":["useVote","id","sessionId","onSuccess","api","useWidget","useAsyncFn","action"],"mappings":"2HAQgB,SAAAA,EAAQC,EAAYC,EAAmBC,EAAwB,CACvE,KAAA,CACJ,UAAW,CAAE,IAAAC,CAAI,GACfC,EAAU,UAAA,EACP,OAAAC,EAAA,SACL,MAAOC,GACEH,EACJ,KAAK,CACJ,OAAQG,IAAW,KAAO,SAAW,WACrC,gBAAiBN,EACjB,UAAAC,CAAA,CACD,EACA,KAAKC,CAAS,EAEnB,CAACC,EAAKH,EAAIC,EAAWC,CAAS,CAAA,CAElC"}
|
package/dist/react.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { u, _ as
|
|
2
|
-
import { W as p, k as
|
|
1
|
+
import { u, _ as o } from "./useModes-CCwRYrkY.js";
|
|
2
|
+
import { W as p, k as l, a as f, b as v, c as W, d as c, l as m, e as P, f as w, g as x, i as C, h as b, j as h } from "./useModes-CCwRYrkY.js";
|
|
3
3
|
function g(e, s, t) {
|
|
4
4
|
const {
|
|
5
5
|
widgetCtx: { api: a }
|
|
6
6
|
} = u();
|
|
7
|
-
return
|
|
7
|
+
return o(
|
|
8
8
|
async (i) => a.vote({
|
|
9
9
|
action: i === "up" ? "upvote" : "downvote",
|
|
10
10
|
messagePublicId: e,
|
|
@@ -15,18 +15,19 @@ function g(e, s, t) {
|
|
|
15
15
|
}
|
|
16
16
|
export {
|
|
17
17
|
p as WidgetProvider,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
l as WidgetTriggerProvider,
|
|
19
|
+
f as useConfig,
|
|
20
20
|
v as useContact,
|
|
21
21
|
W as useIsAwaitingBotReply,
|
|
22
22
|
c as useMessages,
|
|
23
|
-
m as
|
|
24
|
-
P as
|
|
25
|
-
w as
|
|
26
|
-
x as
|
|
23
|
+
m as useModes,
|
|
24
|
+
P as usePreludeData,
|
|
25
|
+
w as usePrimitiveState,
|
|
26
|
+
x as useSessions,
|
|
27
|
+
C as useUploadFiles,
|
|
27
28
|
g as useVote,
|
|
28
29
|
u as useWidget,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
b as useWidgetRouter,
|
|
31
|
+
h as useWidgetTrigger
|
|
31
32
|
};
|
|
32
33
|
//# sourceMappingURL=react.js.map
|
|
@@ -133,7 +133,7 @@ export declare const TestUtils: {
|
|
|
133
133
|
};
|
|
134
134
|
requestBody: {
|
|
135
135
|
content: {
|
|
136
|
-
"application/json": import('../api/schema').components["schemas"]["
|
|
136
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetSendMessageInputDto"];
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
139
|
responses: {
|
|
@@ -142,7 +142,7 @@ export declare const TestUtils: {
|
|
|
142
142
|
[name: string]: unknown;
|
|
143
143
|
};
|
|
144
144
|
content: {
|
|
145
|
-
"application/json": import('../api/schema').components["schemas"]["
|
|
145
|
+
"application/json": import('../api/schema').components["schemas"]["WidgetSendMessageOutputDto"];
|
|
146
146
|
};
|
|
147
147
|
};
|
|
148
148
|
500: {
|
|
@@ -90,7 +90,7 @@ export declare class ApiCaller {
|
|
|
90
90
|
};
|
|
91
91
|
requestBody: {
|
|
92
92
|
content: {
|
|
93
|
-
"application/json": import('./schema').components["schemas"]["
|
|
93
|
+
"application/json": import('./schema').components["schemas"]["WidgetSendMessageInputDto"];
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
responses: {
|
|
@@ -99,7 +99,7 @@ export declare class ApiCaller {
|
|
|
99
99
|
[name: string]: unknown;
|
|
100
100
|
};
|
|
101
101
|
content: {
|
|
102
|
-
"application/json": import('./schema').components["schemas"]["
|
|
102
|
+
"application/json": import('./schema').components["schemas"]["WidgetSendMessageOutputDto"];
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
105
|
500: {
|
|
@@ -115,6 +115,22 @@ export interface paths {
|
|
|
115
115
|
patch?: never;
|
|
116
116
|
trace?: never;
|
|
117
117
|
};
|
|
118
|
+
'/backend/widget/v2/checkpoint': {
|
|
119
|
+
parameters: {
|
|
120
|
+
query?: never;
|
|
121
|
+
header?: never;
|
|
122
|
+
path?: never;
|
|
123
|
+
cookie?: never;
|
|
124
|
+
};
|
|
125
|
+
get?: never;
|
|
126
|
+
put?: never;
|
|
127
|
+
post: operations['createStateCheckpoint'];
|
|
128
|
+
delete?: never;
|
|
129
|
+
options?: never;
|
|
130
|
+
head?: never;
|
|
131
|
+
patch?: never;
|
|
132
|
+
trace?: never;
|
|
133
|
+
};
|
|
118
134
|
'/backend/widget/v2/upload': {
|
|
119
135
|
parameters: {
|
|
120
136
|
query?: never;
|
|
@@ -199,42 +215,6 @@ export interface components {
|
|
|
199
215
|
/** Format: binary */
|
|
200
216
|
file: string;
|
|
201
217
|
};
|
|
202
|
-
HandleContactMessageOutputDto: {
|
|
203
|
-
/** @enum {boolean} */
|
|
204
|
-
success: true;
|
|
205
|
-
code?: string | 'session_assigned_to_human_agent' | 'response_cancelled';
|
|
206
|
-
autopilotResponse?: {
|
|
207
|
-
/** @enum {string} */
|
|
208
|
-
type: 'text';
|
|
209
|
-
value: {
|
|
210
|
-
error: boolean;
|
|
211
|
-
content: string;
|
|
212
|
-
};
|
|
213
|
-
id?: string;
|
|
214
|
-
mightSolveUserIssue: boolean;
|
|
215
|
-
completelyAndFullyCoveredUserIssue: boolean;
|
|
216
|
-
};
|
|
217
|
-
uiResponse?: {
|
|
218
|
-
/** @enum {string} */
|
|
219
|
-
type: 'ui';
|
|
220
|
-
value: {
|
|
221
|
-
/** @enum {string} */
|
|
222
|
-
type: 'ui_component';
|
|
223
|
-
request_response?: unknown;
|
|
224
|
-
name: string;
|
|
225
|
-
content?: string;
|
|
226
|
-
};
|
|
227
|
-
mightSolveUserIssue: boolean;
|
|
228
|
-
};
|
|
229
|
-
sessionIsHandedOff?: boolean;
|
|
230
|
-
} | {
|
|
231
|
-
/** @enum {boolean} */
|
|
232
|
-
success: false;
|
|
233
|
-
error: {
|
|
234
|
-
code?: string;
|
|
235
|
-
message?: string;
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
218
|
/** @description Paginated response. */
|
|
239
219
|
PaginatedWidgetSessionsDto: {
|
|
240
220
|
items: {
|
|
@@ -253,45 +233,14 @@ export interface components {
|
|
|
253
233
|
channel: string;
|
|
254
234
|
isVerified: boolean;
|
|
255
235
|
lastMessage: string | null;
|
|
236
|
+
modeId: string | null;
|
|
237
|
+
latestStateCheckpointPayload: {
|
|
238
|
+
[key: string]: unknown;
|
|
239
|
+
} | null;
|
|
256
240
|
}[];
|
|
257
241
|
/** @description The `cursor` for the request to get the next set of items. Null if there is no more data. */
|
|
258
242
|
next: string | null;
|
|
259
243
|
};
|
|
260
|
-
SendWidgetMessageDto: {
|
|
261
|
-
/** Format: uuid */
|
|
262
|
-
uuid: string;
|
|
263
|
-
content: string;
|
|
264
|
-
session_id: string;
|
|
265
|
-
bot_token: string;
|
|
266
|
-
/** @description Additional headers to be included in the request of action calls */
|
|
267
|
-
headers?: {
|
|
268
|
-
[key: string]: string;
|
|
269
|
-
} | null;
|
|
270
|
-
/** @description Additional query parameters to be included in the query of action calls */
|
|
271
|
-
query_params?: {
|
|
272
|
-
[key: string]: string;
|
|
273
|
-
} | null;
|
|
274
|
-
/** @description Additional body properties to be included in the body of action calls */
|
|
275
|
-
body_properties?: {
|
|
276
|
-
[key: string]: unknown;
|
|
277
|
-
} | null;
|
|
278
|
-
language?: string | null;
|
|
279
|
-
attachments?: {
|
|
280
|
-
id: string;
|
|
281
|
-
name: string;
|
|
282
|
-
size: number;
|
|
283
|
-
type: string;
|
|
284
|
-
url: string;
|
|
285
|
-
}[] | null;
|
|
286
|
-
/** @description Context for the AI to be sent with each contact message */
|
|
287
|
-
clientContext?: {
|
|
288
|
-
[key: string]: unknown;
|
|
289
|
-
} | null;
|
|
290
|
-
/** @description Custom data to be sent with each contact message */
|
|
291
|
-
custom_data?: {
|
|
292
|
-
[key: string]: unknown;
|
|
293
|
-
} | null;
|
|
294
|
-
};
|
|
295
244
|
UploadWidgetFileResponseDto: {
|
|
296
245
|
fileName: string;
|
|
297
246
|
fileUrl: string;
|
|
@@ -299,15 +248,29 @@ export interface components {
|
|
|
299
248
|
WidgetConfigDto: {
|
|
300
249
|
sessionsPollingIntervalSeconds: number;
|
|
301
250
|
sessionPollingIntervalSeconds: number;
|
|
251
|
+
modes: {
|
|
252
|
+
id: string;
|
|
253
|
+
name: string;
|
|
254
|
+
slug?: string | null;
|
|
255
|
+
}[];
|
|
302
256
|
};
|
|
303
257
|
WidgetContactTokenResponseDto: {
|
|
304
258
|
/** @description The JWT token to use for further requests */
|
|
305
259
|
token: string;
|
|
306
260
|
};
|
|
261
|
+
WidgetCreateStateCheckpointInputDto: {
|
|
262
|
+
session_id: string;
|
|
263
|
+
payload: {
|
|
264
|
+
[key: string]: unknown;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
WidgetCreateStateCheckpointOutputDto: {
|
|
268
|
+
success: boolean;
|
|
269
|
+
};
|
|
307
270
|
WidgetHistoryDto: {
|
|
308
271
|
publicId: string;
|
|
309
272
|
/** @enum {string} */
|
|
310
|
-
type: 'message' | '
|
|
273
|
+
type: 'message' | 'agent_message' | 'agent_joined' | 'agent_comment' | 'agent_took_session_from_ai' | 'agent_reopened_session' | 'handoff' | 'handoff_to_zendesk' | 'handoff_to_salesforce_miaw' | 'ai_decided_to_resolve_the_issue' | 'ai_assumed_the_session_resolved' | 'user_confirmed_the_session_resolved' | 'state_checkpoint' | 'email_draft_message' | 'followup' | 'system_message';
|
|
311
274
|
content: {
|
|
312
275
|
text?: string | null;
|
|
313
276
|
};
|
|
@@ -378,6 +341,104 @@ export interface components {
|
|
|
378
341
|
WidgetResolveSessionInputDto: {
|
|
379
342
|
session_id: string;
|
|
380
343
|
};
|
|
344
|
+
WidgetSendMessageInputDto: {
|
|
345
|
+
/** Format: uuid */
|
|
346
|
+
uuid: string;
|
|
347
|
+
content: string;
|
|
348
|
+
session_id: string;
|
|
349
|
+
bot_token: string;
|
|
350
|
+
/** @description Additional headers to be included in the request of action calls */
|
|
351
|
+
headers?: {
|
|
352
|
+
[key: string]: string;
|
|
353
|
+
} | null;
|
|
354
|
+
/** @description Additional query parameters to be included in the query of action calls */
|
|
355
|
+
query_params?: {
|
|
356
|
+
[key: string]: string;
|
|
357
|
+
} | null;
|
|
358
|
+
/** @description Additional body properties to be included in the body of action calls */
|
|
359
|
+
body_properties?: {
|
|
360
|
+
[key: string]: unknown;
|
|
361
|
+
} | null;
|
|
362
|
+
language?: string | null;
|
|
363
|
+
attachments?: {
|
|
364
|
+
id: string;
|
|
365
|
+
name: string;
|
|
366
|
+
size: number;
|
|
367
|
+
type: string;
|
|
368
|
+
url: string;
|
|
369
|
+
}[] | null;
|
|
370
|
+
/** @description Context for the AI to be sent with each contact message */
|
|
371
|
+
clientContext?: {
|
|
372
|
+
[key: string]: unknown;
|
|
373
|
+
} | null;
|
|
374
|
+
/** @description Custom data to be sent with each contact message */
|
|
375
|
+
custom_data?: {
|
|
376
|
+
[key: string]: unknown;
|
|
377
|
+
} | null;
|
|
378
|
+
};
|
|
379
|
+
WidgetSendMessageOutputDto: {
|
|
380
|
+
/** @enum {boolean} */
|
|
381
|
+
success: true;
|
|
382
|
+
code?: string | 'session_assigned_to_human_agent' | 'response_cancelled';
|
|
383
|
+
autopilotResponse?: {
|
|
384
|
+
/** @enum {string} */
|
|
385
|
+
type: 'text';
|
|
386
|
+
value: {
|
|
387
|
+
error: boolean;
|
|
388
|
+
content: string;
|
|
389
|
+
};
|
|
390
|
+
id?: string;
|
|
391
|
+
mightSolveUserIssue: boolean;
|
|
392
|
+
completelyAndFullyCoveredUserIssue: boolean;
|
|
393
|
+
mode?: {
|
|
394
|
+
id: string;
|
|
395
|
+
name: string;
|
|
396
|
+
slug?: string;
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
uiResponse?: {
|
|
400
|
+
/** @enum {string} */
|
|
401
|
+
type: 'ui';
|
|
402
|
+
value: {
|
|
403
|
+
/** @enum {string} */
|
|
404
|
+
type: 'ui_component';
|
|
405
|
+
request_response?: unknown;
|
|
406
|
+
name: string;
|
|
407
|
+
content?: string;
|
|
408
|
+
};
|
|
409
|
+
mightSolveUserIssue: boolean;
|
|
410
|
+
};
|
|
411
|
+
sessionIsHandedOff?: boolean;
|
|
412
|
+
/** @description WidgetSession */
|
|
413
|
+
session?: {
|
|
414
|
+
/** Format: uuid */
|
|
415
|
+
id: string;
|
|
416
|
+
createdAt: string;
|
|
417
|
+
updatedAt: string;
|
|
418
|
+
isHandedOff: boolean;
|
|
419
|
+
isOpened: boolean;
|
|
420
|
+
assignee: {
|
|
421
|
+
/** @enum {string} */
|
|
422
|
+
kind: 'human' | 'ai' | 'none' | 'unknown';
|
|
423
|
+
name: string | null;
|
|
424
|
+
avatarUrl: string | null;
|
|
425
|
+
};
|
|
426
|
+
channel: string;
|
|
427
|
+
isVerified: boolean;
|
|
428
|
+
lastMessage: string | null;
|
|
429
|
+
modeId: string | null;
|
|
430
|
+
latestStateCheckpointPayload: {
|
|
431
|
+
[key: string]: unknown;
|
|
432
|
+
} | null;
|
|
433
|
+
};
|
|
434
|
+
} | {
|
|
435
|
+
/** @enum {boolean} */
|
|
436
|
+
success: false;
|
|
437
|
+
error: {
|
|
438
|
+
code?: string;
|
|
439
|
+
message?: string;
|
|
440
|
+
};
|
|
441
|
+
};
|
|
381
442
|
WidgetSessionAndHistoryDto: {
|
|
382
443
|
/** @description WidgetSession */
|
|
383
444
|
session: {
|
|
@@ -396,11 +457,15 @@ export interface components {
|
|
|
396
457
|
channel: string;
|
|
397
458
|
isVerified: boolean;
|
|
398
459
|
lastMessage: string | null;
|
|
460
|
+
modeId: string | null;
|
|
461
|
+
latestStateCheckpointPayload: {
|
|
462
|
+
[key: string]: unknown;
|
|
463
|
+
} | null;
|
|
399
464
|
};
|
|
400
465
|
history: {
|
|
401
466
|
publicId: string;
|
|
402
467
|
/** @enum {string} */
|
|
403
|
-
type: 'message' | '
|
|
468
|
+
type: 'message' | 'agent_message' | 'agent_joined' | 'agent_comment' | 'agent_took_session_from_ai' | 'agent_reopened_session' | 'handoff' | 'handoff_to_zendesk' | 'handoff_to_salesforce_miaw' | 'ai_decided_to_resolve_the_issue' | 'ai_assumed_the_session_resolved' | 'user_confirmed_the_session_resolved' | 'state_checkpoint' | 'email_draft_message' | 'followup' | 'system_message';
|
|
404
469
|
content: {
|
|
405
470
|
text?: string | null;
|
|
406
471
|
};
|
|
@@ -442,6 +507,10 @@ export interface components {
|
|
|
442
507
|
channel: string;
|
|
443
508
|
isVerified: boolean;
|
|
444
509
|
lastMessage: string | null;
|
|
510
|
+
modeId: string | null;
|
|
511
|
+
latestStateCheckpointPayload: {
|
|
512
|
+
[key: string]: unknown;
|
|
513
|
+
} | null;
|
|
445
514
|
};
|
|
446
515
|
WidgetVoteDto: {
|
|
447
516
|
/** @enum {string} */
|
|
@@ -667,7 +736,39 @@ export interface operations {
|
|
|
667
736
|
};
|
|
668
737
|
requestBody: {
|
|
669
738
|
content: {
|
|
670
|
-
'application/json': components['schemas']['
|
|
739
|
+
'application/json': components['schemas']['WidgetSendMessageInputDto'];
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
responses: {
|
|
743
|
+
200: {
|
|
744
|
+
headers: {
|
|
745
|
+
[name: string]: unknown;
|
|
746
|
+
};
|
|
747
|
+
content: {
|
|
748
|
+
'application/json': components['schemas']['WidgetSendMessageOutputDto'];
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
/** @description Internal Server Error */
|
|
752
|
+
500: {
|
|
753
|
+
headers: {
|
|
754
|
+
[name: string]: unknown;
|
|
755
|
+
};
|
|
756
|
+
content: {
|
|
757
|
+
'application/json': components['schemas']['ErrorDto'];
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
};
|
|
762
|
+
createStateCheckpoint: {
|
|
763
|
+
parameters: {
|
|
764
|
+
query?: never;
|
|
765
|
+
header?: never;
|
|
766
|
+
path?: never;
|
|
767
|
+
cookie?: never;
|
|
768
|
+
};
|
|
769
|
+
requestBody: {
|
|
770
|
+
content: {
|
|
771
|
+
'application/json': components['schemas']['WidgetCreateStateCheckpointInputDto'];
|
|
671
772
|
};
|
|
672
773
|
};
|
|
673
774
|
responses: {
|
|
@@ -676,7 +777,7 @@ export interface operations {
|
|
|
676
777
|
[name: string]: unknown;
|
|
677
778
|
};
|
|
678
779
|
content: {
|
|
679
|
-
'application/json': components['schemas']['
|
|
780
|
+
'application/json': components['schemas']['WidgetCreateStateCheckpointOutputDto'];
|
|
680
781
|
};
|
|
681
782
|
};
|
|
682
783
|
/** @description Internal Server Error */
|
|
@@ -52,6 +52,10 @@ export declare class SessionCtx {
|
|
|
52
52
|
channel: string;
|
|
53
53
|
isVerified: boolean;
|
|
54
54
|
lastMessage: string | null;
|
|
55
|
+
modeId: string | null;
|
|
56
|
+
latestStateCheckpointPayload: {
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
} | null;
|
|
55
59
|
} | null>;
|
|
56
60
|
loadMoreSessions: () => Promise<void>;
|
|
57
61
|
private getSessions;
|
|
@@ -77,6 +81,10 @@ export declare class SessionCtx {
|
|
|
77
81
|
channel: string;
|
|
78
82
|
isVerified: boolean;
|
|
79
83
|
lastMessage: string | null;
|
|
84
|
+
modeId: string | null;
|
|
85
|
+
latestStateCheckpointPayload: {
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
} | null;
|
|
80
88
|
};
|
|
81
89
|
readonly error?: undefined;
|
|
82
90
|
} | {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApiCaller } from '../api/api-caller';
|
|
2
|
+
import { ModeDto } from '../types/dtos';
|
|
2
3
|
import { ExternalStorage } from '../types/external-storage';
|
|
3
4
|
import { WidgetConfig } from '../types/widget-config';
|
|
4
5
|
import { ContactCtx } from './contact.ctx';
|
|
@@ -14,6 +15,7 @@ export declare class WidgetCtx {
|
|
|
14
15
|
messageCtx: MessageCtx;
|
|
15
16
|
routerCtx: RouterCtx;
|
|
16
17
|
storageCtx?: StorageCtx;
|
|
18
|
+
modes: ModeDto[];
|
|
17
19
|
private static pollingIntervalsSeconds;
|
|
18
20
|
private activeSessionPollingCtx;
|
|
19
21
|
private constructor();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Dto } from '../api/client';
|
|
2
2
|
export type VoteInputDto = Dto['WidgetVoteDto'];
|
|
3
3
|
export type VoteOutputDto = Dto['WidgetVoteResponseDto'];
|
|
4
|
-
export type SendMessageDto = Dto['
|
|
5
|
-
export type SendMessageOutputDto = Dto['
|
|
4
|
+
export type SendMessageDto = Dto['WidgetSendMessageInputDto'];
|
|
5
|
+
export type SendMessageOutputDto = Dto['WidgetSendMessageOutputDto'];
|
|
6
6
|
export type ResolveSessionDto = Dto['WidgetResolveSessionInputDto'];
|
|
7
7
|
export type SessionDto = Dto['WidgetSessionDto'];
|
|
8
8
|
export type MessageDto = Dto['WidgetHistoryDto'];
|
|
9
9
|
export type PreludeDto = Dto['WidgetPreludeDto'];
|
|
10
10
|
export type MessageAttachmentType = NonNullable<Dto['WidgetHistoryDto']['attachments']>[number];
|
|
11
11
|
export type ActionCallDto = NonNullable<Dto['WidgetHistoryDto']['actionCalls']>[number];
|
|
12
|
+
export type ModeDto = Dto['WidgetConfigDto']['modes'][number];
|
|
@@ -72,6 +72,13 @@ type ThemeOptions = {
|
|
|
72
72
|
chat?: {
|
|
73
73
|
height?: string;
|
|
74
74
|
width?: string;
|
|
75
|
+
/** When the canvas is open */
|
|
76
|
+
withCanvas?: {
|
|
77
|
+
height?: string;
|
|
78
|
+
width?: string;
|
|
79
|
+
transitionTimingFunction?: string;
|
|
80
|
+
transitionDuration?: string;
|
|
81
|
+
};
|
|
75
82
|
};
|
|
76
83
|
};
|
|
77
84
|
};
|
|
@@ -32,6 +32,10 @@ export declare function useSessions(): {
|
|
|
32
32
|
channel: string;
|
|
33
33
|
isVerified: boolean;
|
|
34
34
|
lastMessage: string | null;
|
|
35
|
+
modeId: string | null;
|
|
36
|
+
latestStateCheckpointPayload: {
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
} | null;
|
|
35
39
|
};
|
|
36
40
|
readonly error?: undefined;
|
|
37
41
|
} | {
|
|
@@ -57,6 +61,10 @@ export declare function useSessions(): {
|
|
|
57
61
|
channel: string;
|
|
58
62
|
isVerified: boolean;
|
|
59
63
|
lastMessage: string | null;
|
|
64
|
+
modeId: string | null;
|
|
65
|
+
latestStateCheckpointPayload: {
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
} | null;
|
|
60
68
|
}[];
|
|
61
69
|
closedSessions: {
|
|
62
70
|
id: string;
|
|
@@ -72,6 +80,10 @@ export declare function useSessions(): {
|
|
|
72
80
|
channel: string;
|
|
73
81
|
isVerified: boolean;
|
|
74
82
|
lastMessage: string | null;
|
|
83
|
+
modeId: string | null;
|
|
84
|
+
latestStateCheckpointPayload: {
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
} | null;
|
|
75
87
|
}[];
|
|
76
88
|
canCreateNewSession: boolean;
|
|
77
89
|
};
|
|
@@ -11,3 +11,4 @@ export { useWidgetRouter } from './hooks/useWidgetRouter';
|
|
|
11
11
|
export { useVote } from './hooks/useVote';
|
|
12
12
|
export { type FileWithProgress, useUploadFiles } from './hooks/useUploadFiles';
|
|
13
13
|
export { useWidgetTrigger, WidgetTriggerProvider, } from './hooks/useWidgetTrigger';
|
|
14
|
+
export { useModes } from './hooks/useModes';
|