@atlaskit/smart-card 30.2.3 → 30.2.4

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,13 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 30.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#161848](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161848)
8
+ [`b3284704393ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b3284704393ce) -
9
+ Migrate analytics for smartlinkiframe
10
+
3
11
  ## 30.2.3
4
12
 
5
13
  ### Patch Changes
@@ -2,22 +2,33 @@ common:
2
2
  product: media
3
3
 
4
4
  context:
5
- PackageMetaData: &PackageMetaDataContext
5
+ PackageMetaDataContext: &PackageMetaDataContext
6
6
  packageName:
7
7
  type: string
8
8
  description: name of the package the event was fired from
9
9
  packageVersion:
10
10
  type: string
11
11
  description: version of the package the event was fired from
12
-
13
- ResolvedAttributes: &ResolvedAttributes
12
+ ResolvedContext: &ResolvedContext
14
13
  status:
15
- type: ['pending', 'resolving', 'resolved', 'errored', 'fallback', 'unauthorized', 'forbidden', 'not_found']
14
+ type:
15
+ [
16
+ 'pending',
17
+ 'resolving',
18
+ 'resolved',
19
+ 'errored',
20
+ 'fallback',
21
+ 'unauthorized',
22
+ 'forbidden',
23
+ 'not_found',
24
+ ]
16
25
  description: The status of the link resolution at the time of the event.
17
26
  required: false
18
27
  statusDetails:
19
28
  type: string
20
- description: Provides further information of the resolved status. May be different for different status values
29
+ description:
30
+ Provides further information of the resolved status. May be different for different status
31
+ values
21
32
  required: false
22
33
  displayCategory:
23
34
  type: ['smartLink', 'link']
@@ -72,36 +83,40 @@ context:
72
83
  required: false
73
84
  description: An indicator that a link can be converted to datasource view
74
85
 
75
- aiInteractionAttributes: &aiInteractionAttributes
86
+ attributes:
87
+ AiInteractionAttributes: &AiInteractionAttributes
76
88
  aiFeatureName:
77
89
  type: string
78
90
  description: The name of the AI feature as shared with AI team
79
91
  proactiveAIGenerated:
80
92
  type: number
81
- description: Attribute that captures the fact that an AI generated result was proactively served to a user.
93
+ description:
94
+ Attribute that captures the fact that an AI generated result was proactively served to a
95
+ user.
82
96
  userGeneratedAI:
83
97
  type: number
84
- description: Attribute that captures the fact that a user interaction with a feature lead to generation of an AI result.
85
-
98
+ description:
99
+ Attribute that captures the fact that a user interaction with a feature lead to generation
100
+ of an AI result.
86
101
 
87
102
  events:
88
103
  - button clicked (aiSummary):
89
104
  type: ui
90
105
  description: fired when an ai summary is clicked
91
106
  attributes:
92
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
107
+ <<: [*PackageMetaDataContext, *ResolvedContext]
93
108
 
94
109
  - button clicked (copySummary):
95
110
  type: ui
96
111
  description: fired when the copy ai summary button is clicked
97
112
  attributes:
98
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
113
+ <<: [*PackageMetaDataContext, *ResolvedContext]
99
114
 
100
115
  - summary viewed:
101
116
  type: ui
102
117
  description: fired when a summary is viewed
103
118
  attributes:
104
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
119
+ <<: [*PackageMetaDataContext, *ResolvedContext]
105
120
  fromCache:
106
121
  required: false
107
122
  type: boolean
@@ -111,19 +126,19 @@ events:
111
126
  type: ui
112
127
  description: fired when a summary error is viewed
113
128
  attributes:
114
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
129
+ <<: [*PackageMetaDataContext, *ResolvedContext]
115
130
 
116
131
  - summary success:
117
132
  type: operational
118
133
  description: fired when a summary request finishes with a successful response
119
134
  attributes:
120
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
135
+ <<: [*PackageMetaDataContext, *ResolvedContext]
121
136
 
122
137
  - summary failed:
123
138
  type: operational
124
139
  description: fired when a summary request finishes with a failed response
125
140
  attributes:
126
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
141
+ <<: [*PackageMetaDataContext, *ResolvedContext]
127
142
  reason:
128
143
  required: false
129
144
  type: string
@@ -133,36 +148,35 @@ events:
133
148
  type: boolean
134
149
  description: True if the error should be counted towards the SLO.
135
150
 
136
-
137
151
  - aiInteraction initiated:
138
152
  type: track
139
153
  description: fired when an explicit request is made to use an AI-powered feature
140
154
  attributes:
141
- <<: [*PackageMetaDataContext, *aiInteractionAttributes]
155
+ <<: [*PackageMetaDataContext, *AiInteractionAttributes]
142
156
 
143
157
  - button clicked (automationAction):
144
158
  type: ui
145
159
  description: fired when the automation action button is clicked
146
160
  attributes:
147
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
161
+ <<: [*PackageMetaDataContext, *ResolvedContext]
148
162
 
149
163
  - button clicked (relatedLinks):
150
164
  type: ui
151
165
  description: fired when the related links action button is clicked
152
166
  attributes:
153
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
167
+ <<: [*PackageMetaDataContext, *ResolvedContext]
154
168
 
155
169
  - modal opened (relatedLinks):
156
170
  type: ui
157
171
  description: fired when related links modal is opened
158
172
  attributes:
159
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
173
+ <<: [*PackageMetaDataContext, *ResolvedContext]
160
174
 
161
175
  - modal closed (relatedLinks):
162
176
  type: ui
163
177
  description: fired when related links modal is closed
164
178
  attributes:
165
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
179
+ <<: [*PackageMetaDataContext, *ResolvedContext]
166
180
  dwellTime:
167
181
  required: true
168
182
  type: number
@@ -170,9 +184,9 @@ events:
170
184
 
171
185
  - relatedLinks success:
172
186
  type: operational
173
- description: fired when related links are retrieved succesfully
187
+ description: fired when related links are retrieved successfully
174
188
  attributes:
175
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
189
+ <<: [*PackageMetaDataContext, *ResolvedContext]
176
190
  incomingCount:
177
191
  type: number
178
192
  required: true
@@ -186,8 +200,57 @@ events:
186
200
  type: operational
187
201
  description: fired when related links retrieval fails
188
202
  attributes:
189
- <<: [*PackageMetaDataContext, *ResolvedAttributes]
203
+ <<: [*PackageMetaDataContext, *ResolvedContext]
190
204
  reason:
191
205
  required: true
192
206
  type: string
193
207
  description: failure reason
208
+ - smartLinkIframe dwelled:
209
+ type: ui
210
+ description: fired when a user dwells their cursor on a Smart Link's iframe
211
+ attributes:
212
+ <<: [*PackageMetaDataContext, *ResolvedContext]
213
+ id:
214
+ required: true
215
+ type: string
216
+ description: The unique ID for this Smart Link
217
+ display:
218
+ required: true
219
+ type: ['inline', 'block', 'embed', 'embedPreview', 'flexible', 'hoverCardPreview']
220
+ description: Whether the card was an Inline, Block, Embed or Flexible UI
221
+ definitionId:
222
+ required: false
223
+ type: string
224
+ description: The definitionId of the Smart Link resolver invoked.
225
+ location:
226
+ required: false
227
+ type: string
228
+ description: Where the Smart Link is currently rendered
229
+ dwellTime:
230
+ required: true
231
+ type: number
232
+ description: Total seconds that the user has dwelled on this iframe
233
+ dwellPercentVisible:
234
+ required: true
235
+ type: number
236
+ description: Percentage element was visible at end of dwell
237
+ - smartLinkIframe focus:
238
+ type: ui
239
+ description: fires when a user clicks or tabs into a Smart Link's iframe.
240
+ attributes:
241
+ id:
242
+ required: true
243
+ type: string
244
+ description: The unique ID for this Smart Link.
245
+ display:
246
+ required: true
247
+ type: ['inline', 'block', 'embed', 'embedPreview', 'flexible', 'hoverCardPreview']
248
+ description: Whether the card was an Inline, Block, Embed or Flexible UI.
249
+ definitionId:
250
+ required: false
251
+ type: string
252
+ description: The definitionId of the Smart Link resolver invoked.
253
+ location:
254
+ required: false
255
+ type: string
256
+ description: Where the Smart Link is currently rendered.
@@ -36,7 +36,6 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
36
36
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
37
37
  *
38
38
  * @param url URL of the link
39
- * @param dispatchAnalytics dispatchAnalytics function
40
39
  * @param id fallback id of the events sent if no id is available
41
40
  * @param defaultLocation location attribute to be used
42
41
  * @returns
@@ -187,6 +186,7 @@ var useSmartLinkAnalytics = exports.useSmartLinkAnalytics = function useSmartLin
187
186
  * @param dwellTime Total seconds that the user has dwelled on this iframe
188
187
  * @param dwellPercentVisible Percentage element was visible at end of dwell
189
188
  * @returns
189
+ * @deprecated
190
190
  */
191
191
  iframeDwelledEvent: function iframeDwelledEvent(_ref4) {
192
192
  var id = _ref4.id,
@@ -222,6 +222,7 @@ var useSmartLinkAnalytics = exports.useSmartLinkAnalytics = function useSmartLin
222
222
  * @param location Where the Smart Link is currently rendered.
223
223
  * @param destinationProduct The product the Smart Link is linked to.
224
224
  * @returns
225
+ * @deprecated
225
226
  */
226
227
  iframeFocusedEvent: function iframeFocusedEvent(_ref5) {
227
228
  var id = _ref5.id,
@@ -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.3"
25
+ packageVersion: "30.2.4"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -91,7 +91,7 @@ var getSimulatedBetterMetadata = exports.getSimulatedBetterMetadata = function g
91
91
  }, {
92
92
  name: _constants.ElementName.ModifiedOn
93
93
  }];
94
- } else if (isJiraPlan && (0, _platformFeatureFlags.fg)('smart_links_for_plans')) {
94
+ } else if (isJiraPlan && (0, _platformFeatureFlags.fg)('smart_links_for_plans_platform')) {
95
95
  topMetadata = [{
96
96
  name: _constants.ElementName.OwnedByGroup
97
97
  }, {
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.CardWithUrlContent = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _analyticsNext = require("@atlaskit/analytics-next");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _useAnalyticsEvents2 = require("../../common/analytics/generated/use-analytics-events");
11
13
  var _constants = require("../../constants");
12
14
  var _state = require("../../state");
13
15
  var _helpers = require("../../state/helpers");
@@ -51,8 +53,10 @@ function Component(_ref) {
51
53
  removeTextHighlightingFromTitle = _ref.removeTextHighlightingFromTitle,
52
54
  resolvingPlaceholder = _ref.resolvingPlaceholder,
53
55
  truncateInline = _ref.truncateInline;
54
- var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
55
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
56
+ var _useAnalyticsEventsNe = (0, _analyticsNext.useAnalyticsEvents)(),
57
+ createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
58
+ var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
59
+ fireEvent = _useAnalyticsEvents.fireEvent;
56
60
 
57
61
  // Get state, actions for this card.
58
62
  var _useSmartLink = (0, _state.useSmartLink)(id, url),
@@ -156,29 +160,49 @@ function Component(_ref) {
156
160
  }
157
161
  }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
158
162
  var onIframeDwell = (0, _react.useCallback)(function (dwellTime, dwellPercentVisible) {
159
- analytics.ui.iframeDwelledEvent({
160
- id: id,
161
- display: isFlexibleUi ? 'flexible' : appearance,
162
- status: state.status,
163
- definitionId: definitionId,
164
- extensionKey: extensionKey,
165
- destinationProduct: product,
166
- destinationSubproduct: subproduct,
167
- dwellTime: dwellTime,
168
- dwellPercentVisible: dwellPercentVisible
169
- });
170
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct]);
163
+ if ((0, _platformFeatureFlags.fg)('smart-card-migrate-smartlinkiframe-analytics')) {
164
+ fireEvent('ui.smartLinkIframe.dwelled', {
165
+ id: id,
166
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
167
+ location: null,
168
+ display: isFlexibleUi ? 'flexible' : appearance,
169
+ dwellPercentVisible: dwellPercentVisible,
170
+ dwellTime: dwellTime
171
+ });
172
+ } else {
173
+ analytics.ui.iframeDwelledEvent({
174
+ id: id,
175
+ display: isFlexibleUi ? 'flexible' : appearance,
176
+ status: state.status,
177
+ definitionId: definitionId,
178
+ extensionKey: extensionKey,
179
+ destinationProduct: product,
180
+ destinationSubproduct: subproduct,
181
+ dwellTime: dwellTime,
182
+ dwellPercentVisible: dwellPercentVisible
183
+ });
184
+ }
185
+ }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
171
186
  var onIframeFocus = (0, _react.useCallback)(function () {
172
- analytics.ui.iframeFocusedEvent({
173
- id: id,
174
- display: isFlexibleUi ? 'flexible' : appearance,
175
- status: state.status,
176
- definitionId: definitionId,
177
- extensionKey: extensionKey,
178
- destinationProduct: product,
179
- destinationSubproduct: subproduct
180
- });
181
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct]);
187
+ if ((0, _platformFeatureFlags.fg)('smart-card-migrate-smartlinkiframe-analytics')) {
188
+ fireEvent('ui.smartLinkIframe.focus', {
189
+ id: id,
190
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
191
+ location: null,
192
+ display: isFlexibleUi ? 'flexible' : appearance
193
+ });
194
+ } else {
195
+ analytics.ui.iframeFocusedEvent({
196
+ id: id,
197
+ display: isFlexibleUi ? 'flexible' : appearance,
198
+ status: state.status,
199
+ definitionId: definitionId,
200
+ extensionKey: extensionKey,
201
+ destinationProduct: product,
202
+ destinationSubproduct: subproduct
203
+ });
204
+ }
205
+ }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
182
206
  if (isFlexibleUi) {
183
207
  var cardState = state;
184
208
  if (error) {
@@ -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.3",
20
+ packageVersion: "30.2.4",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -22,7 +22,6 @@ const applyCommonAttributes = (event, commonAttributes) => {
22
22
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
23
23
  *
24
24
  * @param url URL of the link
25
- * @param dispatchAnalytics dispatchAnalytics function
26
25
  * @param id fallback id of the events sent if no id is available
27
26
  * @param defaultLocation location attribute to be used
28
27
  * @returns
@@ -170,6 +169,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
170
169
  * @param dwellTime Total seconds that the user has dwelled on this iframe
171
170
  * @param dwellPercentVisible Percentage element was visible at end of dwell
172
171
  * @returns
172
+ * @deprecated
173
173
  */
174
174
  iframeDwelledEvent: ({
175
175
  id,
@@ -204,6 +204,7 @@ export const useSmartLinkAnalytics = (url, id, defaultLocation) => {
204
204
  * @param location Where the Smart Link is currently rendered.
205
205
  * @param destinationProduct The product the Smart Link is linked to.
206
206
  * @returns
207
+ * @deprecated
207
208
  */
208
209
  iframeFocusedEvent: ({
209
210
  id,
@@ -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.3"
7
+ packageVersion: "30.2.4"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -85,7 +85,7 @@ export const getSimulatedBetterMetadata = cardDetails => {
85
85
  }, {
86
86
  name: ElementName.ModifiedOn
87
87
  }];
88
- } else if (isJiraPlan && fg('smart_links_for_plans')) {
88
+ } else if (isJiraPlan && fg('smart_links_for_plans_platform')) {
89
89
  topMetadata = [{
90
90
  name: ElementName.OwnedByGroup
91
91
  }, {
@@ -1,5 +1,7 @@
1
1
  import React, { useCallback, useEffect, useMemo } from 'react';
2
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
2
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
3
5
  import { CardDisplay } from '../../constants';
4
6
  import { useSmartLink } from '../../state';
5
7
  import { getCanBeDatasource, getClickUrl, getDefinitionId, getExtensionKey, getProduct, getResourceType, getServices, getSubproduct, isFinalState } from '../../state/helpers';
@@ -44,6 +46,9 @@ function Component({
44
46
  }) {
45
47
  const {
46
48
  createAnalyticsEvent
49
+ } = useAnalyticsEventsNext();
50
+ const {
51
+ fireEvent
47
52
  } = useAnalyticsEvents();
48
53
 
49
54
  // Get state, actions for this card.
@@ -143,29 +148,49 @@ function Component({
143
148
  }
144
149
  }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
145
150
  const onIframeDwell = useCallback((dwellTime, dwellPercentVisible) => {
146
- analytics.ui.iframeDwelledEvent({
147
- id,
148
- display: isFlexibleUi ? 'flexible' : appearance,
149
- status: state.status,
150
- definitionId,
151
- extensionKey,
152
- destinationProduct: product,
153
- destinationSubproduct: subproduct,
154
- dwellTime: dwellTime,
155
- dwellPercentVisible: dwellPercentVisible
156
- });
157
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct]);
151
+ if (fg('smart-card-migrate-smartlinkiframe-analytics')) {
152
+ fireEvent('ui.smartLinkIframe.dwelled', {
153
+ id,
154
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
155
+ location: null,
156
+ display: isFlexibleUi ? 'flexible' : appearance,
157
+ dwellPercentVisible,
158
+ dwellTime
159
+ });
160
+ } else {
161
+ analytics.ui.iframeDwelledEvent({
162
+ id,
163
+ display: isFlexibleUi ? 'flexible' : appearance,
164
+ status: state.status,
165
+ definitionId,
166
+ extensionKey,
167
+ destinationProduct: product,
168
+ destinationSubproduct: subproduct,
169
+ dwellTime: dwellTime,
170
+ dwellPercentVisible: dwellPercentVisible
171
+ });
172
+ }
173
+ }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
158
174
  const onIframeFocus = useCallback(() => {
159
- analytics.ui.iframeFocusedEvent({
160
- id,
161
- display: isFlexibleUi ? 'flexible' : appearance,
162
- status: state.status,
163
- definitionId,
164
- extensionKey,
165
- destinationProduct: product,
166
- destinationSubproduct: subproduct
167
- });
168
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct]);
175
+ if (fg('smart-card-migrate-smartlinkiframe-analytics')) {
176
+ fireEvent('ui.smartLinkIframe.focus', {
177
+ id,
178
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
179
+ location: null,
180
+ display: isFlexibleUi ? 'flexible' : appearance
181
+ });
182
+ } else {
183
+ analytics.ui.iframeFocusedEvent({
184
+ id,
185
+ display: isFlexibleUi ? 'flexible' : appearance,
186
+ status: state.status,
187
+ definitionId,
188
+ extensionKey,
189
+ destinationProduct: product,
190
+ destinationSubproduct: subproduct
191
+ });
192
+ }
193
+ }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
169
194
  if (isFlexibleUi) {
170
195
  let cardState = state;
171
196
  if (error) {
@@ -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.3",
10
+ packageVersion: "30.2.4",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -29,7 +29,6 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
29
29
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
30
30
  *
31
31
  * @param url URL of the link
32
- * @param dispatchAnalytics dispatchAnalytics function
33
32
  * @param id fallback id of the events sent if no id is available
34
33
  * @param defaultLocation location attribute to be used
35
34
  * @returns
@@ -180,6 +179,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
180
179
  * @param dwellTime Total seconds that the user has dwelled on this iframe
181
180
  * @param dwellPercentVisible Percentage element was visible at end of dwell
182
181
  * @returns
182
+ * @deprecated
183
183
  */
184
184
  iframeDwelledEvent: function iframeDwelledEvent(_ref4) {
185
185
  var id = _ref4.id,
@@ -215,6 +215,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, id, defau
215
215
  * @param location Where the Smart Link is currently rendered.
216
216
  * @param destinationProduct The product the Smart Link is linked to.
217
217
  * @returns
218
+ * @deprecated
218
219
  */
219
220
  iframeFocusedEvent: function iframeFocusedEvent(_ref5) {
220
221
  var id = _ref5.id,
@@ -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.3"
18
+ packageVersion: "30.2.4"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -85,7 +85,7 @@ export var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(card
85
85
  }, {
86
86
  name: ElementName.ModifiedOn
87
87
  }];
88
- } else if (isJiraPlan && fg('smart_links_for_plans')) {
88
+ } else if (isJiraPlan && fg('smart_links_for_plans_platform')) {
89
89
  topMetadata = [{
90
90
  name: ElementName.OwnedByGroup
91
91
  }, {
@@ -1,5 +1,7 @@
1
1
  import React, { useCallback, useEffect, useMemo } from 'react';
2
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
2
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { useAnalyticsEvents } from '../../common/analytics/generated/use-analytics-events';
3
5
  import { CardDisplay } from '../../constants';
4
6
  import { useSmartLink } from '../../state';
5
7
  import { getCanBeDatasource, getClickUrl, getDefinitionId, getExtensionKey, getProduct, getResourceType, getServices, getSubproduct, isFinalState } from '../../state/helpers';
@@ -41,8 +43,10 @@ function Component(_ref) {
41
43
  removeTextHighlightingFromTitle = _ref.removeTextHighlightingFromTitle,
42
44
  resolvingPlaceholder = _ref.resolvingPlaceholder,
43
45
  truncateInline = _ref.truncateInline;
46
+ var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
47
+ createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
44
48
  var _useAnalyticsEvents = useAnalyticsEvents(),
45
- createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
49
+ fireEvent = _useAnalyticsEvents.fireEvent;
46
50
 
47
51
  // Get state, actions for this card.
48
52
  var _useSmartLink = useSmartLink(id, url),
@@ -146,29 +150,49 @@ function Component(_ref) {
146
150
  }
147
151
  }, [isFlexibleUi, appearance, state.status, url, definitionId, extensionKey, analytics.ui, id, canBeDatasource]);
148
152
  var onIframeDwell = useCallback(function (dwellTime, dwellPercentVisible) {
149
- analytics.ui.iframeDwelledEvent({
150
- id: id,
151
- display: isFlexibleUi ? 'flexible' : appearance,
152
- status: state.status,
153
- definitionId: definitionId,
154
- extensionKey: extensionKey,
155
- destinationProduct: product,
156
- destinationSubproduct: subproduct,
157
- dwellTime: dwellTime,
158
- dwellPercentVisible: dwellPercentVisible
159
- });
160
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct]);
153
+ if (fg('smart-card-migrate-smartlinkiframe-analytics')) {
154
+ fireEvent('ui.smartLinkIframe.dwelled', {
155
+ id: id,
156
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
157
+ location: null,
158
+ display: isFlexibleUi ? 'flexible' : appearance,
159
+ dwellPercentVisible: dwellPercentVisible,
160
+ dwellTime: dwellTime
161
+ });
162
+ } else {
163
+ analytics.ui.iframeDwelledEvent({
164
+ id: id,
165
+ display: isFlexibleUi ? 'flexible' : appearance,
166
+ status: state.status,
167
+ definitionId: definitionId,
168
+ extensionKey: extensionKey,
169
+ destinationProduct: product,
170
+ destinationSubproduct: subproduct,
171
+ dwellTime: dwellTime,
172
+ dwellPercentVisible: dwellPercentVisible
173
+ });
174
+ }
175
+ }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
161
176
  var onIframeFocus = useCallback(function () {
162
- analytics.ui.iframeFocusedEvent({
163
- id: id,
164
- display: isFlexibleUi ? 'flexible' : appearance,
165
- status: state.status,
166
- definitionId: definitionId,
167
- extensionKey: extensionKey,
168
- destinationProduct: product,
169
- destinationSubproduct: subproduct
170
- });
171
- }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct]);
177
+ if (fg('smart-card-migrate-smartlinkiframe-analytics')) {
178
+ fireEvent('ui.smartLinkIframe.focus', {
179
+ id: id,
180
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
181
+ location: null,
182
+ display: isFlexibleUi ? 'flexible' : appearance
183
+ });
184
+ } else {
185
+ analytics.ui.iframeFocusedEvent({
186
+ id: id,
187
+ display: isFlexibleUi ? 'flexible' : appearance,
188
+ status: state.status,
189
+ definitionId: definitionId,
190
+ extensionKey: extensionKey,
191
+ destinationProduct: product,
192
+ destinationSubproduct: subproduct
193
+ });
194
+ }
195
+ }, [id, state.status, analytics.ui, appearance, definitionId, extensionKey, isFlexibleUi, product, subproduct, fireEvent]);
172
196
  if (isFlexibleUi) {
173
197
  var cardState = state;
174
198
  if (error) {
@@ -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.3",
13
+ packageVersion: "30.2.4",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -3,14 +3,14 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::b519212dc7ce398897c4e790498adb64>>
6
+ * @codegen <<SignedSource::86bf439a8a42bc5afbfacd43626136ae>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
8
8
  */
9
- export type PackageMetaDataType = {
9
+ export type PackageMetaDataContextType = {
10
10
  packageName: string;
11
11
  packageVersion: string;
12
12
  };
13
- export type ResolvedAttributesType = {
13
+ export type ResolvedContextType = {
14
14
  status: 'pending' | 'resolving' | 'resolved' | 'errored' | 'fallback' | 'unauthorized' | 'forbidden' | 'not_found' | null;
15
15
  statusDetails: string | null;
16
16
  displayCategory: 'smartLink' | 'link';
@@ -53,6 +53,20 @@ export type RelatedLinksSuccessAttributesType = {
53
53
  export type RelatedLinksFailedAttributesType = {
54
54
  reason: string;
55
55
  };
56
+ export type SmartLinkIframeDwelledAttributesType = {
57
+ id: string;
58
+ display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
59
+ definitionId: string | null;
60
+ location: string | null;
61
+ dwellTime: number;
62
+ dwellPercentVisible: number;
63
+ };
64
+ export type SmartLinkIframeFocusAttributesType = {
65
+ id: string;
66
+ display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
67
+ definitionId: string | null;
68
+ location: string | null;
69
+ };
56
70
  export type AnalyticsEventAttributes = {
57
71
  /**
58
72
  * fired when an ai summary is clicked */
@@ -88,10 +102,16 @@ export type AnalyticsEventAttributes = {
88
102
  * fired when related links modal is closed */
89
103
  'ui.modal.closed.relatedLinks': ModalClosedRelatedLinksAttributesType;
90
104
  /**
91
- * fired when related links are retrieved succesfully */
105
+ * fired when related links are retrieved successfully */
92
106
  'operational.relatedLinks.success': RelatedLinksSuccessAttributesType;
93
107
  /**
94
108
  * fired when related links retrieval fails */
95
109
  'operational.relatedLinks.failed': RelatedLinksFailedAttributesType;
110
+ /**
111
+ * fired when a user dwells their cursor on a Smart Link's iframe */
112
+ 'ui.smartLinkIframe.dwelled': SmartLinkIframeDwelledAttributesType;
113
+ /**
114
+ * fires when a user clicks or tabs into a Smart Link's iframe. */
115
+ 'ui.smartLinkIframe.focus': SmartLinkIframeFocusAttributesType;
96
116
  };
97
117
  export type EventKey = keyof AnalyticsEventAttributes;
@@ -7,7 +7,6 @@ import { type AnalyticsName, type AnalyticsPayload } from '../../utils/types';
7
7
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
8
8
  *
9
9
  * @param url URL of the link
10
- * @param dispatchAnalytics dispatchAnalytics function
11
10
  * @param id fallback id of the events sent if no id is available
12
11
  * @param defaultLocation location attribute to be used
13
12
  * @returns
@@ -65,6 +64,7 @@ export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLo
65
64
  * @param dwellTime Total seconds that the user has dwelled on this iframe
66
65
  * @param dwellPercentVisible Percentage element was visible at end of dwell
67
66
  * @returns
67
+ * @deprecated
68
68
  */
69
69
  iframeDwelledEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, dwellTime, dwellPercentVisible, }: UiIframeDwelledEventProps) => void;
70
70
  /**
@@ -77,6 +77,7 @@ export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLo
77
77
  * @param location Where the Smart Link is currently rendered.
78
78
  * @param destinationProduct The product the Smart Link is linked to.
79
79
  * @returns
80
+ * @deprecated
80
81
  */
81
82
  iframeFocusedEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, }: UiIframeFocusedEventProps) => void;
82
83
  /**
@@ -3,14 +3,14 @@
3
3
  *
4
4
  * Generates Typescript types for analytics events from analytics.spec.yaml
5
5
  *
6
- * @codegen <<SignedSource::b519212dc7ce398897c4e790498adb64>>
6
+ * @codegen <<SignedSource::86bf439a8a42bc5afbfacd43626136ae>>
7
7
  * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
8
8
  */
9
- export type PackageMetaDataType = {
9
+ export type PackageMetaDataContextType = {
10
10
  packageName: string;
11
11
  packageVersion: string;
12
12
  };
13
- export type ResolvedAttributesType = {
13
+ export type ResolvedContextType = {
14
14
  status: 'pending' | 'resolving' | 'resolved' | 'errored' | 'fallback' | 'unauthorized' | 'forbidden' | 'not_found' | null;
15
15
  statusDetails: string | null;
16
16
  displayCategory: 'smartLink' | 'link';
@@ -53,6 +53,20 @@ export type RelatedLinksSuccessAttributesType = {
53
53
  export type RelatedLinksFailedAttributesType = {
54
54
  reason: string;
55
55
  };
56
+ export type SmartLinkIframeDwelledAttributesType = {
57
+ id: string;
58
+ display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
59
+ definitionId: string | null;
60
+ location: string | null;
61
+ dwellTime: number;
62
+ dwellPercentVisible: number;
63
+ };
64
+ export type SmartLinkIframeFocusAttributesType = {
65
+ id: string;
66
+ display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview';
67
+ definitionId: string | null;
68
+ location: string | null;
69
+ };
56
70
  export type AnalyticsEventAttributes = {
57
71
  /**
58
72
  * fired when an ai summary is clicked */
@@ -88,10 +102,16 @@ export type AnalyticsEventAttributes = {
88
102
  * fired when related links modal is closed */
89
103
  'ui.modal.closed.relatedLinks': ModalClosedRelatedLinksAttributesType;
90
104
  /**
91
- * fired when related links are retrieved succesfully */
105
+ * fired when related links are retrieved successfully */
92
106
  'operational.relatedLinks.success': RelatedLinksSuccessAttributesType;
93
107
  /**
94
108
  * fired when related links retrieval fails */
95
109
  'operational.relatedLinks.failed': RelatedLinksFailedAttributesType;
110
+ /**
111
+ * fired when a user dwells their cursor on a Smart Link's iframe */
112
+ 'ui.smartLinkIframe.dwelled': SmartLinkIframeDwelledAttributesType;
113
+ /**
114
+ * fires when a user clicks or tabs into a Smart Link's iframe. */
115
+ 'ui.smartLinkIframe.focus': SmartLinkIframeFocusAttributesType;
96
116
  };
97
117
  export type EventKey = keyof AnalyticsEventAttributes;
@@ -7,7 +7,6 @@ import { type AnalyticsName, type AnalyticsPayload } from '../../utils/types';
7
7
  * Can be provided to Card via the analyticsEvents prop to change the analytics events.
8
8
  *
9
9
  * @param url URL of the link
10
- * @param dispatchAnalytics dispatchAnalytics function
11
10
  * @param id fallback id of the events sent if no id is available
12
11
  * @param defaultLocation location attribute to be used
13
12
  * @returns
@@ -65,6 +64,7 @@ export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLo
65
64
  * @param dwellTime Total seconds that the user has dwelled on this iframe
66
65
  * @param dwellPercentVisible Percentage element was visible at end of dwell
67
66
  * @returns
67
+ * @deprecated
68
68
  */
69
69
  iframeDwelledEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, dwellTime, dwellPercentVisible, }: UiIframeDwelledEventProps) => void;
70
70
  /**
@@ -77,6 +77,7 @@ export declare const useSmartLinkAnalytics: (url: string, id?: string, defaultLo
77
77
  * @param location Where the Smart Link is currently rendered.
78
78
  * @param destinationProduct The product the Smart Link is linked to.
79
79
  * @returns
80
+ * @deprecated
80
81
  */
81
82
  iframeFocusedEvent: ({ id, display, status, definitionId, extensionKey, location, destinationProduct, destinationSubproduct, }: UiIframeFocusedEventProps) => void;
82
83
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "30.2.3",
3
+ "version": "30.2.4",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -171,7 +171,10 @@
171
171
  "platform-visual-refresh-icons": {
172
172
  "type": "boolean"
173
173
  },
174
- "smart_links_for_plans": {
174
+ "smart_links_for_plans_platform": {
175
+ "type": "boolean"
176
+ },
177
+ "smart-card-migrate-smartlinkiframe-analytics": {
175
178
  "type": "boolean"
176
179
  }
177
180
  }