Skip to content

Commit

Permalink
Remove intercom (#1547)
Browse files Browse the repository at this point in the history
* Bump moment from 2.29.1 to 2.29.4 in /client-report (#1514)

Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](moment/moment@2.29.1...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump y18n from 3.2.1 to 3.2.2 in /client-report (#932)

Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* remove intercom features from server

* remove intercom from clients

* use client-report/package-lock.json from edge

* remove more intercom references and waitinglist

* drop waitinglist table if exists migration

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bennie Rosas <ben@aliencyb.org>
  • Loading branch information
3 people authored Feb 9, 2023
1 parent b5e4ada commit 35ca449
Show file tree
Hide file tree
Showing 22 changed files with 8 additions and 799 deletions.
1 change: 0 additions & 1 deletion client-admin/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ env:
es2020: true
jquery: true
globals:
Intercom: readonly
FB: readonly
plugins:
- babel
Expand Down
1 change: 0 additions & 1 deletion client-admin/polis.config.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module.exports = {
".+\\.(n|ssl)ip\\.io$",
],

DISABLE_INTERCOM: true,
DISABLE_PLANS: true,

FB_APP_ID: '661042417336977'
Expand Down
29 changes: 0 additions & 29 deletions client-admin/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,6 @@
</script>
<script>
window.usePlans = <%= usePlans %>;
if (<%= useIntercom %>) {
window.useIntercom = true;
window.initIntercom = function(){
var w=window;var ic=w.Intercom;
if(typeof ic==="function"){
// ic('reattach_activator');
// ic('update',intercomSettings);
}else{
var d=document;
var i=function(){
i.c(arguments)
};
i.q=[];
i.c=function(args){
i.q.push(args)
};
w.Intercom=i;
function l(){
var s=d.createElement('script');
s.type='text/javascript';
s.async=true;
s.src='https://widget.intercom.io/widget/nb5hla8s';
var x=d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s,x);
}
$(l); // custom - using jQuery's ready listener
}
};
}
</script>
<script>
window.version = "NULL_VERSION";
Expand Down
53 changes: 0 additions & 53 deletions client-admin/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,59 +110,6 @@ class App extends React.Component {
this.mediaQueryChanged()
}

initIntercom() {
if (window.useIntercom && !this.intercomInitialized) {
const { user } = this.props
if (user) {
if (!window.Intercom && user && user.uid) {
window.initIntercom()
}
if (user.email) {
/*eslint-disable */
/* jshint ignore:start */
Intercom("boot", {
app_id: "nb5hla8s",
created_at: (user.created / 1000) >> 0,
user_id: user.uid,
});
/* jshint ignore:end */
/* eslint-enable */
}
this.intercomInitialized = true
}
}
}

updateIntercomSettings() {
this.initIntercom()
if (this.intercomInitialized) {
const { user } = this.props
const intercomOptions = {
app_id: 'nb5hla8s',
widget: {
activator: '#IntercomDefaultWidget'
}
}
if (user && user.uid) {
intercomOptions.user_id = user.uid + ''
}
if (user && user.email) {
intercomOptions.email = user.email
}
if (user && user.created) {
intercomOptions.created_at = (user.created / 1000) >> 0
}
if (user && user.hname) {
intercomOptions.name = user.hname
}
Intercom('update', intercomOptions)
}
}

componentDidUpdate() {
this.updateIntercomSettings()
}

componentWillUnmount() {
this.state.mql.removeListener(this.mediaQueryChanged.bind(this))
}
Expand Down
2 changes: 0 additions & 2 deletions client-admin/src/strings/en_us.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ s.polis_err_reg_need_name = 'Please include your name.'

s.polis_err_post_comment_duplicate =
'Error posting: This comment already exists!'
s.waitinglist_add_success =
"You've been added to the waiting list! We'll be in touch."

s.polis_err_fetching_tweet =
'Error fetching tweet. Expected a URL to a twitter tweet.'
Expand Down
2 changes: 1 addition & 1 deletion client-admin/src/strings/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
{
title: 'FAQ',
url:
'https://intercom.help/polis/frequently-asked-questions/polis-faq'
'https://compdemocracy.org/faq'
}
]
},
Expand Down
2 changes: 0 additions & 2 deletions client-admin/src/strings/pt_br.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ s.polis_err_reg_need_name = 'Por favor inclua seu nome.'

s.polis_err_post_comment_duplicate =
'Erro ao publicar. Este comentário já existe!'
s.waitinglist_add_success =
'Você já foi incluído na lista de email! Manteremos contato.'

s.polis_err_fetching_tweet =
'Erro buscando tuíte. Verifique se esse link é mesmo de um tuíte.'
Expand Down
1 change: 0 additions & 1 deletion client-admin/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ module.exports = (env, options) => {
domainWhitelist: `["${polisConfig.domainWhitelist.join('","')}"]`,
fbAppId: polisConfig.FB_APP_ID,
usePlans: !isTrue(polisConfig.DISABLE_PLANS),
useIntercom: !isTrue(polisConfig.DISABLE_INTERCOM),
},
}),
new LodashModuleReplacementPlugin({
Expand Down
1 change: 0 additions & 1 deletion client-participation/css/polis/polis.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
// @import 'modules/footer';
// @import 'modules/forms';
// @import 'modules/formSwitch';
// @import 'modules/intercom';
// @import 'modules/header';
// @import 'modules/hero';
// @import 'modules/icons';
Expand Down
52 changes: 1 addition & 51 deletions client-participation/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var display = require("./util/display");
var eb = require("./eventBus");
var Handlebars = require("handlebars");
var MainPolisRouter = require("./routers/main-polis-router");
var Metrics = require("./metrics");
var PolisStorage = require("./util/polisStorage");
var PostMessageUtils = require("./util/postMessageUtils");
var preloadHelper = require("./util/preloadHelper");
Expand Down Expand Up @@ -405,26 +404,7 @@ var uidPromise;
// if (PolisStorage.uidFromCookie()) {
// uidPromise = $.Deferred().resolve(PolisStorage.uidFromCookie());
// } else {
uidPromise = CurrentUserModel.update().then(function(user) {

if (window.useIntercom) {
window.intercomOptions = {
app_id: 'nb5hla8s',
widget: {
activator: '#IntercomDefaultWidget'
}
};
if (user.uid) {
intercomOptions.user_id = user.uid + "";
}
if (user.email) {
intercomOptions.email = user.email;
}
if (user.created) {
intercomOptions.created_at = user.created / 1000 >> 0;
}
}
});
uidPromise = CurrentUserModel.update();
// }


Expand All @@ -446,20 +426,6 @@ $.when(
// needed are aysynchronous
var router = new MainPolisRouter();

Metrics.boot();
if (!isEmbedded() && !isParticipationView()) {
// load intercom widget
// (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://static.intercomcdn.com/intercom.v1.js';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();

// IntercomModalHack.init();
}

if (!window.Intercom) {
if (window.useIntercom && !isEmbedded() && !isParticipationView()) {
window.initIntercom();
}
}

// set up the "exitConv" event
var currentRoute;
router.on("route", function(route, params) {
Expand All @@ -468,22 +434,6 @@ $.when(
eb.trigger(eb.exitConv);
}
currentRoute = route;

uidPromise.then(function() {

var u = userObject;
if (window.useIntercom && !isEmbedded() && !isParticipationView() && (u.email || u.hasTwitter || u.hasFacebook)) {
var intercomWait = 0;
if (!window.Intercom) {
intercomWait = 4000;
}
setTimeout(function() {
window.Intercom('boot', window.intercomOptions);
window.Intercom('update');
window.Intercom('reattach_activator');
}, intercomWait);
}
});
});

display.init();
Expand Down
27 changes: 0 additions & 27 deletions client-participation/js/metrics.js

This file was deleted.

2 changes: 1 addition & 1 deletion client-participation/js/util/facebookButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function facebookLoginOkHandler(response, optionalPassword) {
if (response && response.authResponse && response.authResponse.grantedScopes) {
data.fb_granted_scopes = response.authResponse.grantedScopes;
}
data.owner = false; // since this is the participation view, don't add them to intercom
data.owner = false; // since this is the participation view, don't assume they're an owner


M.add(M.FB_AUTH_INIT);
Expand Down
40 changes: 0 additions & 40 deletions client-participation/js/util/intercomModalHack.js

This file was deleted.

Loading

0 comments on commit 35ca449

Please sign in to comment.