@inploi/plugin-chatbot 3.24.0 → 3.25.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/cdn/index.js +11 -11
- package/dist/{chatbot-body-66b0a30f.cjs → chatbot-body-af83f13f.cjs} +26 -11
- package/dist/{chatbot-body-fe759b08.js → chatbot-body-fb25c0fb.js} +26 -11
- package/dist/chatbot.api.d.ts +11 -0
- package/dist/chatbot.state.d.ts +4 -1
- package/dist/chatbot.utils.d.ts +1 -0
- package/dist/{index-8bfa662b.js → index-91ddb671.js} +4 -3
- package/dist/{index-6d177413.cjs → index-acee09dd.cjs} +2 -1
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +2 -2
- 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-acee09dd.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
5
|
const isIfBlockConditionMet = (ifBlock, {
|
|
6
6
|
context,
|
|
@@ -430,9 +430,7 @@ async function interpretSubmitNode({
|
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
await chat.sendMessage({
|
|
433
|
-
type: "
|
|
434
|
-
variant: "info",
|
|
435
|
-
text: "Submitting…"
|
|
433
|
+
type: "loading"
|
|
436
434
|
});
|
|
437
435
|
const {
|
|
438
436
|
anonymous_id,
|
|
@@ -635,7 +633,8 @@ async function interpretQuestionTextNode({
|
|
|
635
633
|
optional: node.data.optional,
|
|
636
634
|
placeholder: node.data.placeholder,
|
|
637
635
|
format: node.data.format,
|
|
638
|
-
maxChars: node.data.maxChars
|
|
636
|
+
maxChars: node.data.maxChars,
|
|
637
|
+
minChars: node.data.minChars
|
|
639
638
|
}
|
|
640
639
|
});
|
|
641
640
|
if (reply === null) {
|
|
@@ -3690,7 +3689,7 @@ const ChatInputSubmit = ({
|
|
|
3690
3689
|
class: "flex items-center gap-1.5",
|
|
3691
3690
|
children: [index.o("span", {
|
|
3692
3691
|
class: "inline-flex items-center text-sm font-medium",
|
|
3693
|
-
children: input.config.label
|
|
3692
|
+
children: input.config.label || "Submit"
|
|
3694
3693
|
}), index.o("svg", {
|
|
3695
3694
|
stroke: "currentColor",
|
|
3696
3695
|
"stroke-width": "1.5",
|
|
@@ -3738,13 +3737,16 @@ const inputFormatToProps = {
|
|
|
3738
3737
|
};
|
|
3739
3738
|
const isTextSubmission = index.isSubmissionOfType("string");
|
|
3740
3739
|
const getResolver = (config) => {
|
|
3741
|
-
const
|
|
3740
|
+
const configErrors = {
|
|
3741
|
+
maxLength: `Please enter no more than ${config.maxChars ?? 999} characters`,
|
|
3742
|
+
minLength: `Please enter ${config.minChars ?? 1} or more characters`
|
|
3743
|
+
};
|
|
3742
3744
|
return i(index.object({
|
|
3743
3745
|
text: {
|
|
3744
|
-
email: index.string(errors.email, [index.email(errors.email), index.maxLength(config.maxChars ?? Infinity,
|
|
3745
|
-
phone: index.transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, ""), [index.maxLength(config.maxChars ?? Infinity,
|
|
3746
|
-
text: index.string([index.minLength(1,
|
|
3747
|
-
url: index.string([index.url(errors.url), index.maxLength(config.maxChars ?? Infinity,
|
|
3746
|
+
email: index.string(errors.email, [index.email(errors.email), index.minLength(config.minChars ?? 1, configErrors.minLength), index.maxLength(config.maxChars ?? Infinity, configErrors.maxLength)]),
|
|
3747
|
+
phone: index.transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, ""), [index.minLength(config.minChars ?? 1, configErrors.minLength), index.maxLength(config.maxChars ?? Infinity, configErrors.maxLength)]),
|
|
3748
|
+
text: index.string([index.minLength(config.minChars ?? 1, configErrors.minLength), index.maxLength(config.maxChars ?? Infinity, configErrors.maxLength)]),
|
|
3749
|
+
url: index.string([index.url(errors.url), index.minLength(config.minChars ?? 1, configErrors.minLength), index.maxLength(config.maxChars ?? Infinity, configErrors.maxLength)])
|
|
3748
3750
|
}[config.format]
|
|
3749
3751
|
}));
|
|
3750
3752
|
};
|
|
@@ -4071,6 +4073,19 @@ const Conversation = ({
|
|
|
4071
4073
|
sizeKb: file.fileSizeKb
|
|
4072
4074
|
}
|
|
4073
4075
|
});
|
|
4076
|
+
}).with({
|
|
4077
|
+
type: "loading"
|
|
4078
|
+
}, (message2) => {
|
|
4079
|
+
const lastMessage = messages[messages.length - 1];
|
|
4080
|
+
const isLastMessage = message2 === lastMessage;
|
|
4081
|
+
if (!isLastMessage || chatStore.isBotTyping$.value)
|
|
4082
|
+
return null;
|
|
4083
|
+
return index.o("div", {
|
|
4084
|
+
class: "flex flex-grow flex-col items-center justify-center",
|
|
4085
|
+
children: index.o(index.LoadingIndicator, {
|
|
4086
|
+
class: "text-neutral-6 h-8 w-8"
|
|
4087
|
+
})
|
|
4088
|
+
});
|
|
4074
4089
|
}).exhaustive()
|
|
4075
4090
|
})
|
|
4076
4091
|
}, i2);
|
|
@@ -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 k, m as k$1, n as getFormSubmitter, q as parse, r as picklist, t as isSubmissionOfType, C as Cn, u as parseAsync, V as ValiError, v as object, w as transform, x as cva, z as maxLength, B as minLength, D as record, E as boolean, G as number, H as minValue, I as maxValue, J as custom, K as string, L as email, M as url, O as regex, P 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 k, m as k$1, n as getFormSubmitter, q as parse, r as picklist, t as isSubmissionOfType, C as Cn, u as parseAsync, V as ValiError, v as object, w as transform, x as cva, z as maxLength, B as minLength, D as record, E as boolean, G as number, H as minValue, I as maxValue, J as custom, K as string, L as email, M as url, O as regex, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-91ddb671.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const isIfBlockConditionMet = (ifBlock, {
|
|
4
4
|
context,
|
|
@@ -428,9 +428,7 @@ async function interpretSubmitNode({
|
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
430
|
await chat.sendMessage({
|
|
431
|
-
type: "
|
|
432
|
-
variant: "info",
|
|
433
|
-
text: "Submitting…"
|
|
431
|
+
type: "loading"
|
|
434
432
|
});
|
|
435
433
|
const {
|
|
436
434
|
anonymous_id,
|
|
@@ -633,7 +631,8 @@ async function interpretQuestionTextNode({
|
|
|
633
631
|
optional: node.data.optional,
|
|
634
632
|
placeholder: node.data.placeholder,
|
|
635
633
|
format: node.data.format,
|
|
636
|
-
maxChars: node.data.maxChars
|
|
634
|
+
maxChars: node.data.maxChars,
|
|
635
|
+
minChars: node.data.minChars
|
|
637
636
|
}
|
|
638
637
|
});
|
|
639
638
|
if (reply === null) {
|
|
@@ -3688,7 +3687,7 @@ const ChatInputSubmit = ({
|
|
|
3688
3687
|
class: "flex items-center gap-1.5",
|
|
3689
3688
|
children: [o$1("span", {
|
|
3690
3689
|
class: "inline-flex items-center text-sm font-medium",
|
|
3691
|
-
children: input.config.label
|
|
3690
|
+
children: input.config.label || "Submit"
|
|
3692
3691
|
}), o$1("svg", {
|
|
3693
3692
|
stroke: "currentColor",
|
|
3694
3693
|
"stroke-width": "1.5",
|
|
@@ -3736,13 +3735,16 @@ const inputFormatToProps = {
|
|
|
3736
3735
|
};
|
|
3737
3736
|
const isTextSubmission = isSubmissionOfType("string");
|
|
3738
3737
|
const getResolver = (config) => {
|
|
3739
|
-
const
|
|
3738
|
+
const configErrors = {
|
|
3739
|
+
maxLength: `Please enter no more than ${config.maxChars ?? 999} characters`,
|
|
3740
|
+
minLength: `Please enter ${config.minChars ?? 1} or more characters`
|
|
3741
|
+
};
|
|
3740
3742
|
return i(object({
|
|
3741
3743
|
text: {
|
|
3742
|
-
email: string(errors.email, [email(errors.email), maxLength(config.maxChars ?? Infinity,
|
|
3743
|
-
phone: transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, ""), [maxLength(config.maxChars ?? Infinity,
|
|
3744
|
-
text: string([minLength(1,
|
|
3745
|
-
url: string([url(errors.url), maxLength(config.maxChars ?? Infinity,
|
|
3744
|
+
email: string(errors.email, [email(errors.email), minLength(config.minChars ?? 1, configErrors.minLength), maxLength(config.maxChars ?? Infinity, configErrors.maxLength)]),
|
|
3745
|
+
phone: transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, ""), [minLength(config.minChars ?? 1, configErrors.minLength), maxLength(config.maxChars ?? Infinity, configErrors.maxLength)]),
|
|
3746
|
+
text: string([minLength(config.minChars ?? 1, configErrors.minLength), maxLength(config.maxChars ?? Infinity, configErrors.maxLength)]),
|
|
3747
|
+
url: string([url(errors.url), minLength(config.minChars ?? 1, configErrors.minLength), maxLength(config.maxChars ?? Infinity, configErrors.maxLength)])
|
|
3746
3748
|
}[config.format]
|
|
3747
3749
|
}));
|
|
3748
3750
|
};
|
|
@@ -4069,6 +4071,19 @@ const Conversation = ({
|
|
|
4069
4071
|
sizeKb: file.fileSizeKb
|
|
4070
4072
|
}
|
|
4071
4073
|
});
|
|
4074
|
+
}).with({
|
|
4075
|
+
type: "loading"
|
|
4076
|
+
}, (message2) => {
|
|
4077
|
+
const lastMessage = messages[messages.length - 1];
|
|
4078
|
+
const isLastMessage = message2 === lastMessage;
|
|
4079
|
+
if (!isLastMessage || chatStore.isBotTyping$.value)
|
|
4080
|
+
return null;
|
|
4081
|
+
return o$1("div", {
|
|
4082
|
+
class: "flex flex-grow flex-col items-center justify-center",
|
|
4083
|
+
children: o$1(LoadingIndicator, {
|
|
4084
|
+
class: "text-neutral-6 h-8 w-8"
|
|
4085
|
+
})
|
|
4086
|
+
});
|
|
4072
4087
|
}).exhaustive()
|
|
4073
4088
|
})
|
|
4074
4089
|
}, i2);
|
package/dist/chatbot.api.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
86
86
|
format: "text" | "url" | "email" | "phone";
|
|
87
87
|
placeholder?: string | undefined;
|
|
88
88
|
maxChars?: number | undefined;
|
|
89
|
+
minChars?: number | undefined;
|
|
89
90
|
};
|
|
90
91
|
type: "question-text";
|
|
91
92
|
id: string;
|
|
@@ -247,6 +248,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
247
248
|
format: "text" | "url" | "email" | "phone";
|
|
248
249
|
placeholder?: string | undefined;
|
|
249
250
|
maxChars?: number | undefined;
|
|
251
|
+
minChars?: number | undefined;
|
|
250
252
|
};
|
|
251
253
|
type: "question-text";
|
|
252
254
|
id: string;
|
|
@@ -435,6 +437,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
435
437
|
format: "text" | "url" | "email" | "phone";
|
|
436
438
|
placeholder?: string | undefined;
|
|
437
439
|
maxChars?: number | undefined;
|
|
440
|
+
minChars?: number | undefined;
|
|
438
441
|
};
|
|
439
442
|
type: "question-text";
|
|
440
443
|
id: string;
|
|
@@ -610,6 +613,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
610
613
|
format: "text" | "url" | "email" | "phone";
|
|
611
614
|
placeholder?: string | undefined;
|
|
612
615
|
maxChars?: number | undefined;
|
|
616
|
+
minChars?: number | undefined;
|
|
613
617
|
};
|
|
614
618
|
type: "question-text";
|
|
615
619
|
id: string;
|
|
@@ -771,6 +775,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
771
775
|
format: "text" | "url" | "email" | "phone";
|
|
772
776
|
placeholder?: string | undefined;
|
|
773
777
|
maxChars?: number | undefined;
|
|
778
|
+
minChars?: number | undefined;
|
|
774
779
|
};
|
|
775
780
|
type: "question-text";
|
|
776
781
|
id: string;
|
|
@@ -959,6 +964,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
959
964
|
format: "text" | "url" | "email" | "phone";
|
|
960
965
|
placeholder?: string | undefined;
|
|
961
966
|
maxChars?: number | undefined;
|
|
967
|
+
minChars?: number | undefined;
|
|
962
968
|
};
|
|
963
969
|
type: "question-text";
|
|
964
970
|
id: string;
|
|
@@ -1133,6 +1139,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1133
1139
|
format: "text" | "url" | "email" | "phone";
|
|
1134
1140
|
placeholder?: string | undefined;
|
|
1135
1141
|
maxChars?: number | undefined;
|
|
1142
|
+
minChars?: number | undefined;
|
|
1136
1143
|
};
|
|
1137
1144
|
type: "question-text";
|
|
1138
1145
|
id: string;
|
|
@@ -1313,6 +1320,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1313
1320
|
format: "text" | "url" | "email" | "phone";
|
|
1314
1321
|
placeholder?: string | undefined;
|
|
1315
1322
|
maxChars?: number | undefined;
|
|
1323
|
+
minChars?: number | undefined;
|
|
1316
1324
|
};
|
|
1317
1325
|
type: "question-text";
|
|
1318
1326
|
id: string;
|
|
@@ -1474,6 +1482,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1474
1482
|
format: "text" | "url" | "email" | "phone";
|
|
1475
1483
|
placeholder?: string | undefined;
|
|
1476
1484
|
maxChars?: number | undefined;
|
|
1485
|
+
minChars?: number | undefined;
|
|
1477
1486
|
};
|
|
1478
1487
|
type: "question-text";
|
|
1479
1488
|
id: string;
|
|
@@ -1662,6 +1671,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1662
1671
|
format: "text" | "url" | "email" | "phone";
|
|
1663
1672
|
placeholder?: string | undefined;
|
|
1664
1673
|
maxChars?: number | undefined;
|
|
1674
|
+
minChars?: number | undefined;
|
|
1665
1675
|
};
|
|
1666
1676
|
type: "question-text";
|
|
1667
1677
|
id: string;
|
|
@@ -1843,6 +1853,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1843
1853
|
format: "text" | "url" | "email" | "phone";
|
|
1844
1854
|
placeholder?: string | undefined;
|
|
1845
1855
|
maxChars?: number | undefined;
|
|
1856
|
+
minChars?: number | undefined;
|
|
1846
1857
|
};
|
|
1847
1858
|
type: "question-text";
|
|
1848
1859
|
id: string;
|
package/dist/chatbot.state.d.ts
CHANGED
|
@@ -75,7 +75,10 @@ type FileMessage = {
|
|
|
75
75
|
fileName: string;
|
|
76
76
|
fileSizeKb: number;
|
|
77
77
|
};
|
|
78
|
-
export type
|
|
78
|
+
export type LoadingMessage = {
|
|
79
|
+
type: 'loading';
|
|
80
|
+
};
|
|
81
|
+
export type ChatMessage = TextMessage | ImageMessage | SystemMessage | FileMessage | LinkMessage | LoadingMessage;
|
|
79
82
|
export type FileToUpload = {
|
|
80
83
|
name: string;
|
|
81
84
|
data: string;
|
package/dist/chatbot.utils.d.ts
CHANGED
|
@@ -5314,7 +5314,7 @@ const StatusBar = ({
|
|
|
5314
5314
|
})
|
|
5315
5315
|
});
|
|
5316
5316
|
};
|
|
5317
|
-
const ChatbotBody = M(() => import("./chatbot-body-
|
|
5317
|
+
const ChatbotBody = M(() => import("./chatbot-body-fb25c0fb.js").then((module) => module.ChatbotBody));
|
|
5318
5318
|
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", {
|
|
5319
5319
|
variants: {
|
|
5320
5320
|
view: {
|
|
@@ -5827,8 +5827,9 @@ export {
|
|
|
5827
5827
|
url as M,
|
|
5828
5828
|
N,
|
|
5829
5829
|
regex as O,
|
|
5830
|
-
|
|
5831
|
-
|
|
5830
|
+
LoadingIndicator as P,
|
|
5831
|
+
ERROR_MESSAGES as Q,
|
|
5832
|
+
chatbotPlugin as R,
|
|
5832
5833
|
ValiError as V,
|
|
5833
5834
|
_$3 as _,
|
|
5834
5835
|
getHeadOrThrow as a,
|
|
@@ -5315,7 +5315,7 @@ const StatusBar = ({
|
|
|
5315
5315
|
})
|
|
5316
5316
|
});
|
|
5317
5317
|
};
|
|
5318
|
-
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-
|
|
5318
|
+
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-af83f13f.cjs")).then((module2) => module2.ChatbotBody));
|
|
5319
5319
|
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", {
|
|
5320
5320
|
variants: {
|
|
5321
5321
|
view: {
|
|
@@ -5816,6 +5816,7 @@ exports.AbortedError = AbortedError;
|
|
|
5816
5816
|
exports.Cn = Cn;
|
|
5817
5817
|
exports.ERROR_MESSAGES = ERROR_MESSAGES;
|
|
5818
5818
|
exports.F = F$1;
|
|
5819
|
+
exports.LoadingIndicator = LoadingIndicator;
|
|
5819
5820
|
exports.N = N;
|
|
5820
5821
|
exports.ValiError = ValiError;
|
|
5821
5822
|
exports._ = _$3;
|
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.
|
|
3
|
+
"version": "3.25.0",
|
|
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/
|
|
69
|
+
"@inploi/core": "1.14.3",
|
|
70
70
|
"@inploi/design-tokens": "0.2.1",
|
|
71
|
-
"@inploi/
|
|
71
|
+
"@inploi/sdk": "1.14.4",
|
|
72
72
|
"eslint-config-custom": "0.1.0",
|
|
73
73
|
"tsconfig": "0.1.0"
|
|
74
74
|
},
|