@inploi/plugin-chatbot 3.28.0 → 3.28.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 +7 -7
- package/dist/{chatbot-body-b6a50260.js → chatbot-body-1f775f40.js} +28 -11
- package/dist/{chatbot-body-3ba65f33.cjs → chatbot-body-bed76074.cjs} +28 -11
- package/dist/chatbot.api.d.ts +88 -0
- package/dist/chatbot.utils.d.ts +8 -0
- package/dist/{index-c4e1f2bb.js → index-5230f617.js} +1 -1
- package/dist/{index-5f9d9b6a.cjs → index-8f799f13.cjs} +1 -1
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as get$1, i as isString$2, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, c as getFlowSubmissionsPayload, N, _, 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 regex, M as email, O as url, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-
|
|
1
|
+
import { g as get$1, i as isString$2, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, c as getFlowSubmissionsPayload, N, _, 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 regex, M as email, O as url, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-5230f617.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const isIfBlockConditionMet = (ifBlock, {
|
|
4
4
|
context,
|
|
@@ -420,27 +420,44 @@ async function interpret(params) {
|
|
|
420
420
|
});
|
|
421
421
|
case "integration-workflow-get":
|
|
422
422
|
throw Error("Workflow should be unreachable");
|
|
423
|
+
case "identify":
|
|
424
|
+
return interpretIdentifyNode({
|
|
425
|
+
...params,
|
|
426
|
+
node
|
|
427
|
+
});
|
|
423
428
|
default:
|
|
424
429
|
throw new Error(`Unknown node: ${JSON.stringify(node)}`);
|
|
425
430
|
}
|
|
426
431
|
}
|
|
427
|
-
async function
|
|
428
|
-
chat,
|
|
432
|
+
async function interpretIdentifyNode({
|
|
429
433
|
next,
|
|
430
434
|
node,
|
|
435
|
+
analytics,
|
|
431
436
|
submissions,
|
|
432
|
-
|
|
437
|
+
logger
|
|
433
438
|
}) {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
var _a;
|
|
440
|
+
if (!submissions)
|
|
441
|
+
return next(node.nextId);
|
|
442
|
+
const identifier = (_a = submissions[node.data.key]) == null ? void 0 : _a.value;
|
|
443
|
+
if (typeof identifier !== "string" && typeof identifier !== "number") {
|
|
444
|
+
logger.warn(`Failed to identify user, key “${node.data.key}” is not a string or number`);
|
|
445
|
+
return next(node.nextId);
|
|
446
|
+
}
|
|
447
|
+
analytics.log({
|
|
448
|
+
event: "IDENTIFY",
|
|
449
|
+
properties: {
|
|
450
|
+
identifier: identifier.toString()
|
|
451
|
+
}
|
|
441
452
|
});
|
|
442
453
|
next(node.nextId);
|
|
443
454
|
}
|
|
455
|
+
async function interpretJumpNode({
|
|
456
|
+
next,
|
|
457
|
+
node
|
|
458
|
+
}) {
|
|
459
|
+
next(node.data.targetId);
|
|
460
|
+
}
|
|
444
461
|
async function interpretAddSubmissionNode({
|
|
445
462
|
next,
|
|
446
463
|
node,
|
|
@@ -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-8f799f13.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
5
|
const isIfBlockConditionMet = (ifBlock, {
|
|
6
6
|
context,
|
|
@@ -422,27 +422,44 @@ async function interpret(params) {
|
|
|
422
422
|
});
|
|
423
423
|
case "integration-workflow-get":
|
|
424
424
|
throw Error("Workflow should be unreachable");
|
|
425
|
+
case "identify":
|
|
426
|
+
return interpretIdentifyNode({
|
|
427
|
+
...params,
|
|
428
|
+
node
|
|
429
|
+
});
|
|
425
430
|
default:
|
|
426
431
|
throw new Error(`Unknown node: ${JSON.stringify(node)}`);
|
|
427
432
|
}
|
|
428
433
|
}
|
|
429
|
-
async function
|
|
430
|
-
chat,
|
|
434
|
+
async function interpretIdentifyNode({
|
|
431
435
|
next,
|
|
432
436
|
node,
|
|
437
|
+
analytics,
|
|
433
438
|
submissions,
|
|
434
|
-
|
|
439
|
+
logger
|
|
435
440
|
}) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
441
|
+
var _a;
|
|
442
|
+
if (!submissions)
|
|
443
|
+
return next(node.nextId);
|
|
444
|
+
const identifier = (_a = submissions[node.data.key]) == null ? void 0 : _a.value;
|
|
445
|
+
if (typeof identifier !== "string" && typeof identifier !== "number") {
|
|
446
|
+
logger.warn(`Failed to identify user, key “${node.data.key}” is not a string or number`);
|
|
447
|
+
return next(node.nextId);
|
|
448
|
+
}
|
|
449
|
+
analytics.log({
|
|
450
|
+
event: "IDENTIFY",
|
|
451
|
+
properties: {
|
|
452
|
+
identifier: identifier.toString()
|
|
453
|
+
}
|
|
443
454
|
});
|
|
444
455
|
next(node.nextId);
|
|
445
456
|
}
|
|
457
|
+
async function interpretJumpNode({
|
|
458
|
+
next,
|
|
459
|
+
node
|
|
460
|
+
}) {
|
|
461
|
+
next(node.data.targetId);
|
|
462
|
+
}
|
|
446
463
|
async function interpretAddSubmissionNode({
|
|
447
464
|
next,
|
|
448
465
|
node,
|
package/dist/chatbot.api.d.ts
CHANGED
|
@@ -182,6 +182,14 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
182
182
|
id: string;
|
|
183
183
|
isHead?: boolean | undefined;
|
|
184
184
|
nextId?: string | undefined;
|
|
185
|
+
} | {
|
|
186
|
+
data: {
|
|
187
|
+
key: string;
|
|
188
|
+
};
|
|
189
|
+
type: "identify";
|
|
190
|
+
id: string;
|
|
191
|
+
isHead?: boolean | undefined;
|
|
192
|
+
nextId?: string | undefined;
|
|
185
193
|
}>, ({
|
|
186
194
|
data: {
|
|
187
195
|
text: string;
|
|
@@ -353,6 +361,14 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
353
361
|
id: string;
|
|
354
362
|
isHead?: boolean | undefined;
|
|
355
363
|
nextId?: string | undefined;
|
|
364
|
+
} | {
|
|
365
|
+
data: {
|
|
366
|
+
key: string;
|
|
367
|
+
};
|
|
368
|
+
type: "identify";
|
|
369
|
+
id: string;
|
|
370
|
+
isHead?: boolean | undefined;
|
|
371
|
+
nextId?: string | undefined;
|
|
356
372
|
})[]>;
|
|
357
373
|
context_schema: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ObjectSchema<{
|
|
358
374
|
required: import("valibot").BooleanSchema<boolean>;
|
|
@@ -551,6 +567,14 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
|
|
|
551
567
|
id: string;
|
|
552
568
|
isHead?: boolean | undefined;
|
|
553
569
|
nextId?: string | undefined;
|
|
570
|
+
} | {
|
|
571
|
+
data: {
|
|
572
|
+
key: string;
|
|
573
|
+
};
|
|
574
|
+
type: "identify";
|
|
575
|
+
id: string;
|
|
576
|
+
isHead?: boolean | undefined;
|
|
577
|
+
nextId?: string | undefined;
|
|
554
578
|
})[];
|
|
555
579
|
context_schema?: {
|
|
556
580
|
[x: string]: {
|
|
@@ -736,6 +760,14 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
736
760
|
id: string;
|
|
737
761
|
isHead?: boolean | undefined;
|
|
738
762
|
nextId?: string | undefined;
|
|
763
|
+
} | {
|
|
764
|
+
data: {
|
|
765
|
+
key: string;
|
|
766
|
+
};
|
|
767
|
+
type: "identify";
|
|
768
|
+
id: string;
|
|
769
|
+
isHead?: boolean | undefined;
|
|
770
|
+
nextId?: string | undefined;
|
|
739
771
|
}>, ({
|
|
740
772
|
data: {
|
|
741
773
|
text: string;
|
|
@@ -907,6 +939,14 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
907
939
|
id: string;
|
|
908
940
|
isHead?: boolean | undefined;
|
|
909
941
|
nextId?: string | undefined;
|
|
942
|
+
} | {
|
|
943
|
+
data: {
|
|
944
|
+
key: string;
|
|
945
|
+
};
|
|
946
|
+
type: "identify";
|
|
947
|
+
id: string;
|
|
948
|
+
isHead?: boolean | undefined;
|
|
949
|
+
nextId?: string | undefined;
|
|
910
950
|
})[]>;
|
|
911
951
|
context_schema: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ObjectSchema<{
|
|
912
952
|
required: import("valibot").BooleanSchema<boolean>;
|
|
@@ -1105,6 +1145,14 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1105
1145
|
id: string;
|
|
1106
1146
|
isHead?: boolean | undefined;
|
|
1107
1147
|
nextId?: string | undefined;
|
|
1148
|
+
} | {
|
|
1149
|
+
data: {
|
|
1150
|
+
key: string;
|
|
1151
|
+
};
|
|
1152
|
+
type: "identify";
|
|
1153
|
+
id: string;
|
|
1154
|
+
isHead?: boolean | undefined;
|
|
1155
|
+
nextId?: string | undefined;
|
|
1108
1156
|
})[];
|
|
1109
1157
|
context_schema?: {
|
|
1110
1158
|
[x: string]: {
|
|
@@ -1289,6 +1337,14 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1289
1337
|
id: string;
|
|
1290
1338
|
isHead?: boolean | undefined;
|
|
1291
1339
|
nextId?: string | undefined;
|
|
1340
|
+
} | {
|
|
1341
|
+
data: {
|
|
1342
|
+
key: string;
|
|
1343
|
+
};
|
|
1344
|
+
type: "identify";
|
|
1345
|
+
id: string;
|
|
1346
|
+
isHead?: boolean | undefined;
|
|
1347
|
+
nextId?: string | undefined;
|
|
1292
1348
|
})[];
|
|
1293
1349
|
context_schema?: {
|
|
1294
1350
|
[x: string]: {
|
|
@@ -1479,6 +1535,14 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1479
1535
|
id: string;
|
|
1480
1536
|
isHead?: boolean | undefined;
|
|
1481
1537
|
nextId?: string | undefined;
|
|
1538
|
+
} | {
|
|
1539
|
+
data: {
|
|
1540
|
+
key: string;
|
|
1541
|
+
};
|
|
1542
|
+
type: "identify";
|
|
1543
|
+
id: string;
|
|
1544
|
+
isHead?: boolean | undefined;
|
|
1545
|
+
nextId?: string | undefined;
|
|
1482
1546
|
}>, ({
|
|
1483
1547
|
data: {
|
|
1484
1548
|
text: string;
|
|
@@ -1650,6 +1714,14 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1650
1714
|
id: string;
|
|
1651
1715
|
isHead?: boolean | undefined;
|
|
1652
1716
|
nextId?: string | undefined;
|
|
1717
|
+
} | {
|
|
1718
|
+
data: {
|
|
1719
|
+
key: string;
|
|
1720
|
+
};
|
|
1721
|
+
type: "identify";
|
|
1722
|
+
id: string;
|
|
1723
|
+
isHead?: boolean | undefined;
|
|
1724
|
+
nextId?: string | undefined;
|
|
1653
1725
|
})[]>;
|
|
1654
1726
|
context_schema: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ObjectSchema<{
|
|
1655
1727
|
required: import("valibot").BooleanSchema<boolean>;
|
|
@@ -1848,6 +1920,14 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
1848
1920
|
id: string;
|
|
1849
1921
|
isHead?: boolean | undefined;
|
|
1850
1922
|
nextId?: string | undefined;
|
|
1923
|
+
} | {
|
|
1924
|
+
data: {
|
|
1925
|
+
key: string;
|
|
1926
|
+
};
|
|
1927
|
+
type: "identify";
|
|
1928
|
+
id: string;
|
|
1929
|
+
isHead?: boolean | undefined;
|
|
1930
|
+
nextId?: string | undefined;
|
|
1851
1931
|
})[];
|
|
1852
1932
|
context_schema?: {
|
|
1853
1933
|
[x: string]: {
|
|
@@ -2039,6 +2119,14 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
|
|
|
2039
2119
|
id: string;
|
|
2040
2120
|
isHead?: boolean | undefined;
|
|
2041
2121
|
nextId?: string | undefined;
|
|
2122
|
+
} | {
|
|
2123
|
+
data: {
|
|
2124
|
+
key: string;
|
|
2125
|
+
};
|
|
2126
|
+
type: "identify";
|
|
2127
|
+
id: string;
|
|
2128
|
+
isHead?: boolean | undefined;
|
|
2129
|
+
nextId?: string | undefined;
|
|
2042
2130
|
})[];
|
|
2043
2131
|
context_schema?: {
|
|
2044
2132
|
[x: string]: {
|
package/dist/chatbot.utils.d.ts
CHANGED
|
@@ -173,6 +173,14 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
173
173
|
id: string;
|
|
174
174
|
isHead?: boolean | undefined;
|
|
175
175
|
nextId?: string | undefined;
|
|
176
|
+
} | {
|
|
177
|
+
data: {
|
|
178
|
+
key: string;
|
|
179
|
+
};
|
|
180
|
+
type: "identify";
|
|
181
|
+
id: string;
|
|
182
|
+
isHead?: boolean | undefined;
|
|
183
|
+
nextId?: string | undefined;
|
|
176
184
|
};
|
|
177
185
|
export declare const getFlowSubmissionsPayload: (submissions: KeyToSubmissionMap) => Record<string, unknown>;
|
|
178
186
|
export declare const isSubmissionOfType: <T extends "string" | "number" | "boolean" | "enum" | "address" | "file" | "integration">(type: T) => (submission?: FlowSubmission) => submission is Extract<import("./chatbot.state").FlowSubmissionString, {
|
|
@@ -5320,7 +5320,7 @@ const StatusBar = ({
|
|
|
5320
5320
|
};
|
|
5321
5321
|
function noop() {
|
|
5322
5322
|
}
|
|
5323
|
-
const ChatbotBody = M(() => import("./chatbot-body-
|
|
5323
|
+
const ChatbotBody = M(() => import("./chatbot-body-1f775f40.js").then((module) => module.ChatbotBody));
|
|
5324
5324
|
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 [&:has(.view-switch:active)]:scale-[0.98] transition-all duration-1000 ease-expo-out", {
|
|
5325
5325
|
variants: {
|
|
5326
5326
|
view: {
|
|
@@ -5321,7 +5321,7 @@ const StatusBar = ({
|
|
|
5321
5321
|
};
|
|
5322
5322
|
function noop() {
|
|
5323
5323
|
}
|
|
5324
|
-
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-
|
|
5324
|
+
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-bed76074.cjs")).then((module2) => module2.ChatbotBody));
|
|
5325
5325
|
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 [&:has(.view-switch:active)]:scale-[0.98] transition-all duration-1000 ease-expo-out", {
|
|
5326
5326
|
variants: {
|
|
5327
5327
|
view: {
|
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.28.
|
|
3
|
+
"version": "3.28.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/plugin-chatbot.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"vite": "^4.4.5",
|
|
68
68
|
"vite-plugin-dts": "^3.7.0",
|
|
69
69
|
"vite-tsconfig-paths": "^4.2.1",
|
|
70
|
-
"@inploi/core": "1.14.
|
|
71
|
-
"@inploi/sdk": "1.14.6",
|
|
70
|
+
"@inploi/core": "1.14.5",
|
|
72
71
|
"@inploi/design-tokens": "0.2.1",
|
|
72
|
+
"@inploi/sdk": "1.14.8",
|
|
73
73
|
"eslint-config-custom": "0.1.0",
|
|
74
74
|
"tsconfig": "0.1.0"
|
|
75
75
|
},
|