Fix chat with us button at the editor help menu (#3465)

This commit is contained in:
Rishabh Saxena 2021-03-10 11:27:17 +05:30 committed by GitHub
parent b6961ce7a4
commit 08ebbe410b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 17 deletions

View File

@ -22,6 +22,8 @@ import {
} from "actions/helpActions";
import { Icon } from "@blueprintjs/core";
import moment from "moment";
import { getCurrentUser } from "selectors/usersSelectors";
import { User } from "constants/userConstants";
const {
algolia,
@ -308,6 +310,7 @@ type Props = {
dispatch: any;
hideSearch?: boolean;
hideMinimizeBtn?: boolean;
user?: User;
};
type State = { showResults: boolean };
@ -356,6 +359,17 @@ class DocumentationSearch extends React.Component<Props, State> {
showResults: props.defaultRefinement.length > 0,
};
}
componentDidMount() {
const { user } = this.props;
if (cloudHosting && intercomAppID && window.Intercom) {
window.Intercom("boot", {
app_id: intercomAppID,
user_id: user?.username,
name: user?.name,
email: user?.email,
});
}
}
onSearchValueChange = (event: SyntheticEvent<HTMLInputElement, Event>) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: No types available
@ -439,6 +453,7 @@ class DocumentationSearch extends React.Component<Props, State> {
const mapStateToProps = (state: AppState) => ({
defaultRefinement: getDefaultRefinement(state),
user: getCurrentUser(state),
});
export default connect(mapStateToProps)(DocumentationSearch);

View File

@ -13,12 +13,10 @@ import { getAppsmithConfigs } from "configs";
import { LayersContext } from "constants/Layers";
import { connect } from "react-redux";
import { AppState } from "reducers";
import { getCurrentUser } from "selectors/usersSelectors";
import { User } from "constants/userConstants";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { HELP_MODAL_HEIGHT, HELP_MODAL_WIDTH } from "constants/HelpConstants";
const { algolia, cloudHosting, intercomAppID } = getAppsmithConfigs();
const { algolia } = getAppsmithConfigs();
const HelpButton = styled.button<{
highlight: boolean;
layer: number;
@ -59,25 +57,12 @@ const CloseIcon = HelpIcons.CLOSE_ICON;
type Props = {
isHelpModalOpen: boolean;
dispatch: any;
user?: User;
page: string;
};
class HelpModal extends React.Component<Props> {
static contextType = LayersContext;
componentDidMount() {
const { user } = this.props;
if (cloudHosting && intercomAppID && window.Intercom) {
window.Intercom("boot", {
app_id: intercomAppID,
user_id: user?.username,
name: user?.name,
email: user?.email,
});
}
}
/**
* closes help modal
*
@ -152,7 +137,6 @@ class HelpModal extends React.Component<Props> {
const mapStateToProps = (state: AppState) => ({
isHelpModalOpen: getHelpModalOpen(state),
user: getCurrentUser(state),
});
export default connect(mapStateToProps)(HelpModal);