Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Upgrade and remove unnecessary Livechat dependencies #25672

Merged
merged 2 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/livechat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,23 @@
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@kossnocorp/desvg": "^0.2.0",
"@rocket.chat/fuselage-tokens": "~0.31.11",
"@rocket.chat/logo": "^0.31.11",
"@rocket.chat/sdk": "^1.0.0-alpha.42",
"@rocket.chat/ui-kit": "^0.14.1",
"crypto-js": "^4.1.1",
"css-vars-ponyfill": "^2.3.2",
"date-fns": "^2.15.0",
"desvg": "^1.0.2",
"emoji-mart": "^3.0.0",
"history": "^5.0.0",
"i18next": "^21.3.3",
"i18next": "^21.8.4",
"markdown-it": "^11.0.0",
"mem": "^6.1.0",
"mitt": "^2.1.0",
"preact": "^10.4.6",
"preact-router": "^3.2.1",
"query-string": "^6.13.1",
"react-i18next": "^11.13.0",
"whatwg-fetch": "^3.4.0"
"query-string": "^7.1.1",
"react-i18next": "^11.16.9",
"whatwg-fetch": "^3.6.2"
},
"browserslist": [
"> 1%",
Expand Down
7 changes: 3 additions & 4 deletions packages/livechat/src/components/App/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import i18next from 'i18next';
import { Component } from 'preact';
import { Router, route } from 'preact-router';
import queryString from 'query-string';
import { parse } from 'query-string';
import { withTranslation } from 'react-i18next';

import history from '../../history';
import Connection from '../../lib/connection';
import CustomFields from '../../lib/customFields';
import Hooks from '../../lib/hooks';
Expand Down Expand Up @@ -160,7 +159,7 @@ export class App extends Component {
checkPoppedOutWindow() {
// Checking if the window is poppedOut and setting parent minimized if yes for the restore purpose
const { dispatch } = this.props;
const poppedOut = queryString.parse(window.location.search).mode === 'popout';
const poppedOut = parse(window.location.search).mode === 'popout';
this.setState({ poppedOut });
if (poppedOut) {
dispatch({ minimized: false });
Expand Down Expand Up @@ -231,7 +230,7 @@ export class App extends Component {
};

return (
<Router history={history} onChange={this.handleRoute}>
<Router onChange={this.handleRoute}>
<ChatConnector default path='/' {...screenProps} />
<ChatFinished path='/chat-finished' {...screenProps} />
<GDPRAgreement path='/gdpr' {...screenProps} />
Expand Down
5 changes: 0 additions & 5 deletions packages/livechat/src/history.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/livechat/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'emoji-mart/css/emoji-mart.css';
import './styles/index.scss';

export { default } from './components/App';
8 changes: 4 additions & 4 deletions packages/livechat/src/routes/SwitchDepartment/container.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component } from 'preact';
import { route } from 'preact-router';
import { withTranslation } from 'react-i18next';

import { Livechat } from '../../api';
import { ModalManager } from '../../components/Modal';
import history from '../../history';
import { loadConfig } from '../../lib/main';
import { createToken } from '../../lib/random';
import SwitchDepartment from './component';
Expand All @@ -30,7 +30,7 @@ class SwitchDepartmentContainer extends Component {
if (!room) {
const user = await Livechat.grantVisitor({ visitor: { department, token } });
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 });
Expand All @@ -49,7 +49,7 @@ class SwitchDepartmentContainer extends Component {
text: t('department_switched'),
});

history.go(-1);
route('/');
} catch (error) {
console.error(error);
await dispatch({ alerts: (alerts.push({ id: createToken(), children: t('no_available_agents_to_transfer'), warning: true }), alerts) });
Expand All @@ -59,7 +59,7 @@ class SwitchDepartmentContainer extends Component {
}

handleCancel = () => {
history.go(-1);
route('/');
}

render = (props) => (
Expand Down
80 changes: 35 additions & 45 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2350,13 +2350,6 @@ __metadata:
languageName: node
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":
version: 1.0.9
resolution: "@mapbox/node-pre-gyp@npm:1.0.9"
Expand Down Expand Up @@ -3674,7 +3667,6 @@ __metadata:
resolution: "@rocket.chat/livechat@workspace:packages/livechat"
dependencies:
"@babel/preset-env": ^7.11.5
"@kossnocorp/desvg": ^0.2.0
"@rocket.chat/eslint-config": ^0.4.0
"@rocket.chat/fuselage-tokens": ~0.31.11
"@rocket.chat/logo": ^0.31.11
Expand All @@ -3699,7 +3691,6 @@ __metadata:
css-vars-ponyfill: ^2.3.2
cssnano: ^4.1.10
date-fns: ^2.15.0
desvg: ^1.0.2
desvg-loader: ^0.1.0
emoji-mart: ^3.0.0
eslint: ^7.5.0
Expand All @@ -3708,10 +3699,9 @@ __metadata:
eslint-plugin-react-hooks: ^4.1.0
file-loader: ^6.1.0
gh-release: ^3.5.0
history: ^5.0.0
html-webpack-plugin: ^4.4.1
husky: ^4.2.5
i18next: ^21.3.3
i18next: ^21.8.4
if-env: ^1.0.4
image-webpack-loader: ^6.0.0
lorem-ipsum: ^2.0.3
Expand All @@ -3729,9 +3719,9 @@ __metadata:
postcss-selector-not: ^4.0.0
preact: ^10.4.6
preact-router: ^3.2.1
query-string: ^6.13.1
query-string: ^7.1.1
react-dom: ~17
react-i18next: ^11.13.0
react-i18next: ^11.16.9
rimraf: ^3.0.2
sass: ^1.49.10
sass-loader: ^9.0.2
Expand All @@ -3746,7 +3736,7 @@ __metadata:
webpack: ^4.44.1
webpack-cli: ^3.3.12
webpack-dev-server: ^3.11.0
whatwg-fetch: ^3.4.0
whatwg-fetch: ^3.6.2
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -12553,13 +12543,6 @@ __metadata:
languageName: node
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":
version: 2.0.4
resolution: "detab@npm:2.0.4"
Expand Down Expand Up @@ -16735,15 +16718,6 @@ __metadata:
languageName: node
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":
version: 1.0.1
resolution: "hmac-drbg@npm:1.0.1"
Expand Down Expand Up @@ -17243,7 +17217,16 @@ __metadata:
languageName: node
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
resolution: "i18next@npm:21.6.14"
dependencies:
Expand Down Expand Up @@ -25686,18 +25669,6 @@ __metadata:
languageName: node
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":
version: 7.1.1
resolution: "query-string@npm:7.1.1"
Expand Down Expand Up @@ -26070,7 +26041,7 @@ __metadata:
languageName: node
linkType: hard

"react-i18next@npm:^11.13.0, react-i18next@npm:^11.16.7":
"react-i18next@npm:^11.16.7":
version: 11.16.7
resolution: "react-i18next@npm:11.16.7"
dependencies:
Expand All @@ -26089,6 +26060,25 @@ __metadata:
languageName: node
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":
version: 3.0.0
resolution: "react-input-autosize@npm:3.0.0"
Expand Down Expand Up @@ -31966,7 +31956,7 @@ __metadata:
languageName: node
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
resolution: "whatwg-fetch@npm:3.6.2"
checksum: ee976b7249e7791edb0d0a62cd806b29006ad7ec3a3d89145921ad8c00a3a67e4be8f3fb3ec6bc7b58498724fd568d11aeeeea1f7827e7e1e5eae6c8a275afed
Expand Down