@inploi/plugin-chatbot 3.22.0 → 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-160169ee.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
@@ -471,7 +499,6 @@ async function interpretSubmitNode({
471
499
  href: href.toString(),
472
500
  text: "Complete submission",
473
501
  onClick: () => {
474
- alert("kek");
475
502
  if (!session_id)
476
503
  return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
477
504
  analytics.log({
@@ -526,14 +553,8 @@ async function interpretLinkNode({
526
553
  next,
527
554
  node,
528
555
  submissions,
529
- context,
530
- analytics,
531
- flow,
532
- logger
556
+ context
533
557
  }) {
534
- const {
535
- session_id
536
- } = analytics.getSessionInfo();
537
558
  await chat.sendMessage({
538
559
  type: "link",
539
560
  href: interpolateWithData(node.data.href, {
@@ -543,21 +564,7 @@ async function interpretLinkNode({
543
564
  text: interpolateWithData(node.data.cta, {
544
565
  submissions,
545
566
  context
546
- }),
547
- onClick: () => {
548
- if (!session_id)
549
- return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
550
- analytics.log({
551
- event: "FLOW_REDIRECT",
552
- properties: {
553
- flow_build: flow.build,
554
- flow_id: flow.id,
555
- flow_session_id: session_id,
556
- flow_version: flow.version,
557
- href: node.data.href
558
- }
559
- });
560
- }
567
+ })
561
568
  });
562
569
  next(node.nextId);
563
570
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-9daf272b.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
@@ -473,7 +501,6 @@ async function interpretSubmitNode({
473
501
  href: href.toString(),
474
502
  text: "Complete submission",
475
503
  onClick: () => {
476
- alert("kek");
477
504
  if (!session_id)
478
505
  return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
479
506
  analytics.log({
@@ -528,14 +555,8 @@ async function interpretLinkNode({
528
555
  next,
529
556
  node,
530
557
  submissions,
531
- context,
532
- analytics,
533
- flow,
534
- logger
558
+ context
535
559
  }) {
536
- const {
537
- session_id
538
- } = analytics.getSessionInfo();
539
560
  await chat.sendMessage({
540
561
  type: "link",
541
562
  href: interpolateWithData(node.data.href, {
@@ -545,21 +566,7 @@ async function interpretLinkNode({
545
566
  text: interpolateWithData(node.data.cta, {
546
567
  submissions,
547
568
  context
548
- }),
549
- onClick: () => {
550
- if (!session_id)
551
- return logger.error("session_id not set, cannot log FLOW_REDIRECT event");
552
- analytics.log({
553
- event: "FLOW_REDIRECT",
554
- properties: {
555
- flow_build: flow.build,
556
- flow_id: flow.id,
557
- flow_session_id: session_id,
558
- flow_version: flow.version,
559
- href: node.data.href
560
- }
561
- });
562
- }
569
+ })
563
570
  });
564
571
  next(node.nextId);
565
572
  }
@@ -5312,7 +5312,7 @@ const StatusBar = ({
5312
5312
  })
5313
5313
  });
5314
5314
  };
5315
- const ChatbotBody = M(() => import("./chatbot-body-ced5f714.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-e6a3f53d.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-9daf272b.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-160169ee.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.0",
3
+ "version": "3.23.0",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -68,7 +68,7 @@
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.1",
71
+ "@inploi/sdk": "1.14.2",
72
72
  "eslint-config-custom": "0.1.0",
73
73
  "tsconfig": "0.1.0"
74
74
  },