@atlaskit/smart-card 23.10.2 → 23.11.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 +12 -0
- package/dist/cjs/extractors/common/lozenge/extractLozengeText.js +21 -0
- package/dist/cjs/state/actions/index.js +29 -4
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +12 -3
- package/dist/cjs/utils/analytics/analytics.js +122 -104
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/extractors/common/lozenge/extractLozengeText.js +11 -0
- package/dist/es2019/state/actions/index.js +25 -3
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +8 -0
- package/dist/es2019/utils/analytics/analytics.js +12 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/extractors/common/lozenge/extractLozengeText.js +11 -0
- package/dist/esm/state/actions/index.js +28 -4
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +11 -3
- package/dist/esm/utils/analytics/analytics.js +117 -103
- package/dist/esm/version.json +1 -1
- package/dist/types/extractors/common/lozenge/extractLozengeText.d.ts +2 -0
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +7 -1
- package/dist/types/state/flexible-ui-context/index.d.ts +6 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +3 -0
- package/dist/types/utils/analytics/analytics.d.ts +4 -1
- package/dist/types/utils/mocks.d.ts +3 -0
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/view/EmbedCard/components/styled.d.ts +64 -16
- package/dist/types/view/InlineCard/Frame/styled.d.ts +8 -2
- package/dist/types/view/InlineCard/Icon.d.ts +12 -3
- package/dist/types/view/InlineCard/IconAndTitleLayout/styled.d.ts +36 -9
- package/dist/types/view/InlineCard/ResolvingView/styled.d.ts +6 -11
- package/dist/types/view/InlineCard/styled.d.ts +16 -8
- package/package.json +6 -6
- package/report.api.md +7 -0
- package/tmp/api-report-tmp.d.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 23.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`32aa136af5c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/32aa136af5c) - Hover Preview: Add actionable element experiment reload analytics
|
|
8
|
+
|
|
9
|
+
## 23.10.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`bca078a37af`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bca078a37af) - Bump to @emotion v11
|
|
14
|
+
|
|
3
15
|
## 23.10.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractLozengeText = void 0;
|
|
7
|
+
|
|
8
|
+
var _extractLozenge = require("./extractLozenge");
|
|
9
|
+
|
|
10
|
+
var extractLozengeText = function extractLozengeText(response) {
|
|
11
|
+
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
12
|
+
|
|
13
|
+
if (data) {
|
|
14
|
+
var _ref = (0, _extractLozenge.extractLozenge)(data) || {},
|
|
15
|
+
text = _ref.text;
|
|
16
|
+
|
|
17
|
+
return text;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.extractLozengeText = extractLozengeText;
|
|
@@ -33,6 +33,8 @@ var _analytics = require("../analytics");
|
|
|
33
33
|
|
|
34
34
|
var _constants2 = require("../../constants");
|
|
35
35
|
|
|
36
|
+
var _extractLozengeText = require("../../extractors/common/lozenge/extractLozengeText");
|
|
37
|
+
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
39
|
|
|
38
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -189,16 +191,39 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
|
|
|
189
191
|
return resolve();
|
|
190
192
|
}, [details, resolve, dispatch, url, setMetadataStatus]);
|
|
191
193
|
var reload = (0, _react.useCallback)(function () {
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
194
|
+
var _details$data, _details$data$Type;
|
|
195
|
+
|
|
196
|
+
var definitionId = (0, _helpers.getDefinitionId)(details); // Start: Smart link Actions experiment
|
|
197
|
+
|
|
198
|
+
if (definitionId === 'jira-object-provider' && details !== null && details !== void 0 && (_details$data = details.data) !== null && _details$data !== void 0 && (_details$data$Type = _details$data['@type']) !== null && _details$data$Type !== void 0 && _details$data$Type.includes('atlassian:Task')) {
|
|
199
|
+
// EDM-5149: This is part of actionable element experiment where we
|
|
200
|
+
// reload jira issue link after embed view modal is closed.
|
|
201
|
+
// In our component, `reload` is only used in auth flow which
|
|
202
|
+
// jira link, being Atlassian product, would not fall into this category
|
|
203
|
+
// and would not be reloaded in normal smart link context.
|
|
204
|
+
// The code from resolve is duplicated here to avoid changing the response
|
|
205
|
+
// shape of resolve.
|
|
206
|
+
var previousJiraStatus = (0, _extractLozengeText.extractLozengeText)(details);
|
|
207
|
+
connections.client.fetchData(url, true).then(function (response) {
|
|
208
|
+
handleResolvedLinkResponse(url, response, true, false);
|
|
209
|
+
var jiraStatus = (0, _extractLozengeText.extractLozengeText)(response);
|
|
210
|
+
analytics.track.linkUpdated({
|
|
211
|
+
actionSubjectId: 'jiraIssueStatus',
|
|
212
|
+
previousJiraStatus: previousJiraStatus,
|
|
213
|
+
jiraStatus: jiraStatus
|
|
214
|
+
});
|
|
215
|
+
}).catch(function (error) {
|
|
216
|
+
return handleResolvedLinkError(url, error, undefined, false);
|
|
217
|
+
});
|
|
218
|
+
} // End: Smart ink Actions experiment
|
|
219
|
+
else if (definitionId) {
|
|
195
220
|
(0, _helpers.getByDefinitionId)(definitionId, getState()).map(function (url) {
|
|
196
221
|
return resolve(url, true);
|
|
197
222
|
});
|
|
198
223
|
} else {
|
|
199
224
|
resolve(url, true);
|
|
200
225
|
}
|
|
201
|
-
}, [url,
|
|
226
|
+
}, [details, connections.client, url, handleResolvedLinkResponse, analytics.track, handleResolvedLinkError, getState, resolve]);
|
|
202
227
|
var loadMetadata = (0, _react.useCallback)(function () {
|
|
203
228
|
//metadataStatus will be undefined for SSR links only
|
|
204
229
|
if (metadataStatus === undefined) {
|
|
@@ -23,6 +23,8 @@ var _helpers = require("../helpers");
|
|
|
23
23
|
|
|
24
24
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
25
25
|
|
|
26
|
+
var _analytics2 = require("../../utils/analytics/analytics");
|
|
27
|
+
|
|
26
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
29
|
|
|
28
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -31,11 +33,11 @@ var applyCommonAttributes = function applyCommonAttributes(event, commonAttribut
|
|
|
31
33
|
if (event && event.attributes) {
|
|
32
34
|
for (var _i = 0, _Object$entries = Object.entries(commonAttributes); _i < _Object$entries.length; _i++) {
|
|
33
35
|
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
34
|
-
|
|
36
|
+
_key = _Object$entries$_i[0],
|
|
35
37
|
value = _Object$entries$_i[1];
|
|
36
38
|
|
|
37
|
-
if (event.attributes[
|
|
38
|
-
event.attributes[
|
|
39
|
+
if (event.attributes[_key] === undefined) {
|
|
40
|
+
event.attributes[_key] = value;
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -689,6 +691,13 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, dispatchAnalytic
|
|
|
689
691
|
extensionKey: extensionKey,
|
|
690
692
|
location: location
|
|
691
693
|
})), commonAttributes));
|
|
694
|
+
},
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* This fires a tracking event before and after link updated.
|
|
698
|
+
*/
|
|
699
|
+
linkUpdated: function linkUpdated(props) {
|
|
700
|
+
return dispatchAnalytics(applyCommonAttributes((0, _analytics2.trackLinkUpdated)(_objectSpread(_objectSpread({}, commonAttributes), props)), commonAttributes));
|
|
692
701
|
}
|
|
693
702
|
};
|
|
694
703
|
}, [commonAttributes, dispatchAnalytics]);
|
|
@@ -5,7 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.unresolvedEvent = exports.uiRenderSuccessEvent = exports.uiRenderFailedEvent = exports.uiLearnMoreLinkClickedEvent = exports.uiHoverCardViewedEvent = exports.uiHoverCardOpenLinkClickedEvent = exports.uiHoverCardDismissedEvent = exports.uiClosedAuthEvent = exports.uiCardClickedEvent = exports.uiAuthEvent = exports.uiAuthAlternateAccountEvent = exports.uiActionClickedEvent = exports.trackAppAccountConnected = exports.trackAppAccountAuthStarted = exports.screenAuthPopupEvent = exports.resolvedEvent = exports.invokeSucceededEvent = exports.invokeFailedEvent = exports.fireSmartLinkEvent = exports.context = exports.connectSucceededEvent = exports.connectFailedEvent = exports.chunkloadFailedEvent = exports.SmartLinkEvents = exports.ANALYTICS_CHANNEL = void 0;
|
|
8
|
+
exports.unresolvedEvent = exports.uiRenderSuccessEvent = exports.uiRenderFailedEvent = exports.uiLearnMoreLinkClickedEvent = exports.uiHoverCardViewedEvent = exports.uiHoverCardOpenLinkClickedEvent = exports.uiHoverCardDismissedEvent = exports.uiClosedAuthEvent = exports.uiCardClickedEvent = exports.uiAuthEvent = exports.uiAuthAlternateAccountEvent = exports.uiActionClickedEvent = exports.trackLinkUpdated = exports.trackAppAccountConnected = exports.trackAppAccountAuthStarted = exports.screenAuthPopupEvent = exports.resolvedEvent = exports.invokeSucceededEvent = exports.invokeFailedEvent = exports.fireSmartLinkEvent = exports.context = exports.connectSucceededEvent = exports.connectFailedEvent = exports.chunkloadFailedEvent = exports.SmartLinkEvents = exports.ANALYTICS_CHANNEL = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
11
|
|
|
10
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
13
|
|
|
@@ -17,6 +19,8 @@ var _version = require("../../version.json");
|
|
|
17
19
|
|
|
18
20
|
var _performance = require("../performance");
|
|
19
21
|
|
|
22
|
+
var _excluded = ["actionSubjectId"];
|
|
23
|
+
|
|
20
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
25
|
|
|
22
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -273,13 +277,27 @@ var trackAppAccountAuthStarted = function trackAppAccountAuthStarted(_ref7) {
|
|
|
273
277
|
|
|
274
278
|
exports.trackAppAccountAuthStarted = trackAppAccountAuthStarted;
|
|
275
279
|
|
|
276
|
-
var
|
|
277
|
-
var
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
var trackLinkUpdated = function trackLinkUpdated(_ref8) {
|
|
281
|
+
var actionSubjectId = _ref8.actionSubjectId,
|
|
282
|
+
attributes = (0, _objectWithoutProperties2.default)(_ref8, _excluded);
|
|
283
|
+
return {
|
|
284
|
+
action: 'updated',
|
|
285
|
+
actionSubject: 'link',
|
|
286
|
+
actionSubjectId: actionSubjectId,
|
|
287
|
+
eventType: 'track',
|
|
288
|
+
attributes: _objectSpread(_objectSpread({}, context), attributes)
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
exports.trackLinkUpdated = trackLinkUpdated;
|
|
293
|
+
|
|
294
|
+
var uiAuthEvent = function uiAuthEvent(_ref9) {
|
|
295
|
+
var definitionId = _ref9.definitionId,
|
|
296
|
+
extensionKey = _ref9.extensionKey,
|
|
297
|
+
destinationProduct = _ref9.destinationProduct,
|
|
298
|
+
destinationSubproduct = _ref9.destinationSubproduct,
|
|
299
|
+
location = _ref9.location,
|
|
300
|
+
display = _ref9.display;
|
|
283
301
|
return {
|
|
284
302
|
action: 'clicked',
|
|
285
303
|
actionSubject: 'button',
|
|
@@ -298,13 +316,13 @@ var uiAuthEvent = function uiAuthEvent(_ref8) {
|
|
|
298
316
|
|
|
299
317
|
exports.uiAuthEvent = uiAuthEvent;
|
|
300
318
|
|
|
301
|
-
var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(
|
|
302
|
-
var definitionId =
|
|
303
|
-
extensionKey =
|
|
304
|
-
destinationProduct =
|
|
305
|
-
destinationSubproduct =
|
|
306
|
-
location =
|
|
307
|
-
display =
|
|
319
|
+
var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref10) {
|
|
320
|
+
var definitionId = _ref10.definitionId,
|
|
321
|
+
extensionKey = _ref10.extensionKey,
|
|
322
|
+
destinationProduct = _ref10.destinationProduct,
|
|
323
|
+
destinationSubproduct = _ref10.destinationSubproduct,
|
|
324
|
+
location = _ref10.location,
|
|
325
|
+
display = _ref10.display;
|
|
308
326
|
return {
|
|
309
327
|
action: 'clicked',
|
|
310
328
|
actionSubject: 'smartLink',
|
|
@@ -323,17 +341,17 @@ var uiAuthAlternateAccountEvent = function uiAuthAlternateAccountEvent(_ref9) {
|
|
|
323
341
|
|
|
324
342
|
exports.uiAuthAlternateAccountEvent = uiAuthAlternateAccountEvent;
|
|
325
343
|
|
|
326
|
-
var uiCardClickedEvent = function uiCardClickedEvent(
|
|
327
|
-
var id =
|
|
328
|
-
display =
|
|
329
|
-
status =
|
|
330
|
-
definitionId =
|
|
331
|
-
extensionKey =
|
|
332
|
-
isModifierKeyPressed =
|
|
333
|
-
location =
|
|
334
|
-
destinationProduct =
|
|
335
|
-
destinationSubproduct =
|
|
336
|
-
actionSubjectId =
|
|
344
|
+
var uiCardClickedEvent = function uiCardClickedEvent(_ref11) {
|
|
345
|
+
var id = _ref11.id,
|
|
346
|
+
display = _ref11.display,
|
|
347
|
+
status = _ref11.status,
|
|
348
|
+
definitionId = _ref11.definitionId,
|
|
349
|
+
extensionKey = _ref11.extensionKey,
|
|
350
|
+
isModifierKeyPressed = _ref11.isModifierKeyPressed,
|
|
351
|
+
location = _ref11.location,
|
|
352
|
+
destinationProduct = _ref11.destinationProduct,
|
|
353
|
+
destinationSubproduct = _ref11.destinationSubproduct,
|
|
354
|
+
actionSubjectId = _ref11.actionSubjectId;
|
|
337
355
|
return {
|
|
338
356
|
action: 'clicked',
|
|
339
357
|
actionSubject: 'smartLink',
|
|
@@ -355,15 +373,15 @@ var uiCardClickedEvent = function uiCardClickedEvent(_ref10) {
|
|
|
355
373
|
|
|
356
374
|
exports.uiCardClickedEvent = uiCardClickedEvent;
|
|
357
375
|
|
|
358
|
-
var uiActionClickedEvent = function uiActionClickedEvent(
|
|
359
|
-
var id =
|
|
360
|
-
actionType =
|
|
361
|
-
extensionKey =
|
|
362
|
-
display =
|
|
363
|
-
definitionId =
|
|
364
|
-
destinationProduct =
|
|
365
|
-
destinationSubproduct =
|
|
366
|
-
location =
|
|
376
|
+
var uiActionClickedEvent = function uiActionClickedEvent(_ref12) {
|
|
377
|
+
var id = _ref12.id,
|
|
378
|
+
actionType = _ref12.actionType,
|
|
379
|
+
extensionKey = _ref12.extensionKey,
|
|
380
|
+
display = _ref12.display,
|
|
381
|
+
definitionId = _ref12.definitionId,
|
|
382
|
+
destinationProduct = _ref12.destinationProduct,
|
|
383
|
+
destinationSubproduct = _ref12.destinationSubproduct,
|
|
384
|
+
location = _ref12.location;
|
|
367
385
|
return {
|
|
368
386
|
action: 'clicked',
|
|
369
387
|
actionSubject: 'button',
|
|
@@ -384,13 +402,13 @@ var uiActionClickedEvent = function uiActionClickedEvent(_ref11) {
|
|
|
384
402
|
|
|
385
403
|
exports.uiActionClickedEvent = uiActionClickedEvent;
|
|
386
404
|
|
|
387
|
-
var uiClosedAuthEvent = function uiClosedAuthEvent(
|
|
388
|
-
var display =
|
|
389
|
-
extensionKey =
|
|
390
|
-
definitionId =
|
|
391
|
-
destinationProduct =
|
|
392
|
-
destinationSubproduct =
|
|
393
|
-
location =
|
|
405
|
+
var uiClosedAuthEvent = function uiClosedAuthEvent(_ref13) {
|
|
406
|
+
var display = _ref13.display,
|
|
407
|
+
extensionKey = _ref13.extensionKey,
|
|
408
|
+
definitionId = _ref13.definitionId,
|
|
409
|
+
destinationProduct = _ref13.destinationProduct,
|
|
410
|
+
destinationSubproduct = _ref13.destinationSubproduct,
|
|
411
|
+
location = _ref13.location;
|
|
394
412
|
return {
|
|
395
413
|
action: 'closed',
|
|
396
414
|
actionSubject: 'consentModal',
|
|
@@ -408,12 +426,12 @@ var uiClosedAuthEvent = function uiClosedAuthEvent(_ref12) {
|
|
|
408
426
|
|
|
409
427
|
exports.uiClosedAuthEvent = uiClosedAuthEvent;
|
|
410
428
|
|
|
411
|
-
var screenAuthPopupEvent = function screenAuthPopupEvent(
|
|
412
|
-
var extensionKey =
|
|
413
|
-
definitionId =
|
|
414
|
-
destinationProduct =
|
|
415
|
-
destinationSubproduct =
|
|
416
|
-
location =
|
|
429
|
+
var screenAuthPopupEvent = function screenAuthPopupEvent(_ref14) {
|
|
430
|
+
var extensionKey = _ref14.extensionKey,
|
|
431
|
+
definitionId = _ref14.definitionId,
|
|
432
|
+
destinationProduct = _ref14.destinationProduct,
|
|
433
|
+
destinationSubproduct = _ref14.destinationSubproduct,
|
|
434
|
+
location = _ref14.location;
|
|
417
435
|
return {
|
|
418
436
|
actionSubject: 'consentModal',
|
|
419
437
|
eventType: 'screen',
|
|
@@ -429,14 +447,14 @@ var screenAuthPopupEvent = function screenAuthPopupEvent(_ref13) {
|
|
|
429
447
|
|
|
430
448
|
exports.screenAuthPopupEvent = screenAuthPopupEvent;
|
|
431
449
|
|
|
432
|
-
var uiRenderSuccessEvent = function uiRenderSuccessEvent(
|
|
433
|
-
var display =
|
|
434
|
-
status =
|
|
435
|
-
extensionKey =
|
|
436
|
-
definitionId =
|
|
437
|
-
destinationProduct =
|
|
438
|
-
destinationSubproduct =
|
|
439
|
-
location =
|
|
450
|
+
var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref15) {
|
|
451
|
+
var display = _ref15.display,
|
|
452
|
+
status = _ref15.status,
|
|
453
|
+
extensionKey = _ref15.extensionKey,
|
|
454
|
+
definitionId = _ref15.definitionId,
|
|
455
|
+
destinationProduct = _ref15.destinationProduct,
|
|
456
|
+
destinationSubproduct = _ref15.destinationSubproduct,
|
|
457
|
+
location = _ref15.location;
|
|
440
458
|
return {
|
|
441
459
|
action: 'renderSuccess',
|
|
442
460
|
actionSubject: 'smartLink',
|
|
@@ -455,15 +473,15 @@ var uiRenderSuccessEvent = function uiRenderSuccessEvent(_ref14) {
|
|
|
455
473
|
|
|
456
474
|
exports.uiRenderSuccessEvent = uiRenderSuccessEvent;
|
|
457
475
|
|
|
458
|
-
var uiRenderFailedEvent = function uiRenderFailedEvent(
|
|
459
|
-
var display =
|
|
460
|
-
error =
|
|
461
|
-
errorInfo =
|
|
462
|
-
extensionKey =
|
|
463
|
-
definitionId =
|
|
464
|
-
destinationProduct =
|
|
465
|
-
destinationSubproduct =
|
|
466
|
-
location =
|
|
476
|
+
var uiRenderFailedEvent = function uiRenderFailedEvent(_ref16) {
|
|
477
|
+
var display = _ref16.display,
|
|
478
|
+
error = _ref16.error,
|
|
479
|
+
errorInfo = _ref16.errorInfo,
|
|
480
|
+
extensionKey = _ref16.extensionKey,
|
|
481
|
+
definitionId = _ref16.definitionId,
|
|
482
|
+
destinationProduct = _ref16.destinationProduct,
|
|
483
|
+
destinationSubproduct = _ref16.destinationSubproduct,
|
|
484
|
+
location = _ref16.location;
|
|
467
485
|
return {
|
|
468
486
|
actionSubject: 'smartLink',
|
|
469
487
|
action: 'renderFailed',
|
|
@@ -483,16 +501,16 @@ var uiRenderFailedEvent = function uiRenderFailedEvent(_ref15) {
|
|
|
483
501
|
|
|
484
502
|
exports.uiRenderFailedEvent = uiRenderFailedEvent;
|
|
485
503
|
|
|
486
|
-
var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(
|
|
487
|
-
var id =
|
|
488
|
-
previewDisplay =
|
|
489
|
-
extensionKey =
|
|
490
|
-
definitionId =
|
|
491
|
-
destinationProduct =
|
|
492
|
-
destinationSubproduct =
|
|
493
|
-
location =
|
|
494
|
-
previewInvokeMethod =
|
|
495
|
-
status =
|
|
504
|
+
var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref17) {
|
|
505
|
+
var id = _ref17.id,
|
|
506
|
+
previewDisplay = _ref17.previewDisplay,
|
|
507
|
+
extensionKey = _ref17.extensionKey,
|
|
508
|
+
definitionId = _ref17.definitionId,
|
|
509
|
+
destinationProduct = _ref17.destinationProduct,
|
|
510
|
+
destinationSubproduct = _ref17.destinationSubproduct,
|
|
511
|
+
location = _ref17.location,
|
|
512
|
+
previewInvokeMethod = _ref17.previewInvokeMethod,
|
|
513
|
+
status = _ref17.status;
|
|
496
514
|
return {
|
|
497
515
|
action: 'viewed',
|
|
498
516
|
actionSubject: 'hoverCard',
|
|
@@ -513,17 +531,17 @@ var uiHoverCardViewedEvent = function uiHoverCardViewedEvent(_ref16) {
|
|
|
513
531
|
|
|
514
532
|
exports.uiHoverCardViewedEvent = uiHoverCardViewedEvent;
|
|
515
533
|
|
|
516
|
-
var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(
|
|
517
|
-
var id =
|
|
518
|
-
previewDisplay =
|
|
519
|
-
hoverTime =
|
|
520
|
-
extensionKey =
|
|
521
|
-
definitionId =
|
|
522
|
-
destinationProduct =
|
|
523
|
-
destinationSubproduct =
|
|
524
|
-
location =
|
|
525
|
-
previewInvokeMethod =
|
|
526
|
-
status =
|
|
534
|
+
var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref18) {
|
|
535
|
+
var id = _ref18.id,
|
|
536
|
+
previewDisplay = _ref18.previewDisplay,
|
|
537
|
+
hoverTime = _ref18.hoverTime,
|
|
538
|
+
extensionKey = _ref18.extensionKey,
|
|
539
|
+
definitionId = _ref18.definitionId,
|
|
540
|
+
destinationProduct = _ref18.destinationProduct,
|
|
541
|
+
destinationSubproduct = _ref18.destinationSubproduct,
|
|
542
|
+
location = _ref18.location,
|
|
543
|
+
previewInvokeMethod = _ref18.previewInvokeMethod,
|
|
544
|
+
status = _ref18.status;
|
|
527
545
|
return {
|
|
528
546
|
action: 'dismissed',
|
|
529
547
|
actionSubject: 'hoverCard',
|
|
@@ -545,15 +563,15 @@ var uiHoverCardDismissedEvent = function uiHoverCardDismissedEvent(_ref17) {
|
|
|
545
563
|
|
|
546
564
|
exports.uiHoverCardDismissedEvent = uiHoverCardDismissedEvent;
|
|
547
565
|
|
|
548
|
-
var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(
|
|
549
|
-
var id =
|
|
550
|
-
previewDisplay =
|
|
551
|
-
extensionKey =
|
|
552
|
-
definitionId =
|
|
553
|
-
destinationProduct =
|
|
554
|
-
destinationSubproduct =
|
|
555
|
-
location =
|
|
556
|
-
previewInvokeMethod =
|
|
566
|
+
var uiHoverCardOpenLinkClickedEvent = function uiHoverCardOpenLinkClickedEvent(_ref19) {
|
|
567
|
+
var id = _ref19.id,
|
|
568
|
+
previewDisplay = _ref19.previewDisplay,
|
|
569
|
+
extensionKey = _ref19.extensionKey,
|
|
570
|
+
definitionId = _ref19.definitionId,
|
|
571
|
+
destinationProduct = _ref19.destinationProduct,
|
|
572
|
+
destinationSubproduct = _ref19.destinationSubproduct,
|
|
573
|
+
location = _ref19.location,
|
|
574
|
+
previewInvokeMethod = _ref19.previewInvokeMethod;
|
|
557
575
|
return {
|
|
558
576
|
action: 'clicked',
|
|
559
577
|
actionSubject: 'button',
|
|
@@ -586,15 +604,15 @@ var uiLearnMoreLinkClickedEvent = function uiLearnMoreLinkClickedEvent() {
|
|
|
586
604
|
|
|
587
605
|
exports.uiLearnMoreLinkClickedEvent = uiLearnMoreLinkClickedEvent;
|
|
588
606
|
|
|
589
|
-
var chunkloadFailedEvent = function chunkloadFailedEvent(
|
|
590
|
-
var display =
|
|
591
|
-
error =
|
|
592
|
-
errorInfo =
|
|
593
|
-
extensionKey =
|
|
594
|
-
definitionId =
|
|
595
|
-
destinationProduct =
|
|
596
|
-
destinationSubproduct =
|
|
597
|
-
location =
|
|
607
|
+
var chunkloadFailedEvent = function chunkloadFailedEvent(_ref20) {
|
|
608
|
+
var display = _ref20.display,
|
|
609
|
+
error = _ref20.error,
|
|
610
|
+
errorInfo = _ref20.errorInfo,
|
|
611
|
+
extensionKey = _ref20.extensionKey,
|
|
612
|
+
definitionId = _ref20.definitionId,
|
|
613
|
+
destinationProduct = _ref20.destinationProduct,
|
|
614
|
+
destinationSubproduct = _ref20.destinationSubproduct,
|
|
615
|
+
location = _ref20.location;
|
|
598
616
|
return {
|
|
599
617
|
action: 'chunkLoadFailed',
|
|
600
618
|
actionSubject: 'smartLink',
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { extractLozenge } from './extractLozenge';
|
|
2
|
+
export const extractLozengeText = response => {
|
|
3
|
+
const data = response === null || response === void 0 ? void 0 : response.data;
|
|
4
|
+
|
|
5
|
+
if (data) {
|
|
6
|
+
const {
|
|
7
|
+
text
|
|
8
|
+
} = extractLozenge(data) || {};
|
|
9
|
+
return text;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -8,6 +8,7 @@ import * as measure from '../../utils/performance';
|
|
|
8
8
|
import { getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
9
9
|
import { addMetadataToExperience } from '../analytics';
|
|
10
10
|
import { SmartLinkStatus } from '../../constants';
|
|
11
|
+
import { extractLozengeText } from '../../extractors/common/lozenge/extractLozengeText';
|
|
11
12
|
export const useSmartCardActions = (id, url, analytics) => {
|
|
12
13
|
const {
|
|
13
14
|
store,
|
|
@@ -135,14 +136,35 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
135
136
|
return resolve();
|
|
136
137
|
}, [details, resolve, dispatch, url, setMetadataStatus]);
|
|
137
138
|
const reload = useCallback(() => {
|
|
138
|
-
|
|
139
|
+
var _details$data, _details$data$Type;
|
|
140
|
+
|
|
141
|
+
const definitionId = getDefinitionId(details); // Start: Smart link Actions experiment
|
|
139
142
|
|
|
140
|
-
if (definitionId) {
|
|
143
|
+
if (definitionId === 'jira-object-provider' && details !== null && details !== void 0 && (_details$data = details.data) !== null && _details$data !== void 0 && (_details$data$Type = _details$data['@type']) !== null && _details$data$Type !== void 0 && _details$data$Type.includes('atlassian:Task')) {
|
|
144
|
+
// EDM-5149: This is part of actionable element experiment where we
|
|
145
|
+
// reload jira issue link after embed view modal is closed.
|
|
146
|
+
// In our component, `reload` is only used in auth flow which
|
|
147
|
+
// jira link, being Atlassian product, would not fall into this category
|
|
148
|
+
// and would not be reloaded in normal smart link context.
|
|
149
|
+
// The code from resolve is duplicated here to avoid changing the response
|
|
150
|
+
// shape of resolve.
|
|
151
|
+
const previousJiraStatus = extractLozengeText(details);
|
|
152
|
+
connections.client.fetchData(url, true).then(response => {
|
|
153
|
+
handleResolvedLinkResponse(url, response, true, false);
|
|
154
|
+
const jiraStatus = extractLozengeText(response);
|
|
155
|
+
analytics.track.linkUpdated({
|
|
156
|
+
actionSubjectId: 'jiraIssueStatus',
|
|
157
|
+
previousJiraStatus,
|
|
158
|
+
jiraStatus
|
|
159
|
+
});
|
|
160
|
+
}).catch(error => handleResolvedLinkError(url, error, undefined, false));
|
|
161
|
+
} // End: Smart ink Actions experiment
|
|
162
|
+
else if (definitionId) {
|
|
141
163
|
getByDefinitionId(definitionId, getState()).map(url => resolve(url, true));
|
|
142
164
|
} else {
|
|
143
165
|
resolve(url, true);
|
|
144
166
|
}
|
|
145
|
-
}, [url,
|
|
167
|
+
}, [details, connections.client, url, handleResolvedLinkResponse, analytics.track, handleResolvedLinkError, getState, resolve]);
|
|
146
168
|
const loadMetadata = useCallback(() => {
|
|
147
169
|
//metadataStatus will be undefined for SSR links only
|
|
148
170
|
if (metadataStatus === undefined) {
|
|
@@ -4,6 +4,7 @@ import { chunkloadFailedEvent, connectFailedEvent, connectSucceededEvent, contex
|
|
|
4
4
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
5
5
|
import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getSubproduct } from '../helpers';
|
|
6
6
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
|
+
import { trackLinkUpdated } from '../../utils/analytics/analytics';
|
|
7
8
|
|
|
8
9
|
const applyCommonAttributes = (event, commonAttributes) => {
|
|
9
10
|
if (event && event.attributes) {
|
|
@@ -656,6 +657,13 @@ export const useSmartLinkAnalytics = (url, dispatchAnalytics, id, defaultLocatio
|
|
|
656
657
|
}) => dispatchAnalytics(applyCommonAttributes(trackAppAccountAuthStarted({ ...commonAttributes,
|
|
657
658
|
extensionKey,
|
|
658
659
|
location
|
|
660
|
+
}), commonAttributes)),
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* This fires a tracking event before and after link updated.
|
|
664
|
+
*/
|
|
665
|
+
linkUpdated: props => dispatchAnalytics(applyCommonAttributes(trackLinkUpdated({ ...commonAttributes,
|
|
666
|
+
...props
|
|
659
667
|
}), commonAttributes))
|
|
660
668
|
}), [commonAttributes, dispatchAnalytics]);
|
|
661
669
|
/** Contains all screen analytics events */
|
|
@@ -215,6 +215,18 @@ export const trackAppAccountAuthStarted = ({
|
|
|
215
215
|
location
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
|
+
export const trackLinkUpdated = ({
|
|
219
|
+
actionSubjectId,
|
|
220
|
+
...attributes
|
|
221
|
+
}) => ({
|
|
222
|
+
action: 'updated',
|
|
223
|
+
actionSubject: 'link',
|
|
224
|
+
actionSubjectId,
|
|
225
|
+
eventType: 'track',
|
|
226
|
+
attributes: { ...context,
|
|
227
|
+
...attributes
|
|
228
|
+
}
|
|
229
|
+
});
|
|
218
230
|
export const uiAuthEvent = ({
|
|
219
231
|
definitionId,
|
|
220
232
|
extensionKey,
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { extractLozenge } from './extractLozenge';
|
|
2
|
+
export var extractLozengeText = function extractLozengeText(response) {
|
|
3
|
+
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
4
|
+
|
|
5
|
+
if (data) {
|
|
6
|
+
var _ref = extractLozenge(data) || {},
|
|
7
|
+
text = _ref.text;
|
|
8
|
+
|
|
9
|
+
return text;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -10,6 +10,7 @@ import * as measure from '../../utils/performance';
|
|
|
10
10
|
import { getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
11
11
|
import { addMetadataToExperience } from '../analytics';
|
|
12
12
|
import { SmartLinkStatus } from '../../constants';
|
|
13
|
+
import { extractLozengeText } from '../../extractors/common/lozenge/extractLozengeText';
|
|
13
14
|
export var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
|
|
14
15
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
15
16
|
store = _useSmartLinkContext.store,
|
|
@@ -162,16 +163,39 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
162
163
|
return resolve();
|
|
163
164
|
}, [details, resolve, dispatch, url, setMetadataStatus]);
|
|
164
165
|
var reload = useCallback(function () {
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
var _details$data, _details$data$Type;
|
|
167
|
+
|
|
168
|
+
var definitionId = getDefinitionId(details); // Start: Smart link Actions experiment
|
|
169
|
+
|
|
170
|
+
if (definitionId === 'jira-object-provider' && details !== null && details !== void 0 && (_details$data = details.data) !== null && _details$data !== void 0 && (_details$data$Type = _details$data['@type']) !== null && _details$data$Type !== void 0 && _details$data$Type.includes('atlassian:Task')) {
|
|
171
|
+
// EDM-5149: This is part of actionable element experiment where we
|
|
172
|
+
// reload jira issue link after embed view modal is closed.
|
|
173
|
+
// In our component, `reload` is only used in auth flow which
|
|
174
|
+
// jira link, being Atlassian product, would not fall into this category
|
|
175
|
+
// and would not be reloaded in normal smart link context.
|
|
176
|
+
// The code from resolve is duplicated here to avoid changing the response
|
|
177
|
+
// shape of resolve.
|
|
178
|
+
var previousJiraStatus = extractLozengeText(details);
|
|
179
|
+
connections.client.fetchData(url, true).then(function (response) {
|
|
180
|
+
handleResolvedLinkResponse(url, response, true, false);
|
|
181
|
+
var jiraStatus = extractLozengeText(response);
|
|
182
|
+
analytics.track.linkUpdated({
|
|
183
|
+
actionSubjectId: 'jiraIssueStatus',
|
|
184
|
+
previousJiraStatus: previousJiraStatus,
|
|
185
|
+
jiraStatus: jiraStatus
|
|
186
|
+
});
|
|
187
|
+
}).catch(function (error) {
|
|
188
|
+
return handleResolvedLinkError(url, error, undefined, false);
|
|
189
|
+
});
|
|
190
|
+
} // End: Smart ink Actions experiment
|
|
191
|
+
else if (definitionId) {
|
|
168
192
|
getByDefinitionId(definitionId, getState()).map(function (url) {
|
|
169
193
|
return resolve(url, true);
|
|
170
194
|
});
|
|
171
195
|
} else {
|
|
172
196
|
resolve(url, true);
|
|
173
197
|
}
|
|
174
|
-
}, [url,
|
|
198
|
+
}, [details, connections.client, url, handleResolvedLinkResponse, analytics.track, handleResolvedLinkError, getState, resolve]);
|
|
175
199
|
var loadMetadata = useCallback(function () {
|
|
176
200
|
//metadataStatus will be undefined for SSR links only
|
|
177
201
|
if (metadataStatus === undefined) {
|