@atlaskit/smart-card 30.3.4 → 30.4.1
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/messages.js +3 -3
- package/dist/cjs/state/actions/index.js +4 -11
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +6 -81
- package/dist/cjs/utils/analytics/analytics.js +104 -216
- package/dist/cjs/utils/analytics/index.js +0 -12
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +3 -11
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +2 -9
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +11 -31
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +10 -39
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +2 -10
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +1 -98
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/messages.js +3 -3
- package/dist/es2019/state/actions/index.js +4 -11
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +3 -78
- package/dist/es2019/utils/analytics/analytics.js +1 -118
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -12
- package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +2 -9
- package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +11 -31
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +10 -39
- package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +2 -10
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +1 -79
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/messages.js +3 -3
- package/dist/esm/state/actions/index.js +4 -11
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +8 -83
- package/dist/esm/utils/analytics/analytics.js +103 -215
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -12
- package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +2 -9
- package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +11 -31
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +10 -39
- package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +2 -10
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +1 -98
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +1 -49
- package/dist/types/state/hooks/useSmartLink.d.ts +0 -16
- package/dist/types/utils/analytics/analytics.d.ts +1 -32
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/analytics/types.d.ts +0 -1
- package/dist/types/utils/mocks.d.ts +0 -16
- package/dist/types/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +1 -1
- package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +1 -49
- package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +0 -16
- package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -32
- package/dist/types-ts4.5/utils/analytics/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/analytics/types.d.ts +0 -1
- package/dist/types-ts4.5/utils/mocks.d.ts +0 -16
- package/dist/types-ts4.5/view/HoverCard/components/views/unauthorised/index.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +1 -1
- package/package.json +7 -10
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "30.
|
|
7
|
+
packageVersion: "30.4.1"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -204,123 +204,6 @@ export const connectFailedEvent = ({
|
|
|
204
204
|
location
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* @deprecated
|
|
210
|
-
*/
|
|
211
|
-
export const trackAppAccountConnected = ({
|
|
212
|
-
definitionId,
|
|
213
|
-
extensionKey,
|
|
214
|
-
destinationProduct,
|
|
215
|
-
destinationSubproduct,
|
|
216
|
-
location
|
|
217
|
-
}) => ({
|
|
218
|
-
action: 'connected',
|
|
219
|
-
actionSubject: 'applicationAccount',
|
|
220
|
-
eventType: 'track',
|
|
221
|
-
attributes: {
|
|
222
|
-
...context,
|
|
223
|
-
definitionId,
|
|
224
|
-
extensionKey,
|
|
225
|
-
destinationProduct,
|
|
226
|
-
destinationSubproduct,
|
|
227
|
-
location
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* @deprecated
|
|
233
|
-
*/
|
|
234
|
-
export const trackAppAccountAuthStarted = ({
|
|
235
|
-
extensionKey,
|
|
236
|
-
location
|
|
237
|
-
}) => ({
|
|
238
|
-
action: 'authStarted',
|
|
239
|
-
actionSubject: 'applicationAccount',
|
|
240
|
-
eventType: 'track',
|
|
241
|
-
attributes: {
|
|
242
|
-
...context,
|
|
243
|
-
extensionKey,
|
|
244
|
-
location
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* @deprecated
|
|
250
|
-
*/
|
|
251
|
-
export const trackSmartLinkQuickActionStarted = ({
|
|
252
|
-
smartLinkActionType,
|
|
253
|
-
...attributes
|
|
254
|
-
}) => {
|
|
255
|
-
var _SmartLinkActionTypeT;
|
|
256
|
-
return {
|
|
257
|
-
action: 'started',
|
|
258
|
-
actionSubject: 'smartLinkQuickAction',
|
|
259
|
-
eventType: 'track',
|
|
260
|
-
attributes: {
|
|
261
|
-
...context,
|
|
262
|
-
...attributes,
|
|
263
|
-
smartLinkActionType: (_SmartLinkActionTypeT = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT !== void 0 ? _SmartLinkActionTypeT : smartLinkActionType
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @deprecated
|
|
270
|
-
*/
|
|
271
|
-
export const trackSmartLinkQuickActionSuccess = ({
|
|
272
|
-
smartLinkActionType,
|
|
273
|
-
...attributes
|
|
274
|
-
}) => {
|
|
275
|
-
var _SmartLinkActionTypeT2;
|
|
276
|
-
return {
|
|
277
|
-
action: 'success',
|
|
278
|
-
actionSubject: 'smartLinkQuickAction',
|
|
279
|
-
eventType: 'track',
|
|
280
|
-
attributes: {
|
|
281
|
-
...context,
|
|
282
|
-
...attributes,
|
|
283
|
-
smartLinkActionType: (_SmartLinkActionTypeT2 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT2 !== void 0 ? _SmartLinkActionTypeT2 : smartLinkActionType
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* @deprecated
|
|
290
|
-
*/
|
|
291
|
-
export const trackSmartLinkQuickActionFailed = ({
|
|
292
|
-
smartLinkActionType,
|
|
293
|
-
...attributes
|
|
294
|
-
}) => {
|
|
295
|
-
var _SmartLinkActionTypeT3;
|
|
296
|
-
return {
|
|
297
|
-
action: 'failed',
|
|
298
|
-
actionSubject: 'smartLinkQuickAction',
|
|
299
|
-
eventType: 'track',
|
|
300
|
-
attributes: {
|
|
301
|
-
...context,
|
|
302
|
-
...attributes,
|
|
303
|
-
smartLinkActionType: (_SmartLinkActionTypeT3 = SmartLinkActionTypeTrackingEventMapper[smartLinkActionType]) !== null && _SmartLinkActionTypeT3 !== void 0 ? _SmartLinkActionTypeT3 : smartLinkActionType
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* @deprecated
|
|
310
|
-
*/
|
|
311
|
-
export const trackHoverCardResolutionStarted = ({
|
|
312
|
-
display,
|
|
313
|
-
...attributes
|
|
314
|
-
}) => ({
|
|
315
|
-
action: 'resolved',
|
|
316
|
-
actionSubject: 'hoverCard',
|
|
317
|
-
eventType: 'track',
|
|
318
|
-
attributes: {
|
|
319
|
-
...context,
|
|
320
|
-
...attributes,
|
|
321
|
-
display
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
207
|
export const uiAuthEvent = ({
|
|
325
208
|
definitionId,
|
|
326
209
|
extensionKey,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getMeasure } from '../performance';
|
|
2
2
|
import { resolvedEvent, unresolvedEvent } from './analytics';
|
|
3
|
-
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, chunkloadFailedEvent, connectSucceededEvent, connectFailedEvent,
|
|
3
|
+
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, chunkloadFailedEvent, connectSucceededEvent, connectFailedEvent, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, uiLearnMoreLinkClickedEvent, uiSmartLinkStatusLozengeButtonClicked, uiSmartLinkStatusListItemButtonClicked, uiSmartLinkStatusOpenPreviewButtonClicked } from './analytics';
|
|
4
4
|
export const instrumentEvent = ({
|
|
5
5
|
id,
|
|
6
6
|
status,
|
|
@@ -9,10 +9,9 @@ import { useCallback, useMemo } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
11
11
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { useAnalyticsEvents } from '../../../../common/analytics/generated/use-analytics-events';
|
|
14
13
|
import { messages } from '../../../../messages';
|
|
15
|
-
import {
|
|
14
|
+
import { hasAuthScopeOverrides } from '../../../../state/helpers';
|
|
16
15
|
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
17
16
|
import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
|
|
18
17
|
import UnresolvedView from './unresolved-view';
|
|
@@ -34,13 +33,12 @@ const FlexibleUnauthorisedView = ({
|
|
|
34
33
|
testId = 'smart-block-unauthorized-view',
|
|
35
34
|
...props
|
|
36
35
|
}) => {
|
|
37
|
-
var
|
|
36
|
+
var _cardState$details, _extractProvider;
|
|
38
37
|
const {
|
|
39
38
|
analytics,
|
|
40
39
|
cardState,
|
|
41
40
|
onAuthorize
|
|
42
41
|
} = props;
|
|
43
|
-
const extensionKey = (_getExtensionKey = getExtensionKey(cardState === null || cardState === void 0 ? void 0 : cardState.details)) !== null && _getExtensionKey !== void 0 ? _getExtensionKey : '';
|
|
44
42
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
45
43
|
const providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
|
|
46
44
|
const isProductIntegrationSupported = hasAuthScopeOverrides(cardState === null || cardState === void 0 ? void 0 : cardState.details);
|
|
@@ -49,16 +47,10 @@ const FlexibleUnauthorisedView = ({
|
|
|
49
47
|
} = useAnalyticsEvents();
|
|
50
48
|
const handleAuthorize = useCallback(() => {
|
|
51
49
|
if (onAuthorize) {
|
|
52
|
-
|
|
53
|
-
fireEvent('track.applicationAccount.authStarted', {});
|
|
54
|
-
} else {
|
|
55
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
|
|
56
|
-
extensionKey
|
|
57
|
-
});
|
|
58
|
-
}
|
|
50
|
+
fireEvent('track.applicationAccount.authStarted', {});
|
|
59
51
|
onAuthorize();
|
|
60
52
|
}
|
|
61
|
-
}, [onAuthorize,
|
|
53
|
+
}, [onAuthorize, fireEvent]);
|
|
62
54
|
const content = useMemo(() => onAuthorize ? jsx(UnauthorisedViewContent, {
|
|
63
55
|
providerName: providerName,
|
|
64
56
|
isProductIntegrationSupported: isProductIntegrationSupported,
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import Button from '@atlaskit/button';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { useAnalyticsEvents } from '../../../../common/analytics/generated/use-analytics-events';
|
|
7
6
|
import { messages } from '../../../../messages';
|
|
8
7
|
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
@@ -23,16 +22,10 @@ const UnauthorizedView = ({
|
|
|
23
22
|
} = useAnalyticsEvents();
|
|
24
23
|
const handleOnAuthorizeClick = useCallback(() => {
|
|
25
24
|
if (onAuthorize) {
|
|
26
|
-
|
|
27
|
-
fireEvent('track.applicationAccount.authStarted', {});
|
|
28
|
-
} else {
|
|
29
|
-
analytics.track.appAccountAuthStarted({
|
|
30
|
-
extensionKey
|
|
31
|
-
});
|
|
32
|
-
}
|
|
25
|
+
fireEvent('track.applicationAccount.authStarted', {});
|
|
33
26
|
onAuthorize();
|
|
34
27
|
}
|
|
35
|
-
}, [onAuthorize,
|
|
28
|
+
}, [onAuthorize, fireEvent]);
|
|
36
29
|
const content = useMemo(() => {
|
|
37
30
|
if (onAuthorize) {
|
|
38
31
|
var _context$text;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
5
4
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
6
5
|
import useInvoke from '../../../../../../state/hooks/use-invoke';
|
|
@@ -30,26 +29,14 @@ const ServerAction = ({
|
|
|
30
29
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkServerActionClickedEvent({
|
|
31
30
|
smartLinkActionType
|
|
32
31
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
39
|
-
smartLinkActionType
|
|
40
|
-
});
|
|
41
|
-
}
|
|
32
|
+
fireEvent('track.smartLinkQuickAction.started', {
|
|
33
|
+
smartLinkActionType
|
|
34
|
+
});
|
|
42
35
|
const request = createInvokeRequest(action);
|
|
43
36
|
await invoke(request);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
} else {
|
|
49
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
50
|
-
smartLinkActionType
|
|
51
|
-
});
|
|
52
|
-
}
|
|
37
|
+
fireEvent('track.smartLinkQuickAction.success', {
|
|
38
|
+
smartLinkActionType
|
|
39
|
+
});
|
|
53
40
|
if (action.reload && action.reload.url) {
|
|
54
41
|
await reload(action.reload.url, true, undefined, action.reload.id);
|
|
55
42
|
}
|
|
@@ -59,21 +46,14 @@ const ServerAction = ({
|
|
|
59
46
|
}
|
|
60
47
|
} catch (err) {
|
|
61
48
|
setIsLoading(false);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed({
|
|
69
|
-
smartLinkActionType,
|
|
70
|
-
reason: getInvokeFailureReason(err)
|
|
71
|
-
});
|
|
72
|
-
}
|
|
49
|
+
fireEvent('track.smartLinkQuickAction.failed', {
|
|
50
|
+
smartLinkActionType,
|
|
51
|
+
reason: getInvokeFailureReason(err)
|
|
52
|
+
});
|
|
73
53
|
onErrorCallback === null || onErrorCallback === void 0 ? void 0 : onErrorCallback();
|
|
74
54
|
}
|
|
75
55
|
}
|
|
76
|
-
}, [action, analytics === null || analytics === void 0 ? void 0 : analytics.
|
|
56
|
+
}, [action, analytics === null || analytics === void 0 ? void 0 : analytics.ui, invoke, onClick, onErrorCallback, reload, fireEvent]);
|
|
77
57
|
return /*#__PURE__*/React.createElement(Action, _extends({}, props, {
|
|
78
58
|
isLoading: isLoading,
|
|
79
59
|
onClick: handleClick
|
|
@@ -8,7 +8,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
10
|
import DropdownMenu from '@atlaskit/dropdown-menu';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
13
12
|
import extractLozengeActionItems from '../../../../../../extractors/action/extract-lozenge-action-items';
|
|
14
13
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
@@ -65,15 +64,9 @@ const LozengeAction = ({
|
|
|
65
64
|
setIsOpen(args.isOpen);
|
|
66
65
|
if (args.isOpen) {
|
|
67
66
|
analytics === null || analytics === void 0 ? void 0 : analytics.ui.smartLinkLozengeActionClickedEvent();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionStarted({
|
|
74
|
-
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
75
|
-
});
|
|
76
|
-
}
|
|
67
|
+
fireEvent('track.smartLinkQuickAction.started', {
|
|
68
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
69
|
+
});
|
|
77
70
|
if (!isLoaded && action !== null && action !== void 0 && action.read) {
|
|
78
71
|
try {
|
|
79
72
|
setIsLoading(true);
|
|
@@ -82,22 +75,14 @@ const LozengeAction = ({
|
|
|
82
75
|
setItems(validItems);
|
|
83
76
|
setIsLoaded(true);
|
|
84
77
|
if ((validItems === null || validItems === void 0 ? void 0 : validItems.length) === 0) {
|
|
85
|
-
|
|
86
|
-
fireEvent('track.smartLinkQuickAction.failed', permissionLoadErrorAnalyticsPayload);
|
|
87
|
-
} else {
|
|
88
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(permissionLoadErrorAnalyticsPayload);
|
|
89
|
-
}
|
|
78
|
+
fireEvent('track.smartLinkQuickAction.failed', permissionLoadErrorAnalyticsPayload);
|
|
90
79
|
setErrorMessage(LozengeActionErrorMessages.noData);
|
|
91
80
|
setIsLoaded(false);
|
|
92
81
|
}
|
|
93
82
|
} catch (err) {
|
|
94
83
|
setErrorMessage(LozengeActionErrorMessages.unknown);
|
|
95
84
|
setIsLoaded(false);
|
|
96
|
-
|
|
97
|
-
fireEvent('track.smartLinkQuickAction.failed', unknownLoadErrorAnalyticsPayload);
|
|
98
|
-
} else {
|
|
99
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(unknownLoadErrorAnalyticsPayload);
|
|
100
|
-
}
|
|
85
|
+
fireEvent('track.smartLinkQuickAction.failed', unknownLoadErrorAnalyticsPayload);
|
|
101
86
|
} finally {
|
|
102
87
|
setIsLoading(false);
|
|
103
88
|
}
|
|
@@ -129,15 +114,9 @@ const LozengeAction = ({
|
|
|
129
114
|
setIsLoaded(false);
|
|
130
115
|
setIsOpen(false);
|
|
131
116
|
setItems([]);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
} else {
|
|
137
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionSuccess({
|
|
138
|
-
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
139
|
-
});
|
|
140
|
-
}
|
|
117
|
+
fireEvent('track.smartLinkQuickAction.success', {
|
|
118
|
+
smartLinkActionType: TrackQuickActionType.StatusUpdate
|
|
119
|
+
});
|
|
141
120
|
if (url) {
|
|
142
121
|
await reload(url, true, undefined, linkId);
|
|
143
122
|
}
|
|
@@ -146,18 +125,10 @@ const LozengeAction = ({
|
|
|
146
125
|
setIsLoading(false);
|
|
147
126
|
if (isInvokeCustomError(err)) {
|
|
148
127
|
setErrorMessage(err.message);
|
|
149
|
-
|
|
150
|
-
fireEvent('track.smartLinkQuickAction.failed', validationUpdateErrorAnalyticsPayload);
|
|
151
|
-
} else {
|
|
152
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(validationUpdateErrorAnalyticsPayload);
|
|
153
|
-
}
|
|
128
|
+
fireEvent('track.smartLinkQuickAction.failed', validationUpdateErrorAnalyticsPayload);
|
|
154
129
|
} else {
|
|
155
130
|
setErrorMessage(LozengeActionErrorMessages.updateFailed);
|
|
156
|
-
|
|
157
|
-
fireEvent('track.smartLinkQuickAction.failed', unknownUpdateErrorAnalyticsPayload);
|
|
158
|
-
} else {
|
|
159
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.smartLinkQuickActionFailed(unknownUpdateErrorAnalyticsPayload);
|
|
160
|
-
}
|
|
131
|
+
fireEvent('track.smartLinkQuickAction.failed', unknownUpdateErrorAnalyticsPayload);
|
|
161
132
|
}
|
|
162
133
|
}
|
|
163
134
|
}, [action === null || action === void 0 ? void 0 : action.update, analytics, invoke, linkId, reload, url, fireEvent]);
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import { extractProvider } from '@atlaskit/link-extractors';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
7
6
|
import { ActionName, CardDisplay } from '../../../../../constants';
|
|
8
7
|
import { messages } from '../../../../../messages';
|
|
@@ -16,7 +15,6 @@ import { LinkIcon } from '../../../../FlexibleCard/components/elements';
|
|
|
16
15
|
import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
|
|
17
16
|
const HoverCardUnauthorisedView = ({
|
|
18
17
|
analytics,
|
|
19
|
-
extensionKey,
|
|
20
18
|
id = '',
|
|
21
19
|
flexibleCardProps,
|
|
22
20
|
testId = 'hover-card-unauthorised-view',
|
|
@@ -37,16 +35,10 @@ const HoverCardUnauthorisedView = ({
|
|
|
37
35
|
} = useAnalyticsEvents();
|
|
38
36
|
const handleAuthorize = useCallback(() => {
|
|
39
37
|
if (authorize) {
|
|
40
|
-
|
|
41
|
-
fireEvent('track.applicationAccount.authStarted', {});
|
|
42
|
-
} else {
|
|
43
|
-
analytics.track.appAccountAuthStarted({
|
|
44
|
-
extensionKey
|
|
45
|
-
});
|
|
46
|
-
}
|
|
38
|
+
fireEvent('track.applicationAccount.authStarted', {});
|
|
47
39
|
authorize(CardDisplay.HoverCardPreview);
|
|
48
40
|
}
|
|
49
|
-
}, [authorize,
|
|
41
|
+
}, [authorize, fireEvent]);
|
|
50
42
|
const actions = useMemo(() => [{
|
|
51
43
|
name: ActionName.CustomAction,
|
|
52
44
|
content: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
5
4
|
import Button from '@atlaskit/button';
|
|
6
5
|
import LockIcon from '@atlaskit/icon/glyph/lock-filled';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
import { N500, R400 } from '@atlaskit/theme/colors';
|
|
9
7
|
import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
|
|
10
8
|
import { messages } from '../../../messages';
|
|
@@ -19,7 +17,7 @@ const FallbackUnauthorizedIcon = /*#__PURE__*/React.createElement(AKIconWrapper,
|
|
|
19
17
|
size: "small",
|
|
20
18
|
primaryColor: `var(--ds-icon-danger, ${R400})`
|
|
21
19
|
}));
|
|
22
|
-
const
|
|
20
|
+
export const InlineCardUnauthorizedView = ({
|
|
23
21
|
url,
|
|
24
22
|
id,
|
|
25
23
|
icon,
|
|
@@ -75,80 +73,4 @@ const InlineCardUnauthorizedViewNew = ({
|
|
|
75
73
|
}, inlineCardUnauthenticatedView);
|
|
76
74
|
}
|
|
77
75
|
return inlineCardUnauthenticatedView;
|
|
78
|
-
};
|
|
79
|
-
class InlineCardUnauthorizedViewOld extends React.Component {
|
|
80
|
-
constructor(...args) {
|
|
81
|
-
super(...args);
|
|
82
|
-
_defineProperty(this, "frameRef", /*#__PURE__*/React.createRef());
|
|
83
|
-
_defineProperty(this, "handleConnectAccount", event => {
|
|
84
|
-
const {
|
|
85
|
-
analytics,
|
|
86
|
-
extensionKey,
|
|
87
|
-
onAuthorise
|
|
88
|
-
} = this.props;
|
|
89
|
-
event.preventDefault();
|
|
90
|
-
event.stopPropagation();
|
|
91
|
-
if (onAuthorise) {
|
|
92
|
-
analytics === null || analytics === void 0 ? void 0 : analytics.track.appAccountAuthStarted({
|
|
93
|
-
extensionKey
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return onAuthorise();
|
|
97
|
-
});
|
|
98
|
-
_defineProperty(this, "renderActionButton", () => {
|
|
99
|
-
const {
|
|
100
|
-
onAuthorise,
|
|
101
|
-
context
|
|
102
|
-
} = this.props;
|
|
103
|
-
const ActionButton = withFrameStyleControl(Button, this.frameRef);
|
|
104
|
-
return onAuthorise ? /*#__PURE__*/React.createElement(ActionButton, {
|
|
105
|
-
spacing: "none",
|
|
106
|
-
component: IconStyledButton,
|
|
107
|
-
onClick: this.handleConnectAccount,
|
|
108
|
-
testId: "button-connect-account"
|
|
109
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_link_account_card_name, {
|
|
110
|
-
values: {
|
|
111
|
-
context
|
|
112
|
-
}
|
|
113
|
-
}))) : undefined;
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
render() {
|
|
117
|
-
const {
|
|
118
|
-
url,
|
|
119
|
-
icon,
|
|
120
|
-
onAuthorise,
|
|
121
|
-
onClick,
|
|
122
|
-
isSelected,
|
|
123
|
-
testId = 'inline-card-unauthorized-view',
|
|
124
|
-
showAuthTooltip = false,
|
|
125
|
-
truncateInline
|
|
126
|
-
} = this.props;
|
|
127
|
-
const inlineCardUnauthenticatedView = /*#__PURE__*/React.createElement(Frame, {
|
|
128
|
-
testId: testId,
|
|
129
|
-
isSelected: isSelected,
|
|
130
|
-
ref: this.frameRef,
|
|
131
|
-
truncateInline: truncateInline
|
|
132
|
-
}, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
|
|
133
|
-
icon: icon ? icon : FallbackUnauthorizedIcon,
|
|
134
|
-
title: url,
|
|
135
|
-
link: url,
|
|
136
|
-
onClick: onClick,
|
|
137
|
-
titleColor: `var(--ds-text-subtle, ${N500})`
|
|
138
|
-
}), this.renderActionButton());
|
|
139
|
-
if (onAuthorise && showAuthTooltip) {
|
|
140
|
-
return /*#__PURE__*/React.createElement(HoverCard, {
|
|
141
|
-
url: url,
|
|
142
|
-
id: this.props.id
|
|
143
|
-
}, inlineCardUnauthenticatedView);
|
|
144
|
-
}
|
|
145
|
-
return inlineCardUnauthenticatedView;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
export const InlineCardUnauthorizedView = props => {
|
|
149
|
-
if (fg('smart-card-migrate-track-analytics')) {
|
|
150
|
-
return /*#__PURE__*/React.createElement(InlineCardUnauthorizedViewNew, props);
|
|
151
|
-
} else {
|
|
152
|
-
return /*#__PURE__*/React.createElement(InlineCardUnauthorizedViewOld, props);
|
|
153
|
-
}
|
|
154
76
|
};
|
|
@@ -7,7 +7,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
7
7
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "30.
|
|
10
|
+
packageVersion: "30.4.1",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
package/dist/esm/messages.js
CHANGED
|
@@ -67,7 +67,7 @@ export var messages = defineMessages({
|
|
|
67
67
|
},
|
|
68
68
|
automation_action_title: {
|
|
69
69
|
id: 'fabric.linking.automation-action.title',
|
|
70
|
-
defaultMessage: 'View automation rules
|
|
70
|
+
defaultMessage: 'View automation rules',
|
|
71
71
|
description: 'The title of the button in a hover card to open an automation menu for a given SmartLink.'
|
|
72
72
|
},
|
|
73
73
|
automation_action_icon_label: {
|
|
@@ -706,8 +706,8 @@ export var messages = defineMessages({
|
|
|
706
706
|
description: 'Shown as the title for the related links modal'
|
|
707
707
|
},
|
|
708
708
|
related_links_view_related_urls: {
|
|
709
|
-
id: 'fabric.linking.related_links_view_related_urls
|
|
710
|
-
defaultMessage: 'View recent links
|
|
709
|
+
id: 'fabric.linking.related_links_view_related_urls',
|
|
710
|
+
defaultMessage: 'View recent links',
|
|
711
711
|
description: 'Action to view related links to the given resource'
|
|
712
712
|
},
|
|
713
713
|
related_links_found_in: {
|
|
@@ -124,16 +124,9 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
auth(services[0].url).then(function () {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
} else {
|
|
132
|
-
analytics.track.appAccountConnected({
|
|
133
|
-
definitionId: definitionId,
|
|
134
|
-
extensionKey: extensionKey
|
|
135
|
-
});
|
|
136
|
-
}
|
|
127
|
+
fireEvent('track.applicationAccount.connected', {
|
|
128
|
+
definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null
|
|
129
|
+
});
|
|
137
130
|
analytics.operational.connectSucceededEvent({
|
|
138
131
|
id: id,
|
|
139
132
|
definitionId: definitionId,
|
|
@@ -157,7 +150,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url, analytics
|
|
|
157
150
|
reload();
|
|
158
151
|
});
|
|
159
152
|
}
|
|
160
|
-
}, [getSmartLinkState, analytics.ui, analytics.screen, analytics.
|
|
153
|
+
}, [getSmartLinkState, analytics.ui, analytics.screen, analytics.operational, id, reload, fireEvent]);
|
|
161
154
|
var invoke = useCallback( /*#__PURE__*/function () {
|
|
162
155
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(opts, appearance) {
|
|
163
156
|
var key, action, source;
|