@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
33 lines • 1.42 kB
JavaScript
import { EDITOR_APPEARANCE_CONTEXT } from '@atlaskit/analytics-namespaced-context';
export const getAnalyticsAppearance = appearance => {
switch (appearance) {
case 'full-page':
return EDITOR_APPEARANCE_CONTEXT.FIXED_WIDTH;
case 'full-width':
return EDITOR_APPEARANCE_CONTEXT.FULL_WIDTH;
case 'comment':
return EDITOR_APPEARANCE_CONTEXT.COMMENT;
case 'chromeless':
return EDITOR_APPEARANCE_CONTEXT.CHROMELESS;
case 'mobile':
return EDITOR_APPEARANCE_CONTEXT.MOBILE;
}
};
export const getAnalyticsEditorAppearance = editorAppearance => editorAppearance ? `editor_${getAnalyticsAppearance(editorAppearance)}` : '_unknown';
export const getAnalyticsEventSeverity = (duration, normalThreshold, degradedThreshold) => {
if (duration > normalThreshold && duration <= degradedThreshold) {
return SEVERITY.DEGRADED;
}
if (duration > degradedThreshold) {
return SEVERITY.BLOCKING;
}
return SEVERITY.NORMAL;
};
export let SEVERITY = /*#__PURE__*/function (SEVERITY) {
SEVERITY["NORMAL"] = "normal";
SEVERITY["DEGRADED"] = "degraded";
SEVERITY["BLOCKING"] = "blocking";
return SEVERITY;
}({});
export { UNSUPPORTED_CONTENT_LEVEL_SEVERITY, getUnsupportedContentLevelData, UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS } from './unsupportedContent/get-unsupported-content-level-data';
export const analyticsEventKey = 'EDITOR_ANALYTICS_EVENT';