diff --git a/.github/workflows/client-test.yml b/.github/workflows/client-test.yml index d6f2b89ac4..e87827fa33 100644 --- a/.github/workflows/client-test.yml +++ b/.github/workflows/client-test.yml @@ -114,6 +114,7 @@ jobs: REACT_APP_VERSION_ID=${{ steps.vars.outputs.version }} \ REACT_APP_VERSION_RELEASE_DATE=$(date -u '+%Y-%m-%dT%H:%M:%SZ') \ REACT_APP_GOOGLE_ANALYTICS_ID=${{ secrets.GOOGLE_TAG_MANAGER_ID }} \ + REACT_APP_INTERCOM_APP_ID=${{ secrets.APPSMITH_INTERCOM_ID }} \ REACT_APP_SHOW_ONBOARDING_FORM=true \ yarn build diff --git a/app/client/public/index.html b/app/client/public/index.html index a022cc7b1c..a2a59ed6d7 100755 --- a/app/client/public/index.html +++ b/app/client/public/index.html @@ -142,7 +142,7 @@ // '' (empty strings), 'false' are falsy // could return either boolean or string based on value const parseConfig = (config) => { - if (config.indexOf("__") === 0 || config.indexOf("$") === 0) + if (config.indexOf("__") === 0 || config.indexOf("$") === 0 || config.indexOf("%") === 0) return ""; const result = config.trim(); @@ -157,13 +157,13 @@ const LOG_LEVELS = ["debug", "error"]; const CONFIG_LOG_LEVEL_INDEX = LOG_LEVELS.indexOf(parseConfig("__APPSMITH_CLIENT_LOG_LEVEL__")); - const APP_ID = parseConfig("__APPSMITH_INTERCOM_APP_ID__"); + const INTERCOM_APP_ID = parseConfig("%REACT_APP_INTERCOM_APP_ID%") || parseConfig("__APPSMITH_INTERCOM_APP_ID__"); const CLOUD_HOSTING = parseConfig("__APPSMITH_CLOUD_HOSTING__"); const DISABLE_TELEMETRY = parseConfig("__APPSMITH_DISABLE_TELEMETRY__"); // Initialize the Intercom library - if (APP_ID.length && APP_ID[0] !== "%" && CLOUD_HOSTING) { - (function () { 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/' + APP_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); } } })(); + if (INTERCOM_APP_ID.length) { + (function () { 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/' + INTERCOM_APP_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); } } })(); } window.SENTRY_CONFIG = parseConfig("__APPSMITH_SENTRY_DSN__"); @@ -201,7 +201,7 @@ id: parseConfig("__APPSMITH_VERSION_ID__"), releaseDate: parseConfig("__APPSMITH_VERSION_RELEASE_DATE__") }, - intercomAppID: APP_ID, + intercomAppID: INTERCOM_APP_ID, mailEnabled: parseConfig("__APPSMITH_MAIL_ENABLED__"), disableTelemetry: DISABLE_TELEMETRY === "" || DISABLE_TELEMETRY, cloudServicesBaseUrl: parseConfig("__APPSMITH_CLOUD_SERVICES_BASE_URL__") || "https://cs.appsmith.com", diff --git a/app/client/src/components/designSystems/appsmith/help/DocumentationSearch.tsx b/app/client/src/components/designSystems/appsmith/help/DocumentationSearch.tsx index 89fe057084..483d814c57 100644 --- a/app/client/src/components/designSystems/appsmith/help/DocumentationSearch.tsx +++ b/app/client/src/components/designSystems/appsmith/help/DocumentationSearch.tsx @@ -25,12 +25,7 @@ import moment from "moment"; import { getCurrentUser } from "selectors/usersSelectors"; import { User } from "constants/userConstants"; -const { - algolia, - appVersion, - cloudHosting, - intercomAppID, -} = getAppsmithConfigs(); +const { algolia, appVersion, intercomAppID } = getAppsmithConfigs(); const searchClient = algoliasearch(algolia.apiId, algolia.apiKey); const OenLinkIcon = HelpIcons.OPEN_LINK; @@ -116,7 +111,7 @@ function DefaultHelpMenuItem(props: { onClick={() => { if (props.item.link) window.open(props.item.link, "_blank"); if (props.item.id === "intercom-trigger") { - if (cloudHosting && intercomAppID && window.Intercom) { + if (intercomAppID && window.Intercom) { window.Intercom("show"); } } @@ -331,11 +326,6 @@ const HELP_MENU_ITEMS: HelpItem[] = [ label: "Report a bug", link: "https://github.com/appsmithorg/appsmith/issues/new/choose", }, - { - icon: , - label: "Chat with us", - link: "https://github.com/appsmithorg/appsmith/discussions", - }, { icon: , label: "Join our Discord", @@ -343,12 +333,12 @@ const HELP_MENU_ITEMS: HelpItem[] = [ }, ]; -if (cloudHosting) { - HELP_MENU_ITEMS[2] = { +if (intercomAppID) { + HELP_MENU_ITEMS.push({ icon: , label: "Chat with us", id: "intercom-trigger", - }; + }); } class DocumentationSearch extends React.Component { @@ -360,7 +350,7 @@ class DocumentationSearch extends React.Component { } componentDidMount() { const { user } = this.props; - if (cloudHosting && intercomAppID && window.Intercom) { + if (intercomAppID && window.Intercom) { window.Intercom("boot", { app_id: intercomAppID, user_id: user?.username,