@kindly/react-chat 2.41.6 → 2.42.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.
- package/.storybook/main.js +15 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +17 -16
- package/stories/screens.stories/Chat/FormStates.stories.jsx +102 -2
- package/stories/screens.stories/Chat/index.stories.jsx +18 -0
- package/.storybook/test-runner.js +0 -35
- /package/dist/src/assets/audio/{newagent.mp3 → newagent.442793eb7365abe2d4df421936fd9e6b.mp3} +0 -0
- /package/dist/src/assets/fonts/{IBMPlexSans-Medium.ttf → IBMPlexSans-Medium.c4877bdfa15aef22d9255288b16899c5.ttf} +0 -0
- /package/dist/src/assets/fonts/{IBMPlexSans-Regular.ttf → IBMPlexSans-Regular.2c412e2f77ae69aa2154613095be7130.ttf} +0 -0
- /package/dist/src/assets/fonts/{KindlySans-Regular.otf → KindlySans-Regular.65d6f01a87841a240c37cd04c52f3c2f.otf} +0 -0
- /package/dist/src/assets/icons/{emoji-happy.png → emoji-happy.2431cc815a557e13fb8bb3081c134168.png} +0 -0
- /package/dist/src/assets/icons/{emoji-neutral.png → emoji-neutral.162fb27d7794b5fc5c14308413ce0522.png} +0 -0
- /package/dist/src/assets/icons/{emoji-sad.png → emoji-sad.234ffed28d562b078fa3a9946e420086.png} +0 -0
- /package/dist/src/assets/images/{santaHat.png → santaHat.58ebdd17ed2b555ef8b1826469e6c7ff.png} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kindly/react-chat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.42.1",
|
|
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",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"test": "jest src",
|
|
19
19
|
"test:storybook": "test-storybook",
|
|
20
20
|
"update:browserslist": "npx browserslist@latest --update-db",
|
|
21
|
-
"storybook": "
|
|
22
|
-
"build-storybook": "build
|
|
21
|
+
"storybook": "storybook dev -p 6006",
|
|
22
|
+
"build-storybook": "storybook build"
|
|
23
23
|
},
|
|
24
24
|
"scriptsComments": {
|
|
25
25
|
"test-a11y": "Runs the storybook test-runner. Currently running only axe-core for a11y tests."
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"@babel/plugin-transform-runtime": "^7.21.0",
|
|
70
70
|
"@babel/preset-env": "^7.20.2",
|
|
71
71
|
"@babel/preset-react": "^7.18.6",
|
|
72
|
-
"@storybook/addon-a11y": "^
|
|
73
|
-
"@storybook/addon-actions": "^
|
|
74
|
-
"@storybook/addon-essentials": "^
|
|
75
|
-
"@storybook/addon-interactions": "^
|
|
76
|
-
"@storybook/addon-links": "^
|
|
77
|
-
"@storybook/
|
|
78
|
-
"@storybook/jest": "^0.0
|
|
79
|
-
"@storybook/
|
|
80
|
-
"@storybook/react": "^
|
|
81
|
-
"@storybook/test-runner": "^0.
|
|
82
|
-
"@storybook/testing-library": "^0.0
|
|
72
|
+
"@storybook/addon-a11y": "^7.0.4",
|
|
73
|
+
"@storybook/addon-actions": "^7.0.4",
|
|
74
|
+
"@storybook/addon-essentials": "^7.0.4",
|
|
75
|
+
"@storybook/addon-interactions": "^7.0.4",
|
|
76
|
+
"@storybook/addon-links": "^7.0.4",
|
|
77
|
+
"@storybook/addon-mdx-gfm": "^7.0.4",
|
|
78
|
+
"@storybook/jest": "^0.1.0",
|
|
79
|
+
"@storybook/react": "^7.0.4",
|
|
80
|
+
"@storybook/react-webpack5": "^7.0.4",
|
|
81
|
+
"@storybook/test-runner": "^0.10.0",
|
|
82
|
+
"@storybook/testing-library": "^0.1.0",
|
|
83
83
|
"@testing-library/jest-dom": "^5.16.5",
|
|
84
84
|
"@testing-library/react": "^11.2.7",
|
|
85
85
|
"@types/react": "^16.14.35",
|
|
@@ -112,7 +112,8 @@
|
|
|
112
112
|
"react-svg-loader": "^3.0.3",
|
|
113
113
|
"react-test-renderer": "16.14.0",
|
|
114
114
|
"resolve-url-loader": "^5.0.0",
|
|
115
|
-
"storybook
|
|
115
|
+
"storybook": "^7.0.4",
|
|
116
|
+
"storybook-addon-mock": "^4.0.0",
|
|
116
117
|
"url-loader": "^4.1.1",
|
|
117
118
|
"wait-on": "^6.0.1",
|
|
118
119
|
"webpack": "^5.76.1",
|
|
@@ -129,5 +130,5 @@
|
|
|
129
130
|
"pusher-js": "8.0.1"
|
|
130
131
|
}
|
|
131
132
|
},
|
|
132
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "b2f0e79ce5be18782b4c66075d1b9830205d4de9"
|
|
133
134
|
}
|
|
@@ -154,7 +154,9 @@ FormActive.parameters = {
|
|
|
154
154
|
validators: [
|
|
155
155
|
{
|
|
156
156
|
max_length: 30,
|
|
157
|
-
|
|
157
|
+
texts: {
|
|
158
|
+
text: 'Maximum number of length is 30',
|
|
159
|
+
},
|
|
158
160
|
},
|
|
159
161
|
],
|
|
160
162
|
},
|
|
@@ -171,7 +173,9 @@ FormActive.parameters = {
|
|
|
171
173
|
validators: [
|
|
172
174
|
{
|
|
173
175
|
min_length: 5,
|
|
174
|
-
|
|
176
|
+
texts: {
|
|
177
|
+
text: 'This field should be at least 5 characters long',
|
|
178
|
+
},
|
|
175
179
|
},
|
|
176
180
|
{
|
|
177
181
|
max_length: 15,
|
|
@@ -400,6 +404,102 @@ FormActive2.play = async ({ canvasElement }) => {
|
|
|
400
404
|
fireEvent.scroll(chatBody, { target: { scrollTop: chatBody.clientHeight } });
|
|
401
405
|
};
|
|
402
406
|
|
|
407
|
+
export const FormActive3 = Template.bind({});
|
|
408
|
+
FormActive3.parameters = {
|
|
409
|
+
...defaultParameters,
|
|
410
|
+
initialStateModifier: {
|
|
411
|
+
...defaultParameters.initialStateModifier,
|
|
412
|
+
messages: {
|
|
413
|
+
chatMessages: [
|
|
414
|
+
{
|
|
415
|
+
chat_source: 'web',
|
|
416
|
+
chat_language_code: 'en',
|
|
417
|
+
from_bot: true,
|
|
418
|
+
sender: 'BOT',
|
|
419
|
+
message: '',
|
|
420
|
+
message_format: 'txt',
|
|
421
|
+
buttons: [],
|
|
422
|
+
created: '2022-06-15T19:03:46.186495Z',
|
|
423
|
+
id: '1',
|
|
424
|
+
form: {
|
|
425
|
+
submission_id: 'submissionId',
|
|
426
|
+
id: 'formId',
|
|
427
|
+
dialogue_id: '2',
|
|
428
|
+
submit_dialogue_id: 'c0d685d3-3f11-41b8-9cfd-e35d54df2c95',
|
|
429
|
+
abandon_dialogue_id: 'b1cde0f3-0715-48eb-8482-a9355fa11ba8',
|
|
430
|
+
languageCode: 'en',
|
|
431
|
+
texts: {
|
|
432
|
+
title: 'This is a form',
|
|
433
|
+
error_text: 'There was an error around here',
|
|
434
|
+
submit_button_text: 'Submit',
|
|
435
|
+
cancel_button_text: 'Exit',
|
|
436
|
+
unanswered_text: 'You failed to answer this form',
|
|
437
|
+
cancel_text: 'You have cancelled/exited this form',
|
|
438
|
+
},
|
|
439
|
+
fields: [
|
|
440
|
+
{
|
|
441
|
+
input_type: FIELDS.RADIO,
|
|
442
|
+
order: 1,
|
|
443
|
+
required: true,
|
|
444
|
+
slug: 'radui-icecream-option',
|
|
445
|
+
attributes: {
|
|
446
|
+
options: [
|
|
447
|
+
{
|
|
448
|
+
value: 'chocolate',
|
|
449
|
+
label: 'Chocolate',
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
value: 'vanilla',
|
|
453
|
+
label: 'Vanilla',
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
},
|
|
457
|
+
texts: {
|
|
458
|
+
label: 'Please select an icecream flavour.',
|
|
459
|
+
},
|
|
460
|
+
validators: [],
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
input_type: FIELDS.RADIO,
|
|
464
|
+
order: 2,
|
|
465
|
+
required: true,
|
|
466
|
+
slug: 'radui-payment-method',
|
|
467
|
+
attributes: {
|
|
468
|
+
options: [
|
|
469
|
+
{
|
|
470
|
+
value: 'paypal',
|
|
471
|
+
label: 'Paypal',
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
value: 'Debit',
|
|
475
|
+
label: 'Debit',
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
},
|
|
479
|
+
texts: {
|
|
480
|
+
label: 'Please select a way to pay.',
|
|
481
|
+
},
|
|
482
|
+
validators: [],
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
],
|
|
488
|
+
},
|
|
489
|
+
},
|
|
490
|
+
};
|
|
491
|
+
FormActive3.play = async ({ canvasElement }) => {
|
|
492
|
+
await within(canvasElement).findByText('Submit', undefined, { timeout: 5000 });
|
|
493
|
+
await fireEvent(await within(canvasElement).getByRole('button', { name: /submit/i }), new MouseEvent('click'));
|
|
494
|
+
|
|
495
|
+
const checkboxTerms = await within(canvasElement).findByLabelText('Debit');
|
|
496
|
+
await userEvent.click(checkboxTerms);
|
|
497
|
+
|
|
498
|
+
const chatBody = await within(canvasElement).findByTestId('chat-body-container');
|
|
499
|
+
await wait(300); // wait for the autoscroll to finish, so we can bottom for the Chromatic snapshot
|
|
500
|
+
fireEvent.scroll(chatBody, { target: { scrollTop: chatBody.clientHeight } });
|
|
501
|
+
};
|
|
502
|
+
|
|
403
503
|
export const FormWithoutTitle = Template.bind({});
|
|
404
504
|
FormWithoutTitle.parameters = {
|
|
405
505
|
...defaultParameters,
|
|
@@ -178,6 +178,24 @@ Maintenance.parameters = {
|
|
|
178
178
|
},
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
+
export const Announcement = Template.bind({});
|
|
182
|
+
Announcement.parameters = {
|
|
183
|
+
botSettings: defaultBotSettings,
|
|
184
|
+
initialStateModifier: {
|
|
185
|
+
chatbubble: {
|
|
186
|
+
active: true,
|
|
187
|
+
chatHasStarted: true,
|
|
188
|
+
currentLanguage: 'en',
|
|
189
|
+
},
|
|
190
|
+
announcement: {
|
|
191
|
+
show: true,
|
|
192
|
+
text: 'Maintenance mode!',
|
|
193
|
+
url: 'https://example.com',
|
|
194
|
+
type: 'WARNING',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
|
|
181
199
|
export const HiddenInput = Template.bind({});
|
|
182
200
|
HiddenInput.parameters = {
|
|
183
201
|
botSettings: defaultBotSettings,
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
const { getStoryContext } = require('@storybook/test-runner');
|
|
3
|
-
const { injectAxe, checkA11y } = require('axe-playwright');
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental
|
|
7
|
-
* to learn more about the test-runner hooks API.
|
|
8
|
-
*/
|
|
9
|
-
module.exports = {
|
|
10
|
-
async preRender(page) {
|
|
11
|
-
await injectAxe(page);
|
|
12
|
-
},
|
|
13
|
-
async postRender(page, context) {
|
|
14
|
-
const storyContext = await getStoryContext(page, context);
|
|
15
|
-
// Do not test a11y for stories that disable a11y
|
|
16
|
-
if (storyContext.parameters?.a11y?.disable) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
await page.waitForLoadState('domcontentloaded');
|
|
21
|
-
|
|
22
|
-
await checkA11y(page, '#root', {
|
|
23
|
-
detailedReport: true,
|
|
24
|
-
detailedReportOptions: {
|
|
25
|
-
html: true,
|
|
26
|
-
},
|
|
27
|
-
axeOptions: {
|
|
28
|
-
rules: storyContext.parameters?.a11y?.config.rules.reduce(
|
|
29
|
-
(previousValue, currentValue) => ({ ...previousValue, [currentValue.id]: currentValue }),
|
|
30
|
-
{},
|
|
31
|
-
),
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
};
|
/package/dist/src/assets/audio/{newagent.mp3 → newagent.442793eb7365abe2d4df421936fd9e6b.mp3}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/src/assets/icons/{emoji-happy.png → emoji-happy.2431cc815a557e13fb8bb3081c134168.png}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/src/assets/icons/{emoji-sad.png → emoji-sad.234ffed28d562b078fa3a9946e420086.png}
RENAMED
|
File without changes
|
/package/dist/src/assets/images/{santaHat.png → santaHat.58ebdd17ed2b555ef8b1826469e6c7ff.png}
RENAMED
|
File without changes
|