@inploi/plugin-chatbot 3.12.1 → 3.12.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-9f0cf58e.cjs");
3
+ const index = require("./index-1d3d0226.cjs");
4
4
  require("@inploi/sdk");
5
5
  const followNodes = ({
6
6
  node,
@@ -203,22 +203,6 @@ async function interpretSubmitNode({
203
203
  label: "Submit my application"
204
204
  }
205
205
  });
206
- const logApplyComplete = () => {
207
- const contextJobId = typeof context.job_id === "string" ? context.job_id : void 0;
208
- const contextFlowId = typeof context.flow_id === "string" ? context.flow_id : void 0;
209
- if (!contextJobId || !contextFlowId)
210
- return;
211
- if (contextJobId) {
212
- analytics.log({
213
- event: "APPLY_COMPLETE",
214
- attributionKey: `job_${contextJobId}`,
215
- properties: {
216
- job_id: contextJobId,
217
- flow_id: contextFlowId
218
- }
219
- });
220
- }
221
- };
222
206
  await chat.sendMessage({
223
207
  type: "system",
224
208
  variant: "info",
@@ -252,7 +236,6 @@ async function interpretSubmitNode({
252
236
  if (anonymous_id && !href.searchParams.has("anonymous_id")) {
253
237
  href.searchParams.set("anonymous_id", anonymous_id);
254
238
  }
255
- logApplyComplete();
256
239
  await chat.sendMessage({
257
240
  type: "link",
258
241
  href: href.toString(),
@@ -262,7 +245,6 @@ async function interpretSubmitNode({
262
245
  }).with({
263
246
  success: true
264
247
  }, async () => {
265
- logApplyComplete();
266
248
  await chat.sendMessage({
267
249
  type: "system",
268
250
  variant: "success",
@@ -1084,6 +1066,11 @@ const validateExtensions = ({
1084
1066
  const normalisedExtensions = allowedExtensions.map((ext) => ext.toLowerCase());
1085
1067
  return files.every((file) => normalisedExtensions.includes(getFileExtension(file.name).toLowerCase()));
1086
1068
  };
1069
+ const trimFileName = (fileName, maxLength) => {
1070
+ const extension = getFileExtension(fileName);
1071
+ const trimmedName = fileName.replace(new RegExp(`${extension}$`), "").slice(0, maxLength);
1072
+ return `${trimmedName}${extension}`;
1073
+ };
1087
1074
  const ChatInputFile = ({
1088
1075
  input,
1089
1076
  onSubmitSuccess,
@@ -1204,7 +1191,7 @@ const ChatInputFile = ({
1204
1191
  const filesToUpload = await Promise.allSettled(files2.map(async (file) => {
1205
1192
  const data = await toBase64(file);
1206
1193
  return {
1207
- name: file.name,
1194
+ name: trimFileName(file.name, 42),
1208
1195
  data,
1209
1196
  sizeKb: file.size / 1e3
1210
1197
  };
@@ -3293,6 +3280,14 @@ const ChatbotBody = ({
3293
3280
  if (fromNodeId === void 0) {
3294
3281
  fromNodeId = index.getHeadOrThrow(flow.nodes).id;
3295
3282
  index.store.setCurrentNodeId(fromNodeId);
3283
+ analytics.log({
3284
+ event: "FLOW_START",
3285
+ properties: {
3286
+ flow_id: flow.id,
3287
+ flow_version: flow.version,
3288
+ flow_session_id: currentApplication.data.flowSessionId
3289
+ }
3290
+ });
3296
3291
  } else {
3297
3292
  index.store.removeMessagesSentByNodeIds([fromNodeId]);
3298
3293
  }
@@ -3334,6 +3329,17 @@ const ChatbotBody = ({
3334
3329
  },
3335
3330
  onFlowEnd: async () => {
3336
3331
  index.store.markAsFinished();
3332
+ const currentState = index.store.current$.peek().flow;
3333
+ index.invariant(currentState);
3334
+ analytics.log({
3335
+ event: "FLOW_END",
3336
+ properties: {
3337
+ flow_id: flow.id,
3338
+ flow_version: flow.version,
3339
+ flow_session_id: currentState.data.flowSessionId
3340
+ },
3341
+ customProperties: flow.context
3342
+ });
3337
3343
  }
3338
3344
  });
3339
3345
  setUndoFn(() => undo);
@@ -1,4 +1,4 @@
1
- import { _, g as getHeadOrThrow, i as invariant, A as AbortedError, N, a as getFlowSubmissionsPayload, h as hasProp, k as kbToReadableSize, o as o$1, c as clsx, b as a$2, d as _$1, y, F, s as store, p, e as parse, f as picklist, j as h, l as k, m as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, u as minLength, v as record, w as boolean, x as string, z as email, B as url, D as regex, T, E as m, G as AnimatePresence, H as ERROR_MESSAGES } from "./index-fc00a362.js";
1
+ import { _, g as getHeadOrThrow, i as invariant, A as AbortedError, N, a as getFlowSubmissionsPayload, h as hasProp, k as kbToReadableSize, o as o$1, c as clsx, b as a$2, d as _$1, y, F, s as store, p, e as parse, f as picklist, j as h, l as k, m as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, u as minLength, v as record, w as boolean, x as string, z as email, B as url, D as regex, T, E as m, G as AnimatePresence, H as ERROR_MESSAGES } from "./index-c15669f1.js";
2
2
  import "@inploi/sdk";
3
3
  const followNodes = ({
4
4
  node,
@@ -201,22 +201,6 @@ async function interpretSubmitNode({
201
201
  label: "Submit my application"
202
202
  }
203
203
  });
204
- const logApplyComplete = () => {
205
- const contextJobId = typeof context.job_id === "string" ? context.job_id : void 0;
206
- const contextFlowId = typeof context.flow_id === "string" ? context.flow_id : void 0;
207
- if (!contextJobId || !contextFlowId)
208
- return;
209
- if (contextJobId) {
210
- analytics.log({
211
- event: "APPLY_COMPLETE",
212
- attributionKey: `job_${contextJobId}`,
213
- properties: {
214
- job_id: contextJobId,
215
- flow_id: contextFlowId
216
- }
217
- });
218
- }
219
- };
220
204
  await chat.sendMessage({
221
205
  type: "system",
222
206
  variant: "info",
@@ -250,7 +234,6 @@ async function interpretSubmitNode({
250
234
  if (anonymous_id && !href.searchParams.has("anonymous_id")) {
251
235
  href.searchParams.set("anonymous_id", anonymous_id);
252
236
  }
253
- logApplyComplete();
254
237
  await chat.sendMessage({
255
238
  type: "link",
256
239
  href: href.toString(),
@@ -260,7 +243,6 @@ async function interpretSubmitNode({
260
243
  }).with({
261
244
  success: true
262
245
  }, async () => {
263
- logApplyComplete();
264
246
  await chat.sendMessage({
265
247
  type: "system",
266
248
  variant: "success",
@@ -1082,6 +1064,11 @@ const validateExtensions = ({
1082
1064
  const normalisedExtensions = allowedExtensions.map((ext) => ext.toLowerCase());
1083
1065
  return files.every((file) => normalisedExtensions.includes(getFileExtension(file.name).toLowerCase()));
1084
1066
  };
1067
+ const trimFileName = (fileName, maxLength2) => {
1068
+ const extension = getFileExtension(fileName);
1069
+ const trimmedName = fileName.replace(new RegExp(`${extension}$`), "").slice(0, maxLength2);
1070
+ return `${trimmedName}${extension}`;
1071
+ };
1085
1072
  const ChatInputFile = ({
1086
1073
  input,
1087
1074
  onSubmitSuccess,
@@ -1202,7 +1189,7 @@ const ChatInputFile = ({
1202
1189
  const filesToUpload = await Promise.allSettled(files2.map(async (file) => {
1203
1190
  const data = await toBase64(file);
1204
1191
  return {
1205
- name: file.name,
1192
+ name: trimFileName(file.name, 42),
1206
1193
  data,
1207
1194
  sizeKb: file.size / 1e3
1208
1195
  };
@@ -3291,6 +3278,14 @@ const ChatbotBody = ({
3291
3278
  if (fromNodeId === void 0) {
3292
3279
  fromNodeId = getHeadOrThrow(flow.nodes).id;
3293
3280
  store.setCurrentNodeId(fromNodeId);
3281
+ analytics.log({
3282
+ event: "FLOW_START",
3283
+ properties: {
3284
+ flow_id: flow.id,
3285
+ flow_version: flow.version,
3286
+ flow_session_id: currentApplication.data.flowSessionId
3287
+ }
3288
+ });
3294
3289
  } else {
3295
3290
  store.removeMessagesSentByNodeIds([fromNodeId]);
3296
3291
  }
@@ -3332,6 +3327,17 @@ const ChatbotBody = ({
3332
3327
  },
3333
3328
  onFlowEnd: async () => {
3334
3329
  store.markAsFinished();
3330
+ const currentState = store.current$.peek().flow;
3331
+ invariant(currentState);
3332
+ analytics.log({
3333
+ event: "FLOW_END",
3334
+ properties: {
3335
+ flow_id: flow.id,
3336
+ flow_version: flow.version,
3337
+ flow_session_id: currentState.data.flowSessionId
3338
+ },
3339
+ customProperties: flow.context
3340
+ });
3335
3341
  }
3336
3342
  });
3337
3343
  setUndoFn(() => undo);
@@ -87,6 +87,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
87
87
  optional: boolean;
88
88
  format: "text" | "url" | "email" | "phone";
89
89
  placeholder?: string | undefined;
90
+ maxChars?: number | undefined;
90
91
  };
91
92
  type: "question-text";
92
93
  isHead?: boolean | undefined;
@@ -243,6 +244,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
243
244
  optional: boolean;
244
245
  format: "text" | "url" | "email" | "phone";
245
246
  placeholder?: string | undefined;
247
+ maxChars?: number | undefined;
246
248
  };
247
249
  type: "question-text";
248
250
  isHead?: boolean | undefined;
@@ -403,6 +405,7 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
403
405
  optional: boolean;
404
406
  format: "text" | "url" | "email" | "phone";
405
407
  placeholder?: string | undefined;
408
+ maxChars?: number | undefined;
406
409
  };
407
410
  type: "question-text";
408
411
  isHead?: boolean | undefined;
@@ -565,6 +568,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
565
568
  optional: boolean;
566
569
  format: "text" | "url" | "email" | "phone";
567
570
  placeholder?: string | undefined;
571
+ maxChars?: number | undefined;
568
572
  };
569
573
  type: "question-text";
570
574
  isHead?: boolean | undefined;
@@ -721,6 +725,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
721
725
  optional: boolean;
722
726
  format: "text" | "url" | "email" | "phone";
723
727
  placeholder?: string | undefined;
728
+ maxChars?: number | undefined;
724
729
  };
725
730
  type: "question-text";
726
731
  isHead?: boolean | undefined;
@@ -881,6 +886,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
881
886
  optional: boolean;
882
887
  format: "text" | "url" | "email" | "phone";
883
888
  placeholder?: string | undefined;
889
+ maxChars?: number | undefined;
884
890
  };
885
891
  type: "question-text";
886
892
  isHead?: boolean | undefined;
@@ -1043,6 +1049,7 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
1043
1049
  optional: boolean;
1044
1050
  format: "text" | "url" | "email" | "phone";
1045
1051
  placeholder?: string | undefined;
1052
+ maxChars?: number | undefined;
1046
1053
  };
1047
1054
  type: "question-text";
1048
1055
  isHead?: boolean | undefined;
@@ -1211,6 +1218,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1211
1218
  optional: boolean;
1212
1219
  format: "text" | "url" | "email" | "phone";
1213
1220
  placeholder?: string | undefined;
1221
+ maxChars?: number | undefined;
1214
1222
  };
1215
1223
  type: "question-text";
1216
1224
  isHead?: boolean | undefined;
@@ -1367,6 +1375,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1367
1375
  optional: boolean;
1368
1376
  format: "text" | "url" | "email" | "phone";
1369
1377
  placeholder?: string | undefined;
1378
+ maxChars?: number | undefined;
1370
1379
  };
1371
1380
  type: "question-text";
1372
1381
  isHead?: boolean | undefined;
@@ -1527,6 +1536,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1527
1536
  optional: boolean;
1528
1537
  format: "text" | "url" | "email" | "phone";
1529
1538
  placeholder?: string | undefined;
1539
+ maxChars?: number | undefined;
1530
1540
  };
1531
1541
  type: "question-text";
1532
1542
  isHead?: boolean | undefined;
@@ -1696,6 +1706,7 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1696
1706
  optional: boolean;
1697
1707
  format: "text" | "url" | "email" | "phone";
1698
1708
  placeholder?: string | undefined;
1709
+ maxChars?: number | undefined;
1699
1710
  };
1700
1711
  type: "question-text";
1701
1712
  isHead?: boolean | undefined;
@@ -1866,6 +1877,7 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
1866
1877
  optional: boolean;
1867
1878
  format: "text" | "url" | "email" | "phone";
1868
1879
  placeholder?: string | undefined;
1880
+ maxChars?: number | undefined;
1869
1881
  };
1870
1882
  type: "question-text";
1871
1883
  isHead?: boolean | undefined;
@@ -2022,6 +2034,7 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2022
2034
  optional: boolean;
2023
2035
  format: "text" | "url" | "email" | "phone";
2024
2036
  placeholder?: string | undefined;
2037
+ maxChars?: number | undefined;
2025
2038
  };
2026
2039
  type: "question-text";
2027
2040
  isHead?: boolean | undefined;
@@ -2182,6 +2195,7 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2182
2195
  optional: boolean;
2183
2196
  format: "text" | "url" | "email" | "phone";
2184
2197
  placeholder?: string | undefined;
2198
+ maxChars?: number | undefined;
2185
2199
  };
2186
2200
  type: "question-text";
2187
2201
  isHead?: boolean | undefined;
@@ -2349,6 +2363,7 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2349
2363
  optional: boolean;
2350
2364
  format: "text" | "url" | "email" | "phone";
2351
2365
  placeholder?: string | undefined;
2366
+ maxChars?: number | undefined;
2352
2367
  };
2353
2368
  type: "question-text";
2354
2369
  isHead?: boolean | undefined;
@@ -74,6 +74,7 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
74
74
  optional: boolean;
75
75
  format: "text" | "url" | "email" | "phone";
76
76
  placeholder?: string | undefined;
77
+ maxChars?: number | undefined;
77
78
  };
78
79
  type: "question-text";
79
80
  isHead?: boolean | undefined;
@@ -9100,7 +9100,7 @@ const StatusBar = ({
9100
9100
  })
9101
9101
  });
9102
9102
  };
9103
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-5ed580ca.cjs")).then((module2) => module2.ChatbotBody));
9103
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-0265ed24.cjs")).then((module2) => module2.ChatbotBody));
9104
9104
  const MotionProvider = ({
9105
9105
  children
9106
9106
  }) => {
@@ -9099,7 +9099,7 @@ const StatusBar = ({
9099
9099
  })
9100
9100
  });
9101
9101
  };
9102
- const ChatbotBody = M(() => import("./chatbot-body-ed7bd24c.js").then((module) => module.ChatbotBody));
9102
+ const ChatbotBody = M(() => import("./chatbot-body-af246505.js").then((module) => module.ChatbotBody));
9103
9103
  const MotionProvider = ({
9104
9104
  children
9105
9105
  }) => {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-9f0cf58e.cjs");
3
+ const index = require("./index-1d3d0226.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { I } from "./index-fc00a362.js";
1
+ import { I } from "./index-c15669f1.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  I as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.12.1",
3
+ "version": "3.12.3",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,9 +65,9 @@
65
65
  "vite": "^4.4.5",
66
66
  "vite-plugin-dts": "^3.7.0",
67
67
  "vite-tsconfig-paths": "^4.2.1",
68
- "@inploi/core": "1.11.6",
68
+ "@inploi/core": "1.11.8",
69
69
  "@inploi/design-tokens": "0.2.1",
70
- "@inploi/sdk": "1.12.1",
70
+ "@inploi/sdk": "1.12.2",
71
71
  "eslint-config-custom": "0.1.0",
72
72
  "tsconfig": "0.1.0"
73
73
  },