@inploi/plugin-chatbot 3.27.5 → 3.28.1

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.
@@ -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, 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 regex, M as email, O as url, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-329555fd.js";
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-71e0220a.js";
2
2
  import "@inploi/sdk";
3
3
  const isIfBlockConditionMet = (ifBlock, {
4
4
  context,
@@ -346,66 +346,109 @@ const createFlowInterpreter = ({
346
346
  };
347
347
  };
348
348
  async function interpret(params) {
349
- return await N(params).with({
350
- node: {
351
- type: "text"
352
- }
353
- }, interpretTextNode).with({
354
- node: {
355
- type: "image"
356
- }
357
- }, interpretImageNode).with({
358
- node: {
359
- type: "question-text"
360
- }
361
- }, interpretQuestionTextNode).with({
362
- node: {
363
- type: "question-enum"
364
- }
365
- }, interpretQuestionEnumNode).with({
366
- node: {
367
- type: "question-number"
368
- }
369
- }, interpretQuestionNumberNode).with({
370
- node: {
371
- type: "question-boolean"
372
- }
373
- }, interpretQuestionBooleanNode).with({
374
- node: {
375
- type: "question-file"
376
- }
377
- }, interpretQuestionFileNode).with({
378
- node: {
379
- type: "question-address"
380
- }
381
- }, interpretQuestionAddressNode).with({
382
- node: {
383
- type: "end-flow"
384
- }
385
- }, interpretEndFlowNode).with({
386
- node: {
387
- type: "if-block"
388
- }
389
- }, interpretIfBlockNode).with({
390
- node: {
391
- type: "jump"
392
- }
393
- }, ({
394
- node,
395
- next
396
- }) => next(node.data.targetId)).with({
397
- node: {
398
- type: "link"
399
- }
400
- }, interpretLinkNode).with({
401
- node: {
402
- type: "integration-application-submit"
403
- }
404
- }, interpretSubmitNode).with({
405
- node: {
406
- type: "integration-workflow-get"
407
- }
408
- }, () => Error("Unreachable")).exhaustive();
349
+ const node = params.node;
350
+ switch (node.type) {
351
+ case "text":
352
+ return interpretTextNode({
353
+ ...params,
354
+ node
355
+ });
356
+ case "image":
357
+ return interpretImageNode({
358
+ ...params,
359
+ node
360
+ });
361
+ case "question-text":
362
+ return interpretQuestionTextNode({
363
+ ...params,
364
+ node
365
+ });
366
+ case "question-enum":
367
+ return interpretQuestionEnumNode({
368
+ ...params,
369
+ node
370
+ });
371
+ case "question-number":
372
+ return interpretQuestionNumberNode({
373
+ ...params,
374
+ node
375
+ });
376
+ case "question-boolean":
377
+ return interpretQuestionBooleanNode({
378
+ ...params,
379
+ node
380
+ });
381
+ case "question-file":
382
+ return interpretQuestionFileNode({
383
+ ...params,
384
+ node
385
+ });
386
+ case "question-address":
387
+ return interpretQuestionAddressNode({
388
+ ...params,
389
+ node
390
+ });
391
+ case "end-flow":
392
+ return interpretEndFlowNode({
393
+ ...params,
394
+ node
395
+ });
396
+ case "if-block":
397
+ return interpretIfBlockNode({
398
+ ...params,
399
+ node
400
+ });
401
+ case "jump":
402
+ return interpretJumpNode({
403
+ ...params,
404
+ node
405
+ });
406
+ case "link":
407
+ return interpretLinkNode({
408
+ ...params,
409
+ node
410
+ });
411
+ case "integration-application-submit":
412
+ return interpretSubmitNode({
413
+ ...params,
414
+ node
415
+ });
416
+ case "add-submission":
417
+ return interpretAddSubmissionNode({
418
+ ...params,
419
+ node
420
+ });
421
+ case "integration-workflow-get":
422
+ throw Error("Workflow should be unreachable");
423
+ default:
424
+ throw new Error(`Unknown node: ${JSON.stringify(node)}`);
425
+ }
426
+ }
427
+ async function interpretJumpNode({
428
+ next,
429
+ node
430
+ }) {
431
+ next(node.data.targetId);
432
+ }
433
+ async function interpretAddSubmissionNode({
434
+ next,
435
+ node,
436
+ logger,
437
+ submissions,
438
+ context
439
+ }) {
440
+ if (!submissions) {
441
+ logger.error("Submissions not found");
442
+ return;
443
+ }
444
+ submissions[node.data.key] = {
445
+ type: "string",
446
+ value: interpolateWithData(node.data.value, {
447
+ submissions,
448
+ context
449
+ })
450
+ };
451
+ next(node.nextId);
409
452
  }
410
453
  async function interpretSubmitNode({
411
454
  chat,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-524d7299.cjs");
3
+ const index = require("./index-0ccab8a1.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isIfBlockConditionMet = (ifBlock, {
6
6
  context,
@@ -348,66 +348,109 @@ const createFlowInterpreter = ({
348
348
  };
349
349
  };
350
350
  async function interpret(params) {
351
- return await index.N(params).with({
352
- node: {
353
- type: "text"
354
- }
355
- }, interpretTextNode).with({
356
- node: {
357
- type: "image"
358
- }
359
- }, interpretImageNode).with({
360
- node: {
361
- type: "question-text"
362
- }
363
- }, interpretQuestionTextNode).with({
364
- node: {
365
- type: "question-enum"
366
- }
367
- }, interpretQuestionEnumNode).with({
368
- node: {
369
- type: "question-number"
370
- }
371
- }, interpretQuestionNumberNode).with({
372
- node: {
373
- type: "question-boolean"
374
- }
375
- }, interpretQuestionBooleanNode).with({
376
- node: {
377
- type: "question-file"
378
- }
379
- }, interpretQuestionFileNode).with({
380
- node: {
381
- type: "question-address"
382
- }
383
- }, interpretQuestionAddressNode).with({
384
- node: {
385
- type: "end-flow"
386
- }
387
- }, interpretEndFlowNode).with({
388
- node: {
389
- type: "if-block"
390
- }
391
- }, interpretIfBlockNode).with({
392
- node: {
393
- type: "jump"
394
- }
395
- }, ({
396
- node,
397
- next
398
- }) => next(node.data.targetId)).with({
399
- node: {
400
- type: "link"
401
- }
402
- }, interpretLinkNode).with({
403
- node: {
404
- type: "integration-application-submit"
405
- }
406
- }, interpretSubmitNode).with({
407
- node: {
408
- type: "integration-workflow-get"
409
- }
410
- }, () => Error("Unreachable")).exhaustive();
351
+ const node = params.node;
352
+ switch (node.type) {
353
+ case "text":
354
+ return interpretTextNode({
355
+ ...params,
356
+ node
357
+ });
358
+ case "image":
359
+ return interpretImageNode({
360
+ ...params,
361
+ node
362
+ });
363
+ case "question-text":
364
+ return interpretQuestionTextNode({
365
+ ...params,
366
+ node
367
+ });
368
+ case "question-enum":
369
+ return interpretQuestionEnumNode({
370
+ ...params,
371
+ node
372
+ });
373
+ case "question-number":
374
+ return interpretQuestionNumberNode({
375
+ ...params,
376
+ node
377
+ });
378
+ case "question-boolean":
379
+ return interpretQuestionBooleanNode({
380
+ ...params,
381
+ node
382
+ });
383
+ case "question-file":
384
+ return interpretQuestionFileNode({
385
+ ...params,
386
+ node
387
+ });
388
+ case "question-address":
389
+ return interpretQuestionAddressNode({
390
+ ...params,
391
+ node
392
+ });
393
+ case "end-flow":
394
+ return interpretEndFlowNode({
395
+ ...params,
396
+ node
397
+ });
398
+ case "if-block":
399
+ return interpretIfBlockNode({
400
+ ...params,
401
+ node
402
+ });
403
+ case "jump":
404
+ return interpretJumpNode({
405
+ ...params,
406
+ node
407
+ });
408
+ case "link":
409
+ return interpretLinkNode({
410
+ ...params,
411
+ node
412
+ });
413
+ case "integration-application-submit":
414
+ return interpretSubmitNode({
415
+ ...params,
416
+ node
417
+ });
418
+ case "add-submission":
419
+ return interpretAddSubmissionNode({
420
+ ...params,
421
+ node
422
+ });
423
+ case "integration-workflow-get":
424
+ throw Error("Workflow should be unreachable");
425
+ default:
426
+ throw new Error(`Unknown node: ${JSON.stringify(node)}`);
427
+ }
428
+ }
429
+ async function interpretJumpNode({
430
+ next,
431
+ node
432
+ }) {
433
+ next(node.data.targetId);
434
+ }
435
+ async function interpretAddSubmissionNode({
436
+ next,
437
+ node,
438
+ logger,
439
+ submissions,
440
+ context
441
+ }) {
442
+ if (!submissions) {
443
+ logger.error("Submissions not found");
444
+ return;
445
+ }
446
+ submissions[node.data.key] = {
447
+ type: "string",
448
+ value: interpolateWithData(node.data.value, {
449
+ submissions,
450
+ context
451
+ })
452
+ };
453
+ next(node.nextId);
411
454
  }
412
455
  async function interpretSubmitNode({
413
456
  chat,
@@ -173,6 +173,15 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
173
173
  id: string;
174
174
  isHead?: boolean | undefined;
175
175
  nextId?: string | undefined;
176
+ } | {
177
+ data: {
178
+ value: string;
179
+ key: string;
180
+ };
181
+ type: "add-submission";
182
+ id: string;
183
+ isHead?: boolean | undefined;
184
+ nextId?: string | undefined;
176
185
  }>, ({
177
186
  data: {
178
187
  text: string;
@@ -335,6 +344,15 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
335
344
  id: string;
336
345
  isHead?: boolean | undefined;
337
346
  nextId?: string | undefined;
347
+ } | {
348
+ data: {
349
+ value: string;
350
+ key: string;
351
+ };
352
+ type: "add-submission";
353
+ id: string;
354
+ isHead?: boolean | undefined;
355
+ nextId?: string | undefined;
338
356
  })[]>;
339
357
  context_schema: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ObjectSchema<{
340
358
  required: import("valibot").BooleanSchema<boolean>;
@@ -524,6 +542,15 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
524
542
  id: string;
525
543
  isHead?: boolean | undefined;
526
544
  nextId?: string | undefined;
545
+ } | {
546
+ data: {
547
+ value: string;
548
+ key: string;
549
+ };
550
+ type: "add-submission";
551
+ id: string;
552
+ isHead?: boolean | undefined;
553
+ nextId?: string | undefined;
527
554
  })[];
528
555
  context_schema?: {
529
556
  [x: string]: {
@@ -700,6 +727,15 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
700
727
  id: string;
701
728
  isHead?: boolean | undefined;
702
729
  nextId?: string | undefined;
730
+ } | {
731
+ data: {
732
+ value: string;
733
+ key: string;
734
+ };
735
+ type: "add-submission";
736
+ id: string;
737
+ isHead?: boolean | undefined;
738
+ nextId?: string | undefined;
703
739
  }>, ({
704
740
  data: {
705
741
  text: string;
@@ -862,6 +898,15 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
862
898
  id: string;
863
899
  isHead?: boolean | undefined;
864
900
  nextId?: string | undefined;
901
+ } | {
902
+ data: {
903
+ value: string;
904
+ key: string;
905
+ };
906
+ type: "add-submission";
907
+ id: string;
908
+ isHead?: boolean | undefined;
909
+ nextId?: string | undefined;
865
910
  })[]>;
866
911
  context_schema: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ObjectSchema<{
867
912
  required: import("valibot").BooleanSchema<boolean>;
@@ -1051,6 +1096,15 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
1051
1096
  id: string;
1052
1097
  isHead?: boolean | undefined;
1053
1098
  nextId?: string | undefined;
1099
+ } | {
1100
+ data: {
1101
+ value: string;
1102
+ key: string;
1103
+ };
1104
+ type: "add-submission";
1105
+ id: string;
1106
+ isHead?: boolean | undefined;
1107
+ nextId?: string | undefined;
1054
1108
  })[];
1055
1109
  context_schema?: {
1056
1110
  [x: string]: {
@@ -1226,6 +1280,15 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
1226
1280
  id: string;
1227
1281
  isHead?: boolean | undefined;
1228
1282
  nextId?: string | undefined;
1283
+ } | {
1284
+ data: {
1285
+ value: string;
1286
+ key: string;
1287
+ };
1288
+ type: "add-submission";
1289
+ id: string;
1290
+ isHead?: boolean | undefined;
1291
+ nextId?: string | undefined;
1229
1292
  })[];
1230
1293
  context_schema?: {
1231
1294
  [x: string]: {
@@ -1407,6 +1470,15 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1407
1470
  id: string;
1408
1471
  isHead?: boolean | undefined;
1409
1472
  nextId?: string | undefined;
1473
+ } | {
1474
+ data: {
1475
+ value: string;
1476
+ key: string;
1477
+ };
1478
+ type: "add-submission";
1479
+ id: string;
1480
+ isHead?: boolean | undefined;
1481
+ nextId?: string | undefined;
1410
1482
  }>, ({
1411
1483
  data: {
1412
1484
  text: string;
@@ -1569,6 +1641,15 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1569
1641
  id: string;
1570
1642
  isHead?: boolean | undefined;
1571
1643
  nextId?: string | undefined;
1644
+ } | {
1645
+ data: {
1646
+ value: string;
1647
+ key: string;
1648
+ };
1649
+ type: "add-submission";
1650
+ id: string;
1651
+ isHead?: boolean | undefined;
1652
+ nextId?: string | undefined;
1572
1653
  })[]>;
1573
1654
  context_schema: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ObjectSchema<{
1574
1655
  required: import("valibot").BooleanSchema<boolean>;
@@ -1758,6 +1839,15 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1758
1839
  id: string;
1759
1840
  isHead?: boolean | undefined;
1760
1841
  nextId?: string | undefined;
1842
+ } | {
1843
+ data: {
1844
+ value: string;
1845
+ key: string;
1846
+ };
1847
+ type: "add-submission";
1848
+ id: string;
1849
+ isHead?: boolean | undefined;
1850
+ nextId?: string | undefined;
1761
1851
  })[];
1762
1852
  context_schema?: {
1763
1853
  [x: string]: {
@@ -1940,6 +2030,15 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1940
2030
  id: string;
1941
2031
  isHead?: boolean | undefined;
1942
2032
  nextId?: string | undefined;
2033
+ } | {
2034
+ data: {
2035
+ value: string;
2036
+ key: string;
2037
+ };
2038
+ type: "add-submission";
2039
+ id: string;
2040
+ isHead?: boolean | undefined;
2041
+ nextId?: string | undefined;
1943
2042
  })[];
1944
2043
  context_schema?: {
1945
2044
  [x: string]: {
@@ -164,6 +164,15 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
164
164
  id: string;
165
165
  isHead?: boolean | undefined;
166
166
  nextId?: string | undefined;
167
+ } | {
168
+ data: {
169
+ value: string;
170
+ key: string;
171
+ };
172
+ type: "add-submission";
173
+ id: string;
174
+ isHead?: boolean | undefined;
175
+ nextId?: string | undefined;
167
176
  };
168
177
  export declare const getFlowSubmissionsPayload: (submissions: KeyToSubmissionMap) => Record<string, unknown>;
169
178
  export declare const isSubmissionOfType: <T extends "string" | "number" | "boolean" | "enum" | "address" | "file" | "integration">(type: T) => (submission?: FlowSubmission) => submission is Extract<import("./chatbot.state").FlowSubmissionString, {
@@ -5321,7 +5321,7 @@ const StatusBar = ({
5321
5321
  };
5322
5322
  function noop() {
5323
5323
  }
5324
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-f6724ca6.cjs")).then((module2) => module2.ChatbotBody));
5324
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-535477d0.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: {
@@ -5320,7 +5320,7 @@ const StatusBar = ({
5320
5320
  };
5321
5321
  function noop() {
5322
5322
  }
5323
- const ChatbotBody = M(() => import("./chatbot-body-1a4b8522.js").then((module) => module.ChatbotBody));
5323
+ const ChatbotBody = M(() => import("./chatbot-body-373856bd.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: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-524d7299.cjs");
3
+ const index = require("./index-0ccab8a1.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { R } from "./index-329555fd.js";
1
+ import { R } from "./index-71e0220a.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  R as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.27.5",
3
+ "version": "3.28.1",
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.3",
70
+ "@inploi/core": "1.14.4",
71
71
  "@inploi/design-tokens": "0.2.1",
72
- "@inploi/sdk": "1.14.5",
72
+ "@inploi/sdk": "1.14.7",
73
73
  "eslint-config-custom": "0.1.0",
74
74
  "tsconfig": "0.1.0"
75
75
  },