Skip to content
Open
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
5 changes: 5 additions & 0 deletions dist/cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,11 @@ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* ()
action: (opts.action
? opts.action
: undefined),
overriddenUserInfo: {
userId: opts.userId,
userFirstName: opts.userFirstName,
userLastName: opts.userLastName,
},
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion dist/cjs/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/cjs/types/types/LogFunction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type LogFunction = (opts: ({
[k: string]: any;
};
level?: LogLevel;
userId?: number;
userFirstName?: string;
userLastName?: string;
} & ({
error: any;
} | {
Expand Down
5 changes: 5 additions & 0 deletions dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,11 @@ const logClientEvent = (opts) => __awaiter(void 0, void 0, void 0, function* ()
action: (opts.action
? opts.action
: undefined),
overriddenUserInfo: {
userId: opts.userId,
userFirstName: opts.userFirstName,
userLastName: opts.userLastName,
},
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/esm/types/types/LogFunction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type LogFunction = (opts: ({
[k: string]: any;
};
level?: LogLevel;
userId?: number;
userFirstName?: string;
userLastName?: string;
} & ({
error: any;
} | {
Expand Down
3 changes: 3 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,9 @@ type LogFunction = (opts: ({
[k: string]: any;
};
level?: LogLevel;
userId?: number;
userFirstName?: string;
userLastName?: string;
} & ({
error: any;
} | {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dce-reactkit",
"version": "4.1.7",
"version": "4.1.8",
"description": "Shared components for Harvard DCE apps",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/logClientEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ const logClientEvent: LogFunction = async (opts) => {
? (opts as any).action
: undefined
),
overriddenUserInfo: {
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overriddenUserInfo object is always created even when all override values are undefined. Consider only including this object when at least one override value is provided to avoid unnecessary data in logs.

Copilot uses AI. Check for mistakes.
userId: opts.userId,
userFirstName: opts.userFirstName,
userLastName: opts.userLastName,
},
},
});
};
Expand Down
6 changes: 6 additions & 0 deletions src/types/LogFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ type LogFunction = (
},
// Log level (default is info)
level?: LogLevel,
// Optional Canvas userId that overrides the current userId from the session (if there is one)
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment mentions 'Canvas userId' which appears to be domain-specific. Consider using more generic terminology like 'user ID' to make the API more reusable across different contexts.

Suggested change
// Optional Canvas userId that overrides the current userId from the session (if there is one)
// Optional user ID that overrides the current user ID from the session (if there is one)

Copilot uses AI. Check for mistakes.
userId?: number,
// Optional Canvas user first name that overrides the current user first name from the session (if there is one)
userFirstName?: string,
// Optional Canvas user last name that overrides the current user last name from the session (if there is one)
userLastName?: string,
} & (
// Error
| {
Expand Down