@inploi/plugin-chatbot 3.7.0 → 3.9.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 +16 -20
- package/dist/chatbot.d.ts +2 -3
- package/dist/chatbot.dom.d.ts +1 -2
- package/dist/chatbot.state.d.ts +2 -2
- package/dist/chatbot.utils.d.ts +6 -7
- package/dist/{index-09e54786.cjs → index-210f3179.cjs} +485 -3424
- package/dist/{index-1808db67.js → index-6a43f107.js} +496 -3435
- package/dist/interpreter.d.ts +5 -4
- package/dist/{job-application-content-205c66b2.js → job-application-content-6683c944.js} +250 -44
- package/dist/{job-application-content-43128b7f.cjs → job-application-content-cdd9aeb2.cjs} +250 -44
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +2 -2
- package/package.json +7 -4
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-210f3179.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
|
+
const kbToReadableSize = (kb) => index.N(kb).with(index._.number.lte(1e3), () => `${Math.round(kb)}KB`).with(index._.number.lt(1e3 * 10), () => `${(kb / 1e3).toFixed(1)}MB`).otherwise(() => `${Math.round(kb / 1e3)}MB`);
|
|
5
6
|
const getHeadOrThrow = (nodes) => {
|
|
6
7
|
const head = nodes.find((n2) => n2.isHead);
|
|
7
8
|
if (!head)
|
|
@@ -235,8 +236,6 @@ async function interpretSubmitNode({
|
|
|
235
236
|
method: "POST",
|
|
236
237
|
body: JSON.stringify({
|
|
237
238
|
...context,
|
|
238
|
-
type: node.data.type,
|
|
239
|
-
ats: node.data.ats,
|
|
240
239
|
integration_id: node.data.integrationId,
|
|
241
240
|
anonymous_id: analytics.getAnonymousId(),
|
|
242
241
|
submissions: getApplicationSubmissionsPayload(submissions || {})
|
|
@@ -287,12 +286,13 @@ async function interpretSubmitNode({
|
|
|
287
286
|
async function interpretLinkNode({
|
|
288
287
|
chat,
|
|
289
288
|
next,
|
|
290
|
-
node
|
|
289
|
+
node,
|
|
290
|
+
submissions
|
|
291
291
|
}) {
|
|
292
292
|
await chat.sendMessage({
|
|
293
293
|
type: "link",
|
|
294
294
|
href: node.data.href,
|
|
295
|
-
text: node.data.cta
|
|
295
|
+
text: interpolateString(node.data.cta, submissions)
|
|
296
296
|
});
|
|
297
297
|
next(node.nextId);
|
|
298
298
|
}
|
|
@@ -307,12 +307,13 @@ async function interpretIfBlockNode({
|
|
|
307
307
|
async function interpretTextNode({
|
|
308
308
|
chat,
|
|
309
309
|
next,
|
|
310
|
-
node
|
|
310
|
+
node,
|
|
311
|
+
submissions
|
|
311
312
|
}) {
|
|
312
313
|
await chat.sendMessage({
|
|
313
314
|
author: "bot",
|
|
314
315
|
type: "text",
|
|
315
|
-
text: node.data.text
|
|
316
|
+
text: interpolateString(node.data.text, submissions)
|
|
316
317
|
});
|
|
317
318
|
next(node.nextId);
|
|
318
319
|
}
|
|
@@ -333,12 +334,13 @@ async function interpretImageNode({
|
|
|
333
334
|
async function interpretQuestionTextNode({
|
|
334
335
|
chat,
|
|
335
336
|
next,
|
|
336
|
-
node
|
|
337
|
+
node,
|
|
338
|
+
submissions
|
|
337
339
|
}) {
|
|
338
340
|
await chat.sendMessage({
|
|
339
341
|
author: "bot",
|
|
340
342
|
type: "text",
|
|
341
|
-
text: node.data.question
|
|
343
|
+
text: interpolateString(node.data.question, submissions)
|
|
342
344
|
});
|
|
343
345
|
const reply = await chat.userInput({
|
|
344
346
|
key: node.data.key,
|
|
@@ -367,12 +369,13 @@ async function interpretQuestionTextNode({
|
|
|
367
369
|
async function interpretQuestionNumberNode({
|
|
368
370
|
chat,
|
|
369
371
|
next,
|
|
370
|
-
node
|
|
372
|
+
node,
|
|
373
|
+
submissions
|
|
371
374
|
}) {
|
|
372
375
|
await chat.sendMessage({
|
|
373
376
|
author: "bot",
|
|
374
377
|
type: "text",
|
|
375
|
-
text: node.data.question
|
|
378
|
+
text: interpolateString(node.data.question, submissions)
|
|
376
379
|
});
|
|
377
380
|
const reply = await chat.userInput({
|
|
378
381
|
key: node.data.key,
|
|
@@ -401,12 +404,13 @@ async function interpretQuestionNumberNode({
|
|
|
401
404
|
async function interpretQuestionEnumNode({
|
|
402
405
|
chat,
|
|
403
406
|
next,
|
|
404
|
-
node
|
|
407
|
+
node,
|
|
408
|
+
submissions
|
|
405
409
|
}) {
|
|
406
410
|
await chat.sendMessage({
|
|
407
411
|
author: "bot",
|
|
408
412
|
type: "text",
|
|
409
|
-
text: node.data.question
|
|
413
|
+
text: interpolateString(node.data.question, submissions)
|
|
410
414
|
});
|
|
411
415
|
const reply = await chat.userInput({
|
|
412
416
|
key: node.data.key,
|
|
@@ -431,12 +435,13 @@ async function interpretQuestionEnumNode({
|
|
|
431
435
|
async function interpretQuestionBooleanNode({
|
|
432
436
|
chat,
|
|
433
437
|
next,
|
|
434
|
-
node
|
|
438
|
+
node,
|
|
439
|
+
submissions
|
|
435
440
|
}) {
|
|
436
441
|
await chat.sendMessage({
|
|
437
442
|
author: "bot",
|
|
438
443
|
type: "text",
|
|
439
|
-
text: node.data.question
|
|
444
|
+
text: interpolateString(node.data.question, submissions)
|
|
440
445
|
});
|
|
441
446
|
const input = await chat.userInput({
|
|
442
447
|
key: node.data.key,
|
|
@@ -468,27 +473,205 @@ async function interpretQuestionBooleanNode({
|
|
|
468
473
|
}
|
|
469
474
|
next(node.nextId);
|
|
470
475
|
}
|
|
476
|
+
const dummyDivBecauseGoogleRequiresIt = document.createElement("div");
|
|
477
|
+
const keyToAddressComponnents = {
|
|
478
|
+
line1: ["street_number", "floor", "room", "premise"],
|
|
479
|
+
line2: ["subpremise", "street_address", "route"],
|
|
480
|
+
line3: ["sublocality", "neighborhood"],
|
|
481
|
+
city: ["locality", "postal_town"],
|
|
482
|
+
state: ["administrative_area_level_1"],
|
|
483
|
+
postcode: ["postal_code"],
|
|
484
|
+
country: ["country"]
|
|
485
|
+
};
|
|
486
|
+
const fieldMapKeys = Object.keys(keyToAddressComponnents);
|
|
471
487
|
async function interpretQuestionAddressNode({
|
|
472
488
|
chat,
|
|
473
489
|
next,
|
|
474
|
-
node
|
|
490
|
+
node,
|
|
491
|
+
logger
|
|
475
492
|
}) {
|
|
493
|
+
const {
|
|
494
|
+
google
|
|
495
|
+
} = window;
|
|
476
496
|
await chat.sendMessage({
|
|
477
497
|
author: "bot",
|
|
478
498
|
type: "text",
|
|
479
|
-
text:
|
|
499
|
+
text: node.data.question
|
|
480
500
|
});
|
|
481
|
-
|
|
501
|
+
const askForAddress = async (defaultValues) => {
|
|
502
|
+
const addressFields = [{
|
|
503
|
+
label: "Postcode",
|
|
504
|
+
key: node.data.keys.postcode,
|
|
505
|
+
optional: false,
|
|
506
|
+
defaultValue: defaultValues.postcode
|
|
507
|
+
}, {
|
|
508
|
+
label: "Line 1",
|
|
509
|
+
key: node.data.keys.line1,
|
|
510
|
+
optional: false,
|
|
511
|
+
defaultValue: defaultValues.line1
|
|
512
|
+
}, {
|
|
513
|
+
label: "Line 2",
|
|
514
|
+
key: node.data.keys.line2,
|
|
515
|
+
optional: true,
|
|
516
|
+
defaultValue: defaultValues.line2
|
|
517
|
+
}, {
|
|
518
|
+
label: "Line 3",
|
|
519
|
+
key: node.data.keys.line3,
|
|
520
|
+
optional: true,
|
|
521
|
+
defaultValue: defaultValues.line3
|
|
522
|
+
}, {
|
|
523
|
+
label: "City",
|
|
524
|
+
key: node.data.keys.city,
|
|
525
|
+
optional: false,
|
|
526
|
+
defaultValue: defaultValues.city
|
|
527
|
+
}, {
|
|
528
|
+
label: "State/County/Province",
|
|
529
|
+
key: node.data.keys.state,
|
|
530
|
+
optional: true,
|
|
531
|
+
defaultValue: defaultValues.state
|
|
532
|
+
}, {
|
|
533
|
+
label: "Country",
|
|
534
|
+
key: node.data.keys.country,
|
|
535
|
+
optional: false,
|
|
536
|
+
defaultValue: defaultValues.country
|
|
537
|
+
}];
|
|
538
|
+
for (const field of addressFields) {
|
|
539
|
+
await chat.sendMessage({
|
|
540
|
+
author: "bot",
|
|
541
|
+
type: "text",
|
|
542
|
+
text: field.label
|
|
543
|
+
});
|
|
544
|
+
const {
|
|
545
|
+
value
|
|
546
|
+
} = await chat.userInput({
|
|
547
|
+
type: "text",
|
|
548
|
+
key: field.key,
|
|
549
|
+
config: {
|
|
550
|
+
format: "text",
|
|
551
|
+
optional: field.optional,
|
|
552
|
+
defaultValue: field.defaultValue
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
if (value === null) {
|
|
556
|
+
await chat.sendMessage({
|
|
557
|
+
type: "system",
|
|
558
|
+
variant: "info",
|
|
559
|
+
text: "Skipped"
|
|
560
|
+
});
|
|
561
|
+
} else {
|
|
562
|
+
await chat.sendMessage({
|
|
563
|
+
author: "user",
|
|
564
|
+
type: "text",
|
|
565
|
+
text: value
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
if (!index.hasProp(window, "google") || !index.hasProp(window.google, "maps") || !index.hasProp(window.google.maps, "places")) {
|
|
571
|
+
logger.warn("Google maps not available, falling back to manual input.");
|
|
572
|
+
logger.info("If you’d like to use the address autocomplete, please insert the google maps API snippet in your website and make sure it has access to the *places* library.");
|
|
573
|
+
await askForAddress({});
|
|
574
|
+
return next(node.nextId);
|
|
575
|
+
}
|
|
576
|
+
const autocomplete = new google.maps.places.AutocompleteService();
|
|
577
|
+
const places = new google.maps.places.PlacesService(dummyDivBecauseGoogleRequiresIt);
|
|
578
|
+
const {
|
|
579
|
+
value: search
|
|
580
|
+
} = await chat.userInput({
|
|
581
|
+
type: "text",
|
|
582
|
+
key: "_internal-address-search",
|
|
583
|
+
config: {
|
|
584
|
+
format: "text",
|
|
585
|
+
optional: false,
|
|
586
|
+
placeholder: "Search for your address"
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
if (search === null)
|
|
590
|
+
return next(node.id);
|
|
591
|
+
await chat.sendMessage({
|
|
592
|
+
author: "user",
|
|
593
|
+
type: "text",
|
|
594
|
+
text: `Search for “${search}”`
|
|
595
|
+
});
|
|
596
|
+
const {
|
|
597
|
+
predictions
|
|
598
|
+
} = await autocomplete.getPlacePredictions({
|
|
599
|
+
input: search
|
|
600
|
+
});
|
|
601
|
+
const {
|
|
602
|
+
value: [selected]
|
|
603
|
+
} = await chat.userInput({
|
|
604
|
+
type: "multiple-choice",
|
|
605
|
+
key: void 0,
|
|
606
|
+
config: {
|
|
607
|
+
options: predictions.slice(0, 4).map((p) => ({
|
|
608
|
+
label: p.description,
|
|
609
|
+
value: p.place_id
|
|
610
|
+
})).concat({
|
|
611
|
+
label: "None of these",
|
|
612
|
+
value: "none"
|
|
613
|
+
}),
|
|
614
|
+
maxSelected: 1,
|
|
615
|
+
minSelected: 1
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
if (!selected || selected === "none") {
|
|
619
|
+
return next(node.id);
|
|
620
|
+
}
|
|
621
|
+
const result = await new Promise((resolve, reject) => places.getDetails({
|
|
622
|
+
placeId: selected,
|
|
623
|
+
fields: ["address_components"]
|
|
624
|
+
}, (result2, status) => {
|
|
625
|
+
if (status !== google.maps.places.PlacesServiceStatus["OK"])
|
|
626
|
+
return reject(status);
|
|
627
|
+
if (result2 === null)
|
|
628
|
+
return reject("ZERO_RESULTS");
|
|
629
|
+
return resolve({
|
|
630
|
+
ok: true,
|
|
631
|
+
place: result2
|
|
632
|
+
});
|
|
633
|
+
})).catch(async (e) => {
|
|
634
|
+
logger.error("Failed to get address details", e);
|
|
635
|
+
return {
|
|
636
|
+
ok: false
|
|
637
|
+
};
|
|
638
|
+
});
|
|
639
|
+
if (result.ok === false) {
|
|
640
|
+
await chat.sendMessage({
|
|
641
|
+
type: "system",
|
|
642
|
+
variant: "error",
|
|
643
|
+
text: "Failed to get address details"
|
|
644
|
+
});
|
|
645
|
+
await askForAddress({});
|
|
646
|
+
return next(node.id);
|
|
647
|
+
}
|
|
648
|
+
const addressComponents = result.place.address_components;
|
|
649
|
+
const autoFilledInputs = addressComponents ? fieldMapKeys.reduce((acc, key) => {
|
|
650
|
+
const componentTypes = keyToAddressComponnents[key];
|
|
651
|
+
const value = addressComponents.filter((component) => component.types.some((type) => componentTypes.includes(type))).map((component) => component.long_name).join(", ");
|
|
652
|
+
if (value) {
|
|
653
|
+
acc[key] = value;
|
|
654
|
+
}
|
|
655
|
+
return acc;
|
|
656
|
+
}, {}) : {};
|
|
657
|
+
await chat.sendMessage({
|
|
658
|
+
author: "bot",
|
|
659
|
+
type: "text",
|
|
660
|
+
text: "Please confirm or adjust your address:"
|
|
661
|
+
});
|
|
662
|
+
await askForAddress(autoFilledInputs);
|
|
663
|
+
return next(node.nextId);
|
|
482
664
|
}
|
|
483
665
|
async function interpretQuestionFileNode({
|
|
484
666
|
node,
|
|
485
667
|
chat,
|
|
486
|
-
next
|
|
668
|
+
next,
|
|
669
|
+
submissions
|
|
487
670
|
}) {
|
|
488
671
|
await chat.sendMessage({
|
|
489
672
|
author: "bot",
|
|
490
673
|
type: "text",
|
|
491
|
-
text: node.data.question
|
|
674
|
+
text: interpolateString(node.data.question, submissions)
|
|
492
675
|
});
|
|
493
676
|
const files = await chat.userInput({
|
|
494
677
|
key: node.data.key,
|
|
@@ -577,11 +760,33 @@ const isIfBlockConditionMet = (ifBlock, submissions) => {
|
|
|
577
760
|
}
|
|
578
761
|
}, () => false).exhaustive();
|
|
579
762
|
};
|
|
763
|
+
const interpolateString = (str, context) => {
|
|
764
|
+
const regex = /{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g;
|
|
765
|
+
return str.replace(regex, (match2, key, defaultValue = "") => {
|
|
766
|
+
key = key.trim();
|
|
767
|
+
const submission = context == null ? void 0 : context[key];
|
|
768
|
+
if (!submission)
|
|
769
|
+
return defaultValue;
|
|
770
|
+
switch (submission.type) {
|
|
771
|
+
case "boolean":
|
|
772
|
+
return submission.value === "true" ? "true" : "false";
|
|
773
|
+
case "file":
|
|
774
|
+
if (!submission.value)
|
|
775
|
+
return "no files";
|
|
776
|
+
return submission.value.map((file) => `${file.name} (${kbToReadableSize(file.sizeKb)})`).join(", ");
|
|
777
|
+
case "multiple-choice":
|
|
778
|
+
return submission.value.join(", ");
|
|
779
|
+
default:
|
|
780
|
+
return submission.value || defaultValue;
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
};
|
|
580
784
|
const SendButton = ({
|
|
581
785
|
class: className,
|
|
582
786
|
...props
|
|
583
787
|
}) => index.o("button", {
|
|
584
|
-
class: index.clsx("bg-accent-
|
|
788
|
+
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),
|
|
789
|
+
type: "submit",
|
|
585
790
|
...props,
|
|
586
791
|
children: index.o("svg", {
|
|
587
792
|
class: "block",
|
|
@@ -605,7 +810,8 @@ const SkipButton = ({
|
|
|
605
810
|
class: className,
|
|
606
811
|
...props
|
|
607
812
|
}) => index.o("button", {
|
|
608
|
-
|
|
813
|
+
type: "button",
|
|
814
|
+
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),
|
|
609
815
|
...props,
|
|
610
816
|
children: [index.o("svg", {
|
|
611
817
|
class: "block",
|
|
@@ -668,7 +874,7 @@ const ChatInputBoolean = ({
|
|
|
668
874
|
type: "submit",
|
|
669
875
|
name: FIELD_NAME,
|
|
670
876
|
value,
|
|
671
|
-
class: "bg-lowest ease-expo-out ring-
|
|
877
|
+
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
878
|
children: index.o("p", {
|
|
673
879
|
class: "truncate text-center text-base",
|
|
674
880
|
children: input.config.labels[value]
|
|
@@ -700,7 +906,7 @@ const InputError = ({
|
|
|
700
906
|
role: "alert",
|
|
701
907
|
class: "text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",
|
|
702
908
|
children: [index.o("svg", {
|
|
703
|
-
class: "text-error-
|
|
909
|
+
class: "text-error-9 h-4 w-4",
|
|
704
910
|
viewBox: "0 0 16 16",
|
|
705
911
|
fill: "none",
|
|
706
912
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -739,7 +945,6 @@ const toBase64 = (file) => new Promise((resolve, reject) => {
|
|
|
739
945
|
};
|
|
740
946
|
reader.onerror = reject;
|
|
741
947
|
});
|
|
742
|
-
const kbToReadableSize = (kb) => index.N(kb).with(index._.number.lte(1e3), () => `${Math.round(kb)}KB`).with(index._.number.lt(1e3 * 10), () => `${(kb / 1e3).toFixed(1)}MB`).otherwise(() => `${Math.round(kb / 1e3)}MB`);
|
|
743
948
|
const addFileSizesKb = (files) => files.reduce((acc, cur) => acc + cur.sizeKb, 0);
|
|
744
949
|
const isFileSubmission = isSubmissionOfType("file");
|
|
745
950
|
const FILENAMES_TO_SHOW_QTY = 3;
|
|
@@ -751,7 +956,7 @@ const FileThumbnail = ({
|
|
|
751
956
|
const extension = file.name.split(".").pop();
|
|
752
957
|
const fileName = file.name.replace(new RegExp(`.${extension}$`), "");
|
|
753
958
|
return index.o("div", {
|
|
754
|
-
class: index.clsx("bg-accent-1 outline-
|
|
959
|
+
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),
|
|
755
960
|
...props,
|
|
756
961
|
children: [index.o("p", {
|
|
757
962
|
"aria-label": "File name",
|
|
@@ -764,7 +969,7 @@ const FileThumbnail = ({
|
|
|
764
969
|
})]
|
|
765
970
|
}), index.o("p", {
|
|
766
971
|
"aria-label": "File size",
|
|
767
|
-
class: "text-
|
|
972
|
+
class: "text-accent-11",
|
|
768
973
|
children: kbToReadableSize(file.sizeKb)
|
|
769
974
|
})]
|
|
770
975
|
});
|
|
@@ -858,7 +1063,7 @@ const ChatInputFile = ({
|
|
|
858
1063
|
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"
|
|
859
1064
|
})
|
|
860
1065
|
}), index.o("p", {
|
|
861
|
-
class: "text-neutral-12 tracking-[-0.01em]
|
|
1066
|
+
class: "text-neutral-12 tracking-[-0.01em]",
|
|
862
1067
|
children: [input.config.allowMultiple ? "Select files" : "Select a file", " to upload"]
|
|
863
1068
|
}), input.config.fileSizeLimitKib ? index.o("p", {
|
|
864
1069
|
class: "text-neutral-10 text-xs",
|
|
@@ -2424,7 +2629,7 @@ const ChatInputMultipleChoice = ({
|
|
|
2424
2629
|
resolver: getResolver$1(input.config)
|
|
2425
2630
|
});
|
|
2426
2631
|
const focusRef = useFocusOnMount();
|
|
2427
|
-
const isSingleChoice = input.config.minSelected === 1 && input.config.maxSelected === 1;
|
|
2632
|
+
const isSingleChoice = (input.config.minSelected === 1 || input.config.minSelected === void 0) && input.config.maxSelected === 1;
|
|
2428
2633
|
return index.o("form", {
|
|
2429
2634
|
noValidate: true,
|
|
2430
2635
|
class: "flex flex-col gap-1 pr-2.5",
|
|
@@ -2467,7 +2672,7 @@ const ChatInputMultipleChoice = ({
|
|
|
2467
2672
|
class: "peer sr-only h-full",
|
|
2468
2673
|
type: "checkbox"
|
|
2469
2674
|
}), index.o("label", {
|
|
2470
|
-
class: "bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-
|
|
2675
|
+
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",
|
|
2471
2676
|
htmlFor: id,
|
|
2472
2677
|
children: option.label
|
|
2473
2678
|
})]
|
|
@@ -2532,6 +2737,7 @@ const ChatInputText = ({
|
|
|
2532
2737
|
}) => {
|
|
2533
2738
|
var _a;
|
|
2534
2739
|
const submission = input.key ? (_a = index.application.current$.value.application) == null ? void 0 : _a.data.submissions[input.key] : void 0;
|
|
2740
|
+
const defaultValue = input.config.defaultValue;
|
|
2535
2741
|
const {
|
|
2536
2742
|
register,
|
|
2537
2743
|
handleSubmit,
|
|
@@ -2540,7 +2746,7 @@ const ChatInputText = ({
|
|
|
2540
2746
|
}
|
|
2541
2747
|
} = useForm({
|
|
2542
2748
|
defaultValues: {
|
|
2543
|
-
text: isTextSubmission(submission) ? submission.value : ""
|
|
2749
|
+
text: defaultValue ? defaultValue : isTextSubmission(submission) ? submission.value : ""
|
|
2544
2750
|
},
|
|
2545
2751
|
resolver: getResolver(input.config)
|
|
2546
2752
|
});
|
|
@@ -2582,7 +2788,7 @@ const ChatInputText = ({
|
|
|
2582
2788
|
}
|
|
2583
2789
|
setRef(element);
|
|
2584
2790
|
},
|
|
2585
|
-
class: "outline-
|
|
2791
|
+
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
2792
|
placeholder: input.config.placeholder
|
|
2587
2793
|
}), input.config.optional && index.o(SkipButton, {
|
|
2588
2794
|
class: "absolute right-0 top-0",
|
|
@@ -2626,10 +2832,10 @@ const ChatInput = ({
|
|
|
2626
2832
|
height: 0,
|
|
2627
2833
|
opacity: 0
|
|
2628
2834
|
},
|
|
2629
|
-
class: "bg-
|
|
2835
|
+
class: "bg-statusbar absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-md backdrop-saturate-150",
|
|
2630
2836
|
children: index.o("div", {
|
|
2631
2837
|
ref: inputWrapperRef,
|
|
2632
|
-
class: "border-
|
|
2838
|
+
class: "border-divider border-t",
|
|
2633
2839
|
children: index.N({
|
|
2634
2840
|
application: index.application,
|
|
2635
2841
|
input,
|
|
@@ -2641,7 +2847,7 @@ const ChatInput = ({
|
|
|
2641
2847
|
children: [index.o("input", {
|
|
2642
2848
|
"aria-hidden": "true",
|
|
2643
2849
|
id: "chat-input",
|
|
2644
|
-
class: "outline-
|
|
2850
|
+
class: "outline-divider flex-grow rounded-full bg-transparent px-3 py-1 text-base outline outline-2",
|
|
2645
2851
|
disabled: true
|
|
2646
2852
|
}), index.o(SendButton, {
|
|
2647
2853
|
disabled: true,
|
|
@@ -2724,11 +2930,11 @@ const cva = (base, config) => {
|
|
|
2724
2930
|
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2725
2931
|
};
|
|
2726
2932
|
};
|
|
2727
|
-
const chatBubbleVariants = cva("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink
|
|
2933
|
+
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", {
|
|
2728
2934
|
variants: {
|
|
2729
2935
|
side: {
|
|
2730
|
-
left: "bg-
|
|
2731
|
-
right: "ml-auto bg-accent-
|
|
2936
|
+
left: "bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",
|
|
2937
|
+
right: "ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"
|
|
2732
2938
|
},
|
|
2733
2939
|
transitionState: {
|
|
2734
2940
|
entering: "opacity-0 translate-y-8",
|
|
@@ -2791,7 +2997,7 @@ const TypingIndicator = ({
|
|
|
2791
2997
|
children: Array.from({
|
|
2792
2998
|
length: 3
|
|
2793
2999
|
}, (_, i2) => index.o("div", {
|
|
2794
|
-
class: "bg-accent-
|
|
3000
|
+
class: "bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",
|
|
2795
3001
|
style: {
|
|
2796
3002
|
animationDelay: `${-i2 * 200}ms`
|
|
2797
3003
|
}
|
|
@@ -2802,7 +3008,7 @@ const authorToSide = {
|
|
|
2802
3008
|
bot: "left",
|
|
2803
3009
|
user: "right"
|
|
2804
3010
|
};
|
|
2805
|
-
const systemMessageStyle = cva("w-full select-none py-2 text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.
|
|
3011
|
+
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)]", {
|
|
2806
3012
|
variants: {
|
|
2807
3013
|
variant: {
|
|
2808
3014
|
info: "text-neutral-8",
|
|
@@ -2812,7 +3018,7 @@ const systemMessageStyle = cva("w-full select-none py-2 text-center text-[10px]
|
|
|
2812
3018
|
}
|
|
2813
3019
|
}
|
|
2814
3020
|
});
|
|
2815
|
-
const
|
|
3021
|
+
const Conversation = ({
|
|
2816
3022
|
messages,
|
|
2817
3023
|
isBotTyping
|
|
2818
3024
|
}) => {
|
|
@@ -2842,9 +3048,9 @@ const JobApplicationMessages = ({
|
|
|
2842
3048
|
type: "link"
|
|
2843
3049
|
}, (message2) => {
|
|
2844
3050
|
return index.o("div", {
|
|
2845
|
-
class: "bg-accent-
|
|
3051
|
+
class: "bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl py-2",
|
|
2846
3052
|
children: index.o("a", {
|
|
2847
|
-
class: "bg-lowest shadow-surface-sm ring-accent-
|
|
3053
|
+
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",
|
|
2848
3054
|
target: "_blank",
|
|
2849
3055
|
href: message2.href,
|
|
2850
3056
|
children: [message2.text, index.o("svg", {
|
|
@@ -3066,7 +3272,7 @@ const JobApplicationContent = ({
|
|
|
3066
3272
|
paddingBottom: index.inputHeight.value
|
|
3067
3273
|
},
|
|
3068
3274
|
children: index.o(index.AnimatePresence, {
|
|
3069
|
-
children: index.o(
|
|
3275
|
+
children: index.o(Conversation, {
|
|
3070
3276
|
isBotTyping,
|
|
3071
3277
|
messages: currentApplication.data.messages
|
|
3072
3278
|
})
|
package/dist/plugin-chatbot.cjs
CHANGED
package/dist/plugin-chatbot.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inploi/plugin-chatbot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.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": "^
|
|
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,7 +31,9 @@
|
|
|
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
|
+
"@types/google.maps": "^3.55.4",
|
|
36
37
|
"@types/node": "^20.10.0",
|
|
37
38
|
"@types/react-transition-group": "^4.4.9",
|
|
38
39
|
"autoprefixer": "^10.4.16",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"dotenv": "^16.3.1",
|
|
44
45
|
"eslint": "^7.32.0",
|
|
45
46
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
47
|
+
"eslint-plugin-tailwindcss": "^3.14.1",
|
|
46
48
|
"happy-dom": "^12.6.0",
|
|
47
49
|
"idb-keyval": "^6.2.1",
|
|
48
50
|
"msw": "^2.0.10",
|
|
@@ -63,7 +65,8 @@
|
|
|
63
65
|
"vite": "^4.4.5",
|
|
64
66
|
"vite-plugin-dts": "^3.7.0",
|
|
65
67
|
"vite-tsconfig-paths": "^4.2.1",
|
|
66
|
-
"@inploi/core": "1.11.
|
|
68
|
+
"@inploi/core": "1.11.5",
|
|
69
|
+
"@inploi/design-tokens": "0.2.0",
|
|
67
70
|
"@inploi/sdk": "1.11.4",
|
|
68
71
|
"eslint-config-custom": "0.1.0",
|
|
69
72
|
"tsconfig": "0.1.0"
|