UNPKG

@atlaskit/editor-plugin-media

Version:

Media plugin for @atlaskit/editor-core

30 lines (27 loc) • 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isMediaDropPositionEnabled = exports.exposeMediaDropPosition = void 0; var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled"); var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure"); var MEDIA_DROP_POSITION_EXPERIMENT = 'platform_editor_media_drop_position'; /** * Enrols the user and returns whether they are in the test cohort. * * Called only from the dropzone's drag-enter and drop callbacks, which fire exclusively for * accepted external file interactions, so both cohorts enrol at the same point. */ var exposeMediaDropPosition = exports.exposeMediaDropPosition = function exposeMediaDropPosition() { return (0, _isExperimentEnabled.isExperimentEnabled)(MEDIA_DROP_POSITION_EXPERIMENT); }; /** * Returns whether the user is in the test cohort without enrolling them. * * Used by the render, transaction and decoration paths, which run for every editor user on * every transaction and would otherwise enrol people who never drag a file. Enrolment happens * in {@link exposeMediaDropPosition}. */ var isMediaDropPositionEnabled = exports.isMediaDropPositionEnabled = function isMediaDropPositionEnabled() { return (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)(MEDIA_DROP_POSITION_EXPERIMENT, 'isEnabled', false) === true; };