@atlaskit/insm 0.2.4 → 0.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,16 @@
1
1
  # @atlaskit/insm
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`707c5a42b5358`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/707c5a42b5358) -
8
+ [ux] Updates LCM for new Read only mode. Also adds a new static property setter to the insm api.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 0.2.4
4
15
 
5
16
  ### Patch Changes
package/README.md CHANGED
@@ -43,7 +43,22 @@ tracked on the resulting session event.
43
43
 
44
44
  ### Adding additional information to the session
45
45
 
46
- Additional session information can be added through the `addProperties` api.
46
+ Additional session information can be added through either the `setProperty` or the `addProperties`
47
+ api.
48
+
49
+ #### setProperty
50
+
51
+ ```ts
52
+ insm.session.setProperty(key: string, value: string | number | boolean): void
53
+ ```
54
+
55
+ This api is an alternative to addProperties for scenarios such as where you have a hot path that
56
+ will repeatedly fire throughout a session.
57
+
58
+ The last value for a given key will be used, and if there is a matching key from addProperties, the
59
+ addProperties value will be used.
60
+
61
+ #### addProperties
47
62
 
48
63
  ```ts
49
64
  type ValidProperty = string | number | boolean;
@@ -31,6 +31,7 @@ var INSMSession = exports.INSMSession = /*#__PURE__*/function () {
31
31
  (0, _defineProperty2.default)(this, "pageLoadTime", null);
32
32
  (0, _defineProperty2.default)(this, "running", true);
33
33
  (0, _defineProperty2.default)(this, "addedProperties", []);
34
+ (0, _defineProperty2.default)(this, "staticProperties", {});
34
35
  (0, _defineProperty2.default)(this, "runningFeatures", new Set());
35
36
  this.experienceKey = experienceKey;
36
37
  this.experienceProperties = experienceProperties;
@@ -98,6 +99,23 @@ var INSMSession = exports.INSMSession = /*#__PURE__*/function () {
98
99
  };
99
100
  }
100
101
 
102
+ /**
103
+ * This api is an alternative to addProperties for scenarios
104
+ * such as where you have a hot path that will repeatedly fire
105
+ * throughout a session.
106
+ * The last value for a given key will be used, and if there is a
107
+ * matching key from addProperties, the addProperties value will be used.
108
+ *
109
+ * ```ts
110
+ * insm.session.addProperties('custom:lcm', true)
111
+ * ```
112
+ */
113
+ }, {
114
+ key: "setProperty",
115
+ value: function setProperty(key, value) {
116
+ this.staticProperties[key] = value;
117
+ }
118
+
101
119
  /**
102
120
  * This api takes either a static single-level key-value object, or callbacks which return the same and
103
121
  * will be evaluated on session end.
@@ -186,7 +204,7 @@ var INSMSession = exports.INSMSession = /*#__PURE__*/function () {
186
204
  var operationalEvent = {
187
205
  actionSubject: 'insm',
188
206
  action: 'measured',
189
- attributes: _objectSpread(_objectSpread(_objectSpread({}, evaluatedAddedProperties), {}, {
207
+ attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this.staticProperties), evaluatedAddedProperties), {}, {
190
208
  'event:population': this.insm.options.population,
191
209
  experienceKey: this.experienceKey,
192
210
  initial: this.experienceProperties.initial,
@@ -17,6 +17,7 @@ export class INSMSession {
17
17
  _defineProperty(this, "pageLoadTime", null);
18
18
  _defineProperty(this, "running", true);
19
19
  _defineProperty(this, "addedProperties", []);
20
+ _defineProperty(this, "staticProperties", {});
20
21
  _defineProperty(this, "runningFeatures", new Set());
21
22
  this.experienceKey = experienceKey;
22
23
  this.experienceProperties = experienceProperties;
@@ -74,6 +75,21 @@ export class INSMSession {
74
75
  };
75
76
  }
76
77
 
78
+ /**
79
+ * This api is an alternative to addProperties for scenarios
80
+ * such as where you have a hot path that will repeatedly fire
81
+ * throughout a session.
82
+ * The last value for a given key will be used, and if there is a
83
+ * matching key from addProperties, the addProperties value will be used.
84
+ *
85
+ * ```ts
86
+ * insm.session.addProperties('custom:lcm', true)
87
+ * ```
88
+ */
89
+ setProperty(key, value) {
90
+ this.staticProperties[key] = value;
91
+ }
92
+
77
93
  /**
78
94
  * This api takes either a static single-level key-value object, or callbacks which return the same and
79
95
  * will be evaluated on session end.
@@ -149,6 +165,7 @@ export class INSMSession {
149
165
  action: 'measured',
150
166
  attributes: {
151
167
  // Added first to ensure these don't overwrite any insm properties
168
+ ...this.staticProperties,
152
169
  ...evaluatedAddedProperties,
153
170
  'event:population': this.insm.options.population,
154
171
  experienceKey: this.experienceKey,
@@ -25,6 +25,7 @@ export var INSMSession = /*#__PURE__*/function () {
25
25
  _defineProperty(this, "pageLoadTime", null);
26
26
  _defineProperty(this, "running", true);
27
27
  _defineProperty(this, "addedProperties", []);
28
+ _defineProperty(this, "staticProperties", {});
28
29
  _defineProperty(this, "runningFeatures", new Set());
29
30
  this.experienceKey = experienceKey;
30
31
  this.experienceProperties = experienceProperties;
@@ -92,6 +93,23 @@ export var INSMSession = /*#__PURE__*/function () {
92
93
  };
93
94
  }
94
95
 
96
+ /**
97
+ * This api is an alternative to addProperties for scenarios
98
+ * such as where you have a hot path that will repeatedly fire
99
+ * throughout a session.
100
+ * The last value for a given key will be used, and if there is a
101
+ * matching key from addProperties, the addProperties value will be used.
102
+ *
103
+ * ```ts
104
+ * insm.session.addProperties('custom:lcm', true)
105
+ * ```
106
+ */
107
+ }, {
108
+ key: "setProperty",
109
+ value: function setProperty(key, value) {
110
+ this.staticProperties[key] = value;
111
+ }
112
+
95
113
  /**
96
114
  * This api takes either a static single-level key-value object, or callbacks which return the same and
97
115
  * will be evaluated on session end.
@@ -180,7 +198,7 @@ export var INSMSession = /*#__PURE__*/function () {
180
198
  var operationalEvent = {
181
199
  actionSubject: 'insm',
182
200
  action: 'measured',
183
- attributes: _objectSpread(_objectSpread(_objectSpread({}, evaluatedAddedProperties), {}, {
201
+ attributes: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this.staticProperties), evaluatedAddedProperties), {}, {
184
202
  'event:population': this.insm.options.population,
185
203
  experienceKey: this.experienceKey,
186
204
  initial: this.experienceProperties.initial,
@@ -9,5 +9,5 @@ export declare function init(options: INSMOptions): void;
9
9
  * **In**teractivity **s**ession **m**onitoring
10
10
  */
11
11
  export declare const insm: Pick<INSM, 'start' | 'stopEarly' | 'startHeavyTask' | 'endHeavyTask' | 'overrideExperienceKey'> & {
12
- session: Pick<INSMSession, 'details' | 'startFeature' | 'endFeature' | 'addProperties'> | undefined;
12
+ session: Pick<INSMSession, 'details' | 'startFeature' | 'endFeature' | 'addProperties' | 'setProperty'> | undefined;
13
13
  };
@@ -17,6 +17,7 @@ export declare class INSMSession {
17
17
  insm: INSM;
18
18
  private running;
19
19
  private addedProperties;
20
+ private staticProperties;
20
21
  runningFeatures: Set<string>;
21
22
  periodTracking: PeriodTracking;
22
23
  longAnimationFrameMeasurer: LongAnimationFrameMeasurer;
@@ -49,6 +50,18 @@ export declare class INSMSession {
49
50
  */
50
51
  running: boolean;
51
52
  };
53
+ /**
54
+ * This api is an alternative to addProperties for scenarios
55
+ * such as where you have a hot path that will repeatedly fire
56
+ * throughout a session.
57
+ * The last value for a given key will be used, and if there is a
58
+ * matching key from addProperties, the addProperties value will be used.
59
+ *
60
+ * ```ts
61
+ * insm.session.addProperties('custom:lcm', true)
62
+ * ```
63
+ */
64
+ setProperty(key: string, value: number | string | boolean): void;
52
65
  /**
53
66
  * This api takes either a static single-level key-value object, or callbacks which return the same and
54
67
  * will be evaluated on session end.
@@ -9,5 +9,5 @@ export declare function init(options: INSMOptions): void;
9
9
  * **In**teractivity **s**ession **m**onitoring
10
10
  */
11
11
  export declare const insm: Pick<INSM, 'start' | 'stopEarly' | 'startHeavyTask' | 'endHeavyTask' | 'overrideExperienceKey'> & {
12
- session: Pick<INSMSession, 'details' | 'startFeature' | 'endFeature' | 'addProperties'> | undefined;
12
+ session: Pick<INSMSession, 'details' | 'startFeature' | 'endFeature' | 'addProperties' | 'setProperty'> | undefined;
13
13
  };
@@ -17,6 +17,7 @@ export declare class INSMSession {
17
17
  insm: INSM;
18
18
  private running;
19
19
  private addedProperties;
20
+ private staticProperties;
20
21
  runningFeatures: Set<string>;
21
22
  periodTracking: PeriodTracking;
22
23
  longAnimationFrameMeasurer: LongAnimationFrameMeasurer;
@@ -49,6 +50,18 @@ export declare class INSMSession {
49
50
  */
50
51
  running: boolean;
51
52
  };
53
+ /**
54
+ * This api is an alternative to addProperties for scenarios
55
+ * such as where you have a hot path that will repeatedly fire
56
+ * throughout a session.
57
+ * The last value for a given key will be used, and if there is a
58
+ * matching key from addProperties, the addProperties value will be used.
59
+ *
60
+ * ```ts
61
+ * insm.session.addProperties('custom:lcm', true)
62
+ * ```
63
+ */
64
+ setProperty(key: string, value: number | string | boolean): void;
52
65
  /**
53
66
  * This api takes either a static single-level key-value object, or callbacks which return the same and
54
67
  * will be evaluated on session end.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/insm",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "description": "INSM tooling measures user-perceived interactivity of a page",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@atlaskit/analytics-listeners": "^9.3.0",
29
29
  "@atlaskit/platform-feature-flags": "^1.1.0",
30
- "@atlaskit/tmp-editor-statsig": "^17.0.0",
30
+ "@atlaskit/tmp-editor-statsig": "^17.5.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "bowser-ultralight": "^1.0.6"
33
33
  },