diff --git a/.github/workflows/client-test.yml b/.github/workflows/client-test.yml index a42688f1fa..fa966b11f6 100644 --- a/.github/workflows/client-test.yml +++ b/.github/workflows/client-test.yml @@ -119,7 +119,7 @@ jobs: 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 \ + REACT_APP_IS_APPSMITH_CLOUD=${{ secrets.IS_APPSMITH_CLOUD }} \ yarn build # Upload the build artifact so that it can be used by the test & deploy job in the workflow diff --git a/app/client/src/configs/index.ts b/app/client/src/configs/index.ts index c058a38d6a..fbf3e474a8 100644 --- a/app/client/src/configs/index.ts +++ b/app/client/src/configs/index.ts @@ -45,6 +45,7 @@ export type INJECTED_CONFIGS = { cloudServicesBaseUrl: string; googleRecaptchaSiteKey: string; supportEmail: string; + isAppsmithCloud: boolean; }; declare global { interface Window { @@ -122,6 +123,7 @@ const getConfigsFromEnvVars = (): INJECTED_CONFIGS => { googleRecaptchaSiteKey: process.env.REACT_APP_GOOGLE_RECAPTCHA_SITE_KEY || "", supportEmail: process.env.APPSMITH_SUPPORT_EMAIL || "support@appsmith.com", + isAppsmithCloud: !!process.env.REACT_APP_IS_APPSMITH_CLOUD, }; }; @@ -291,5 +293,6 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => { ENV_CONFIG.cloudServicesBaseUrl || APPSMITH_FEATURE_CONFIGS.cloudServicesBaseUrl, appsmithSupportEmail: ENV_CONFIG.supportEmail, + isAppsmithCloud: ENV_CONFIG.isAppsmithCloud, }; }; diff --git a/app/client/src/configs/types.ts b/app/client/src/configs/types.ts index 680e523a08..65ac399811 100644 --- a/app/client/src/configs/types.ts +++ b/app/client/src/configs/types.ts @@ -79,4 +79,5 @@ export type AppsmithUIConfigs = { apiKey: string; }; appsmithSupportEmail: string; + isAppsmithCloud: boolean; }; diff --git a/app/client/src/utils/helpers.tsx b/app/client/src/utils/helpers.tsx index 3394e403b7..7a8a26bf23 100644 --- a/app/client/src/utils/helpers.tsx +++ b/app/client/src/utils/helpers.tsx @@ -15,8 +15,9 @@ import { } from "pages/Applications/permissionHelpers"; import { User } from "constants/userConstants"; import { getAppsmithConfigs } from "configs"; +import { sha256 } from "js-sha256"; -const { intercomAppID } = getAppsmithConfigs(); +const { intercomAppID, isAppsmithCloud } = getAppsmithConfigs(); export const snapToGrid = ( columnWidth: number, @@ -423,11 +424,21 @@ export const getIsSafeRedirectURL = (redirectURL: string) => { export function bootIntercom(user?: User) { if (intercomAppID && window.Intercom) { + let { email, username } = user || {}; + let name; + if (!isAppsmithCloud) { + username = sha256(username || ""); + email = sha256(email || ""); + } else { + name = user?.name; + } + window.Intercom("boot", { app_id: intercomAppID, - user_id: user?.username, - name: user?.name, - email: user?.email, + user_id: username, + email, + // keep name undefined instead of an empty string so that intercom auto assigns a name + name, }); } }