@inploi/plugin-chatbot 3.28.4 → 3.28.5

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-251fe248.cjs");
3
+ const index = require("./index-a5203fc5.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isConditionMet = ({
6
6
  condition,
@@ -597,32 +597,41 @@ async function interpretSubmitNode({
597
597
  author: "bot",
598
598
  text: response2.redirect.message ?? "Almost there! Please complete your submission here:"
599
599
  });
600
- const href = new URL(response2.redirect.redirect_url);
601
- if (anonymous_id && !href.searchParams.has("anonymous_id")) {
602
- href.searchParams.set("anonymous_id", anonymous_id);
603
- }
604
- await chat.sendMessage({
605
- type: "link",
606
- href: href.toString(),
607
- text: response2.redirect.button_text ?? "Complete submission",
608
- onClick: () => {
609
- if (!session_id) {
610
- logger.error("session_id not set, cannot log FLOW_REDIRECT event");
611
- return;
612
- }
613
- analytics.log({
614
- event: "FLOW_REDIRECT",
615
- properties: {
616
- flow_build: flow.build,
617
- flow_id: flow.id,
618
- flow_session_id: session_id,
619
- flow_version: flow.version,
620
- href: href.toString(),
621
- job: flow.job
622
- }
623
- });
600
+ try {
601
+ const href = new URL(response2.redirect.redirect_url);
602
+ if (anonymous_id && !href.searchParams.has("anonymous_id")) {
603
+ href.searchParams.set("anonymous_id", anonymous_id);
624
604
  }
625
- });
605
+ await chat.sendMessage({
606
+ type: "link",
607
+ href: href.toString(),
608
+ text: response2.redirect.button_text ?? "Complete submission",
609
+ onClick: () => {
610
+ if (!session_id) {
611
+ logger.error("session_id not set, cannot log FLOW_REDIRECT event");
612
+ return;
613
+ }
614
+ analytics.log({
615
+ event: "FLOW_REDIRECT",
616
+ properties: {
617
+ flow_build: flow.build,
618
+ flow_id: flow.id,
619
+ flow_session_id: session_id,
620
+ flow_version: flow.version,
621
+ href: href.toString(),
622
+ job: flow.job
623
+ }
624
+ });
625
+ }
626
+ });
627
+ } catch (e) {
628
+ logger.error(`Invalid redirect URL: ${response2.redirect.redirect_url}`, e);
629
+ chat.sendMessage({
630
+ type: "system",
631
+ variant: "error",
632
+ text: "Couldn’t get the redirect URL."
633
+ });
634
+ }
626
635
  next(node.nextId);
627
636
  }).with({
628
637
  success: true
@@ -1,4 +1,4 @@
1
- import { g as get$1, i as isString$2, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, c as getFlowSubmissionsPayload, N, _, 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 k, m as k$1, n as getFormSubmitter, q as parse, r as picklist, t as isSubmissionOfType, C as Cn, u as parseAsync, V as ValiError, v as object, w as transform, x as cva, z as maxLength, B as minLength, D as record, E as boolean, G as number, H as minValue, I as maxValue, J as custom, K as string, L as regex, M as email, O as url, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-5e2a3998.js";
1
+ import { g as get$1, i as isString$2, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, c as getFlowSubmissionsPayload, N, _, 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 k, m as k$1, n as getFormSubmitter, q as parse, r as picklist, t as isSubmissionOfType, C as Cn, u as parseAsync, V as ValiError, v as object, w as transform, x as cva, z as maxLength, B as minLength, D as record, E as boolean, G as number, H as minValue, I as maxValue, J as custom, K as string, L as regex, M as email, O as url, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-d86fb8f9.js";
2
2
  import "@inploi/sdk";
3
3
  const isConditionMet = ({
4
4
  condition,
@@ -595,32 +595,41 @@ async function interpretSubmitNode({
595
595
  author: "bot",
596
596
  text: response2.redirect.message ?? "Almost there! Please complete your submission here:"
597
597
  });
598
- const href = new URL(response2.redirect.redirect_url);
599
- if (anonymous_id && !href.searchParams.has("anonymous_id")) {
600
- href.searchParams.set("anonymous_id", anonymous_id);
601
- }
602
- await chat.sendMessage({
603
- type: "link",
604
- href: href.toString(),
605
- text: response2.redirect.button_text ?? "Complete submission",
606
- onClick: () => {
607
- if (!session_id) {
608
- logger.error("session_id not set, cannot log FLOW_REDIRECT event");
609
- return;
610
- }
611
- analytics.log({
612
- event: "FLOW_REDIRECT",
613
- properties: {
614
- flow_build: flow.build,
615
- flow_id: flow.id,
616
- flow_session_id: session_id,
617
- flow_version: flow.version,
618
- href: href.toString(),
619
- job: flow.job
620
- }
621
- });
598
+ try {
599
+ const href = new URL(response2.redirect.redirect_url);
600
+ if (anonymous_id && !href.searchParams.has("anonymous_id")) {
601
+ href.searchParams.set("anonymous_id", anonymous_id);
622
602
  }
623
- });
603
+ await chat.sendMessage({
604
+ type: "link",
605
+ href: href.toString(),
606
+ text: response2.redirect.button_text ?? "Complete submission",
607
+ onClick: () => {
608
+ if (!session_id) {
609
+ logger.error("session_id not set, cannot log FLOW_REDIRECT event");
610
+ return;
611
+ }
612
+ analytics.log({
613
+ event: "FLOW_REDIRECT",
614
+ properties: {
615
+ flow_build: flow.build,
616
+ flow_id: flow.id,
617
+ flow_session_id: session_id,
618
+ flow_version: flow.version,
619
+ href: href.toString(),
620
+ job: flow.job
621
+ }
622
+ });
623
+ }
624
+ });
625
+ } catch (e) {
626
+ logger.error(`Invalid redirect URL: ${response2.redirect.redirect_url}`, e);
627
+ chat.sendMessage({
628
+ type: "system",
629
+ variant: "error",
630
+ text: "Couldn’t get the redirect URL."
631
+ });
632
+ }
624
633
  next(node.nextId);
625
634
  }).with({
626
635
  success: true
@@ -5321,7 +5321,7 @@ const StatusBar = ({
5321
5321
  };
5322
5322
  function noop() {
5323
5323
  }
5324
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-30a036fc.cjs")).then((module2) => module2.ChatbotBody));
5324
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-37310a05.cjs")).then((module2) => module2.ChatbotBody));
5325
5325
  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 [&:has(.view-switch:active)]:scale-[0.98] transition-all duration-1000 ease-expo-out", {
5326
5326
  variants: {
5327
5327
  view: {
@@ -5320,7 +5320,7 @@ const StatusBar = ({
5320
5320
  };
5321
5321
  function noop() {
5322
5322
  }
5323
- const ChatbotBody = M(() => import("./chatbot-body-51e9bd34.js").then((module) => module.ChatbotBody));
5323
+ const ChatbotBody = M(() => import("./chatbot-body-3937530b.js").then((module) => module.ChatbotBody));
5324
5324
  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 [&:has(.view-switch:active)]:scale-[0.98] transition-all duration-1000 ease-expo-out", {
5325
5325
  variants: {
5326
5326
  view: {
@@ -1,2 +1,3 @@
1
1
  import { FlowNode } from '@inploi/core/flows';
2
2
  export declare const mockGetFlowEndpoint: (nodes: FlowNode[]) => import("msw").HttpHandler;
3
+ export declare const mockSubmitEndpoint: (response: unknown) => import("msw").HttpHandler;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-251fe248.cjs");
3
+ const index = require("./index-a5203fc5.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { R } from "./index-5e2a3998.js";
1
+ import { R } from "./index-d86fb8f9.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.28.4",
3
+ "version": "3.28.5",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -69,7 +69,7 @@
69
69
  "vite-tsconfig-paths": "^4.2.1",
70
70
  "@inploi/core": "1.14.6",
71
71
  "@inploi/design-tokens": "0.2.1",
72
- "@inploi/sdk": "1.14.8",
72
+ "@inploi/sdk": "1.14.9",
73
73
  "eslint-config-custom": "0.1.0",
74
74
  "tsconfig": "0.1.0"
75
75
  },