@inploi/plugin-chatbot 3.28.1 → 3.28.3

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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-0ccab8a1.cjs");
3
+ const index = require("./index-70d48f50.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isIfBlockConditionMet = (ifBlock, {
6
6
  context,
@@ -422,10 +422,38 @@ 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
  }
434
+ async function interpretIdentifyNode({
435
+ next,
436
+ node,
437
+ analytics,
438
+ submissions,
439
+ logger
440
+ }) {
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
+ }
454
+ });
455
+ next(node.nextId);
456
+ }
429
457
  async function interpretJumpNode({
430
458
  next,
431
459
  node
@@ -1386,7 +1414,7 @@ const countries = {
1386
1414
  France: "33",
1387
1415
  "French Guiana": "594",
1388
1416
  "French Polynesia": "689",
1389
- "French Southern and Antarctic Lands": "260",
1417
+ "French Southern and Antarctic Lands": "262",
1390
1418
  Gabon: "241",
1391
1419
  Georgia: "995",
1392
1420
  Germany: "49",
@@ -1411,7 +1439,7 @@ const countries = {
1411
1439
  Indonesia: "62",
1412
1440
  Iran: "98",
1413
1441
  Iraq: "964",
1414
- Ireland: "352",
1442
+ Ireland: "353",
1415
1443
  "Isle of Man": "44",
1416
1444
  Israel: "972",
1417
1445
  Italy: "39",
@@ -1467,7 +1495,7 @@ const countries = {
1467
1495
  Nigeria: "234",
1468
1496
  Niue: "683",
1469
1497
  "Norfolk Island": "672",
1470
- "North Korea": "852",
1498
+ "North Korea": "850",
1471
1499
  "North Macedonia": "389",
1472
1500
  "Northern Mariana Islands": "1 670",
1473
1501
  Norway: "47",
@@ -1521,7 +1549,7 @@ const countries = {
1521
1549
  Sweden: "46",
1522
1550
  Switzerland: "41",
1523
1551
  Syria: "963",
1524
- "São Tomé and Príncipe": "293",
1552
+ "São Tomé and Príncipe": "239",
1525
1553
  Taiwan: "886",
1526
1554
  Tajikistan: "992",
1527
1555
  Tanzania: "255",
@@ -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-71e0220a.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-430056cf.js";
2
2
  import "@inploi/sdk";
3
3
  const isIfBlockConditionMet = (ifBlock, {
4
4
  context,
@@ -420,10 +420,38 @@ 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
  }
432
+ async function interpretIdentifyNode({
433
+ next,
434
+ node,
435
+ analytics,
436
+ submissions,
437
+ logger
438
+ }) {
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
+ }
452
+ });
453
+ next(node.nextId);
454
+ }
427
455
  async function interpretJumpNode({
428
456
  next,
429
457
  node
@@ -1384,7 +1412,7 @@ const countries = {
1384
1412
  France: "33",
1385
1413
  "French Guiana": "594",
1386
1414
  "French Polynesia": "689",
1387
- "French Southern and Antarctic Lands": "260",
1415
+ "French Southern and Antarctic Lands": "262",
1388
1416
  Gabon: "241",
1389
1417
  Georgia: "995",
1390
1418
  Germany: "49",
@@ -1409,7 +1437,7 @@ const countries = {
1409
1437
  Indonesia: "62",
1410
1438
  Iran: "98",
1411
1439
  Iraq: "964",
1412
- Ireland: "352",
1440
+ Ireland: "353",
1413
1441
  "Isle of Man": "44",
1414
1442
  Israel: "972",
1415
1443
  Italy: "39",
@@ -1465,7 +1493,7 @@ const countries = {
1465
1493
  Nigeria: "234",
1466
1494
  Niue: "683",
1467
1495
  "Norfolk Island": "672",
1468
- "North Korea": "852",
1496
+ "North Korea": "850",
1469
1497
  "North Macedonia": "389",
1470
1498
  "Northern Mariana Islands": "1 670",
1471
1499
  Norway: "47",
@@ -1519,7 +1547,7 @@ const countries = {
1519
1547
  Sweden: "46",
1520
1548
  Switzerland: "41",
1521
1549
  Syria: "963",
1522
- "São Tomé and Príncipe": "293",
1550
+ "São Tomé and Príncipe": "239",
1523
1551
  Taiwan: "886",
1524
1552
  Tajikistan: "992",
1525
1553
  Tanzania: "255",
@@ -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]: {
@@ -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-373856bd.js").then((module) => module.ChatbotBody));
5323
+ const ChatbotBody = M(() => import("./chatbot-body-dd8b2ce7.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-535477d0.cjs")).then((module2) => module2.ChatbotBody));
5324
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-b09f390e.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: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-0ccab8a1.cjs");
3
+ const index = require("./index-70d48f50.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { R } from "./index-71e0220a.js";
1
+ import { R } from "./index-430056cf.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.28.1",
3
+ "version": "3.28.3",
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.4",
70
+ "@inploi/core": "1.14.5",
71
71
  "@inploi/design-tokens": "0.2.1",
72
- "@inploi/sdk": "1.14.7",
72
+ "@inploi/sdk": "1.14.8",
73
73
  "eslint-config-custom": "0.1.0",
74
74
  "tsconfig": "0.1.0"
75
75
  },