diff --git a/packages/livechat/package.json b/packages/livechat/package.json index 8b9a2a119fcd..14c3e5c79c8d 100644 --- a/packages/livechat/package.json +++ b/packages/livechat/package.json @@ -79,7 +79,6 @@ "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", @@ -87,18 +86,16 @@ "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%", diff --git a/packages/livechat/src/components/App/App.js b/packages/livechat/src/components/App/App.js index e2161042b07b..1d9a41c4a90f 100644 --- a/packages/livechat/src/components/App/App.js +++ b/packages/livechat/src/components/App/App.js @@ -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'; @@ -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 }); @@ -231,7 +230,7 @@ export class App extends Component { }; return ( - + diff --git a/packages/livechat/src/history.js b/packages/livechat/src/history.js deleted file mode 100644 index e27d7b781705..000000000000 --- a/packages/livechat/src/history.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createMemoryHistory } from 'history'; - -export const history = createMemoryHistory(); - -export default history; diff --git a/packages/livechat/src/index.ts b/packages/livechat/src/index.ts index 2142536f217d..b852068e1c46 100644 --- a/packages/livechat/src/index.ts +++ b/packages/livechat/src/index.ts @@ -1,4 +1,3 @@ -import 'emoji-mart/css/emoji-mart.css'; import './styles/index.scss'; export { default } from './components/App'; diff --git a/packages/livechat/src/routes/SwitchDepartment/container.js b/packages/livechat/src/routes/SwitchDepartment/container.js index 035a235c2b97..36c26d4fb4db 100644 --- a/packages/livechat/src/routes/SwitchDepartment/container.js +++ b/packages/livechat/src/routes/SwitchDepartment/container.js @@ -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'; @@ -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 }); @@ -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) }); @@ -59,7 +59,7 @@ class SwitchDepartmentContainer extends Component { } handleCancel = () => { - history.go(-1); + route('/'); } render = (props) => ( diff --git a/yarn.lock b/yarn.lock index 78958caeabd8..fc70b794cbf2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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" @@ -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" @@ -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: @@ -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" @@ -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: @@ -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" @@ -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