@inploi/plugin-chatbot 3.22.1 → 3.23.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,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 k$1, q as getFormSubmitter, r as parse, t as picklist, u as isSubmissionOfType, C as Cn, v as parseAsync, V as ValiError, w as object, x as transform, z as cva, B as maxLength, D as minLength, E as record, G as boolean, H as number, I as minValue, J as maxValue, K as custom, L as string, M as email, O as url, P as regex, Q as ERROR_MESSAGES } from "./index-794ce056.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 k$1, q as getFormSubmitter, r as parse, t as picklist, u as isSubmissionOfType, C as Cn, v as parseAsync, V as ValiError, w as object, x as transform, z as cva, B as maxLength, D as minLength, E as record, G as boolean, H as number, I as minValue, J as maxValue, K as custom, L as string, M as email, O as url, P as regex, Q as ERROR_MESSAGES } from "./index-6e48d6e0.js";
2
2
  import "@inploi/sdk";
3
3
  const isIfBlockConditionMet = (ifBlock, {
4
4
  context,
@@ -440,10 +440,11 @@ async function interpretSubmitNode({
440
440
  const response = await apiClient.fetch(`/flow/submit`, {
441
441
  method: "POST",
442
442
  body: JSON.stringify({
443
- ...context,
443
+ log_submit: false,
444
444
  integration_id: node.data.integrationId,
445
445
  anonymous_id,
446
446
  session_id,
447
+ ...context,
447
448
  submissions: getFlowSubmissionsPayload(submissions || {})
448
449
  })
449
450
  }).catch((e) => e);
@@ -452,6 +453,33 @@ async function interpretSubmitNode({
452
453
  type: "integration",
453
454
  value: response
454
455
  });
456
+ N(response).with({
457
+ integration_response: _.select(_.union({
458
+ status: _.number,
459
+ data: _.any
460
+ }, {
461
+ status: _.number,
462
+ error: {
463
+ message: _.string,
464
+ data: _.any
465
+ }
466
+ }))
467
+ }, (integrationResponse) => {
468
+ analytics.log({
469
+ event: "FLOW_SUBMIT",
470
+ properties: {
471
+ flow_id: flow.id,
472
+ flow_version: flow.version,
473
+ flow_session_id: flow.data.flowSessionId,
474
+ flow_build: flow.build,
475
+ response: {
476
+ status: integrationResponse.status,
477
+ payload: "data" in integrationResponse ? integrationResponse.data : integrationResponse.error.data ?? null
478
+ }
479
+ }
480
+ });
481
+ }).otherwise(() => {
482
+ });
455
483
  await N(response).with({
456
484
  ats_data: {
457
485
  redirect_url: _.string
@@ -525,14 +553,8 @@ async function interpretLinkNode({
525
553
  next,
526
554
  node,
527
555
  submissions,
528
- context,
529
- analytics,
530
- flow,
531
- logger
556
+ context
532
557
  }) {
533
- const {
534
- session_id
535
- } = analytics.getSessionInfo();
536
558
  await chat.sendMessage({
537
559
  type: "link",
538
560
  href: interpolateWithData(node.data.href, {
@@ -542,21 +564,7 @@ async function interpretLinkNode({
542
564
  text: interpolateWithData(node.data.cta, {
543
565
  submissions,
544
566
  context
545
- }),
546
- onClick: () => {
547
- if (!session_id)
548
- return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
549
- analytics.log({
550
- event: "FLOW_REDIRECT",
551
- properties: {
552
- flow_build: flow.build,
553
- flow_id: flow.id,
554
- flow_session_id: session_id,
555
- flow_version: flow.version,
556
- href: node.data.href
557
- }
558
- });
559
- }
567
+ })
560
568
  });
561
569
  next(node.nextId);
562
570
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-e1616316.cjs");
3
+ const index = require("./index-d8265e0a.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isIfBlockConditionMet = (ifBlock, {
6
6
  context,
@@ -442,10 +442,11 @@ async function interpretSubmitNode({
442
442
  const response = await apiClient.fetch(`/flow/submit`, {
443
443
  method: "POST",
444
444
  body: JSON.stringify({
445
- ...context,
445
+ log_submit: false,
446
446
  integration_id: node.data.integrationId,
447
447
  anonymous_id,
448
448
  session_id,
449
+ ...context,
449
450
  submissions: index.getFlowSubmissionsPayload(submissions || {})
450
451
  })
451
452
  }).catch((e) => e);
@@ -454,6 +455,33 @@ async function interpretSubmitNode({
454
455
  type: "integration",
455
456
  value: response
456
457
  });
458
+ index.N(response).with({
459
+ integration_response: index._.select(index._.union({
460
+ status: index._.number,
461
+ data: index._.any
462
+ }, {
463
+ status: index._.number,
464
+ error: {
465
+ message: index._.string,
466
+ data: index._.any
467
+ }
468
+ }))
469
+ }, (integrationResponse) => {
470
+ analytics.log({
471
+ event: "FLOW_SUBMIT",
472
+ properties: {
473
+ flow_id: flow.id,
474
+ flow_version: flow.version,
475
+ flow_session_id: flow.data.flowSessionId,
476
+ flow_build: flow.build,
477
+ response: {
478
+ status: integrationResponse.status,
479
+ payload: "data" in integrationResponse ? integrationResponse.data : integrationResponse.error.data ?? null
480
+ }
481
+ }
482
+ });
483
+ }).otherwise(() => {
484
+ });
457
485
  await index.N(response).with({
458
486
  ats_data: {
459
487
  redirect_url: index._.string
@@ -527,14 +555,8 @@ async function interpretLinkNode({
527
555
  next,
528
556
  node,
529
557
  submissions,
530
- context,
531
- analytics,
532
- flow,
533
- logger
558
+ context
534
559
  }) {
535
- const {
536
- session_id
537
- } = analytics.getSessionInfo();
538
560
  await chat.sendMessage({
539
561
  type: "link",
540
562
  href: interpolateWithData(node.data.href, {
@@ -544,21 +566,7 @@ async function interpretLinkNode({
544
566
  text: interpolateWithData(node.data.cta, {
545
567
  submissions,
546
568
  context
547
- }),
548
- onClick: () => {
549
- if (!session_id)
550
- return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
551
- analytics.log({
552
- event: "FLOW_REDIRECT",
553
- properties: {
554
- flow_build: flow.build,
555
- flow_id: flow.id,
556
- flow_session_id: session_id,
557
- flow_version: flow.version,
558
- href: node.data.href
559
- }
560
- });
561
- }
569
+ })
562
570
  });
563
571
  next(node.nextId);
564
572
  }
@@ -5312,7 +5312,7 @@ const StatusBar = ({
5312
5312
  })
5313
5313
  });
5314
5314
  };
5315
- const ChatbotBody = M(() => import("./chatbot-body-8e509812.js").then((module) => module.ChatbotBody));
5315
+ const ChatbotBody = M(() => import("./chatbot-body-364c9383.js").then((module) => module.ChatbotBody));
5316
5316
  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", {
5317
5317
  variants: {
5318
5318
  view: {
@@ -5744,6 +5744,7 @@ const chatbotPlugin = ({
5744
5744
  analytics: {
5745
5745
  customProperties: {
5746
5746
  job_id: data.job.id,
5747
+ key: "external_id",
5747
5748
  flow_id: data.flow.id,
5748
5749
  flow_version: data.flow.version,
5749
5750
  ...(_a = additionalProperties == null ? void 0 : additionalProperties.analytics) == null ? void 0 : _a.customProperties
@@ -5313,7 +5313,7 @@ const StatusBar = ({
5313
5313
  })
5314
5314
  });
5315
5315
  };
5316
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-7dbeea50.cjs")).then((module2) => module2.ChatbotBody));
5316
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-e518eb9a.cjs")).then((module2) => module2.ChatbotBody));
5317
5317
  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", {
5318
5318
  variants: {
5319
5319
  view: {
@@ -5745,6 +5745,7 @@ const chatbotPlugin = ({
5745
5745
  analytics: {
5746
5746
  customProperties: {
5747
5747
  job_id: data.job.id,
5748
+ key: "external_id",
5748
5749
  flow_id: data.flow.id,
5749
5750
  flow_version: data.flow.version,
5750
5751
  ...(_a = additionalProperties == null ? void 0 : additionalProperties.analytics) == null ? void 0 : _a.customProperties
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-e1616316.cjs");
3
+ const index = require("./index-d8265e0a.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { R } from "./index-794ce056.js";
1
+ import { R } from "./index-6e48d6e0.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.22.1",
3
+ "version": "3.23.0",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -68,8 +68,8 @@
68
68
  "vite-tsconfig-paths": "^4.2.1",
69
69
  "@inploi/core": "1.14.2",
70
70
  "@inploi/design-tokens": "0.2.1",
71
+ "@inploi/sdk": "1.14.2",
71
72
  "eslint-config-custom": "0.1.0",
72
- "@inploi/sdk": "1.14.1",
73
73
  "tsconfig": "0.1.0"
74
74
  },
75
75
  "msw": {