@atlaskit/smart-card 30.2.6 → 30.2.7

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
+ ## 30.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 30.2.6
4
10
 
5
11
  ### Patch Changes
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
22
22
  var context = exports.context = {
23
23
  componentName: 'smart-cards',
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "30.2.6"
25
+ packageVersion: "30.2.7"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -106,12 +106,25 @@ var createLinkClickedPayload = exports.createLinkClickedPayload = function creat
106
106
  var clickOutcome = getLinkClickOutcome(event, clickType);
107
107
  var keysHeld = getKeys(event);
108
108
  var defaultPrevented = event.defaultPrevented;
109
- return linkClickedEvent({
109
+ var linkClickedEventResult = linkClickedEvent({
110
110
  clickType: clickType,
111
111
  clickOutcome: clickOutcome,
112
112
  keysHeld: keysHeld,
113
113
  defaultPrevented: defaultPrevented
114
114
  });
115
+
116
+ // if the current target is an anchor tag, we can get the href from it and use that as the url being navigated too.
117
+ if (event.currentTarget instanceof HTMLAnchorElement) {
118
+ var url = event.currentTarget.href;
119
+ return _objectSpread(_objectSpread({}, linkClickedEventResult), {}, {
120
+ nonPrivacySafeAttributes: {
121
+ url: url
122
+ }
123
+ });
124
+ } else {
125
+ // We can't get the href from the event target, so dont include the url or any non privacy safe attributes
126
+ return linkClickedEventResult;
127
+ }
115
128
  };
116
129
  var fireLinkClickedEvent = exports.fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsEvent) {
117
130
  return function (event) {
@@ -119,7 +132,8 @@ var fireLinkClickedEvent = exports.fireLinkClickedEvent = function fireLinkClick
119
132
  var payload = createLinkClickedPayload(event);
120
133
  if (payload) {
121
134
  createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, payload), overrides), {}, {
122
- attributes: _objectSpread(_objectSpread({}, payload.attributes), overrides === null || overrides === void 0 ? void 0 : overrides.attributes)
135
+ attributes: _objectSpread(_objectSpread({}, payload.attributes), overrides === null || overrides === void 0 ? void 0 : overrides.attributes),
136
+ nonPrivacySafeAttributes: _objectSpread(_objectSpread({}, payload.nonPrivacySafeAttributes), overrides === null || overrides === void 0 ? void 0 : overrides.nonPrivacySafeAttributes)
123
137
  })).fire(_analytics.ANALYTICS_CHANNEL);
124
138
  }
125
139
  };
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
17
17
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
18
18
  var PACKAGE_DATA = {
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "30.2.6",
20
+ packageVersion: "30.2.7",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "30.2.6"
7
+ packageVersion: "30.2.7"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -92,12 +92,26 @@ export const createLinkClickedPayload = event => {
92
92
  const clickOutcome = getLinkClickOutcome(event, clickType);
93
93
  const keysHeld = getKeys(event);
94
94
  const defaultPrevented = event.defaultPrevented;
95
- return linkClickedEvent({
95
+ const linkClickedEventResult = linkClickedEvent({
96
96
  clickType,
97
97
  clickOutcome,
98
98
  keysHeld,
99
99
  defaultPrevented
100
100
  });
101
+
102
+ // if the current target is an anchor tag, we can get the href from it and use that as the url being navigated too.
103
+ if (event.currentTarget instanceof HTMLAnchorElement) {
104
+ const url = event.currentTarget.href;
105
+ return {
106
+ ...linkClickedEventResult,
107
+ nonPrivacySafeAttributes: {
108
+ url
109
+ }
110
+ };
111
+ } else {
112
+ // We can't get the href from the event target, so dont include the url or any non privacy safe attributes
113
+ return linkClickedEventResult;
114
+ }
101
115
  };
102
116
  export const fireLinkClickedEvent = createAnalyticsEvent => (event, overrides = {}) => {
103
117
  const payload = createLinkClickedPayload(event);
@@ -108,6 +122,10 @@ export const fireLinkClickedEvent = createAnalyticsEvent => (event, overrides =
108
122
  attributes: {
109
123
  ...payload.attributes,
110
124
  ...(overrides === null || overrides === void 0 ? void 0 : overrides.attributes)
125
+ },
126
+ nonPrivacySafeAttributes: {
127
+ ...payload.nonPrivacySafeAttributes,
128
+ ...(overrides === null || overrides === void 0 ? void 0 : overrides.nonPrivacySafeAttributes)
111
129
  }
112
130
  }).fire(ANALYTICS_CHANNEL);
113
131
  }
@@ -7,7 +7,7 @@ import LinkWarningModal from './LinkWarningModal';
7
7
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "30.2.6",
10
+ packageVersion: "30.2.7",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "30.2.6"
18
+ packageVersion: "30.2.7"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -97,12 +97,25 @@ export var createLinkClickedPayload = function createLinkClickedPayload(event) {
97
97
  var clickOutcome = getLinkClickOutcome(event, clickType);
98
98
  var keysHeld = getKeys(event);
99
99
  var defaultPrevented = event.defaultPrevented;
100
- return linkClickedEvent({
100
+ var linkClickedEventResult = linkClickedEvent({
101
101
  clickType: clickType,
102
102
  clickOutcome: clickOutcome,
103
103
  keysHeld: keysHeld,
104
104
  defaultPrevented: defaultPrevented
105
105
  });
106
+
107
+ // if the current target is an anchor tag, we can get the href from it and use that as the url being navigated too.
108
+ if (event.currentTarget instanceof HTMLAnchorElement) {
109
+ var url = event.currentTarget.href;
110
+ return _objectSpread(_objectSpread({}, linkClickedEventResult), {}, {
111
+ nonPrivacySafeAttributes: {
112
+ url: url
113
+ }
114
+ });
115
+ } else {
116
+ // We can't get the href from the event target, so dont include the url or any non privacy safe attributes
117
+ return linkClickedEventResult;
118
+ }
106
119
  };
107
120
  export var fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsEvent) {
108
121
  return function (event) {
@@ -110,7 +123,8 @@ export var fireLinkClickedEvent = function fireLinkClickedEvent(createAnalyticsE
110
123
  var payload = createLinkClickedPayload(event);
111
124
  if (payload) {
112
125
  createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, payload), overrides), {}, {
113
- attributes: _objectSpread(_objectSpread({}, payload.attributes), overrides === null || overrides === void 0 ? void 0 : overrides.attributes)
126
+ attributes: _objectSpread(_objectSpread({}, payload.attributes), overrides === null || overrides === void 0 ? void 0 : overrides.attributes),
127
+ nonPrivacySafeAttributes: _objectSpread(_objectSpread({}, payload.nonPrivacySafeAttributes), overrides === null || overrides === void 0 ? void 0 : overrides.nonPrivacySafeAttributes)
114
128
  })).fire(ANALYTICS_CHANNEL);
115
129
  }
116
130
  };
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
10
10
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
11
11
  var PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "30.2.6",
13
+ packageVersion: "30.2.7",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "30.2.6",
3
+ "version": "30.2.7",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/dropdown-menu": "^12.22.0",
36
36
  "@atlaskit/form": "^10.5.0",
37
37
  "@atlaskit/frontend-utilities": "^2.7.0",
38
- "@atlaskit/heading": "^2.4.0",
38
+ "@atlaskit/heading": "^3.0.0",
39
39
  "@atlaskit/icon": "^22.24.0",
40
40
  "@atlaskit/icon-file-type": "^6.7.0",
41
41
  "@atlaskit/icon-object": "^6.7.0",