@atlaskit/editor-common 110.25.0 → 110.25.2

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/analytics/types/enums.js +2 -0
  3. package/dist/cjs/analytics/types/experience-events.js +5 -0
  4. package/dist/cjs/experiences/Experience.js +104 -46
  5. package/dist/cjs/experiences/consts.js +13 -2
  6. package/dist/cjs/experiences/experience-state.js +32 -0
  7. package/dist/cjs/monitoring/error.js +1 -1
  8. package/dist/cjs/styles/shared/table.js +1 -0
  9. package/dist/cjs/ui/DropList/index.js +1 -1
  10. package/dist/cjs/user-intent/UserIntentPopupWrapper.js +1 -1
  11. package/dist/es2019/analytics/types/enums.js +2 -0
  12. package/dist/es2019/analytics/types/experience-events.js +1 -0
  13. package/dist/es2019/experiences/Experience.js +102 -42
  14. package/dist/es2019/experiences/consts.js +12 -1
  15. package/dist/es2019/experiences/experience-state.js +26 -0
  16. package/dist/es2019/monitoring/error.js +1 -1
  17. package/dist/es2019/styles/shared/table.js +1 -0
  18. package/dist/es2019/ui/DropList/index.js +1 -1
  19. package/dist/es2019/user-intent/UserIntentPopupWrapper.js +2 -2
  20. package/dist/esm/analytics/types/enums.js +2 -0
  21. package/dist/esm/analytics/types/experience-events.js +1 -0
  22. package/dist/esm/experiences/Experience.js +104 -46
  23. package/dist/esm/experiences/consts.js +12 -1
  24. package/dist/esm/experiences/experience-state.js +26 -0
  25. package/dist/esm/monitoring/error.js +1 -1
  26. package/dist/esm/styles/shared/table.js +1 -0
  27. package/dist/esm/ui/DropList/index.js +1 -1
  28. package/dist/esm/user-intent/UserIntentPopupWrapper.js +1 -1
  29. package/dist/types/analytics/index.d.ts +1 -0
  30. package/dist/types/analytics/types/enums.d.ts +2 -0
  31. package/dist/types/analytics/types/events.d.ts +2 -1
  32. package/dist/types/analytics/types/experience-events.d.ts +34 -0
  33. package/dist/types/experiences/Experience.d.ts +57 -11
  34. package/dist/types/experiences/consts.d.ts +10 -0
  35. package/dist/types/experiences/experience-state.d.ts +16 -0
  36. package/dist/types/styles/shared/table.d.ts +1 -0
  37. package/dist/types-ts4.5/analytics/index.d.ts +1 -0
  38. package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -0
  39. package/dist/types-ts4.5/analytics/types/events.d.ts +2 -1
  40. package/dist/types-ts4.5/analytics/types/experience-events.d.ts +34 -0
  41. package/dist/types-ts4.5/experiences/Experience.d.ts +57 -11
  42. package/dist/types-ts4.5/experiences/consts.d.ts +10 -0
  43. package/dist/types-ts4.5/experiences/experience-state.d.ts +16 -0
  44. package/dist/types-ts4.5/styles/shared/table.d.ts +1 -0
  45. package/package.json +3 -3
@@ -1,10 +1,30 @@
1
- import { type CustomData } from '@atlaskit/ufo';
1
+ import type { CustomData } from '@atlaskit/ufo';
2
+ import type { DispatchAnalyticsEvent } from '../analytics';
2
3
  import type { ExperienceCheck } from './ExperienceCheck';
3
4
  type ExperienceOptions = {
4
5
  /**
5
- * Checks used to determine experience completion, either success, or failure.
6
+ * Checks used to control experience transition to various states.
7
+ * Once the experience is in progress, these checks can automatically trigger
8
+ * state transitions (e.g., timeout check to trigger failure).
6
9
  */
7
10
  checks?: ExperienceCheck[];
11
+ /**
12
+ * Function to dispatch analytics events for experience tracking.
13
+ * Required for tracking experienceMeasured and experienceSampled events.
14
+ */
15
+ dispatchAnalyticsEvent: DispatchAnalyticsEvent;
16
+ /**
17
+ * Sample rate for experienceSampled events.
18
+ * Determines how frequently we should track events for the experience based on
19
+ * expected volume. Value should be between 0 and 1.
20
+ *
21
+ * @default DEFAULT_EXPERIENCE_SAMPLE_RATE (0.001 = 1 in 1000)
22
+ *
23
+ * Newly defined experiences should use the default unless they have data
24
+ * to justify a different rate. Measurements should be gathered after initial
25
+ * instrumentation, then the sample rate can be tuned up to a safe threshold.
26
+ */
27
+ sampleRate?: number;
8
28
  };
9
29
  type ExperienceStartOptions = {
10
30
  metadata?: CustomData;
@@ -14,21 +34,49 @@ type ExperienceEndOptions = {
14
34
  };
15
35
  export declare class Experience {
16
36
  private readonly id;
17
- private readonly options;
18
- private _ufoExperience;
37
+ private readonly dispatchAnalyticsEvent;
38
+ private readonly sampleRate;
19
39
  private check;
20
40
  private startOptions;
21
- constructor(id: string, options?: ExperienceOptions);
22
- private get ufoExperience();
41
+ private currentState;
42
+ private statesSeen;
43
+ /**
44
+ * Indicates whether sampled tracking is enabled for this current experience session.
45
+ *
46
+ * Set to true | false upon transitioning to 'started' state.
47
+ * When true, on subsequent transitions we fire experienceSampled events.
48
+ * Ensures that every tracked start has corresponding abort/fail/success tracked.
49
+ */
50
+ private isSampledTrackingEnabled;
51
+ constructor(id: string, options: ExperienceOptions);
23
52
  private startCheck;
24
53
  private stopCheck;
25
- private isInProgress;
26
54
  private getEndStateConfig;
55
+ /**
56
+ * Transitions to a new experience state and tracks analytics events.
57
+ *
58
+ * Upon transition to each state, two events are tracked:
59
+ * - experienceMeasured: tracked on every successful transition, used for data analysis
60
+ * - experienceSampled: tracked only on 1 out of every N transitions based on sample rate
61
+ *
62
+ * @param toState - The target state to transition to
63
+ * @param metadata - Optional metadata to attach to the analytics events
64
+ * @returns true if transition was successful, false if invalid transition
65
+ */
66
+ private transitionTo;
67
+ /**
68
+ * Tracks analytics events for a state transition.
69
+ *
70
+ * Fires both experienceMeasured (always) and experienceSampled (sampled) events.
71
+ *
72
+ * @param toState - The state that was transitioned to
73
+ * @param metadata - Metadata to include in the event, including firstInSession flag
74
+ */
75
+ private trackTransition;
27
76
  /**
28
77
  * Starts tracking the experience and all checks which monitor for completion.
29
78
  *
30
- * If the experience is already in progress, this will restart the checks.
31
- * Metadata from options will be merged with any end state metadata.
79
+ * Metadata from options will be merged with metadata provided in subsequent events.
32
80
  *
33
81
  * @param options - Configuration for starting the experience
34
82
  * @param options.metadata - Optional metadata attached to all subsequent events for this started experience
@@ -37,8 +85,6 @@ export declare class Experience {
37
85
  /**
38
86
  * Marks the experience as successful and stops any ongoing checks.
39
87
  *
40
- * Use this when the experience completes as expected.
41
- *
42
88
  * @param options - Configuration for the success event
43
89
  * @param options.metadata - Optional metadata attached to the success event
44
90
  */
@@ -18,3 +18,13 @@ export declare const EXPERIENCE_FAILURE_REASON: {
18
18
  */
19
19
  readonly DOM_MUTATION_CHECK_ERROR: "dom-mutation-check-error";
20
20
  };
21
+ /**
22
+ * Default sample rate for experienceSampled events.
23
+ * Set to 1 in 1000 (0.001) to balance data collection with event volume.
24
+ *
25
+ * Newly defined experiences should use this default unless they have data
26
+ * to justify a different rate. The expectation is that measurements will be
27
+ * gathered after initial instrumentation, then the sample rate can be tuned
28
+ * up to a safe threshold.
29
+ */
30
+ export declare const DEFAULT_EXPERIENCE_SAMPLE_RATE = 0.001;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Represents the state of an experience throughout its lifecycle.
3
+ */
4
+ export type ExperienceState = 'pending' | 'started' | 'aborted' | 'failed' | 'succeeded';
5
+ /**
6
+ * State transition map defining valid state transitions.
7
+ */
8
+ export declare const EXPERIENCE_STATE_TRANSITIONS: Record<ExperienceState, ExperienceState[]>;
9
+ /**
10
+ * Validates whether a state transition is allowed.
11
+ *
12
+ * @param fromState - The current state
13
+ * @param toState - The target state to transition to
14
+ * @returns true if the transition is valid, false otherwise
15
+ */
16
+ export declare const canTransition: (fromState: ExperienceState, toState: ExperienceState) => boolean;
@@ -13,6 +13,7 @@ export declare const tableControlsSpacing: number;
13
13
  export declare const TableSharedCssClassName: {
14
14
  readonly TABLE_CONTAINER: "pm-table-container";
15
15
  readonly TABLE_NODE_WRAPPER: "pm-table-wrapper";
16
+ readonly TABLE_NODE_WRAPPER_NO_OVERFLOW: "pm-table-wrapper-no-overflow";
16
17
  readonly TABLE_SCROLL_INLINE_SHADOW: "pm-table-scroll-inline-shadow";
17
18
  readonly TABLE_RIGHT_BORDER: "pm-table-right-border";
18
19
  readonly TABLE_LEFT_BORDER: "pm-table-left-border";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "110.25.0",
3
+ "version": "110.25.2",
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/"
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/link-datasource": "^4.29.0",
58
58
  "@atlaskit/link-picker": "^3.16.0",
59
59
  "@atlaskit/media-card": "^79.6.0",
60
- "@atlaskit/media-client": "^35.5.0",
60
+ "@atlaskit/media-client": "^35.6.0",
61
61
  "@atlaskit/media-client-react": "^4.1.0",
62
62
  "@atlaskit/media-common": "^12.3.0",
63
63
  "@atlaskit/media-file-preview": "^0.11.0",
@@ -82,7 +82,7 @@
82
82
  "@atlaskit/task-decision": "^19.2.0",
83
83
  "@atlaskit/textfield": "^8.0.0",
84
84
  "@atlaskit/theme": "^21.0.0",
85
- "@atlaskit/tmp-editor-statsig": "^13.32.0",
85
+ "@atlaskit/tmp-editor-statsig": "^13.34.0",
86
86
  "@atlaskit/tokens": "^8.0.0",
87
87
  "@atlaskit/tooltip": "^20.8.0",
88
88
  "@atlaskit/ufo": "^0.4.0",