@atlaskit/smart-card 41.0.5 → 42.0.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 +19 -0
- package/dist/cjs/extractors/action/extract-invoke-preview-action.js +12 -7
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +9 -16
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/index.js +10 -3
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/SmartLinkEvents/useSmartLinkEvents.js +22 -0
- package/dist/es2019/extractors/action/extract-invoke-preview-action.js +6 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +9 -16
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/index.js +11 -4
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/SmartLinkEvents/useSmartLinkEvents.js +22 -0
- package/dist/esm/extractors/action/extract-invoke-preview-action.js +12 -7
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +9 -16
- package/dist/esm/view/LinkUrl/HyperlinkResolver/index.js +11 -4
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/SmartLinkEvents/useSmartLinkEvents.js +21 -0
- package/dist/types/view/SmartLinkEvents/useSmartLinkEvents.d.ts +1 -0
- package/dist/types-ts4.5/view/SmartLinkEvents/useSmartLinkEvents.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 42.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`ad77adef566c2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ad77adef566c2) -
|
|
8
|
+
For short links on a confluence page, use resolved url for preview panels
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 41.0.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`f339ddf502fde`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f339ddf502fde) -
|
|
19
|
+
Update analytics fire for simplification of code and allow fire for blue hyperlinks
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 41.0.5
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -54,24 +54,29 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
|
|
|
54
54
|
invokeAction: {
|
|
55
55
|
actionFn: function () {
|
|
56
56
|
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
57
|
-
var _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe;
|
|
57
|
+
var resolvedUrl, responseUrl, _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe;
|
|
58
58
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
59
59
|
while (1) switch (_context.prev = _context.next) {
|
|
60
60
|
case 0:
|
|
61
61
|
if (!hasPreviewPanel) {
|
|
62
|
-
_context.next =
|
|
62
|
+
_context.next = 6;
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
+
resolvedUrl = url;
|
|
66
|
+
if ((0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test')) {
|
|
67
|
+
responseUrl = response.data && 'url' in response.data ? response.data.url : undefined;
|
|
68
|
+
resolvedUrl = responseUrl || url;
|
|
69
|
+
}
|
|
65
70
|
openPreviewPanel({
|
|
66
71
|
ari: ari,
|
|
67
|
-
url:
|
|
72
|
+
url: resolvedUrl,
|
|
68
73
|
name: name,
|
|
69
74
|
iconUrl: undefined
|
|
70
75
|
});
|
|
71
|
-
_context.next =
|
|
76
|
+
_context.next = 8;
|
|
72
77
|
break;
|
|
73
|
-
case
|
|
74
|
-
_context.next =
|
|
78
|
+
case 6:
|
|
79
|
+
_context.next = 8;
|
|
75
80
|
return (0, _utils.openEmbedModal)(_objectSpread({
|
|
76
81
|
fireEvent: fireEvent,
|
|
77
82
|
extensionKey: extensionKey,
|
|
@@ -91,7 +96,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
|
|
|
91
96
|
}, (0, _expValEquals.expValEquals)('platform_hover_card_preview_panel', 'cohort', 'test') && {
|
|
92
97
|
isInPreviewPanel: isInPreviewPanel
|
|
93
98
|
}));
|
|
94
|
-
case
|
|
99
|
+
case 8:
|
|
95
100
|
case "end":
|
|
96
101
|
return _context.stop();
|
|
97
102
|
}
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "41.0.
|
|
14
|
+
packageVersion: "41.0.6"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -26,6 +26,7 @@ var _BlockCard = require("../BlockCard");
|
|
|
26
26
|
var _EmbedCard = require("../EmbedCard");
|
|
27
27
|
var _FlexibleCard = _interopRequireDefault(require("../FlexibleCard"));
|
|
28
28
|
var _InlineCard = require("../InlineCard");
|
|
29
|
+
var _useSmartLinkEvents = require("../SmartLinkEvents/useSmartLinkEvents");
|
|
29
30
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
30
31
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
31
32
|
function Component(_ref) {
|
|
@@ -84,6 +85,7 @@ function Component(_ref) {
|
|
|
84
85
|
actionOptions: actionOptionsProp,
|
|
85
86
|
platform: platform
|
|
86
87
|
});
|
|
88
|
+
var fire3PClickEvent = (0, _useSmartLinkEvents.useFire3PWorkflowsClickEvent)(firstPartyIdentifier, thirdPartyARI);
|
|
87
89
|
|
|
88
90
|
// Setup UI handlers.
|
|
89
91
|
var handleClickWrapper = (0, _react.useCallback)(function (event) {
|
|
@@ -97,23 +99,14 @@ function Component(_ref) {
|
|
|
97
99
|
if ((0, _platformFeatureFlags.fg)('platform_smartlink_3pclick_analytics')) {
|
|
98
100
|
if (thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix)) {
|
|
99
101
|
var clickURL = (0, _helpers.getClickUrl)(url, state.details);
|
|
100
|
-
if (clickURL === url) {
|
|
102
|
+
if (clickURL === url && event.button === 0) {
|
|
103
|
+
// We want to verify that left click only triggers this
|
|
104
|
+
// event being fired, not right click, so we check button
|
|
105
|
+
// === 0, which indicates left click as defined here:
|
|
106
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
101
107
|
// For questions or concerns about this event,
|
|
102
108
|
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
103
|
-
|
|
104
|
-
action: 'clicked',
|
|
105
|
-
actionSubject: 'smartLink',
|
|
106
|
-
actionSubjectId: 'smartlinkClickAnalyticsWorkflows',
|
|
107
|
-
eventType: 'ui',
|
|
108
|
-
attributes: {
|
|
109
|
-
eventName: 'smartLinkClickAnalyticsThirdPartyWorkflows',
|
|
110
|
-
firstPartyIdentifier: firstPartyIdentifier
|
|
111
|
-
},
|
|
112
|
-
nonPrivacySafeAttributes: {
|
|
113
|
-
thirdPartyARI: thirdPartyARI
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
smartlinkClickAnalyticsEvent.fire('media');
|
|
109
|
+
fire3PClickEvent();
|
|
117
110
|
}
|
|
118
111
|
}
|
|
119
112
|
}
|
|
@@ -160,7 +153,7 @@ function Component(_ref) {
|
|
|
160
153
|
}
|
|
161
154
|
(0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event);
|
|
162
155
|
}
|
|
163
|
-
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent,
|
|
156
|
+
}, [fireEvent, fire3PClickEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel, thirdPartyARI]);
|
|
164
157
|
var handleAuthorize = (0, _react.useCallback)(function () {
|
|
165
158
|
return actions.authorize(appearance);
|
|
166
159
|
}, [actions, appearance]);
|
|
@@ -19,6 +19,7 @@ var _helpers = require("../../../state/helpers");
|
|
|
19
19
|
var _useResolveHyperlink2 = _interopRequireDefault(require("../../../state/hooks/use-resolve-hyperlink"));
|
|
20
20
|
var _useResolveHyperlinkValidator = _interopRequireWildcard(require("../../../state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator"));
|
|
21
21
|
var _intlProvider = _interopRequireDefault(require("../../common/intl-provider"));
|
|
22
|
+
var _useSmartLinkEvents = require("../../SmartLinkEvents/useSmartLinkEvents");
|
|
22
23
|
var _Hyperlink = _interopRequireDefault(require("../Hyperlink"));
|
|
23
24
|
var _errorBoundary = _interopRequireDefault(require("./error-boundary"));
|
|
24
25
|
var _resolveHyperlink = require("./resolve-hyperlink");
|
|
@@ -43,11 +44,17 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
|
|
|
43
44
|
actions = _useResolveHyperlink.actions,
|
|
44
45
|
state = _useResolveHyperlink.state;
|
|
45
46
|
var services = (0, _helpers.getServices)(state === null || state === void 0 ? void 0 : state.details);
|
|
47
|
+
var thirdPartyARI = (0, _helpers.getThirdPartyARI)(state === null || state === void 0 ? void 0 : state.details);
|
|
48
|
+
var firstPartyIdentifier = (0, _helpers.getFirstPartyIdentifier)();
|
|
49
|
+
var fire3PClickEvent = (0, _useSmartLinkEvents.useFire3PWorkflowsClickEvent)(firstPartyIdentifier, thirdPartyARI);
|
|
46
50
|
var onClick = (0, _react.useCallback)(function (e) {
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
if (state.status === 'resolved' && e.button === 0) {
|
|
52
|
+
// 0 taken from button state representation -
|
|
53
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
54
|
+
fire3PClickEvent();
|
|
55
|
+
}
|
|
49
56
|
onClickCallback === null || onClickCallback === void 0 || onClickCallback(e);
|
|
50
|
-
}, [onClickCallback]);
|
|
57
|
+
}, [onClickCallback, state.status, fire3PClickEvent]);
|
|
51
58
|
|
|
52
59
|
// TODO: AI3W-1113: Show auth button
|
|
53
60
|
var onAuthorize = (0, _platformFeatureFlags.fg)('platform_linking_plain_hyperlink_connect_button') ?
|
|
@@ -25,7 +25,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
25
25
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
26
26
|
var PACKAGE_DATA = {
|
|
27
27
|
packageName: "@atlaskit/smart-card",
|
|
28
|
-
packageVersion: "41.0.
|
|
28
|
+
packageVersion: "41.0.6",
|
|
29
29
|
componentName: 'linkUrl'
|
|
30
30
|
};
|
|
31
31
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.useFire3PWorkflowsClickEvent = useFire3PWorkflowsClickEvent;
|
|
6
7
|
exports.useSmartLinkEvents = useSmartLinkEvents;
|
|
7
8
|
var _react = require("react");
|
|
9
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
8
10
|
var _analytics = require("../../utils/analytics/analytics");
|
|
9
11
|
function useSmartLinkEvents() {
|
|
10
12
|
/**
|
|
@@ -15,4 +17,24 @@ function useSmartLinkEvents() {
|
|
|
15
17
|
return new _analytics.SmartLinkEvents();
|
|
16
18
|
}, []);
|
|
17
19
|
return events;
|
|
20
|
+
}
|
|
21
|
+
function useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI) {
|
|
22
|
+
var _useAnalyticsEventsNe = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
23
|
+
createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
|
|
24
|
+
return function () {
|
|
25
|
+
var smartlinkClickAnalyticsEvent = createAnalyticsEvent({
|
|
26
|
+
action: 'clicked',
|
|
27
|
+
actionSubject: 'smartLink',
|
|
28
|
+
actionSubjectId: 'smartlinkClickAnalyticsWorkflows',
|
|
29
|
+
eventType: 'ui',
|
|
30
|
+
attributes: {
|
|
31
|
+
eventName: 'smartLinkClickAnalyticsThirdPartyWorkflows',
|
|
32
|
+
firstPartyIdentifier: firstPartyIdentifier
|
|
33
|
+
},
|
|
34
|
+
nonPrivacySafeAttributes: {
|
|
35
|
+
thirdPartyARI: thirdPartyARI
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
smartlinkClickAnalyticsEvent.fire('media');
|
|
39
|
+
};
|
|
18
40
|
}
|
|
@@ -44,9 +44,14 @@ export const extractInvokePreviewAction = param => {
|
|
|
44
44
|
invokeAction: {
|
|
45
45
|
actionFn: async () => {
|
|
46
46
|
if (hasPreviewPanel) {
|
|
47
|
+
let resolvedUrl = url;
|
|
48
|
+
if (expValEquals('platform_hover_card_preview_panel', 'cohort', 'test')) {
|
|
49
|
+
const responseUrl = response.data && 'url' in response.data ? response.data.url : undefined;
|
|
50
|
+
resolvedUrl = responseUrl || url;
|
|
51
|
+
}
|
|
47
52
|
openPreviewPanel({
|
|
48
53
|
ari: ari,
|
|
49
|
-
url:
|
|
54
|
+
url: resolvedUrl,
|
|
50
55
|
name: name,
|
|
51
56
|
iconUrl: undefined
|
|
52
57
|
});
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "41.0.
|
|
5
|
+
packageVersion: "41.0.6"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -18,6 +18,7 @@ import { BlockCard } from '../BlockCard';
|
|
|
18
18
|
import { EmbedCard } from '../EmbedCard';
|
|
19
19
|
import FlexibleCard from '../FlexibleCard';
|
|
20
20
|
import { InlineCard } from '../InlineCard';
|
|
21
|
+
import { useFire3PWorkflowsClickEvent } from '../SmartLinkEvents/useSmartLinkEvents';
|
|
21
22
|
const thirdPartyARIPrefix = 'ari:third-party';
|
|
22
23
|
function Component({
|
|
23
24
|
id,
|
|
@@ -77,6 +78,7 @@ function Component({
|
|
|
77
78
|
actionOptions: actionOptionsProp,
|
|
78
79
|
platform
|
|
79
80
|
});
|
|
81
|
+
const fire3PClickEvent = useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI);
|
|
80
82
|
|
|
81
83
|
// Setup UI handlers.
|
|
82
84
|
const handleClickWrapper = useCallback(event => {
|
|
@@ -90,23 +92,14 @@ function Component({
|
|
|
90
92
|
if (fg('platform_smartlink_3pclick_analytics')) {
|
|
91
93
|
if (thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix)) {
|
|
92
94
|
const clickURL = getClickUrl(url, state.details);
|
|
93
|
-
if (clickURL === url) {
|
|
95
|
+
if (clickURL === url && event.button === 0) {
|
|
96
|
+
// We want to verify that left click only triggers this
|
|
97
|
+
// event being fired, not right click, so we check button
|
|
98
|
+
// === 0, which indicates left click as defined here:
|
|
99
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
94
100
|
// For questions or concerns about this event,
|
|
95
101
|
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
96
|
-
|
|
97
|
-
action: 'clicked',
|
|
98
|
-
actionSubject: 'smartLink',
|
|
99
|
-
actionSubjectId: 'smartlinkClickAnalyticsWorkflows',
|
|
100
|
-
eventType: 'ui',
|
|
101
|
-
attributes: {
|
|
102
|
-
eventName: 'smartLinkClickAnalyticsThirdPartyWorkflows',
|
|
103
|
-
firstPartyIdentifier: firstPartyIdentifier
|
|
104
|
-
},
|
|
105
|
-
nonPrivacySafeAttributes: {
|
|
106
|
-
thirdPartyARI: thirdPartyARI
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
smartlinkClickAnalyticsEvent.fire('media');
|
|
102
|
+
fire3PClickEvent();
|
|
110
103
|
}
|
|
111
104
|
}
|
|
112
105
|
}
|
|
@@ -153,7 +146,7 @@ function Component({
|
|
|
153
146
|
}
|
|
154
147
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
155
148
|
}
|
|
156
|
-
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent,
|
|
149
|
+
}, [fireEvent, fire3PClickEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel, thirdPartyARI]);
|
|
157
150
|
const handleAuthorize = useCallback(() => actions.authorize(appearance), [actions, appearance]);
|
|
158
151
|
const handleRetry = useCallback(() => {
|
|
159
152
|
actions.reload();
|
|
@@ -6,10 +6,11 @@ import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
|
6
6
|
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { SmartCardContext } from '../../../state';
|
|
9
|
-
import { getServices } from '../../../state/helpers';
|
|
9
|
+
import { getFirstPartyIdentifier, getServices, getThirdPartyARI } from '../../../state/helpers';
|
|
10
10
|
import useResolveHyperlink from '../../../state/hooks/use-resolve-hyperlink';
|
|
11
11
|
import useResolveHyperlinkValidator, { isGoogleDomain, isSharePointDomain } from '../../../state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator';
|
|
12
12
|
import withIntlProvider from '../../common/intl-provider';
|
|
13
|
+
import { useFire3PWorkflowsClickEvent } from '../../SmartLinkEvents/useSmartLinkEvents';
|
|
13
14
|
import Hyperlink from '../Hyperlink';
|
|
14
15
|
import withErrorBoundary from './error-boundary';
|
|
15
16
|
import { ResolveHyperlink } from './resolve-hyperlink';
|
|
@@ -30,11 +31,17 @@ const HyperlinkWithSmartLinkResolverInner = ({
|
|
|
30
31
|
href: props.href || ''
|
|
31
32
|
});
|
|
32
33
|
const services = getServices(state === null || state === void 0 ? void 0 : state.details);
|
|
34
|
+
const thirdPartyARI = getThirdPartyARI(state === null || state === void 0 ? void 0 : state.details);
|
|
35
|
+
const firstPartyIdentifier = getFirstPartyIdentifier();
|
|
36
|
+
const fire3PClickEvent = useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI);
|
|
33
37
|
const onClick = useCallback(e => {
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
if (state.status === 'resolved' && e.button === 0) {
|
|
39
|
+
// 0 taken from button state representation -
|
|
40
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
41
|
+
fire3PClickEvent();
|
|
42
|
+
}
|
|
36
43
|
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(e);
|
|
37
|
-
}, [onClickCallback]);
|
|
44
|
+
}, [onClickCallback, state.status, fire3PClickEvent]);
|
|
38
45
|
|
|
39
46
|
// TODO: AI3W-1113: Show auth button
|
|
40
47
|
const onAuthorize = fg('platform_linking_plain_hyperlink_connect_button') ?
|
|
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
13
13
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
14
14
|
const PACKAGE_DATA = {
|
|
15
15
|
packageName: "@atlaskit/smart-card",
|
|
16
|
-
packageVersion: "41.0.
|
|
16
|
+
packageVersion: "41.0.6",
|
|
17
17
|
componentName: 'linkUrl'
|
|
18
18
|
};
|
|
19
19
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
2
3
|
import { SmartLinkEvents } from '../../utils/analytics/analytics';
|
|
3
4
|
export function useSmartLinkEvents() {
|
|
4
5
|
/**
|
|
@@ -7,4 +8,25 @@ export function useSmartLinkEvents() {
|
|
|
7
8
|
*/
|
|
8
9
|
const events = useMemo(() => new SmartLinkEvents(), []);
|
|
9
10
|
return events;
|
|
11
|
+
}
|
|
12
|
+
export function useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI) {
|
|
13
|
+
const {
|
|
14
|
+
createAnalyticsEvent
|
|
15
|
+
} = useAnalyticsEventsNext();
|
|
16
|
+
return () => {
|
|
17
|
+
const smartlinkClickAnalyticsEvent = createAnalyticsEvent({
|
|
18
|
+
action: 'clicked',
|
|
19
|
+
actionSubject: 'smartLink',
|
|
20
|
+
actionSubjectId: 'smartlinkClickAnalyticsWorkflows',
|
|
21
|
+
eventType: 'ui',
|
|
22
|
+
attributes: {
|
|
23
|
+
eventName: 'smartLinkClickAnalyticsThirdPartyWorkflows',
|
|
24
|
+
firstPartyIdentifier: firstPartyIdentifier
|
|
25
|
+
},
|
|
26
|
+
nonPrivacySafeAttributes: {
|
|
27
|
+
thirdPartyARI: thirdPartyARI
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
smartlinkClickAnalyticsEvent.fire('media');
|
|
31
|
+
};
|
|
10
32
|
}
|
|
@@ -47,24 +47,29 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
|
|
|
47
47
|
invokeAction: {
|
|
48
48
|
actionFn: function () {
|
|
49
49
|
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
50
|
-
var _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe;
|
|
50
|
+
var resolvedUrl, responseUrl, _extractSmartLinkProv, _extractSmartLinkEmbe, _actionOptions$previe;
|
|
51
51
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
52
52
|
while (1) switch (_context.prev = _context.next) {
|
|
53
53
|
case 0:
|
|
54
54
|
if (!hasPreviewPanel) {
|
|
55
|
-
_context.next =
|
|
55
|
+
_context.next = 6;
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
|
+
resolvedUrl = url;
|
|
59
|
+
if (expValEquals('platform_hover_card_preview_panel', 'cohort', 'test')) {
|
|
60
|
+
responseUrl = response.data && 'url' in response.data ? response.data.url : undefined;
|
|
61
|
+
resolvedUrl = responseUrl || url;
|
|
62
|
+
}
|
|
58
63
|
openPreviewPanel({
|
|
59
64
|
ari: ari,
|
|
60
|
-
url:
|
|
65
|
+
url: resolvedUrl,
|
|
61
66
|
name: name,
|
|
62
67
|
iconUrl: undefined
|
|
63
68
|
});
|
|
64
|
-
_context.next =
|
|
69
|
+
_context.next = 8;
|
|
65
70
|
break;
|
|
66
|
-
case
|
|
67
|
-
_context.next =
|
|
71
|
+
case 6:
|
|
72
|
+
_context.next = 8;
|
|
68
73
|
return openEmbedModal(_objectSpread({
|
|
69
74
|
fireEvent: fireEvent,
|
|
70
75
|
extensionKey: extensionKey,
|
|
@@ -84,7 +89,7 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
|
|
|
84
89
|
}, expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && {
|
|
85
90
|
isInPreviewPanel: isInPreviewPanel
|
|
86
91
|
}));
|
|
87
|
-
case
|
|
92
|
+
case 8:
|
|
88
93
|
case "end":
|
|
89
94
|
return _context.stop();
|
|
90
95
|
}
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "41.0.
|
|
7
|
+
packageVersion: "41.0.6"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -18,6 +18,7 @@ import { BlockCard } from '../BlockCard';
|
|
|
18
18
|
import { EmbedCard } from '../EmbedCard';
|
|
19
19
|
import FlexibleCard from '../FlexibleCard';
|
|
20
20
|
import { InlineCard } from '../InlineCard';
|
|
21
|
+
import { useFire3PWorkflowsClickEvent } from '../SmartLinkEvents/useSmartLinkEvents';
|
|
21
22
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
22
23
|
function Component(_ref) {
|
|
23
24
|
var id = _ref.id,
|
|
@@ -75,6 +76,7 @@ function Component(_ref) {
|
|
|
75
76
|
actionOptions: actionOptionsProp,
|
|
76
77
|
platform: platform
|
|
77
78
|
});
|
|
79
|
+
var fire3PClickEvent = useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI);
|
|
78
80
|
|
|
79
81
|
// Setup UI handlers.
|
|
80
82
|
var handleClickWrapper = useCallback(function (event) {
|
|
@@ -88,23 +90,14 @@ function Component(_ref) {
|
|
|
88
90
|
if (fg('platform_smartlink_3pclick_analytics')) {
|
|
89
91
|
if (thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix)) {
|
|
90
92
|
var clickURL = getClickUrl(url, state.details);
|
|
91
|
-
if (clickURL === url) {
|
|
93
|
+
if (clickURL === url && event.button === 0) {
|
|
94
|
+
// We want to verify that left click only triggers this
|
|
95
|
+
// event being fired, not right click, so we check button
|
|
96
|
+
// === 0, which indicates left click as defined here:
|
|
97
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
92
98
|
// For questions or concerns about this event,
|
|
93
99
|
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
94
|
-
|
|
95
|
-
action: 'clicked',
|
|
96
|
-
actionSubject: 'smartLink',
|
|
97
|
-
actionSubjectId: 'smartlinkClickAnalyticsWorkflows',
|
|
98
|
-
eventType: 'ui',
|
|
99
|
-
attributes: {
|
|
100
|
-
eventName: 'smartLinkClickAnalyticsThirdPartyWorkflows',
|
|
101
|
-
firstPartyIdentifier: firstPartyIdentifier
|
|
102
|
-
},
|
|
103
|
-
nonPrivacySafeAttributes: {
|
|
104
|
-
thirdPartyARI: thirdPartyARI
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
smartlinkClickAnalyticsEvent.fire('media');
|
|
100
|
+
fire3PClickEvent();
|
|
108
101
|
}
|
|
109
102
|
}
|
|
110
103
|
}
|
|
@@ -151,7 +144,7 @@ function Component(_ref) {
|
|
|
151
144
|
}
|
|
152
145
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
153
146
|
}
|
|
154
|
-
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent,
|
|
147
|
+
}, [fireEvent, fire3PClickEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel, thirdPartyARI]);
|
|
155
148
|
var handleAuthorize = useCallback(function () {
|
|
156
149
|
return actions.authorize(appearance);
|
|
157
150
|
}, [actions, appearance]);
|
|
@@ -8,10 +8,11 @@ import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
|
8
8
|
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { SmartCardContext } from '../../../state';
|
|
11
|
-
import { getServices } from '../../../state/helpers';
|
|
11
|
+
import { getFirstPartyIdentifier, getServices, getThirdPartyARI } from '../../../state/helpers';
|
|
12
12
|
import useResolveHyperlink from '../../../state/hooks/use-resolve-hyperlink';
|
|
13
13
|
import useResolveHyperlinkValidator, { isGoogleDomain, isSharePointDomain } from '../../../state/hooks/use-resolve-hyperlink/useResolveHyperlinkValidator';
|
|
14
14
|
import withIntlProvider from '../../common/intl-provider';
|
|
15
|
+
import { useFire3PWorkflowsClickEvent } from '../../SmartLinkEvents/useSmartLinkEvents';
|
|
15
16
|
import Hyperlink from '../Hyperlink';
|
|
16
17
|
import withErrorBoundary from './error-boundary';
|
|
17
18
|
import { ResolveHyperlink } from './resolve-hyperlink';
|
|
@@ -34,11 +35,17 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
|
|
|
34
35
|
actions = _useResolveHyperlink.actions,
|
|
35
36
|
state = _useResolveHyperlink.state;
|
|
36
37
|
var services = getServices(state === null || state === void 0 ? void 0 : state.details);
|
|
38
|
+
var thirdPartyARI = getThirdPartyARI(state === null || state === void 0 ? void 0 : state.details);
|
|
39
|
+
var firstPartyIdentifier = getFirstPartyIdentifier();
|
|
40
|
+
var fire3PClickEvent = useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI);
|
|
37
41
|
var onClick = useCallback(function (e) {
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
if (state.status === 'resolved' && e.button === 0) {
|
|
43
|
+
// 0 taken from button state representation -
|
|
44
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
45
|
+
fire3PClickEvent();
|
|
46
|
+
}
|
|
40
47
|
onClickCallback === null || onClickCallback === void 0 || onClickCallback(e);
|
|
41
|
-
}, [onClickCallback]);
|
|
48
|
+
}, [onClickCallback, state.status, fire3PClickEvent]);
|
|
42
49
|
|
|
43
50
|
// TODO: AI3W-1113: Show auth button
|
|
44
51
|
var onAuthorize = fg('platform_linking_plain_hyperlink_connect_button') ?
|
|
@@ -16,7 +16,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
16
16
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
17
17
|
var PACKAGE_DATA = {
|
|
18
18
|
packageName: "@atlaskit/smart-card",
|
|
19
|
-
packageVersion: "41.0.
|
|
19
|
+
packageVersion: "41.0.6",
|
|
20
20
|
componentName: 'linkUrl'
|
|
21
21
|
};
|
|
22
22
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
2
3
|
import { SmartLinkEvents } from '../../utils/analytics/analytics';
|
|
3
4
|
export function useSmartLinkEvents() {
|
|
4
5
|
/**
|
|
@@ -9,4 +10,24 @@ export function useSmartLinkEvents() {
|
|
|
9
10
|
return new SmartLinkEvents();
|
|
10
11
|
}, []);
|
|
11
12
|
return events;
|
|
13
|
+
}
|
|
14
|
+
export function useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI) {
|
|
15
|
+
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
16
|
+
createAnalyticsEvent = _useAnalyticsEventsNe.createAnalyticsEvent;
|
|
17
|
+
return function () {
|
|
18
|
+
var smartlinkClickAnalyticsEvent = createAnalyticsEvent({
|
|
19
|
+
action: 'clicked',
|
|
20
|
+
actionSubject: 'smartLink',
|
|
21
|
+
actionSubjectId: 'smartlinkClickAnalyticsWorkflows',
|
|
22
|
+
eventType: 'ui',
|
|
23
|
+
attributes: {
|
|
24
|
+
eventName: 'smartLinkClickAnalyticsThirdPartyWorkflows',
|
|
25
|
+
firstPartyIdentifier: firstPartyIdentifier
|
|
26
|
+
},
|
|
27
|
+
nonPrivacySafeAttributes: {
|
|
28
|
+
thirdPartyARI: thirdPartyARI
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
smartlinkClickAnalyticsEvent.fire('media');
|
|
32
|
+
};
|
|
12
33
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { SmartLinkEvents } from '../../utils/analytics/analytics';
|
|
2
2
|
export declare function useSmartLinkEvents(): SmartLinkEvents;
|
|
3
|
+
export declare function useFire3PWorkflowsClickEvent(firstPartyIdentifier: string | undefined, thirdPartyARI: string | undefined): () => void;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { SmartLinkEvents } from '../../utils/analytics/analytics';
|
|
2
2
|
export declare function useSmartLinkEvents(): SmartLinkEvents;
|
|
3
|
+
export declare function useFire3PWorkflowsClickEvent(firstPartyIdentifier: string | undefined, thirdPartyARI: string | undefined): () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "42.0.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/css": "^0.14.0",
|
|
38
38
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
39
39
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
40
|
-
"@atlaskit/form": "^12.
|
|
40
|
+
"@atlaskit/form": "^12.7.0",
|
|
41
41
|
"@atlaskit/frontend-utilities": "^3.1.0",
|
|
42
42
|
"@atlaskit/heading": "^5.2.0",
|
|
43
43
|
"@atlaskit/icon": "^28.2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@atlaskit/textarea": "^8.0.0",
|
|
70
70
|
"@atlaskit/textfield": "^8.0.0",
|
|
71
71
|
"@atlaskit/theme": "^21.0.0",
|
|
72
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
72
|
+
"@atlaskit/tmp-editor-statsig": "^12.25.0",
|
|
73
73
|
"@atlaskit/tokens": "^6.3.0",
|
|
74
74
|
"@atlaskit/tooltip": "^20.4.0",
|
|
75
75
|
"@atlaskit/ufo": "^0.4.0",
|