Merge branch 'feature/page-events' into 'release'

Page events

See merge request theappsmith/internal-tools-client!395
This commit is contained in:
Satbir Singh 2020-03-18 14:31:30 +00:00
commit b377502720
3 changed files with 54 additions and 1 deletions

View File

@ -144,10 +144,19 @@ const DraggableComponent = (props: DraggableComponentProps) => {
props.widgetId === propertyPaneState.widgetId) ||
props.widgetId !== propertyPaneState.widgetId
) {
AnalyticsUtil.logEvent("PROPERTY_PANE_OPEN_CLICK", {
widgetType: props.type,
widgetId: props.widgetId,
});
showPropertyPane && showPropertyPane(props.widgetId, undefined, true);
} else {
AnalyticsUtil.logEvent("PROPERTY_PANE_CLOSE_CLICK", {
widgetType: props.type,
widgetId: props.widgetId,
});
showPropertyPane && showPropertyPane();
}
e.preventDefault();
e.stopPropagation();
};

View File

@ -82,6 +82,12 @@ class PropertyPane extends Component<
<CloseButton
onClick={(e: any) => {
AnalyticsUtil.logEvent("PROPERTY_PANE_CLOSE_CLICK", {
widgetType: this.props.widgetProperties
? this.props.widgetProperties.type
: "",
widgetId: this.props.widgetId,
});
this.props.hidePropertyPane();
e.preventDefault();
e.stopPropagation();
@ -167,6 +173,40 @@ class PropertyPane extends Component<
}
};
shouldComponentUpdate(nextProps: PropertyPaneProps & PropertyPaneFunctions) {
if (
nextProps.widgetId !== this.props.widgetId &&
nextProps.widgetId !== undefined
) {
if (this.props.widgetId && this.props.widgetProperties) {
AnalyticsUtil.logEvent("PROPERTY_PANE_CLOSE", {
widgetType: this.props.widgetProperties.type,
widgetId: this.props.widgetId,
});
}
if (nextProps.widgetProperties) {
AnalyticsUtil.logEvent("PROPERTY_PANE_OPEN", {
widgetType: nextProps.widgetProperties.type,
widgetId: nextProps.widgetId,
});
}
}
if (
nextProps.widgetId === this.props.widgetId &&
nextProps.isVisible &&
!this.props.isVisible &&
nextProps.widgetProperties !== undefined
) {
AnalyticsUtil.logEvent("PROPERTY_PANE_OPEN", {
widgetType: nextProps.widgetProperties.type,
widgetId: nextProps.widgetId,
});
}
return true;
}
onPropertyChange(propertyName: string, propertyValue: any) {
this.props.updateWidgetProperty(
this.props.widgetId,

View File

@ -42,7 +42,11 @@ export type EventName =
| "SAVE_DATA_SOURCE"
| "NAVIGATE"
| "PAGE_LOAD"
| "NAVIGATE_EDITOR";
| "NAVIGATE_EDITOR"
| "PROPERTY_PANE_OPEN"
| "PROPERTY_PANE_CLOSE"
| "PROPERTY_PANE_OPEN_CLICK"
| "PROPERTY_PANE_CLOSE_CLICK";
export type Gender = "MALE" | "FEMALE";
export interface User {