@kindly/react-chat 2.46.1 β 2.47.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kindly/react-chat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.47.0",
|
|
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",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"phoenix-socket": "^1.2.3",
|
|
42
42
|
"prop-types": "^15.8.1",
|
|
43
43
|
"react-children-utilities": "^2.9.0",
|
|
44
|
-
"react-hook-form": "^7.
|
|
44
|
+
"react-hook-form": "^7.45.0",
|
|
45
45
|
"react-idle-timer": "^5.7.2",
|
|
46
|
-
"react-redux": "^8.
|
|
47
|
-
"react-textarea-autosize": "^8.
|
|
46
|
+
"react-redux": "^8.1.1",
|
|
47
|
+
"react-textarea-autosize": "^8.5.0",
|
|
48
48
|
"redux": "^4.2.1",
|
|
49
49
|
"redux-localstorage": "^0.4.1",
|
|
50
50
|
"redux-logger": "^3.0.6",
|
|
@@ -60,39 +60,39 @@
|
|
|
60
60
|
"react-dom": ">=18.2.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@babel/core": "^7.
|
|
63
|
+
"@babel/core": "^7.22.5",
|
|
64
64
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
65
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
66
|
-
"@babel/preset-env": "^7.
|
|
67
|
-
"@babel/preset-react": "^7.
|
|
68
|
-
"@storybook/addon-a11y": "^7.0.
|
|
69
|
-
"@storybook/addon-actions": "^7.0.
|
|
70
|
-
"@storybook/addon-essentials": "^7.0.
|
|
71
|
-
"@storybook/addon-interactions": "^7.0.
|
|
72
|
-
"@storybook/addon-links": "^7.0.
|
|
73
|
-
"@storybook/addon-mdx-gfm": "^7.0.
|
|
65
|
+
"@babel/plugin-transform-runtime": "^7.22.5",
|
|
66
|
+
"@babel/preset-env": "^7.22.5",
|
|
67
|
+
"@babel/preset-react": "^7.22.5",
|
|
68
|
+
"@storybook/addon-a11y": "^7.0.23",
|
|
69
|
+
"@storybook/addon-actions": "^7.0.23",
|
|
70
|
+
"@storybook/addon-essentials": "^7.0.23",
|
|
71
|
+
"@storybook/addon-interactions": "^7.0.23",
|
|
72
|
+
"@storybook/addon-links": "^7.0.23",
|
|
73
|
+
"@storybook/addon-mdx-gfm": "^7.0.23",
|
|
74
74
|
"@storybook/jest": "^0.1.0",
|
|
75
|
-
"@storybook/react": "^7.0.
|
|
76
|
-
"@storybook/react-webpack5": "^7.0.
|
|
77
|
-
"@storybook/test-runner": "^0.
|
|
78
|
-
"@storybook/testing-library": "^0.
|
|
75
|
+
"@storybook/react": "^7.0.23",
|
|
76
|
+
"@storybook/react-webpack5": "^7.0.23",
|
|
77
|
+
"@storybook/test-runner": "^0.11.0",
|
|
78
|
+
"@storybook/testing-library": "^0.2.0",
|
|
79
79
|
"@testing-library/jest-dom": "^5.16.5",
|
|
80
80
|
"@testing-library/react": "^11.2.7",
|
|
81
|
-
"@types/react": "^18.
|
|
82
|
-
"@types/react-dom": "^18.
|
|
81
|
+
"@types/react": "^18.2.13",
|
|
82
|
+
"@types/react-dom": "^18.2.6",
|
|
83
83
|
"axe-playwright": "^1.2.3",
|
|
84
84
|
"babel-jest": "^29.5.0",
|
|
85
85
|
"babel-loader": "^9.1.2",
|
|
86
86
|
"babel-plugin-styled-components": "^1.13.3",
|
|
87
87
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
88
88
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
89
|
-
"browserslist": "^4.21.
|
|
90
|
-
"chromatic": "^6.
|
|
89
|
+
"browserslist": "^4.21.9",
|
|
90
|
+
"chromatic": "^6.19.9",
|
|
91
91
|
"clean-webpack-plugin": "^4.0.0",
|
|
92
92
|
"dotenv": "8.6.0",
|
|
93
93
|
"express": "^4.18.2",
|
|
94
94
|
"file-loader": "^6.2.0",
|
|
95
|
-
"html-webpack-plugin": "^5.5.
|
|
95
|
+
"html-webpack-plugin": "^5.5.3",
|
|
96
96
|
"husky": "3.1.0",
|
|
97
97
|
"jest": "^29.5.0",
|
|
98
98
|
"jest-each": "^29.5.0",
|
|
@@ -101,21 +101,22 @@
|
|
|
101
101
|
"jest-webpack-resolver": "^0.3.0",
|
|
102
102
|
"lodash.clonedeep": "^4.5.0",
|
|
103
103
|
"lodash.set": "^4.3.2",
|
|
104
|
+
"mockdate": "^3.0.5",
|
|
104
105
|
"process": "^0.11.10",
|
|
105
|
-
"pusher-js": "^8.0
|
|
106
|
+
"pusher-js": "^8.2.0",
|
|
106
107
|
"pusher-redux": "^0.5.0",
|
|
107
108
|
"react": "^18.2.0",
|
|
108
109
|
"react-dom": "^18.2.0",
|
|
109
110
|
"react-test-renderer": "18.2.0",
|
|
110
111
|
"resolve-url-loader": "^5.0.0",
|
|
111
|
-
"storybook": "^7.0.
|
|
112
|
+
"storybook": "^7.0.23",
|
|
112
113
|
"storybook-addon-mock": "^4.0.0",
|
|
113
114
|
"url-loader": "^4.1.1",
|
|
114
|
-
"webpack": "^5.
|
|
115
|
-
"webpack-bundle-analyzer": "^4.
|
|
116
|
-
"webpack-cli": "^5.
|
|
117
|
-
"webpack-dev-server": "^4.
|
|
118
|
-
"webpack-merge": "^5.
|
|
115
|
+
"webpack": "^5.88.0",
|
|
116
|
+
"webpack-bundle-analyzer": "^4.9.0",
|
|
117
|
+
"webpack-cli": "^5.1.4",
|
|
118
|
+
"webpack-dev-server": "^4.15.1",
|
|
119
|
+
"webpack-merge": "^5.9.0"
|
|
119
120
|
},
|
|
120
121
|
"engines": {
|
|
121
122
|
"npm": ">=8.3.0"
|
|
@@ -143,5 +144,5 @@
|
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
},
|
|
146
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "6868be8097a32a761e858682fe987e21e290e2b4"
|
|
147
148
|
}
|
|
@@ -393,6 +393,7 @@ FormActive2.play = async ({ canvasElement }) => {
|
|
|
393
393
|
const selectInputStyle = window.getComputedStyle(selectInput);
|
|
394
394
|
expect(selectInputStyle.border).not.toContain('#00000000');
|
|
395
395
|
expect(selectInputStyle.border).not.toContain('transparent');
|
|
396
|
+
await wait(10); // This fixes inconsistent test results due to composer autofocus
|
|
396
397
|
await userEvent.selectOptions(selectInput, 'Very long message');
|
|
397
398
|
await expect(selectInputStyle.border).toContain('rgba(0, 0, 0, 0)');
|
|
398
399
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expect } from '@storybook/jest';
|
|
2
2
|
import { fireEvent, userEvent, waitFor, within } from '@storybook/testing-library';
|
|
3
|
+
import MockDate from 'mockdate';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
|
|
5
6
|
import { HANDLERS, IMAGE_WIDTH } from 'app/constants';
|
|
@@ -12,6 +13,8 @@ import withContainer from '../../decorators/withContainer';
|
|
|
12
13
|
import withMockProvider from '../../decorators/withProvider';
|
|
13
14
|
import wait from '../../utils/wait';
|
|
14
15
|
|
|
16
|
+
MockDate.set(0);
|
|
17
|
+
|
|
15
18
|
const defaultBotSettings = {
|
|
16
19
|
welcomePage: settingsJSON.welcome_page,
|
|
17
20
|
feedbackForm: settingsJSON.feedback_form,
|
|
@@ -110,8 +113,8 @@ Regular.parameters = {
|
|
|
110
113
|
chromatic: { viewports: chromaticViewports },
|
|
111
114
|
};
|
|
112
115
|
|
|
113
|
-
export const
|
|
114
|
-
|
|
116
|
+
export const Announcement = Template.bind({});
|
|
117
|
+
Announcement.args = {
|
|
115
118
|
type: 'WARNING',
|
|
116
119
|
text: 'You seem to be offline, please check your internet connection',
|
|
117
120
|
initialStateModifierFromArgs: ({ type, text }) => ({
|
|
@@ -123,7 +126,7 @@ Annoucement.args = {
|
|
|
123
126
|
},
|
|
124
127
|
}),
|
|
125
128
|
};
|
|
126
|
-
|
|
129
|
+
Announcement.argTypes = {
|
|
127
130
|
type: {
|
|
128
131
|
options: ['WARNING', 'CRITICAL'],
|
|
129
132
|
control: {
|
|
@@ -131,26 +134,8 @@ Annoucement.argTypes = {
|
|
|
131
134
|
},
|
|
132
135
|
},
|
|
133
136
|
};
|
|
134
|
-
Annoucement.parameters = {
|
|
135
|
-
botSettings: defaultBotSettings,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export const Announcement = Template.bind({});
|
|
139
137
|
Announcement.parameters = {
|
|
140
138
|
botSettings: defaultBotSettings,
|
|
141
|
-
initialStateModifier: {
|
|
142
|
-
chatbubble: {
|
|
143
|
-
active: true,
|
|
144
|
-
chatHasStarted: true,
|
|
145
|
-
currentLanguage: 'en',
|
|
146
|
-
},
|
|
147
|
-
announcement: {
|
|
148
|
-
show: true,
|
|
149
|
-
text: 'Maintenance mode!',
|
|
150
|
-
url: 'https://example.com',
|
|
151
|
-
type: 'WARNING',
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
139
|
};
|
|
155
140
|
|
|
156
141
|
export const HiddenInput = Template.bind({});
|
|
@@ -227,7 +212,7 @@ MimirBotMessage.args = {
|
|
|
227
212
|
messages: {
|
|
228
213
|
chatMessages: [
|
|
229
214
|
{
|
|
230
|
-
from_bot:
|
|
215
|
+
from_bot: true,
|
|
231
216
|
sender: 'BOT',
|
|
232
217
|
handler: HANDLERS.MIMIR,
|
|
233
218
|
message: 'This is a message from Mimir, our KindlyGPT bot.',
|
|
@@ -366,8 +351,13 @@ NewUnreadMessages.play = async ({ canvasElement }) => {
|
|
|
366
351
|
{ timeout: 5000 },
|
|
367
352
|
);
|
|
368
353
|
mockMessage(window.store, 'This is a new message');
|
|
369
|
-
|
|
370
|
-
await
|
|
354
|
+
|
|
355
|
+
await waitFor(
|
|
356
|
+
async () => {
|
|
357
|
+
await expect(chatNewMessage).toHaveTextContent('This is a new message');
|
|
358
|
+
},
|
|
359
|
+
{ timeout: 5000 },
|
|
360
|
+
);
|
|
371
361
|
}
|
|
372
362
|
};
|
|
373
363
|
|
|
@@ -774,6 +764,77 @@ Slider.parameters = {
|
|
|
774
764
|
},
|
|
775
765
|
};
|
|
776
766
|
|
|
767
|
+
export const Buttons = Template.bind({});
|
|
768
|
+
Buttons.parameters = {
|
|
769
|
+
...defaultParameters,
|
|
770
|
+
initialStateModifier: {
|
|
771
|
+
...defaultParameters.initialStateModifier,
|
|
772
|
+
messages: {
|
|
773
|
+
chatMessages: [
|
|
774
|
+
{
|
|
775
|
+
chat_source: 'web',
|
|
776
|
+
chat_language_code: 'en',
|
|
777
|
+
from_bot: true,
|
|
778
|
+
sender: 'BOT',
|
|
779
|
+
message: 'Button list!',
|
|
780
|
+
message_format: 'txt',
|
|
781
|
+
buttons: [
|
|
782
|
+
{
|
|
783
|
+
id: '1',
|
|
784
|
+
button_type: 'EXTERNAL_LINK',
|
|
785
|
+
language_code: 'en',
|
|
786
|
+
label: 'Open a link',
|
|
787
|
+
value: 'https://example.com',
|
|
788
|
+
index: 0,
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
id: '2',
|
|
792
|
+
button_type: 'QUICK_REPLY',
|
|
793
|
+
language_code: 'en',
|
|
794
|
+
label: 'Quick reply',
|
|
795
|
+
value: 'This is a quick reply',
|
|
796
|
+
index: 1,
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
id: '3',
|
|
800
|
+
button_type: 'EMAIL',
|
|
801
|
+
language_code: 'en',
|
|
802
|
+
label: 'Email',
|
|
803
|
+
value: 'support@example.com',
|
|
804
|
+
index: 2,
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
id: '4',
|
|
808
|
+
button_type: 'PHONE',
|
|
809
|
+
language_code: 'en',
|
|
810
|
+
label: 'Phone',
|
|
811
|
+
value: '+46 070-174 06 05',
|
|
812
|
+
index: 3,
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
id: '5',
|
|
816
|
+
button_type: 'UPLOAD_ATTACHMENT',
|
|
817
|
+
language_code: 'en',
|
|
818
|
+
label: 'Upload attachment',
|
|
819
|
+
index: 4,
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
id: '6',
|
|
823
|
+
button_type: 'DIALOGUE_TRIGGER',
|
|
824
|
+
language_code: 'en',
|
|
825
|
+
label: 'Trigger another dialogue',
|
|
826
|
+
value: 'dialogue_id',
|
|
827
|
+
index: 5,
|
|
828
|
+
},
|
|
829
|
+
],
|
|
830
|
+
created,
|
|
831
|
+
id: '1',
|
|
832
|
+
},
|
|
833
|
+
],
|
|
834
|
+
},
|
|
835
|
+
},
|
|
836
|
+
};
|
|
837
|
+
|
|
777
838
|
export const LeaveContactDetails = Template.bind({});
|
|
778
839
|
LeaveContactDetails.parameters = {
|
|
779
840
|
...defaultParameters,
|
|
@@ -875,31 +936,31 @@ MessageReference.parameters = {
|
|
|
875
936
|
{
|
|
876
937
|
...defaultParameters.initialStateModifier.messages.chatMessages[2],
|
|
877
938
|
message:
|
|
878
|
-
"As a player in a Kahoot game, you cannot hide the answers of other players
|
|
939
|
+
"As a player in a Kahoot game, you cannot hide the answers of other players πͺπΏπ. The game is designed to display all answers on the host's screen and on individual player devices for transparency and fairness.",
|
|
879
940
|
message_references: [
|
|
880
941
|
{
|
|
881
942
|
url: 'http://example.com#1',
|
|
882
|
-
offset:
|
|
943
|
+
offset: 79,
|
|
883
944
|
},
|
|
884
945
|
{
|
|
885
946
|
url: 'http://example.com#2',
|
|
886
|
-
offset:
|
|
947
|
+
offset: 79,
|
|
887
948
|
},
|
|
888
949
|
{
|
|
889
950
|
url: 'http://example.com#3',
|
|
890
|
-
offset:
|
|
951
|
+
offset: 79,
|
|
891
952
|
},
|
|
892
953
|
{
|
|
893
954
|
url: 'http://example.com#2',
|
|
894
|
-
offset:
|
|
955
|
+
offset: 144,
|
|
895
956
|
},
|
|
896
957
|
{
|
|
897
958
|
url: 'http://example.com#4',
|
|
898
|
-
offset:
|
|
959
|
+
offset: 208,
|
|
899
960
|
},
|
|
900
961
|
{
|
|
901
962
|
url: 'http://example.com#1',
|
|
902
|
-
offset:
|
|
963
|
+
offset: 208,
|
|
903
964
|
},
|
|
904
965
|
],
|
|
905
966
|
from_bot: true,
|
|
@@ -7,6 +7,7 @@ import { OPTION_VIEW } from '../../src/features/OptionsScreen/constants';
|
|
|
7
7
|
import settingsJSON from '../assets/settingsJson';
|
|
8
8
|
import withContainer from '../decorators/withContainer';
|
|
9
9
|
import withMockProvider from '../decorators/withProvider';
|
|
10
|
+
import wait from '../utils/wait';
|
|
10
11
|
|
|
11
12
|
const defaultBotSettings = {
|
|
12
13
|
welcomePage: settingsJSON.welcome_page,
|
|
@@ -173,6 +174,7 @@ LanguageChoiceConfirm.argTypes = LanguageChoice.argTypes;
|
|
|
173
174
|
LanguageChoiceConfirm.parameters = LanguageChoice.parameters;
|
|
174
175
|
LanguageChoiceConfirm.play = async ({ canvasElement }) => {
|
|
175
176
|
const norskButton = await within(canvasElement).findByText(availableLanguages[1].name);
|
|
177
|
+
await wait(10); // This fixes inconsistent test results due to composer autofocus
|
|
176
178
|
await userEvent.click(norskButton);
|
|
177
179
|
};
|
|
178
180
|
|