Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,7 @@ const CONST = {
CONTEXT_FULLSTORY: 'Fullstory',
CONTEXT_POLICIES: 'Policies',
TAG_ACTIVE_POLICY: 'active_policy_id',
TAG_NUDGE_MIGRATION_COHORT: 'nudge_migration_cohort',
// Span names
SPAN_OPEN_REPORT: 'ManualOpenReport',
SPAN_APP_STARTUP: 'ManualAppStartup',
Expand Down
19 changes: 18 additions & 1 deletion src/libs/telemetry/TelemetrySynchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import Onyx from 'react-native-onyx';
import {getActivePolicies} from '@libs/PolicyUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Policy, Session} from '@src/types/onyx';
import type {Policy, Session, TryNewDot} from '@src/types/onyx';

/**
* Connect to Onyx to retrieve information about the user's active policies.
*/
let session: OnyxEntry<Session>;
let activePolicyID: OnyxEntry<string>;
let policies: OnyxCollection<Policy>;
let tryNewDot: OnyxEntry<TryNewDot>;

Onyx.connectWithoutView({
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
Expand Down Expand Up @@ -52,6 +53,14 @@ Onyx.connectWithoutView({
},
});

Onyx.connectWithoutView({
key: ONYXKEYS.NVP_TRY_NEW_DOT,
callback: (value) => {
tryNewDot = value;
sendTryNewDotCohortTag();
},
});

function sendPoliciesContext() {
if (!policies || !session?.email || !activePolicyID) {
return;
Expand All @@ -60,3 +69,11 @@ function sendPoliciesContext() {
Sentry.setTag(CONST.TELEMETRY.TAG_ACTIVE_POLICY, activePolicyID);
Sentry.setContext(CONST.TELEMETRY.CONTEXT_POLICIES, {activePolicyID, activePolicies});
}

function sendTryNewDotCohortTag() {
const cohort = tryNewDot?.nudgeMigration?.cohort;
if (!cohort) {
return;
}
Sentry.setTag(CONST.TELEMETRY.TAG_NUDGE_MIGRATION_COHORT, cohort);
}
2 changes: 2 additions & 0 deletions src/types/onyx/TryNewDot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type TryNewDot = {
nudgeMigration?: {
/** Indicates timestamp of an action. */
timestamp: Date;
/** Indicates the user's cohort */
cohort?: string;
};
};

Expand Down
Loading