Skip to content

Commit 32b620a

Browse files
authored
Merge pull request #41077 from appsmithorg/release
03/07 Daily Promotion
2 parents f5405c1 + b4d5685 commit 32b620a

File tree

31 files changed

+1660
-121
lines changed

31 files changed

+1660
-121
lines changed

app/client/cypress/support/Pages/AppSettings/AppSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class AppSettings {
5959
".t--app-viewer-navigation-top-inline-more-dropdown-item",
6060
_scrollArrows: ".scroll-arrows",
6161
_getActivePage: (pageName: string) =>
62-
`//span[contains(text(),"${pageName}")]//ancestor::a[contains(@class,'is-active')]`,
62+
`//span[contains(text(),"${pageName}")]//ancestor::div[contains(@class,'is-active')]`,
6363
_importBtn: "[data-testid='t--app-setting-import-btn']",
6464
};
6565

app/client/src/actions/pageActions.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import type { PACKAGE_PULL_STATUS } from "ee/constants/ModuleConstants";
3030
import type { ApiResponse } from "api/ApiResponses";
3131
import type { EvaluationReduxAction } from "./EvaluationReduxActionTypes";
3232
import { appsmithTelemetry } from "instrumentation";
33+
import type { NavigateToAnotherPagePayload } from "sagas/ActionExecution/NavigateActionSaga/types";
3334

3435
export interface FetchPageListPayload {
3536
applicationId: string;
@@ -696,3 +697,10 @@ export const setupPublishedPage = (
696697
pageWithMigratedDsl,
697698
},
698699
});
700+
701+
export const navigateToAnotherPage = (
702+
payload: NavigateToAnotherPagePayload,
703+
) => ({
704+
type: ReduxActionTypes.NAVIGATE_TO_ANOTHER_PAGE,
705+
payload,
706+
});

app/client/src/ce/constants/ReduxActionConstants.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ const PageActionTypes = {
620620
RESET_PAGE_LIST: "RESET_PAGE_LIST",
621621
SET_ONLOAD_ACTION_EXECUTED: "SET_ONLOAD_ACTION_EXECUTED",
622622
EXECUTE_REACTIVE_QUERIES: "EXECUTE_REACTIVE_QUERIES",
623+
NAVIGATE_TO_ANOTHER_PAGE: "NAVIGATE_TO_ANOTHER_PAGE",
623624
};
624625

625626
const PageActionErrorTypes = {
@@ -731,6 +732,9 @@ const ActionExecutionTypes = {
731732
CANCEL_ACTION_MODAL: "CANCEL_ACTION_MODAL",
732733
CONFIRM_ACTION_MODAL: "CONFIRM_ACTION_MODAL",
733734
EXECUTE_PAGE_LOAD_ACTIONS: "EXECUTE_PAGE_LOAD_ACTIONS",
735+
EXECUTE_PAGE_UNLOAD_ACTIONS: "EXECUTE_PAGE_UNLOAD_ACTIONS",
736+
EXECUTE_PAGE_UNLOAD_ACTIONS_SUCCESS: "EXECUTE_PAGE_UNLOAD_ACTIONS_SUCCESS",
737+
EXECUTE_PAGE_UNLOAD_ACTIONS_ERROR: "EXECUTE_PAGE_UNLOAD_ACTIONS_ERROR",
734738
EXECUTE_PLUGIN_ACTION_REQUEST: "EXECUTE_PLUGIN_ACTION_REQUEST",
735739
EXECUTE_PLUGIN_ACTION_SUCCESS: "EXECUTE_PLUGIN_ACTION_SUCCESS",
736740
SET_ACTION_RESPONSE_DISPLAY_FORMAT: "SET_ACTION_RESPONSE_DISPLAY_FORMAT",

app/client/src/ce/entities/FeatureFlag.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export const FEATURE_FLAG = {
6262
license_ai_agent_instance_enabled: "license_ai_agent_instance_enabled",
6363
release_jsobjects_onpageunloadactions_enabled:
6464
"release_jsobjects_onpageunloadactions_enabled",
65+
configure_block_event_tracking_for_anonymous_users:
66+
"configure_block_event_tracking_for_anonymous_users",
6567
} as const;
6668

6769
export type FeatureFlag = keyof typeof FEATURE_FLAG;
@@ -113,6 +115,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
113115
release_reactive_actions_enabled: false,
114116
license_ai_agent_instance_enabled: false,
115117
release_jsobjects_onpageunloadactions_enabled: false,
118+
configure_block_event_tracking_for_anonymous_users: false,
116119
};
117120

118121
export const AB_TESTING_EVENT_KEYS = {

app/client/src/ce/sagas/userSagas.tsx

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
take,
88
type TakeEffect,
99
} from "redux-saga/effects";
10+
import type { SagaIterator } from "redux-saga";
1011
import type {
1112
ReduxAction,
1213
ReduxActionWithPromise,
@@ -88,6 +89,7 @@ import {
8889
segmentInitUncertain,
8990
} from "actions/analyticsActions";
9091
import { getSegmentState } from "selectors/analyticsSelectors";
92+
import { getOrganizationConfig } from "ee/selectors/organizationSelectors";
9193

9294
export function* getCurrentUserSaga(action?: {
9395
payload?: { userProfile?: ApiResponse };
@@ -150,7 +152,28 @@ function* getSessionRecordingConfig() {
150152
};
151153
}
152154

153-
function* initTrackers(currentUser: User) {
155+
function shouldTrackUser(
156+
currentUser: User,
157+
licenseActive: boolean,
158+
featureFlag: boolean,
159+
): boolean {
160+
try {
161+
const isAnonymous =
162+
currentUser?.isAnonymous || currentUser?.username === "anonymousUser";
163+
164+
if (!isAnonymous) {
165+
return true;
166+
}
167+
168+
const telemetryOn = currentUser?.enableTelemetry ?? false;
169+
170+
return isAnonymous && (licenseActive || (telemetryOn && !featureFlag));
171+
} catch (error) {
172+
return true;
173+
}
174+
}
175+
176+
function* initTrackers(currentUser: User): SagaIterator {
154177
try {
155178
const isFFFetched: boolean = yield select(getFeatureFlagsFetched);
156179

@@ -162,7 +185,21 @@ function* initTrackers(currentUser: User) {
162185
getSessionRecordingConfig,
163186
);
164187

165-
yield call(AnalyticsUtil.initialize, currentUser, sessionRecordingConfig);
188+
const featureFlags: FeatureFlags = yield select(selectFeatureFlags);
189+
const organizationConfig = yield select(getOrganizationConfig);
190+
191+
const shouldTrack = shouldTrackUser(
192+
currentUser,
193+
organizationConfig.license.active,
194+
featureFlags.configure_block_event_tracking_for_anonymous_users,
195+
);
196+
197+
yield call(
198+
AnalyticsUtil.initialize,
199+
currentUser,
200+
sessionRecordingConfig,
201+
shouldTrack,
202+
);
166203
yield put(segmentInitSuccess());
167204
} catch (e) {
168205
log.error(e);

app/client/src/ce/utils/AnalyticsUtil.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ let segmentAnalytics: SegmentSingleton | null = null;
3030
async function initialize(
3131
user: User,
3232
sessionRecordingConfig: SessionRecordingConfig,
33+
shouldTrackUser: boolean,
3334
) {
3435
// SentryUtil.init();
3536
await SmartlookUtil.init();
3637

3738
segmentAnalytics = SegmentSingleton.getInstance();
3839

39-
await segmentAnalytics.init();
40+
await segmentAnalytics.init(shouldTrackUser);
4041

4142
// Mixpanel needs to be initialized after Segment
4243
await MixpanelSingleton.getInstance().init(sessionRecordingConfig);

app/client/src/entities/Action/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export enum ActionExecutionContext {
3939
PAGE_LOAD = "PAGE_LOAD",
4040
EVALUATION_ACTION_TRIGGER = "EVALUATION_ACTION_TRIGGER",
4141
REFRESH_ACTIONS_ON_ENV_CHANGE = "REFRESH_ACTIONS_ON_ENV_CHANGE",
42+
PAGE_UNLOAD = "PAGE_UNLOAD",
4243
}
4344

4445
export interface KeyValuePair {

app/client/src/pages/AppViewer/Navigation/components/MenuItem.styled.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import {
55
getMenuItemBackgroundColorWhenActive,
66
getMenuItemTextColor,
77
} from "pages/AppViewer/utils";
8-
import { NavLink } from "react-router-dom";
98
import styled from "styled-components";
109

11-
export const StyledMenuItem = styled(NavLink)<{
10+
export const StyledMenuItem = styled.div<{
1211
borderRadius: string;
1312
primaryColor: string;
1413
navColorStyle: NavigationSetting["colorStyle"];

0 commit comments

Comments
 (0)