@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.
- package/cdn/index.js +28 -32
- package/dist/chatbot.d.ts +2 -2
- package/dist/chatbot.dom.d.ts +1 -2
- package/dist/chatbot.state.d.ts +7 -7
- package/dist/chatbot.utils.d.ts +10 -5
- package/dist/{index-b130eeef.js → index-b616116f.js} +493 -3429
- package/dist/{index-ebce8046.cjs → index-efb34443.cjs} +493 -3429
- package/dist/interpreter.d.ts +1 -1
- package/dist/{job-application-content-bacb82b9.cjs → job-application-content-8b7e62bb.cjs} +215 -114
- package/dist/{job-application-content-f45a3311.js → job-application-content-b9799966.js} +215 -114
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +6 -4
package/dist/interpreter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlowNode } from '@inploi/core/flows';
|
|
2
2
|
import { AnalyticsService, ApiClient, Logger } from '@inploi/sdk';
|
|
3
|
-
import { ChatInput } from './
|
|
3
|
+
import { ChatInput } from './components/chat-input/chat-input';
|
|
4
4
|
import { ApplicationSubmission, ChatMessage, KeyToSubmissionMap } from './chatbot.state';
|
|
5
5
|
export declare const followNodes: ({ node, nodes, stopWhen, }: {
|
|
6
6
|
node: FlowNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-efb34443.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
5
|
const getHeadOrThrow = (nodes) => {
|
|
6
6
|
const head = nodes.find((n2) => n2.isHead);
|
|
@@ -263,6 +263,7 @@ async function interpretSubmitNode({
|
|
|
263
263
|
href: href.toString(),
|
|
264
264
|
text: "Finalise application on partner"
|
|
265
265
|
});
|
|
266
|
+
next(node.nextId);
|
|
266
267
|
}).with({
|
|
267
268
|
success: true
|
|
268
269
|
}, async () => {
|
|
@@ -343,15 +344,24 @@ async function interpretQuestionTextNode({
|
|
|
343
344
|
key: node.data.key,
|
|
344
345
|
type: "text",
|
|
345
346
|
config: {
|
|
347
|
+
optional: node.data.optional,
|
|
346
348
|
placeholder: node.data.placeholder,
|
|
347
349
|
format: node.data.format
|
|
348
350
|
}
|
|
349
351
|
});
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
352
|
+
if (reply.value === null) {
|
|
353
|
+
await chat.sendMessage({
|
|
354
|
+
type: "system",
|
|
355
|
+
variant: "info",
|
|
356
|
+
text: "Skipped"
|
|
357
|
+
});
|
|
358
|
+
} else {
|
|
359
|
+
await chat.sendMessage({
|
|
360
|
+
author: "user",
|
|
361
|
+
type: "text",
|
|
362
|
+
text: reply.value
|
|
363
|
+
});
|
|
364
|
+
}
|
|
355
365
|
next(node.nextId);
|
|
356
366
|
}
|
|
357
367
|
async function interpretQuestionNumberNode({
|
|
@@ -368,15 +378,24 @@ async function interpretQuestionNumberNode({
|
|
|
368
378
|
key: node.data.key,
|
|
369
379
|
type: "text",
|
|
370
380
|
config: {
|
|
381
|
+
optional: node.data.optional,
|
|
371
382
|
placeholder: node.data.placeholder,
|
|
372
383
|
format: "text"
|
|
373
384
|
}
|
|
374
385
|
});
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
386
|
+
if (reply.value === null) {
|
|
387
|
+
await chat.sendMessage({
|
|
388
|
+
type: "system",
|
|
389
|
+
variant: "info",
|
|
390
|
+
text: "Skipped"
|
|
391
|
+
});
|
|
392
|
+
} else {
|
|
393
|
+
await chat.sendMessage({
|
|
394
|
+
author: "user",
|
|
395
|
+
type: "text",
|
|
396
|
+
text: reply.value
|
|
397
|
+
});
|
|
398
|
+
}
|
|
380
399
|
next(node.nextId);
|
|
381
400
|
}
|
|
382
401
|
async function interpretQuestionEnumNode({
|
|
@@ -394,11 +413,19 @@ async function interpretQuestionEnumNode({
|
|
|
394
413
|
type: "multiple-choice",
|
|
395
414
|
config: node.data
|
|
396
415
|
});
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
416
|
+
if (reply.value.length === 0) {
|
|
417
|
+
await chat.sendMessage({
|
|
418
|
+
type: "system",
|
|
419
|
+
variant: "info",
|
|
420
|
+
text: "Skipped"
|
|
421
|
+
});
|
|
422
|
+
} else {
|
|
423
|
+
await chat.sendMessage({
|
|
424
|
+
author: "user",
|
|
425
|
+
type: "text",
|
|
426
|
+
text: node.data.options.filter((o2) => reply.value.includes(o2.value)).map((o2) => o2.label).join(", ")
|
|
427
|
+
});
|
|
428
|
+
}
|
|
402
429
|
next(node.nextId);
|
|
403
430
|
}
|
|
404
431
|
async function interpretQuestionBooleanNode({
|
|
@@ -415,6 +442,7 @@ async function interpretQuestionBooleanNode({
|
|
|
415
442
|
key: node.data.key,
|
|
416
443
|
type: "boolean",
|
|
417
444
|
config: {
|
|
445
|
+
optional: node.data.optional,
|
|
418
446
|
labels: {
|
|
419
447
|
true: node.data.trueLabel,
|
|
420
448
|
false: node.data.falseLabel
|
|
@@ -422,15 +450,22 @@ async function interpretQuestionBooleanNode({
|
|
|
422
450
|
}
|
|
423
451
|
});
|
|
424
452
|
const reply = input.value;
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
453
|
+
if (reply === null) {
|
|
454
|
+
await chat.sendMessage({
|
|
455
|
+
type: "system",
|
|
456
|
+
variant: "info",
|
|
457
|
+
text: "Skipped"
|
|
458
|
+
});
|
|
459
|
+
} else {
|
|
460
|
+
await chat.sendMessage({
|
|
461
|
+
author: "user",
|
|
462
|
+
type: "text",
|
|
463
|
+
text: {
|
|
464
|
+
true: node.data.trueLabel,
|
|
465
|
+
false: node.data.falseLabel
|
|
466
|
+
}[reply]
|
|
467
|
+
});
|
|
468
|
+
}
|
|
434
469
|
next(node.nextId);
|
|
435
470
|
}
|
|
436
471
|
async function interpretQuestionAddressNode({
|
|
@@ -459,19 +494,28 @@ async function interpretQuestionFileNode({
|
|
|
459
494
|
key: node.data.key,
|
|
460
495
|
type: "file",
|
|
461
496
|
config: {
|
|
497
|
+
optional: node.data.optional,
|
|
462
498
|
extensions: node.data.extensions,
|
|
463
499
|
// default value for fileSizeLimitKib is 10MB
|
|
464
500
|
fileSizeLimitKib: node.data.maxSizeKb ?? 10 * 1024,
|
|
465
501
|
allowMultiple: node.data.multiple === true
|
|
466
502
|
}
|
|
467
503
|
});
|
|
468
|
-
|
|
504
|
+
if (files.value === null) {
|
|
469
505
|
await chat.sendMessage({
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
fileSizeKb: file.sizeKb
|
|
506
|
+
type: "system",
|
|
507
|
+
variant: "info",
|
|
508
|
+
text: "Skipped"
|
|
474
509
|
});
|
|
510
|
+
} else {
|
|
511
|
+
for (const file of files.value) {
|
|
512
|
+
await chat.sendMessage({
|
|
513
|
+
author: "user",
|
|
514
|
+
type: "file",
|
|
515
|
+
fileName: file.name,
|
|
516
|
+
fileSizeKb: file.sizeKb
|
|
517
|
+
});
|
|
518
|
+
}
|
|
475
519
|
}
|
|
476
520
|
next(node.nextId);
|
|
477
521
|
}
|
|
@@ -487,7 +531,7 @@ async function interpretEndFlowNode({
|
|
|
487
531
|
});
|
|
488
532
|
end();
|
|
489
533
|
}
|
|
490
|
-
const
|
|
534
|
+
const possibleContainsValue = index._.union(index._.string, index._.array(index._.string), null);
|
|
491
535
|
const isIfBlockConditionMet = (ifBlock, submissions) => {
|
|
492
536
|
const answer = submissions == null ? void 0 : submissions[ifBlock.data.compareKey];
|
|
493
537
|
if (!answer)
|
|
@@ -514,20 +558,20 @@ const isIfBlockConditionMet = (ifBlock, submissions) => {
|
|
|
514
558
|
}).with({
|
|
515
559
|
compare: "contains",
|
|
516
560
|
answer: {
|
|
517
|
-
value:
|
|
561
|
+
value: possibleContainsValue
|
|
518
562
|
}
|
|
519
563
|
}, ({
|
|
520
564
|
compareValue,
|
|
521
565
|
answer: answer2
|
|
522
|
-
}) => answer2.value.includes(compareValue)).with({
|
|
566
|
+
}) => answer2.value !== null && answer2.value.includes(compareValue)).with({
|
|
523
567
|
compare: "notContains",
|
|
524
568
|
answer: {
|
|
525
|
-
value:
|
|
569
|
+
value: possibleContainsValue
|
|
526
570
|
}
|
|
527
571
|
}, ({
|
|
528
572
|
compareValue,
|
|
529
573
|
answer: answer2
|
|
530
|
-
}) => !answer2.value.includes(compareValue)).with({
|
|
574
|
+
}) => answer2.value === null || !answer2.value.includes(compareValue)).with({
|
|
531
575
|
answer: {
|
|
532
576
|
type: "file"
|
|
533
577
|
}
|
|
@@ -537,7 +581,8 @@ const SendButton = ({
|
|
|
537
581
|
class: className,
|
|
538
582
|
...props
|
|
539
583
|
}) => index.o("button", {
|
|
540
|
-
class: index.clsx("bg-accent-
|
|
584
|
+
class: index.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),
|
|
585
|
+
type: "submit",
|
|
541
586
|
...props,
|
|
542
587
|
children: index.o("svg", {
|
|
543
588
|
class: "block",
|
|
@@ -557,6 +602,31 @@ const SendButton = ({
|
|
|
557
602
|
})]
|
|
558
603
|
})
|
|
559
604
|
});
|
|
605
|
+
const SkipButton = ({
|
|
606
|
+
class: className,
|
|
607
|
+
...props
|
|
608
|
+
}) => index.o("button", {
|
|
609
|
+
type: "button",
|
|
610
|
+
class: index.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),
|
|
611
|
+
...props,
|
|
612
|
+
children: [index.o("svg", {
|
|
613
|
+
class: "block",
|
|
614
|
+
width: "16",
|
|
615
|
+
height: "16",
|
|
616
|
+
viewBox: "0 0 16 16",
|
|
617
|
+
fill: "transparent",
|
|
618
|
+
stroke: "currentColor",
|
|
619
|
+
"stroke-linecap": "round",
|
|
620
|
+
"stroke-width": "1.5",
|
|
621
|
+
children: [index.o("title", {
|
|
622
|
+
children: "Skip"
|
|
623
|
+
}), index.o("path", {
|
|
624
|
+
d: "M3.25 11.25A5 5 0 0 1 12 7"
|
|
625
|
+
}), index.o("path", {
|
|
626
|
+
d: "M13.25 4.5V8.25H9.5"
|
|
627
|
+
})]
|
|
628
|
+
}), "Skip"]
|
|
629
|
+
});
|
|
560
630
|
const useFocusOnMount = () => {
|
|
561
631
|
const focusRef = index._$1(null);
|
|
562
632
|
index.p(() => {
|
|
@@ -577,7 +647,7 @@ const ChatInputBoolean = ({
|
|
|
577
647
|
onHeightChange();
|
|
578
648
|
return index.o("form", {
|
|
579
649
|
noValidate: true,
|
|
580
|
-
class: "
|
|
650
|
+
class: "",
|
|
581
651
|
onSubmit: (e) => {
|
|
582
652
|
e.preventDefault();
|
|
583
653
|
const value = index.N(e).with({
|
|
@@ -592,19 +662,29 @@ const ChatInputBoolean = ({
|
|
|
592
662
|
const answer = index.parse(AnswerSchema, value);
|
|
593
663
|
onSubmitSuccess(answer);
|
|
594
664
|
},
|
|
595
|
-
children:
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
class: "
|
|
604
|
-
children:
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
665
|
+
children: [index.o("div", {
|
|
666
|
+
class: "flex items-center gap-2 p-2.5",
|
|
667
|
+
children: options.map((value, i2) => {
|
|
668
|
+
return index.o("button", {
|
|
669
|
+
ref: i2 === 0 ? focusRef : null,
|
|
670
|
+
type: "submit",
|
|
671
|
+
name: FIELD_NAME,
|
|
672
|
+
value,
|
|
673
|
+
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",
|
|
674
|
+
children: index.o("p", {
|
|
675
|
+
class: "truncate text-center text-base",
|
|
676
|
+
children: input.config.labels[value]
|
|
677
|
+
})
|
|
678
|
+
});
|
|
679
|
+
})
|
|
680
|
+
}), input.config.optional && index.o("div", {
|
|
681
|
+
class: "pb-2",
|
|
682
|
+
children: index.o(SkipButton, {
|
|
683
|
+
class: "w-full",
|
|
684
|
+
type: "button",
|
|
685
|
+
onClick: () => onSubmitSuccess(null)
|
|
686
|
+
})
|
|
687
|
+
})]
|
|
608
688
|
});
|
|
609
689
|
};
|
|
610
690
|
const InputError = ({
|
|
@@ -616,13 +696,13 @@ const InputError = ({
|
|
|
616
696
|
onAnimationComplete();
|
|
617
697
|
}
|
|
618
698
|
}, [error, onAnimationComplete]);
|
|
619
|
-
|
|
699
|
+
if (!error)
|
|
700
|
+
return null;
|
|
701
|
+
return index.o("div", {
|
|
620
702
|
role: "alert",
|
|
621
703
|
class: "text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",
|
|
622
704
|
children: [index.o("svg", {
|
|
623
|
-
class: "text-error-
|
|
624
|
-
width: "16",
|
|
625
|
-
height: "16",
|
|
705
|
+
class: "text-error-9 h-4 w-4",
|
|
626
706
|
viewBox: "0 0 16 16",
|
|
627
707
|
fill: "none",
|
|
628
708
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -649,7 +729,7 @@ const InputError = ({
|
|
|
649
729
|
class: "truncate pr-1 text-sm",
|
|
650
730
|
children: error.message
|
|
651
731
|
})]
|
|
652
|
-
})
|
|
732
|
+
});
|
|
653
733
|
};
|
|
654
734
|
const toBase64 = (file) => new Promise((resolve, reject) => {
|
|
655
735
|
const reader = new FileReader();
|
|
@@ -673,7 +753,7 @@ const FileThumbnail = ({
|
|
|
673
753
|
const extension = file.name.split(".").pop();
|
|
674
754
|
const fileName = file.name.replace(new RegExp(`.${extension}$`), "");
|
|
675
755
|
return index.o("div", {
|
|
676
|
-
class: index.clsx("bg-accent-1 outline-
|
|
756
|
+
class: index.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),
|
|
677
757
|
...props,
|
|
678
758
|
children: [index.o("p", {
|
|
679
759
|
"aria-label": "File name",
|
|
@@ -686,7 +766,7 @@ const FileThumbnail = ({
|
|
|
686
766
|
})]
|
|
687
767
|
}), index.o("p", {
|
|
688
768
|
"aria-label": "File size",
|
|
689
|
-
class: "text-
|
|
769
|
+
class: "text-accent-11",
|
|
690
770
|
children: kbToReadableSize(file.sizeKb)
|
|
691
771
|
})]
|
|
692
772
|
});
|
|
@@ -705,7 +785,7 @@ const ChatInputFile = ({
|
|
|
705
785
|
}) => {
|
|
706
786
|
var _a;
|
|
707
787
|
const submission = (_a = index.application.current$.value.application) == null ? void 0 : _a.data.submissions[input.key];
|
|
708
|
-
const [files, setFiles] = index.h(isFileSubmission(submission) ? submission.value : []);
|
|
788
|
+
const [files, setFiles] = index.h(isFileSubmission(submission) && submission.value !== null ? submission.value : []);
|
|
709
789
|
const [error, setError] = index.h();
|
|
710
790
|
const hiddenFileCount = files.length - FILENAMES_TO_SHOW_QTY;
|
|
711
791
|
const totalSize = addFileSizesKb(files);
|
|
@@ -780,7 +860,7 @@ const ChatInputFile = ({
|
|
|
780
860
|
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"
|
|
781
861
|
})
|
|
782
862
|
}), index.o("p", {
|
|
783
|
-
class: "text-neutral-12 tracking-[-0.01em]
|
|
863
|
+
class: "text-neutral-12 tracking-[-0.01em]",
|
|
784
864
|
children: [input.config.allowMultiple ? "Select files" : "Select a file", " to upload"]
|
|
785
865
|
}), input.config.fileSizeLimitKib ? index.o("p", {
|
|
786
866
|
class: "text-neutral-10 text-xs",
|
|
@@ -829,8 +909,13 @@ const ChatInputFile = ({
|
|
|
829
909
|
type: "file",
|
|
830
910
|
class: "sr-only"
|
|
831
911
|
})]
|
|
832
|
-
}), index.o(
|
|
833
|
-
|
|
912
|
+
}), index.o("div", {
|
|
913
|
+
class: "flex h-full flex-col items-center gap-2",
|
|
914
|
+
children: [index.o(SendButton, {
|
|
915
|
+
disabled: files.length === 0
|
|
916
|
+
}), input.config.optional && index.o(SkipButton, {
|
|
917
|
+
onClick: () => onSubmitSuccess(null)
|
|
918
|
+
})]
|
|
834
919
|
})]
|
|
835
920
|
}), error && index.o(InputError, {
|
|
836
921
|
onAnimationComplete: onHeightChange,
|
|
@@ -2341,7 +2426,7 @@ const ChatInputMultipleChoice = ({
|
|
|
2341
2426
|
resolver: getResolver$1(input.config)
|
|
2342
2427
|
});
|
|
2343
2428
|
const focusRef = useFocusOnMount();
|
|
2344
|
-
const isSingleChoice = input.config.minSelected === 1 && input.config.maxSelected === 1;
|
|
2429
|
+
const isSingleChoice = (input.config.minSelected === 1 || input.config.minSelected === void 0) && input.config.maxSelected === 1;
|
|
2345
2430
|
return index.o("form", {
|
|
2346
2431
|
noValidate: true,
|
|
2347
2432
|
class: "flex flex-col gap-1 pr-2.5",
|
|
@@ -2384,13 +2469,19 @@ const ChatInputMultipleChoice = ({
|
|
|
2384
2469
|
class: "peer sr-only h-full",
|
|
2385
2470
|
type: "checkbox"
|
|
2386
2471
|
}), index.o("label", {
|
|
2387
|
-
class: "bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-
|
|
2472
|
+
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",
|
|
2388
2473
|
htmlFor: id,
|
|
2389
2474
|
children: option.label
|
|
2390
2475
|
})]
|
|
2391
2476
|
}, option.value);
|
|
2392
2477
|
})
|
|
2393
|
-
}),
|
|
2478
|
+
}), index.o("div", {
|
|
2479
|
+
class: "flex flex-col items-center gap-2",
|
|
2480
|
+
children: [!isSingleChoice && index.o(SendButton, {}), input.config.minSelected === 0 && index.o(SkipButton, {
|
|
2481
|
+
type: "button",
|
|
2482
|
+
onClick: () => onSubmitSuccess([])
|
|
2483
|
+
})]
|
|
2484
|
+
})]
|
|
2394
2485
|
}), index.o("div", {
|
|
2395
2486
|
class: "px-1",
|
|
2396
2487
|
children: index.o(InputError, {
|
|
@@ -2401,16 +2492,12 @@ const ChatInputMultipleChoice = ({
|
|
|
2401
2492
|
});
|
|
2402
2493
|
};
|
|
2403
2494
|
const errors = {
|
|
2495
|
+
empty: "Please enter some text",
|
|
2404
2496
|
email: "That doesn’t look like a valid email address",
|
|
2405
|
-
phone: "That doesn’t look like a valid phone number"
|
|
2497
|
+
phone: "That doesn’t look like a valid phone number",
|
|
2498
|
+
url: "That doesn’t look like a valid URL"
|
|
2406
2499
|
};
|
|
2407
2500
|
const PhoneSchema = index.string(errors.phone, [index.regex(/^\+?[0-9 -]+$/, errors.phone)]);
|
|
2408
|
-
const inputFormatToSchema = {
|
|
2409
|
-
email: index.string(errors.email, [index.email(errors.email)]),
|
|
2410
|
-
phone: index.transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, "")),
|
|
2411
|
-
text: index.string([index.minLength(1, "Please enter some text")]),
|
|
2412
|
-
url: index.string([index.url("That doesn’t look like a valid URL")])
|
|
2413
|
-
};
|
|
2414
2501
|
const inputFormatToProps = {
|
|
2415
2502
|
email: {
|
|
2416
2503
|
type: "email",
|
|
@@ -2433,7 +2520,12 @@ const inputFormatToProps = {
|
|
|
2433
2520
|
};
|
|
2434
2521
|
const isTextSubmission = isSubmissionOfType("text");
|
|
2435
2522
|
const getResolver = (config) => i(index.object({
|
|
2436
|
-
text:
|
|
2523
|
+
text: {
|
|
2524
|
+
email: index.string(errors.email, [index.email(errors.email)]),
|
|
2525
|
+
phone: index.transform(PhoneSchema, (value) => value.replace(/[^0-9]/g, "")),
|
|
2526
|
+
text: index.string([index.minLength(1, errors.empty)]),
|
|
2527
|
+
url: index.string([index.url(errors.url)])
|
|
2528
|
+
}[config.format]
|
|
2437
2529
|
}));
|
|
2438
2530
|
const ChatInputText = ({
|
|
2439
2531
|
input,
|
|
@@ -2458,7 +2550,7 @@ const ChatInputText = ({
|
|
|
2458
2550
|
ref: setRef,
|
|
2459
2551
|
...props
|
|
2460
2552
|
} = register("text", {
|
|
2461
|
-
required:
|
|
2553
|
+
required: !input.config.optional
|
|
2462
2554
|
});
|
|
2463
2555
|
const ref = index._$1();
|
|
2464
2556
|
index.y(() => {
|
|
@@ -2467,35 +2559,43 @@ const ChatInputText = ({
|
|
|
2467
2559
|
ref.current.select();
|
|
2468
2560
|
}
|
|
2469
2561
|
}, []);
|
|
2470
|
-
return index.o(
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2562
|
+
return index.o(index.k, {
|
|
2563
|
+
children: index.o("form", {
|
|
2564
|
+
noValidate: true,
|
|
2565
|
+
class: "flex flex-col gap-1 p-2.5",
|
|
2566
|
+
onSubmit: handleSubmit((submission2) => {
|
|
2567
|
+
onSubmitSuccess(submission2.text);
|
|
2568
|
+
}),
|
|
2569
|
+
children: [index.o("div", {
|
|
2570
|
+
class: "flex items-center gap-2",
|
|
2571
|
+
children: [index.o("div", {
|
|
2572
|
+
class: "relative min-w-0 flex-grow",
|
|
2573
|
+
children: [index.o("input", {
|
|
2574
|
+
id: "chat-input",
|
|
2575
|
+
...props,
|
|
2576
|
+
...inputFormatToProps[input.config.format],
|
|
2577
|
+
autocomplete: "off",
|
|
2578
|
+
autoCapitalize: "off",
|
|
2579
|
+
autoCorrect: "off",
|
|
2580
|
+
autoFocus: true,
|
|
2581
|
+
ref: (element) => {
|
|
2582
|
+
if (element) {
|
|
2583
|
+
ref.current = element;
|
|
2584
|
+
}
|
|
2585
|
+
setRef(element);
|
|
2586
|
+
},
|
|
2587
|
+
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",
|
|
2588
|
+
placeholder: input.config.placeholder
|
|
2589
|
+
}), input.config.optional && index.o(SkipButton, {
|
|
2590
|
+
class: "absolute right-0 top-0",
|
|
2591
|
+
onClick: () => onSubmitSuccess(null)
|
|
2592
|
+
})]
|
|
2593
|
+
}), index.o(SendButton, {})]
|
|
2594
|
+
}), index.o(InputError, {
|
|
2595
|
+
onAnimationComplete: onHeightChange,
|
|
2596
|
+
error: errors2.text
|
|
2597
|
+
})]
|
|
2598
|
+
})
|
|
2499
2599
|
});
|
|
2500
2600
|
};
|
|
2501
2601
|
const ChatInput = ({
|
|
@@ -2528,10 +2628,10 @@ const ChatInput = ({
|
|
|
2528
2628
|
height: 0,
|
|
2529
2629
|
opacity: 0
|
|
2530
2630
|
},
|
|
2531
|
-
class: "bg-
|
|
2631
|
+
class: "bg-statusbar absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-md backdrop-saturate-150",
|
|
2532
2632
|
children: index.o("div", {
|
|
2533
2633
|
ref: inputWrapperRef,
|
|
2534
|
-
class: "border-
|
|
2634
|
+
class: "border-divider border-t",
|
|
2535
2635
|
children: index.N({
|
|
2536
2636
|
application: index.application,
|
|
2537
2637
|
input,
|
|
@@ -2543,7 +2643,7 @@ const ChatInput = ({
|
|
|
2543
2643
|
children: [index.o("input", {
|
|
2544
2644
|
"aria-hidden": "true",
|
|
2545
2645
|
id: "chat-input",
|
|
2546
|
-
class: "outline-
|
|
2646
|
+
class: "outline-divider flex-grow rounded-full bg-transparent px-3 py-1 text-base outline outline-2",
|
|
2547
2647
|
disabled: true
|
|
2548
2648
|
}), index.o(SendButton, {
|
|
2549
2649
|
disabled: true,
|
|
@@ -2626,11 +2726,11 @@ const cva = (base, config) => {
|
|
|
2626
2726
|
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2627
2727
|
};
|
|
2628
2728
|
};
|
|
2629
|
-
const chatBubbleVariants = cva("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink
|
|
2729
|
+
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", {
|
|
2630
2730
|
variants: {
|
|
2631
2731
|
side: {
|
|
2632
|
-
left: "bg-
|
|
2633
|
-
right: "ml-auto bg-accent-
|
|
2732
|
+
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
2733
|
+
right: "ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"
|
|
2634
2734
|
},
|
|
2635
2735
|
transitionState: {
|
|
2636
2736
|
entering: "opacity-0 translate-y-8",
|
|
@@ -2693,7 +2793,7 @@ const TypingIndicator = ({
|
|
|
2693
2793
|
children: Array.from({
|
|
2694
2794
|
length: 3
|
|
2695
2795
|
}, (_, i2) => index.o("div", {
|
|
2696
|
-
class: "bg-accent-
|
|
2796
|
+
class: "bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",
|
|
2697
2797
|
style: {
|
|
2698
2798
|
animationDelay: `${-i2 * 200}ms`
|
|
2699
2799
|
}
|
|
@@ -2704,7 +2804,7 @@ const authorToSide = {
|
|
|
2704
2804
|
bot: "left",
|
|
2705
2805
|
user: "right"
|
|
2706
2806
|
};
|
|
2707
|
-
const systemMessageStyle = cva("w-full select-none py-2 text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.
|
|
2807
|
+
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)]", {
|
|
2708
2808
|
variants: {
|
|
2709
2809
|
variant: {
|
|
2710
2810
|
info: "text-neutral-8",
|
|
@@ -2714,7 +2814,7 @@ const systemMessageStyle = cva("w-full select-none py-2 text-center text-[10px]
|
|
|
2714
2814
|
}
|
|
2715
2815
|
}
|
|
2716
2816
|
});
|
|
2717
|
-
const
|
|
2817
|
+
const Conversation = ({
|
|
2718
2818
|
messages,
|
|
2719
2819
|
isBotTyping
|
|
2720
2820
|
}) => {
|
|
@@ -2744,9 +2844,9 @@ const JobApplicationMessages = ({
|
|
|
2744
2844
|
type: "link"
|
|
2745
2845
|
}, (message2) => {
|
|
2746
2846
|
return index.o("div", {
|
|
2747
|
-
class: "bg-accent-
|
|
2847
|
+
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl py-2",
|
|
2748
2848
|
children: index.o("a", {
|
|
2749
|
-
class: "bg-lowest shadow-surface-sm ring-accent-
|
|
2849
|
+
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",
|
|
2750
2850
|
target: "_blank",
|
|
2751
2851
|
href: message2.href,
|
|
2752
2852
|
children: [message2.text, index.o("svg", {
|
|
@@ -2841,6 +2941,7 @@ const useChatService = () => {
|
|
|
2841
2941
|
throw new AbortedError();
|
|
2842
2942
|
index.application.setInput(void 0);
|
|
2843
2943
|
if (input.key) {
|
|
2944
|
+
index.application.setSubmission;
|
|
2844
2945
|
index.application.setSubmission(input.key, submission);
|
|
2845
2946
|
}
|
|
2846
2947
|
resolve(submission);
|
|
@@ -2967,7 +3068,7 @@ const JobApplicationContent = ({
|
|
|
2967
3068
|
paddingBottom: index.inputHeight.value
|
|
2968
3069
|
},
|
|
2969
3070
|
children: index.o(index.AnimatePresence, {
|
|
2970
|
-
children: index.o(
|
|
3071
|
+
children: index.o(Conversation, {
|
|
2971
3072
|
isBotTyping,
|
|
2972
3073
|
messages: currentApplication.data.messages
|
|
2973
3074
|
})
|