@atlaskit/profilecard
Version:
A React component to display a card with user information.
110 lines (98 loc) • 3.92 kB
JavaScript
import { getPageTime } from './performance';
export const PACKAGE_META_DATA = {
packageName: "@atlaskit/profilecard",
packageVersion: "24.44.17"
};
const TEAM_SUBJECT = 'teamProfileCard';
const USER_SUBJECT = 'profilecard';
const AGENT_SUBJECT = 'rovoAgentProfilecard';
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
const createEvent = (eventType, action, actionSubject, actionSubjectId, attributes = {}) => ({
eventType,
action,
actionSubject,
actionSubjectId,
attributes: {
packageName: "@atlaskit/profilecard",
packageVersion: "24.44.17",
...attributes,
firedAt: Math.round(getPageTime())
}
});
export const getActionSubject = type => {
switch (type) {
case 'user':
return USER_SUBJECT;
case 'team':
return TEAM_SUBJECT;
case 'agent':
return AGENT_SUBJECT;
default:
return 'user';
}
};
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const cardTriggered = (type, method, teamId) => {
return createEvent('ui', 'triggered', getActionSubject(type), undefined, {
method,
...(type === 'team' && teamId ? {
teamId
} : {})
});
};
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const teamRequestAnalytics = (action, attributes) => createEvent('operational', action, TEAM_SUBJECT, 'request', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const userRequestAnalytics = (action, attributes) => createEvent('operational', action, USER_SUBJECT, 'request', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const profileCardRendered = (type, actionSubjectId, attributes) => createEvent('ui', 'rendered', getActionSubject(type), actionSubjectId, attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const actionClicked = (type, attributes) => createEvent('ui', 'clicked', getActionSubject(type), 'action', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const reportingLinesClicked = attributes => createEvent('ui', 'clicked', USER_SUBJECT, 'reportingLines', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const moreActionsClicked = (type, attributes) => createEvent('ui', 'clicked', getActionSubject(type), 'moreActions', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const teamAvatarClicked = attributes => createEvent('ui', 'clicked', TEAM_SUBJECT, 'avatar', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const moreMembersClicked = attributes => createEvent('ui', 'clicked', TEAM_SUBJECT, 'moreMembers', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const errorRetryClicked = attributes => createEvent('ui', 'clicked', TEAM_SUBJECT, 'errorRetry', attributes);
/**
* @private
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
*/
export const agentRequestAnalytics = (action, actionSubjectId, attributes) => createEvent('operational', action, AGENT_SUBJECT, actionSubjectId || 'request', attributes);