@inploi/plugin-chatbot 3.12.3 → 3.12.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-1d3d0226.cjs");
3
+ const index = require("./index-395856be.cjs");
4
4
  require("@inploi/sdk");
5
5
  const followNodes = ({
6
6
  node,
@@ -196,17 +196,19 @@ async function interpretSubmitNode({
196
196
  context,
197
197
  analytics
198
198
  }) {
199
- await chat.userInput({
200
- type: "submit",
201
- key: void 0,
202
- config: {
203
- label: "Submit my application"
204
- }
205
- });
199
+ if (node.data.skipConfirmation !== true) {
200
+ await chat.userInput({
201
+ type: "submit",
202
+ key: void 0,
203
+ config: {
204
+ label: node.data.submitLabel
205
+ }
206
+ });
207
+ }
206
208
  await chat.sendMessage({
207
209
  type: "system",
208
210
  variant: "info",
209
- text: "Submitting your application…"
211
+ text: "Submitting…"
210
212
  });
211
213
  const {
212
214
  anonymous_id,
@@ -230,7 +232,7 @@ async function interpretSubmitNode({
230
232
  await chat.sendMessage({
231
233
  type: "text",
232
234
  author: "bot",
233
- text: "Almost there! Please finalise your application on our partner’s website."
235
+ text: "Almost there! Please complete your submission here:"
234
236
  });
235
237
  const href = new URL(response2.ats_data.redirect_url);
236
238
  if (anonymous_id && !href.searchParams.has("anonymous_id")) {
@@ -239,7 +241,7 @@ async function interpretSubmitNode({
239
241
  await chat.sendMessage({
240
242
  type: "link",
241
243
  href: href.toString(),
242
- text: "Finalise application on partner"
244
+ text: "Complete submission"
243
245
  });
244
246
  next(node.nextId);
245
247
  }).with({
@@ -248,7 +250,7 @@ async function interpretSubmitNode({
248
250
  await chat.sendMessage({
249
251
  type: "system",
250
252
  variant: "success",
251
- text: "Application submitted"
253
+ text: "Submission completed!"
252
254
  });
253
255
  next(node.nextId);
254
256
  }).otherwise(async (response2) => {
@@ -256,7 +258,7 @@ async function interpretSubmitNode({
256
258
  await chat.sendMessage({
257
259
  type: "system",
258
260
  variant: "error",
259
- text: "Failed to submit application"
261
+ text: "Failed to submit"
260
262
  });
261
263
  next(node.id);
262
264
  });
@@ -326,7 +328,8 @@ async function interpretQuestionTextNode({
326
328
  config: {
327
329
  optional: node.data.optional,
328
330
  placeholder: node.data.placeholder,
329
- format: node.data.format
331
+ format: node.data.format,
332
+ maxChars: node.data.maxChars
330
333
  }
331
334
  });
332
335
  if (reply.value === null) {
@@ -2856,14 +2859,17 @@ const inputFormatToProps = {
2856
2859
  }
2857
2860
  };
2858
2861
  const isTextSubmission = index.isSubmissionOfType("text");
2859
- const getResolver = (config) => i(index.object({
2860
- text: {
2861
- email: index.string(errors.email, [index.email(errors.email)]),
2862
- phone: index.transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, "")),
2863
- text: index.string([index.minLength(1, errors.empty)]),
2864
- url: index.string([index.url(errors.url)])
2865
- }[config.format]
2866
- }));
2862
+ const getResolver = (config) => {
2863
+ const maxLengthError = `Please enter no more than ${config.maxChars} characters`;
2864
+ return i(index.object({
2865
+ text: {
2866
+ email: index.string(errors.email, [index.email(errors.email), index.maxLength(config.maxChars ?? Infinity, maxLengthError)]),
2867
+ phone: index.transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, ""), [index.maxLength(config.maxChars ?? Infinity, maxLengthError)]),
2868
+ text: index.string([index.minLength(1, errors.empty), index.maxLength(config.maxChars ?? Infinity, maxLengthError)]),
2869
+ url: index.string([index.url(errors.url), index.maxLength(config.maxChars ?? Infinity, maxLengthError)])
2870
+ }[config.format]
2871
+ }));
2872
+ };
2867
2873
  const ChatInputText = ({
2868
2874
  input,
2869
2875
  onSubmitSuccess,
@@ -1,4 +1,4 @@
1
- import { _, g as getHeadOrThrow, i as invariant, A as AbortedError, N, a as getFlowSubmissionsPayload, h as hasProp, k as kbToReadableSize, o as o$1, c as clsx, b as a$2, d as _$1, y, F, s as store, p, e as parse, f as picklist, j as h, l as k, m as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, u as minLength, v as record, w as boolean, x as string, z as email, B as url, D as regex, T, E as m, G as AnimatePresence, H as ERROR_MESSAGES } from "./index-c15669f1.js";
1
+ import { _, g as getHeadOrThrow, i as invariant, A as AbortedError, N, a as getFlowSubmissionsPayload, h as hasProp, k as kbToReadableSize, o as o$1, c as clsx, b as a$2, d as _$1, y, F, s as store, p, e as parse, f as picklist, j as h, l as k, m as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, u as minLength, v as record, w as boolean, x as string, z as email, B as url, D as regex, T, E as m, G as AnimatePresence, H as ERROR_MESSAGES } from "./index-b4781911.js";
2
2
  import "@inploi/sdk";
3
3
  const followNodes = ({
4
4
  node,
@@ -194,17 +194,19 @@ async function interpretSubmitNode({
194
194
  context,
195
195
  analytics
196
196
  }) {
197
- await chat.userInput({
198
- type: "submit",
199
- key: void 0,
200
- config: {
201
- label: "Submit my application"
202
- }
203
- });
197
+ if (node.data.skipConfirmation !== true) {
198
+ await chat.userInput({
199
+ type: "submit",
200
+ key: void 0,
201
+ config: {
202
+ label: node.data.submitLabel
203
+ }
204
+ });
205
+ }
204
206
  await chat.sendMessage({
205
207
  type: "system",
206
208
  variant: "info",
207
- text: "Submitting your application…"
209
+ text: "Submitting…"
208
210
  });
209
211
  const {
210
212
  anonymous_id,
@@ -228,7 +230,7 @@ async function interpretSubmitNode({
228
230
  await chat.sendMessage({
229
231
  type: "text",
230
232
  author: "bot",
231
- text: "Almost there! Please finalise your application on our partner’s website."
233
+ text: "Almost there! Please complete your submission here:"
232
234
  });
233
235
  const href = new URL(response2.ats_data.redirect_url);
234
236
  if (anonymous_id && !href.searchParams.has("anonymous_id")) {
@@ -237,7 +239,7 @@ async function interpretSubmitNode({
237
239
  await chat.sendMessage({
238
240
  type: "link",
239
241
  href: href.toString(),
240
- text: "Finalise application on partner"
242
+ text: "Complete submission"
241
243
  });
242
244
  next(node.nextId);
243
245
  }).with({
@@ -246,7 +248,7 @@ async function interpretSubmitNode({
246
248
  await chat.sendMessage({
247
249
  type: "system",
248
250
  variant: "success",
249
- text: "Application submitted"
251
+ text: "Submission completed!"
250
252
  });
251
253
  next(node.nextId);
252
254
  }).otherwise(async (response2) => {
@@ -254,7 +256,7 @@ async function interpretSubmitNode({
254
256
  await chat.sendMessage({
255
257
  type: "system",
256
258
  variant: "error",
257
- text: "Failed to submit application"
259
+ text: "Failed to submit"
258
260
  });
259
261
  next(node.id);
260
262
  });
@@ -324,7 +326,8 @@ async function interpretQuestionTextNode({
324
326
  config: {
325
327
  optional: node.data.optional,
326
328
  placeholder: node.data.placeholder,
327
- format: node.data.format
329
+ format: node.data.format,
330
+ maxChars: node.data.maxChars
328
331
  }
329
332
  });
330
333
  if (reply.value === null) {
@@ -2854,14 +2857,17 @@ const inputFormatToProps = {
2854
2857
  }
2855
2858
  };
2856
2859
  const isTextSubmission = isSubmissionOfType("text");
2857
- const getResolver = (config) => i(object({
2858
- text: {
2859
- email: string(errors.email, [email(errors.email)]),
2860
- phone: transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, "")),
2861
- text: string([minLength(1, errors.empty)]),
2862
- url: string([url(errors.url)])
2863
- }[config.format]
2864
- }));
2860
+ const getResolver = (config) => {
2861
+ const maxLengthError = `Please enter no more than ${config.maxChars} characters`;
2862
+ return i(object({
2863
+ text: {
2864
+ email: string(errors.email, [email(errors.email), maxLength(config.maxChars ?? Infinity, maxLengthError)]),
2865
+ phone: transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, ""), [maxLength(config.maxChars ?? Infinity, maxLengthError)]),
2866
+ text: string([minLength(1, errors.empty), maxLength(config.maxChars ?? Infinity, maxLengthError)]),
2867
+ url: string([url(errors.url), maxLength(config.maxChars ?? Infinity, maxLengthError)])
2868
+ }[config.format]
2869
+ }));
2870
+ };
2865
2871
  const ChatInputText = ({
2866
2872
  input,
2867
2873
  onSubmitSuccess,
@@ -35,6 +35,8 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
35
35
  id: string;
36
36
  data: {
37
37
  integrationId: string;
38
+ skipConfirmation: boolean;
39
+ submitLabel: string;
38
40
  };
39
41
  type: "integration-application-submit";
40
42
  isHead?: boolean | undefined;
@@ -192,6 +194,8 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
192
194
  id: string;
193
195
  data: {
194
196
  integrationId: string;
197
+ skipConfirmation: boolean;
198
+ submitLabel: string;
195
199
  };
196
200
  type: "integration-application-submit";
197
201
  isHead?: boolean | undefined;
@@ -353,6 +357,8 @@ export declare const FlowSchema: import("valibot").ObjectSchema<{
353
357
  id: string;
354
358
  data: {
355
359
  integrationId: string;
360
+ skipConfirmation: boolean;
361
+ submitLabel: string;
356
362
  };
357
363
  type: "integration-application-submit";
358
364
  isHead?: boolean | undefined;
@@ -516,6 +522,8 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
516
522
  id: string;
517
523
  data: {
518
524
  integrationId: string;
525
+ skipConfirmation: boolean;
526
+ submitLabel: string;
519
527
  };
520
528
  type: "integration-application-submit";
521
529
  isHead?: boolean | undefined;
@@ -673,6 +681,8 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
673
681
  id: string;
674
682
  data: {
675
683
  integrationId: string;
684
+ skipConfirmation: boolean;
685
+ submitLabel: string;
676
686
  };
677
687
  type: "integration-application-submit";
678
688
  isHead?: boolean | undefined;
@@ -834,6 +844,8 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
834
844
  id: string;
835
845
  data: {
836
846
  integrationId: string;
847
+ skipConfirmation: boolean;
848
+ submitLabel: string;
837
849
  };
838
850
  type: "integration-application-submit";
839
851
  isHead?: boolean | undefined;
@@ -997,6 +1009,8 @@ export declare const FlowByIdPayloadSchema: import("valibot").ObjectSchema<{
997
1009
  id: string;
998
1010
  data: {
999
1011
  integrationId: string;
1012
+ skipConfirmation: boolean;
1013
+ submitLabel: string;
1000
1014
  };
1001
1015
  type: "integration-application-submit";
1002
1016
  isHead?: boolean | undefined;
@@ -1166,6 +1180,8 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1166
1180
  id: string;
1167
1181
  data: {
1168
1182
  integrationId: string;
1183
+ skipConfirmation: boolean;
1184
+ submitLabel: string;
1169
1185
  };
1170
1186
  type: "integration-application-submit";
1171
1187
  isHead?: boolean | undefined;
@@ -1323,6 +1339,8 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1323
1339
  id: string;
1324
1340
  data: {
1325
1341
  integrationId: string;
1342
+ skipConfirmation: boolean;
1343
+ submitLabel: string;
1326
1344
  };
1327
1345
  type: "integration-application-submit";
1328
1346
  isHead?: boolean | undefined;
@@ -1484,6 +1502,8 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1484
1502
  id: string;
1485
1503
  data: {
1486
1504
  integrationId: string;
1505
+ skipConfirmation: boolean;
1506
+ submitLabel: string;
1487
1507
  };
1488
1508
  type: "integration-application-submit";
1489
1509
  isHead?: boolean | undefined;
@@ -1654,6 +1674,8 @@ export declare const FlowByJobPayloadSchema: import("valibot").ObjectSchema<{
1654
1674
  id: string;
1655
1675
  data: {
1656
1676
  integrationId: string;
1677
+ skipConfirmation: boolean;
1678
+ submitLabel: string;
1657
1679
  };
1658
1680
  type: "integration-application-submit";
1659
1681
  isHead?: boolean | undefined;
@@ -1825,6 +1847,8 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
1825
1847
  id: string;
1826
1848
  data: {
1827
1849
  integrationId: string;
1850
+ skipConfirmation: boolean;
1851
+ submitLabel: string;
1828
1852
  };
1829
1853
  type: "integration-application-submit";
1830
1854
  isHead?: boolean | undefined;
@@ -1982,6 +2006,8 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
1982
2006
  id: string;
1983
2007
  data: {
1984
2008
  integrationId: string;
2009
+ skipConfirmation: boolean;
2010
+ submitLabel: string;
1985
2011
  };
1986
2012
  type: "integration-application-submit";
1987
2013
  isHead?: boolean | undefined;
@@ -2143,6 +2169,8 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2143
2169
  id: string;
2144
2170
  data: {
2145
2171
  integrationId: string;
2172
+ skipConfirmation: boolean;
2173
+ submitLabel: string;
2146
2174
  };
2147
2175
  type: "integration-application-submit";
2148
2176
  isHead?: boolean | undefined;
@@ -2311,6 +2339,8 @@ export declare const StartFlowSchema: import("valibot").ObjectSchema<{
2311
2339
  id: string;
2312
2340
  data: {
2313
2341
  integrationId: string;
2342
+ skipConfirmation: boolean;
2343
+ submitLabel: string;
2314
2344
  };
2315
2345
  type: "integration-application-submit";
2316
2346
  isHead?: boolean | undefined;
@@ -22,6 +22,8 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
22
22
  id: string;
23
23
  data: {
24
24
  integrationId: string;
25
+ skipConfirmation: boolean;
26
+ submitLabel: string;
25
27
  };
26
28
  type: "integration-application-submit";
27
29
  isHead?: boolean | undefined;
@@ -9100,7 +9100,7 @@ const StatusBar = ({
9100
9100
  })
9101
9101
  });
9102
9102
  };
9103
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-0265ed24.cjs")).then((module2) => module2.ChatbotBody));
9103
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-1c87450e.cjs")).then((module2) => module2.ChatbotBody));
9104
9104
  const MotionProvider = ({
9105
9105
  children
9106
9106
  }) => {
@@ -9099,7 +9099,7 @@ const StatusBar = ({
9099
9099
  })
9100
9100
  });
9101
9101
  };
9102
- const ChatbotBody = M(() => import("./chatbot-body-af246505.js").then((module) => module.ChatbotBody));
9102
+ const ChatbotBody = M(() => import("./chatbot-body-83a30845.js").then((module) => module.ChatbotBody));
9103
9103
  const MotionProvider = ({
9104
9104
  children
9105
9105
  }) => {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-1d3d0226.cjs");
3
+ const index = require("./index-395856be.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { I } from "./index-c15669f1.js";
1
+ import { I } from "./index-b4781911.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  I as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.12.3",
3
+ "version": "3.12.5",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,7 +65,7 @@
65
65
  "vite": "^4.4.5",
66
66
  "vite-plugin-dts": "^3.7.0",
67
67
  "vite-tsconfig-paths": "^4.2.1",
68
- "@inploi/core": "1.11.8",
68
+ "@inploi/core": "1.11.10",
69
69
  "@inploi/design-tokens": "0.2.1",
70
70
  "@inploi/sdk": "1.12.2",
71
71
  "eslint-config-custom": "0.1.0",