Skip to content
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
3 changes: 2 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ module.exports = {
},
},
{
resolve: `gatsby-plugin-freshchat`,
resolve: `gatsby-plugin-ts-freshchat`,
options: {
token: process.env.FRESHCHAT_TOKEN,
host: "https://wchat.freshchat.com",
appEmbedUrl: "https://app.testsigma.com/ui/dashboard",
},
},
{
Expand Down
23 changes: 3 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dotenv": "^10.0.0",
"gatsby": "^3.13.0",
"gatsby-plugin-algolia": "^0.22.2",
"gatsby-plugin-freshchat": "^1.0.0-rc1",
"gatsby-plugin-ts-freshchat": "file:plugins/gatsby-plugin-ts-freshchat",
"gatsby-plugin-google-analytics": "^4.14.0",
"gatsby-plugin-google-gtag": "^4.4.0",
"gatsby-plugin-image": "^1.13.0",
Expand Down
73 changes: 73 additions & 0 deletions plugins/gatsby-plugin-ts-freshchat/gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const React = require("react")

module.exports.onRenderBody = (
{setPostBodyComponents},
pluginOptions
) => {
if (typeof pluginOptions.token === `undefined`) {
return null
}

const freshchatHost = pluginOptions.host ? pluginOptions.host : `https://wchat.freshchat.com`

const appEmbedUrl =
pluginOptions.appEmbedUrl ? pluginOptions.appEmbedUrl : `https://app.testsigma.com/ui/dashboard`

const renderHTML = () => `
window.fcSettings = {
token: "${pluginOptions.token}",
host: "${freshchatHost}"
};

function addFreshchatScript() {
if (window.fcWidgetAdded) return;
var fcScript = document.createElement('script');
fcScript.setAttribute('src','https://wchat.freshchat.com/js/widget.js');
fcScript.setAttribute('async', 'async');
document.body.appendChild(fcScript);
window.fcWidgetAdded = true;
}

function changeSignupBtn() {
var signupBtn = document.getElementById('signup-btn');
if (!signupBtn) {
setTimeout(changeSignupBtn, 1000);
return;
}
document.getElementById('signup-btn').textContent = 'Go to Dashboard';
document.getElementById('signup-btn').href = 'https://app.testsigma.com';
}

// If session details is not received from app within 15 seconds, create new chat.
setTimeout(addFreshchatScript, 15000);

window.addEventListener('message', function( event) {
if (event.origin === 'https://app.testsigma.com' ||
event.origin === 'https://staging.testsigma.com' ||
event.origin === 'https://prestaging.testsigma.com' ||
event.origin === 'https://devtesting.testsigma.com' ||
event.origin === 'http://dev.testsigma.com') {
if (event.data === 'appLoggedOut') {
addFreshchatScript();
} else {
var session = JSON.parse(event.data);
changeSignupBtn();
window.fcSettings.externalId = session.user.email;
window.fcSettings.restoreId = session.fcRestoreId;
addFreshchatScript();
}
}
});
`

setPostBodyComponents([
<iframe key={`gatsby-plugin-ts-freshchat-iframe`}
src={`${appEmbedUrl}`}
height={0} width={0}
style={{display: "none"}}></iframe>,
<script
key={`gatsby-plugin-ts-freshchat-render`}
dangerouslySetInnerHTML={{__html: renderHTML()}}
/>
])
}
1 change: 1 addition & 0 deletions plugins/gatsby-plugin-ts-freshchat/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// noop
6 changes: 6 additions & 0 deletions plugins/gatsby-plugin-ts-freshchat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "gatsby-plugin-ts-freshchat",
"version": "1.0.0",
"description": "Gatsby Plugin to add Freshchat to Testsigma sites",
"main": "index.js"
}
1 change: 1 addition & 0 deletions src/components/EditButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class EditDoc extends Component {
const classes = className ? `${className}` : '';
const { pathRoute } = this.state;
return (
pathRoute &&
<a className={classes} href={`https://github.com/testsigmahq/testsigma-tutorials/blob/dev/src/pages${pathRoute}.md`} target="_blank" rel="noopener noreferrer nofollow">
<i>
<svg className="button-icon--left" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Paste this in place of “test data”. Click **Create** and you are done!
Here’s a summary of the steps we discussed so far.
<iframe src="https://docs.testsigma.com/videos/tutorials/getting-started-ios/recorded-steps-getting-started-testsigma-new.mp4" width="600" height="400"></iframe>

To learn all other options available in the test recorder [click here](https://testsignma.com/docs/test-cases/create-steps-recorder/ios-apps/overview/).
To learn all other options available in the test recorder [click here](https://testsigma.com/docs/test-cases/create-steps-recorder/ios-apps/overview/).

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Lets learn how to perform the actions in Test Recorder

5. Add Conditional statements

Learn more about [Test Recorder here.](https://testsoigma.com/docs/test-cases/create-steps-recorder/ios-apps/overview/)
Learn more about [Test Recorder here.](https://testsigma.com/docs/test-cases/create-steps-recorder/ios-apps/overview/)

###Record Actions

Expand Down
2 changes: 1 addition & 1 deletion src/templates/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default ({ data, pageContext }) => {
</nav>
<div className="relative flex items-center justify-between w-2/5 pl-9 pr-9">
<SearchInputBox></SearchInputBox>
<a className="border border-green-600 font-bold px-4 py-1.5 text-green-600 rounded" href='https://testsigma.com/signup'>Get started for free</a>
<a id={'signup-btn'} target={'_blank'} className="border border-green-600 font-bold px-4 py-1.5 text-green-600 rounded" href='https://testsigma.com/signup'>Get started for free</a>
</div>
</nav>
</div>
Expand Down