@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
35 lines • 1.53 kB
JavaScript
import { EDITOR_APPEARANCE_CONTEXT } from '@atlaskit/analytics-namespaced-context';
export var getAnalyticsAppearance = function 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 var getAnalyticsEditorAppearance = function getAnalyticsEditorAppearance(editorAppearance) {
return editorAppearance ? "editor_".concat(getAnalyticsAppearance(editorAppearance)) : '_unknown';
};
export var getAnalyticsEventSeverity = function getAnalyticsEventSeverity(duration, normalThreshold, degradedThreshold) {
if (duration > normalThreshold && duration <= degradedThreshold) {
return SEVERITY.DEGRADED;
}
if (duration > degradedThreshold) {
return SEVERITY.BLOCKING;
}
return SEVERITY.NORMAL;
};
export var 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 var analyticsEventKey = 'EDITOR_ANALYTICS_EVENT';