@atlaskit/editor-common 110.2.3 → 110.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 110.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e3780960bb0ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3780960bb0ae) - ##
8
+ What Update `EditorAnalyticsAPI` to allow for `fireAnalyticsEvent` to use a custom payload if an
9
+ explicit type parameter is used. This is mostly used by the analytics plugin
10
+
11
+ ```ts
12
+ // Example
13
+ api?.analytics.actions.fireAnalyticsEvent<CustomPayload, 'customEventType'>({ ... });
14
+ ```
15
+
16
+ ## Why
17
+
18
+ The current Payload structure is not extensible. There are times we don't want to update the base
19
+ analytics types (and increase bundle size) and scope them only to a specific package. This
20
+ provides an escape hatch but still enforces some level of type safety (currently there are some
21
+ examples of using `ts-expect-error` to side step this).
22
+
23
+ ## How to upgrade
24
+
25
+ In most scenarios this should not cause any breaking change but can be breaking if you are side
26
+ stepping type safety here with `ts-expect-error`.
27
+
3
28
  ## 110.2.3
4
29
 
5
30
  ### Patch Changes
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "110.2.2";
19
+ var packageVersion = "110.2.3";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // Ignored via go/ees007
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "110.2.2";
27
+ var packageVersion = "110.2.3";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "110.2.2";
4
+ const packageVersion = "110.2.3";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "110.2.2";
17
+ const packageVersion = "110.2.3";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "110.2.2";
10
+ var packageVersion = "110.2.3";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "110.2.2";
24
+ var packageVersion = "110.2.3";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -6,6 +6,15 @@ export type FireAnalyticsEventOptions = {
6
6
  };
7
7
  immediate?: boolean;
8
8
  };
9
+ export type BaseEventPayload = {
10
+ action: string;
11
+ actionSubject: string;
12
+ actionSubjectId?: string | null;
13
+ attributes?: {
14
+ [key: string]: any;
15
+ };
16
+ eventType: string;
17
+ };
9
18
  export type EditorAnalyticsAPI = {
10
19
  /**
11
20
  * attachAnalyticsEvent is used to attach an analytics payloads to a transaction
@@ -24,6 +33,12 @@ export type EditorAnalyticsAPI = {
24
33
  * @param {object} [options] - optional options object
25
34
  * @param {boolean} [options.immediate] - if true, fire the event immediately
26
35
  * @param {object} [options.context] - optional context object will include the selection data.
36
+ *
37
+ * @example
38
+ * You can also pass custom events using a special type signature:
39
+ * ```ts
40
+ * editorAnalyticsAPI.fireAnalyticsEvent<CustomEventType, 'customEventType'>(...);
41
+ * ```
27
42
  */
28
- fireAnalyticsEvent: (payload: AnalyticsEventPayload, channel?: string, options?: FireAnalyticsEventOptions) => void | undefined;
43
+ fireAnalyticsEvent: (<Payload extends BaseEventPayload, CustomEventType extends 'customEventType' | false = false>(payload: CustomEventType extends 'customEventType' ? Payload : never, channel?: string, options?: FireAnalyticsEventOptions) => void | undefined) & ((payload: AnalyticsEventPayload, channel?: string, options?: FireAnalyticsEventOptions) => void | undefined);
29
44
  };
@@ -36,7 +36,7 @@ export type { OperationalAEP } from './types/utils';
36
36
  export type { PluginMethodReport, PluginsReport, NodeCount, PluginPerformanceReportData, } from './types/performance-report';
37
37
  export type { InitialiseFragmentMarksAEP, ConnectedNodesAEP, DisconnectedSourceAEP, DisconnectedTargetAEP, GotConnectionsAEP, UpdatedFragmentMarkNameAEP, UpdatedSourceAEP, UpdatedTargetAEP, } from './types/referentiality-events';
38
38
  export type { ViewInlineCommentsButtonEventAEP, ViewEventPayload } from './types/view-events';
39
- export type { EditorAnalyticsAPI, FireAnalyticsEventOptions } from './api';
39
+ export type { EditorAnalyticsAPI, FireAnalyticsEventOptions, BaseEventPayload } from './api';
40
40
  export { editorAnalyticsChannel, fireAnalyticsEvent } from './fire-analytics-event';
41
41
  export { getAnalyticsEventsFromTransaction } from './utils';
42
42
  export { buildEditLinkPayload, buildVisitedLinkPayload, buildVisitedNonHyperLinkPayload, buildOpenedSettingsPayload, unlinkPayload, } from './linking-utils';
@@ -6,6 +6,15 @@ export type FireAnalyticsEventOptions = {
6
6
  };
7
7
  immediate?: boolean;
8
8
  };
9
+ export type BaseEventPayload = {
10
+ action: string;
11
+ actionSubject: string;
12
+ actionSubjectId?: string | null;
13
+ attributes?: {
14
+ [key: string]: any;
15
+ };
16
+ eventType: string;
17
+ };
9
18
  export type EditorAnalyticsAPI = {
10
19
  /**
11
20
  * attachAnalyticsEvent is used to attach an analytics payloads to a transaction
@@ -24,6 +33,12 @@ export type EditorAnalyticsAPI = {
24
33
  * @param {object} [options] - optional options object
25
34
  * @param {boolean} [options.immediate] - if true, fire the event immediately
26
35
  * @param {object} [options.context] - optional context object will include the selection data.
36
+ *
37
+ * @example
38
+ * You can also pass custom events using a special type signature:
39
+ * ```ts
40
+ * editorAnalyticsAPI.fireAnalyticsEvent<CustomEventType, 'customEventType'>(...);
41
+ * ```
27
42
  */
28
- fireAnalyticsEvent: (payload: AnalyticsEventPayload, channel?: string, options?: FireAnalyticsEventOptions) => void | undefined;
43
+ fireAnalyticsEvent: (<Payload extends BaseEventPayload, CustomEventType extends 'customEventType' | false = false>(payload: CustomEventType extends 'customEventType' ? Payload : never, channel?: string, options?: FireAnalyticsEventOptions) => void | undefined) & ((payload: AnalyticsEventPayload, channel?: string, options?: FireAnalyticsEventOptions) => void | undefined);
29
44
  };
@@ -36,7 +36,7 @@ export type { OperationalAEP } from './types/utils';
36
36
  export type { PluginMethodReport, PluginsReport, NodeCount, PluginPerformanceReportData, } from './types/performance-report';
37
37
  export type { InitialiseFragmentMarksAEP, ConnectedNodesAEP, DisconnectedSourceAEP, DisconnectedTargetAEP, GotConnectionsAEP, UpdatedFragmentMarkNameAEP, UpdatedSourceAEP, UpdatedTargetAEP, } from './types/referentiality-events';
38
38
  export type { ViewInlineCommentsButtonEventAEP, ViewEventPayload } from './types/view-events';
39
- export type { EditorAnalyticsAPI, FireAnalyticsEventOptions } from './api';
39
+ export type { EditorAnalyticsAPI, FireAnalyticsEventOptions, BaseEventPayload } from './api';
40
40
  export { editorAnalyticsChannel, fireAnalyticsEvent } from './fire-analytics-event';
41
41
  export { getAnalyticsEventsFromTransaction } from './utils';
42
42
  export { buildEditLinkPayload, buildVisitedLinkPayload, buildVisitedNonHyperLinkPayload, buildOpenedSettingsPayload, unlinkPayload, } from './linking-utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "110.2.3",
3
+ "version": "110.3.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -71,7 +71,7 @@
71
71
  "@atlaskit/platform-feature-flags-react": "^0.3.0",
72
72
  "@atlaskit/popper": "^7.1.0",
73
73
  "@atlaskit/primitives": "^14.15.0",
74
- "@atlaskit/profilecard": "^24.14.0",
74
+ "@atlaskit/profilecard": "^24.15.0",
75
75
  "@atlaskit/react-ufo": "^4.11.0",
76
76
  "@atlaskit/section-message": "^8.7.0",
77
77
  "@atlaskit/smart-card": "^42.3.0",