@inploi/plugin-chatbot 2.1.0 → 2.1.1

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.
Files changed (56) hide show
  1. package/cdn/index.js +56 -0
  2. package/package.json +14 -3
  3. package/.env +0 -2
  4. package/.env.example +0 -2
  5. package/.env.test +0 -2
  6. package/.eslintrc.cjs +0 -10
  7. package/CHANGELOG.md +0 -91
  8. package/bunfig.toml +0 -2
  9. package/happydom.ts +0 -10
  10. package/index.html +0 -29
  11. package/playwright.config.ts +0 -82
  12. package/postcss.config.cjs +0 -7
  13. package/src/chatbot.api.ts +0 -46
  14. package/src/chatbot.constants.ts +0 -9
  15. package/src/chatbot.css +0 -93
  16. package/src/chatbot.dom.ts +0 -28
  17. package/src/chatbot.idb.ts +0 -17
  18. package/src/chatbot.state.ts +0 -114
  19. package/src/chatbot.ts +0 -59
  20. package/src/chatbot.utils.ts +0 -56
  21. package/src/index.cdn.ts +0 -12
  22. package/src/index.dev.ts +0 -31
  23. package/src/index.ts +0 -1
  24. package/src/interpreter/interpreter.test.ts +0 -69
  25. package/src/interpreter/interpreter.ts +0 -249
  26. package/src/mocks/browser.ts +0 -5
  27. package/src/mocks/example.flows.ts +0 -801
  28. package/src/mocks/handlers.ts +0 -57
  29. package/src/style/palette.test.ts +0 -20
  30. package/src/style/palette.ts +0 -69
  31. package/src/ui/chat-bubble.tsx +0 -51
  32. package/src/ui/chat-input/chat-input.boolean.tsx +0 -62
  33. package/src/ui/chat-input/chat-input.file.tsx +0 -213
  34. package/src/ui/chat-input/chat-input.multiple-choice.tsx +0 -117
  35. package/src/ui/chat-input/chat-input.text.tsx +0 -111
  36. package/src/ui/chat-input/chat-input.tsx +0 -81
  37. package/src/ui/chatbot-header.tsx +0 -95
  38. package/src/ui/chatbot.tsx +0 -94
  39. package/src/ui/input-error.tsx +0 -33
  40. package/src/ui/job-application-content.tsx +0 -144
  41. package/src/ui/job-application-messages.tsx +0 -64
  42. package/src/ui/loading-indicator.tsx +0 -37
  43. package/src/ui/send-button.tsx +0 -27
  44. package/src/ui/transition.tsx +0 -1
  45. package/src/ui/typing-indicator.tsx +0 -12
  46. package/src/ui/useChatService.ts +0 -67
  47. package/src/ui/useFocus.ts +0 -10
  48. package/src/vite-env.d.ts +0 -1
  49. package/tailwind.config.ts +0 -119
  50. package/tests/integration.spec.ts +0 -19
  51. package/tests/test.ts +0 -22
  52. package/tsconfig.json +0 -33
  53. package/tsconfig.node.json +0 -10
  54. package/types.d.ts +0 -2
  55. package/vite.config.ts +0 -18
  56. /package/{public → cdn}/mockServiceWorker.js +0 -0
@@ -1,801 +0,0 @@
1
- import { FlowNode } from '@inploi/core/flows';
2
-
3
- export const automatedTestFlow: FlowNode[] = [
4
- {
5
- id: '1',
6
- type: 'text',
7
- data: {
8
- text: 'Text node',
9
- },
10
- isHead: true,
11
- },
12
- ];
13
-
14
- const textOnly: FlowNode[] = [
15
- {
16
- id: '443c2374-13d1-4b02-b2ed-17f148d2a3da',
17
- isHead: true,
18
- nextId: '5df04ee2-b786-4df6-874b-9d1c740363d9',
19
- type: 'question-boolean',
20
- data: {
21
- key: 'like',
22
- question: 'do u hate cats',
23
- trueLabel: 'Yes',
24
- falseLabel: 'No',
25
- },
26
- },
27
- {
28
- id: '5df04ee2-b786-4df6-874b-9d1c740363d9',
29
- nextId: 'b6060696-ebb5-4b17-9d88-470394ccd1d3',
30
- type: 'if-block',
31
- data: {
32
- compareKey: 'like',
33
- compareValue: 'true',
34
- compare: 'equals',
35
- },
36
- branchId: 'f94662b2-5229-4602-bc4e-d84666a56a25',
37
- },
38
- {
39
- id: '801ccc8c-d5db-4864-9b89-1465c014e20e',
40
- nextId: '042a8657-132d-4eb7-be4e-c1d300ecc538',
41
- type: 'text',
42
- data: {
43
- text: 'nice',
44
- },
45
- },
46
- {
47
- id: 'fec23e69-ef6c-4ae5-b10a-11104d36158c',
48
- nextId: '801ccc8c-d5db-4864-9b89-1465c014e20e',
49
- type: 'question-boolean',
50
- data: {
51
- key: 'free-will',
52
- question: 'do you have free will?',
53
- trueLabel: 'Yes',
54
- falseLabel: 'No',
55
- },
56
- },
57
- {
58
- id: 'b6060696-ebb5-4b17-9d88-470394ccd1d3',
59
- nextId: 'fec23e69-ef6c-4ae5-b10a-11104d36158c',
60
- type: 'text',
61
- data: {
62
- text: 'nice youre a decent person',
63
- },
64
- },
65
- {
66
- id: 'f94662b2-5229-4602-bc4e-d84666a56a25',
67
- type: 'abandon-flow',
68
- data: {
69
- text: 'you cant hate cats to work here',
70
- redirectUrl: '',
71
- cta: '',
72
- },
73
- },
74
- {
75
- id: '042a8657-132d-4eb7-be4e-c1d300ecc538',
76
- type: 'complete-flow',
77
- data: {
78
- text: "we'll hire you",
79
- submitCta: 'submit',
80
- },
81
- },
82
- ];
83
-
84
- const fromAlex: FlowNode[] = [
85
- {
86
- id: 'intro-message',
87
- isHead: true,
88
- nextId: 'email-address',
89
- type: 'text',
90
- data: {
91
- text: "Hey, welcome to this flows editor test.\nWe'll be recreating a wagamama flow.",
92
- },
93
- },
94
- {
95
- id: 'email-address',
96
- nextId: 'phone-number',
97
- type: 'question-text',
98
- data: {
99
- key: 'email',
100
- question: "What is your email?\n(I'm testing email validation here)",
101
- placeholder: 'example@domain.com',
102
- format: 'email',
103
- },
104
- },
105
- {
106
- id: 'phone-number',
107
- nextId: 'option-age',
108
- type: 'question-text',
109
- data: {
110
- key: 'phone',
111
- question: "What is your phone number? (I'm testing phone validation)",
112
- placeholder: '07674948572',
113
- format: 'phone',
114
- },
115
- },
116
- {
117
- id: 'option-age',
118
- nextId: 'age-condition',
119
- type: 'question-boolean',
120
- data: {
121
- key: 'age',
122
- question: 'You may be required to serve alcohol, are you over the age of 16?',
123
- trueLabel: 'Yes',
124
- falseLabel: 'No',
125
- },
126
- },
127
- {
128
- id: 'age-condition',
129
- nextId: 'option-right-to-work',
130
- type: 'if-block',
131
- data: {
132
- compareKey: 'age',
133
- compare: 'equals',
134
- compareValue: 'false',
135
- },
136
- branchId: 'too-young',
137
- },
138
- {
139
- id: 'too-young',
140
- type: 'abandon-flow',
141
- data: {
142
- text: "unfortunately we are unable to progress with your application. once you've reached 16 years old and school leaving age (normally the june in the year you leave school) please do apply again with us. we'd love to hear from you again in the future",
143
- redirectUrl: 'jobs.wagamama.uk',
144
- cta: 'Career hub test',
145
- },
146
- },
147
- {
148
- id: 'option-right-to-work',
149
- nextId: 'rtw-branch',
150
- type: 'question-boolean',
151
- data: {
152
- key: 'right-to-work',
153
- question: 'do you currently live in the uk + do you have valid right to work in the uk?',
154
- trueLabel: 'Yes',
155
- falseLabel: 'No',
156
- },
157
- },
158
- {
159
- id: 'rtw-branch',
160
- nextId: 'option-hours',
161
- type: 'if-block',
162
- data: {
163
- compareKey: 'right-to-work',
164
- compare: 'equals',
165
- compareValue: 'false',
166
- },
167
- branchId: 'no-rtw',
168
- },
169
- {
170
- id: 'no-rtw',
171
- type: 'abandon-flow',
172
- data: {
173
- text: 'unfortunately we cannot progress with your application as we require you to live + have right to work in the uk to join the wagamama family. if your circumstances change please do feel free to apply again in the future 🙂',
174
- },
175
- },
176
- {
177
- id: 'option-hours',
178
- nextId: 'option-anyday2',
179
- type: 'question-enum',
180
- data: {
181
- key: 'hours',
182
- question: 'how many hours are you looking to work? ⏰',
183
- options: [
184
- {
185
- label: '5-10 hours',
186
- value: '5-10 hours',
187
- },
188
- {
189
- label: '10-20 hours',
190
- value: '10-20 hours',
191
- },
192
- {
193
- label: '20-30 hours',
194
- value: '20-30 hours',
195
- },
196
- {
197
- label: '30+ hours',
198
- value: '30+ hours',
199
- },
200
- ],
201
- maxSelected: 3,
202
- minSelected: 1,
203
- },
204
- },
205
- {
206
- id: 'option-anyday2',
207
- nextId: 'branch-availability',
208
- type: 'question-enum',
209
- data: {
210
- key: 'anyday',
211
- question: 'are you fully available anyday anytime?',
212
- options: [
213
- {
214
- label: 'anyday anytime',
215
- value: 'anyday anytime',
216
- },
217
- {
218
- label: 'provide my availability',
219
- value: 'provide my availability',
220
- },
221
- ],
222
- maxSelected: 1,
223
- minSelected: 1,
224
- },
225
- },
226
- {
227
- id: 'branch-availability',
228
- nextId: 'worked-before',
229
- type: 'if-block',
230
- data: {
231
- compareKey: 'anyday',
232
- compare: 'equals',
233
- compareValue: 'provide my availability',
234
- },
235
- branchId: 'option-morning',
236
- },
237
- {
238
- id: 'option-morning',
239
- nextId: 'option-afternoons',
240
- type: 'question-enum',
241
- data: {
242
- key: 'morning',
243
- question:
244
- 'what days are you available to work mornings? (usually between 7am-12pm but we can be flexible) select all that apply',
245
- options: [
246
- {
247
- label: 'monday',
248
- value: 'monday',
249
- },
250
- {
251
- label: 'tuesday',
252
- value: 'tuesday',
253
- },
254
- {
255
- label: 'wednesday',
256
- value: 'wednesday',
257
- },
258
- {
259
- label: 'thursday',
260
- value: 'thursday',
261
- },
262
- {
263
- label: 'friday',
264
- value: 'friday',
265
- },
266
- {
267
- label: 'saturday',
268
- value: 'saturday',
269
- },
270
- {
271
- label: 'sunday',
272
- value: 'sunday',
273
- },
274
- ],
275
- maxSelected: 1,
276
- minSelected: 1,
277
- },
278
- },
279
- {
280
- id: 'option-afternoons',
281
- nextId: 'option-evenings',
282
- type: 'question-enum',
283
- data: {
284
- key: 'afternoon',
285
- question:
286
- 'what days are you available to work afternoons? (usually between 12pm-4pm but we can be flexible) select all that apply',
287
- options: [
288
- {
289
- label: 'monday',
290
- value: 'monday',
291
- },
292
- {
293
- label: 'tuesday',
294
- value: 'tuesday',
295
- },
296
- {
297
- label: 'wednesday',
298
- value: 'wednesday',
299
- },
300
- {
301
- label: 'thursday',
302
- value: 'thursday',
303
- },
304
- {
305
- label: 'friday',
306
- value: 'friday',
307
- },
308
- {
309
- label: 'saturday',
310
- value: 'saturday',
311
- },
312
- {
313
- label: 'sunday',
314
- value: 'sunday',
315
- },
316
- ],
317
- maxSelected: 1,
318
- minSelected: 1,
319
- },
320
- },
321
- {
322
- id: 'option-evenings',
323
- type: 'question-enum',
324
- data: {
325
- key: 'evening',
326
- question:
327
- 'what days are you available to work evenings? (usually between 4pm-onwards but we can be flexible) select all that apply',
328
- options: [
329
- {
330
- label: 'monday',
331
- value: 'monday',
332
- },
333
- {
334
- label: 'tuesday',
335
- value: 'tuesday',
336
- },
337
- {
338
- label: 'wednesday',
339
- value: 'wednesday',
340
- },
341
- {
342
- label: 'thursday',
343
- value: 'thursday',
344
- },
345
- {
346
- label: 'friday',
347
- value: 'friday',
348
- },
349
- {
350
- label: 'saturday',
351
- value: 'saturday',
352
- },
353
- {
354
- label: 'sunday',
355
- value: 'sunday',
356
- },
357
- ],
358
- maxSelected: 1,
359
- minSelected: 1,
360
- },
361
- },
362
- {
363
- id: 'worked-before',
364
- nextId: 'worked-condition',
365
- type: 'question-boolean',
366
- data: {
367
- key: 'worked-before',
368
- question:
369
- 'have you ever worked for wagamama or the restaurant group (frankie + bennys, chiquito, firejacks, coast to coast, brunning + price, barburrito) before?',
370
- trueLabel: 'yes',
371
- falseLabel: 'no',
372
- },
373
- },
374
- {
375
- id: 'worked-condition',
376
- nextId: 'option-referred',
377
- type: 'if-block',
378
- data: {
379
- compareKey: 'worked-before',
380
- compare: 'equals',
381
- compareValue: 'true',
382
- },
383
- branchId: 'options-worked',
384
- },
385
- {
386
- id: 'options-worked',
387
- type: 'question-enum',
388
- data: {
389
- key: 'worked-before',
390
- question: 'please tell us who',
391
- options: [
392
- {
393
- label: 'wagamama',
394
- value: 'wagamama',
395
- },
396
- {
397
- label: 'frankie + bennys',
398
- value: 'frankie + bennys',
399
- },
400
- {
401
- label: 'chiquito',
402
- value: 'chiquito',
403
- },
404
- {
405
- label: 'firejacks',
406
- value: 'firejacks',
407
- },
408
- {
409
- label: 'coast to coast',
410
- value: 'coast to coast',
411
- },
412
- {
413
- label: 'brunning + price',
414
- value: 'brunning + price',
415
- },
416
- {
417
- label: 'barburrito',
418
- value: 'barburrito',
419
- },
420
- ],
421
- maxSelected: 1,
422
- minSelected: 1,
423
- },
424
- nextId: 'option-referred',
425
- },
426
- {
427
- id: 'option-referred',
428
- nextId: 'referred-branch',
429
- type: 'question-boolean',
430
- data: {
431
- key: 'referred',
432
- question: 'are you being referred by one of our current employees?',
433
- trueLabel: 'yes',
434
- falseLabel: 'no',
435
- },
436
- },
437
- {
438
- id: 'referred-branch',
439
- nextId: 'why-wagamama',
440
- type: 'if-block',
441
- data: {
442
- compareKey: 'referred',
443
- compare: 'equals',
444
- compareValue: 'true',
445
- },
446
- branchId: 'referrer',
447
- },
448
- {
449
- id: 'referrer',
450
- type: 'question-text',
451
- nextId: 'why-wagamama',
452
- data: {
453
- key: 'referrer',
454
- question: 'cool, what is their full name? 👨🏼‍🍳',
455
- placeholder: 'name lastname',
456
- format: 'text',
457
- },
458
- },
459
- {
460
- id: 'why-wagamama',
461
- nextId: 'require-support',
462
- type: 'question-text',
463
- data: {
464
- key: 'why-wagamama',
465
- question: 'why do you want to work for wagamama?',
466
- format: 'text',
467
- },
468
- },
469
- {
470
- id: 'require-support',
471
- nextId: 'support-yes',
472
- type: 'question-boolean',
473
- data: {
474
- key: 'require-support',
475
- question: 'do you require any support or reasonable adjustments if invited for interview?',
476
- trueLabel: 'yes',
477
- falseLabel: 'no',
478
- },
479
- },
480
- {
481
- id: 'support-yes',
482
- nextId: 'cv-question',
483
- type: 'if-block',
484
- data: {
485
- compareKey: 'require-support',
486
- compare: 'equals',
487
- compareValue: 'true',
488
- },
489
- branchId: 'what-support',
490
- },
491
- {
492
- id: 'what-support',
493
- type: 'question-text',
494
- data: {
495
- key: 'what-support',
496
- question: 'what support do you need?',
497
- format: 'text',
498
- },
499
- nextId: 'cv-question',
500
- },
501
- {
502
- id: 'cv-question',
503
- nextId: 'cv-branch',
504
- type: 'question-boolean',
505
- data: {
506
- key: 'cv-question',
507
- question: 'would you like to submit a cv? this is optional',
508
- trueLabel: 'yes',
509
- falseLabel: 'no',
510
- },
511
- },
512
- {
513
- id: 'cv-branch',
514
- nextId: 'cv-no',
515
- type: 'if-block',
516
- data: {
517
- compareKey: 'cv-question',
518
- compare: 'equals',
519
- compareValue: 'true',
520
- },
521
- branchId: 'cv-upload',
522
- },
523
- {
524
- id: 'cv-upload',
525
- type: 'question-file',
526
- data: {
527
- key: 'cv-upload',
528
- question: 'please upload your cv',
529
- extensions: ['.pdf', '.docx'],
530
- },
531
- nextId: 'recent-job',
532
- },
533
- {
534
- id: 'cv-no',
535
- nextId: 'complete',
536
- type: 'if-block',
537
- data: {
538
- compareKey: 'cv-question',
539
- compare: 'equals',
540
- compareValue: 'false',
541
- },
542
- branchId: 'recent-job',
543
- },
544
- {
545
- id: 'recent-job',
546
- type: 'question-text',
547
- nextId: 'complete',
548
- data: {
549
- key: 'recent-job',
550
- question:
551
- "if you aren't able to provide a cv, tell us a little more about your most recent role + company, education or other roles that may support your application",
552
- format: 'text',
553
- },
554
- },
555
- {
556
- id: 'complete',
557
- type: 'complete-flow',
558
- data: {
559
- text: "Congrats, you've finished the flow!",
560
- submitCta: 'Submit',
561
- },
562
- },
563
- ];
564
-
565
- const byClaude: FlowNode[] = [
566
- {
567
- id: 'file',
568
- isHead: true,
569
- type: 'question-file',
570
- data: {
571
- extensions: ['.jpg', '.png', '.gif', '.mp4', '.pdf', '.jpeg', '.exe'],
572
- multiple: true,
573
- maxSizeKb: 10000,
574
- key: 'file',
575
- question: 'Go ahead upload a picture',
576
- },
577
- nextId: 'intro',
578
- },
579
- {
580
- id: 'intro',
581
- type: 'text',
582
- data: {
583
- text: 'Welcome to our chef application flow!',
584
- },
585
-
586
- nextId: 'ertyerty',
587
- },
588
- {
589
- type: 'image',
590
- id: 'ertyerty',
591
- data: {
592
- height: 500,
593
- url: 'https://placekitten.com/500/500',
594
- width: 500,
595
- },
596
- nextId: 'q',
597
- },
598
- {
599
- id: 'q',
600
- type: 'question-boolean',
601
- data: {
602
- key: 'question',
603
- question: 'Do you want to continue?',
604
- falseLabel: 'Nah just end it man, Im exhausted of writing a very long option name to break it',
605
- trueLabel: 'Yeah pls',
606
- },
607
- nextId: 'if',
608
- },
609
- {
610
- id: 'if',
611
- type: 'if-block',
612
- data: {
613
- compareKey: 'question',
614
- compare: 'contains',
615
- compareValue: 'true',
616
- },
617
- branchId: 'name',
618
- nextId: 'nop',
619
- },
620
- {
621
- id: 'nop',
622
- type: 'abandon-flow',
623
- data: {
624
- text: "You said no, so we're ending the flow here.",
625
- },
626
- },
627
- {
628
- id: 'name',
629
- type: 'question-text',
630
- data: {
631
- key: 'first_name',
632
- question: 'What is your first name?',
633
- placeholder: 'John',
634
- format: 'text',
635
- },
636
- nextId: 'email',
637
- },
638
- {
639
- id: 'email',
640
- type: 'question-text',
641
- data: {
642
- key: 'email',
643
- question: 'What is your email?',
644
- placeholder: 'Doe',
645
- format: 'email',
646
- },
647
- nextId: 'phone',
648
- },
649
- {
650
- id: 'phone',
651
- type: 'question-text',
652
- data: {
653
- key: 'phone',
654
- question: 'What is your phone number?',
655
- placeholder: 'Doe',
656
- format: 'phone',
657
- },
658
- nextId: 'portfolio',
659
- },
660
- {
661
- id: 'portfolio',
662
- type: 'question-text',
663
- data: {
664
- key: 'portfolio',
665
- question: 'What is your portfolio URL?',
666
- placeholder: 'Doe',
667
- format: 'url',
668
- },
669
- nextId: 'experience',
670
- },
671
- {
672
- id: 'experience',
673
- type: 'question-text',
674
- data: {
675
- key: 'experience_years',
676
- question: 'How many years of chef experience do you have?',
677
- format: 'text',
678
- },
679
- nextId: 'cuisine',
680
- },
681
- {
682
- id: 'cuisine',
683
- type: 'question-enum',
684
- data: {
685
- key: 'cuisine',
686
- question: 'What cuisine do you specialize in?',
687
- maxSelected: 3,
688
- minSelected: 1,
689
- options: [
690
- { label: 'Italian', value: 'italian' },
691
- { label: 'French', value: 'french' },
692
- { label: 'Japanese', value: 'japanese' },
693
- { label: 'Chinese', value: 'chinese' },
694
- { label: 'Indian', value: 'indian' },
695
- { label: 'Thai', value: 'thai' },
696
- { label: 'Mexican', value: 'mexican' },
697
- { label: 'Spanish', value: 'spanish' },
698
- { label: 'Greek', value: 'greek' },
699
- { label: 'Turkish', value: 'turkish' },
700
- { label: 'Lebanese', value: 'lebanese' },
701
- { label: 'Other', value: 'other' },
702
- ],
703
- },
704
- nextId: 'end-q',
705
- },
706
- {
707
- id: 'end-q',
708
- type: 'question-boolean',
709
- data: {
710
- key: 'end',
711
- question: 'Do you want to end the flow or go back to the start?',
712
- falseLabel: 'Back to start',
713
- trueLabel: 'End',
714
- },
715
- nextId: 'end-if',
716
- },
717
- {
718
- id: 'end-if',
719
- type: 'if-block',
720
- data: {
721
- compareKey: 'end',
722
- compare: 'contains',
723
- compareValue: 'true',
724
- },
725
- branchId: 'end',
726
- nextId: 'loop',
727
- },
728
- {
729
- id: 'loop',
730
- type: 'jump',
731
- data: {
732
- targetId: 'intro',
733
- },
734
- },
735
- {
736
- id: 'end',
737
- type: 'complete-flow',
738
- data: {
739
- text: 'Thanks for applying! We will review your application soon.',
740
- },
741
- },
742
- ];
743
-
744
- const helloWorld: FlowNode[] = [
745
- {
746
- type: 'text',
747
- id: '1',
748
- isHead: true,
749
- data: {
750
- text: 'Hello world!',
751
- },
752
- nextId: '2',
753
- },
754
- {
755
- type: 'image',
756
- id: '2',
757
- isHead: false,
758
- data: {
759
- height: 500,
760
- url: 'https://placekitten.com/500/500',
761
- width: 500,
762
- },
763
- nextId: '3',
764
- },
765
- {
766
- type: 'text',
767
- id: '3',
768
- isHead: false,
769
- data: {
770
- text: 'Here you will find much joy',
771
- },
772
- nextId: '4',
773
- },
774
- {
775
- type: 'question-text',
776
- id: '4',
777
- isHead: false,
778
- data: {
779
- key: 'cats',
780
- question: 'Do you like cats?',
781
- format: 'text',
782
- placeholder: 'Type your answer here',
783
- },
784
- nextId: '5',
785
- },
786
- {
787
- type: 'complete-flow',
788
- id: '5',
789
- isHead: false,
790
- data: {
791
- text: 'Done!',
792
- },
793
- },
794
- ];
795
-
796
- export const exampleFlows = {
797
- byClaude,
798
- helloWorld,
799
- textOnly,
800
- fromAlex,
801
- };