@inploi/plugin-chatbot 3.17.1 → 3.18.1

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 { i as isString$1, g as getHeadOrThrow, a as invariant, A as AbortedError, N, b as getFlowSubmissionsPayload, _, k as kbToReadableSize, h, c as _$1, p, F, o as o$1, d as clsx, y, s as store, e as a$2, f as debounce$1, j as k, l as parse, m as picklist, n as isSubmissionOfType, C as Cn, q as parseAsync, V as ValiError, r as object, t as transform, u as maxLength, v as minLength, w as record, x as boolean, z as number, B as minValue, D as maxValue, E as custom, G as string, H as email, I as url, J as regex, K as cva, L as ERROR_MESSAGES } from "./index-bc9ac6fc.js";
1
+ import { i as isString$1, g as getHeadOrThrow, a as invariant, A as AbortedError, N, k as kbToReadableSize, b as getFlowSubmissionsPayload, _, h, c as _$1, p, F, o as o$1, d as clsx, y, s as store, e as a$2, f as debounce$1, j as k, l as parse, m as picklist, n as isSubmissionOfType, C as Cn, q as parseAsync, V as ValiError, r as object, t as transform, u as maxLength, v as minLength, w as record, x as boolean, z as number, B as minValue, D as maxValue, E as custom, G as string, H as email, I as url, J as regex, K as cva, L as ERROR_MESSAGES } from "./index-18edb2f5.js";
2
2
  import "@inploi/sdk";
3
3
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
@@ -792,77 +792,93 @@ async function interpretSubmitNode({
792
792
  context,
793
793
  analytics
794
794
  }) {
795
- if (node.data.skipConfirmation !== true) {
796
- await chat.userInput({
797
- type: "submit",
798
- key: void 0,
799
- config: {
800
- label: node.data.submitLabel
801
- }
802
- });
803
- }
804
- await chat.sendMessage({
805
- type: "system",
806
- variant: "info",
807
- text: "Submitting…"
808
- });
809
- const {
810
- anonymous_id,
811
- session_id
812
- } = analytics.getSessionInfo();
813
- const response = await apiClient.fetch(`/flow/apply`, {
814
- method: "POST",
815
- body: JSON.stringify({
816
- ...context,
817
- integration_id: node.data.integrationId,
818
- anonymous_id,
819
- session_id,
820
- submissions: getFlowSubmissionsPayload(submissions || {})
821
- })
822
- }).catch((e) => e);
823
- if (node.data.key)
824
- chat.addToSubmissions(node.data.key, {
825
- type: "integration",
826
- value: response
827
- });
828
- await N(response).with({
829
- ats_data: {
830
- redirect_url: _.string
831
- }
832
- }, async (response2) => {
833
- await chat.sendMessage({
834
- type: "text",
835
- author: "bot",
836
- text: "Almost there! Please complete your submission here:"
837
- });
838
- const href = new URL(response2.ats_data.redirect_url);
839
- if (anonymous_id && !href.searchParams.has("anonymous_id")) {
840
- href.searchParams.set("anonymous_id", anonymous_id);
795
+ const submit = async (skipConfirmation) => {
796
+ if (skipConfirmation !== true) {
797
+ await chat.userInput({
798
+ type: "submit",
799
+ key: void 0,
800
+ config: {
801
+ label: node.data.submitLabel
802
+ }
803
+ });
841
804
  }
842
- await chat.sendMessage({
843
- type: "link",
844
- href: href.toString(),
845
- text: "Complete submission"
846
- });
847
- next(node.nextId);
848
- }).with({
849
- success: true
850
- }, async () => {
851
805
  await chat.sendMessage({
852
806
  type: "system",
853
- variant: "success",
854
- text: "Submission completed!"
807
+ variant: "info",
808
+ text: "Submitting…"
855
809
  });
856
- next(node.nextId);
857
- }).otherwise(async (response2) => {
858
- logger.error(response2);
859
- await chat.sendMessage({
860
- type: "system",
861
- variant: "error",
862
- text: "Failed to submit"
810
+ const {
811
+ anonymous_id,
812
+ session_id
813
+ } = analytics.getSessionInfo();
814
+ const response = await apiClient.fetch(`/flow/submit`, {
815
+ method: "POST",
816
+ body: JSON.stringify({
817
+ ...context,
818
+ integration_id: node.data.integrationId,
819
+ anonymous_id,
820
+ session_id,
821
+ submissions: getFlowSubmissionsPayload(submissions || {})
822
+ })
823
+ }).catch((e) => e);
824
+ if (node.data.key)
825
+ chat.addToSubmissions(node.data.key, {
826
+ type: "integration",
827
+ value: response
828
+ });
829
+ await N(response).with({
830
+ ats_data: {
831
+ redirect_url: _.string
832
+ }
833
+ }, async (response2) => {
834
+ await chat.sendMessage({
835
+ type: "text",
836
+ author: "bot",
837
+ text: "Almost there! Please complete your submission here:"
838
+ });
839
+ const href = new URL(response2.ats_data.redirect_url);
840
+ if (anonymous_id && !href.searchParams.has("anonymous_id")) {
841
+ href.searchParams.set("anonymous_id", anonymous_id);
842
+ }
843
+ await chat.sendMessage({
844
+ type: "link",
845
+ href: href.toString(),
846
+ text: "Complete submission"
847
+ });
848
+ next(node.nextId);
849
+ }).with({
850
+ success: true
851
+ }, async () => {
852
+ await chat.sendMessage({
853
+ type: "system",
854
+ variant: "success",
855
+ text: "Submission completed!"
856
+ });
857
+ next(node.nextId);
858
+ }).with({
859
+ sucess: false,
860
+ ats_data: {
861
+ message: _.string
862
+ }
863
+ }, async (response2) => {
864
+ logger.error(response2.ats_data);
865
+ await chat.sendMessage({
866
+ type: "system",
867
+ variant: "error",
868
+ text: response2.ats_data.message
869
+ });
870
+ await submit(false);
871
+ }).otherwise(async (response2) => {
872
+ logger.error(response2);
873
+ await chat.sendMessage({
874
+ type: "system",
875
+ variant: "error",
876
+ text: "Failed to submit"
877
+ });
878
+ await submit(false);
863
879
  });
864
- next(node.id);
865
- });
880
+ };
881
+ await submit(node.data.skipConfirmation);
866
882
  }
867
883
  async function interpretLinkNode({
868
884
  chat,
@@ -1637,10 +1653,10 @@ const ChatInputAddress = ({
1637
1653
  const debouncedQuery = F(() => debounce$1((query2) => {
1638
1654
  invariant(enabled, "Query state should not be enabled if Google Places isn't available");
1639
1655
  setQuery(query2);
1640
- if (query2 === "") {
1656
+ if (query2 === "")
1641
1657
  setSuggestions([]);
1658
+ if (query2.length < 3)
1642
1659
  return;
1643
- }
1644
1660
  getPredictions(query2).then((predictions) => {
1645
1661
  setSuggestions(predictions);
1646
1662
  });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-65ebb99d.cjs");
3
+ const index = require("./index-89588fad.cjs");
4
4
  require("@inploi/sdk");
5
5
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6
6
  function getDefaultExportFromCjs(x) {
@@ -794,77 +794,93 @@ async function interpretSubmitNode({
794
794
  context,
795
795
  analytics
796
796
  }) {
797
- if (node.data.skipConfirmation !== true) {
798
- await chat.userInput({
799
- type: "submit",
800
- key: void 0,
801
- config: {
802
- label: node.data.submitLabel
803
- }
804
- });
805
- }
806
- await chat.sendMessage({
807
- type: "system",
808
- variant: "info",
809
- text: "Submitting…"
810
- });
811
- const {
812
- anonymous_id,
813
- session_id
814
- } = analytics.getSessionInfo();
815
- const response = await apiClient.fetch(`/flow/apply`, {
816
- method: "POST",
817
- body: JSON.stringify({
818
- ...context,
819
- integration_id: node.data.integrationId,
820
- anonymous_id,
821
- session_id,
822
- submissions: index.getFlowSubmissionsPayload(submissions || {})
823
- })
824
- }).catch((e) => e);
825
- if (node.data.key)
826
- chat.addToSubmissions(node.data.key, {
827
- type: "integration",
828
- value: response
829
- });
830
- await index.N(response).with({
831
- ats_data: {
832
- redirect_url: index._.string
833
- }
834
- }, async (response2) => {
835
- await chat.sendMessage({
836
- type: "text",
837
- author: "bot",
838
- text: "Almost there! Please complete your submission here:"
839
- });
840
- const href = new URL(response2.ats_data.redirect_url);
841
- if (anonymous_id && !href.searchParams.has("anonymous_id")) {
842
- href.searchParams.set("anonymous_id", anonymous_id);
797
+ const submit = async (skipConfirmation) => {
798
+ if (skipConfirmation !== true) {
799
+ await chat.userInput({
800
+ type: "submit",
801
+ key: void 0,
802
+ config: {
803
+ label: node.data.submitLabel
804
+ }
805
+ });
843
806
  }
844
- await chat.sendMessage({
845
- type: "link",
846
- href: href.toString(),
847
- text: "Complete submission"
848
- });
849
- next(node.nextId);
850
- }).with({
851
- success: true
852
- }, async () => {
853
807
  await chat.sendMessage({
854
808
  type: "system",
855
- variant: "success",
856
- text: "Submission completed!"
809
+ variant: "info",
810
+ text: "Submitting…"
857
811
  });
858
- next(node.nextId);
859
- }).otherwise(async (response2) => {
860
- logger.error(response2);
861
- await chat.sendMessage({
862
- type: "system",
863
- variant: "error",
864
- text: "Failed to submit"
812
+ const {
813
+ anonymous_id,
814
+ session_id
815
+ } = analytics.getSessionInfo();
816
+ const response = await apiClient.fetch(`/flow/submit`, {
817
+ method: "POST",
818
+ body: JSON.stringify({
819
+ ...context,
820
+ integration_id: node.data.integrationId,
821
+ anonymous_id,
822
+ session_id,
823
+ submissions: index.getFlowSubmissionsPayload(submissions || {})
824
+ })
825
+ }).catch((e) => e);
826
+ if (node.data.key)
827
+ chat.addToSubmissions(node.data.key, {
828
+ type: "integration",
829
+ value: response
830
+ });
831
+ await index.N(response).with({
832
+ ats_data: {
833
+ redirect_url: index._.string
834
+ }
835
+ }, async (response2) => {
836
+ await chat.sendMessage({
837
+ type: "text",
838
+ author: "bot",
839
+ text: "Almost there! Please complete your submission here:"
840
+ });
841
+ const href = new URL(response2.ats_data.redirect_url);
842
+ if (anonymous_id && !href.searchParams.has("anonymous_id")) {
843
+ href.searchParams.set("anonymous_id", anonymous_id);
844
+ }
845
+ await chat.sendMessage({
846
+ type: "link",
847
+ href: href.toString(),
848
+ text: "Complete submission"
849
+ });
850
+ next(node.nextId);
851
+ }).with({
852
+ success: true
853
+ }, async () => {
854
+ await chat.sendMessage({
855
+ type: "system",
856
+ variant: "success",
857
+ text: "Submission completed!"
858
+ });
859
+ next(node.nextId);
860
+ }).with({
861
+ sucess: false,
862
+ ats_data: {
863
+ message: index._.string
864
+ }
865
+ }, async (response2) => {
866
+ logger.error(response2.ats_data);
867
+ await chat.sendMessage({
868
+ type: "system",
869
+ variant: "error",
870
+ text: response2.ats_data.message
871
+ });
872
+ await submit(false);
873
+ }).otherwise(async (response2) => {
874
+ logger.error(response2);
875
+ await chat.sendMessage({
876
+ type: "system",
877
+ variant: "error",
878
+ text: "Failed to submit"
879
+ });
880
+ await submit(false);
865
881
  });
866
- next(node.id);
867
- });
882
+ };
883
+ await submit(node.data.skipConfirmation);
868
884
  }
869
885
  async function interpretLinkNode({
870
886
  chat,
@@ -1639,10 +1655,10 @@ const ChatInputAddress = ({
1639
1655
  const debouncedQuery = index.F(() => index.debounce((query2) => {
1640
1656
  index.invariant(enabled, "Query state should not be enabled if Google Places isn't available");
1641
1657
  setQuery(query2);
1642
- if (query2 === "") {
1658
+ if (query2 === "")
1643
1659
  setSuggestions([]);
1660
+ if (query2.length < 3)
1644
1661
  return;
1645
- }
1646
1662
  getPredictions(query2).then((predictions) => {
1647
1663
  setSuggestions(predictions);
1648
1664
  });
@@ -47,7 +47,6 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
47
47
  nextId?: string | undefined;
48
48
  } | {
49
49
  data: {
50
- ats: "cornerstone";
51
50
  integrationId: string;
52
51
  };
53
52
  type: "integration-workflow-get";
@@ -209,7 +208,6 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
209
208
  nextId?: string | undefined;
210
209
  } | {
211
210
  data: {
212
- ats: "cornerstone";
213
211
  integrationId: string;
214
212
  };
215
213
  type: "integration-workflow-get";
@@ -376,7 +374,6 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
376
374
  nextId?: string | undefined;
377
375
  } | {
378
376
  data: {
379
- ats: "cornerstone";
380
377
  integrationId: string;
381
378
  };
382
379
  type: "integration-workflow-get";
@@ -545,7 +542,6 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
545
542
  nextId?: string | undefined;
546
543
  } | {
547
544
  data: {
548
- ats: "cornerstone";
549
545
  integrationId: string;
550
546
  };
551
547
  type: "integration-workflow-get";
@@ -707,7 +703,6 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
707
703
  nextId?: string | undefined;
708
704
  } | {
709
705
  data: {
710
- ats: "cornerstone";
711
706
  integrationId: string;
712
707
  };
713
708
  type: "integration-workflow-get";
@@ -874,7 +869,6 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
874
869
  nextId?: string | undefined;
875
870
  } | {
876
871
  data: {
877
- ats: "cornerstone";
878
872
  integrationId: string;
879
873
  };
880
874
  type: "integration-workflow-get";
@@ -1043,7 +1037,6 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
1043
1037
  nextId?: string | undefined;
1044
1038
  } | {
1045
1039
  data: {
1046
- ats: "cornerstone";
1047
1040
  integrationId: string;
1048
1041
  };
1049
1042
  type: "integration-workflow-get";
@@ -1218,7 +1211,6 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1218
1211
  nextId?: string | undefined;
1219
1212
  } | {
1220
1213
  data: {
1221
- ats: "cornerstone";
1222
1214
  integrationId: string;
1223
1215
  };
1224
1216
  type: "integration-workflow-get";
@@ -1380,7 +1372,6 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1380
1372
  nextId?: string | undefined;
1381
1373
  } | {
1382
1374
  data: {
1383
- ats: "cornerstone";
1384
1375
  integrationId: string;
1385
1376
  };
1386
1377
  type: "integration-workflow-get";
@@ -1547,7 +1538,6 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1547
1538
  nextId?: string | undefined;
1548
1539
  } | {
1549
1540
  data: {
1550
- ats: "cornerstone";
1551
1541
  integrationId: string;
1552
1542
  };
1553
1543
  type: "integration-workflow-get";
@@ -1723,7 +1713,6 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1723
1713
  nextId?: string | undefined;
1724
1714
  } | {
1725
1715
  data: {
1726
- ats: "cornerstone";
1727
1716
  integrationId: string;
1728
1717
  };
1729
1718
  type: "integration-workflow-get";
@@ -1900,7 +1889,6 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
1900
1889
  nextId?: string | undefined;
1901
1890
  } | {
1902
1891
  data: {
1903
- ats: "cornerstone";
1904
1892
  integrationId: string;
1905
1893
  };
1906
1894
  type: "integration-workflow-get";
@@ -2062,7 +2050,6 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2062
2050
  nextId?: string | undefined;
2063
2051
  } | {
2064
2052
  data: {
2065
- ats: "cornerstone";
2066
2053
  integrationId: string;
2067
2054
  };
2068
2055
  type: "integration-workflow-get";
@@ -2229,7 +2216,6 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2229
2216
  nextId?: string | undefined;
2230
2217
  } | {
2231
2218
  data: {
2232
- ats: "cornerstone";
2233
2219
  integrationId: string;
2234
2220
  };
2235
2221
  type: "integration-workflow-get";
@@ -2403,7 +2389,6 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2403
2389
  nextId?: string | undefined;
2404
2390
  } | {
2405
2391
  data: {
2406
- ats: "cornerstone";
2407
2392
  integrationId: string;
2408
2393
  };
2409
2394
  type: "integration-workflow-get";
@@ -32,7 +32,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
32
32
  nextId?: string | undefined;
33
33
  } | {
34
34
  data: {
35
- ats: "cornerstone";
36
35
  integrationId: string;
37
36
  };
38
37
  type: "integration-workflow-get";
@@ -4758,7 +4758,7 @@ const StatusBar = ({
4758
4758
  })
4759
4759
  });
4760
4760
  };
4761
- const ChatbotBody = M(() => import("./chatbot-body-7f24fa2b.js").then((module) => module.ChatbotBody));
4761
+ const ChatbotBody = M(() => import("./chatbot-body-67894fdd.js").then((module) => module.ChatbotBody));
4762
4762
  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", {
4763
4763
  variants: {
4764
4764
  view: {
@@ -4759,7 +4759,7 @@ const StatusBar = ({
4759
4759
  })
4760
4760
  });
4761
4761
  };
4762
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-ca0c18fa.cjs")).then((module2) => module2.ChatbotBody));
4762
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-c8efca55.cjs")).then((module2) => module2.ChatbotBody));
4763
4763
  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", {
4764
4764
  variants: {
4765
4765
  view: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-65ebb99d.cjs");
3
+ const index = require("./index-89588fad.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { M } from "./index-bc9ac6fc.js";
1
+ import { M } from "./index-18edb2f5.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  M as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.17.1",
3
+ "version": "3.18.1",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,9 +66,9 @@
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.14.0",
69
+ "@inploi/core": "1.14.1",
70
70
  "@inploi/design-tokens": "0.2.1",
71
- "@inploi/sdk": "1.13.2",
71
+ "@inploi/sdk": "1.13.3",
72
72
  "eslint-config-custom": "0.1.0",
73
73
  "tsconfig": "0.1.0"
74
74
  },