From 5571a745fdfa6dab60f628c44859766c1863f06c Mon Sep 17 00:00:00 2001 From: Shabarish V Date: Thu, 17 Nov 2022 18:58:06 +0530 Subject: [PATCH 1/4] WEB-113 - Safe check invalid gitlink --- src/components/EditButton.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/EditButton.jsx b/src/components/EditButton.jsx index b9d8cfb..c1776b0 100644 --- a/src/components/EditButton.jsx +++ b/src/components/EditButton.jsx @@ -20,6 +20,7 @@ class EditDoc extends Component { const classes = className ? `${className}` : ''; const { pathRoute } = this.state; return ( + pathRoute && From cc69df3b167fdd9e3c8e730a5611bbda7f15d567 Mon Sep 17 00:00:00 2001 From: shabarish-testsigma <83057054+shabarish-testsigma@users.noreply.github.com> Date: Fri, 18 Nov 2022 18:31:55 +0530 Subject: [PATCH 2/4] url fixes (#9) Co-authored-by: Pratheep Velicherla --- .../tutorials/getting-started/automate-ios-applications.md | 2 +- .../test-cases/mobile-apps/build-tests-using-recorder.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/tutorials/getting-started/automate-ios-applications.md b/src/pages/tutorials/getting-started/automate-ios-applications.md index 0acd7db..c39d5b5 100644 --- a/src/pages/tutorials/getting-started/automate-ios-applications.md +++ b/src/pages/tutorials/getting-started/automate-ios-applications.md @@ -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. -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/). --- diff --git a/src/pages/tutorials/test-cases/mobile-apps/build-tests-using-recorder.md b/src/pages/tutorials/test-cases/mobile-apps/build-tests-using-recorder.md index f990610..286798a 100644 --- a/src/pages/tutorials/test-cases/mobile-apps/build-tests-using-recorder.md +++ b/src/pages/tutorials/test-cases/mobile-apps/build-tests-using-recorder.md @@ -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 From b79d1afb9a4ef1b2fbc16f2fa5e415e3496b7cb5 Mon Sep 17 00:00:00 2001 From: Rahul Mohan <111055521+RahulMohan7@users.noreply.github.com> Date: Tue, 22 Nov 2022 16:28:45 +0530 Subject: [PATCH 3/4] [3.3.2][TE-6165]: Use same Freshchat session in app and website (#19) * [3.3.2][TE-6165]: Use same Freshchat session in app and website * [3.3.2][TE-6165]: Update package-lock.json --- gatsby-config.js | 3 +- package-lock.json | 23 +----- package.json | 2 +- .../gatsby-plugin-ts-freshchat/gatsby-ssr.js | 73 +++++++++++++++++++ plugins/gatsby-plugin-ts-freshchat/index.js | 1 + .../gatsby-plugin-ts-freshchat/package.json | 6 ++ src/templates/page.jsx | 2 +- 7 files changed, 87 insertions(+), 23 deletions(-) create mode 100644 plugins/gatsby-plugin-ts-freshchat/gatsby-ssr.js create mode 100644 plugins/gatsby-plugin-ts-freshchat/index.js create mode 100644 plugins/gatsby-plugin-ts-freshchat/package.json diff --git a/gatsby-config.js b/gatsby-config.js index ed720f0..74ec736 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -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://prestaging.testsigma.com/ui/dashboard", }, }, { diff --git a/package-lock.json b/package-lock.json index 9653d7c..c7a932e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "dotenv": "^10.0.0", "gatsby": "^3.13.0", "gatsby-plugin-algolia": "^0.22.2", - "gatsby-plugin-freshchat": "^1.0.0-rc1", "gatsby-plugin-google-analytics": "^4.14.0", "gatsby-plugin-google-gtag": "^4.4.0", "gatsby-plugin-image": "^1.13.0", @@ -9963,17 +9962,6 @@ "@algolia/transporter": "4.10.5" } }, - "node_modules/gatsby-plugin-freshchat": { - "version": "1.0.0-rc1", - "resolved": "https://registry.npmjs.org/gatsby-plugin-freshchat/-/gatsby-plugin-freshchat-1.0.0-rc1.tgz", - "integrity": "sha512-7RWJP9gX9nbTF/8tHFrm5LpD4lSRQRCLNIW/d/ET4vgu6HWvbKHo4OaXIe35fO1yWkyfhDJzBUS668BDjAc1bQ==", - "dependencies": { - "@babel/runtime": "^7.1.5" - }, - "peerDependencies": { - "gatsby": ">2.0.0-alpha" - } - }, "node_modules/gatsby-plugin-google-analytics": { "version": "4.14.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.14.0.tgz", @@ -30914,14 +30902,6 @@ } } }, - "gatsby-plugin-freshchat": { - "version": "1.0.0-rc1", - "resolved": "https://registry.npmjs.org/gatsby-plugin-freshchat/-/gatsby-plugin-freshchat-1.0.0-rc1.tgz", - "integrity": "sha512-7RWJP9gX9nbTF/8tHFrm5LpD4lSRQRCLNIW/d/ET4vgu6HWvbKHo4OaXIe35fO1yWkyfhDJzBUS668BDjAc1bQ==", - "requires": { - "@babel/runtime": "^7.1.5" - } - }, "gatsby-plugin-google-analytics": { "version": "4.14.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.14.0.tgz", @@ -31486,6 +31466,9 @@ } } }, + "gatsby-plugin-ts-freshchat": { + "version": "file:plugins/gatsby-plugin-ts-freshchat" + }, "gatsby-plugin-typescript": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-typescript/-/gatsby-plugin-typescript-3.13.0.tgz", diff --git a/package.json b/package.json index 33c259a..114d479 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/plugins/gatsby-plugin-ts-freshchat/gatsby-ssr.js b/plugins/gatsby-plugin-ts-freshchat/gatsby-ssr.js new file mode 100644 index 0000000..619331f --- /dev/null +++ b/plugins/gatsby-plugin-ts-freshchat/gatsby-ssr.js @@ -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([ + , + + ]) +} \ No newline at end of file diff --git a/plugins/gatsby-plugin-ts-freshchat/index.js b/plugins/gatsby-plugin-ts-freshchat/index.js new file mode 100644 index 0000000..625c089 --- /dev/null +++ b/plugins/gatsby-plugin-ts-freshchat/index.js @@ -0,0 +1 @@ +// noop \ No newline at end of file diff --git a/plugins/gatsby-plugin-ts-freshchat/package.json b/plugins/gatsby-plugin-ts-freshchat/package.json new file mode 100644 index 0000000..dd65d0d --- /dev/null +++ b/plugins/gatsby-plugin-ts-freshchat/package.json @@ -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" +} diff --git a/src/templates/page.jsx b/src/templates/page.jsx index abcff3f..fb7d190 100644 --- a/src/templates/page.jsx +++ b/src/templates/page.jsx @@ -84,7 +84,7 @@ export default ({ data, pageContext }) => {
- Get started for free + Get started for free
From d8cae49936daf8dc77500e07f5f63f1b54890426 Mon Sep 17 00:00:00 2001 From: Rahul Mohan <111055521+RahulMohan7@users.noreply.github.com> Date: Fri, 2 Dec 2022 19:33:02 +0530 Subject: [PATCH 4/4] [3.3.2][TE-6165]: Use app URL to check user session to initialize Freshchat (#20) --- gatsby-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gatsby-config.js b/gatsby-config.js index 74ec736..649b6b0 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -104,7 +104,7 @@ module.exports = { options: { token: process.env.FRESHCHAT_TOKEN, host: "https://wchat.freshchat.com", - appEmbedUrl: "https://prestaging.testsigma.com/ui/dashboard", + appEmbedUrl: "https://app.testsigma.com/ui/dashboard", }, }, {