@atlaskit/smart-card 25.9.4 → 25.9.5

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,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 25.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e241a5dda48`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e241a5dda48) - Add 'keyboard' clickType for link clicked analytics events when user interacts with links using keyboard
8
+
3
9
  ## 25.9.4
4
10
 
5
11
  ### Patch Changes
@@ -35,6 +35,7 @@ function getLinkClickOutcome(e, clickType) {
35
35
  }
36
36
  switch (clickType) {
37
37
  case 'left':
38
+ case 'keyboard':
38
39
  {
39
40
  // Meta key = Cmd for macOS, Windows key sometimes for Windows (otherwise false)
40
41
  // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey
@@ -94,7 +95,10 @@ var linkClickedEvent = function linkClickedEvent(_ref) {
94
95
  };
95
96
  };
96
97
  var createLinkClickedPayload = function createLinkClickedPayload(event) {
97
- var clickType = buttonMap.get(event.button);
98
+ // Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
99
+ // https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
100
+ var isKeyboard = event.nativeEvent.detail === 0;
101
+ var clickType = isKeyboard ? 'keyboard' : buttonMap.get(event.button);
98
102
  if (!clickType) {
99
103
  return;
100
104
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.9.4",
3
+ "version": "25.9.5",
4
4
  "sideEffects": false
5
5
  }
@@ -21,6 +21,7 @@ export function getLinkClickOutcome(e, clickType) {
21
21
  }
22
22
  switch (clickType) {
23
23
  case 'left':
24
+ case 'keyboard':
24
25
  {
25
26
  // Meta key = Cmd for macOS, Windows key sometimes for Windows (otherwise false)
26
27
  // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey
@@ -79,7 +80,10 @@ const linkClickedEvent = ({
79
80
  }
80
81
  });
81
82
  export const createLinkClickedPayload = event => {
82
- const clickType = buttonMap.get(event.button);
83
+ // Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
84
+ // https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
85
+ const isKeyboard = event.nativeEvent.detail === 0;
86
+ const clickType = isKeyboard ? 'keyboard' : buttonMap.get(event.button);
83
87
  if (!clickType) {
84
88
  return;
85
89
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.9.4",
3
+ "version": "25.9.5",
4
4
  "sideEffects": false
5
5
  }
@@ -25,6 +25,7 @@ export function getLinkClickOutcome(e, clickType) {
25
25
  }
26
26
  switch (clickType) {
27
27
  case 'left':
28
+ case 'keyboard':
28
29
  {
29
30
  // Meta key = Cmd for macOS, Windows key sometimes for Windows (otherwise false)
30
31
  // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey
@@ -84,7 +85,10 @@ var linkClickedEvent = function linkClickedEvent(_ref) {
84
85
  };
85
86
  };
86
87
  export var createLinkClickedPayload = function createLinkClickedPayload(event) {
87
- var clickType = buttonMap.get(event.button);
88
+ // Through the `detail` property, we're able to determine if the event is (most likely) triggered via keyboard
89
+ // https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
90
+ var isKeyboard = event.nativeEvent.detail === 0;
91
+ var clickType = isKeyboard ? 'keyboard' : buttonMap.get(event.button);
88
92
  if (!clickType) {
89
93
  return;
90
94
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.9.4",
3
+ "version": "25.9.5",
4
4
  "sideEffects": false
5
5
  }
@@ -105,7 +105,7 @@ export declare type InstrumentEventProps = CommonEventProps & {
105
105
  status: CardType;
106
106
  id: string;
107
107
  };
108
- export declare type ClickType = 'left' | 'middle' | 'right' | 'none';
108
+ export declare type ClickType = 'left' | 'middle' | 'right' | 'keyboard' | 'none';
109
109
  export declare type ClickOutcome = 'prevented' | 'clickThrough' | 'clickThroughNewTabOrWindow' | 'contextMenu' | 'alt' | 'contentEditable' | 'unknown';
110
110
  export declare type UiLinkClickedEventProps = {
111
111
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.9.4",
3
+ "version": "25.9.5",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,7 +34,7 @@
34
34
  "@atlaskit/icon-priority": "^6.3.0",
35
35
  "@atlaskit/in-product-testing": "^0.1.0",
36
36
  "@atlaskit/link-client-extension": "^0.5.0",
37
- "@atlaskit/linking-common": "^2.6.0",
37
+ "@atlaskit/linking-common": "^2.7.0",
38
38
  "@atlaskit/linking-types": "^1.3.0",
39
39
  "@atlaskit/logo": "^13.13.0",
40
40
  "@atlaskit/lozenge": "^11.3.0",
@@ -77,7 +77,7 @@
77
77
  "@atlaskit/link-test-helpers": "^2.2.0",
78
78
  "@atlaskit/lozenge": "^11.3.0",
79
79
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
80
- "@atlaskit/media-test-helpers": "^32.0.0",
80
+ "@atlaskit/media-test-helpers": "^32.1.0",
81
81
  "@atlaskit/page": "^12.2.0",
82
82
  "@atlaskit/radio": "^5.4.0",
83
83
  "@atlaskit/range": "^7.0.0",