From fba50e959d440bb8f13cf060c4743741b34331e3 Mon Sep 17 00:00:00 2001 From: Ashit Rath Date: Mon, 4 Nov 2024 09:57:00 +0530 Subject: [PATCH 1/2] chore: Add isModuleInstance property to EXECUTE_ACTION event --- app/client/src/ce/sagas/analyticsSaga.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/client/src/ce/sagas/analyticsSaga.ts b/app/client/src/ce/sagas/analyticsSaga.ts index 6cd7c5799da5..546bbb6fdf70 100644 --- a/app/client/src/ce/sagas/analyticsSaga.ts +++ b/app/client/src/ce/sagas/analyticsSaga.ts @@ -4,14 +4,14 @@ import { call, select } from "redux-saga/effects"; import type { APP_MODE } from "entities/App"; import { getCurrentPageId } from "selectors/editorSelectors"; import type { TriggerMeta } from "ee/sagas/ActionExecution/ActionExecutionSagas"; -import { TriggerKind } from "constants/AppsmithActionConstants/ActionConstants"; import { isArray } from "lodash"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; -import { getAppMode } from "ee/selectors/entitiesSelector"; +import { getAppMode, getJSCollection } from "ee/selectors/entitiesSelector"; import type { AppState } from "ee/reducers"; import { getWidget } from "sagas/selectors"; import { getUserSource } from "ee/utils/AnalyticsUtil"; import { getCurrentApplication } from "ee/selectors/applicationSelectors"; +import type { JSCollection } from "entities/JSCollection"; export interface UserAndAppDetails { pageId: string; @@ -58,8 +58,6 @@ export function* logDynamicTriggerExecution({ errors: unknown; triggerMeta: TriggerMeta; }) { - if (triggerMeta.triggerKind !== TriggerKind.EVENT_EXECUTION) return; - const isUnsuccessfulExecution = isArray(errors) && errors.length > 0; const { appId, @@ -75,6 +73,10 @@ export function* logDynamicTriggerExecution({ const widget: ReturnType | undefined = yield select( (state: AppState) => getWidget(state, triggerMeta.source?.id || ""), ); + const jsCollection: JSCollection | undefined = yield select( + getJSCollection, + triggerMeta?.source?.id || "", + ); const dynamicPropertyPathList = widget?.dynamicPropertyPathList; const isJSToggled = !!dynamicPropertyPathList?.find( @@ -100,6 +102,7 @@ export function* logDynamicTriggerExecution({ propertyName: triggerMeta.triggerPropertyName, instanceId, isJSToggled, + isModuleInstance: Boolean(jsCollection?.moduleInstanceId), }); AnalyticsUtil.logEvent( @@ -125,6 +128,7 @@ export function* logDynamicTriggerExecution({ propertyName: triggerMeta.triggerPropertyName, instanceId, isJSToggled, + isModuleInstance: Boolean(jsCollection?.moduleInstanceId), }, ); } From 4e2d9a8cdfff06e9f588eb501e8295a7a1435871 Mon Sep 17 00:00:00 2001 From: Ashit Rath Date: Mon, 4 Nov 2024 10:21:55 +0530 Subject: [PATCH 2/2] update selector --- app/client/src/ce/sagas/analyticsSaga.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/client/src/ce/sagas/analyticsSaga.ts b/app/client/src/ce/sagas/analyticsSaga.ts index 546bbb6fdf70..4807b6a4a821 100644 --- a/app/client/src/ce/sagas/analyticsSaga.ts +++ b/app/client/src/ce/sagas/analyticsSaga.ts @@ -6,12 +6,12 @@ import { getCurrentPageId } from "selectors/editorSelectors"; import type { TriggerMeta } from "ee/sagas/ActionExecution/ActionExecutionSagas"; import { isArray } from "lodash"; import AnalyticsUtil from "ee/utils/AnalyticsUtil"; -import { getAppMode, getJSCollection } from "ee/selectors/entitiesSelector"; +import { getAllJSCollections, getAppMode } from "ee/selectors/entitiesSelector"; import type { AppState } from "ee/reducers"; import { getWidget } from "sagas/selectors"; import { getUserSource } from "ee/utils/AnalyticsUtil"; import { getCurrentApplication } from "ee/selectors/applicationSelectors"; -import type { JSCollection } from "entities/JSCollection"; +import type { JSCollectionData } from "ee/reducers/entityReducers/jsActionsReducer"; export interface UserAndAppDetails { pageId: string; @@ -73,10 +73,12 @@ export function* logDynamicTriggerExecution({ const widget: ReturnType | undefined = yield select( (state: AppState) => getWidget(state, triggerMeta.source?.id || ""), ); - const jsCollection: JSCollection | undefined = yield select( - getJSCollection, - triggerMeta?.source?.id || "", + const jsCollectionsData: JSCollectionData[] = + yield select(getAllJSCollections); + const jsCollectionData = (jsCollectionsData || []).find( + ({ config }) => config.id === triggerMeta?.source?.id || "", ); + const jsCollection = jsCollectionData?.config; const dynamicPropertyPathList = widget?.dynamicPropertyPathList; const isJSToggled = !!dynamicPropertyPathList?.find(