Skip to content

Commit 238bea2

Browse files
authored
Merge pull request #2104 from ChildMindInstitute/release/2025.06.5
Release/2025.06.5
2 parents 679a237 + efd1b82 commit 238bea2

4 files changed

Lines changed: 24 additions & 9 deletions

File tree

src/modules/Builder/features/ActivityItems/LeftBar/Item/Item.styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export const StyledItem = styled(StyledFlexTopCenter, shouldForwardProp)`
3737
stroke: ${variables.palette.on_surface_variant};
3838
}
3939
40-
${isActive && `background-color: ${variables.palette.secondary_container};`}
41-
${hasError && `background-color: ${variables.palette.error_container};`}
40+
${isActive && `background-color: ${variables.palette.secondary_container}`};
41+
${hasError && `background-color: ${variables.palette.error_container}`};
4242
${
4343
isDragging &&
4444
`background-color: ${blendColorsNormal(

src/shared/features/AppletSettings/ExportDataSetting/Popups/DataExportPopup/DataExportPopup_old.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ import {
3535
variables,
3636
} from 'shared/styles';
3737
import {
38+
ExportDataSuccessfulEvent,
3839
exportEncryptedDataSucceed,
3940
Mixpanel,
4041
MixpanelEventType,
42+
MixpanelFeature,
4143
MixpanelProps,
4244
sendLogFile,
4345
} from 'shared/utils';
@@ -101,6 +103,11 @@ export const DataExportPopup = ({
101103
const executeAllPagesOfExportData = useCallback(
102104
async ({ appletId, targetSubjectIds }: ExecuteAllPagesOfExportData) => {
103105
try {
106+
const analyticsEvent: ExportDataSuccessfulEvent = {
107+
action: MixpanelEventType.ExportDataSuccessful,
108+
[MixpanelProps.AppletId]: appletId,
109+
};
110+
104111
dataExportingRef.current = true;
105112
setDataIsExporting(true);
106113

@@ -212,7 +219,7 @@ export const DataExportPopup = ({
212219
const respondentId = filters?.sourceSubjectId;
213220
const subjectId = targetSubjectIds ?? filters?.targetSubjectId;
214221

215-
await new EHRDataExporter().exportData({
222+
const { size } = await new EHRDataExporter().exportData({
216223
appletId,
217224
fromDate,
218225
toDate,
@@ -221,13 +228,15 @@ export const DataExportPopup = ({
221228
respondentIds: respondentId ? [respondentId] : undefined,
222229
subjectIds: subjectId ? [subjectId] : undefined,
223230
});
231+
232+
if (size) {
233+
analyticsEvent[MixpanelProps.Feature] = [MixpanelFeature.EHR];
234+
analyticsEvent[MixpanelProps.EHRFileSize] = size;
235+
}
224236
}
225237

238+
Mixpanel.track(analyticsEvent);
226239
handlePopupClose();
227-
Mixpanel.track({
228-
action: MixpanelEventType.ExportDataSuccessful,
229-
[MixpanelProps.AppletId]: appletId,
230-
});
231240
} catch (e) {
232241
const error = e as TypeError;
233242
console.warn('Error while export data', error);

src/shared/utils/exportData/exporters/EHRDataExporter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class EHRDataExporter {
3939
flowIds,
4040
respondentIds,
4141
subjectIds,
42-
}: EHRDataExporterOptions) {
42+
}: EHRDataExporterOptions): Promise<{ size?: number }> {
4343
// Build the URL with query parameters
4444
const queryParams = new URLSearchParams();
4545
if (fromDate) queryParams.append('fromDate', fromDate);
@@ -72,7 +72,7 @@ export class EHRDataExporter {
7272
if (!response.ok) throw new Error(`EHR data download failed for ${url}`);
7373

7474
// No EHR data matching the query parameters found
75-
if (response.status === 204) return;
75+
if (response.status === 204) return {};
7676

7777
// Get the filename from the Content-Disposition header or use default
7878
const contentDisposition = response.headers.get('Content-Disposition');
@@ -90,5 +90,7 @@ export class EHRDataExporter {
9090
a.click();
9191
window.URL.revokeObjectURL(downloadUrl);
9292
document.body.removeChild(a);
93+
94+
return { size: blob.size };
9395
}
9496
}

src/shared/utils/mixpanel/mixpanel.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ export enum MixpanelProps {
3232
AutoAssignedFlowCount = 'Auto-assigned flow count',
3333
ManuallyAssignedActivityCount = 'Manually-assigned activity count',
3434
ManuallyAssignedFlowCount = 'Manually-assigned flow count',
35+
EHRFileSize = 'EHR File Size',
3536
}
3637

3738
export enum MixpanelFeature {
3839
MultiInformant = 'Multi-informant',
3940
SSI = 'SSI',
41+
EHR = 'EHR',
4042
}
4143

4244
export enum MixpanelEventType {
@@ -373,6 +375,8 @@ export type EditLimitedAccountClickedEvent = WithAppletId<{
373375

374376
export type ExportDataSuccessfulEvent = WithAppletId<{
375377
action: MixpanelEventType.ExportDataSuccessful;
378+
[MixpanelProps.Feature]?: MixpanelFeature[];
379+
[MixpanelProps.EHRFileSize]?: number;
376380
}>;
377381

378382
export type FullAccountEditedSuccessfullyEvent = WithAppletId<{

0 commit comments

Comments
 (0)