@inploi/plugin-chatbot 3.6.5 → 3.8.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 { _, N, i as invariant, o as o$1, c as clsx, a as _$1, p, b as parse, d as picklist, y, k, e as application, h, C as Cn, f as parseAsync, V as ValiError, g as object, t as transform, m as maxLength, j as minLength, r as record, l as boolean, s as string, n as email, u as url, q as regex, T, v as inputHeight, w as m, A as AnimatePresence, F, x as viewState, E as ERROR_MESSAGES } from "./index-b130eeef.js";
1
+ import { _, N, i as invariant, o as o$1, c as clsx, a as _$1, p, b as parse, d as picklist, y, e as application, h, k, C as Cn, f as parseAsync, V as ValiError, g as object, t as transform, m as maxLength, j as minLength, r as record, l as boolean, s as string, n as email, u as url, q as regex, T, v as inputHeight, w as m, A as AnimatePresence, F, x as viewState, E as ERROR_MESSAGES } from "./index-b616116f.js";
2
2
  import "@inploi/sdk";
3
3
  const getHeadOrThrow = (nodes) => {
4
4
  const head = nodes.find((n2) => n2.isHead);
@@ -261,6 +261,7 @@ async function interpretSubmitNode({
261
261
  href: href.toString(),
262
262
  text: "Finalise application on partner"
263
263
  });
264
+ next(node.nextId);
264
265
  }).with({
265
266
  success: true
266
267
  }, async () => {
@@ -341,15 +342,24 @@ async function interpretQuestionTextNode({
341
342
  key: node.data.key,
342
343
  type: "text",
343
344
  config: {
345
+ optional: node.data.optional,
344
346
  placeholder: node.data.placeholder,
345
347
  format: node.data.format
346
348
  }
347
349
  });
348
- await chat.sendMessage({
349
- author: "user",
350
- type: "text",
351
- text: reply.value
352
- });
350
+ if (reply.value === null) {
351
+ await chat.sendMessage({
352
+ type: "system",
353
+ variant: "info",
354
+ text: "Skipped"
355
+ });
356
+ } else {
357
+ await chat.sendMessage({
358
+ author: "user",
359
+ type: "text",
360
+ text: reply.value
361
+ });
362
+ }
353
363
  next(node.nextId);
354
364
  }
355
365
  async function interpretQuestionNumberNode({
@@ -366,15 +376,24 @@ async function interpretQuestionNumberNode({
366
376
  key: node.data.key,
367
377
  type: "text",
368
378
  config: {
379
+ optional: node.data.optional,
369
380
  placeholder: node.data.placeholder,
370
381
  format: "text"
371
382
  }
372
383
  });
373
- await chat.sendMessage({
374
- author: "user",
375
- type: "text",
376
- text: reply.value
377
- });
384
+ if (reply.value === null) {
385
+ await chat.sendMessage({
386
+ type: "system",
387
+ variant: "info",
388
+ text: "Skipped"
389
+ });
390
+ } else {
391
+ await chat.sendMessage({
392
+ author: "user",
393
+ type: "text",
394
+ text: reply.value
395
+ });
396
+ }
378
397
  next(node.nextId);
379
398
  }
380
399
  async function interpretQuestionEnumNode({
@@ -392,11 +411,19 @@ async function interpretQuestionEnumNode({
392
411
  type: "multiple-choice",
393
412
  config: node.data
394
413
  });
395
- await chat.sendMessage({
396
- author: "user",
397
- type: "text",
398
- text: node.data.options.filter((o2) => reply.value.includes(o2.value)).map((o2) => o2.label).join(", ")
399
- });
414
+ if (reply.value.length === 0) {
415
+ await chat.sendMessage({
416
+ type: "system",
417
+ variant: "info",
418
+ text: "Skipped"
419
+ });
420
+ } else {
421
+ await chat.sendMessage({
422
+ author: "user",
423
+ type: "text",
424
+ text: node.data.options.filter((o2) => reply.value.includes(o2.value)).map((o2) => o2.label).join(", ")
425
+ });
426
+ }
400
427
  next(node.nextId);
401
428
  }
402
429
  async function interpretQuestionBooleanNode({
@@ -413,6 +440,7 @@ async function interpretQuestionBooleanNode({
413
440
  key: node.data.key,
414
441
  type: "boolean",
415
442
  config: {
443
+ optional: node.data.optional,
416
444
  labels: {
417
445
  true: node.data.trueLabel,
418
446
  false: node.data.falseLabel
@@ -420,15 +448,22 @@ async function interpretQuestionBooleanNode({
420
448
  }
421
449
  });
422
450
  const reply = input.value;
423
- const labelMap = {
424
- true: node.data.trueLabel,
425
- false: node.data.falseLabel
426
- };
427
- await chat.sendMessage({
428
- author: "user",
429
- type: "text",
430
- text: labelMap[reply]
431
- });
451
+ if (reply === null) {
452
+ await chat.sendMessage({
453
+ type: "system",
454
+ variant: "info",
455
+ text: "Skipped"
456
+ });
457
+ } else {
458
+ await chat.sendMessage({
459
+ author: "user",
460
+ type: "text",
461
+ text: {
462
+ true: node.data.trueLabel,
463
+ false: node.data.falseLabel
464
+ }[reply]
465
+ });
466
+ }
432
467
  next(node.nextId);
433
468
  }
434
469
  async function interpretQuestionAddressNode({
@@ -457,19 +492,28 @@ async function interpretQuestionFileNode({
457
492
  key: node.data.key,
458
493
  type: "file",
459
494
  config: {
495
+ optional: node.data.optional,
460
496
  extensions: node.data.extensions,
461
497
  // default value for fileSizeLimitKib is 10MB
462
498
  fileSizeLimitKib: node.data.maxSizeKb ?? 10 * 1024,
463
499
  allowMultiple: node.data.multiple === true
464
500
  }
465
501
  });
466
- for await (const file of files.value) {
502
+ if (files.value === null) {
467
503
  await chat.sendMessage({
468
- author: "user",
469
- type: "file",
470
- fileName: file.name,
471
- fileSizeKb: file.sizeKb
504
+ type: "system",
505
+ variant: "info",
506
+ text: "Skipped"
472
507
  });
508
+ } else {
509
+ for (const file of files.value) {
510
+ await chat.sendMessage({
511
+ author: "user",
512
+ type: "file",
513
+ fileName: file.name,
514
+ fileSizeKb: file.sizeKb
515
+ });
516
+ }
473
517
  }
474
518
  next(node.nextId);
475
519
  }
@@ -485,7 +529,7 @@ async function interpretEndFlowNode({
485
529
  });
486
530
  end();
487
531
  }
488
- const stringOrStringArray = _.union(_.string, _.array(_.string));
532
+ const possibleContainsValue = _.union(_.string, _.array(_.string), null);
489
533
  const isIfBlockConditionMet = (ifBlock, submissions) => {
490
534
  const answer = submissions == null ? void 0 : submissions[ifBlock.data.compareKey];
491
535
  if (!answer)
@@ -512,20 +556,20 @@ const isIfBlockConditionMet = (ifBlock, submissions) => {
512
556
  }).with({
513
557
  compare: "contains",
514
558
  answer: {
515
- value: stringOrStringArray
559
+ value: possibleContainsValue
516
560
  }
517
561
  }, ({
518
562
  compareValue,
519
563
  answer: answer2
520
- }) => answer2.value.includes(compareValue)).with({
564
+ }) => answer2.value !== null && answer2.value.includes(compareValue)).with({
521
565
  compare: "notContains",
522
566
  answer: {
523
- value: stringOrStringArray
567
+ value: possibleContainsValue
524
568
  }
525
569
  }, ({
526
570
  compareValue,
527
571
  answer: answer2
528
- }) => !answer2.value.includes(compareValue)).with({
572
+ }) => answer2.value === null || !answer2.value.includes(compareValue)).with({
529
573
  answer: {
530
574
  type: "file"
531
575
  }
@@ -535,7 +579,8 @@ const SendButton = ({
535
579
  class: className,
536
580
  ...props
537
581
  }) => o$1("button", {
538
- class: clsx("bg-accent-7 active:bg-accent-10 active:text-accent-2 text-lowest pointer-coarse:touch-hitbox focus-visible:ring-accent-7/50 flex-shrink-0 rounded-full p-2 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
582
+ class: clsx("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50", className),
583
+ type: "submit",
539
584
  ...props,
540
585
  children: o$1("svg", {
541
586
  class: "block",
@@ -555,6 +600,31 @@ const SendButton = ({
555
600
  })]
556
601
  })
557
602
  });
603
+ const SkipButton = ({
604
+ class: className,
605
+ ...props
606
+ }) => o$1("button", {
607
+ type: "button",
608
+ class: clsx("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all", className),
609
+ ...props,
610
+ children: [o$1("svg", {
611
+ class: "block",
612
+ width: "16",
613
+ height: "16",
614
+ viewBox: "0 0 16 16",
615
+ fill: "transparent",
616
+ stroke: "currentColor",
617
+ "stroke-linecap": "round",
618
+ "stroke-width": "1.5",
619
+ children: [o$1("title", {
620
+ children: "Skip"
621
+ }), o$1("path", {
622
+ d: "M3.25 11.25A5 5 0 0 1 12 7"
623
+ }), o$1("path", {
624
+ d: "M13.25 4.5V8.25H9.5"
625
+ })]
626
+ }), "Skip"]
627
+ });
558
628
  const useFocusOnMount = () => {
559
629
  const focusRef = _$1(null);
560
630
  p(() => {
@@ -575,7 +645,7 @@ const ChatInputBoolean = ({
575
645
  onHeightChange();
576
646
  return o$1("form", {
577
647
  noValidate: true,
578
- class: "flex items-center gap-2 p-2.5",
648
+ class: "",
579
649
  onSubmit: (e) => {
580
650
  e.preventDefault();
581
651
  const value = N(e).with({
@@ -590,19 +660,29 @@ const ChatInputBoolean = ({
590
660
  const answer = parse(AnswerSchema, value);
591
661
  onSubmitSuccess(answer);
592
662
  },
593
- children: options.map((value, i2) => {
594
- return o$1("button", {
595
- ref: i2 === 0 ? focusRef : null,
596
- type: "submit",
597
- name: FIELD_NAME,
598
- value,
599
- class: "bg-lowest ease-expo-out ring-neutral-12/5 text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr duration-snappy block flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",
600
- children: o$1("p", {
601
- class: "truncate text-center text-base",
602
- children: input.config.labels[value]
603
- })
604
- });
605
- })
663
+ children: [o$1("div", {
664
+ class: "flex items-center gap-2 p-2.5",
665
+ children: options.map((value, i2) => {
666
+ return o$1("button", {
667
+ ref: i2 === 0 ? focusRef : null,
668
+ type: "submit",
669
+ name: FIELD_NAME,
670
+ value,
671
+ class: "bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",
672
+ children: o$1("p", {
673
+ class: "truncate text-center text-base",
674
+ children: input.config.labels[value]
675
+ })
676
+ });
677
+ })
678
+ }), input.config.optional && o$1("div", {
679
+ class: "pb-2",
680
+ children: o$1(SkipButton, {
681
+ class: "w-full",
682
+ type: "button",
683
+ onClick: () => onSubmitSuccess(null)
684
+ })
685
+ })]
606
686
  });
607
687
  };
608
688
  const InputError = ({
@@ -614,13 +694,13 @@ const InputError = ({
614
694
  onAnimationComplete();
615
695
  }
616
696
  }, [error, onAnimationComplete]);
617
- return error ? o$1("div", {
697
+ if (!error)
698
+ return null;
699
+ return o$1("div", {
618
700
  role: "alert",
619
701
  class: "text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",
620
702
  children: [o$1("svg", {
621
- class: "text-error-10",
622
- width: "16",
623
- height: "16",
703
+ class: "text-error-9 h-4 w-4",
624
704
  viewBox: "0 0 16 16",
625
705
  fill: "none",
626
706
  xmlns: "http://www.w3.org/2000/svg",
@@ -647,7 +727,7 @@ const InputError = ({
647
727
  class: "truncate pr-1 text-sm",
648
728
  children: error.message
649
729
  })]
650
- }) : o$1(k, {});
730
+ });
651
731
  };
652
732
  const toBase64 = (file) => new Promise((resolve, reject) => {
653
733
  const reader = new FileReader();
@@ -671,7 +751,7 @@ const FileThumbnail = ({
671
751
  const extension = file.name.split(".").pop();
672
752
  const fileName = file.name.replace(new RegExp(`.${extension}$`), "");
673
753
  return o$1("div", {
674
- class: clsx("bg-accent-1 outline-neutral-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", className),
754
+ class: clsx("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline", className),
675
755
  ...props,
676
756
  children: [o$1("p", {
677
757
  "aria-label": "File name",
@@ -684,7 +764,7 @@ const FileThumbnail = ({
684
764
  })]
685
765
  }), o$1("p", {
686
766
  "aria-label": "File size",
687
- class: "text-neutral-10",
767
+ class: "text-accent-11",
688
768
  children: kbToReadableSize(file.sizeKb)
689
769
  })]
690
770
  });
@@ -703,7 +783,7 @@ const ChatInputFile = ({
703
783
  }) => {
704
784
  var _a;
705
785
  const submission = (_a = application.current$.value.application) == null ? void 0 : _a.data.submissions[input.key];
706
- const [files, setFiles] = h(isFileSubmission(submission) ? submission.value : []);
786
+ const [files, setFiles] = h(isFileSubmission(submission) && submission.value !== null ? submission.value : []);
707
787
  const [error, setError] = h();
708
788
  const hiddenFileCount = files.length - FILENAMES_TO_SHOW_QTY;
709
789
  const totalSize = addFileSizesKb(files);
@@ -778,7 +858,7 @@ const ChatInputFile = ({
778
858
  d: "M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
779
859
  })
780
860
  }), o$1("p", {
781
- class: "text-neutral-12 tracking-[-0.01em] dark:text-gray-400",
861
+ class: "text-neutral-12 tracking-[-0.01em]",
782
862
  children: [input.config.allowMultiple ? "Select files" : "Select a file", " to upload"]
783
863
  }), input.config.fileSizeLimitKib ? o$1("p", {
784
864
  class: "text-neutral-10 text-xs",
@@ -827,8 +907,13 @@ const ChatInputFile = ({
827
907
  type: "file",
828
908
  class: "sr-only"
829
909
  })]
830
- }), o$1(SendButton, {
831
- disabled: files.length === 0
910
+ }), o$1("div", {
911
+ class: "flex h-full flex-col items-center gap-2",
912
+ children: [o$1(SendButton, {
913
+ disabled: files.length === 0
914
+ }), input.config.optional && o$1(SkipButton, {
915
+ onClick: () => onSubmitSuccess(null)
916
+ })]
832
917
  })]
833
918
  }), error && o$1(InputError, {
834
919
  onAnimationComplete: onHeightChange,
@@ -2339,7 +2424,7 @@ const ChatInputMultipleChoice = ({
2339
2424
  resolver: getResolver$1(input.config)
2340
2425
  });
2341
2426
  const focusRef = useFocusOnMount();
2342
- const isSingleChoice = input.config.minSelected === 1 && input.config.maxSelected === 1;
2427
+ const isSingleChoice = (input.config.minSelected === 1 || input.config.minSelected === void 0) && input.config.maxSelected === 1;
2343
2428
  return o$1("form", {
2344
2429
  noValidate: true,
2345
2430
  class: "flex flex-col gap-1 pr-2.5",
@@ -2382,13 +2467,19 @@ const ChatInputMultipleChoice = ({
2382
2467
  class: "peer sr-only h-full",
2383
2468
  type: "checkbox"
2384
2469
  }), o$1("label", {
2385
- class: "bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-neutral-12/5 text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 duration-snappy block rounded-2xl px-2.5 py-1 outline outline-2 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4 peer-focus-visible:ring-offset-2",
2470
+ class: "bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 block rounded-2xl px-2.5 py-1 outline outline-2 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4 peer-focus-visible:ring-offset-2",
2386
2471
  htmlFor: id,
2387
2472
  children: option.label
2388
2473
  })]
2389
2474
  }, option.value);
2390
2475
  })
2391
- }), !isSingleChoice && o$1(SendButton, {})]
2476
+ }), o$1("div", {
2477
+ class: "flex flex-col items-center gap-2",
2478
+ children: [!isSingleChoice && o$1(SendButton, {}), input.config.minSelected === 0 && o$1(SkipButton, {
2479
+ type: "button",
2480
+ onClick: () => onSubmitSuccess([])
2481
+ })]
2482
+ })]
2392
2483
  }), o$1("div", {
2393
2484
  class: "px-1",
2394
2485
  children: o$1(InputError, {
@@ -2399,16 +2490,12 @@ const ChatInputMultipleChoice = ({
2399
2490
  });
2400
2491
  };
2401
2492
  const errors = {
2493
+ empty: "Please enter some text",
2402
2494
  email: "That doesn’t look like a valid email address",
2403
- phone: "That doesn’t look like a valid phone number"
2495
+ phone: "That doesn’t look like a valid phone number",
2496
+ url: "That doesn’t look like a valid URL"
2404
2497
  };
2405
2498
  const PhoneSchema = string(errors.phone, [regex(/^\+?[0-9 -]+$/, errors.phone)]);
2406
- const inputFormatToSchema = {
2407
- email: string(errors.email, [email(errors.email)]),
2408
- phone: transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, "")),
2409
- text: string([minLength(1, "Please enter some text")]),
2410
- url: string([url("That doesn’t look like a valid URL")])
2411
- };
2412
2499
  const inputFormatToProps = {
2413
2500
  email: {
2414
2501
  type: "email",
@@ -2431,7 +2518,12 @@ const inputFormatToProps = {
2431
2518
  };
2432
2519
  const isTextSubmission = isSubmissionOfType("text");
2433
2520
  const getResolver = (config) => i(object({
2434
- text: inputFormatToSchema[config.format]
2521
+ text: {
2522
+ email: string(errors.email, [email(errors.email)]),
2523
+ phone: transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, "")),
2524
+ text: string([minLength(1, errors.empty)]),
2525
+ url: string([url(errors.url)])
2526
+ }[config.format]
2435
2527
  }));
2436
2528
  const ChatInputText = ({
2437
2529
  input,
@@ -2456,7 +2548,7 @@ const ChatInputText = ({
2456
2548
  ref: setRef,
2457
2549
  ...props
2458
2550
  } = register("text", {
2459
- required: true
2551
+ required: !input.config.optional
2460
2552
  });
2461
2553
  const ref = _$1();
2462
2554
  y(() => {
@@ -2465,35 +2557,43 @@ const ChatInputText = ({
2465
2557
  ref.current.select();
2466
2558
  }
2467
2559
  }, []);
2468
- return o$1("form", {
2469
- noValidate: true,
2470
- class: "flex flex-col gap-1 p-2.5",
2471
- onSubmit: handleSubmit((submission2) => {
2472
- onSubmitSuccess(submission2.text);
2473
- }),
2474
- children: [o$1("div", {
2475
- class: "flex items-center gap-2",
2476
- children: [o$1("input", {
2477
- id: "chat-input",
2478
- ...props,
2479
- ...inputFormatToProps[input.config.format],
2480
- autocomplete: "off",
2481
- autoCapitalize: "off",
2482
- autoCorrect: "off",
2483
- autoFocus: true,
2484
- ref: (e) => {
2485
- if (e) {
2486
- ref.current = e;
2487
- }
2488
- setRef(e);
2489
- },
2490
- class: "outline-neutral-12/5 ease-expo-out placeholder:text-neutral-5 focus-visible:outline-accent-7 caret-accent-9 duration-snappy flex-grow rounded-full px-3 py-1 text-base outline outline-2 transition-all",
2491
- placeholder: input.config.placeholder
2492
- }), o$1(SendButton, {})]
2493
- }), o$1(InputError, {
2494
- onAnimationComplete: onHeightChange,
2495
- error: errors2.text
2496
- })]
2560
+ return o$1(k, {
2561
+ children: o$1("form", {
2562
+ noValidate: true,
2563
+ class: "flex flex-col gap-1 p-2.5",
2564
+ onSubmit: handleSubmit((submission2) => {
2565
+ onSubmitSuccess(submission2.text);
2566
+ }),
2567
+ children: [o$1("div", {
2568
+ class: "flex items-center gap-2",
2569
+ children: [o$1("div", {
2570
+ class: "relative min-w-0 flex-grow",
2571
+ children: [o$1("input", {
2572
+ id: "chat-input",
2573
+ ...props,
2574
+ ...inputFormatToProps[input.config.format],
2575
+ autocomplete: "off",
2576
+ autoCapitalize: "off",
2577
+ autoCorrect: "off",
2578
+ autoFocus: true,
2579
+ ref: (element) => {
2580
+ if (element) {
2581
+ ref.current = element;
2582
+ }
2583
+ setRef(element);
2584
+ },
2585
+ class: "outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",
2586
+ placeholder: input.config.placeholder
2587
+ }), input.config.optional && o$1(SkipButton, {
2588
+ class: "absolute right-0 top-0",
2589
+ onClick: () => onSubmitSuccess(null)
2590
+ })]
2591
+ }), o$1(SendButton, {})]
2592
+ }), o$1(InputError, {
2593
+ onAnimationComplete: onHeightChange,
2594
+ error: errors2.text
2595
+ })]
2596
+ })
2497
2597
  });
2498
2598
  };
2499
2599
  const ChatInput = ({
@@ -2526,10 +2626,10 @@ const ChatInput = ({
2526
2626
  height: 0,
2527
2627
  opacity: 0
2528
2628
  },
2529
- class: "bg-neutral-2/80 absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-md backdrop-saturate-150",
2629
+ class: "bg-statusbar absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-md backdrop-saturate-150",
2530
2630
  children: o$1("div", {
2531
2631
  ref: inputWrapperRef,
2532
- class: "border-neutral-12/5 border-t",
2632
+ class: "border-divider border-t",
2533
2633
  children: N({
2534
2634
  application,
2535
2635
  input,
@@ -2541,7 +2641,7 @@ const ChatInput = ({
2541
2641
  children: [o$1("input", {
2542
2642
  "aria-hidden": "true",
2543
2643
  id: "chat-input",
2544
- class: "outline-neutral-12/5 placeholder:text-neutral-4 focus-visible:outline-accent-9 caret-accent-9 flex-grow rounded-full px-3 py-1 text-base outline outline-2",
2644
+ class: "outline-divider flex-grow rounded-full bg-transparent px-3 py-1 text-base outline outline-2",
2545
2645
  disabled: true
2546
2646
  }), o$1(SendButton, {
2547
2647
  disabled: true,
@@ -2624,11 +2724,11 @@ const cva = (base, config) => {
2624
2724
  return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
2625
2725
  };
2626
2726
  };
2627
- const chatBubbleVariants = cva("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink-1 min-w-[2rem] text-md py-2 px-3 rounded-[18px] min-h-[36px] break-words", {
2727
+ const chatBubbleVariants = cva("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words", {
2628
2728
  variants: {
2629
2729
  side: {
2630
- left: "bg-lowest text-neutral-12 shadow-surface-sm outline outline-1 outline-neutral-11/[.08] rounded-bl-md",
2631
- right: "ml-auto bg-accent-7 text-lowest rounded-br-md bubble-right"
2730
+ left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
2731
+ right: "ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"
2632
2732
  },
2633
2733
  transitionState: {
2634
2734
  entering: "opacity-0 translate-y-8",
@@ -2691,7 +2791,7 @@ const TypingIndicator = ({
2691
2791
  children: Array.from({
2692
2792
  length: 3
2693
2793
  }, (_2, i2) => o$1("div", {
2694
- class: "bg-accent-7 h-1.5 w-1.5 animate-bounce rounded-full",
2794
+ class: "bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",
2695
2795
  style: {
2696
2796
  animationDelay: `${-i2 * 200}ms`
2697
2797
  }
@@ -2702,7 +2802,7 @@ const authorToSide = {
2702
2802
  bot: "left",
2703
2803
  user: "right"
2704
2804
  };
2705
- const systemMessageStyle = cva("w-full select-none py-2 text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_white]", {
2805
+ const systemMessageStyle = cva("w-full select-none py-2 text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_var(--i-color-n-1)]", {
2706
2806
  variants: {
2707
2807
  variant: {
2708
2808
  info: "text-neutral-8",
@@ -2712,7 +2812,7 @@ const systemMessageStyle = cva("w-full select-none py-2 text-center text-[10px]
2712
2812
  }
2713
2813
  }
2714
2814
  });
2715
- const JobApplicationMessages = ({
2815
+ const Conversation = ({
2716
2816
  messages,
2717
2817
  isBotTyping
2718
2818
  }) => {
@@ -2742,9 +2842,9 @@ const JobApplicationMessages = ({
2742
2842
  type: "link"
2743
2843
  }, (message2) => {
2744
2844
  return o$1("div", {
2745
- class: "bg-accent-8/5 flex w-full items-center justify-center overflow-hidden rounded-xl py-2",
2845
+ class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl py-2",
2746
2846
  children: o$1("a", {
2747
- class: "bg-lowest shadow-surface-sm ring-accent-8/20 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 flex items-center gap-1.5 truncate rounded-full py-2 pl-4 pr-2.5 no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
2847
+ class: "bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 flex items-center gap-1.5 truncate rounded-full py-2 pl-4 pr-2.5 no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",
2748
2848
  target: "_blank",
2749
2849
  href: message2.href,
2750
2850
  children: [message2.text, o$1("svg", {
@@ -2839,6 +2939,7 @@ const useChatService = () => {
2839
2939
  throw new AbortedError();
2840
2940
  application.setInput(void 0);
2841
2941
  if (input.key) {
2942
+ application.setSubmission;
2842
2943
  application.setSubmission(input.key, submission);
2843
2944
  }
2844
2945
  resolve(submission);
@@ -2965,7 +3066,7 @@ const JobApplicationContent = ({
2965
3066
  paddingBottom: inputHeight.value
2966
3067
  },
2967
3068
  children: o$1(AnimatePresence, {
2968
- children: o$1(JobApplicationMessages, {
3069
+ children: o$1(Conversation, {
2969
3070
  isBotTyping,
2970
3071
  messages: currentApplication.data.messages
2971
3072
  })
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-ebce8046.cjs");
3
+ const index = require("./index-efb34443.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { z } from "./index-b130eeef.js";
1
+ import { z } from "./index-b616116f.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  z as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.6.5",
3
+ "version": "3.8.0",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,9 +22,8 @@
22
22
  "@inploi/sdk": "*"
23
23
  },
24
24
  "devDependencies": {
25
- "@happy-dom/global-registrator": "^12.6.0",
25
+ "@happy-dom/global-registrator": "^13.6.2",
26
26
  "@hookform/resolvers": "^3.3.2",
27
- "@playwright/test": "^1.40.1",
28
27
  "@preact/preset-vite": "^2.5.0",
29
28
  "@preact/signals": "^1.2.2",
30
29
  "@radix-ui/react-dialog": "^1.0.5",
@@ -32,12 +31,14 @@
32
31
  "@radix-ui/react-focus-scope": "^1.0.4",
33
32
  "@radix-ui/react-slot": "^1.0.2",
34
33
  "@total-typescript/ts-reset": "^0.5.1",
34
+ "@types/bun": "^1.0.8",
35
35
  "@types/culori": "^2.0.4",
36
36
  "@types/node": "^20.10.0",
37
37
  "@types/react-transition-group": "^4.4.9",
38
38
  "autoprefixer": "^10.4.16",
39
39
  "class-variance-authority": "^0.7.0",
40
40
  "clsx": "^2.0.0",
41
+ "eslint-plugin-tailwindcss": "^3.14.1",
41
42
  "concurrently": "^8.2.2",
42
43
  "culori": "^3.3.0",
43
44
  "dotenv": "^16.3.1",
@@ -63,8 +64,9 @@
63
64
  "vite": "^4.4.5",
64
65
  "vite-plugin-dts": "^3.7.0",
65
66
  "vite-tsconfig-paths": "^4.2.1",
66
- "@inploi/core": "1.11.3",
67
+ "@inploi/core": "1.11.4",
67
68
  "@inploi/sdk": "1.11.4",
69
+ "@inploi/design-tokens": "0.2.0",
68
70
  "eslint-config-custom": "0.1.0",
69
71
  "tsconfig": "0.1.0"
70
72
  },