From 9dba5e4ff0cb6c94bd69932c0d699dfd34a467ab Mon Sep 17 00:00:00 2001 From: paulbert Date: Mon, 16 Dec 2024 16:33:16 -0500 Subject: [PATCH] refactor: Remove ZendeskFab component Deletes the ZendeskFab component and associated mock, removes react-zendesk package, and removes env variables for Zendesk --- .env | 1 - .env.development | 1 - .env.test | 1 - example.env.config.js | 1 - package-lock.json | 9 --- package.json | 1 - src/App.test.jsx | 1 - .../__snapshots__/index.test.jsx.snap | 65 ------------------- src/components/ZendeskFab/index.jsx | 56 ---------------- src/components/ZendeskFab/index.test.jsx | 12 ---- src/components/ZendeskFab/messages.js | 16 ----- src/config/index.js | 1 - 12 files changed, 165 deletions(-) delete mode 100644 src/components/ZendeskFab/__snapshots__/index.test.jsx.snap delete mode 100644 src/components/ZendeskFab/index.jsx delete mode 100644 src/components/ZendeskFab/index.test.jsx delete mode 100644 src/components/ZendeskFab/messages.js diff --git a/.env b/.env index dd38ba31..68ac3abe 100644 --- a/.env +++ b/.env @@ -32,7 +32,6 @@ ENTERPRISE_MARKETING_UTM_SOURCE='' ENTERPRISE_MARKETING_UTM_CAMPAIGN='' ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='' LEARNING_BASE_URL='' -ZENDESK_KEY='' HOTJAR_APP_ID='' HOTJAR_VERSION='6' HOTJAR_DEBUG='' diff --git a/.env.development b/.env.development index 6685c05a..db34121f 100644 --- a/.env.development +++ b/.env.development @@ -38,7 +38,6 @@ ENTERPRISE_MARKETING_UTM_CAMPAIGN='example.com Referral' ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='Footer' LEARNING_BASE_URL='http://localhost:2000' SESSION_COOKIE_DOMAIN='localhost' -ZENDESK_KEY='' HOTJAR_APP_ID='' HOTJAR_VERSION='6' HOTJAR_DEBUG='' diff --git a/.env.test b/.env.test index 0769651a..0d270017 100644 --- a/.env.test +++ b/.env.test @@ -37,7 +37,6 @@ ENTERPRISE_MARKETING_UTM_SOURCE='example.com' ENTERPRISE_MARKETING_UTM_CAMPAIGN='example.com Referral' ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='Footer' LEARNING_BASE_URL='http://localhost:2000' -ZENDESK_KEY='test-zendesk-key' HOTJAR_APP_ID='hot-jar-app-id' HOTJAR_VERSION='6' HOTJAR_DEBUG='' diff --git a/example.env.config.js b/example.env.config.js index 27540ef2..9637d198 100644 --- a/example.env.config.js +++ b/example.env.config.js @@ -59,7 +59,6 @@ module.exports = { ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM: 'Footer', LEARNING_BASE_URL: 'http://localhost:2000', SESSION_COOKIE_DOMAIN: 'localhost', - ZENDESK_KEY: '', HOTJAR_APP_ID: '', HOTJAR_VERSION: 6, HOTJAR_DEBUG: '', diff --git a/package-lock.json b/package-lock.json index 11b2fda9..8eb30ca8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,6 @@ "react-redux": "^7.2.4", "react-router-dom": "6.27.0", "react-share": "^4.4.0", - "react-zendesk": "^0.1.13", "redux": "4.2.1", "redux-logger": "3.0.6", "redux-thunk": "2.4.2", @@ -15396,14 +15395,6 @@ "react-dom": ">=16.6.0" } }, - "node_modules/react-zendesk": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/react-zendesk/-/react-zendesk-0.1.13.tgz", - "integrity": "sha512-9UNzzgdgC8nr2nZ13PNudspUClZZgsnS3FofnuGK1I7+yDPNAP8iDFD2WSQRJmYDAzH+mTlVB4K+G8lY1/0B+w==", - "dependencies": { - "prop-types": "^15.7.2" - } - }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", diff --git a/package.json b/package.json index bce14391..e0d57f75 100755 --- a/package.json +++ b/package.json @@ -61,7 +61,6 @@ "react-redux": "^7.2.4", "react-router-dom": "6.27.0", "react-share": "^4.4.0", - "react-zendesk": "^0.1.13", "redux": "4.2.1", "redux-logger": "3.0.6", "redux-thunk": "2.4.2", diff --git a/src/App.test.jsx b/src/App.test.jsx index 54204a0a..6b31ffc3 100644 --- a/src/App.test.jsx +++ b/src/App.test.jsx @@ -17,7 +17,6 @@ jest.mock('@edx/frontend-component-footer', () => ({ FooterSlot: 'Footer' })); jest.mock('containers/Dashboard', () => 'Dashboard'); jest.mock('containers/LearnerDashboardHeader', () => 'LearnerDashboardHeader'); -jest.mock('components/ZendeskFab', () => 'ZendeskFab'); jest.mock('containers/WidgetContainers/AppWrapper', () => 'AppWrapper'); jest.mock('data/redux', () => ({ selectors: 'redux.selectors', diff --git a/src/components/ZendeskFab/__snapshots__/index.test.jsx.snap b/src/components/ZendeskFab/__snapshots__/index.test.jsx.snap deleted file mode 100644 index 23ccdd5a..00000000 --- a/src/components/ZendeskFab/__snapshots__/index.test.jsx.snap +++ /dev/null @@ -1,65 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ZendeskFab snapshot 1`] = ` - -`; diff --git a/src/components/ZendeskFab/index.jsx b/src/components/ZendeskFab/index.jsx deleted file mode 100644 index 55e69a61..00000000 --- a/src/components/ZendeskFab/index.jsx +++ /dev/null @@ -1,56 +0,0 @@ -import React from 'react'; - -import { getConfig } from '@edx/frontend-platform'; -import { useIntl } from '@edx/frontend-platform/i18n'; - -import Zendesk from 'react-zendesk'; -import messages from './messages'; - -const ZendeskFab = () => { - const { formatMessage } = useIntl(); - const setting = { - cookies: true, - webWidget: { - contactOptions: { - enabled: false, - }, - chat: { - suppress: false, - departments: { - enabled: ['account settings', 'billing and payments', 'certificates', 'deadlines', 'errors and technical issues', 'other', 'proctoring'], - }, - }, - contactForm: { - ticketForms: [ - { - id: 360003368814, - subject: false, - fields: [{ id: 'description', prefill: { '*': '' } }], - }, - ], - selectTicketForm: { - '*': formatMessage(messages.selectTicketForm), - }, - attachments: true, - }, - helpCenter: { - originalArticleButton: true, - }, - answerBot: { - suppress: false, - contactOnlyAfterQuery: true, - title: { '*': formatMessage(messages.supportTitle) }, - avatar: { - url: 'https://edx-cdn.org/v3/prod/favicon.ico', - name: { '*': formatMessage(messages.supportTitle) }, - }, - }, - }, - }; - - return ( - - ); -}; - -export default ZendeskFab; diff --git a/src/components/ZendeskFab/index.test.jsx b/src/components/ZendeskFab/index.test.jsx deleted file mode 100644 index d57da5d4..00000000 --- a/src/components/ZendeskFab/index.test.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import { shallow } from '@edx/react-unit-test-utils'; - -import ZendeskFab from '.'; - -jest.mock('react-zendesk', () => 'Zendesk'); - -describe('ZendeskFab', () => { - test('snapshot', () => { - const wrapper = shallow(); - expect(wrapper.snapshot).toMatchSnapshot(); - }); -}); diff --git a/src/components/ZendeskFab/messages.js b/src/components/ZendeskFab/messages.js deleted file mode 100644 index 0178ebb8..00000000 --- a/src/components/ZendeskFab/messages.js +++ /dev/null @@ -1,16 +0,0 @@ -import { defineMessages } from '@edx/frontend-platform/i18n'; - -const messages = defineMessages({ - supportTitle: { - id: 'zendesk.supportTitle', - description: 'Title for the support button', - defaultMessage: 'edX Support', - }, - selectTicketForm: { - id: 'zendesk.selectTicketForm', - description: 'Select ticket form', - defaultMessage: 'Please choose your request type:', - }, -}); - -export default messages; diff --git a/src/config/index.js b/src/config/index.js index e1bacea8..32fc614b 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -12,7 +12,6 @@ const configuration = { // ACCESS_TOKEN_COOKIE_NAME: process.env.ACCESS_TOKEN_COOKIE_NAME, LEARNING_BASE_URL: process.env.LEARNING_BASE_URL, SESSION_COOKIE_DOMAIN: process.env.SESSION_COOKIE_DOMAIN || '', - ZENDESK_KEY: process.env.ZENDESK_KEY, SUPPORT_URL: process.env.SUPPORT_URL || null, ENABLE_NOTICES: process.env.ENABLE_NOTICES || null, CAREER_LINK_URL: process.env.CAREER_LINK_URL || null,