@atlaskit/smart-card 42.0.0 → 42.0.2
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 +16 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +16 -9
- package/dist/cjs/view/LinkUrl/HyperlinkResolver/index.js +3 -10
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/SmartLinkEvents/useSmartLinkEvents.js +0 -22
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +16 -9
- package/dist/es2019/view/LinkUrl/HyperlinkResolver/index.js +4 -11
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/SmartLinkEvents/useSmartLinkEvents.js +0 -22
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +16 -9
- package/dist/esm/view/LinkUrl/HyperlinkResolver/index.js +4 -11
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/SmartLinkEvents/useSmartLinkEvents.js +0 -21
- package/dist/types/view/SmartLinkEvents/useSmartLinkEvents.d.ts +0 -1
- package/dist/types-ts4.5/view/SmartLinkEvents/useSmartLinkEvents.d.ts +0 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 42.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`45c6f8d40f9ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/45c6f8d40f9ac) -
|
|
8
|
+
Bump i18n pkg versions for atlaskit packages for including license field
|
|
9
|
+
|
|
10
|
+
## 42.0.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`2bcf051004790`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2bcf051004790) -
|
|
15
|
+
Reverting "Update analytics fire for simplification of code and allow fire for blue hyperlinks"
|
|
16
|
+
change
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 42.0.0
|
|
4
20
|
|
|
5
21
|
### Major Changes
|
|
@@ -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: "
|
|
14
|
+
packageVersion: "0.0.0-development"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -26,7 +26,6 @@ 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");
|
|
30
29
|
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); }
|
|
31
30
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
32
31
|
function Component(_ref) {
|
|
@@ -85,7 +84,6 @@ function Component(_ref) {
|
|
|
85
84
|
actionOptions: actionOptionsProp,
|
|
86
85
|
platform: platform
|
|
87
86
|
});
|
|
88
|
-
var fire3PClickEvent = (0, _useSmartLinkEvents.useFire3PWorkflowsClickEvent)(firstPartyIdentifier, thirdPartyARI);
|
|
89
87
|
|
|
90
88
|
// Setup UI handlers.
|
|
91
89
|
var handleClickWrapper = (0, _react.useCallback)(function (event) {
|
|
@@ -99,14 +97,23 @@ function Component(_ref) {
|
|
|
99
97
|
if ((0, _platformFeatureFlags.fg)('platform_smartlink_3pclick_analytics')) {
|
|
100
98
|
if (thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix)) {
|
|
101
99
|
var clickURL = (0, _helpers.getClickUrl)(url, state.details);
|
|
102
|
-
if (clickURL === url
|
|
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
|
|
100
|
+
if (clickURL === url) {
|
|
107
101
|
// For questions or concerns about this event,
|
|
108
102
|
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
109
|
-
|
|
103
|
+
var smartlinkClickAnalyticsEvent = createAnalyticsEvent({
|
|
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');
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
119
|
}
|
|
@@ -153,7 +160,7 @@ function Component(_ref) {
|
|
|
153
160
|
}
|
|
154
161
|
(0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event);
|
|
155
162
|
}
|
|
156
|
-
}, [fireEvent,
|
|
163
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, thirdPartyARI, firstPartyIdentifier, disablePreviewPanel]);
|
|
157
164
|
var handleAuthorize = (0, _react.useCallback)(function () {
|
|
158
165
|
return actions.authorize(appearance);
|
|
159
166
|
}, [actions, appearance]);
|
|
@@ -19,7 +19,6 @@ 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");
|
|
23
22
|
var _Hyperlink = _interopRequireDefault(require("../Hyperlink"));
|
|
24
23
|
var _errorBoundary = _interopRequireDefault(require("./error-boundary"));
|
|
25
24
|
var _resolveHyperlink = require("./resolve-hyperlink");
|
|
@@ -44,17 +43,11 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
|
|
|
44
43
|
actions = _useResolveHyperlink.actions,
|
|
45
44
|
state = _useResolveHyperlink.state;
|
|
46
45
|
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);
|
|
50
46
|
var onClick = (0, _react.useCallback)(function (e) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
54
|
-
fire3PClickEvent();
|
|
55
|
-
}
|
|
47
|
+
// TODO: AI3W-1203: 3P link click analytics
|
|
48
|
+
|
|
56
49
|
onClickCallback === null || onClickCallback === void 0 || onClickCallback(e);
|
|
57
|
-
}, [onClickCallback
|
|
50
|
+
}, [onClickCallback]);
|
|
58
51
|
|
|
59
52
|
// TODO: AI3W-1113: Show auth button
|
|
60
53
|
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: "
|
|
28
|
+
packageVersion: "0.0.0-development",
|
|
29
29
|
componentName: 'linkUrl'
|
|
30
30
|
};
|
|
31
31
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useFire3PWorkflowsClickEvent = useFire3PWorkflowsClickEvent;
|
|
7
6
|
exports.useSmartLinkEvents = useSmartLinkEvents;
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
8
|
var _analytics = require("../../utils/analytics/analytics");
|
|
11
9
|
function useSmartLinkEvents() {
|
|
12
10
|
/**
|
|
@@ -17,24 +15,4 @@ function useSmartLinkEvents() {
|
|
|
17
15
|
return new _analytics.SmartLinkEvents();
|
|
18
16
|
}, []);
|
|
19
17
|
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
|
-
};
|
|
40
18
|
}
|
|
@@ -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: "
|
|
5
|
+
packageVersion: "0.0.0-development"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -18,7 +18,6 @@ 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';
|
|
22
21
|
const thirdPartyARIPrefix = 'ari:third-party';
|
|
23
22
|
function Component({
|
|
24
23
|
id,
|
|
@@ -78,7 +77,6 @@ function Component({
|
|
|
78
77
|
actionOptions: actionOptionsProp,
|
|
79
78
|
platform
|
|
80
79
|
});
|
|
81
|
-
const fire3PClickEvent = useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI);
|
|
82
80
|
|
|
83
81
|
// Setup UI handlers.
|
|
84
82
|
const handleClickWrapper = useCallback(event => {
|
|
@@ -92,14 +90,23 @@ function Component({
|
|
|
92
90
|
if (fg('platform_smartlink_3pclick_analytics')) {
|
|
93
91
|
if (thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix)) {
|
|
94
92
|
const clickURL = getClickUrl(url, state.details);
|
|
95
|
-
if (clickURL === url
|
|
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
|
|
93
|
+
if (clickURL === url) {
|
|
100
94
|
// For questions or concerns about this event,
|
|
101
95
|
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
102
|
-
|
|
96
|
+
const smartlinkClickAnalyticsEvent = createAnalyticsEvent({
|
|
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');
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
}
|
|
@@ -146,7 +153,7 @@ function Component({
|
|
|
146
153
|
}
|
|
147
154
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
148
155
|
}
|
|
149
|
-
}, [fireEvent,
|
|
156
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, thirdPartyARI, firstPartyIdentifier, disablePreviewPanel]);
|
|
150
157
|
const handleAuthorize = useCallback(() => actions.authorize(appearance), [actions, appearance]);
|
|
151
158
|
const handleRetry = useCallback(() => {
|
|
152
159
|
actions.reload();
|
|
@@ -6,11 +6,10 @@ 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 {
|
|
9
|
+
import { getServices } 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';
|
|
14
13
|
import Hyperlink from '../Hyperlink';
|
|
15
14
|
import withErrorBoundary from './error-boundary';
|
|
16
15
|
import { ResolveHyperlink } from './resolve-hyperlink';
|
|
@@ -31,17 +30,11 @@ const HyperlinkWithSmartLinkResolverInner = ({
|
|
|
31
30
|
href: props.href || ''
|
|
32
31
|
});
|
|
33
32
|
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);
|
|
37
33
|
const onClick = useCallback(e => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
41
|
-
fire3PClickEvent();
|
|
42
|
-
}
|
|
34
|
+
// TODO: AI3W-1203: 3P link click analytics
|
|
35
|
+
|
|
43
36
|
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(e);
|
|
44
|
-
}, [onClickCallback
|
|
37
|
+
}, [onClickCallback]);
|
|
45
38
|
|
|
46
39
|
// TODO: AI3W-1113: Show auth button
|
|
47
40
|
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: "
|
|
16
|
+
packageVersion: "0.0.0-development",
|
|
17
17
|
componentName: 'linkUrl'
|
|
18
18
|
};
|
|
19
19
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
2
|
import { SmartLinkEvents } from '../../utils/analytics/analytics';
|
|
4
3
|
export function useSmartLinkEvents() {
|
|
5
4
|
/**
|
|
@@ -8,25 +7,4 @@ export function useSmartLinkEvents() {
|
|
|
8
7
|
*/
|
|
9
8
|
const events = useMemo(() => new SmartLinkEvents(), []);
|
|
10
9
|
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
|
-
};
|
|
32
10
|
}
|
|
@@ -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: "
|
|
7
|
+
packageVersion: "0.0.0-development"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -18,7 +18,6 @@ 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';
|
|
22
21
|
var thirdPartyARIPrefix = 'ari:third-party';
|
|
23
22
|
function Component(_ref) {
|
|
24
23
|
var id = _ref.id,
|
|
@@ -76,7 +75,6 @@ function Component(_ref) {
|
|
|
76
75
|
actionOptions: actionOptionsProp,
|
|
77
76
|
platform: platform
|
|
78
77
|
});
|
|
79
|
-
var fire3PClickEvent = useFire3PWorkflowsClickEvent(firstPartyIdentifier, thirdPartyARI);
|
|
80
78
|
|
|
81
79
|
// Setup UI handlers.
|
|
82
80
|
var handleClickWrapper = useCallback(function (event) {
|
|
@@ -90,14 +88,23 @@ function Component(_ref) {
|
|
|
90
88
|
if (fg('platform_smartlink_3pclick_analytics')) {
|
|
91
89
|
if (thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix)) {
|
|
92
90
|
var clickURL = getClickUrl(url, state.details);
|
|
93
|
-
if (clickURL === url
|
|
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
|
|
91
|
+
if (clickURL === url) {
|
|
98
92
|
// For questions or concerns about this event,
|
|
99
93
|
// please reach out to the 3P Workflows Team via Slack in #help-3p-connector-workflow
|
|
100
|
-
|
|
94
|
+
var smartlinkClickAnalyticsEvent = createAnalyticsEvent({
|
|
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');
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
}
|
|
@@ -144,7 +151,7 @@ function Component(_ref) {
|
|
|
144
151
|
}
|
|
145
152
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
146
153
|
}
|
|
147
|
-
}, [fireEvent,
|
|
154
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, state.details, ari, name, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, thirdPartyARI, firstPartyIdentifier, disablePreviewPanel]);
|
|
148
155
|
var handleAuthorize = useCallback(function () {
|
|
149
156
|
return actions.authorize(appearance);
|
|
150
157
|
}, [actions, appearance]);
|
|
@@ -8,11 +8,10 @@ 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 {
|
|
11
|
+
import { getServices } 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';
|
|
16
15
|
import Hyperlink from '../Hyperlink';
|
|
17
16
|
import withErrorBoundary from './error-boundary';
|
|
18
17
|
import { ResolveHyperlink } from './resolve-hyperlink';
|
|
@@ -35,17 +34,11 @@ var HyperlinkWithSmartLinkResolverInner = function HyperlinkWithSmartLinkResolve
|
|
|
35
34
|
actions = _useResolveHyperlink.actions,
|
|
36
35
|
state = _useResolveHyperlink.state;
|
|
37
36
|
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);
|
|
41
37
|
var onClick = useCallback(function (e) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
45
|
-
fire3PClickEvent();
|
|
46
|
-
}
|
|
38
|
+
// TODO: AI3W-1203: 3P link click analytics
|
|
39
|
+
|
|
47
40
|
onClickCallback === null || onClickCallback === void 0 || onClickCallback(e);
|
|
48
|
-
}, [onClickCallback
|
|
41
|
+
}, [onClickCallback]);
|
|
49
42
|
|
|
50
43
|
// TODO: AI3W-1113: Show auth button
|
|
51
44
|
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: "
|
|
19
|
+
packageVersion: "0.0.0-development",
|
|
20
20
|
componentName: 'linkUrl'
|
|
21
21
|
};
|
|
22
22
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
3
2
|
import { SmartLinkEvents } from '../../utils/analytics/analytics';
|
|
4
3
|
export function useSmartLinkEvents() {
|
|
5
4
|
/**
|
|
@@ -10,24 +9,4 @@ export function useSmartLinkEvents() {
|
|
|
10
9
|
return new SmartLinkEvents();
|
|
11
10
|
}, []);
|
|
12
11
|
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
|
-
};
|
|
33
12
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
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,3 +1,2 @@
|
|
|
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": "42.0.
|
|
3
|
+
"version": "42.0.2",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"analytics:codegen": "yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card --output ./src/common/analytics/generated"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@atlaskit/afm-i18n-platform-linking-platform-smart-card": "2.
|
|
29
|
+
"@atlaskit/afm-i18n-platform-linking-platform-smart-card": "2.6.0",
|
|
30
30
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
31
31
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
32
32
|
"@atlaskit/avatar": "^25.1.0",
|