fix: anonymize user info intercom (#6936)
This commit is contained in:
parent
681f2a11f8
commit
1add6c905c
2
.github/workflows/client-test.yml
vendored
2
.github/workflows/client-test.yml
vendored
|
|
@ -119,7 +119,7 @@ jobs:
|
||||||
REACT_APP_VERSION_RELEASE_DATE=$(date -u '+%Y-%m-%dT%H:%M:%SZ') \
|
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_GOOGLE_ANALYTICS_ID=${{ secrets.GOOGLE_TAG_MANAGER_ID }} \
|
||||||
REACT_APP_INTERCOM_APP_ID=${{ secrets.APPSMITH_INTERCOM_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
|
yarn build
|
||||||
|
|
||||||
# Upload the build artifact so that it can be used by the test & deploy job in the workflow
|
# Upload the build artifact so that it can be used by the test & deploy job in the workflow
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ export type INJECTED_CONFIGS = {
|
||||||
cloudServicesBaseUrl: string;
|
cloudServicesBaseUrl: string;
|
||||||
googleRecaptchaSiteKey: string;
|
googleRecaptchaSiteKey: string;
|
||||||
supportEmail: string;
|
supportEmail: string;
|
||||||
|
isAppsmithCloud: boolean;
|
||||||
};
|
};
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
|
@ -122,6 +123,7 @@ const getConfigsFromEnvVars = (): INJECTED_CONFIGS => {
|
||||||
googleRecaptchaSiteKey:
|
googleRecaptchaSiteKey:
|
||||||
process.env.REACT_APP_GOOGLE_RECAPTCHA_SITE_KEY || "",
|
process.env.REACT_APP_GOOGLE_RECAPTCHA_SITE_KEY || "",
|
||||||
supportEmail: process.env.APPSMITH_SUPPORT_EMAIL || "support@appsmith.com",
|
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 ||
|
ENV_CONFIG.cloudServicesBaseUrl ||
|
||||||
APPSMITH_FEATURE_CONFIGS.cloudServicesBaseUrl,
|
APPSMITH_FEATURE_CONFIGS.cloudServicesBaseUrl,
|
||||||
appsmithSupportEmail: ENV_CONFIG.supportEmail,
|
appsmithSupportEmail: ENV_CONFIG.supportEmail,
|
||||||
|
isAppsmithCloud: ENV_CONFIG.isAppsmithCloud,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,5 @@ export type AppsmithUIConfigs = {
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
};
|
};
|
||||||
appsmithSupportEmail: string;
|
appsmithSupportEmail: string;
|
||||||
|
isAppsmithCloud: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,9 @@ import {
|
||||||
} from "pages/Applications/permissionHelpers";
|
} from "pages/Applications/permissionHelpers";
|
||||||
import { User } from "constants/userConstants";
|
import { User } from "constants/userConstants";
|
||||||
import { getAppsmithConfigs } from "configs";
|
import { getAppsmithConfigs } from "configs";
|
||||||
|
import { sha256 } from "js-sha256";
|
||||||
|
|
||||||
const { intercomAppID } = getAppsmithConfigs();
|
const { intercomAppID, isAppsmithCloud } = getAppsmithConfigs();
|
||||||
|
|
||||||
export const snapToGrid = (
|
export const snapToGrid = (
|
||||||
columnWidth: number,
|
columnWidth: number,
|
||||||
|
|
@ -423,11 +424,21 @@ export const getIsSafeRedirectURL = (redirectURL: string) => {
|
||||||
|
|
||||||
export function bootIntercom(user?: User) {
|
export function bootIntercom(user?: User) {
|
||||||
if (intercomAppID && window.Intercom) {
|
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", {
|
window.Intercom("boot", {
|
||||||
app_id: intercomAppID,
|
app_id: intercomAppID,
|
||||||
user_id: user?.username,
|
user_id: username,
|
||||||
name: user?.name,
|
email,
|
||||||
email: user?.email,
|
// keep name undefined instead of an empty string so that intercom auto assigns a name
|
||||||
|
name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user