UNPKG

@atlaskit/editor-plugin-media

Version:

Media plugin for @atlaskit/editor-core

51 lines 1.16 kB
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics'; export const getMediaResizeAnalyticsEvent = (type, attributes) => { if (!attributes) { return; } const { width, widthType, layout, snapType, parentNode } = attributes; const actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE; return { action: ACTION.EDITED, actionSubject, actionSubjectId: ACTION_SUBJECT_ID.RESIZED, attributes: { width, layout, widthType, snapType, parentNode }, eventType: EVENT_TYPE.UI }; }; export const getMediaInputResizeAnalyticsEvent = (type, attributes) => { if (!attributes) { return; } const { width, layout, validation, parentNode } = attributes; const actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE; return { action: ACTION.EDITED, actionSubject, actionSubjectId: ACTION_SUBJECT_ID.RESIZED, attributes: { width, layout, validation, parentNode }, eventType: EVENT_TYPE.UI }; };