Skip to content
Snippets Groups Projects
Unverified Commit 651a085e authored by Tiago Evangelista Pinto's avatar Tiago Evangelista Pinto Committed by GitHub
Browse files

Chore: Upgrade and remove unnecessary Livechat dependencies (#25672)

<!-- This is a pull request template, you do not need to uncomment or remove the comments, they won't show up in the PR text. -->

<!-- Your Pull Request name should start with one of the following tags
  [NEW] For new features
  [IMPROVE] For an improvement (performance or little improvements) in existing features
  [FIX] For bug fixes that affect the end-user
  [BREAK] For pull requests including breaking changes
  Chore: For small tasks
  Doc: For documentation
-->

<!-- Checklist!!! If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. 
  - I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc
  - I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat
  - Lint and unit tests pass locally with my changes
  - I have added tests that prove my fix is effective or that my feature works (if applicable)
  - I have added necessary documentation (if applicable)
  - Any dependent changes have been merged and published in downstream modules
-->

## Proposed changes (including videos or screenshots)
<!-- CHANGELOG -->
<!--
  Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
  If it fixes a bug or resolves a feature request, be sure to link to that issue below.
  This description will appear in the release notes if we accept the contribution.
-->

<!-- END CHANGELOG -->

## Issue(s)
<!-- Link the issues being closed by or related to this PR. For example, you can use #594 if this PR closes issue number 594 -->

## Steps to test or reproduce
<!-- Mention how you would reproduce the bug if not mentioned on the issue page already. Also mention which screens are going to have the changes if applicable -->

## Further comments
<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
parent 4832e9be
No related branches found
No related tags found
No related merge requests found
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
"webpack-dev-server": "^3.11.0" "webpack-dev-server": "^3.11.0"
}, },
"dependencies": { "dependencies": {
"@kossnocorp/desvg": "^0.2.0",
"@rocket.chat/fuselage-tokens": "~0.31.11", "@rocket.chat/fuselage-tokens": "~0.31.11",
"@rocket.chat/logo": "^0.31.11", "@rocket.chat/logo": "^0.31.11",
"@rocket.chat/sdk": "^1.0.0-alpha.42", "@rocket.chat/sdk": "^1.0.0-alpha.42",
...@@ -87,18 +86,16 @@ ...@@ -87,18 +86,16 @@
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"css-vars-ponyfill": "^2.3.2", "css-vars-ponyfill": "^2.3.2",
"date-fns": "^2.15.0", "date-fns": "^2.15.0",
"desvg": "^1.0.2",
"emoji-mart": "^3.0.0", "emoji-mart": "^3.0.0",
"history": "^5.0.0", "i18next": "^21.8.4",
"i18next": "^21.3.3",
"markdown-it": "^11.0.0", "markdown-it": "^11.0.0",
"mem": "^6.1.0", "mem": "^6.1.0",
"mitt": "^2.1.0", "mitt": "^2.1.0",
"preact": "^10.4.6", "preact": "^10.4.6",
"preact-router": "^3.2.1", "preact-router": "^3.2.1",
"query-string": "^6.13.1", "query-string": "^7.1.1",
"react-i18next": "^11.13.0", "react-i18next": "^11.16.9",
"whatwg-fetch": "^3.4.0" "whatwg-fetch": "^3.6.2"
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
......
import i18next from 'i18next'; import i18next from 'i18next';
import { Component } from 'preact'; import { Component } from 'preact';
import { Router, route } from 'preact-router'; import { Router, route } from 'preact-router';
import queryString from 'query-string'; import { parse } from 'query-string';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import history from '../../history';
import Connection from '../../lib/connection'; import Connection from '../../lib/connection';
import CustomFields from '../../lib/customFields'; import CustomFields from '../../lib/customFields';
import Hooks from '../../lib/hooks'; import Hooks from '../../lib/hooks';
...@@ -160,7 +159,7 @@ export class App extends Component { ...@@ -160,7 +159,7 @@ export class App extends Component {
checkPoppedOutWindow() { checkPoppedOutWindow() {
// Checking if the window is poppedOut and setting parent minimized if yes for the restore purpose // Checking if the window is poppedOut and setting parent minimized if yes for the restore purpose
const { dispatch } = this.props; const { dispatch } = this.props;
const poppedOut = queryString.parse(window.location.search).mode === 'popout'; const poppedOut = parse(window.location.search).mode === 'popout';
this.setState({ poppedOut }); this.setState({ poppedOut });
if (poppedOut) { if (poppedOut) {
dispatch({ minimized: false }); dispatch({ minimized: false });
...@@ -231,7 +230,7 @@ export class App extends Component { ...@@ -231,7 +230,7 @@ export class App extends Component {
}; };
return ( return (
<Router history={history} onChange={this.handleRoute}> <Router onChange={this.handleRoute}>
<ChatConnector default path='/' {...screenProps} /> <ChatConnector default path='/' {...screenProps} />
<ChatFinished path='/chat-finished' {...screenProps} /> <ChatFinished path='/chat-finished' {...screenProps} />
<GDPRAgreement path='/gdpr' {...screenProps} /> <GDPRAgreement path='/gdpr' {...screenProps} />
......
import { createMemoryHistory } from 'history';
export const history = createMemoryHistory();
export default history;
import 'emoji-mart/css/emoji-mart.css';
import './styles/index.scss'; import './styles/index.scss';
export { default } from './components/App'; export { default } from './components/App';
import { Component } from 'preact'; import { Component } from 'preact';
import { route } from 'preact-router';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import { Livechat } from '../../api'; import { Livechat } from '../../api';
import { ModalManager } from '../../components/Modal'; import { ModalManager } from '../../components/Modal';
import history from '../../history';
import { loadConfig } from '../../lib/main'; import { loadConfig } from '../../lib/main';
import { createToken } from '../../lib/random'; import { createToken } from '../../lib/random';
import SwitchDepartment from './component'; import SwitchDepartment from './component';
...@@ -30,7 +30,7 @@ class SwitchDepartmentContainer extends Component { ...@@ -30,7 +30,7 @@ class SwitchDepartmentContainer extends Component {
if (!room) { if (!room) {
const user = await Livechat.grantVisitor({ visitor: { department, token } }); const user = await Livechat.grantVisitor({ visitor: { department, token } });
await dispatch({ user, alerts: (alerts.push({ id: createToken(), children: t('department_switched'), success: true }), alerts) }); await dispatch({ user, alerts: (alerts.push({ id: createToken(), children: t('department_switched'), success: true }), alerts) });
return history.go(-1); return route('/');
} }
await dispatch({ loading: true }); await dispatch({ loading: true });
...@@ -49,7 +49,7 @@ class SwitchDepartmentContainer extends Component { ...@@ -49,7 +49,7 @@ class SwitchDepartmentContainer extends Component {
text: t('department_switched'), text: t('department_switched'),
}); });
history.go(-1); route('/');
} catch (error) { } catch (error) {
console.error(error); console.error(error);
await dispatch({ alerts: (alerts.push({ id: createToken(), children: t('no_available_agents_to_transfer'), warning: true }), alerts) }); await dispatch({ alerts: (alerts.push({ id: createToken(), children: t('no_available_agents_to_transfer'), warning: true }), alerts) });
...@@ -59,7 +59,7 @@ class SwitchDepartmentContainer extends Component { ...@@ -59,7 +59,7 @@ class SwitchDepartmentContainer extends Component {
} }
handleCancel = () => { handleCancel = () => {
history.go(-1); route('/');
} }
render = (props) => ( render = (props) => (
......
...@@ -2350,13 +2350,6 @@ __metadata: ...@@ -2350,13 +2350,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"@kossnocorp/desvg@npm:^0.2.0":
version: 0.2.0
resolution: "@kossnocorp/desvg@npm:0.2.0"
checksum: 53a702af964f3d021955b47389cbdbab445c7bfc412e222cc6e060f7c360fa89b15c5f690fad3a0a1dd1807785124960e7e32449476949e16ffe4b427e13fa2e
languageName: node
linkType: hard
"@mapbox/node-pre-gyp@npm:^1.0.0": "@mapbox/node-pre-gyp@npm:^1.0.0":
version: 1.0.9 version: 1.0.9
resolution: "@mapbox/node-pre-gyp@npm:1.0.9" resolution: "@mapbox/node-pre-gyp@npm:1.0.9"
...@@ -3674,7 +3667,6 @@ __metadata: ...@@ -3674,7 +3667,6 @@ __metadata:
resolution: "@rocket.chat/livechat@workspace:packages/livechat" resolution: "@rocket.chat/livechat@workspace:packages/livechat"
dependencies: dependencies:
"@babel/preset-env": ^7.11.5 "@babel/preset-env": ^7.11.5
"@kossnocorp/desvg": ^0.2.0
"@rocket.chat/eslint-config": ^0.4.0 "@rocket.chat/eslint-config": ^0.4.0
"@rocket.chat/fuselage-tokens": ~0.31.11 "@rocket.chat/fuselage-tokens": ~0.31.11
"@rocket.chat/logo": ^0.31.11 "@rocket.chat/logo": ^0.31.11
...@@ -3699,7 +3691,6 @@ __metadata: ...@@ -3699,7 +3691,6 @@ __metadata:
css-vars-ponyfill: ^2.3.2 css-vars-ponyfill: ^2.3.2
cssnano: ^4.1.10 cssnano: ^4.1.10
date-fns: ^2.15.0 date-fns: ^2.15.0
desvg: ^1.0.2
desvg-loader: ^0.1.0 desvg-loader: ^0.1.0
emoji-mart: ^3.0.0 emoji-mart: ^3.0.0
eslint: ^7.5.0 eslint: ^7.5.0
...@@ -3708,10 +3699,9 @@ __metadata: ...@@ -3708,10 +3699,9 @@ __metadata:
eslint-plugin-react-hooks: ^4.1.0 eslint-plugin-react-hooks: ^4.1.0
file-loader: ^6.1.0 file-loader: ^6.1.0
gh-release: ^3.5.0 gh-release: ^3.5.0
history: ^5.0.0
html-webpack-plugin: ^4.4.1 html-webpack-plugin: ^4.4.1
husky: ^4.2.5 husky: ^4.2.5
i18next: ^21.3.3 i18next: ^21.8.4
if-env: ^1.0.4 if-env: ^1.0.4
image-webpack-loader: ^6.0.0 image-webpack-loader: ^6.0.0
lorem-ipsum: ^2.0.3 lorem-ipsum: ^2.0.3
...@@ -3729,9 +3719,9 @@ __metadata: ...@@ -3729,9 +3719,9 @@ __metadata:
postcss-selector-not: ^4.0.0 postcss-selector-not: ^4.0.0
preact: ^10.4.6 preact: ^10.4.6
preact-router: ^3.2.1 preact-router: ^3.2.1
query-string: ^6.13.1 query-string: ^7.1.1
react-dom: ~17 react-dom: ~17
react-i18next: ^11.13.0 react-i18next: ^11.16.9
rimraf: ^3.0.2 rimraf: ^3.0.2
sass: ^1.49.10 sass: ^1.49.10
sass-loader: ^9.0.2 sass-loader: ^9.0.2
...@@ -3746,7 +3736,7 @@ __metadata: ...@@ -3746,7 +3736,7 @@ __metadata:
webpack: ^4.44.1 webpack: ^4.44.1
webpack-cli: ^3.3.12 webpack-cli: ^3.3.12
webpack-dev-server: ^3.11.0 webpack-dev-server: ^3.11.0
whatwg-fetch: ^3.4.0 whatwg-fetch: ^3.6.2
languageName: unknown languageName: unknown
linkType: soft linkType: soft
   
...@@ -12553,13 +12543,6 @@ __metadata: ...@@ -12553,13 +12543,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"desvg@npm:^1.0.2":
version: 1.0.2
resolution: "desvg@npm:1.0.2"
checksum: 05f489a026e8047e6462f6e4f60fc73355e47c9febba0527ff29af552ca751e7da8387b6c928857d3c26862c4cf7cb5a49cbb6611d1fad496e4f6e8034886a42
languageName: node
linkType: hard
"detab@npm:2.0.4": "detab@npm:2.0.4":
version: 2.0.4 version: 2.0.4
resolution: "detab@npm:2.0.4" resolution: "detab@npm:2.0.4"
...@@ -16735,15 +16718,6 @@ __metadata: ...@@ -16735,15 +16718,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"history@npm:^5.0.0":
version: 5.3.0
resolution: "history@npm:5.3.0"
dependencies:
"@babel/runtime": ^7.7.6
checksum: d73c35df49d19ac172f9547d30a21a26793e83f16a78386d99583b5bf1429cc980799fcf1827eb215d31816a6600684fba9686ce78104e23bd89ec239e7c726f
languageName: node
linkType: hard
"hmac-drbg@npm:^1.0.1": "hmac-drbg@npm:^1.0.1":
version: 1.0.1 version: 1.0.1
resolution: "hmac-drbg@npm:1.0.1" resolution: "hmac-drbg@npm:1.0.1"
...@@ -17243,7 +17217,16 @@ __metadata: ...@@ -17243,7 +17217,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"i18next@npm:^21.3.3, i18next@npm:~21.6.11": "i18next@npm:^21.8.4":
version: 21.8.4
resolution: "i18next@npm:21.8.4"
dependencies:
"@babel/runtime": ^7.17.2
checksum: 6ebe9b16014057d924c8c1dc5f5b1648485c6c27ce469cb7674aa01b79e30d9d80ca541571c43253c65f5633d5490248563d2f62f759f48b57640de0f9f7307f
languageName: node
linkType: hard
"i18next@npm:~21.6.11":
version: 21.6.14 version: 21.6.14
resolution: "i18next@npm:21.6.14" resolution: "i18next@npm:21.6.14"
dependencies: dependencies:
...@@ -25686,18 +25669,6 @@ __metadata: ...@@ -25686,18 +25669,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"query-string@npm:^6.13.1":
version: 6.14.1
resolution: "query-string@npm:6.14.1"
dependencies:
decode-uri-component: ^0.2.0
filter-obj: ^1.1.0
split-on-first: ^1.0.0
strict-uri-encode: ^2.0.0
checksum: f2c7347578fa0f3fd4eaace506470cb4e9dc52d409a7ddbd613f614b9a594d750877e193b5d5e843c7477b3b295b857ec328903c943957adc41a3efb6c929449
languageName: node
linkType: hard
"query-string@npm:^7.1.1": "query-string@npm:^7.1.1":
version: 7.1.1 version: 7.1.1
resolution: "query-string@npm:7.1.1" resolution: "query-string@npm:7.1.1"
...@@ -26070,7 +26041,7 @@ __metadata: ...@@ -26070,7 +26041,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"react-i18next@npm:^11.13.0, react-i18next@npm:^11.16.7": "react-i18next@npm:^11.16.7":
version: 11.16.7 version: 11.16.7
resolution: "react-i18next@npm:11.16.7" resolution: "react-i18next@npm:11.16.7"
dependencies: dependencies:
...@@ -26089,6 +26060,25 @@ __metadata: ...@@ -26089,6 +26060,25 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"react-i18next@npm:^11.16.9":
version: 11.16.9
resolution: "react-i18next@npm:11.16.9"
dependencies:
"@babel/runtime": ^7.14.5
html-escaper: ^2.0.2
html-parse-stringify: ^3.0.1
peerDependencies:
i18next: ">= 19.0.0"
react: ">= 16.8.0"
peerDependenciesMeta:
react-dom:
optional: true
react-native:
optional: true
checksum: b79606a0c36a822b3d9a1e4f2bb4b44643c121de9425ddfeea7e63e5136fe33d4b0b42f045f14d53592dcdbde1fb43cd7be4555b22747d2e0f6f754d3a60c711
languageName: node
linkType: hard
"react-input-autosize@npm:^3.0.0": "react-input-autosize@npm:^3.0.0":
version: 3.0.0 version: 3.0.0
resolution: "react-input-autosize@npm:3.0.0" resolution: "react-input-autosize@npm:3.0.0"
...@@ -31966,7 +31956,7 @@ __metadata: ...@@ -31966,7 +31956,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
   
"whatwg-fetch@npm:>=0.10.0, whatwg-fetch@npm:^3.4.0": "whatwg-fetch@npm:>=0.10.0, whatwg-fetch@npm:^3.6.2":
version: 3.6.2 version: 3.6.2
resolution: "whatwg-fetch@npm:3.6.2" resolution: "whatwg-fetch@npm:3.6.2"
checksum: ee976b7249e7791edb0d0a62cd806b29006ad7ec3a3d89145921ad8c00a3a67e4be8f3fb3ec6bc7b58498724fd568d11aeeeea1f7827e7e1e5eae6c8a275afed checksum: ee976b7249e7791edb0d0a62cd806b29006ad7ec3a3d89145921ad8c00a3a67e4be8f3fb3ec6bc7b58498724fd568d11aeeeea1f7827e7e1e5eae6c8a275afed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment