@inploi/plugin-chatbot 3.20.0 → 3.20.2
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/cdn/index.js +5 -5
- package/dist/{chatbot-body-f16e9411.cjs → chatbot-body-9b42fa19.cjs} +86 -38
- package/dist/{chatbot-body-e6cc92c4.js → chatbot-body-a94ce4fa.js} +86 -38
- package/dist/chatbot.d.ts +3 -1
- package/dist/chatbot.state.d.ts +2 -1
- package/dist/chatbot.utils.d.ts +2 -1
- package/dist/{index-41fa1f9a.js → index-065ff0bb.js} +11 -11
- package/dist/{index-701e3473.cjs → index-1a26aac3.cjs} +11 -11
- package/dist/interpreter.d.ts +2 -2
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-1a26aac3.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
5
|
const isIfBlockConditionMet = (ifBlock, {
|
|
6
6
|
context,
|
|
@@ -270,6 +270,7 @@ const createFlowInterpreter = ({
|
|
|
270
270
|
onInterpret == null ? void 0 : onInterpret(node, prevNode);
|
|
271
271
|
try {
|
|
272
272
|
await interpret({
|
|
273
|
+
flow,
|
|
273
274
|
analytics,
|
|
274
275
|
logger,
|
|
275
276
|
apiClient,
|
|
@@ -289,9 +290,9 @@ const createFlowInterpreter = ({
|
|
|
289
290
|
addToSubmissions: chatService.addToSubmissions
|
|
290
291
|
},
|
|
291
292
|
next: (nodeId) => {
|
|
292
|
-
const nextNode = nodeId ? flow.find((node2) => node2.id === nodeId) : fallthroughBranch({
|
|
293
|
+
const nextNode = nodeId ? flow.nodes.find((node2) => node2.id === nodeId) : fallthroughBranch({
|
|
293
294
|
childNode: node,
|
|
294
|
-
nodes: flow
|
|
295
|
+
nodes: flow.nodes
|
|
295
296
|
});
|
|
296
297
|
if (!nextNode)
|
|
297
298
|
return onFlowEnd == null ? void 0 : onFlowEnd(node);
|
|
@@ -307,15 +308,15 @@ const createFlowInterpreter = ({
|
|
|
307
308
|
};
|
|
308
309
|
return {
|
|
309
310
|
interpret: async (startFromNodeId) => {
|
|
310
|
-
const startNode = flow.find((node) => node.id === startFromNodeId) ?? index.getHeadOrThrow(flow);
|
|
311
|
+
const startNode = flow.nodes.find((node) => node.id === startFromNodeId) ?? index.getHeadOrThrow(flow.nodes);
|
|
311
312
|
return interpretNode(startNode);
|
|
312
313
|
},
|
|
313
314
|
undo: (nodeHistory) => {
|
|
314
315
|
let removed = 1;
|
|
315
|
-
const formerLastNode = flow.find((n2) => n2.id === nodeHistory[nodeHistory.length - 1]);
|
|
316
|
+
const formerLastNode = flow.nodes.find((n2) => n2.id === nodeHistory[nodeHistory.length - 1]);
|
|
316
317
|
for (let i2 = nodeHistory.length - 2; i2 > 0; i2--) {
|
|
317
318
|
const nodeId = nodeHistory[i2];
|
|
318
|
-
const node = flow.find((n2) => n2.id === nodeId);
|
|
319
|
+
const node = flow.nodes.find((n2) => n2.id === nodeId);
|
|
319
320
|
if (!node)
|
|
320
321
|
break;
|
|
321
322
|
removed++;
|
|
@@ -324,7 +325,7 @@ const createFlowInterpreter = ({
|
|
|
324
325
|
}
|
|
325
326
|
controller.abort();
|
|
326
327
|
controller = new AbortController();
|
|
327
|
-
const newStartNode = flow.find((node) => node.id === nodeHistory[nodeHistory.length - removed]);
|
|
328
|
+
const newStartNode = flow.nodes.find((node) => node.id === nodeHistory[nodeHistory.length - removed]);
|
|
328
329
|
index.invariant(newStartNode, "Undo failed: new start node not found");
|
|
329
330
|
interpretNode(newStartNode, formerLastNode);
|
|
330
331
|
return {
|
|
@@ -406,7 +407,8 @@ async function interpretSubmitNode({
|
|
|
406
407
|
apiClient,
|
|
407
408
|
submissions,
|
|
408
409
|
context,
|
|
409
|
-
analytics
|
|
410
|
+
analytics,
|
|
411
|
+
flow
|
|
410
412
|
}) {
|
|
411
413
|
const submit = async (skipConfirmation) => {
|
|
412
414
|
if (skipConfirmation !== true) {
|
|
@@ -459,7 +461,23 @@ async function interpretSubmitNode({
|
|
|
459
461
|
await chat.sendMessage({
|
|
460
462
|
type: "link",
|
|
461
463
|
href: href.toString(),
|
|
462
|
-
text: "Complete submission"
|
|
464
|
+
text: "Complete submission",
|
|
465
|
+
onClick: () => {
|
|
466
|
+
alert("kek");
|
|
467
|
+
if (!session_id)
|
|
468
|
+
return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
469
|
+
analytics.log({
|
|
470
|
+
event: "FLOW_REDIRECT",
|
|
471
|
+
properties: {
|
|
472
|
+
flow_build: flow.build,
|
|
473
|
+
flow_id: flow.id,
|
|
474
|
+
flow_session_id: session_id,
|
|
475
|
+
flow_version: flow.version,
|
|
476
|
+
href: href.toString()
|
|
477
|
+
},
|
|
478
|
+
customProperties: context
|
|
479
|
+
});
|
|
480
|
+
}
|
|
463
481
|
});
|
|
464
482
|
next(node.nextId);
|
|
465
483
|
}).with({
|
|
@@ -501,15 +519,39 @@ async function interpretLinkNode({
|
|
|
501
519
|
next,
|
|
502
520
|
node,
|
|
503
521
|
submissions,
|
|
504
|
-
context
|
|
522
|
+
context,
|
|
523
|
+
analytics,
|
|
524
|
+
flow,
|
|
525
|
+
logger
|
|
505
526
|
}) {
|
|
527
|
+
const {
|
|
528
|
+
session_id
|
|
529
|
+
} = analytics.getSessionInfo();
|
|
506
530
|
await chat.sendMessage({
|
|
507
531
|
type: "link",
|
|
508
|
-
href: node.data.href,
|
|
532
|
+
href: interpolateWithData(node.data.href, {
|
|
533
|
+
submissions,
|
|
534
|
+
context
|
|
535
|
+
}),
|
|
509
536
|
text: interpolateWithData(node.data.cta, {
|
|
510
537
|
submissions,
|
|
511
538
|
context
|
|
512
|
-
})
|
|
539
|
+
}),
|
|
540
|
+
onClick: () => {
|
|
541
|
+
if (!session_id)
|
|
542
|
+
return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
543
|
+
analytics.log({
|
|
544
|
+
event: "FLOW_REDIRECT",
|
|
545
|
+
properties: {
|
|
546
|
+
flow_build: flow.build,
|
|
547
|
+
flow_id: flow.id,
|
|
548
|
+
flow_session_id: session_id,
|
|
549
|
+
flow_version: flow.version,
|
|
550
|
+
href: node.data.href
|
|
551
|
+
},
|
|
552
|
+
customProperties: context
|
|
553
|
+
});
|
|
554
|
+
}
|
|
513
555
|
});
|
|
514
556
|
next(node.nextId);
|
|
515
557
|
}
|
|
@@ -3814,6 +3856,33 @@ const ChatBubble = ({
|
|
|
3814
3856
|
children
|
|
3815
3857
|
});
|
|
3816
3858
|
};
|
|
3859
|
+
const LinkMessage = ({
|
|
3860
|
+
message
|
|
3861
|
+
}) => {
|
|
3862
|
+
return index.o("div", {
|
|
3863
|
+
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
3864
|
+
children: index.o("a", {
|
|
3865
|
+
onClick: message.onClick,
|
|
3866
|
+
class: "bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
|
|
3867
|
+
target: "_blank",
|
|
3868
|
+
href: message.href,
|
|
3869
|
+
children: [message.text, index.o("svg", {
|
|
3870
|
+
class: "flex-none",
|
|
3871
|
+
width: "15",
|
|
3872
|
+
height: "15",
|
|
3873
|
+
viewBox: "0 0 15 15",
|
|
3874
|
+
fill: "none",
|
|
3875
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3876
|
+
children: index.o("path", {
|
|
3877
|
+
d: "M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",
|
|
3878
|
+
fill: "currentColor",
|
|
3879
|
+
"fill-rule": "evenodd",
|
|
3880
|
+
"clip-rule": "evenodd"
|
|
3881
|
+
})
|
|
3882
|
+
})]
|
|
3883
|
+
})
|
|
3884
|
+
});
|
|
3885
|
+
};
|
|
3817
3886
|
const TypingIndicator = ({
|
|
3818
3887
|
className,
|
|
3819
3888
|
...props
|
|
@@ -3887,30 +3956,9 @@ const Conversation = ({
|
|
|
3887
3956
|
}, i2);
|
|
3888
3957
|
}).with({
|
|
3889
3958
|
type: "link"
|
|
3890
|
-
}, (message2) => {
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
children: index.o("a", {
|
|
3894
|
-
class: "bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
|
|
3895
|
-
target: "_blank",
|
|
3896
|
-
href: message2.href,
|
|
3897
|
-
children: [message2.text, index.o("svg", {
|
|
3898
|
-
class: "flex-none",
|
|
3899
|
-
width: "15",
|
|
3900
|
-
height: "15",
|
|
3901
|
-
viewBox: "0 0 15 15",
|
|
3902
|
-
fill: "none",
|
|
3903
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3904
|
-
children: index.o("path", {
|
|
3905
|
-
d: "M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",
|
|
3906
|
-
fill: "currentColor",
|
|
3907
|
-
"fill-rule": "evenodd",
|
|
3908
|
-
"clip-rule": "evenodd"
|
|
3909
|
-
})
|
|
3910
|
-
})]
|
|
3911
|
-
})
|
|
3912
|
-
});
|
|
3913
|
-
}).with({
|
|
3959
|
+
}, (message2) => index.o(LinkMessage, {
|
|
3960
|
+
message: message2
|
|
3961
|
+
})).with({
|
|
3914
3962
|
type: "image"
|
|
3915
3963
|
}, (image) => index.o("img", {
|
|
3916
3964
|
class: "shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",
|
|
@@ -3922,7 +3970,7 @@ const Conversation = ({
|
|
|
3922
3970
|
type: "file"
|
|
3923
3971
|
}, (file) => {
|
|
3924
3972
|
return index.o(FileThumbnail, {
|
|
3925
|
-
class: file.author === "bot" ?
|
|
3973
|
+
class: file.author === "bot" ? void 0 : "ml-auto",
|
|
3926
3974
|
file: {
|
|
3927
3975
|
name: file.fileName,
|
|
3928
3976
|
sizeKb: file.fileSizeKb
|
|
@@ -3990,7 +4038,7 @@ const ChatbotBody = ({
|
|
|
3990
4038
|
analytics,
|
|
3991
4039
|
apiClient,
|
|
3992
4040
|
logger,
|
|
3993
|
-
flow
|
|
4041
|
+
flow,
|
|
3994
4042
|
chatService,
|
|
3995
4043
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
3996
4044
|
getSubmissions: () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as parse, q as picklist, r as isSubmissionOfType, C as Cn, t as parseAsync, V as ValiError, u as object, v as transform, w as maxLength, x as minLength, z as record, B as boolean, D as number, E as minValue, G as maxValue, H as custom, I as string, J as email, K as url, L as regex, M as cva, O as ERROR_MESSAGES } from "./index-
|
|
1
|
+
import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as parse, q as picklist, r as isSubmissionOfType, C as Cn, t as parseAsync, V as ValiError, u as object, v as transform, w as maxLength, x as minLength, z as record, B as boolean, D as number, E as minValue, G as maxValue, H as custom, I as string, J as email, K as url, L as regex, M as cva, O as ERROR_MESSAGES } from "./index-065ff0bb.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const isIfBlockConditionMet = (ifBlock, {
|
|
4
4
|
context,
|
|
@@ -268,6 +268,7 @@ const createFlowInterpreter = ({
|
|
|
268
268
|
onInterpret == null ? void 0 : onInterpret(node, prevNode);
|
|
269
269
|
try {
|
|
270
270
|
await interpret({
|
|
271
|
+
flow,
|
|
271
272
|
analytics,
|
|
272
273
|
logger,
|
|
273
274
|
apiClient,
|
|
@@ -287,9 +288,9 @@ const createFlowInterpreter = ({
|
|
|
287
288
|
addToSubmissions: chatService.addToSubmissions
|
|
288
289
|
},
|
|
289
290
|
next: (nodeId) => {
|
|
290
|
-
const nextNode = nodeId ? flow.find((node2) => node2.id === nodeId) : fallthroughBranch({
|
|
291
|
+
const nextNode = nodeId ? flow.nodes.find((node2) => node2.id === nodeId) : fallthroughBranch({
|
|
291
292
|
childNode: node,
|
|
292
|
-
nodes: flow
|
|
293
|
+
nodes: flow.nodes
|
|
293
294
|
});
|
|
294
295
|
if (!nextNode)
|
|
295
296
|
return onFlowEnd == null ? void 0 : onFlowEnd(node);
|
|
@@ -305,15 +306,15 @@ const createFlowInterpreter = ({
|
|
|
305
306
|
};
|
|
306
307
|
return {
|
|
307
308
|
interpret: async (startFromNodeId) => {
|
|
308
|
-
const startNode = flow.find((node) => node.id === startFromNodeId) ?? getHeadOrThrow(flow);
|
|
309
|
+
const startNode = flow.nodes.find((node) => node.id === startFromNodeId) ?? getHeadOrThrow(flow.nodes);
|
|
309
310
|
return interpretNode(startNode);
|
|
310
311
|
},
|
|
311
312
|
undo: (nodeHistory) => {
|
|
312
313
|
let removed = 1;
|
|
313
|
-
const formerLastNode = flow.find((n2) => n2.id === nodeHistory[nodeHistory.length - 1]);
|
|
314
|
+
const formerLastNode = flow.nodes.find((n2) => n2.id === nodeHistory[nodeHistory.length - 1]);
|
|
314
315
|
for (let i2 = nodeHistory.length - 2; i2 > 0; i2--) {
|
|
315
316
|
const nodeId = nodeHistory[i2];
|
|
316
|
-
const node = flow.find((n2) => n2.id === nodeId);
|
|
317
|
+
const node = flow.nodes.find((n2) => n2.id === nodeId);
|
|
317
318
|
if (!node)
|
|
318
319
|
break;
|
|
319
320
|
removed++;
|
|
@@ -322,7 +323,7 @@ const createFlowInterpreter = ({
|
|
|
322
323
|
}
|
|
323
324
|
controller.abort();
|
|
324
325
|
controller = new AbortController();
|
|
325
|
-
const newStartNode = flow.find((node) => node.id === nodeHistory[nodeHistory.length - removed]);
|
|
326
|
+
const newStartNode = flow.nodes.find((node) => node.id === nodeHistory[nodeHistory.length - removed]);
|
|
326
327
|
invariant(newStartNode, "Undo failed: new start node not found");
|
|
327
328
|
interpretNode(newStartNode, formerLastNode);
|
|
328
329
|
return {
|
|
@@ -404,7 +405,8 @@ async function interpretSubmitNode({
|
|
|
404
405
|
apiClient,
|
|
405
406
|
submissions,
|
|
406
407
|
context,
|
|
407
|
-
analytics
|
|
408
|
+
analytics,
|
|
409
|
+
flow
|
|
408
410
|
}) {
|
|
409
411
|
const submit = async (skipConfirmation) => {
|
|
410
412
|
if (skipConfirmation !== true) {
|
|
@@ -457,7 +459,23 @@ async function interpretSubmitNode({
|
|
|
457
459
|
await chat.sendMessage({
|
|
458
460
|
type: "link",
|
|
459
461
|
href: href.toString(),
|
|
460
|
-
text: "Complete submission"
|
|
462
|
+
text: "Complete submission",
|
|
463
|
+
onClick: () => {
|
|
464
|
+
alert("kek");
|
|
465
|
+
if (!session_id)
|
|
466
|
+
return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
467
|
+
analytics.log({
|
|
468
|
+
event: "FLOW_REDIRECT",
|
|
469
|
+
properties: {
|
|
470
|
+
flow_build: flow.build,
|
|
471
|
+
flow_id: flow.id,
|
|
472
|
+
flow_session_id: session_id,
|
|
473
|
+
flow_version: flow.version,
|
|
474
|
+
href: href.toString()
|
|
475
|
+
},
|
|
476
|
+
customProperties: context
|
|
477
|
+
});
|
|
478
|
+
}
|
|
461
479
|
});
|
|
462
480
|
next(node.nextId);
|
|
463
481
|
}).with({
|
|
@@ -499,15 +517,39 @@ async function interpretLinkNode({
|
|
|
499
517
|
next,
|
|
500
518
|
node,
|
|
501
519
|
submissions,
|
|
502
|
-
context
|
|
520
|
+
context,
|
|
521
|
+
analytics,
|
|
522
|
+
flow,
|
|
523
|
+
logger
|
|
503
524
|
}) {
|
|
525
|
+
const {
|
|
526
|
+
session_id
|
|
527
|
+
} = analytics.getSessionInfo();
|
|
504
528
|
await chat.sendMessage({
|
|
505
529
|
type: "link",
|
|
506
|
-
href: node.data.href,
|
|
530
|
+
href: interpolateWithData(node.data.href, {
|
|
531
|
+
submissions,
|
|
532
|
+
context
|
|
533
|
+
}),
|
|
507
534
|
text: interpolateWithData(node.data.cta, {
|
|
508
535
|
submissions,
|
|
509
536
|
context
|
|
510
|
-
})
|
|
537
|
+
}),
|
|
538
|
+
onClick: () => {
|
|
539
|
+
if (!session_id)
|
|
540
|
+
return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
|
|
541
|
+
analytics.log({
|
|
542
|
+
event: "FLOW_REDIRECT",
|
|
543
|
+
properties: {
|
|
544
|
+
flow_build: flow.build,
|
|
545
|
+
flow_id: flow.id,
|
|
546
|
+
flow_session_id: session_id,
|
|
547
|
+
flow_version: flow.version,
|
|
548
|
+
href: node.data.href
|
|
549
|
+
},
|
|
550
|
+
customProperties: context
|
|
551
|
+
});
|
|
552
|
+
}
|
|
511
553
|
});
|
|
512
554
|
next(node.nextId);
|
|
513
555
|
}
|
|
@@ -3812,6 +3854,33 @@ const ChatBubble = ({
|
|
|
3812
3854
|
children
|
|
3813
3855
|
});
|
|
3814
3856
|
};
|
|
3857
|
+
const LinkMessage = ({
|
|
3858
|
+
message
|
|
3859
|
+
}) => {
|
|
3860
|
+
return o$1("div", {
|
|
3861
|
+
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",
|
|
3862
|
+
children: o$1("a", {
|
|
3863
|
+
onClick: message.onClick,
|
|
3864
|
+
class: "bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
|
|
3865
|
+
target: "_blank",
|
|
3866
|
+
href: message.href,
|
|
3867
|
+
children: [message.text, o$1("svg", {
|
|
3868
|
+
class: "flex-none",
|
|
3869
|
+
width: "15",
|
|
3870
|
+
height: "15",
|
|
3871
|
+
viewBox: "0 0 15 15",
|
|
3872
|
+
fill: "none",
|
|
3873
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3874
|
+
children: o$1("path", {
|
|
3875
|
+
d: "M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",
|
|
3876
|
+
fill: "currentColor",
|
|
3877
|
+
"fill-rule": "evenodd",
|
|
3878
|
+
"clip-rule": "evenodd"
|
|
3879
|
+
})
|
|
3880
|
+
})]
|
|
3881
|
+
})
|
|
3882
|
+
});
|
|
3883
|
+
};
|
|
3815
3884
|
const TypingIndicator = ({
|
|
3816
3885
|
className,
|
|
3817
3886
|
...props
|
|
@@ -3885,30 +3954,9 @@ const Conversation = ({
|
|
|
3885
3954
|
}, i2);
|
|
3886
3955
|
}).with({
|
|
3887
3956
|
type: "link"
|
|
3888
|
-
}, (message2) => {
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
children: o$1("a", {
|
|
3892
|
-
class: "bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
|
|
3893
|
-
target: "_blank",
|
|
3894
|
-
href: message2.href,
|
|
3895
|
-
children: [message2.text, o$1("svg", {
|
|
3896
|
-
class: "flex-none",
|
|
3897
|
-
width: "15",
|
|
3898
|
-
height: "15",
|
|
3899
|
-
viewBox: "0 0 15 15",
|
|
3900
|
-
fill: "none",
|
|
3901
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3902
|
-
children: o$1("path", {
|
|
3903
|
-
d: "M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",
|
|
3904
|
-
fill: "currentColor",
|
|
3905
|
-
"fill-rule": "evenodd",
|
|
3906
|
-
"clip-rule": "evenodd"
|
|
3907
|
-
})
|
|
3908
|
-
})]
|
|
3909
|
-
})
|
|
3910
|
-
});
|
|
3911
|
-
}).with({
|
|
3957
|
+
}, (message2) => o$1(LinkMessage, {
|
|
3958
|
+
message: message2
|
|
3959
|
+
})).with({
|
|
3912
3960
|
type: "image"
|
|
3913
3961
|
}, (image) => o$1("img", {
|
|
3914
3962
|
class: "shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",
|
|
@@ -3920,7 +3968,7 @@ const Conversation = ({
|
|
|
3920
3968
|
type: "file"
|
|
3921
3969
|
}, (file) => {
|
|
3922
3970
|
return o$1(FileThumbnail, {
|
|
3923
|
-
class: file.author === "bot" ?
|
|
3971
|
+
class: file.author === "bot" ? void 0 : "ml-auto",
|
|
3924
3972
|
file: {
|
|
3925
3973
|
name: file.fileName,
|
|
3926
3974
|
sizeKb: file.fileSizeKb
|
|
@@ -3988,7 +4036,7 @@ const ChatbotBody = ({
|
|
|
3988
4036
|
analytics,
|
|
3989
4037
|
apiClient,
|
|
3990
4038
|
logger,
|
|
3991
|
-
flow
|
|
4039
|
+
flow,
|
|
3992
4040
|
chatService,
|
|
3993
4041
|
// We need to get fresh submissions, that’s why we call `peek` here.
|
|
3994
4042
|
getSubmissions: () => {
|
package/dist/chatbot.d.ts
CHANGED
|
@@ -31,7 +31,9 @@ export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, }: {
|
|
|
31
31
|
}) => ({ apiClient, logger, analytics }: {
|
|
32
32
|
apiClient: import("@inploi/sdk").ApiClient;
|
|
33
33
|
logger: import("@inploi/sdk").Logger;
|
|
34
|
-
analytics: import("@inploi/sdk").AnalyticsService;
|
|
34
|
+
analytics: import("@inploi/sdk").AnalyticsService; /** Fetches a flow by job ID.
|
|
35
|
+
* @param jobId - The job ID to fetch the flow for. This is the job ID according to the **ATS**, and not the inploi job ID.
|
|
36
|
+
*/
|
|
35
37
|
}) => {
|
|
36
38
|
/** Optionally eagerly renders the interface ahead of needing the chatbot. */
|
|
37
39
|
prepare: () => Promise<void>;
|
package/dist/chatbot.state.d.ts
CHANGED
|
@@ -54,10 +54,11 @@ type TextMessage = {
|
|
|
54
54
|
type: 'text';
|
|
55
55
|
text: string;
|
|
56
56
|
};
|
|
57
|
-
type LinkMessage = {
|
|
57
|
+
export type LinkMessage = {
|
|
58
58
|
type: 'link';
|
|
59
59
|
href: string;
|
|
60
60
|
text: string;
|
|
61
|
+
onClick?: () => void;
|
|
61
62
|
};
|
|
62
63
|
type ImageMessage = {
|
|
63
64
|
author: MessageAuthor;
|
package/dist/chatbot.utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowNode } from '@inploi/core/flows';
|
|
2
|
-
import { FlowSubmission, KeyToSubmissionMap } from './chatbot.state';
|
|
2
|
+
import { FlowStateData, FlowSubmission, KeyToSubmissionMap } from './chatbot.state';
|
|
3
3
|
export type DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T, K> : never;
|
|
4
4
|
export declare const kbToReadableSize: (kb: number) => string;
|
|
5
5
|
export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
@@ -186,3 +186,4 @@ export declare class AbortedError extends Error {
|
|
|
186
186
|
}
|
|
187
187
|
export declare function debounce<TFn extends (...params: any[]) => void>(func: TFn, timeout?: number): TFn;
|
|
188
188
|
export declare const isString: (value: unknown) => value is string;
|
|
189
|
+
export declare const initialiseFlowStateData: () => FlowStateData;
|
|
@@ -4845,6 +4845,16 @@ function debounce(func, timeout = 300) {
|
|
|
4845
4845
|
};
|
|
4846
4846
|
}
|
|
4847
4847
|
const isString = (value) => typeof value === "string";
|
|
4848
|
+
const genRandomId = () => typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
4849
|
+
const initialiseFlowStateData = () => ({
|
|
4850
|
+
messages: [],
|
|
4851
|
+
submissions: {},
|
|
4852
|
+
currentInput: null,
|
|
4853
|
+
nodeHistory: [],
|
|
4854
|
+
isFinished: false,
|
|
4855
|
+
sequence: 0,
|
|
4856
|
+
flowSessionId: genRandomId()
|
|
4857
|
+
});
|
|
4848
4858
|
const db = typeof window === "undefined" ? void 0 : openDB("inploi-chatbot", 2, {
|
|
4849
4859
|
upgrade(db2) {
|
|
4850
4860
|
try {
|
|
@@ -5036,16 +5046,6 @@ const store = {
|
|
|
5036
5046
|
currentInput: input ?? null
|
|
5037
5047
|
}))
|
|
5038
5048
|
};
|
|
5039
|
-
const genRandomId = () => typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
5040
|
-
const initialiseFlowStateData = () => ({
|
|
5041
|
-
messages: [],
|
|
5042
|
-
submissions: {},
|
|
5043
|
-
currentInput: null,
|
|
5044
|
-
nodeHistory: [],
|
|
5045
|
-
isFinished: false,
|
|
5046
|
-
sequence: 0,
|
|
5047
|
-
flowSessionId: genRandomId()
|
|
5048
|
-
});
|
|
5049
5049
|
var _ = 0;
|
|
5050
5050
|
function o(o2, e2, n2, t2, f2, l2) {
|
|
5051
5051
|
var s2, u2, a2 = {};
|
|
@@ -5298,7 +5298,7 @@ const StatusBar = ({
|
|
|
5298
5298
|
})
|
|
5299
5299
|
});
|
|
5300
5300
|
};
|
|
5301
|
-
const ChatbotBody = M(() => import("./chatbot-body-
|
|
5301
|
+
const ChatbotBody = M(() => import("./chatbot-body-a94ce4fa.js").then((module) => module.ChatbotBody));
|
|
5302
5302
|
const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
|
|
5303
5303
|
variants: {
|
|
5304
5304
|
view: {
|
|
@@ -4846,6 +4846,16 @@ function debounce(func, timeout = 300) {
|
|
|
4846
4846
|
};
|
|
4847
4847
|
}
|
|
4848
4848
|
const isString = (value) => typeof value === "string";
|
|
4849
|
+
const genRandomId = () => typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
4850
|
+
const initialiseFlowStateData = () => ({
|
|
4851
|
+
messages: [],
|
|
4852
|
+
submissions: {},
|
|
4853
|
+
currentInput: null,
|
|
4854
|
+
nodeHistory: [],
|
|
4855
|
+
isFinished: false,
|
|
4856
|
+
sequence: 0,
|
|
4857
|
+
flowSessionId: genRandomId()
|
|
4858
|
+
});
|
|
4849
4859
|
const db = typeof window === "undefined" ? void 0 : openDB("inploi-chatbot", 2, {
|
|
4850
4860
|
upgrade(db2) {
|
|
4851
4861
|
try {
|
|
@@ -5037,16 +5047,6 @@ const store = {
|
|
|
5037
5047
|
currentInput: input ?? null
|
|
5038
5048
|
}))
|
|
5039
5049
|
};
|
|
5040
|
-
const genRandomId = () => typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
5041
|
-
const initialiseFlowStateData = () => ({
|
|
5042
|
-
messages: [],
|
|
5043
|
-
submissions: {},
|
|
5044
|
-
currentInput: null,
|
|
5045
|
-
nodeHistory: [],
|
|
5046
|
-
isFinished: false,
|
|
5047
|
-
sequence: 0,
|
|
5048
|
-
flowSessionId: genRandomId()
|
|
5049
|
-
});
|
|
5050
5050
|
var _ = 0;
|
|
5051
5051
|
function o(o2, e2, n2, t2, f2, l2) {
|
|
5052
5052
|
var s2, u2, a2 = {};
|
|
@@ -5299,7 +5299,7 @@ const StatusBar = ({
|
|
|
5299
5299
|
})
|
|
5300
5300
|
});
|
|
5301
5301
|
};
|
|
5302
|
-
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-
|
|
5302
|
+
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-9b42fa19.cjs")).then((module2) => module2.ChatbotBody));
|
|
5303
5303
|
const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
|
|
5304
5304
|
variants: {
|
|
5305
5305
|
view: {
|
package/dist/interpreter.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowNode } from '@inploi/core/flows';
|
|
2
2
|
import { AnalyticsService, ApiClient, Logger } from '@inploi/sdk';
|
|
3
3
|
import { ChatbotInput } from './components/chat-input/chat-input';
|
|
4
|
-
import { ChatMessage, FlowSubmission, KeyToSubmissionMap } from './chatbot.state';
|
|
4
|
+
import { ChatMessage, FlowSubmission, KeyToSubmissionMap, StartedFlow } from './chatbot.state';
|
|
5
5
|
export declare const followNodes: ({ node, nodes, stopWhen, }: {
|
|
6
6
|
node: FlowNode;
|
|
7
7
|
nodes: FlowNode[];
|
|
@@ -29,7 +29,7 @@ type ChatbotInterpreterParams<TContext extends Record<string, unknown>> = {
|
|
|
29
29
|
analytics: AnalyticsService;
|
|
30
30
|
logger: Logger;
|
|
31
31
|
context: TContext;
|
|
32
|
-
flow:
|
|
32
|
+
flow: StartedFlow;
|
|
33
33
|
getSubmissions: () => KeyToSubmissionMap | undefined;
|
|
34
34
|
chatService: ChatService;
|
|
35
35
|
/** When interpreter starts */
|
package/dist/plugin-chatbot.cjs
CHANGED
package/dist/plugin-chatbot.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inploi/plugin-chatbot",
|
|
3
|
-
"version": "3.20.
|
|
3
|
+
"version": "3.20.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/plugin-chatbot.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"vite": "^4.4.5",
|
|
67
67
|
"vite-plugin-dts": "^3.7.0",
|
|
68
68
|
"vite-tsconfig-paths": "^4.2.1",
|
|
69
|
-
"@inploi/core": "1.14.
|
|
69
|
+
"@inploi/core": "1.14.2",
|
|
70
70
|
"@inploi/design-tokens": "0.2.1",
|
|
71
|
-
"@inploi/sdk": "1.14.
|
|
71
|
+
"@inploi/sdk": "1.14.1",
|
|
72
72
|
"eslint-config-custom": "0.1.0",
|
|
73
73
|
"tsconfig": "0.1.0"
|
|
74
74
|
},
|