@inploi/plugin-chatbot 3.27.2 → 3.27.3

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-6f2fa710.cjs");
3
+ const index = require("./index-28ae80a1.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isIfBlockConditionMet = (ifBlock, {
6
6
  context,
@@ -485,12 +485,16 @@ async function interpretSubmitNode({
485
485
  });
486
486
  await index.N(response).with(index._.union({
487
487
  ats_data: index._.select("redirect", {
488
- redirect_url: index._.string
488
+ redirect_url: index._.string,
489
+ message: index._.optional(index._.string),
490
+ button_text: index._.optional(index._.string)
489
491
  })
490
492
  }, {
491
493
  integration_response: {
492
494
  data: index._.select("redirect", {
493
- redirect_url: index._.string
495
+ redirect_url: index._.string,
496
+ message: index._.optional(index._.string),
497
+ button_text: index._.optional(index._.string)
494
498
  })
495
499
  }
496
500
  }), async (response2) => {
@@ -499,7 +503,7 @@ async function interpretSubmitNode({
499
503
  await chat.sendMessage({
500
504
  type: "text",
501
505
  author: "bot",
502
- text: "Almost there! Please complete your submission here:"
506
+ text: response2.redirect.message ?? "Almost there! Please complete your submission here:"
503
507
  });
504
508
  const href = new URL(response2.redirect.redirect_url);
505
509
  if (anonymous_id && !href.searchParams.has("anonymous_id")) {
@@ -508,7 +512,7 @@ async function interpretSubmitNode({
508
512
  await chat.sendMessage({
509
513
  type: "link",
510
514
  href: href.toString(),
511
- text: "Complete submission",
515
+ text: response2.redirect.button_text ?? "Complete submission",
512
516
  onClick: () => {
513
517
  if (!session_id) {
514
518
  logger.error("session_id not set, cannot log FLOW_REDIRECT event");
@@ -531,11 +535,13 @@ async function interpretSubmitNode({
531
535
  }).with({
532
536
  success: true
533
537
  }, async () => {
534
- await chat.sendMessage({
535
- type: "system",
536
- variant: "success",
537
- text: "Submission completed!"
538
- });
538
+ if (node.data.skipConfirmation !== true) {
539
+ await chat.sendMessage({
540
+ type: "system",
541
+ variant: "success",
542
+ text: "Submission completed!"
543
+ });
544
+ }
539
545
  next(node.nextId);
540
546
  }).with(index._.union({
541
547
  success: false,
@@ -4531,10 +4537,11 @@ const Conversation = ({
4531
4537
  }, (message2) => {
4532
4538
  const isLastSentMessage = message2.author === "user" && !messages.slice(i2 + 1).some((m) => m.type === "text" && m.author === "user");
4533
4539
  const isLastMessage = i2 === messages.length - 1;
4540
+ const body = message2.author === "bot" ? parseMarkdownToJSX(message2.text) : message2.text;
4534
4541
  return index.o(ChatBubble, {
4535
4542
  animate: isLastMessage,
4536
4543
  side: authorToSide[message2.author],
4537
- children: [parseMarkdownToJSX(message2.text), isLastSentMessage ? lastSentMessageFooter : null]
4544
+ children: [body, isLastSentMessage ? lastSentMessageFooter : null]
4538
4545
  }, i2);
4539
4546
  }).with({
4540
4547
  type: "link"
@@ -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, 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 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-b484737a.js";
1
+ import { g as get$1, i as isString$2, 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 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-04ef56bd.js";
2
2
  import "@inploi/sdk";
3
3
  const isIfBlockConditionMet = (ifBlock, {
4
4
  context,
@@ -483,12 +483,16 @@ async function interpretSubmitNode({
483
483
  });
484
484
  await N(response).with(_.union({
485
485
  ats_data: _.select("redirect", {
486
- redirect_url: _.string
486
+ redirect_url: _.string,
487
+ message: _.optional(_.string),
488
+ button_text: _.optional(_.string)
487
489
  })
488
490
  }, {
489
491
  integration_response: {
490
492
  data: _.select("redirect", {
491
- redirect_url: _.string
493
+ redirect_url: _.string,
494
+ message: _.optional(_.string),
495
+ button_text: _.optional(_.string)
492
496
  })
493
497
  }
494
498
  }), async (response2) => {
@@ -497,7 +501,7 @@ async function interpretSubmitNode({
497
501
  await chat.sendMessage({
498
502
  type: "text",
499
503
  author: "bot",
500
- text: "Almost there! Please complete your submission here:"
504
+ text: response2.redirect.message ?? "Almost there! Please complete your submission here:"
501
505
  });
502
506
  const href = new URL(response2.redirect.redirect_url);
503
507
  if (anonymous_id && !href.searchParams.has("anonymous_id")) {
@@ -506,7 +510,7 @@ async function interpretSubmitNode({
506
510
  await chat.sendMessage({
507
511
  type: "link",
508
512
  href: href.toString(),
509
- text: "Complete submission",
513
+ text: response2.redirect.button_text ?? "Complete submission",
510
514
  onClick: () => {
511
515
  if (!session_id) {
512
516
  logger.error("session_id not set, cannot log FLOW_REDIRECT event");
@@ -529,11 +533,13 @@ async function interpretSubmitNode({
529
533
  }).with({
530
534
  success: true
531
535
  }, async () => {
532
- await chat.sendMessage({
533
- type: "system",
534
- variant: "success",
535
- text: "Submission completed!"
536
- });
536
+ if (node.data.skipConfirmation !== true) {
537
+ await chat.sendMessage({
538
+ type: "system",
539
+ variant: "success",
540
+ text: "Submission completed!"
541
+ });
542
+ }
537
543
  next(node.nextId);
538
544
  }).with(_.union({
539
545
  success: false,
@@ -4529,10 +4535,11 @@ const Conversation = ({
4529
4535
  }, (message2) => {
4530
4536
  const isLastSentMessage = message2.author === "user" && !messages.slice(i2 + 1).some((m) => m.type === "text" && m.author === "user");
4531
4537
  const isLastMessage = i2 === messages.length - 1;
4538
+ const body = message2.author === "bot" ? parseMarkdownToJSX(message2.text) : message2.text;
4532
4539
  return o$1(ChatBubble, {
4533
4540
  animate: isLastMessage,
4534
4541
  side: authorToSide[message2.author],
4535
- children: [parseMarkdownToJSX(message2.text), isLastSentMessage ? lastSentMessageFooter : null]
4542
+ children: [body, isLastSentMessage ? lastSentMessageFooter : null]
4536
4543
  }, i2);
4537
4544
  }).with({
4538
4545
  type: "link"
package/dist/chatbot.d.ts CHANGED
@@ -49,7 +49,10 @@ export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, }: {
49
49
  /** Fetches a flow by job ID.
50
50
  * @param jobId - The job ID to fetch the flow for. This is the job ID according to the **ATS**, and not the inploi job ID.
51
51
  */
52
- fetchFlowByJobId: (jobId: string, additionalProperties?: Partial<OpenChatbotParams>) => Promise<OpenChatbotParams>;
52
+ fetchFlowByJobId: (jobId: string, additionalProperties?: Partial<OpenChatbotParams & {
53
+ /** What type of id to use. Defaults to `ats` */
54
+ idType: 'inploi' | 'ats';
55
+ }>) => Promise<OpenChatbotParams>;
53
56
  fetchFlowById: (flowId: string, additionalProperties?: Partial<OpenChatbotParams>) => Promise<OpenChatbotParams>;
54
57
  open: (params: OpenChatbotParams | Promise<OpenChatbotParams>) => Promise<void>;
55
58
  close: () => Promise<void>;
@@ -5320,7 +5320,7 @@ const StatusBar = ({
5320
5320
  };
5321
5321
  function noop() {
5322
5322
  }
5323
- const ChatbotBody = M(() => import("./chatbot-body-e725014c.js").then((module) => module.ChatbotBody));
5323
+ const ChatbotBody = M(() => import("./chatbot-body-c01665e7.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: {
@@ -5741,19 +5741,24 @@ const chatbotPlugin = ({
5741
5741
  /** Fetches a flow by job ID.
5742
5742
  * @param jobId - The job ID to fetch the flow for. This is the job ID according to the **ATS**, and not the inploi job ID.
5743
5743
  */
5744
- fetchFlowByJobId: async (jobId, additionalProperties) => apiClient.fetch(`/flow/job/${jobId}`).then((res) => {
5745
- const data = parse$1(FlowByJobPayloadSchema, res);
5746
- return {
5747
- flow: data.flow,
5748
- title: `Applying for “${data.job.title}”`,
5749
- flowKeys: [data.job.id, ...(additionalProperties == null ? void 0 : additionalProperties.flowKeys) ?? []],
5750
- job: {
5751
- id: data.job.id,
5752
- id_type: "external"
5753
- },
5754
- ...additionalProperties
5755
- };
5756
- }),
5744
+ fetchFlowByJobId: async (jobId, additionalProperties) => {
5745
+ const searchParams = new URLSearchParams({
5746
+ id_type: (additionalProperties == null ? void 0 : additionalProperties.idType) === "inploi" ? "internal" : "external"
5747
+ });
5748
+ return apiClient.fetch([`/flow/job/${jobId}`, searchParams.toString()].filter(Boolean).join("?")).then((res) => {
5749
+ const data = parse$1(FlowByJobPayloadSchema, res);
5750
+ return {
5751
+ flow: data.flow,
5752
+ title: `Applying for “${data.job.title}”`,
5753
+ flowKeys: [data.job.id, ...(additionalProperties == null ? void 0 : additionalProperties.flowKeys) ?? []],
5754
+ job: {
5755
+ id: data.job.id,
5756
+ id_type: "external"
5757
+ },
5758
+ ...additionalProperties
5759
+ };
5760
+ });
5761
+ },
5757
5762
  fetchFlowById: async (flowId, additionalProperties) => apiClient.fetch(`/flow/id/${flowId}`).then((res) => {
5758
5763
  var _a;
5759
5764
  const data = parse$1(FlowByIdPayloadSchema, res);
@@ -5321,7 +5321,7 @@ const StatusBar = ({
5321
5321
  };
5322
5322
  function noop() {
5323
5323
  }
5324
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-b8a93536.cjs")).then((module2) => module2.ChatbotBody));
5324
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-830f64e7.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: {
@@ -5742,19 +5742,24 @@ const chatbotPlugin = ({
5742
5742
  /** Fetches a flow by job ID.
5743
5743
  * @param jobId - The job ID to fetch the flow for. This is the job ID according to the **ATS**, and not the inploi job ID.
5744
5744
  */
5745
- fetchFlowByJobId: async (jobId, additionalProperties) => apiClient.fetch(`/flow/job/${jobId}`).then((res) => {
5746
- const data = parse$1(FlowByJobPayloadSchema, res);
5747
- return {
5748
- flow: data.flow,
5749
- title: `Applying for “${data.job.title}”`,
5750
- flowKeys: [data.job.id, ...(additionalProperties == null ? void 0 : additionalProperties.flowKeys) ?? []],
5751
- job: {
5752
- id: data.job.id,
5753
- id_type: "external"
5754
- },
5755
- ...additionalProperties
5756
- };
5757
- }),
5745
+ fetchFlowByJobId: async (jobId, additionalProperties) => {
5746
+ const searchParams = new URLSearchParams({
5747
+ id_type: (additionalProperties == null ? void 0 : additionalProperties.idType) === "inploi" ? "internal" : "external"
5748
+ });
5749
+ return apiClient.fetch([`/flow/job/${jobId}`, searchParams.toString()].filter(Boolean).join("?")).then((res) => {
5750
+ const data = parse$1(FlowByJobPayloadSchema, res);
5751
+ return {
5752
+ flow: data.flow,
5753
+ title: `Applying for “${data.job.title}”`,
5754
+ flowKeys: [data.job.id, ...(additionalProperties == null ? void 0 : additionalProperties.flowKeys) ?? []],
5755
+ job: {
5756
+ id: data.job.id,
5757
+ id_type: "external"
5758
+ },
5759
+ ...additionalProperties
5760
+ };
5761
+ });
5762
+ },
5758
5763
  fetchFlowById: async (flowId, additionalProperties) => apiClient.fetch(`/flow/id/${flowId}`).then((res) => {
5759
5764
  var _a;
5760
5765
  const data = parse$1(FlowByIdPayloadSchema, res);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-6f2fa710.cjs");
3
+ const index = require("./index-28ae80a1.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { R } from "./index-b484737a.js";
1
+ import { R } from "./index-04ef56bd.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.27.2",
3
+ "version": "3.27.3",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",