@inploi/plugin-chatbot 3.20.3 → 3.21.0

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-ff0da338.cjs");
3
+ const index = require("./index-7fba4662.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isIfBlockConditionMet = (ifBlock, {
6
6
  context,
@@ -265,13 +265,23 @@ const createFlowInterpreter = ({
265
265
  onInterpret
266
266
  }) => {
267
267
  let controller = new AbortController();
268
+ const analyticsWithCustomProperties = {
269
+ ...analytics.service,
270
+ log: (params) => analytics.service.log({
271
+ ...params,
272
+ customProperties: {
273
+ ...params.customProperties,
274
+ ...analytics.customProperties
275
+ }
276
+ })
277
+ };
268
278
  const interpretNode = async (node, prevNode) => {
269
279
  const submissions = getSubmissions();
270
280
  onInterpret == null ? void 0 : onInterpret(node, prevNode);
271
281
  try {
272
282
  await interpret({
273
283
  flow,
274
- analytics,
284
+ analytics: analyticsWithCustomProperties,
275
285
  logger,
276
286
  apiClient,
277
287
  context,
@@ -474,8 +484,7 @@ async function interpretSubmitNode({
474
484
  flow_session_id: session_id,
475
485
  flow_version: flow.version,
476
486
  href: href.toString()
477
- },
478
- customProperties: context
487
+ }
479
488
  });
480
489
  }
481
490
  });
@@ -548,8 +557,7 @@ async function interpretLinkNode({
548
557
  flow_session_id: session_id,
549
558
  flow_version: flow.version,
550
559
  href: node.data.href
551
- },
552
- customProperties: context
560
+ }
553
561
  });
554
562
  }
555
563
  });
@@ -4002,6 +4010,7 @@ const ChatbotBody = ({
4002
4010
  chatStore.scrollToEnd.instant();
4003
4011
  }, [view]);
4004
4012
  index.y(() => {
4013
+ var _a, _b;
4005
4014
  const {
4006
4015
  state,
4007
4016
  flow: currentApplication
@@ -4024,7 +4033,7 @@ const ChatbotBody = ({
4024
4033
  flow_session_id: currentApplication.data.flowSessionId,
4025
4034
  flow_build: flow.build
4026
4035
  },
4027
- customProperties: flow.context
4036
+ customProperties: (_a = flow.analytics) == null ? void 0 : _a.customProperties
4028
4037
  });
4029
4038
  } else {
4030
4039
  index.store.removeMessagesSentByNodeIds([fromNodeId]);
@@ -4035,17 +4044,21 @@ const ChatbotBody = ({
4035
4044
  undo
4036
4045
  } = createFlowInterpreter({
4037
4046
  context: flow.context,
4038
- analytics,
4047
+ analytics: {
4048
+ service: analytics,
4049
+ customProperties: (_b = flow.analytics) == null ? void 0 : _b.customProperties
4050
+ },
4039
4051
  apiClient,
4040
4052
  logger,
4041
4053
  flow,
4042
4054
  chatService,
4043
4055
  // We need to get fresh submissions, that’s why we call `peek` here.
4044
4056
  getSubmissions: () => {
4045
- var _a;
4046
- return (_a = index.store.current$.peek().flow) == null ? void 0 : _a.data.submissions;
4057
+ var _a2;
4058
+ return (_a2 = index.store.current$.peek().flow) == null ? void 0 : _a2.data.submissions;
4047
4059
  },
4048
4060
  onInterpret: (node, prevNode) => {
4061
+ var _a2;
4049
4062
  const currentState = index.store.current$.peek().flow;
4050
4063
  index.invariant(currentState);
4051
4064
  if (prevNode) {
@@ -4061,12 +4074,13 @@ const ChatbotBody = ({
4061
4074
  sequence: currentState.data.sequence,
4062
4075
  flow_session_id: currentState.data.flowSessionId
4063
4076
  },
4064
- customProperties: flow.context
4077
+ customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
4065
4078
  });
4066
4079
  }
4067
4080
  index.store.setCurrentNodeId(node.id);
4068
4081
  },
4069
4082
  onFlowEnd: async () => {
4083
+ var _a2;
4070
4084
  index.store.markAsFinished();
4071
4085
  const currentState = index.store.current$.peek().flow;
4072
4086
  index.invariant(currentState);
@@ -4078,7 +4092,7 @@ const ChatbotBody = ({
4078
4092
  flow_session_id: currentState.data.flowSessionId,
4079
4093
  flow_build: flow.build
4080
4094
  },
4081
- customProperties: flow.context
4095
+ customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
4082
4096
  });
4083
4097
  }
4084
4098
  });
@@ -1,4 +1,4 @@
1
- import { g as get$1, i as isString$1, 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 debounce$1, m as k, n as parse, q as picklist, r as isSubmissionOfType, C as Cn, t as parseAsync, V as ValiError, u as object, v as transform, w as maxLength, x as minLength, z as record, B as boolean, D as number, E as minValue, G as maxValue, H as custom, I as string, J as email, K as url, L as regex, M as cva, O as ERROR_MESSAGES } from "./index-03f425b8.js";
1
+ import { g as get$1, i as isString$1, 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 debounce$1, m as k, n as parse, q as picklist, r as isSubmissionOfType, C as Cn, t as parseAsync, V as ValiError, u as object, v as transform, w as maxLength, x as minLength, z as record, B as boolean, D as number, E as minValue, G as maxValue, H as custom, I as string, J as email, K as url, L as regex, M as cva, O as ERROR_MESSAGES } from "./index-8c0699fb.js";
2
2
  import "@inploi/sdk";
3
3
  const isIfBlockConditionMet = (ifBlock, {
4
4
  context,
@@ -263,13 +263,23 @@ const createFlowInterpreter = ({
263
263
  onInterpret
264
264
  }) => {
265
265
  let controller = new AbortController();
266
+ const analyticsWithCustomProperties = {
267
+ ...analytics.service,
268
+ log: (params) => analytics.service.log({
269
+ ...params,
270
+ customProperties: {
271
+ ...params.customProperties,
272
+ ...analytics.customProperties
273
+ }
274
+ })
275
+ };
266
276
  const interpretNode = async (node, prevNode) => {
267
277
  const submissions = getSubmissions();
268
278
  onInterpret == null ? void 0 : onInterpret(node, prevNode);
269
279
  try {
270
280
  await interpret({
271
281
  flow,
272
- analytics,
282
+ analytics: analyticsWithCustomProperties,
273
283
  logger,
274
284
  apiClient,
275
285
  context,
@@ -472,8 +482,7 @@ async function interpretSubmitNode({
472
482
  flow_session_id: session_id,
473
483
  flow_version: flow.version,
474
484
  href: href.toString()
475
- },
476
- customProperties: context
485
+ }
477
486
  });
478
487
  }
479
488
  });
@@ -546,8 +555,7 @@ async function interpretLinkNode({
546
555
  flow_session_id: session_id,
547
556
  flow_version: flow.version,
548
557
  href: node.data.href
549
- },
550
- customProperties: context
558
+ }
551
559
  });
552
560
  }
553
561
  });
@@ -4000,6 +4008,7 @@ const ChatbotBody = ({
4000
4008
  chatStore.scrollToEnd.instant();
4001
4009
  }, [view]);
4002
4010
  y(() => {
4011
+ var _a, _b;
4003
4012
  const {
4004
4013
  state,
4005
4014
  flow: currentApplication
@@ -4022,7 +4031,7 @@ const ChatbotBody = ({
4022
4031
  flow_session_id: currentApplication.data.flowSessionId,
4023
4032
  flow_build: flow.build
4024
4033
  },
4025
- customProperties: flow.context
4034
+ customProperties: (_a = flow.analytics) == null ? void 0 : _a.customProperties
4026
4035
  });
4027
4036
  } else {
4028
4037
  store.removeMessagesSentByNodeIds([fromNodeId]);
@@ -4033,17 +4042,21 @@ const ChatbotBody = ({
4033
4042
  undo
4034
4043
  } = createFlowInterpreter({
4035
4044
  context: flow.context,
4036
- analytics,
4045
+ analytics: {
4046
+ service: analytics,
4047
+ customProperties: (_b = flow.analytics) == null ? void 0 : _b.customProperties
4048
+ },
4037
4049
  apiClient,
4038
4050
  logger,
4039
4051
  flow,
4040
4052
  chatService,
4041
4053
  // We need to get fresh submissions, that’s why we call `peek` here.
4042
4054
  getSubmissions: () => {
4043
- var _a;
4044
- return (_a = store.current$.peek().flow) == null ? void 0 : _a.data.submissions;
4055
+ var _a2;
4056
+ return (_a2 = store.current$.peek().flow) == null ? void 0 : _a2.data.submissions;
4045
4057
  },
4046
4058
  onInterpret: (node, prevNode) => {
4059
+ var _a2;
4047
4060
  const currentState = store.current$.peek().flow;
4048
4061
  invariant(currentState);
4049
4062
  if (prevNode) {
@@ -4059,12 +4072,13 @@ const ChatbotBody = ({
4059
4072
  sequence: currentState.data.sequence,
4060
4073
  flow_session_id: currentState.data.flowSessionId
4061
4074
  },
4062
- customProperties: flow.context
4075
+ customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
4063
4076
  });
4064
4077
  }
4065
4078
  store.setCurrentNodeId(node.id);
4066
4079
  },
4067
4080
  onFlowEnd: async () => {
4081
+ var _a2;
4068
4082
  store.markAsFinished();
4069
4083
  const currentState = store.current$.peek().flow;
4070
4084
  invariant(currentState);
@@ -4076,7 +4090,7 @@ const ChatbotBody = ({
4076
4090
  flow_session_id: currentState.data.flowSessionId,
4077
4091
  flow_build: flow.build
4078
4092
  },
4079
- customProperties: flow.context
4093
+ customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
4080
4094
  });
4081
4095
  }
4082
4096
  });