@inploi/plugin-chatbot 3.2.11 → 3.2.13

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.
@@ -86,5 +86,6 @@ export type ApplicationData = {
86
86
  /** Needs to be separate because a node can have many inputs */
87
87
  currentInput?: ChatInput;
88
88
  isFinished: boolean;
89
+ sequence: number;
89
90
  };
90
91
  export {};
@@ -2,14 +2,6 @@ import { FlowNode } from '@inploi/core/flows';
2
2
  import { ApplicationSubmission, KeyToSubmissionMap } from './chatbot.state';
3
3
  export type DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T, K> : never;
4
4
  export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
5
- id: string;
6
- data: {
7
- text: string;
8
- };
9
- type: "text";
10
- isHead?: boolean | undefined;
11
- nextId?: string | undefined;
12
- } | {
13
5
  id: string;
14
6
  data: {
15
7
  systemMessage?: string | undefined;
@@ -34,6 +26,14 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
34
26
  type: "link";
35
27
  isHead?: boolean | undefined;
36
28
  nextId?: string | undefined;
29
+ } | {
30
+ id: string;
31
+ data: {
32
+ text: string;
33
+ };
34
+ type: "text";
35
+ isHead?: boolean | undefined;
36
+ nextId?: string | undefined;
37
37
  } | {
38
38
  id: string;
39
39
  data: {
@@ -1038,7 +1038,7 @@ function useSignal(n2) {
1038
1038
  return a$1(n2);
1039
1039
  }, []);
1040
1040
  }
1041
- var exhaustive = (value) => {
1041
+ const exhaustive = (value) => {
1042
1042
  throw new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);
1043
1043
  };
1044
1044
  function invariant$1(condition, message) {
@@ -8059,7 +8059,8 @@ const createNewApplicationData = (application2) => ({
8059
8059
  messages: [],
8060
8060
  submissions: {},
8061
8061
  currentNodeId: getHeadOrThrow(application2.flow.nodes).id,
8062
- isFinished: false
8062
+ isFinished: false,
8063
+ sequence: 0
8063
8064
  });
8064
8065
  var _ = 0;
8065
8066
  function o(o2, e2, n2, t2, f2, l2) {
@@ -8295,7 +8296,7 @@ const ChatbotHeader = ({
8295
8296
  })]
8296
8297
  });
8297
8298
  };
8298
- const JobApplicationContent = M$1(() => import("./job-application-content-cccdb8b6.js").then((module) => module.JobApplicationContent));
8299
+ const JobApplicationContent = M$1(() => import("./job-application-content-e3ffad6c.js").then((module) => module.JobApplicationContent));
8299
8300
  const MotionProvider = ({
8300
8301
  children
8301
8302
  }) => {
@@ -12250,8 +12251,17 @@ const chatbotPlugin = ({
12250
12251
  jobId,
12251
12252
  apiClient,
12252
12253
  logger
12253
- }).then((res) => {
12254
+ }).then(async (res) => {
12254
12255
  if (res.ok) {
12256
+ await analytics.log({
12257
+ event: "APPLY_START",
12258
+ properties: {
12259
+ job_id: jobId
12260
+ },
12261
+ customProperties: {
12262
+ flow_id: res.value.flow.id
12263
+ }
12264
+ }).catch(logger.error);
12255
12265
  application.start(res.value);
12256
12266
  } else {
12257
12267
  application.current$.value = {
@@ -1039,7 +1039,7 @@ function useSignal(n2) {
1039
1039
  return a$1(n2);
1040
1040
  }, []);
1041
1041
  }
1042
- var exhaustive = (value) => {
1042
+ const exhaustive = (value) => {
1043
1043
  throw new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);
1044
1044
  };
1045
1045
  function invariant$1(condition, message) {
@@ -8060,7 +8060,8 @@ const createNewApplicationData = (application2) => ({
8060
8060
  messages: [],
8061
8061
  submissions: {},
8062
8062
  currentNodeId: getHeadOrThrow(application2.flow.nodes).id,
8063
- isFinished: false
8063
+ isFinished: false,
8064
+ sequence: 0
8064
8065
  });
8065
8066
  var _ = 0;
8066
8067
  function o(o2, e2, n2, t2, f2, l2) {
@@ -8296,7 +8297,7 @@ const ChatbotHeader = ({
8296
8297
  })]
8297
8298
  });
8298
8299
  };
8299
- const JobApplicationContent = M$1(() => Promise.resolve().then(() => require("./job-application-content-105f0dc9.cjs")).then((module2) => module2.JobApplicationContent));
8300
+ const JobApplicationContent = M$1(() => Promise.resolve().then(() => require("./job-application-content-447d0287.cjs")).then((module2) => module2.JobApplicationContent));
8300
8301
  const MotionProvider = ({
8301
8302
  children
8302
8303
  }) => {
@@ -12251,8 +12252,17 @@ const chatbotPlugin = ({
12251
12252
  jobId,
12252
12253
  apiClient,
12253
12254
  logger
12254
- }).then((res) => {
12255
+ }).then(async (res) => {
12255
12256
  if (res.ok) {
12257
+ await analytics.log({
12258
+ event: "APPLY_START",
12259
+ properties: {
12260
+ job_id: jobId
12261
+ },
12262
+ customProperties: {
12263
+ flow_id: res.value.flow.id
12264
+ }
12265
+ }).catch(logger.error);
12256
12266
  application.start(res.value);
12257
12267
  } else {
12258
12268
  application.current$.value = {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-08db93e2.cjs");
3
+ const index = require("./index-d7f1dfc3.cjs");
4
4
  require("@inploi/sdk");
5
5
  const followNodes = ({
6
6
  node,
@@ -2833,18 +2833,6 @@ const JobApplicationContent = ({
2833
2833
  index.application.setInput(void 0);
2834
2834
  if (currentApplication2.data.isFinished)
2835
2835
  return;
2836
- const fromBeginning = currentApplication2.data.messages.length === 0;
2837
- if (fromBeginning) {
2838
- analytics.log({
2839
- event: "APPLY_START",
2840
- properties: {
2841
- job_id: job.id
2842
- },
2843
- customProperties: {
2844
- flow_id: flow.id
2845
- }
2846
- });
2847
- }
2848
2836
  index.application.removeLastGroupMessagesById(fromNodeId);
2849
2837
  const {
2850
2838
  interpret: interpret2,
@@ -2865,6 +2853,9 @@ const JobApplicationContent = ({
2865
2853
  return (_a = index.application.current$.peek().application) == null ? void 0 : _a.data.submissions;
2866
2854
  },
2867
2855
  onInterpret: (node, prevNode) => {
2856
+ const currentState = index.application.current$.peek().application;
2857
+ index.invariant(currentState);
2858
+ currentState.data.sequence = currentState.data.sequence + 1;
2868
2859
  analytics.log({
2869
2860
  event: "FLOW_NODE",
2870
2861
  properties: {
@@ -2873,7 +2864,7 @@ const JobApplicationContent = ({
2873
2864
  job_id: job.id,
2874
2865
  from_node_id: prevNode ? prevNode.id : null,
2875
2866
  to_node_id: node.id,
2876
- sequence: 1
2867
+ sequence: currentState.data.sequence
2877
2868
  }
2878
2869
  });
2879
2870
  index.application.setCurrentNodeId(node.id);
@@ -1,4 +1,4 @@
1
- import { _, g as getHeadOrThrow, A as AbortedError, N, a as getApplicationSubmissionsPayload, o as o$1, c as clsx, b as _$1, p, d as parse, e as picklist, m, f as AnimatePresence, h as application, i as h, k, j as invariant, l as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, s as minLength, u as record, v as boolean, w as string, x as email, y as url, z as regex, B as y, T, D as inputHeight, F, E as viewState, G as ERROR_MESSAGES } from "./index-17b40695.js";
1
+ import { _, g as getHeadOrThrow, A as AbortedError, N, a as getApplicationSubmissionsPayload, o as o$1, c as clsx, b as _$1, p, d as parse, e as picklist, m, f as AnimatePresence, h as application, i as h, k, j as invariant, l as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, s as minLength, u as record, v as boolean, w as string, x as email, y as url, z as regex, B as y, T, D as inputHeight, F, E as viewState, G as ERROR_MESSAGES } from "./index-8b760687.js";
2
2
  import "@inploi/sdk";
3
3
  const followNodes = ({
4
4
  node,
@@ -2831,18 +2831,6 @@ const JobApplicationContent = ({
2831
2831
  application.setInput(void 0);
2832
2832
  if (currentApplication2.data.isFinished)
2833
2833
  return;
2834
- const fromBeginning = currentApplication2.data.messages.length === 0;
2835
- if (fromBeginning) {
2836
- analytics.log({
2837
- event: "APPLY_START",
2838
- properties: {
2839
- job_id: job.id
2840
- },
2841
- customProperties: {
2842
- flow_id: flow.id
2843
- }
2844
- });
2845
- }
2846
2834
  application.removeLastGroupMessagesById(fromNodeId);
2847
2835
  const {
2848
2836
  interpret: interpret2,
@@ -2863,6 +2851,9 @@ const JobApplicationContent = ({
2863
2851
  return (_a = application.current$.peek().application) == null ? void 0 : _a.data.submissions;
2864
2852
  },
2865
2853
  onInterpret: (node, prevNode) => {
2854
+ const currentState = application.current$.peek().application;
2855
+ invariant(currentState);
2856
+ currentState.data.sequence = currentState.data.sequence + 1;
2866
2857
  analytics.log({
2867
2858
  event: "FLOW_NODE",
2868
2859
  properties: {
@@ -2871,7 +2862,7 @@ const JobApplicationContent = ({
2871
2862
  job_id: job.id,
2872
2863
  from_node_id: prevNode ? prevNode.id : null,
2873
2864
  to_node_id: node.id,
2874
- sequence: 1
2865
+ sequence: currentState.data.sequence
2875
2866
  }
2876
2867
  });
2877
2868
  application.setCurrentNodeId(node.id);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-08db93e2.cjs");
3
+ const index = require("./index-d7f1dfc3.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { H } from "./index-17b40695.js";
1
+ import { H } from "./index-8b760687.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  H as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.2.11",
3
+ "version": "3.2.13",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,10 +66,10 @@
66
66
  "vite": "^4.4.5",
67
67
  "vite-plugin-dts": "^3.7.0",
68
68
  "vite-tsconfig-paths": "^4.2.1",
69
- "@inploi/core": "1.6.2",
70
- "tsconfig": "0.1.0",
71
- "@inploi/sdk": "1.7.4",
72
- "eslint-config-custom": "0.1.0"
69
+ "@inploi/core": "1.7.0",
70
+ "@inploi/sdk": "1.7.6",
71
+ "eslint-config-custom": "0.1.0",
72
+ "tsconfig": "0.1.0"
73
73
  },
74
74
  "msw": {
75
75
  "workerDirectory": "public"