@kindly/react-chat 2.36.1 → 2.37.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kindly/react-chat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.37.2",
|
|
4
4
|
"description": "Kindly Chat react component",
|
|
5
5
|
"repository": "https://github.com/kindly-ai/kindly-chat/tree/main/packages/react-chat",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
"phoenix-socket": "^1.2.3",
|
|
40
40
|
"polished": "^3.4.3",
|
|
41
41
|
"prop-types": "^15.7.2",
|
|
42
|
+
"react-children-utilities": "^2.8.0",
|
|
43
|
+
"react-hook-form": "^7.32.2",
|
|
42
44
|
"react-idle-timer": "^4.2.12",
|
|
43
45
|
"react-redux": "^7.1.1",
|
|
44
46
|
"react-shadow": "^18.0.1",
|
|
@@ -57,29 +59,29 @@
|
|
|
57
59
|
"react-dom": ">=16.9.0"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
|
-
"@babel/core": "^7.18.
|
|
61
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
62
|
-
"@babel/plugin-transform-runtime": "^7.18.
|
|
63
|
-
"@babel/preset-env": "^7.18.
|
|
64
|
-
"@babel/preset-react": "^7.
|
|
65
|
-
"@storybook/addon-actions": "^6.5.
|
|
66
|
-
"@storybook/addon-essentials": "^6.5.
|
|
67
|
-
"@storybook/addon-interactions": "^6.5.
|
|
68
|
-
"@storybook/addon-links": "^6.5.
|
|
69
|
-
"@storybook/builder-webpack4": "^6.5.
|
|
62
|
+
"@babel/core": "^7.18.10",
|
|
63
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
64
|
+
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
65
|
+
"@babel/preset-env": "^7.18.10",
|
|
66
|
+
"@babel/preset-react": "^7.18.6",
|
|
67
|
+
"@storybook/addon-actions": "^6.5.10",
|
|
68
|
+
"@storybook/addon-essentials": "^6.5.10",
|
|
69
|
+
"@storybook/addon-interactions": "^6.5.10",
|
|
70
|
+
"@storybook/addon-links": "^6.5.10",
|
|
71
|
+
"@storybook/builder-webpack4": "^6.5.10",
|
|
70
72
|
"@storybook/jest": "^0.0.10",
|
|
71
|
-
"@storybook/manager-webpack4": "^6.5.
|
|
72
|
-
"@storybook/react": "^6.5.
|
|
73
|
+
"@storybook/manager-webpack4": "^6.5.10",
|
|
74
|
+
"@storybook/react": "^6.5.10",
|
|
73
75
|
"@storybook/testing-library": "^0.0.13",
|
|
74
|
-
"@testing-library/jest-dom": "^5.16.
|
|
76
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
75
77
|
"@testing-library/react": "^11.2.7",
|
|
76
78
|
"babel-jest": "^26.6.3",
|
|
77
79
|
"babel-loader": "^8.2.5",
|
|
78
80
|
"babel-plugin-styled-components": "^1.13.3",
|
|
79
81
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
80
82
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
81
|
-
"browserslist": "^4.
|
|
82
|
-
"chromatic": "^6.
|
|
83
|
+
"browserslist": "^4.21.3",
|
|
84
|
+
"chromatic": "^6.7.4",
|
|
83
85
|
"clean-webpack-plugin": "^3.0.0",
|
|
84
86
|
"compression": "1.7.4",
|
|
85
87
|
"dotenv": "8.6.0",
|
|
@@ -113,5 +115,5 @@
|
|
|
113
115
|
"silent": true,
|
|
114
116
|
"webpackConfig": "./webpack.config.js"
|
|
115
117
|
},
|
|
116
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "2bdd5ae954208d613144bc8787163da67fc7d114"
|
|
117
119
|
}
|
|
@@ -186,6 +186,12 @@ HiddenInput.parameters = {
|
|
|
186
186
|
};
|
|
187
187
|
|
|
188
188
|
export const MultilineBotMessage = Template.bind({});
|
|
189
|
+
const MESSAGES = {
|
|
190
|
+
single: 'Single-line lonely message',
|
|
191
|
+
double: "Double-line message \n\n vibin'",
|
|
192
|
+
multi: 'This is a \n\n three-multiline \n\n bot message',
|
|
193
|
+
};
|
|
194
|
+
MultilineBotMessage.storyName = 'Multiline Bot & User Messages';
|
|
189
195
|
MultilineBotMessage.parameters = {
|
|
190
196
|
...Regular.parameters,
|
|
191
197
|
initialStateModifier: {
|
|
@@ -195,10 +201,45 @@ MultilineBotMessage.parameters = {
|
|
|
195
201
|
{
|
|
196
202
|
from_bot: true,
|
|
197
203
|
sender: 'BOT',
|
|
198
|
-
message:
|
|
204
|
+
message: MESSAGES.single,
|
|
199
205
|
created: '2022-06-09T18:46:51.672Z',
|
|
200
206
|
id: '1',
|
|
201
207
|
},
|
|
208
|
+
{
|
|
209
|
+
from_bot: true,
|
|
210
|
+
sender: 'BOT',
|
|
211
|
+
message: MESSAGES.double,
|
|
212
|
+
created: '2022-06-09T18:47:51.672Z',
|
|
213
|
+
id: '2',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
from_bot: true,
|
|
217
|
+
sender: 'BOT',
|
|
218
|
+
message: MESSAGES.multi,
|
|
219
|
+
created: '2022-06-09T18:48:51.672Z',
|
|
220
|
+
id: '3',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
from_bot: false,
|
|
224
|
+
sender: 'USER',
|
|
225
|
+
message: MESSAGES.single,
|
|
226
|
+
created: '2022-06-09T18:46:51.672Z',
|
|
227
|
+
id: '1',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
from_bot: false,
|
|
231
|
+
sender: 'USER',
|
|
232
|
+
message: MESSAGES.double,
|
|
233
|
+
created: '2022-06-09T18:47:51.672Z',
|
|
234
|
+
id: '2',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
from_bot: false,
|
|
238
|
+
sender: 'USER',
|
|
239
|
+
message: MESSAGES.multi,
|
|
240
|
+
created: '2022-06-09T18:48:51.672Z',
|
|
241
|
+
id: '3',
|
|
242
|
+
},
|
|
202
243
|
],
|
|
203
244
|
},
|
|
204
245
|
},
|
|
@@ -530,6 +571,216 @@ Slider.parameters = {
|
|
|
530
571
|
},
|
|
531
572
|
};
|
|
532
573
|
|
|
574
|
+
export const Form = Template.bind({});
|
|
575
|
+
Form.parameters = {
|
|
576
|
+
...Regular.parameters,
|
|
577
|
+
initialStateModifier: {
|
|
578
|
+
...Regular.parameters.initialStateModifier,
|
|
579
|
+
messages: {
|
|
580
|
+
chatMessages: [
|
|
581
|
+
{
|
|
582
|
+
chat_source: 'web',
|
|
583
|
+
chat_language_code: 'en',
|
|
584
|
+
from_bot: true,
|
|
585
|
+
sender: 'BOT',
|
|
586
|
+
message: '',
|
|
587
|
+
message_format: 'txt',
|
|
588
|
+
buttons: [],
|
|
589
|
+
created: '2022-06-15T19:03:46.186495Z',
|
|
590
|
+
title: '',
|
|
591
|
+
id: '1',
|
|
592
|
+
form: {
|
|
593
|
+
id: 'dddsauhi',
|
|
594
|
+
dialogue_id: 'ddda',
|
|
595
|
+
slug: 'ddas', // Auto generated by the backend, possibly humanly readable and unique
|
|
596
|
+
submit_dialogue_id: 'c0d685d3-3f11-41b8-9cfd-e35d54df2c95',
|
|
597
|
+
abandon_dialogue_id: 'b1cde0f3-0715-48eb-8482-a9355fa11ba8',
|
|
598
|
+
texts: [
|
|
599
|
+
{
|
|
600
|
+
id: 'hoho',
|
|
601
|
+
languageCode: 'en',
|
|
602
|
+
title: 'Form Title',
|
|
603
|
+
abandon_dialogue_message: 'Form exited, please ask something else',
|
|
604
|
+
unanswered_dialogue_message: 'Form unanswered',
|
|
605
|
+
cancel_button_text: 'Cancel',
|
|
606
|
+
send_button_text: 'Submit',
|
|
607
|
+
},
|
|
608
|
+
],
|
|
609
|
+
fields: [
|
|
610
|
+
{
|
|
611
|
+
type: 'text',
|
|
612
|
+
order: 0,
|
|
613
|
+
slug: 'gigi', // Auto generated by the backend, possibly humanly readable and unique
|
|
614
|
+
texts: [
|
|
615
|
+
{
|
|
616
|
+
id: 'gfd',
|
|
617
|
+
languageCode: 'en',
|
|
618
|
+
label: 'Name',
|
|
619
|
+
placeholder: 'Your name',
|
|
620
|
+
helper_text: 'Please fill in your full name here',
|
|
621
|
+
},
|
|
622
|
+
],
|
|
623
|
+
validators: [
|
|
624
|
+
{
|
|
625
|
+
required: true,
|
|
626
|
+
texts: [
|
|
627
|
+
{
|
|
628
|
+
id: 'gruh',
|
|
629
|
+
languageCode: 'en',
|
|
630
|
+
message: 'This field is required',
|
|
631
|
+
},
|
|
632
|
+
],
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
maxLength: 30,
|
|
636
|
+
texts: [
|
|
637
|
+
{
|
|
638
|
+
id: 'duh',
|
|
639
|
+
languageCode: 'en',
|
|
640
|
+
message: 'Maximum number of length is 30',
|
|
641
|
+
},
|
|
642
|
+
],
|
|
643
|
+
},
|
|
644
|
+
],
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
type: 'email',
|
|
648
|
+
order: 1,
|
|
649
|
+
slug: 'bras', // Auto generated by the backend, possibly humanly readable and unique
|
|
650
|
+
texts: [
|
|
651
|
+
{
|
|
652
|
+
id: 'tigg',
|
|
653
|
+
languageCode: 'en',
|
|
654
|
+
label: 'Email',
|
|
655
|
+
placeholder: 'Your email',
|
|
656
|
+
helper_text: 'Please fill in your email address here so we can contact you',
|
|
657
|
+
},
|
|
658
|
+
],
|
|
659
|
+
validators: [
|
|
660
|
+
{
|
|
661
|
+
required: true,
|
|
662
|
+
texts: [
|
|
663
|
+
{
|
|
664
|
+
id: 'gigu',
|
|
665
|
+
languageCode: 'en',
|
|
666
|
+
message: 'This field is required',
|
|
667
|
+
},
|
|
668
|
+
],
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
pattern: /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/.toString(),
|
|
672
|
+
texts: [
|
|
673
|
+
{
|
|
674
|
+
id: 'dada',
|
|
675
|
+
languageCode: 'en',
|
|
676
|
+
message: 'Please provide valid email',
|
|
677
|
+
},
|
|
678
|
+
],
|
|
679
|
+
},
|
|
680
|
+
],
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
type: 'range',
|
|
684
|
+
order: 2,
|
|
685
|
+
affix: 'PREFIX',
|
|
686
|
+
min: 10,
|
|
687
|
+
max: 100,
|
|
688
|
+
step: 10,
|
|
689
|
+
slug: 'yoyo', // Auto generated by the backend, possibly humanly readable and unique
|
|
690
|
+
texts: [
|
|
691
|
+
{
|
|
692
|
+
id: 'blabla',
|
|
693
|
+
languageCode: 'en',
|
|
694
|
+
label: 'Please select a value',
|
|
695
|
+
helper_text: 'Please fill in your full name here',
|
|
696
|
+
affix_value: '$',
|
|
697
|
+
},
|
|
698
|
+
],
|
|
699
|
+
validators: [],
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
type: 'checkbox', // not included in the v1
|
|
703
|
+
order: 3,
|
|
704
|
+
slug: 'dodo', // Auto generated by the backend, possibly humanly readable and unique
|
|
705
|
+
texts: [
|
|
706
|
+
{
|
|
707
|
+
id: 'gogo',
|
|
708
|
+
languageCode: 'en',
|
|
709
|
+
label: 'What animals do you like?',
|
|
710
|
+
helper_text: '',
|
|
711
|
+
},
|
|
712
|
+
],
|
|
713
|
+
list: [
|
|
714
|
+
{
|
|
715
|
+
slug: 'hhh', // Not sure if this needs one
|
|
716
|
+
value: 'cows',
|
|
717
|
+
order: 0,
|
|
718
|
+
texts: [
|
|
719
|
+
{
|
|
720
|
+
id: 'gras',
|
|
721
|
+
languageCode: 'en',
|
|
722
|
+
label: 'I like cows',
|
|
723
|
+
},
|
|
724
|
+
],
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
slug: 'ddsad',
|
|
728
|
+
value: 'snakes',
|
|
729
|
+
order: 1,
|
|
730
|
+
texts: [
|
|
731
|
+
{
|
|
732
|
+
id: 'grq',
|
|
733
|
+
languageCode: 'en',
|
|
734
|
+
label: 'I like snakes',
|
|
735
|
+
},
|
|
736
|
+
],
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
slug: 'abv',
|
|
740
|
+
value: 'foxes',
|
|
741
|
+
order: 2,
|
|
742
|
+
texts: [
|
|
743
|
+
{
|
|
744
|
+
id: 'abc',
|
|
745
|
+
languageCode: 'en',
|
|
746
|
+
label: 'I like foxes',
|
|
747
|
+
},
|
|
748
|
+
],
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
slug: '213',
|
|
752
|
+
value: 'owls',
|
|
753
|
+
order: 3,
|
|
754
|
+
texts: [
|
|
755
|
+
{
|
|
756
|
+
id: '321',
|
|
757
|
+
languageCode: 'en',
|
|
758
|
+
label: 'I like owls',
|
|
759
|
+
},
|
|
760
|
+
],
|
|
761
|
+
},
|
|
762
|
+
],
|
|
763
|
+
validators: [
|
|
764
|
+
{
|
|
765
|
+
required: true,
|
|
766
|
+
texts: [
|
|
767
|
+
{
|
|
768
|
+
id: '432',
|
|
769
|
+
languageCode: 'en',
|
|
770
|
+
message: 'This field is required',
|
|
771
|
+
},
|
|
772
|
+
],
|
|
773
|
+
},
|
|
774
|
+
],
|
|
775
|
+
},
|
|
776
|
+
],
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
],
|
|
780
|
+
},
|
|
781
|
+
},
|
|
782
|
+
};
|
|
783
|
+
|
|
533
784
|
export const LeaveContactDetails = Template.bind({});
|
|
534
785
|
LeaveContactDetails.parameters = {
|
|
535
786
|
...Regular.parameters,
|
|
@@ -5,7 +5,6 @@ import React from 'react';
|
|
|
5
5
|
import withFetchMock from 'storybook-addon-mock';
|
|
6
6
|
|
|
7
7
|
import KindlyChatButton from '../../src/features/KindlyChatButton/KindlyChatButton';
|
|
8
|
-
|
|
9
8
|
import settingsJSON from '../assets/settingsJson';
|
|
10
9
|
import withContainer from '../decorators/withContainer';
|
|
11
10
|
import withMockProvider from '../decorators/withProvider';
|