@atlaskit/smart-card 16.2.1 → 16.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 +33 -0
- package/dist/cjs/extractors/block/index.js +2 -2
- package/dist/cjs/extractors/common/actions/extractPreviewAction.js +2 -2
- package/dist/cjs/index.js +42 -0
- package/dist/cjs/providers/editor/transformer.js +5 -1
- package/dist/cjs/state/actions/index.js +1 -1
- package/dist/cjs/state/analytics/ufoExperiences.js +17 -14
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +12 -4
- package/dist/cjs/utils/analytics/analytics.js +6 -6
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/index.js +1 -1
- package/dist/cjs/view/EmbedCard/index.js +1 -1
- package/dist/es2019/extractors/block/index.js +2 -2
- package/dist/es2019/extractors/common/actions/extractPreviewAction.js +2 -2
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/providers/editor/transformer.js +3 -1
- package/dist/es2019/state/actions/index.js +1 -1
- package/dist/es2019/state/analytics/ufoExperiences.js +17 -14
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +18 -4
- package/dist/es2019/utils/analytics/analytics.js +6 -6
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/index.js +2 -2
- package/dist/es2019/view/EmbedCard/index.js +2 -2
- package/dist/esm/extractors/block/index.js +2 -2
- package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/providers/editor/transformer.js +5 -1
- package/dist/esm/state/actions/index.js +1 -1
- package/dist/esm/state/analytics/ufoExperiences.js +17 -14
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +13 -5
- package/dist/esm/utils/analytics/analytics.js +6 -6
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/index.js +2 -2
- package/dist/esm/view/EmbedCard/index.js +2 -2
- package/dist/types/extractors/block/types.d.ts +1 -1
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/state/analytics/ufoExperiences.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
- package/dist/types/state/hooks/useSmartLink.d.ts +1 -1
- package/dist/types/utils/analytics/analytics.d.ts +3 -3
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 16.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`af29def3dac`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af29def3dac) - expose missing smart-card classnames
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
import {
|
|
11
|
+
blockCardResolvedViewByClassName,
|
|
12
|
+
blockCardForbiddenViewLinkClassName,
|
|
13
|
+
blockCardContentClassName,
|
|
14
|
+
blockCardContentHeaderClassName,
|
|
15
|
+
blockCardContentHeaderNameClassName,
|
|
16
|
+
blockCardNotFoundViewClassName,
|
|
17
|
+
blockCardErroredViewClassName,
|
|
18
|
+
} from '@atlaskit/smart-card'
|
|
19
|
+
|
|
20
|
+
css`
|
|
21
|
+
.${blockCardContentHeaderNameClassName} {
|
|
22
|
+
background-color: red;
|
|
23
|
+
}
|
|
24
|
+
`
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- [`e7b325a766c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7b325a766c) - [ux] Jira Work Management (JWM) Calendar view links will be converted into smart link embed by default
|
|
28
|
+
- [`b2664acc865`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b2664acc865) - [ux] Jira Work Management (JWM) Timeline view links will be converted into smart link embed by default
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- [`bea1d5c0a96`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bea1d5c0a96) - Add UFO instrumentation for action invocation. Send extensionKey for client actions as intended, instead of definitionId
|
|
33
|
+
- [`89aa3e3f314`](https://bitbucket.org/atlassian/atlassian-frontend/commits/89aa3e3f314) - Update dependency of dropdown menu to the lite mode version. Update all usages to cater to the new API. The padding within dropdown menu items is 8px more, which makes the menu look bigger.
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
|
|
3
36
|
## 16.2.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -67,10 +67,10 @@ var extractBlockActions = function extractBlockActions(props, jsonLd, opts, plat
|
|
|
67
67
|
if (opts) {
|
|
68
68
|
var handleInvoke = opts.handleInvoke,
|
|
69
69
|
handleAnalytics = opts.handleAnalytics,
|
|
70
|
-
|
|
70
|
+
extensionKey = opts.extensionKey,
|
|
71
71
|
testId = opts.testId;
|
|
72
72
|
var actions = (0, _extractActions.extractActions)(jsonLd, handleInvoke);
|
|
73
|
-
var previewAction = (0, _extractPreviewAction.extractPreviewAction)(
|
|
73
|
+
var previewAction = (0, _extractPreviewAction.extractPreviewAction)(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform); // The previewAction should always be the last action
|
|
74
74
|
|
|
75
75
|
if (previewAction) {
|
|
76
76
|
actions.push(previewAction);
|
|
@@ -66,7 +66,7 @@ var getInvokeOpts = function getInvokeOpts(key, action, source) {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
var extractPreviewAction = function extractPreviewAction() {
|
|
69
|
-
var
|
|
69
|
+
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'empty-object-provider';
|
|
70
70
|
var viewProps = arguments.length > 1 ? arguments[1] : undefined;
|
|
71
71
|
var jsonLd = arguments.length > 2 ? arguments[2] : undefined;
|
|
72
72
|
var handleInvoke = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -82,7 +82,7 @@ var extractPreviewAction = function extractPreviewAction() {
|
|
|
82
82
|
|
|
83
83
|
if (metadataFromJsonLd.src) {
|
|
84
84
|
// Build action using instrumentation hooks.
|
|
85
|
-
var key =
|
|
85
|
+
var key = extensionKey;
|
|
86
86
|
var previewAction = (0, _mediaUi.PreviewAction)(_objectSpread(_objectSpread({}, metadata), {}, {
|
|
87
87
|
testId: testId,
|
|
88
88
|
onOpen: function onOpen() {
|
package/dist/cjs/index.js
CHANGED
|
@@ -113,6 +113,48 @@ Object.defineProperty(exports, "blockCardIconImageClassName", {
|
|
|
113
113
|
return _classNames.blockCardIconImageClassName;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
+
Object.defineProperty(exports, "blockCardResolvedViewByClassName", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function get() {
|
|
119
|
+
return _classNames.blockCardResolvedViewByClassName;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "blockCardForbiddenViewLinkClassName", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function get() {
|
|
125
|
+
return _classNames.blockCardForbiddenViewLinkClassName;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(exports, "blockCardContentClassName", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function get() {
|
|
131
|
+
return _classNames.blockCardContentClassName;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(exports, "blockCardContentHeaderClassName", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function get() {
|
|
137
|
+
return _classNames.blockCardContentHeaderClassName;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(exports, "blockCardContentHeaderNameClassName", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get: function get() {
|
|
143
|
+
return _classNames.blockCardContentHeaderNameClassName;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(exports, "blockCardNotFoundViewClassName", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function get() {
|
|
149
|
+
return _classNames.blockCardNotFoundViewClassName;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(exports, "blockCardErroredViewClassName", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function get() {
|
|
155
|
+
return _classNames.blockCardErroredViewClassName;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
116
158
|
Object.defineProperty(exports, "loadingPlaceholderClassName", {
|
|
117
159
|
enumerable: true,
|
|
118
160
|
get: function get() {
|
|
@@ -19,6 +19,10 @@ var isPolarisView = function isPolarisView(url) {
|
|
|
19
19
|
return url.match(/^https:\/\/.*?\/jira\/polaris\/projects\/[^\/]+?\/ideas\/view\/\d+$|^https:\/\/.*?\/secure\/JiraProductDiscoveryAnonymous\.jspa\?hash=\w+|^https:\/\/.*?\/jira\/polaris\/share\/\w+/);
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
var isJwmView = function isJwmView(url) {
|
|
23
|
+
return url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar)\/?/);
|
|
24
|
+
};
|
|
25
|
+
|
|
22
26
|
var isSlackMessage = function isSlackMessage(url) {
|
|
23
27
|
return url.match(/^https:\/\/.+?\.slack\.com\/archives\/[CG][A-Z0-9]+\/p[0-9]+(\?.*)?$/);
|
|
24
28
|
};
|
|
@@ -62,7 +66,7 @@ var Transformer = /*#__PURE__*/function () {
|
|
|
62
66
|
}, {
|
|
63
67
|
key: "toAdf",
|
|
64
68
|
value: function toAdf(url, appearance) {
|
|
65
|
-
if (isJiraRoadMap(url) || isPolarisView(url)) {
|
|
69
|
+
if (isJiraRoadMap(url) || isPolarisView(url) || isJwmView(url)) {
|
|
66
70
|
return this.buildEmbedAdf(url);
|
|
67
71
|
} else if (isSlackMessage(url)) {
|
|
68
72
|
return this.buildBlockAdf(url);
|
|
@@ -212,7 +212,7 @@ var useSmartCardActions = function useSmartCardActions(id, url, analytics) {
|
|
|
212
212
|
measure.mark(markName, 'pending');
|
|
213
213
|
_context2.prev = 4;
|
|
214
214
|
// Begin analytics instrumentation.
|
|
215
|
-
analytics.ui.actionClickedEvent(key, action.type, source); // Invoke action - either client-side or server-side.
|
|
215
|
+
analytics.ui.actionClickedEvent(id, key, action.type, source, opts.type); // Invoke action - either client-side or server-side.
|
|
216
216
|
|
|
217
217
|
if (!(opts.type === 'client')) {
|
|
218
218
|
_context2.next = 12;
|
|
@@ -7,21 +7,24 @@ exports.addMetadataToExperience = exports.failUfoExperience = exports.succeedUfo
|
|
|
7
7
|
|
|
8
8
|
var _ufo = require("@atlaskit/ufo");
|
|
9
9
|
|
|
10
|
+
var inlineExperience = {
|
|
11
|
+
platform: {
|
|
12
|
+
component: 'smart-links'
|
|
13
|
+
},
|
|
14
|
+
type: _ufo.ExperienceTypes.Experience,
|
|
15
|
+
performanceType: _ufo.ExperiencePerformanceTypes.InlineResult
|
|
16
|
+
};
|
|
17
|
+
var renderExperience = {
|
|
18
|
+
platform: {
|
|
19
|
+
component: 'smart-links'
|
|
20
|
+
},
|
|
21
|
+
type: _ufo.ExperienceTypes.Load,
|
|
22
|
+
performanceType: _ufo.ExperiencePerformanceTypes.PageSegmentLoad
|
|
23
|
+
};
|
|
10
24
|
var ufoExperiences = {
|
|
11
|
-
'smart-link-rendered': new _ufo.ConcurrentExperience('smart-link-rendered',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
platform: {
|
|
15
|
-
component: 'smart-links'
|
|
16
|
-
}
|
|
17
|
-
}),
|
|
18
|
-
'smart-link-authenticated': new _ufo.ConcurrentExperience('smart-link-authenticated', {
|
|
19
|
-
type: _ufo.ExperienceTypes.Load,
|
|
20
|
-
performanceType: _ufo.ExperiencePerformanceTypes.PageSegmentLoad,
|
|
21
|
-
platform: {
|
|
22
|
-
component: 'smart-links'
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
+
'smart-link-rendered': new _ufo.ConcurrentExperience('smart-link-rendered', renderExperience),
|
|
26
|
+
'smart-link-authenticated': new _ufo.ConcurrentExperience('smart-link-authenticated', inlineExperience),
|
|
27
|
+
'smart-link-action-invocation': new _ufo.ConcurrentExperience('smart-link-action-invocation', inlineExperience)
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
var startUfoExperience = function startUfoExperience(experienceName, id, properties) {
|
|
@@ -23,8 +23,14 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(dispatchAnalytics) {
|
|
|
23
23
|
cardClickedEvent: function cardClickedEvent(display, definitionId, extensionKey) {
|
|
24
24
|
return dispatchAnalytics((0, _analytics.uiCardClickedEvent)(display, definitionId, extensionKey));
|
|
25
25
|
},
|
|
26
|
-
actionClickedEvent: function actionClickedEvent(
|
|
27
|
-
|
|
26
|
+
actionClickedEvent: function actionClickedEvent(id, extensionKey, actionType, display, invokeType) {
|
|
27
|
+
(0, _ufoExperiences.startUfoExperience)('smart-link-action-invocation', id, {
|
|
28
|
+
actionType: actionType,
|
|
29
|
+
display: display,
|
|
30
|
+
extensionKey: extensionKey,
|
|
31
|
+
invokeType: invokeType
|
|
32
|
+
});
|
|
33
|
+
dispatchAnalytics((0, _analytics.uiActionClickedEvent)(extensionKey, actionType, display));
|
|
28
34
|
},
|
|
29
35
|
closedAuthEvent: function closedAuthEvent(display, definitionId, extensionKey) {
|
|
30
36
|
return dispatchAnalytics((0, _analytics.uiClosedAuthEvent)(display, definitionId, extensionKey));
|
|
@@ -51,10 +57,12 @@ var useSmartLinkAnalytics = function useSmartLinkAnalytics(dispatchAnalytics) {
|
|
|
51
57
|
return dispatchAnalytics((0, _analytics.unresolvedEvent)(id, status, definitionId, extensionKey, resourceType));
|
|
52
58
|
},
|
|
53
59
|
invokeSucceededEvent: function invokeSucceededEvent(id, providerKey, actionType, display) {
|
|
54
|
-
|
|
60
|
+
(0, _ufoExperiences.succeedUfoExperience)('smart-link-action-invocation', id);
|
|
61
|
+
dispatchAnalytics((0, _analytics.invokeSucceededEvent)(id, providerKey, actionType, display));
|
|
55
62
|
},
|
|
56
63
|
invokeFailedEvent: function invokeFailedEvent(id, providerKey, actionType, display, reason) {
|
|
57
|
-
|
|
64
|
+
(0, _ufoExperiences.failUfoExperience)('smart-link-action-invocation', id);
|
|
65
|
+
dispatchAnalytics((0, _analytics.invokeFailedEvent)(id, providerKey, actionType, display, reason));
|
|
58
66
|
},
|
|
59
67
|
connectSucceededEvent: function connectSucceededEvent(id, definitionId, extensionKey) {
|
|
60
68
|
(0, _ufoExperiences.startUfoExperience)('smart-link-authenticated', id, {
|
|
@@ -109,7 +109,7 @@ var unresolvedEvent = function unresolvedEvent(id, status, definitionId, extensi
|
|
|
109
109
|
|
|
110
110
|
exports.unresolvedEvent = unresolvedEvent;
|
|
111
111
|
|
|
112
|
-
var invokeSucceededEvent = function invokeSucceededEvent(id,
|
|
112
|
+
var invokeSucceededEvent = function invokeSucceededEvent(id, extensionKey, actionType, display) {
|
|
113
113
|
var measure = (0, _performance.getMeasure)(id, 'resolved') || {
|
|
114
114
|
duration: undefined
|
|
115
115
|
};
|
|
@@ -121,7 +121,7 @@ var invokeSucceededEvent = function invokeSucceededEvent(id, providerKey, action
|
|
|
121
121
|
id: id,
|
|
122
122
|
actionType: actionType,
|
|
123
123
|
display: display,
|
|
124
|
-
|
|
124
|
+
extensionKey: extensionKey,
|
|
125
125
|
duration: measure.duration
|
|
126
126
|
})
|
|
127
127
|
};
|
|
@@ -129,7 +129,7 @@ var invokeSucceededEvent = function invokeSucceededEvent(id, providerKey, action
|
|
|
129
129
|
|
|
130
130
|
exports.invokeSucceededEvent = invokeSucceededEvent;
|
|
131
131
|
|
|
132
|
-
var invokeFailedEvent = function invokeFailedEvent(id,
|
|
132
|
+
var invokeFailedEvent = function invokeFailedEvent(id, extensionKey, actionType, display, reason) {
|
|
133
133
|
var measure = (0, _performance.getMeasure)(id, 'errored') || {
|
|
134
134
|
duration: undefined
|
|
135
135
|
};
|
|
@@ -141,7 +141,7 @@ var invokeFailedEvent = function invokeFailedEvent(id, providerKey, actionType,
|
|
|
141
141
|
id: id,
|
|
142
142
|
actionType: actionType,
|
|
143
143
|
display: display,
|
|
144
|
-
|
|
144
|
+
extensionKey: extensionKey,
|
|
145
145
|
duration: measure.duration,
|
|
146
146
|
reason: reason
|
|
147
147
|
})
|
|
@@ -245,14 +245,14 @@ var uiCardClickedEvent = function uiCardClickedEvent(display, definitionId, exte
|
|
|
245
245
|
|
|
246
246
|
exports.uiCardClickedEvent = uiCardClickedEvent;
|
|
247
247
|
|
|
248
|
-
var uiActionClickedEvent = function uiActionClickedEvent(
|
|
248
|
+
var uiActionClickedEvent = function uiActionClickedEvent(extensionKey, actionType, display) {
|
|
249
249
|
return {
|
|
250
250
|
action: 'clicked',
|
|
251
251
|
actionSubject: 'smartLinkAction',
|
|
252
252
|
eventType: 'ui',
|
|
253
253
|
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
254
254
|
display: display,
|
|
255
|
-
|
|
255
|
+
extensionKey: extensionKey,
|
|
256
256
|
actionType: actionType
|
|
257
257
|
})
|
|
258
258
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -45,7 +45,7 @@ var BlockCard = function BlockCard(_ref) {
|
|
|
45
45
|
var extractorOpts = {
|
|
46
46
|
handleAnalytics: handlePreviewAnalytics,
|
|
47
47
|
handleInvoke: handleInvoke,
|
|
48
|
-
|
|
48
|
+
extensionKey: (0, _helpers.getExtensionKey)(details)
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
switch (status) {
|
|
@@ -92,7 +92,7 @@ var EmbedCard = /*#__PURE__*/_react.default.forwardRef(function (_ref, iframeRef
|
|
|
92
92
|
var resolvedBlockViewProps = (0, _block.extractBlockProps)(data, meta, {
|
|
93
93
|
handleAnalytics: handleAnalytics,
|
|
94
94
|
handleInvoke: handleInvoke,
|
|
95
|
-
|
|
95
|
+
extensionKey: (0, _helpers.getExtensionKey)(details)
|
|
96
96
|
});
|
|
97
97
|
return /*#__PURE__*/_react.default.createElement(_mediaUi.BlockCardResolvedView, (0, _extends2.default)({}, resolvedBlockViewProps, {
|
|
98
98
|
isSelected: isSelected,
|
|
@@ -35,11 +35,11 @@ export const extractBlockActions = (props, jsonLd, opts, platform) => {
|
|
|
35
35
|
const {
|
|
36
36
|
handleInvoke,
|
|
37
37
|
handleAnalytics,
|
|
38
|
-
|
|
38
|
+
extensionKey,
|
|
39
39
|
testId
|
|
40
40
|
} = opts;
|
|
41
41
|
const actions = extractActions(jsonLd, handleInvoke);
|
|
42
|
-
const previewAction = extractPreviewAction(
|
|
42
|
+
const previewAction = extractPreviewAction(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform); // The previewAction should always be the last action
|
|
43
43
|
|
|
44
44
|
if (previewAction) {
|
|
45
45
|
actions.push(previewAction);
|
|
@@ -40,7 +40,7 @@ const getInvokeOpts = (key, action, source) => ({
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
export const extractPreviewAction = (
|
|
43
|
+
export const extractPreviewAction = (extensionKey = 'empty-object-provider', viewProps, jsonLd, handleInvoke, handleAnalytics, testId, platform) => {
|
|
44
44
|
// Extract metadata from view props & raw JSON-LD.
|
|
45
45
|
const metadataFromJsonLd = getMetadataFromJsonLd(jsonLd, platform);
|
|
46
46
|
const metadataFromViewProps = getMetadataFromResolvedProps(viewProps);
|
|
@@ -50,7 +50,7 @@ export const extractPreviewAction = (definitionId = 'empty-object-provider', vie
|
|
|
50
50
|
|
|
51
51
|
if (metadataFromJsonLd.src) {
|
|
52
52
|
// Build action using instrumentation hooks.
|
|
53
|
-
const key =
|
|
53
|
+
const key = extensionKey;
|
|
54
54
|
const previewAction = PreviewAction({ ...metadata,
|
|
55
55
|
testId,
|
|
56
56
|
onOpen: () => {
|
package/dist/es2019/index.js
CHANGED
|
@@ -9,5 +9,5 @@ export { embedHeaderHeight } from '@atlaskit/media-ui/embeds';
|
|
|
9
9
|
export { SmartLinkEvents } from './utils/analytics/analytics';
|
|
10
10
|
export { useSmartLinkEvents } from './view/SmartLinkEvents/useSmartLinkEvents'; // Classnames for integrators
|
|
11
11
|
|
|
12
|
-
export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName } from '@atlaskit/media-ui/classNames';
|
|
12
|
+
export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, blockCardResolvedViewByClassName, blockCardForbiddenViewLinkClassName, blockCardContentClassName, blockCardContentHeaderClassName, blockCardContentHeaderNameClassName, blockCardNotFoundViewClassName, blockCardErroredViewClassName } from '@atlaskit/media-ui/classNames';
|
|
13
13
|
export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
@@ -2,6 +2,8 @@ const isJiraRoadMap = url => url.match(/^https:\/\/.*?\/jira\/software\/(c\/)?pr
|
|
|
2
2
|
|
|
3
3
|
const isPolarisView = url => url.match(/^https:\/\/.*?\/jira\/polaris\/projects\/[^\/]+?\/ideas\/view\/\d+$|^https:\/\/.*?\/secure\/JiraProductDiscoveryAnonymous\.jspa\?hash=\w+|^https:\/\/.*?\/jira\/polaris\/share\/\w+/);
|
|
4
4
|
|
|
5
|
+
const isJwmView = url => url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar)\/?/);
|
|
6
|
+
|
|
5
7
|
const isSlackMessage = url => url.match(/^https:\/\/.+?\.slack\.com\/archives\/[CG][A-Z0-9]+\/p[0-9]+(\?.*)?$/);
|
|
6
8
|
|
|
7
9
|
export class Transformer {
|
|
@@ -34,7 +36,7 @@ export class Transformer {
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
toAdf(url, appearance) {
|
|
37
|
-
if (isJiraRoadMap(url) || isPolarisView(url)) {
|
|
39
|
+
if (isJiraRoadMap(url) || isPolarisView(url) || isJwmView(url)) {
|
|
38
40
|
return this.buildEmbedAdf(url);
|
|
39
41
|
} else if (isSlackMessage(url)) {
|
|
40
42
|
return this.buildBlockAdf(url);
|
|
@@ -158,7 +158,7 @@ export const useSmartCardActions = (id, url, analytics) => {
|
|
|
158
158
|
|
|
159
159
|
try {
|
|
160
160
|
// Begin analytics instrumentation.
|
|
161
|
-
analytics.ui.actionClickedEvent(key, action.type, source); // Invoke action - either client-side or server-side.
|
|
161
|
+
analytics.ui.actionClickedEvent(id, key, action.type, source, opts.type); // Invoke action - either client-side or server-side.
|
|
162
162
|
|
|
163
163
|
let response;
|
|
164
164
|
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
2
|
+
const inlineExperience = {
|
|
3
|
+
platform: {
|
|
4
|
+
component: 'smart-links'
|
|
5
|
+
},
|
|
6
|
+
type: ExperienceTypes.Experience,
|
|
7
|
+
performanceType: ExperiencePerformanceTypes.InlineResult
|
|
8
|
+
};
|
|
9
|
+
const renderExperience = {
|
|
10
|
+
platform: {
|
|
11
|
+
component: 'smart-links'
|
|
12
|
+
},
|
|
13
|
+
type: ExperienceTypes.Load,
|
|
14
|
+
performanceType: ExperiencePerformanceTypes.PageSegmentLoad
|
|
15
|
+
};
|
|
2
16
|
const ufoExperiences = {
|
|
3
|
-
'smart-link-rendered': new ConcurrentExperience('smart-link-rendered',
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
platform: {
|
|
7
|
-
component: 'smart-links'
|
|
8
|
-
}
|
|
9
|
-
}),
|
|
10
|
-
'smart-link-authenticated': new ConcurrentExperience('smart-link-authenticated', {
|
|
11
|
-
type: ExperienceTypes.Load,
|
|
12
|
-
performanceType: ExperiencePerformanceTypes.PageSegmentLoad,
|
|
13
|
-
platform: {
|
|
14
|
-
component: 'smart-links'
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
+
'smart-link-rendered': new ConcurrentExperience('smart-link-rendered', renderExperience),
|
|
18
|
+
'smart-link-authenticated': new ConcurrentExperience('smart-link-authenticated', inlineExperience),
|
|
19
|
+
'smart-link-action-invocation': new ConcurrentExperience('smart-link-action-invocation', inlineExperience)
|
|
17
20
|
};
|
|
18
21
|
export const startUfoExperience = (experienceName, id, properties) => {
|
|
19
22
|
const experience = ufoExperiences[experienceName].getInstance(id);
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
3
|
+
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
4
4
|
export const useSmartLinkAnalytics = dispatchAnalytics => {
|
|
5
5
|
const ui = useMemo(() => ({
|
|
6
6
|
authEvent: (display, definitionId, extensionKey) => dispatchAnalytics(uiAuthEvent(display, definitionId, extensionKey)),
|
|
7
7
|
authAlternateAccountEvent: (display, definitionId, extensionKey) => dispatchAnalytics(uiAuthAlternateAccountEvent(display, definitionId, extensionKey)),
|
|
8
8
|
cardClickedEvent: (display, definitionId, extensionKey) => dispatchAnalytics(uiCardClickedEvent(display, definitionId, extensionKey)),
|
|
9
|
-
actionClickedEvent: (
|
|
9
|
+
actionClickedEvent: (id, extensionKey, actionType, display, invokeType) => {
|
|
10
|
+
startUfoExperience('smart-link-action-invocation', id, {
|
|
11
|
+
actionType,
|
|
12
|
+
display,
|
|
13
|
+
extensionKey,
|
|
14
|
+
invokeType
|
|
15
|
+
});
|
|
16
|
+
dispatchAnalytics(uiActionClickedEvent(extensionKey, actionType, display));
|
|
17
|
+
},
|
|
10
18
|
closedAuthEvent: (display, definitionId, extensionKey) => dispatchAnalytics(uiClosedAuthEvent(display, definitionId, extensionKey)),
|
|
11
19
|
renderSuccessEvent: (display, id, definitionId, extensionKey) => {
|
|
12
20
|
succeedUfoExperience('smart-link-rendered', id, {
|
|
@@ -23,8 +31,14 @@ export const useSmartLinkAnalytics = dispatchAnalytics => {
|
|
|
23
31
|
const operational = useMemo(() => ({
|
|
24
32
|
resolvedEvent: (id, definitionId, extensionKey, resourceType) => dispatchAnalytics(resolvedEvent(id, definitionId, extensionKey, resourceType)),
|
|
25
33
|
unresolvedEvent: (id, status, definitionId, extensionKey, resourceType) => dispatchAnalytics(unresolvedEvent(id, status, definitionId, extensionKey, resourceType)),
|
|
26
|
-
invokeSucceededEvent: (id, providerKey, actionType, display) =>
|
|
27
|
-
|
|
34
|
+
invokeSucceededEvent: (id, providerKey, actionType, display) => {
|
|
35
|
+
succeedUfoExperience('smart-link-action-invocation', id);
|
|
36
|
+
dispatchAnalytics(invokeSucceededEvent(id, providerKey, actionType, display));
|
|
37
|
+
},
|
|
38
|
+
invokeFailedEvent: (id, providerKey, actionType, display, reason) => {
|
|
39
|
+
failUfoExperience('smart-link-action-invocation', id);
|
|
40
|
+
dispatchAnalytics(invokeFailedEvent(id, providerKey, actionType, display, reason));
|
|
41
|
+
},
|
|
28
42
|
connectSucceededEvent: (id, definitionId, extensionKey) => {
|
|
29
43
|
startUfoExperience('smart-link-authenticated', id, {
|
|
30
44
|
extensionKey,
|
|
@@ -69,7 +69,7 @@ export const unresolvedEvent = (id, status, definitionId, extensionKey, resource
|
|
|
69
69
|
} : undefined
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
export const invokeSucceededEvent = (id,
|
|
72
|
+
export const invokeSucceededEvent = (id, extensionKey, actionType, display) => {
|
|
73
73
|
const measure = getMeasure(id, 'resolved') || {
|
|
74
74
|
duration: undefined
|
|
75
75
|
};
|
|
@@ -81,12 +81,12 @@ export const invokeSucceededEvent = (id, providerKey, actionType, display) => {
|
|
|
81
81
|
id,
|
|
82
82
|
actionType,
|
|
83
83
|
display,
|
|
84
|
-
|
|
84
|
+
extensionKey,
|
|
85
85
|
duration: measure.duration
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
|
-
export const invokeFailedEvent = (id,
|
|
89
|
+
export const invokeFailedEvent = (id, extensionKey, actionType, display, reason) => {
|
|
90
90
|
const measure = getMeasure(id, 'errored') || {
|
|
91
91
|
duration: undefined
|
|
92
92
|
};
|
|
@@ -98,7 +98,7 @@ export const invokeFailedEvent = (id, providerKey, actionType, display, reason)
|
|
|
98
98
|
id,
|
|
99
99
|
actionType,
|
|
100
100
|
display,
|
|
101
|
-
|
|
101
|
+
extensionKey,
|
|
102
102
|
duration: measure.duration,
|
|
103
103
|
reason
|
|
104
104
|
}
|
|
@@ -179,13 +179,13 @@ export const uiCardClickedEvent = (display, definitionId, extensionKey) => ({
|
|
|
179
179
|
display
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
|
-
export const uiActionClickedEvent = (
|
|
182
|
+
export const uiActionClickedEvent = (extensionKey, actionType, display) => ({
|
|
183
183
|
action: 'clicked',
|
|
184
184
|
actionSubject: 'smartLinkAction',
|
|
185
185
|
eventType: 'ui',
|
|
186
186
|
attributes: { ...context,
|
|
187
187
|
display,
|
|
188
|
-
|
|
188
|
+
extensionKey,
|
|
189
189
|
actionType: actionType
|
|
190
190
|
}
|
|
191
191
|
});
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { CardLinkView, BlockCardResolvingView, BlockCardErroredView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardResolvedView, BlockCardNotFoundView, AuthorizeAction, ForbiddenAction } from '@atlaskit/media-ui';
|
|
4
|
-
import {
|
|
4
|
+
import { getExtensionKey } from '../../state/helpers';
|
|
5
5
|
import { extractBlockProps } from '../../extractors/block';
|
|
6
6
|
import { getEmptyJsonLd, getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
7
7
|
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
@@ -31,7 +31,7 @@ export const BlockCard = ({
|
|
|
31
31
|
const extractorOpts = {
|
|
32
32
|
handleAnalytics: handlePreviewAnalytics,
|
|
33
33
|
handleInvoke,
|
|
34
|
-
|
|
34
|
+
extensionKey: getExtensionKey(details)
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
switch (status) {
|
|
@@ -6,7 +6,7 @@ import { extractEmbedProps } from '../../extractors/embed';
|
|
|
6
6
|
import { getEmptyJsonLd, getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
7
7
|
import { extractInlineProps } from '../../extractors/inline';
|
|
8
8
|
import { extractBlockProps } from '../../extractors/block';
|
|
9
|
-
import {
|
|
9
|
+
import { getExtensionKey } from '../../state/helpers';
|
|
10
10
|
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
11
11
|
export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
12
12
|
url,
|
|
@@ -75,7 +75,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
75
75
|
const resolvedBlockViewProps = extractBlockProps(data, meta, {
|
|
76
76
|
handleAnalytics,
|
|
77
77
|
handleInvoke,
|
|
78
|
-
|
|
78
|
+
extensionKey: getExtensionKey(details)
|
|
79
79
|
});
|
|
80
80
|
return /*#__PURE__*/React.createElement(BlockCardResolvedView, _extends({}, resolvedBlockViewProps, {
|
|
81
81
|
isSelected: isSelected,
|
|
@@ -44,10 +44,10 @@ export var extractBlockActions = function extractBlockActions(props, jsonLd, opt
|
|
|
44
44
|
if (opts) {
|
|
45
45
|
var handleInvoke = opts.handleInvoke,
|
|
46
46
|
handleAnalytics = opts.handleAnalytics,
|
|
47
|
-
|
|
47
|
+
extensionKey = opts.extensionKey,
|
|
48
48
|
testId = opts.testId;
|
|
49
49
|
var actions = extractActions(jsonLd, handleInvoke);
|
|
50
|
-
var previewAction = extractPreviewAction(
|
|
50
|
+
var previewAction = extractPreviewAction(extensionKey, props, jsonLd, handleInvoke, handleAnalytics, testId, platform); // The previewAction should always be the last action
|
|
51
51
|
|
|
52
52
|
if (previewAction) {
|
|
53
53
|
actions.push(previewAction);
|
|
@@ -53,7 +53,7 @@ var getInvokeOpts = function getInvokeOpts(key, action, source) {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export var extractPreviewAction = function extractPreviewAction() {
|
|
56
|
-
var
|
|
56
|
+
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'empty-object-provider';
|
|
57
57
|
var viewProps = arguments.length > 1 ? arguments[1] : undefined;
|
|
58
58
|
var jsonLd = arguments.length > 2 ? arguments[2] : undefined;
|
|
59
59
|
var handleInvoke = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -69,7 +69,7 @@ export var extractPreviewAction = function extractPreviewAction() {
|
|
|
69
69
|
|
|
70
70
|
if (metadataFromJsonLd.src) {
|
|
71
71
|
// Build action using instrumentation hooks.
|
|
72
|
-
var key =
|
|
72
|
+
var key = extensionKey;
|
|
73
73
|
var previewAction = PreviewAction(_objectSpread(_objectSpread({}, metadata), {}, {
|
|
74
74
|
testId: testId,
|
|
75
75
|
onOpen: function onOpen() {
|
package/dist/esm/index.js
CHANGED
|
@@ -9,5 +9,5 @@ export { embedHeaderHeight } from '@atlaskit/media-ui/embeds';
|
|
|
9
9
|
export { SmartLinkEvents } from './utils/analytics/analytics';
|
|
10
10
|
export { useSmartLinkEvents } from './view/SmartLinkEvents/useSmartLinkEvents'; // Classnames for integrators
|
|
11
11
|
|
|
12
|
-
export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName } from '@atlaskit/media-ui/classNames';
|
|
12
|
+
export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, blockCardResolvedViewByClassName, blockCardForbiddenViewLinkClassName, blockCardContentClassName, blockCardContentHeaderClassName, blockCardContentHeaderNameClassName, blockCardNotFoundViewClassName, blockCardErroredViewClassName } from '@atlaskit/media-ui/classNames';
|
|
13
13
|
export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
@@ -9,6 +9,10 @@ var isPolarisView = function isPolarisView(url) {
|
|
|
9
9
|
return url.match(/^https:\/\/.*?\/jira\/polaris\/projects\/[^\/]+?\/ideas\/view\/\d+$|^https:\/\/.*?\/secure\/JiraProductDiscoveryAnonymous\.jspa\?hash=\w+|^https:\/\/.*?\/jira\/polaris\/share\/\w+/);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
var isJwmView = function isJwmView(url) {
|
|
13
|
+
return url.match(/^https:\/\/.*?\/jira\/core\/projects\/[^\/]+?\/(timeline|calendar)\/?/);
|
|
14
|
+
};
|
|
15
|
+
|
|
12
16
|
var isSlackMessage = function isSlackMessage(url) {
|
|
13
17
|
return url.match(/^https:\/\/.+?\.slack\.com\/archives\/[CG][A-Z0-9]+\/p[0-9]+(\?.*)?$/);
|
|
14
18
|
};
|
|
@@ -52,7 +56,7 @@ export var Transformer = /*#__PURE__*/function () {
|
|
|
52
56
|
}, {
|
|
53
57
|
key: "toAdf",
|
|
54
58
|
value: function toAdf(url, appearance) {
|
|
55
|
-
if (isJiraRoadMap(url) || isPolarisView(url)) {
|
|
59
|
+
if (isJiraRoadMap(url) || isPolarisView(url) || isJwmView(url)) {
|
|
56
60
|
return this.buildEmbedAdf(url);
|
|
57
61
|
} else if (isSlackMessage(url)) {
|
|
58
62
|
return this.buildBlockAdf(url);
|
|
@@ -185,7 +185,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
185
185
|
measure.mark(markName, 'pending');
|
|
186
186
|
_context2.prev = 4;
|
|
187
187
|
// Begin analytics instrumentation.
|
|
188
|
-
analytics.ui.actionClickedEvent(key, action.type, source); // Invoke action - either client-side or server-side.
|
|
188
|
+
analytics.ui.actionClickedEvent(id, key, action.type, source, opts.type); // Invoke action - either client-side or server-side.
|
|
189
189
|
|
|
190
190
|
if (!(opts.type === 'client')) {
|
|
191
191
|
_context2.next = 12;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
2
|
+
var inlineExperience = {
|
|
3
|
+
platform: {
|
|
4
|
+
component: 'smart-links'
|
|
5
|
+
},
|
|
6
|
+
type: ExperienceTypes.Experience,
|
|
7
|
+
performanceType: ExperiencePerformanceTypes.InlineResult
|
|
8
|
+
};
|
|
9
|
+
var renderExperience = {
|
|
10
|
+
platform: {
|
|
11
|
+
component: 'smart-links'
|
|
12
|
+
},
|
|
13
|
+
type: ExperienceTypes.Load,
|
|
14
|
+
performanceType: ExperiencePerformanceTypes.PageSegmentLoad
|
|
15
|
+
};
|
|
2
16
|
var ufoExperiences = {
|
|
3
|
-
'smart-link-rendered': new ConcurrentExperience('smart-link-rendered',
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
platform: {
|
|
7
|
-
component: 'smart-links'
|
|
8
|
-
}
|
|
9
|
-
}),
|
|
10
|
-
'smart-link-authenticated': new ConcurrentExperience('smart-link-authenticated', {
|
|
11
|
-
type: ExperienceTypes.Load,
|
|
12
|
-
performanceType: ExperiencePerformanceTypes.PageSegmentLoad,
|
|
13
|
-
platform: {
|
|
14
|
-
component: 'smart-links'
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
+
'smart-link-rendered': new ConcurrentExperience('smart-link-rendered', renderExperience),
|
|
18
|
+
'smart-link-authenticated': new ConcurrentExperience('smart-link-authenticated', inlineExperience),
|
|
19
|
+
'smart-link-action-invocation': new ConcurrentExperience('smart-link-action-invocation', inlineExperience)
|
|
17
20
|
};
|
|
18
21
|
export var startUfoExperience = function startUfoExperience(experienceName, id, properties) {
|
|
19
22
|
var experience = ufoExperiences[experienceName].getInstance(id);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, resolvedEvent as _resolvedEvent, unresolvedEvent as _unresolvedEvent, invokeSucceededEvent as _invokeSucceededEvent, invokeFailedEvent as _invokeFailedEvent, connectSucceededEvent as _connectSucceededEvent, connectFailedEvent as _connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
3
|
+
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
4
4
|
export var useSmartLinkAnalytics = function useSmartLinkAnalytics(dispatchAnalytics) {
|
|
5
5
|
var ui = useMemo(function () {
|
|
6
6
|
return {
|
|
@@ -13,8 +13,14 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(dispatchAnalyt
|
|
|
13
13
|
cardClickedEvent: function cardClickedEvent(display, definitionId, extensionKey) {
|
|
14
14
|
return dispatchAnalytics(uiCardClickedEvent(display, definitionId, extensionKey));
|
|
15
15
|
},
|
|
16
|
-
actionClickedEvent: function actionClickedEvent(
|
|
17
|
-
|
|
16
|
+
actionClickedEvent: function actionClickedEvent(id, extensionKey, actionType, display, invokeType) {
|
|
17
|
+
startUfoExperience('smart-link-action-invocation', id, {
|
|
18
|
+
actionType: actionType,
|
|
19
|
+
display: display,
|
|
20
|
+
extensionKey: extensionKey,
|
|
21
|
+
invokeType: invokeType
|
|
22
|
+
});
|
|
23
|
+
dispatchAnalytics(uiActionClickedEvent(extensionKey, actionType, display));
|
|
18
24
|
},
|
|
19
25
|
closedAuthEvent: function closedAuthEvent(display, definitionId, extensionKey) {
|
|
20
26
|
return dispatchAnalytics(uiClosedAuthEvent(display, definitionId, extensionKey));
|
|
@@ -41,10 +47,12 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(dispatchAnalyt
|
|
|
41
47
|
return dispatchAnalytics(_unresolvedEvent(id, status, definitionId, extensionKey, resourceType));
|
|
42
48
|
},
|
|
43
49
|
invokeSucceededEvent: function invokeSucceededEvent(id, providerKey, actionType, display) {
|
|
44
|
-
|
|
50
|
+
succeedUfoExperience('smart-link-action-invocation', id);
|
|
51
|
+
dispatchAnalytics(_invokeSucceededEvent(id, providerKey, actionType, display));
|
|
45
52
|
},
|
|
46
53
|
invokeFailedEvent: function invokeFailedEvent(id, providerKey, actionType, display, reason) {
|
|
47
|
-
|
|
54
|
+
failUfoExperience('smart-link-action-invocation', id);
|
|
55
|
+
dispatchAnalytics(_invokeFailedEvent(id, providerKey, actionType, display, reason));
|
|
48
56
|
},
|
|
49
57
|
connectSucceededEvent: function connectSucceededEvent(id, definitionId, extensionKey) {
|
|
50
58
|
startUfoExperience('smart-link-authenticated', id, {
|
|
@@ -82,7 +82,7 @@ export var unresolvedEvent = function unresolvedEvent(id, status, definitionId,
|
|
|
82
82
|
})
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
export var invokeSucceededEvent = function invokeSucceededEvent(id,
|
|
85
|
+
export var invokeSucceededEvent = function invokeSucceededEvent(id, extensionKey, actionType, display) {
|
|
86
86
|
var measure = getMeasure(id, 'resolved') || {
|
|
87
87
|
duration: undefined
|
|
88
88
|
};
|
|
@@ -94,12 +94,12 @@ export var invokeSucceededEvent = function invokeSucceededEvent(id, providerKey,
|
|
|
94
94
|
id: id,
|
|
95
95
|
actionType: actionType,
|
|
96
96
|
display: display,
|
|
97
|
-
|
|
97
|
+
extensionKey: extensionKey,
|
|
98
98
|
duration: measure.duration
|
|
99
99
|
})
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
-
export var invokeFailedEvent = function invokeFailedEvent(id,
|
|
102
|
+
export var invokeFailedEvent = function invokeFailedEvent(id, extensionKey, actionType, display, reason) {
|
|
103
103
|
var measure = getMeasure(id, 'errored') || {
|
|
104
104
|
duration: undefined
|
|
105
105
|
};
|
|
@@ -111,7 +111,7 @@ export var invokeFailedEvent = function invokeFailedEvent(id, providerKey, actio
|
|
|
111
111
|
id: id,
|
|
112
112
|
actionType: actionType,
|
|
113
113
|
display: display,
|
|
114
|
-
|
|
114
|
+
extensionKey: extensionKey,
|
|
115
115
|
duration: measure.duration,
|
|
116
116
|
reason: reason
|
|
117
117
|
})
|
|
@@ -194,14 +194,14 @@ export var uiCardClickedEvent = function uiCardClickedEvent(display, definitionI
|
|
|
194
194
|
})
|
|
195
195
|
};
|
|
196
196
|
};
|
|
197
|
-
export var uiActionClickedEvent = function uiActionClickedEvent(
|
|
197
|
+
export var uiActionClickedEvent = function uiActionClickedEvent(extensionKey, actionType, display) {
|
|
198
198
|
return {
|
|
199
199
|
action: 'clicked',
|
|
200
200
|
actionSubject: 'smartLinkAction',
|
|
201
201
|
eventType: 'ui',
|
|
202
202
|
attributes: _objectSpread(_objectSpread({}, context), {}, {
|
|
203
203
|
display: display,
|
|
204
|
-
|
|
204
|
+
extensionKey: extensionKey,
|
|
205
205
|
actionType: actionType
|
|
206
206
|
})
|
|
207
207
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { CardLinkView, BlockCardResolvingView, BlockCardErroredView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardResolvedView, BlockCardNotFoundView, AuthorizeAction, ForbiddenAction } from '@atlaskit/media-ui';
|
|
4
|
-
import {
|
|
4
|
+
import { getExtensionKey } from '../../state/helpers';
|
|
5
5
|
import { extractBlockProps } from '../../extractors/block';
|
|
6
6
|
import { getEmptyJsonLd, getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
7
7
|
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
@@ -29,7 +29,7 @@ export var BlockCard = function BlockCard(_ref) {
|
|
|
29
29
|
var extractorOpts = {
|
|
30
30
|
handleAnalytics: handlePreviewAnalytics,
|
|
31
31
|
handleInvoke: handleInvoke,
|
|
32
|
-
|
|
32
|
+
extensionKey: getExtensionKey(details)
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
switch (status) {
|
|
@@ -6,7 +6,7 @@ import { extractEmbedProps } from '../../extractors/embed';
|
|
|
6
6
|
import { getEmptyJsonLd, getUnauthorizedJsonLd } from '../../utils/jsonld';
|
|
7
7
|
import { extractInlineProps } from '../../extractors/inline';
|
|
8
8
|
import { extractBlockProps } from '../../extractors/block';
|
|
9
|
-
import {
|
|
9
|
+
import { getExtensionKey } from '../../state/helpers';
|
|
10
10
|
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
11
11
|
export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef) {
|
|
12
12
|
var _details$meta, _forbiddenViewProps$c;
|
|
@@ -73,7 +73,7 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
|
|
|
73
73
|
var resolvedBlockViewProps = extractBlockProps(data, meta, {
|
|
74
74
|
handleAnalytics: handleAnalytics,
|
|
75
75
|
handleInvoke: handleInvoke,
|
|
76
|
-
|
|
76
|
+
extensionKey: getExtensionKey(details)
|
|
77
77
|
});
|
|
78
78
|
return /*#__PURE__*/React.createElement(BlockCardResolvedView, _extends({}, resolvedBlockViewProps, {
|
|
79
79
|
isSelected: isSelected,
|
|
@@ -2,4 +2,4 @@ import { BlockCardResolvedViewProps } from '@atlaskit/media-ui';
|
|
|
2
2
|
import { JsonLd } from 'json-ld-types';
|
|
3
3
|
import { InvokeHandler } from '../../../model/invoke-handler';
|
|
4
4
|
import { AnalyticsHandler } from '../../../utils/types';
|
|
5
|
-
export declare const extractPreviewAction: (
|
|
5
|
+
export declare const extractPreviewAction: (extensionKey: string | undefined, viewProps: BlockCardResolvedViewProps, jsonLd: JsonLd.Data.BaseData, handleInvoke: InvokeHandler, handleAnalytics: AnalyticsHandler, testId?: string | undefined, platform?: "web" | "mobile" | undefined) => import("@atlaskit/media-ui").ActionProps | undefined;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export { EmbedResizeMessageListener } from './view/EmbedCard/EmbedResizeMessageL
|
|
|
14
14
|
export { embedHeaderHeight } from '@atlaskit/media-ui/embeds';
|
|
15
15
|
export { SmartLinkEvents } from './utils/analytics/analytics';
|
|
16
16
|
export { useSmartLinkEvents } from './view/SmartLinkEvents/useSmartLinkEvents';
|
|
17
|
-
export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, } from '@atlaskit/media-ui/classNames';
|
|
17
|
+
export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, blockCardResolvedViewByClassName, blockCardForbiddenViewLinkClassName, blockCardContentClassName, blockCardContentHeaderClassName, blockCardContentHeaderNameClassName, blockCardNotFoundViewClassName, blockCardErroredViewClassName, } from '@atlaskit/media-ui/classNames';
|
|
18
18
|
export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomData } from '@atlaskit/ufo';
|
|
2
|
-
declare type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated';
|
|
2
|
+
declare type UfoExperienceName = 'smart-link-rendered' | 'smart-link-authenticated' | 'smart-link-action-invocation';
|
|
3
3
|
export declare const startUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
|
|
4
4
|
export declare const succeedUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
|
|
5
5
|
export declare const failUfoExperience: (experienceName: UfoExperienceName, id: string, properties?: CustomData | undefined) => void;
|
|
@@ -2,12 +2,13 @@ import { AnalyticsHandler } from '../../utils/types';
|
|
|
2
2
|
import { CardInnerAppearance } from '../../view/Card/types';
|
|
3
3
|
import { CardType } from '../store/types';
|
|
4
4
|
import { APIError } from '../../client/errors';
|
|
5
|
+
import { InvokeType } from '../../model/invoke-opts';
|
|
5
6
|
export declare const useSmartLinkAnalytics: (dispatchAnalytics: AnalyticsHandler) => {
|
|
6
7
|
ui: {
|
|
7
8
|
authEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
8
9
|
authAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
9
10
|
cardClickedEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
10
|
-
actionClickedEvent: (
|
|
11
|
+
actionClickedEvent: (id: string, extensionKey: string, actionType: string, display: CardInnerAppearance, invokeType: InvokeType) => void;
|
|
11
12
|
closedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
12
13
|
renderSuccessEvent: (display: CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
13
14
|
};
|
|
@@ -13,7 +13,7 @@ export declare function useSmartLink(id: string, url: string, dispatchAnalytics:
|
|
|
13
13
|
authEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
14
14
|
authAlternateAccountEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
15
15
|
cardClickedEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
16
|
-
actionClickedEvent: (
|
|
16
|
+
actionClickedEvent: (id: string, extensionKey: string, actionType: string, display: import("../../view/Card/types").CardInnerAppearance, invokeType: import("../../model/invoke-opts").InvokeType) => void;
|
|
17
17
|
closedAuthEvent: (display: import("../../view/Card/types").CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
18
18
|
renderSuccessEvent: (display: import("../../view/Card/types").CardInnerAppearance, id: string, definitionId?: string | undefined, extensionKey?: string | undefined) => void;
|
|
19
19
|
};
|
|
@@ -15,15 +15,15 @@ export declare class SmartLinkEvents {
|
|
|
15
15
|
export declare const fireSmartLinkEvent: (payload: AnalyticsPayload, createAnalyticsEvent?: CreateUIAnalyticsEvent | undefined) => void;
|
|
16
16
|
export declare const resolvedEvent: (id: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined) => AnalyticsPayload;
|
|
17
17
|
export declare const unresolvedEvent: (id: string, status: string, definitionId?: string | undefined, extensionKey?: string | undefined, resourceType?: string | undefined, error?: APIError | undefined) => AnalyticsPayload;
|
|
18
|
-
export declare const invokeSucceededEvent: (id: string,
|
|
19
|
-
export declare const invokeFailedEvent: (id: string,
|
|
18
|
+
export declare const invokeSucceededEvent: (id: string, extensionKey: string, actionType: string, display: CardInnerAppearance) => AnalyticsPayload;
|
|
19
|
+
export declare const invokeFailedEvent: (id: string, extensionKey: string, actionType: string, display: CardInnerAppearance, reason: string) => AnalyticsPayload;
|
|
20
20
|
export declare const connectSucceededEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
21
21
|
export declare const connectFailedEvent: (definitionId?: string | undefined, extensionKey?: string | undefined, reason?: string | undefined) => AnalyticsPayload;
|
|
22
22
|
export declare const trackAppAccountConnected: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
23
23
|
export declare const uiAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
24
24
|
export declare const uiAuthAlternateAccountEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
25
25
|
export declare const uiCardClickedEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
26
|
-
export declare const uiActionClickedEvent: (
|
|
26
|
+
export declare const uiActionClickedEvent: (extensionKey: string, actionType: string, display?: "inline" | "block" | "embed" | "preview" | undefined) => AnalyticsPayload;
|
|
27
27
|
export declare const uiClosedAuthEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
28
28
|
export declare const screenAuthPopupEvent: (definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
|
29
29
|
export declare const uiRenderSuccessEvent: (display: CardInnerAppearance, definitionId?: string | undefined, extensionKey?: string | undefined) => AnalyticsPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.3.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -8,18 +8,12 @@
|
|
|
8
8
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"sideEffects": false,
|
|
12
11
|
"main": "dist/cjs/index.js",
|
|
13
12
|
"module": "dist/esm/index.js",
|
|
14
13
|
"module:es2019": "dist/es2019/index.js",
|
|
15
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
+
"sideEffects": false,
|
|
16
16
|
"atlaskit:src": "src/index.ts",
|
|
17
|
-
"af:exports": {
|
|
18
|
-
"./in-product": "./src/in-product.ts",
|
|
19
|
-
"./client": "./src/client/index.ts",
|
|
20
|
-
"./types": "./src/types.ts",
|
|
21
|
-
".": "./src/index.ts"
|
|
22
|
-
},
|
|
23
17
|
"atlassian": {
|
|
24
18
|
"team": "Linking Platform",
|
|
25
19
|
"releaseModel": "scheduled",
|
|
@@ -35,8 +29,8 @@
|
|
|
35
29
|
"@atlaskit/icon-object": "^6.2.0",
|
|
36
30
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
37
31
|
"@atlaskit/logo": "^13.5.0",
|
|
38
|
-
"@atlaskit/media-ui": "^17.
|
|
39
|
-
"@atlaskit/outbound-auth-flow-client": "^3.
|
|
32
|
+
"@atlaskit/media-ui": "^17.2.0",
|
|
33
|
+
"@atlaskit/outbound-auth-flow-client": "^3.3.0",
|
|
40
34
|
"@atlaskit/theme": "^12.0.0",
|
|
41
35
|
"@atlaskit/ufo": "^0.0.6",
|
|
42
36
|
"@babel/runtime": "^7.0.0",
|
|
@@ -64,7 +58,7 @@
|
|
|
64
58
|
"@atlaskit/form": "^8.4.0",
|
|
65
59
|
"@atlaskit/inline-message": "^11.1.0",
|
|
66
60
|
"@atlaskit/lozenge": "^11.1.0",
|
|
67
|
-
"@atlaskit/media-test-helpers": "^28.
|
|
61
|
+
"@atlaskit/media-test-helpers": "^28.9.0",
|
|
68
62
|
"@atlaskit/page": "^12.0.0",
|
|
69
63
|
"@atlaskit/radio": "^5.3.0",
|
|
70
64
|
"@atlaskit/select": "^15.2.0",
|
|
@@ -95,5 +89,11 @@
|
|
|
95
89
|
"typescript": "3.9.6",
|
|
96
90
|
"xhr-mock": "^2.4.0"
|
|
97
91
|
},
|
|
92
|
+
"af:exports": {
|
|
93
|
+
"./in-product": "./src/in-product.ts",
|
|
94
|
+
"./client": "./src/client/index.ts",
|
|
95
|
+
"./types": "./src/types.ts",
|
|
96
|
+
".": "./src/index.ts"
|
|
97
|
+
},
|
|
98
98
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
99
99
|
}
|