Skip to content

Commit

Permalink
SOV-1149: Tiledesk (#2460)
Browse files Browse the repository at this point in the history
* feat: replace intercom with tiledesk

* feat: remove intercom utils

* chore: move tiledesk id to env var
  • Loading branch information
soulBit authored Dec 1, 2022
1 parent 252a15c commit 59136ca
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 69 deletions.
68 changes: 26 additions & 42 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,51 +99,35 @@
font-family: Courier, monospace;
}
</style>
<% if (process.env.REACT_APP_INTERCOM_ID) { %>
<!-- Intercom Code -->
<script type="text/javascript">
window.intercomSettings = {
api_base: 'https://api-iam.intercom.io',
app_id: '%REACT_APP_INTERCOM_ID%',
Environment: '%REACT_APP_NETWORK%',
<% if (process.env.REACT_APP_TILEDESK_ID) { %>
<!-- Tiledesk Code -->
<script type="application/javascript">
window.tiledeskSettings = {
projectid: '%REACT_APP_TILEDESK_ID%',
};
</script>
<script type="text/javascript">
(function () {
(function (d, s, id) {
var w = window;
var ic = w.Intercom;
if (typeof ic === 'function') {
ic('reattach_activator');
ic('update', w.intercomSettings);
} else {
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Intercom = i;
var l = function () {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/%REACT_APP_INTERCOM_ID%';
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
};
if (document.readyState === 'complete') {
l();
} else if (w.attachEvent) {
w.attachEvent('onload', l);
} else {
w.addEventListener('load', l, false);
}
}
})();
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Tiledesk = i;
var js,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.async = true;
js.src = 'https://widget.tiledesk.com/v5/launch.js';
fjs.parentNode.insertBefore(js, fjs);
})(document, 'script', 'tiledesk-jssdk');
</script>
<!-- End Intercom Code -->
app_id: '%REACT_APP_TILEDESK_ID%',
<!-- End Tiledesk Code -->
<% } %>
</head>
<body>
Expand Down
15 changes: 0 additions & 15 deletions src/app/containers/WalletProvider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import crypto from 'crypto';
import {
useWalletContext,
WalletProvider as SovrynWallet,
Expand All @@ -19,8 +18,6 @@ import { transactionsStateSaga } from 'store/global/transactions-store/saga';
import { reducer, sliceKey } from './slice';
import { walletProviderSaga } from './saga';
import { selectRequestDialogState } from '../../../store/global/transactions-store/selectors';
import { intercomUpdate } from 'utils/intercom';
import { detectWeb3Wallet } from 'utils/helpers';
import { TxRequestDialog } from 'app/components/TransactionDialog/TxRequestDialog';
import { currentChainId } from '../../../utils/classifiers';
import { actions } from './slice';
Expand Down Expand Up @@ -76,18 +73,6 @@ function WalletWatcher() {
const { wallet, address, chainId } = useWalletContext();

useEffect(() => {
if (address) {
intercomUpdate({
'Wallet address': crypto
.createHash('md5')
.update(address)
.digest('hex'),
'Wallet type': detectWeb3Wallet(),
'Wallet network': wallet?.wallet?.chainId?.toString() || 'unknown',
Environment: currentChainId,
});
}

dispatch(actions.accountChanged(address || ''));
}, [dispatch, address, wallet?.wallet]);

Expand Down
12 changes: 0 additions & 12 deletions src/utils/intercom.ts

This file was deleted.

0 comments on commit 59136ca

Please sign in to comment.