Skip to content

Commit aec1ac1

Browse files
Merge pull request #3857 from RedisInsight/fe/feature/RI-5905-enable-telemetry-for-cloud-authenticated-users
RI-5905 enable telemetry for cloud auth users
2 parents 845d9f2 + 1150094 commit aec1ac1

File tree

7 files changed

+26
-11
lines changed

7 files changed

+26
-11
lines changed

redisinsight/api/src/constants/agreements-spec.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"disabled": false,
1010
"category": "privacy",
1111
"since": "1.0.1",
12-
"title": "Analytics",
13-
"label": "Enable Analytics",
14-
"description": "Select to help us make Redis Insight better. We aggregate anonymized user experience data and use it to fix bugs and improve experience for all users."
12+
"title": "Telemetry",
13+
"label": "Enable Telemetry",
14+
"description": "Select to help us make Redis Insight better. Telemetry helps us better understand how Redis Insight features are being used, improve experience for all users, and prioritize new features."
1515
},
1616
"notifications": {
1717
"defaultValue": false,

redisinsight/ui/src/components/config/Config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const Config = () => {
8080
if (cloudSsoFeature?.flag) {
8181
dispatch(fetchProfile())
8282
}
83-
}, [cloudSsoFeature])
83+
}, [cloudSsoFeature?.flag])
8484

8585
useEffect(() => {
8686
featuresHighlight()

redisinsight/ui/src/components/consents-settings/ConsentsPrivacy/ConsentsPrivacy.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('ConsentsPrivacy', () => {
9191
})
9292
})
9393

94-
const expectedActions = [{}].fill(updateUserConfigSettings(), 0)
94+
const expectedActions = [updateUserConfigSettings()]
9595
expect(clearStoreActions(store.getActions().slice(0, expectedActions.length))).toEqual(
9696
clearStoreActions(expectedActions)
9797
)

redisinsight/ui/src/components/consents-settings/ConsentsPrivacy/ConsentsPrivacy.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,8 @@ const ConsentsPrivacy = () => {
7474
return (
7575
<EuiForm component="form" onSubmit={formik.handleSubmit} data-testid="consents-settings-form">
7676
<div className={styles.consentsWrapper}>
77-
<EuiText size="s" className={styles.smallText} color="subdued">
78-
To optimize your experience, Redis Insight uses third-party tools.
79-
All data collected is anonymized and will not be used for any purpose without your consent.
80-
</EuiText>
81-
<EuiSpacer size="l" />
8277
<EuiTitle size="xs">
83-
<h4>Analytics</h4>
78+
<h4>Telemetry</h4>
8479
</EuiTitle>
8580
{
8681
privacyConsents

redisinsight/ui/src/components/oauth/shared/oauth-agreement/OAuthAgreement.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { localStorageService } from 'uiSrc/services'
77
import { BrowserStorageItem } from 'uiSrc/constants'
88
import { setAgreement, oauthCloudPAgreementSelector } from 'uiSrc/slices/oauth/cloud'
99

10+
import { enableUserAnalyticsAction } from 'uiSrc/slices/user/user-settings'
1011
import styles from './styles.module.scss'
1112

1213
export interface Props {
@@ -20,6 +21,9 @@ const OAuthAgreement = (props: Props) => {
2021
const dispatch = useDispatch()
2122

2223
const handleCheck = (e: ChangeEvent<HTMLInputElement>) => {
24+
if (e.target.checked) {
25+
dispatch(enableUserAnalyticsAction())
26+
}
2327
dispatch(setAgreement(e.target.checked))
2428
localStorageService.set(BrowserStorageItem.OAuthAgreement, e.target.checked)
2529
}
@@ -63,6 +67,9 @@ const OAuthAgreement = (props: Props) => {
6367
<li className={styles.listItem}>
6468
that Redis Insight will generate Redis Cloud API account and user keys, and store them locally on your machine
6569
</li>
70+
<li className={styles.listItem}>
71+
Analytics will be enabled to aggregate anonymized user data to improve user experience. You can disable it anytime on the Settings page.
72+
</li>
6673
</ul>
6774
</div>
6875
)

redisinsight/ui/src/components/oauth/shared/oauth-form/OAuthForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { signIn } from 'uiSrc/slices/oauth/cloud'
44
import { OAuthSocialAction, OAuthStrategy } from 'uiSrc/slices/interfaces'
55
import { ipcAuth } from 'uiSrc/electron/utils'
66
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
7+
import { enableUserAnalyticsAction } from 'uiSrc/slices/user/user-settings'
78
import OAuthSsoForm from './components/oauth-sso-form'
89
import OAuthSocialButtons from '../oauth-social-buttons'
910
import { Props as OAuthSocialButtonsProps } from '../oauth-social-buttons/OAuthSocialButtons'
@@ -31,6 +32,7 @@ const OAuthForm = ({
3132
}
3233

3334
const onSocialButtonClick = (authStrategy: OAuthStrategy) => {
35+
dispatch(enableUserAnalyticsAction())
3436
setAuthStrategy(authStrategy)
3537
onClick?.(authStrategy)
3638

redisinsight/ui/src/slices/user/user-settings.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,14 @@ export function updateUserConfigSettingsAction(
182182
}
183183
}
184184
}
185+
186+
export function enableUserAnalyticsAction() {
187+
return async (dispatch: AppDispatch, stateInit: () => RootState) => {
188+
const state = stateInit()
189+
const agreements = state?.user?.settings?.config?.agreements
190+
191+
if (agreements && !agreements.analytics) {
192+
dispatch(updateUserConfigSettingsAction({ agreements: { ...agreements, analytics: true } }))
193+
}
194+
}
195+
}

0 commit comments

Comments
 (0)