@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
60 lines (59 loc) • 2.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SEVERITY = void 0;
Object.defineProperty(exports, "UNSUPPORTED_CONTENT_LEVEL_SEVERITY", {
enumerable: true,
get: function get() {
return _getUnsupportedContentLevelData.UNSUPPORTED_CONTENT_LEVEL_SEVERITY;
}
});
Object.defineProperty(exports, "UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS", {
enumerable: true,
get: function get() {
return _getUnsupportedContentLevelData.UNSUPPORTED_CONTENT_LEVEL_SEVERITY_THRESHOLD_DEFAULTS;
}
});
exports.getAnalyticsEventSeverity = exports.getAnalyticsEditorAppearance = exports.getAnalyticsAppearance = exports.analyticsEventKey = void 0;
Object.defineProperty(exports, "getUnsupportedContentLevelData", {
enumerable: true,
get: function get() {
return _getUnsupportedContentLevelData.getUnsupportedContentLevelData;
}
});
var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
var _getUnsupportedContentLevelData = require("./unsupportedContent/get-unsupported-content-level-data");
var getAnalyticsAppearance = exports.getAnalyticsAppearance = function getAnalyticsAppearance(appearance) {
switch (appearance) {
case 'full-page':
return _analyticsNamespacedContext.EDITOR_APPEARANCE_CONTEXT.FIXED_WIDTH;
case 'full-width':
return _analyticsNamespacedContext.EDITOR_APPEARANCE_CONTEXT.FULL_WIDTH;
case 'comment':
return _analyticsNamespacedContext.EDITOR_APPEARANCE_CONTEXT.COMMENT;
case 'chromeless':
return _analyticsNamespacedContext.EDITOR_APPEARANCE_CONTEXT.CHROMELESS;
case 'mobile':
return _analyticsNamespacedContext.EDITOR_APPEARANCE_CONTEXT.MOBILE;
}
};
var getAnalyticsEditorAppearance = exports.getAnalyticsEditorAppearance = function getAnalyticsEditorAppearance(editorAppearance) {
return editorAppearance ? "editor_".concat(getAnalyticsAppearance(editorAppearance)) : '_unknown';
};
var getAnalyticsEventSeverity = exports.getAnalyticsEventSeverity = function getAnalyticsEventSeverity(duration, normalThreshold, degradedThreshold) {
if (duration > normalThreshold && duration <= degradedThreshold) {
return SEVERITY.DEGRADED;
}
if (duration > degradedThreshold) {
return SEVERITY.BLOCKING;
}
return SEVERITY.NORMAL;
};
var SEVERITY = exports.SEVERITY = /*#__PURE__*/function (SEVERITY) {
SEVERITY["NORMAL"] = "normal";
SEVERITY["DEGRADED"] = "degraded";
SEVERITY["BLOCKING"] = "blocking";
return SEVERITY;
}({});
var analyticsEventKey = exports.analyticsEventKey = 'EDITOR_ANALYTICS_EVENT';