@kindly/react-chat 2.41.5 → 2.42.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.41.5",
3
+ "version": "2.42.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",
@@ -64,7 +64,7 @@
64
64
  "react-dom": ">=16.9.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@babel/core": "^7.21.0",
67
+ "@babel/core": "^7.21.3",
68
68
  "@babel/plugin-proposal-class-properties": "^7.18.6",
69
69
  "@babel/plugin-transform-runtime": "^7.21.0",
70
70
  "@babel/preset-env": "^7.20.2",
@@ -85,7 +85,7 @@
85
85
  "@types/react": "^16.14.35",
86
86
  "@types/react-dom": "^16.9.18",
87
87
  "axe-playwright": "^1.2.3",
88
- "babel-jest": "^29.4.3",
88
+ "babel-jest": "^29.5.0",
89
89
  "babel-loader": "^9.1.2",
90
90
  "babel-plugin-styled-components": "^1.13.3",
91
91
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
@@ -98,11 +98,12 @@
98
98
  "file-loader": "^6.2.0",
99
99
  "html-webpack-plugin": "^5.5.0",
100
100
  "husky": "3.1.0",
101
- "jest": "^29.4.3",
102
- "jest-each": "^29.4.3",
103
- "jest-environment-jsdom": "^29.4.3",
101
+ "jest": "^29.5.0",
102
+ "jest-each": "^29.5.0",
103
+ "jest-environment-jsdom": "^29.5.0",
104
104
  "jest-junit": "^15.0.0",
105
105
  "lodash.clonedeep": "^4.5.0",
106
+ "lodash.set": "^4.3.2",
106
107
  "process": "^0.11.10",
107
108
  "pusher-js": "^8.0.1",
108
109
  "pusher-redux": "^0.5.0",
@@ -114,10 +115,10 @@
114
115
  "storybook-addon-mock": "^3.2.0",
115
116
  "url-loader": "^4.1.1",
116
117
  "wait-on": "^6.0.1",
117
- "webpack": "^5.75.0",
118
+ "webpack": "^5.76.1",
118
119
  "webpack-bundle-analyzer": "^4.8.0",
119
120
  "webpack-cli": "^5.0.1",
120
- "webpack-dev-server": "^4.11.1",
121
+ "webpack-dev-server": "^4.12.0",
121
122
  "webpack-merge": "^5.8.0"
122
123
  },
123
124
  "engines": {
@@ -128,5 +129,5 @@
128
129
  "pusher-js": "8.0.1"
129
130
  }
130
131
  },
131
- "gitHead": "05968afdf3bf67d1ba109d2f41011eabc53629e5"
132
+ "gitHead": "4b8f2bf59a0cce3540ea8262de8b7393e367239c"
132
133
  }
@@ -400,6 +400,102 @@ FormActive2.play = async ({ canvasElement }) => {
400
400
  fireEvent.scroll(chatBody, { target: { scrollTop: chatBody.clientHeight } });
401
401
  };
402
402
 
403
+ export const FormActive3 = Template.bind({});
404
+ FormActive3.parameters = {
405
+ ...defaultParameters,
406
+ initialStateModifier: {
407
+ ...defaultParameters.initialStateModifier,
408
+ messages: {
409
+ chatMessages: [
410
+ {
411
+ chat_source: 'web',
412
+ chat_language_code: 'en',
413
+ from_bot: true,
414
+ sender: 'BOT',
415
+ message: '',
416
+ message_format: 'txt',
417
+ buttons: [],
418
+ created: '2022-06-15T19:03:46.186495Z',
419
+ id: '1',
420
+ form: {
421
+ submission_id: 'submissionId',
422
+ id: 'formId',
423
+ dialogue_id: '2',
424
+ submit_dialogue_id: 'c0d685d3-3f11-41b8-9cfd-e35d54df2c95',
425
+ abandon_dialogue_id: 'b1cde0f3-0715-48eb-8482-a9355fa11ba8',
426
+ languageCode: 'en',
427
+ texts: {
428
+ title: 'This is a form',
429
+ error_text: 'There was an error around here',
430
+ submit_button_text: 'Submit',
431
+ cancel_button_text: 'Exit',
432
+ unanswered_text: 'You failed to answer this form',
433
+ cancel_text: 'You have cancelled/exited this form',
434
+ },
435
+ fields: [
436
+ {
437
+ input_type: FIELDS.RADIO,
438
+ order: 1,
439
+ required: true,
440
+ slug: 'radui-icecream-option',
441
+ attributes: {
442
+ options: [
443
+ {
444
+ value: 'chocolate',
445
+ label: 'Chocolate',
446
+ },
447
+ {
448
+ value: 'vanilla',
449
+ label: 'Vanilla',
450
+ },
451
+ ],
452
+ },
453
+ texts: {
454
+ label: 'Please select an icecream flavour.',
455
+ },
456
+ validators: [],
457
+ },
458
+ {
459
+ input_type: FIELDS.RADIO,
460
+ order: 2,
461
+ required: true,
462
+ slug: 'radui-payment-method',
463
+ attributes: {
464
+ options: [
465
+ {
466
+ value: 'paypal',
467
+ label: 'Paypal',
468
+ },
469
+ {
470
+ value: 'Debit',
471
+ label: 'Debit',
472
+ },
473
+ ],
474
+ },
475
+ texts: {
476
+ label: 'Please select a way to pay.',
477
+ },
478
+ validators: [],
479
+ },
480
+ ],
481
+ },
482
+ },
483
+ ],
484
+ },
485
+ },
486
+ };
487
+ FormActive3.play = async ({ canvasElement }) => {
488
+ await within(canvasElement).findByText('Submit', undefined, { timeout: 5000 });
489
+ await fireEvent(await within(canvasElement).getByRole('button', { name: /submit/i }), new MouseEvent('click'));
490
+
491
+ const checkboxTerms = await within(canvasElement).findByLabelText('Debit');
492
+ await userEvent.click(checkboxTerms);
493
+
494
+ const chatBody = await within(canvasElement).findByTestId('chat-body-container');
495
+ await wait(300); // wait for the autoscroll to finish, so we can bottom for the Chromatic snapshot
496
+ fireEvent.scroll(chatBody, { target: { scrollTop: chatBody.clientHeight } });
497
+ };
498
+
403
499
  export const FormWithoutTitle = Template.bind({});
404
500
  FormWithoutTitle.parameters = {
405
501
  ...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,
@@ -327,7 +345,7 @@ NewUnreadMessages.play = async ({ canvasElement }) => {
327
345
  { timeout: 5000 },
328
346
  );
329
347
  mockMessage(window.store, 'This is a new message');
330
- await wait(50);
348
+ await wait(200);
331
349
  await expect(chatNewMessage).toHaveTextContent('This is a new message');
332
350
  }
333
351
  };